-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix modelling of array types for annotation processing
A `@C int @A [] @b []` is an '`@A` array of `@B` arrays of `@C int`s'. Turbine was parsing that example as `(ArrayType @b (ArrayType @A (PrimitiveType @C int)))`, and then reversing the list of element types to compute the type path for the annotations in the output, and producing correct class files. The difference was still visible to the annotation processing API, and the wrong type annotations were showing up on `ArrayType#getComponentType` for multi-dimensional arrays. This change fixes the bug by parsing the above example as `(ArrayType @A (ArrayType @b (PrimitiveType @C int)))`. This requires reversing the list when pretty-printing the AST node, but simplifies computation of type_paths, and makes the right annotations show up on `ArrayType#getComponentType`. This also simplifies parsing logic, the handling of trailing 'c-style' dimension specifiers can now be handled by the same logic that parses regular dimension specifiers. Some combinations of multi-variable declarations and c-style arrays still disagree with javac, which has [known bugs](https://bugs.openjdk.org/browse/JDK-8178065) in that area. Finally, the integration test being added here for type annotations and annotation processing will be generalized to also exercise type annotations read from bytecode, to test the fix for b/307310010. PiperOrigin-RevId: 578682527
- Loading branch information
Showing
11 changed files
with
694 additions
and
96 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
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
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
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
Oops, something went wrong.