Fix #289
Some checks failed
Build and Test with Maven / Build-and-test-with-Maven (push) Failing after 3m13s
Some checks failed
Build and Test with Maven / Build-and-test-with-Maven (push) Failing after 3m13s
This commit is contained in:
parent
26452eb5de
commit
83ae05ea4a
11
resources/bytecode/javFiles/TypeCast.jav
Normal file
11
resources/bytecode/javFiles/TypeCast.jav
Normal file
@ -0,0 +1,11 @@
|
||||
import java.lang.Object;
|
||||
import java.lang.Integer;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TypeCast {
|
||||
public void main() {
|
||||
Object a = new ArrayList<Integer>();
|
||||
ArrayList b = (ArrayList) a;
|
||||
}
|
||||
}
|
@ -102,7 +102,8 @@ public class TYPEStmt implements StatementVisitor {
|
||||
|
||||
@Override
|
||||
public void visit(CastExpr castExpr) {
|
||||
throw new NotImplementedException();
|
||||
castExpr.expr.accept(this);
|
||||
constraintsSet.addUndConstraint(new Pair(castExpr.getType(), castExpr.expr.getType(), PairOperator.SMALLERDOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -867,6 +867,13 @@ public class TestComplete {
|
||||
assertEquals(clazzPublic.getDeclaredField("fPrivate").getModifiers(), Modifier.PRIVATE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTypeCast() throws Exception {
|
||||
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "TypeCast.jav");
|
||||
var clazz = classFiles.get("TypeCast");
|
||||
var instance = clazz.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBug122() throws Exception {
|
||||
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Bug122.jav");
|
||||
|
Loading…
Reference in New Issue
Block a user