typetools / checker-framework-inference

Inference of pluggable types for Java
10 stars 33 forks source link

fix inference-dev script by updating paths to jdk8.jar and AFU lib jars, and also update eclipse project config #78

Closed jyluo closed 6 years ago

jyluo commented 6 years ago

the inference-dev script is not working, and needs to be updated due to changes in CF and AFU's directory structures

whereas the inference script correctly runs and infers for some java source file, the inference-dev script crashes for the same file. the bug can be reproduced by comparing the outputs of these 2 commands:

./scripts/inference --mode infer --checker interning.InterningChecker --solver checkers.inference.solver.MaxSat2TypeSolver testdata/interning/MapAssignment.java

./scripts/inference-dev --mode infer --checker interning.InterningChecker --solver checkers.inference.solver.MaxSat2TypeSolver testdata/interning/MapAssignment.java

example output with inference script:

--- Inferring ---

May 07, 2018 11:04:11 PM checkers.inference.InferenceMain startCheckerFramework
FINE: Starting checker framework with options: [-processor, checkers.inference.InferenceChecker, -Xmaxwarns, 1000, -Xmaxerrs, 1000, -XDignore.symbol.file, -AprintErrorStack, -Awarns, -Xbootclasspath/p:/home/jeff/jsr308/checker-framework-inference/dist/jdk8.jar, testdata/interning/MapAssignment.java]

...

c And the winner is solver1

--- Inference succeeded ---

example output with inference-dev script:

--- Inferring ---

May 07, 2018 11:04:15 PM checkers.inference.InferenceMain startCheckerFramework
FINE: Starting checker framework with options: [-processor, checkers.inference.InferenceChecker, -Xmaxwarns, 1000, -Xmaxerrs, 1000, -XDignore.symbol.file, -AprintErrorStack, -Awarns, -Xbootclasspath/p:/home/jeff/jsr308/checker-framework/jdk/annotated, testdata/interning/MapAssignment.java]

...

INFO: Note: Did not find stub file or files within directory: com-sun.astub /home/jeff/jsr308/checker-framework-inference/com-sun.astub com-sun.astub
Note: Did not find stub file or files within directory: org-jcp.astub /home/jeff/jsr308/checker-framework-inference/org-jcp.astub org-jcp.astub
Note: Did not find stub file or files within directory: org-xml.astub /home/jeff/jsr308/checker-framework-inference/org-xml.astub org-xml.astub
Note: Did not find stub file or files within directory: sun.astub /home/jeff/jsr308/checker-framework-inference/sun.astub sun.astub
warning: You do not seem to be using the distributed annotated JDK.  To fix the problem, supply javac an argument like:  -Xbootclasspath/p:.../checker/dist/ .  Currently using: jdk8.jar
error: SourceChecker.typeProcess: unexpected Throwable (NoClassDefFoundError) while processing testdata/interning/MapAssignment.java; message: com/google/common/collect/HashBiMap
  Compilation unit: testdata/interning/MapAssignment.java
  Last visited tree at line 5 column 1:
  public class MapAssignment {
  Exception: java.lang.NoClassDefFoundError: com/google/common/collect/HashBiMap; Stack trace: scenelib.annotations.io.ASTIndex.<init>(ASTIndex.java:96)
  scenelib.annotations.io.ASTIndex.indexOf(ASTIndex.java:90)
  checkers.inference.util.ASTPathUtil.getASTRecordForPath(ASTPathUtil.java:60)
  checkers.inference.VariableAnnotator.treeToLocation(VariableAnnotator.java:184)
  checkers.inference.VariableAnnotator.treeToLocation(VariableAnnotator.java:202)

...

  checkers.inference.InferenceMain.startCheckerFramework(InferenceMain.java:180)
  checkers.inference.InferenceMain.run(InferenceMain.java:142)
  checkers.inference.InferenceMain.main(InferenceMain.java:114)
1 error
1 warning

--- Inference failed ---

This PR fixes the inference-dev script by updating/adding the paths to the missing jars, adds a sanity check to build.gradle, adding test jars to the dependenciesJar target, and downgrading the version of google.json-simple to 1.1 as version 1.1.1 transitively depends on junit 4.10 which causes source lookup confusion in eclipse.

This PR also updates the eclipse classpath file to output class files in build/classes/java and to use dependencies.jar.

Finally, a brief new chapter is added to README.md on how to import and edit CFI in eclipse.

jyluo commented 6 years ago

Double check whether build is the output dir for gradle and eclipse.

jyluo commented 6 years ago

@wmdietl I think #72 can be merged, however there's a comment regarding creating checker-inference-qual.jar which is left open.

wmdietl commented 6 years ago

Thanks for the fixes!