-
Notifications
You must be signed in to change notification settings - Fork 348
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
Restore ability to use unannotated stub file to override annotations in bytecode #3599
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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,8 @@ | ||
.PHONY: all | ||
|
||
all: clean | ||
$(JAVAC) testpkg/Issue3597B.java | ||
$(JAVAC) -Astubs=issue3597.astub -processor Nullness -sourcepath : -cp . testpkg/Issue3597A.java | ||
|
||
clean: | ||
rm -f testpkg/*.class |
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,7 @@ | ||
package testpkg; | ||
|
||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
||
class Issue3597B { | ||
Object f(); | ||
} |
7 changes: 7 additions & 0 deletions
7
checker/tests/nullness-extra/issue3597/testpkg/Issue3597A.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,7 @@ | ||
package testpkg; | ||
|
||
class Issue3597A { | ||
void f() { | ||
System.err.println(new Issue3597B().f().toString()); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
checker/tests/nullness-extra/issue3597/testpkg/Issue3597B.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,9 @@ | ||
package testpkg; | ||
|
||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
||
class Issue3597B { | ||
@Nullable Object f() { | ||
return new Object(); | ||
} | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The changes in this file should be merged to master in a separate commit. Can you open a separate PR with these changes? I'll merge that PR first, so it's fine to leave these changes in this PR. Also, can you add a test case for this that is unrelated to the other changes in this file?
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.
I agree that would be cleaner. The reason I didn't do it is:
I cannot. The error here only affects the order of the parts of the type that are contained in the javac representation. With respect to arrays, that means that the only parts that are incorrectly ordered are the
[]
s - even the inferred annotations were ordered correctly before. The error only shows up when there are printable, but not inferred, annotations - which javac prints using fully-qualified names. So it's not possible to test these changes without the fix to the stub parser, but fixing the stub parser causes the existing tests to fail (because the algorithm is wrong).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.
What I mean by this is that the
sceneLibRep
and its associated structures in the old code caused inferred annotations on the inner arrays types to be printed in the correct order, even though the array parts themselves (the[]
s and any annotations in the javac types) were printed in the wrong order.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.
Thanks for the explantation. Now I understand why you can't add a test case (or rather why the existing test case didn't fail until the other bugs where fixed). Could you still open a separate PR without a test case? Then we can just merge that one first, then merge this one.
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.
#3601 has these changes