Skip to content

Fix inference script and add a sanity check. #72

Merged
wmdietl merged 5 commits intotypetools:masterfrom
smillst:fixInferenceScript
May 29, 2018
Merged

Fix inference script and add a sanity check. #72
wmdietl merged 5 commits intotypetools:masterfrom
smillst:fixInferenceScript

Conversation

@smillst
Copy link
Member

@smillst smillst commented Mar 2, 2018

Without these changes,

 ./scripts/inference --mode TYPECHECK --checker ostrusted.OsTrustedChecker --solver checkers.inference.solver.PropagationSolver testdata/ostrusted/VarArgs.java

Issued the following errors:

Exception in thread "main" java.lang.RuntimeException: The following files could not be located: /Users/smillst/jsr308/checker-framework-inference/dist/checker-qual.jar
	at org.checkerframework.framework.util.CheckerMain.assertFilesExist(CheckerMain.java:615)
	at org.checkerframework.framework.util.CheckerMain.assertValidState(CheckerMain.java:124)
	at org.checkerframework.framework.util.CheckerMain.<init>(CheckerMain.java:120)
	at checkers.inference.InferenceLauncher.typecheck(InferenceLauncher.java:129)
	at checkers.inference.InferenceLauncher.launch(InferenceLauncher.java:67)
	at checkers.inference.InferenceLauncher.main(InferenceLauncher.java:105)

Then after coping checker-qual.jar to the correct location:

testdata/ostrusted/VarArgs.java:6: error: package ostrusted.qual does not exist
import ostrusted.qual.*;
^
testdata/ostrusted/VarArgs.java:40: error: cannot find symbol
    void test5(List<@OsTrusted String>... args) {
                     ^
  symbol:   class OsTrusted
  location: class TestVarArgs<E>
  where E is a type-variable:
    E extends Object declared in class TestVarArgs
testdata/ostrusted/VarArgs.java:18: error: cannot find symbol
    void test0(@OsTrusted String[]... args) {
                ^
  symbol:   class OsTrusted
  location: class TestVarArgs<E>
  where E is a type-variable:
    E extends Object declared in class TestVarArgs
3 errors

@smillst smillst requested a review from wmdietl March 2, 2018 16:09

final CheckerMain checkerMain = new CheckerMain(InferenceOptions.checkerJar, options);
checkerMain.addToRuntimeClasspath(getInferenceRuntimeJars());
checkerMain.addToClasspath(getInferenceRuntimeJars());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming seems a bit strange now. Do we actually need the runtime jars on both paths?
Isn't it enough to just have checker-qual.jar on the compilation classpath?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are qualifiers that are not in checker-qual.jar such as ostrusted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a checker-inference-qual.jar as the classpath dependency, instead of adding all runtime jars.
Can you add this as a comment here or open an issue?

@wmdietl
Copy link
Member

wmdietl commented Mar 19, 2018

Sorry for not getting to this sooner. After #71 this has some merge issues.

@wmdietl wmdietl assigned smillst and unassigned wmdietl Mar 19, 2018
mernst pushed a commit to mernst/checker-framework-inference that referenced this pull request Apr 4, 2018
…typetools#72)

* Clean up createEquivalentVarConstranit method in VariableAnnotator.

* Fix typo in javadoc. Removed outdate comments.

* Raise an error if the annotation on the given type is neither VarAnno nor real qualifier.
@wmdietl wmdietl merged commit ff84234 into typetools:master May 29, 2018
@wmdietl
Copy link
Member

wmdietl commented May 29, 2018

Thanks for the fixes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants