-
Bug
-
Resolution: Fixed
-
P3
-
17
-
b10
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment (build 17+35-2724)
OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
TypeMirror's documentation says that a the result of a toString() should try to be valid to use in source code.
/**
* Returns an informative string representation of this type. If
* possible, the string should be of a form suitable for
* representing this type in source code. Any names embedded in
* the result are qualified if possible.
*
* @return a string representation of this type
*/
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Make an annotation whose target is TYPE_USE
@Target({ElementType.TYPE_USE})
@interface ExampleAnn {}
2. Write some code which uses that annotation on a field type
class Example {
@ExampleAnn String abc;
}
3. Obtain a TypeMirror of the VariableElement via an annotation processor.
4. Using .toString() on that TypeMirror
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
java.lang.@ExampleAnn String
ACTUAL -
@ExampleAnn java.lang.String
---------- BEGIN SOURCE ----------
// Code for this requires setting up the scaffolding for an annotation processor
---------- END SOURCE ----------
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment (build 17+35-2724)
OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
TypeMirror's documentation says that a the result of a toString() should try to be valid to use in source code.
/**
* Returns an informative string representation of this type. If
* possible, the string should be of a form suitable for
* representing this type in source code. Any names embedded in
* the result are qualified if possible.
*
* @return a string representation of this type
*/
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Make an annotation whose target is TYPE_USE
@Target({ElementType.TYPE_USE})
@interface ExampleAnn {}
2. Write some code which uses that annotation on a field type
class Example {
@ExampleAnn String abc;
}
3. Obtain a TypeMirror of the VariableElement via an annotation processor.
4. Using .toString() on that TypeMirror
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
java.lang.@ExampleAnn String
ACTUAL -
@ExampleAnn java.lang.String
---------- BEGIN SOURCE ----------
// Code for this requires setting up the scaffolding for an annotation processor
---------- END SOURCE ----------
- relates to
-
JDK-8284220 TypeMirror#toString omits enclosing class names after JDK-8281238
-
- Closed
-
-
JDK-8342934 TYPE_USE annotations printed with error causing "," in toString output
-
- Resolved
-