-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Weitian Xing <xingweitian@gmail.com> Co-authored-by: Baorui Zhou <b42zhou@uwaterloo.ca> Co-authored-by: Jeff Luo <j36luo@uwaterloo.ca> Co-authored-by: Mier Ta <topnessman@sina.com> Co-authored-by: Werner Dietl <wdietl@gmail.com>
- Loading branch information
1 parent
1e566e0
commit e78b5d2
Showing
41 changed files
with
462 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package universe; | ||
|
||
import checkers.inference.test.CFInferenceTest; | ||
import org.checkerframework.framework.test.TestUtilities; | ||
import org.checkerframework.javacutil.Pair; | ||
import org.junit.runners.Parameterized.Parameters; | ||
import universe.solver.UniverseSolverEngine; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class UniverseInferenceTest extends CFInferenceTest { | ||
|
||
public UniverseInferenceTest(File testFile) { | ||
super(testFile, UniverseInferenceChecker.class, "", | ||
"-Anomsgtext", "-Astubs=src/main/java/universe/jdk.astub", "-d", "testTmp", "-doe"); | ||
} | ||
|
||
@Override | ||
public Pair<String, List<String>> getSolverNameAndOptions() { | ||
return Pair.of(UniverseSolverEngine.class.getCanonicalName(), | ||
new ArrayList<String>(Arrays.asList("useGraph=false", "collectStatistic=true"))); | ||
} | ||
|
||
@Override | ||
public boolean useHacks() { | ||
return true; | ||
} | ||
|
||
@Parameters | ||
public static List<File> getTestFiles(){ | ||
List<File> testfiles = new ArrayList<>(); | ||
testfiles.addAll(TestUtilities.findRelativeNestedJavaFiles("tests", "inference")); | ||
return testfiles; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This directory contains test drivers for the two type checkers: | ||
- sub-directory `universe_checker` uses the Checker Framework based checker | ||
- sub-directory `universe_inference_checker` uses the Checker Framework Inference based checker. | ||
|
||
The test drivers in the two directories execute on the same test files and ensure consistent behavior. | ||
All additions and modifications should be performed to both test drivers. |
18 changes: 18 additions & 0 deletions
18
src/test/java/typecheck/universe_checker/UniverseCheckerTestsLostNo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package universe; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
import org.checkerframework.framework.test.CheckerFrameworkPerDirectoryTest; | ||
import org.junit.runners.Parameterized.Parameters; | ||
|
||
public class UniverseCheckerTestsLostNo extends CheckerFrameworkPerDirectoryTest { | ||
public UniverseCheckerTestsLostNo(List <File> testFiles) { | ||
super(testFiles, UniverseChecker.class, "", "-Anomsgtext", "-d", "testTmp"); | ||
} | ||
|
||
@Parameters | ||
public static String [] getTestDirs(){ | ||
return new String[]{"typecheck/lostno"}; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/java/typecheck/universe_checker/UniverseCheckerTestsLostYes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package universe; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
import org.checkerframework.framework.test.CheckerFrameworkPerDirectoryTest; | ||
import org.junit.runners.Parameterized.Parameters; | ||
|
||
public class UniverseCheckerTestsLostYes extends CheckerFrameworkPerDirectoryTest { | ||
public UniverseCheckerTestsLostYes(List <File> testFiles) { | ||
super(testFiles, UniverseChecker.class, "", "-Anomsgtext", "-d", "testTmp"); | ||
} | ||
|
||
@Parameters | ||
public static String [] getTestDirs(){ | ||
return new String[]{"typecheck/lostyes"}; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/java/typecheck/universe_checker/UniverseCheckerTestsStrictPurity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package universe; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
import org.checkerframework.framework.test.CheckerFrameworkPerDirectoryTest; | ||
import org.junit.runners.Parameterized.Parameters; | ||
|
||
public class UniverseCheckerTestsStrictPurity extends CheckerFrameworkPerDirectoryTest { | ||
public UniverseCheckerTestsStrictPurity(List <File> testFiles) { | ||
super(testFiles, UniverseChecker.class, "", "-Anomsgtext", "-Alint=checkStrictPurity", "-d", "testTmp"); | ||
} | ||
|
||
@Parameters | ||
public static String [] getTestDirs(){ | ||
return new String[]{"typecheck/strictpurity"}; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/java/typecheck/universe_checker/UniverseCheckerTestsTopology.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package universe; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
import org.checkerframework.framework.test.CheckerFrameworkPerDirectoryTest; | ||
import org.junit.runners.Parameterized.Parameters; | ||
|
||
public class UniverseCheckerTestsTopology extends CheckerFrameworkPerDirectoryTest { | ||
public UniverseCheckerTestsTopology(List <File> testFiles) { | ||
super(testFiles, UniverseChecker.class, "", "-Anomsgtext", "-AconservativeUninferredTypeArguments", "-d", "testTmp"); | ||
} | ||
|
||
@Parameters | ||
public static String [] getTestDirs(){ | ||
return new String[]{"typecheck/topol"}; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/java/typecheck/universe_inference_checker/UniverseInferenceCheckerTestsLostNo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package universe; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
import org.checkerframework.framework.test.CheckerFrameworkPerDirectoryTest; | ||
import org.junit.runners.Parameterized.Parameters; | ||
|
||
public class UniverseInferenceCheckerTestsLostNo extends CheckerFrameworkPerDirectoryTest { | ||
public UniverseInferenceCheckerTestsLostNo(List <File> testFiles) { | ||
super(testFiles, UniverseInferenceChecker.class, "", "-Anomsgtext", "-d", "testTmp"); | ||
} | ||
|
||
@Parameters | ||
public static String [] getTestDirs(){ | ||
return new String[]{"typecheck/lostno"}; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/java/typecheck/universe_inference_checker/UniverseInferenceCheckerTestsLostYes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package universe; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
import org.checkerframework.framework.test.CheckerFrameworkPerDirectoryTest; | ||
import org.junit.runners.Parameterized.Parameters; | ||
|
||
public class UniverseInferenceCheckerTestsLostYes extends CheckerFrameworkPerDirectoryTest { | ||
public UniverseInferenceCheckerTestsLostYes(List <File> testFiles) { | ||
super(testFiles, UniverseInferenceChecker.class, "", "-Anomsgtext", "-d", "testTmp"); | ||
} | ||
|
||
@Parameters | ||
public static String [] getTestDirs(){ | ||
return new String[]{"typecheck/lostyes"}; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../java/typecheck/universe_inference_checker/UniverseInferenceCheckerTestsStrictPurity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package universe; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
import org.checkerframework.framework.test.CheckerFrameworkPerDirectoryTest; | ||
import org.junit.runners.Parameterized.Parameters; | ||
|
||
public class UniverseInferenceCheckerTestsStrictPurity extends CheckerFrameworkPerDirectoryTest { | ||
public UniverseInferenceCheckerTestsStrictPurity(List <File> testFiles) { | ||
super(testFiles, UniverseInferenceChecker.class, "", "-Anomsgtext", "-Alint=checkStrictPurity", "-d", "testTmp"); | ||
} | ||
|
||
@Parameters | ||
public static String [] getTestDirs(){ | ||
return new String[]{"typecheck/strictpurity"}; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...test/java/typecheck/universe_inference_checker/UniverseInferenceCheckerTestsTopology.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package universe; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
import org.checkerframework.framework.test.CheckerFrameworkPerDirectoryTest; | ||
import org.junit.runners.Parameterized.Parameters; | ||
|
||
public class UniverseInferenceCheckerTestsTopology extends CheckerFrameworkPerDirectoryTest { | ||
public UniverseInferenceCheckerTestsTopology(List <File> testFiles) { | ||
super(testFiles, UniverseInferenceChecker.class, "", "-Anomsgtext", "-AconservativeUninferredTypeArguments", "-d", "testTmp"); | ||
} | ||
|
||
@Parameters | ||
public static String [] getTestDirs(){ | ||
return new String[]{"typecheck/topol"}; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import universe.qual.*; | ||
|
||
public class BottomReceiver { | ||
void foo(char [] a) { | ||
String s = "Hello"; | ||
// :: fixable-error: (assignment.type.incompatible) | ||
a = s.toCharArray(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import universe.qual.*; | ||
|
||
class C { | ||
public C(Object o){} | ||
} | ||
public class ConstructorCall { | ||
Object op; | ||
//:: fixable-error: (assignment.type.incompatible) | ||
//:: fixable-error: (argument.type.incompatible) | ||
C c = new @Rep C(op); | ||
|
||
class C { | ||
public C(Object o){} | ||
} | ||
|
||
void foo(@Peer Object op) { | ||
// :: fixable-error: (argument.type.incompatible) | ||
C c = new @Rep C(op); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import universe.qual.*; | ||
class A { | ||
Object o; | ||
} | ||
|
||
public class FieldAccess { | ||
A a = new A(); | ||
//:: fixable-error: (assignment.type.incompatible) | ||
@Rep Object fo = a.o; | ||
|
||
class A { | ||
Object o; | ||
} | ||
|
||
void foo(A a) { | ||
// :: fixable-error: (assignment.type.incompatible) | ||
@Rep Object fo = a.o; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import java.util.Arrays; | ||
|
||
public class InvalidString { | ||
void foo() { | ||
throwException("" + Arrays.asList("", "")); | ||
} | ||
|
||
void throwException(String s) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,15 @@ | ||
import universe.qual.Self; | ||
import universe.qual.*; | ||
import java.util.List; | ||
class E { | ||
// Type parameter expects @Peer + @Peer Object = @Peer Object | ||
List<Object> le;// If only actual underlying type is the subtype of the declared underlying type, then the qualifier is useless?! | ||
} | ||
|
||
public class Member { | ||
|
||
E e = new E(); | ||
//:: fixable-error: (assignment.type.incompatible) | ||
@Rep List<@Rep Object> l = e.le; | ||
|
||
//@Peer List<@Peer Object> l2 = e.le; | ||
|
||
/* | ||
@Peer List<@Peer String> ln; | ||
@Peer List<@Any String> ln; | ||
@Peer List<@Rep String> ln2 = ln;*/ | ||
/* | ||
@Peer List<@Peer Object> ln; | ||
@Peer List<@Rep Object> ln2 = ln;*/ | ||
void foo(E e) { | ||
// :: fixable-error: (assignment.type.incompatible) | ||
@Rep List<@Rep Object> l = e.le; | ||
} | ||
|
||
class E { | ||
List<Object> le; | ||
} | ||
|
||
} |
Oops, something went wrong.