Skip to content
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

Add modifiers to TypeParameter for kotlin #3698

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2433,7 +2433,7 @@ private J.TypeParameter visitTypeParameter(GenericsType genericType) {
.withAfter(EMPTY));
bounds = JContainer.build(boundsPrefix, convertedBounds, Markers.EMPTY);
}
return new J.TypeParameter(randomId(), prefix, Markers.EMPTY, emptyList(), name, bounds);
return new J.TypeParameter(randomId(), prefix, Markers.EMPTY, emptyList(), emptyList(), name, bounds);
}

private J.Wildcard visitWildcard(GenericsType genericType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ public Tree visitParam(ParamTree node, List<Javadoc> body) {
Space.EMPTY,
Markers.EMPTY,
emptyList(),
emptyList(),
visitIdentifier(node.getName(), whitespaceBefore()).withPrefix(namePrefix),
null
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,7 @@ public J visitTypeParameter(TypeParameterTree node, Space fmt) {
JContainer.build(sourceBefore("extends"),
convertAll(node.getBounds(), t -> sourceBefore("&"), noDelim), Markers.EMPTY);

return new J.TypeParameter(randomId(), fmt, Markers.EMPTY, annotations, name, bounds);
return new J.TypeParameter(randomId(), fmt, Markers.EMPTY, annotations, emptyList(), name, bounds);
}

private <T extends TypeTree & Expression> T buildName(String fullyQualifiedName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ public Tree visitParam(ParamTree node, List<Javadoc> body) {
Space.EMPTY,
Markers.EMPTY,
emptyList(),
emptyList(),
visitIdentifier(node.getName(), whitespaceBefore()).withPrefix(namePrefix),
null
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ public J visitTypeParameter(TypeParameterTree node, Space fmt) {
JContainer.build(sourceBefore("extends"),
convertAll(node.getBounds(), t -> sourceBefore("&"), noDelim), Markers.EMPTY);

return new J.TypeParameter(randomId(), fmt, Markers.EMPTY, annotations, name, bounds);
return new J.TypeParameter(randomId(), fmt, Markers.EMPTY, annotations, emptyList(), name, bounds);
}

private <T extends TypeTree & Expression> T buildName(String fullyQualifiedName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ public Tree visitParam(ParamTree node, List<Javadoc> body) {
Space.EMPTY,
Markers.EMPTY,
emptyList(),
emptyList(),
visitIdentifier(node.getName(), whitespaceBefore()).withPrefix(namePrefix),
null
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ public J visitTypeParameter(TypeParameterTree node, Space fmt) {
JContainer.build(sourceBefore("extends"),
convertAll(node.getBounds(), t -> sourceBefore("&"), noDelim), Markers.EMPTY);

return new J.TypeParameter(randomId(), fmt, Markers.EMPTY, annotations, name, bounds);
return new J.TypeParameter(randomId(), fmt, Markers.EMPTY, annotations, emptyList(), name, bounds);
}

private <T extends TypeTree & Expression> T buildName(String fullyQualifiedName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ public Tree visitParam(ParamTree node, List<Javadoc> body) {
Space.EMPTY,
Markers.EMPTY,
emptyList(),
emptyList(),
visitIdentifier(node.getName(), whitespaceBefore()).withPrefix(namePrefix),
null
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ public J visitTypeParameter(TypeParameterTree node, Space fmt) {
JContainer.build(sourceBefore("extends"),
convertAll(node.getBounds(), t -> sourceBefore("&"), noDelim), Markers.EMPTY);

return new J.TypeParameter(randomId(), fmt, Markers.EMPTY, annotations, name, bounds);
return new J.TypeParameter(randomId(), fmt, Markers.EMPTY, annotations, emptyList(), name, bounds);
}

private <T extends TypeTree & Expression> T buildName(String fullyQualifiedName) {
Expand Down
6 changes: 5 additions & 1 deletion rewrite-java/src/main/java/org/openrewrite/java/tree/J.java
Original file line number Diff line number Diff line change
Expand Up @@ -5258,6 +5258,10 @@ final class TypeParameter implements J {
@Getter
List<Annotation> annotations;

@With
@Getter
List<J.Modifier> modifiers;

/**
* Will be either a {@link TypeTree} or {@link Wildcard}. Wildcards aren't possible in
* every context where type parameters may be defined (e.g. not possible on new statements).
Expand Down Expand Up @@ -5308,7 +5312,7 @@ public JContainer<TypeTree> getBounds() {
}

public TypeParameter withBounds(@Nullable JContainer<TypeTree> bounds) {
return t.bounds == bounds ? t : new TypeParameter(t.id, t.prefix, t.markers, t.annotations, t.name, bounds);
return t.bounds == bounds ? t : new TypeParameter(t.id, t.prefix, t.markers, t.annotations, t.modifiers, t.name, bounds);
}
}
}
Expand Down
Loading