-
Notifications
You must be signed in to change notification settings - Fork 326
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
Added ArrayTypeTree and support for annotated dimensions of array types. #3848
Conversation
@knutwannheden, Changes are ready for review. Annotations on C-style arrays are still unsupported:
|
Update: public class A {
Integer o = generic ( 0, 1, 2 );
Integer p = this . < Integer > generic ( 0, 1, 2 );
public <TTTT> TTTT generic(TTTT n, TTTT... ns) { return n; }
}
|
926d905
to
050ca74
Compare
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 haven't looked at the details of the parser yet, but I commented on the LST model already.
a44a522
to
83ed9e2
Compare
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 may have missed it, but I couldn't find the updated AnnotationService
. Apart from that and a few small comments I left, I think this looks very good.
rewrite-java/src/main/java/org/openrewrite/java/tree/Space.java
Outdated
Show resolved
Hide resolved
770d74f
to
be4c910
Compare
rewrite-java/src/main/java/org/openrewrite/java/service/AnnotationService.java
Outdated
Show resolved
Hide resolved
rewrite-java/src/main/java/org/openrewrite/java/service/AnnotationService.java
Outdated
Show resolved
Hide resolved
b7e6950
to
c9f603d
Compare
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 think this looks good now and it looks like there were a few related bugs that could be squashed, which is very nice!
rewrite-java/src/main/java/org/openrewrite/java/service/AnnotationService.java
Outdated
Show resolved
Hide resolved
As a last thing (in a separate PR) wr may want to make sure the type attribution also has all annotations for array types, if it doesn't already. |
Fixed detection of `...` in method declarations. Synced code between Java parsers. Removed ArrayTypeTree and added changes to ArrayType. Changed dimension field from JRightPadded<Space> to JLeftPadded<Space>. Added JavaType.Array arrayType field to J.ArrayType. Removed dimensions from J.ArrayType and added JSON creator. Renamed JavaType.Array field to type. Updated AnnotationService. Updated GroovyParserVisitor. Set the JavaType from old LSTs in the JsonCreator constructor. Updated annotation service and tests. Updated the JsonCreator constructor to set the correct types if the elementType is a JavaType$Array in J.ArrayType. Update rewrite-java/src/main/java/org/openrewrite/java/service/AnnotationService.java Co-authored-by: Knut Wannheden <knut@moderne.io> Polish.
50aa76f
to
7adf4a6
Compare
Rebased and squashed commits |
Sounds good! I did confirm the types are correct on the annotations, but I'll ensure the JavaTypes have the annotations as well. |
Changes:
J.ArrayType#dimensions
field and added a constructor to transform old LSTs into the new model.J.VariableDeclarations#dimensionsBeforeName
...
is preserved in theJ.VariableDeclarations#varargs
field instead of the prefix of the variable name.GroovyParserVisitor
with the newJ.ArrayType
.J.ArrayType
trees produced by the Java parser will now containJavaType.Array
instead ofJavaType.Class
fixes #2911
fixes #3440
fixes #3453