diff --git a/src/test/java/inferWildcards/TestInferWildcardsJavaTx.java b/src/test/java/inferWildcards/TestInferWildcardsJavaTx.java new file mode 100644 index 00000000..b5b7818a --- /dev/null +++ b/src/test/java/inferWildcards/TestInferWildcardsJavaTx.java @@ -0,0 +1,38 @@ +package inferWildcards; + +import java.io.File; + +import javax.tools.JavaCompiler; +import javax.tools.StandardJavaFileManager; +import javax.tools.ToolProvider; + +import org.junit.Before; +import org.junit.Test; + +import de.dhbwstuttgart.core.JavaTXCompiler; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.constraints.Pair; + +public class TestInferWildcardsJavaTx +{ + + private JavaCompiler compiler; + private StandardJavaFileManager fileManager; + + @Before + public void setup () { + compiler = ToolProvider.getSystemJavaCompiler(); + fileManager = compiler.getStandardFileManager(null, null, null); + } + + @Test + public void test () throws Exception { + String resourcePath = System.getProperty("user.dir") + "/src/test/resources/inferWildcards"; + File[] files1 = { new File(resourcePath + "/TestClassWildcards.java") }; + + JavaTXCompiler javaTXCompiler = new JavaTXCompiler(files1); + ConstraintSet constraints = javaTXCompiler.getConstraints(); + System.out.println(constraints); + } + +} diff --git a/src/test/resources/inferWildcards/TestClassWildcards.java b/src/test/resources/inferWildcards/TestClassWildcards.java index 61f16c9c..d413f030 100644 --- a/src/test/resources/inferWildcards/TestClassWildcards.java +++ b/src/test/resources/inferWildcards/TestClassWildcards.java @@ -1,14 +1,17 @@ import java.util.ArrayList; +import java.util.List; +import java.lang.String; +import java.lang.Object; class TestClassWildcards { private List field1; - private int counter; + //private int counter; public TestClassWildcards () { field1 = new ArrayList<>(); - counter = 0; + //counter = 0; } /** @@ -18,8 +21,8 @@ class TestClassWildcards */ public List test (List param1) { List localVar = field1; - field1 = param; - counter++; + field1 = param1; + //counter++; return localVar; }