Skip to content

Commit ff165f9

Browse files
committed
8342934: TYPE_USE annotations printed with error causing "," in toString output
Reviewed-by: iris, vromero
1 parent 0853aee commit ff165f9

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ protected void appendAnnotationsString(StringBuilder sb,
500500
if (prefix) {
501501
sb.append(" ");
502502
}
503-
sb.append(getAnnotationMirrors());
503+
sb.append(getAnnotationMirrors().toString(" "));
504504
sb.append(" ");
505505
}
506506
}

test/langtools/tools/javac/processing/model/type/AnnotatedTypeToString/AnnotatedTypeToString.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 8284220
26+
* @bug 8284220 8342934
2727
* @summary Tests DeclaredType.toString with type annotations present, for example that '@A
2828
* Map.Entry' is printed as 'java.util.@A Map.Entry' (and not '@A java.util.Map.Entry' or
2929
* 'java.util.@A Entry').

test/langtools/tools/javac/processing/model/type/AnnotatedTypeToString/Test.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
@Target(ElementType.TYPE_USE)
3333
@interface A {}
3434

35+
@Retention(RetentionPolicy.RUNTIME)
36+
@Target(ElementType.TYPE_USE)
37+
@interface B {}
38+
3539
public class Test {
3640
static class StaticNested {
3741
static class InnerMostStaticNested {}
@@ -41,8 +45,8 @@ class Inner {
4145
class InnerMost {}
4246
}
4347

44-
@ExpectedToString("[email protected] StaticNested")
45-
@A StaticNested i;
48+
@ExpectedToString("[email protected] @p.B StaticNested")
49+
@A @B StaticNested i;
4650

4751
@ExpectedToString("[email protected] InnerMostStaticNested")
4852
StaticNested.@A InnerMostStaticNested j;

0 commit comments

Comments
 (0)