-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConstraintManager source tree fix #137
base: master
Are you sure you want to change the base?
Conversation
This reverts commit 93b0ead.
@@ -167,6 +165,17 @@ private AnnotationLocation getCurrentLocation() { | |||
} | |||
} | |||
|
|||
// visitorState.getPath().getLeaf() caused NullPointerException on some real project | |||
// and doesn't always return correct source tree. Using class tree at least shows which |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
"Using class tree at least shows " is ambiguous -- i.e. the code in this function actually only use class tree when
visitorState.getPath()
isnull
.
Maybe only add a code comment on the else branch to document using class tree is a workaround for whenvisitorState.getPath()
isnull
? -
" and doesn't always return correct source tree": do you have minimum code example for that? Should this be an issue instead of a code comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pull in master
// visitorState.getPath().getLeaf() caused NullPointerException on some real project | ||
// and doesn't always return correct source tree. Using class tree at least shows which | ||
// Java source class there is such unsatisfiable error and also doesn't throw exception | ||
private Tree getCurrentTreeLocation() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add Javadoc
} | ||
|
||
private AnnotationLocation getCurrentLocation() { | ||
private AnnotationLocation getCurrentAnnotationLocation() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Javadoc
if (visitorState.getPath() != null) { | ||
return visitorState.getPath().getLeaf(); | ||
} else { | ||
return visitorState.getClassTree(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add TODOs for both methods - why hitting this case(else branch)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: find a minimum test case
Throw NPE in else branch, and find the project that causes exception.
2026571
to
d307fc6
Compare
Find which projects failed. |
# Conflicts: # src/checkers/inference/model/ConstraintManager.java
Sorry I can't recall how I triggered the NPE at that time, but it should be the time when source code is pre-annotated, and the constraints cannot be satisfied before solver (AlwaysFalseConstraint). Maybe you can close this issue for now, and revisit the problem later in an ad-hoc way. I noticed in the latest master branch that source tree location will be passed from
|
visitorState.getPath().getLeaf()
throwNullPointerException
sometimes, and doesn't always return correct source tree location. Change toClassTree
as a temporary fix. There is an issue related to this: typetools#31