Skip to content

Commit e86b792

Browse files
fix: add space after annotation in typeBounds
1 parent 8dd6737 commit e86b792

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

packages/prettier-plugin-java/src/printers/types-values-and-variables.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class TypesValuesAndVariablesPrettierVisitor extends BaseCstPrettierPrint
9595
segments.push(rejectAndConcat(currentSegment));
9696
currentSegment = [];
9797
} else if (isAnnotationCstNode(token)) {
98-
currentSegment.push(this.visit([token]));
98+
currentSegment.push(this.visit([token]), " ");
9999
} else {
100100
currentSegment.push(token);
101101
if (

packages/prettier-plugin-java/test/unit-test/generic_class/_input.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,10 @@ public <BEAN> List<? super BEAN> getBean(final Class<BEAN> beanClass) {
3535
}
3636

3737
}
38+
39+
public class Foo<T> {
40+
41+
public <U extends @NotNull T> void example(U u) {}
42+
43+
public <U extends com.java.Any.@NotNull T> void example(U u) {}
44+
}

packages/prettier-plugin-java/test/unit-test/generic_class/_output.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,10 @@ public <BEAN> List<? super BEAN> getBean(final Class<BEAN> beanClass) {
2727
return new ArrayList<>();
2828
}
2929
}
30+
31+
public class Foo<T> {
32+
33+
public <U extends @NotNull T> void example(U u) {}
34+
35+
public <U extends com.java.Any.@NotNull T> void example(U u) {}
36+
}

0 commit comments

Comments
 (0)