RFR: 8356057: PrintingProcessor (-Xprint) does not print type variable bounds and type annotations for Object supertypes [v3]
Joe Darcy
darcy at openjdk.org
Mon May 5 20:01:51 UTC 2025
On Mon, 5 May 2025 15:15:04 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
>> Consider code like:
>>
>> import java.lang.annotation.*;
>>
>> public class PrintingTest<T extends CharSequence> extends @TA Object {
>> }
>>
>> @Target(ElementType.TYPE_USE)
>> @interface TA {}
>>
>>
>> when using `-Xprint` to print this code, javac produces this:
>>
>> public class PrintingTest<T> {
>>
>> public PrintingTest();
>> }
>>
>> @java.lang.annotation.Target({TYPE_USE})
>> @interface TA {
>> }
>>
>>
>> Note the type variable is missing the bound, and the annotated supertype is missing. This PR proposes to change that to:
>>
>> public class PrintingTest<T extends java.lang.CharSequence> extends java.lang. at TA Object {
>>
>> public PrintingTest();
>> }
>>
>> @java.lang.annotation.Target({TYPE_USE})
>> @interface TA {
>> }
>>
>>
>> Please also review the CSR:
>> https://bugs.openjdk.org/browse/JDK-8356058
>> and the release note:
>> https://bugs.openjdk.org/browse/JDK-8356062
>
> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
>
> Enhancing the test with printing type variables on methods and constructors.
src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java line 796:
> 794: return true;
> 795: }
> 796: return e2.getSuperclass().getKind() != TypeKind.NONE;
I think it would be helpful to include some textual description of the intended semantics here including
"Omit the bound is unannotated java.lang.Object."
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25002#discussion_r2074104883
More information about the compiler-dev
mailing list