JDK 9 RFR of 8068639 : Make certain annotation classfile warnings opt-in

joe darcy joe.darcy at oracle.com
Thu Jan 8 01:27:13 UTC 2015


Jon,

On 1/7/2015 5:16 PM, Jonathan Gibbons wrote:
> Joe,
>
> Looks good, but it would be even better to make sure the warnings are 
> not generated if the lint option is not given, as in:
>
> - * @compile/ref=T6214965.out -XDrawDiagnostics 
> CompilerAnnotationTest2bad.java
> + * @compile/ref=T6214965.out -XDrawDiagnostics -Xlint:classfile 
> CompilerAnnotationTest2bad.java
> + * @compile -Werror CompilerAnnotationTest2bad.java

Good point; I've make that change and also added "8068639" to the @bug 
line of both updated tests:

     http://cr.openjdk.java.net/~darcy/8068639.1

Thanks,

-Joe

>
> -- Jon
>
> On 01/07/2015 04:47 PM, joe darcy wrote:
>> Hello,
>>
>> Our EE associates have reported some issues transitioning EE to use 
>> repeating annotations, certain desirable compilation setups lead to 
>> discouraging warnings.
>>
>> Please review this small change to ease the EE migration snag:
>>
>>     JDK-8068639 : Make certain annotation classfile warnings opt-in
>>     http://cr.openjdk.java.net/~darcy/8068639.0/
>>
>> Patch below.
>>
>> The intention is to backport this change to the 8u and 7u trains as 
>> well.
>>
>> Thanks,
>>
>> -Joe
>>
>> --- 
>> old/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java 
>> 2015-01-07 16:07:58.958480591 -0800
>> +++ 
>> new/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java 
>> 2015-01-07 16:07:58.870480591 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All 
>> rights reserved.
>> + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All 
>> rights reserved.
>>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>>   *
>>   * This code is free software; you can redistribute it and/or modify it
>> @@ -1740,15 +1740,17 @@
>>              // The method wasn't found: emit a warning and recover
>>              JavaFileObject prevSource = 
>> log.useSource(requestingOwner.classfile);
>>              try {
>> -                if (failure == null) {
>> -                    log.warning("annotation.method.not.found",
>> -                                container,
>> -                                name);
>> -                } else {
>> - log.warning("annotation.method.not.found.reason",
>> -                                container,
>> -                                name,
>> - failure.getDetailValue());//diagnostic, if present
>> +                if (lintClassfile) {
>> +                    if (failure == null) {
>> + log.warning("annotation.method.not.found",
>> +                                    container,
>> +                                    name);
>> +                    } else {
>> + log.warning("annotation.method.not.found.reason",
>> +                                    container,
>> +                                    name,
>> + failure.getDetailValue());//diagnostic, if present
>> +                    }
>>                  }
>>              } finally {
>>                  log.useSource(prevSource);
>> --- old/test/tools/javac/annotations/6214965/T6214965.java 2015-01-07 
>> 16:07:59.322480591 -0800
>> +++ new/test/tools/javac/annotations/6214965/T6214965.java 2015-01-07 
>> 16:07:59.234480591 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All 
>> rights reserved.
>> + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All 
>> rights reserved.
>>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>>   *
>>   * This code is free software; you can redistribute it and/or modify it
>> @@ -27,5 +27,5 @@
>>   * @summary Compiler crash on redefing nested annotation types
>>   * @compile CompilerAnnotationTest.java CompilerAnnotationTest2.java
>>   * @compile CompilerAnnotationTest2bad.java
>> - * @compile/ref=T6214965.out -XDrawDiagnostics 
>> CompilerAnnotationTest2bad.java
>> + * @compile/ref=T6214965.out -XDrawDiagnostics -Xlint:classfile 
>> CompilerAnnotationTest2bad.java
>>   */
>> --- old/test/tools/javac/annotations/6365854/T6365854.java 2015-01-07 
>> 16:07:59.638480591 -0800
>> +++ new/test/tools/javac/annotations/6365854/T6365854.java 2015-01-07 
>> 16:07:59.546480591 -0800
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All 
>> rights reserved.
>> + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All 
>> rights reserved.
>>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>>   *
>>   * This code is free software; you can redistribute it and/or modify it
>> @@ -33,11 +33,11 @@
>>   *
>>   * @compile TestAnnotation.java TestCore.java
>>   * @clean test.annotation.TestAnnotation
>> - * @compile/ref=test1.out -XDrawDiagnostics T6365854.java
>> + * @compile/ref=test1.out -XDrawDiagnostics -Xlint:classfile 
>> T6365854.java
>>   * @run main T6365854
>> - * @compile/ref=test2.out -XDrawDiagnostics 
>> evolve/TestAnnotation.java T6365854.java
>> + * @compile/ref=test2.out -XDrawDiagnostics -Xlint:classfile 
>> evolve/TestAnnotation.java T6365854.java
>>   * @run main T6365854
>> - * @compile/ref=test2.out -XDrawDiagnostics T6365854.java
>> + * @compile/ref=test2.out -XDrawDiagnostics -Xlint:classfile 
>> T6365854.java
>>   * @run main T6365854
>>   */
>>
>>
>



More information about the compiler-dev mailing list