diff --git a/resources/bytecode/javFiles/Matrix.jav b/resources/bytecode/javFiles/Matrix.jav index f8c426b4..b94c0783 100644 --- a/resources/bytecode/javFiles/Matrix.jav +++ b/resources/bytecode/javFiles/Matrix.jav @@ -1,6 +1,6 @@ import java.util.Vector; import java.lang.Integer; -import java.lang.Float; +//import java.lang.Float; //import java.lang.Byte; //import java.lang.Boolean; diff --git a/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java b/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java index 2857d015..ecd7600f 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java @@ -610,8 +610,8 @@ public class TYPEStmt implements StatementVisitor{ //Fuer Bytecodegenerierung PL 2020-03-09 wird derzeit nicht benutzt ENDE - methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT)); - extendsMethodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT)); + methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.SMALLERDOT)); + extendsMethodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.SMALLERDOT)); Set parameterContraints = generateParameterConstraints(forMethod, assumption, info, resolver); diff --git a/src/test/java/targetast/TestComplete.java b/src/test/java/targetast/TestComplete.java index 1b39618d..34d1370f 100644 --- a/src/test/java/targetast/TestComplete.java +++ b/src/test/java/targetast/TestComplete.java @@ -279,6 +279,32 @@ public class TestComplete { assertEquals(result, instanceOfClass_m3); } + @Test + public void scalarTest() throws Exception { + var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Scalar.jav"); + var scalar = classFiles.get("Scalar"); + + Vector> vv = new Vector<>(); + Vector v1 = new Vector<> (); + v1.addElement(2); + v1.addElement(2); + + var instanceOfClass_s1 = scalar.getDeclaredConstructor(Vector.class).newInstance(v1); + + Vector v2 = new Vector<> (); + v2.addElement(2); + v2.addElement(2); + + var instanceOfClass_s2 = scalar.getDeclaredConstructor(Vector.class).newInstance(v2); + + var mul = scalar.getDeclaredMethod("mul", Vector.class); + var result = mul.invoke(instanceOfClass_s1, instanceOfClass_s2); + System.out.println(instanceOfClass_s1.toString() + " * " + instanceOfClass_s2.toString() + " = " + result.toString()); + + assertEquals(result, 8); + } + + @Test public void mergeTest() throws Exception { var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Merge.jav");