Skip to content

Commit

Permalink
Add test collectionLiteralExpression and fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kunli2 committed Nov 7, 2023
1 parent da8f517 commit 5e9ae7d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2294,7 +2294,7 @@ public J visitDotQualifiedExpression(KtDotQualifiedExpression expression, Execut
.withName(((J.MethodInvocation) methodInvocation).getName().withPrefix(prefix(callExpression)))
.withPrefix(prefix(expression));
} else if (methodInvocation instanceof J.NewClass) {
if (receiver instanceof J.FieldAccess) {
if (receiver instanceof J.FieldAccess || receiver instanceof J.Identifier) {
J.NewClass cur = (J.NewClass) methodInvocation;
if (cur.getClazz() instanceof J.ParameterizedType) {
cur = cur.withPrefix(prefix(expression));
Expand Down
20 changes: 19 additions & 1 deletion src/test/java/org/openrewrite/kotlin/tree/AnnotationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ annotation class B
}

@Test
void AnntationEntryTrailingComma() {
void AnnotationEntryTrailingComma() {
rewriteRun(
spec -> spec.parser(KotlinParser.builder().classpath("jackson-annotations")),
kotlin(
Expand All @@ -492,4 +492,22 @@ public sealed interface Fruit {
)
);
}

@Test
void collectionLiteralExpression() {
rewriteRun(
spec -> spec.parser(KotlinParser.builder().classpath("jackson-annotations")),
kotlin(
"""
import com.fasterxml.jackson.`annotation`.JsonSubTypes
@JsonSubTypes(value = [
JsonSubTypes . Type(value = Employee::class, name = "Employee")
])
public sealed interface Person {
}
"""
)
);
}
}

0 comments on commit 5e9ae7d

Please sign in to comment.