Fri, 09 Jan 2015 09:27:16 -0800
8068639: Make certain annotation classfile warnings opt-in
Reviewed-by: jjg
1.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Tue Jan 06 14:20:47 2015 -0800 1.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Fri Jan 09 09:27:16 2015 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -1779,15 +1779,17 @@ 1.11 // The method wasn't found: emit a warning and recover 1.12 JavaFileObject prevSource = log.useSource(requestingOwner.classfile); 1.13 try { 1.14 - if (failure == null) { 1.15 - log.warning("annotation.method.not.found", 1.16 - container, 1.17 - name); 1.18 - } else { 1.19 - log.warning("annotation.method.not.found.reason", 1.20 - container, 1.21 - name, 1.22 - failure.getDetailValue());//diagnostic, if present 1.23 + if (lintClassfile) { 1.24 + if (failure == null) { 1.25 + log.warning("annotation.method.not.found", 1.26 + container, 1.27 + name); 1.28 + } else { 1.29 + log.warning("annotation.method.not.found.reason", 1.30 + container, 1.31 + name, 1.32 + failure.getDetailValue()); //diagnostic, if present 1.33 + } 1.34 } 1.35 } finally { 1.36 log.useSource(prevSource);
2.1 --- a/test/tools/javac/annotations/6214965/T6214965.java Tue Jan 06 14:20:47 2015 -0800 2.2 +++ b/test/tools/javac/annotations/6214965/T6214965.java Fri Jan 09 09:27:16 2015 -0800 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -23,9 +23,10 @@ 2.11 2.12 /** 2.13 * @test 2.14 - * @bug 6214965 6365854 2.15 + * @bug 6214965 6365854 8068639 2.16 * @summary Compiler crash on redefing nested annotation types 2.17 * @compile CompilerAnnotationTest.java CompilerAnnotationTest2.java 2.18 * @compile CompilerAnnotationTest2bad.java 2.19 - * @compile/ref=T6214965.out -XDrawDiagnostics CompilerAnnotationTest2bad.java 2.20 + * @compile/ref=T6214965.out -XDrawDiagnostics -Xlint:classfile CompilerAnnotationTest2bad.java 2.21 + * @compile -Werror CompilerAnnotationTest2bad.java 2.22 */
3.1 --- a/test/tools/javac/annotations/6365854/T6365854.java Tue Jan 06 14:20:47 2015 -0800 3.2 +++ b/test/tools/javac/annotations/6365854/T6365854.java Fri Jan 09 09:27:16 2015 -0800 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -23,7 +23,7 @@ 3.11 3.12 /** 3.13 * @test 3.14 - * @bug 6365854 3.15 + * @bug 6365854 8068639 3.16 * @summary javac crashes when compiling against an annotated class 3.17 * @compile TestAnnotation.java TestCore.java 3.18 * @clean test.annotation.TestAnnotation 3.19 @@ -33,11 +33,11 @@ 3.20 * 3.21 * @compile TestAnnotation.java TestCore.java 3.22 * @clean test.annotation.TestAnnotation 3.23 - * @compile/ref=test1.out -XDrawDiagnostics T6365854.java 3.24 + * @compile/ref=test1.out -XDrawDiagnostics -Xlint:classfile T6365854.java 3.25 * @run main T6365854 3.26 - * @compile/ref=test2.out -XDrawDiagnostics evolve/TestAnnotation.java T6365854.java 3.27 + * @compile/ref=test2.out -XDrawDiagnostics -Xlint:classfile evolve/TestAnnotation.java T6365854.java 3.28 * @run main T6365854 3.29 - * @compile/ref=test2.out -XDrawDiagnostics T6365854.java 3.30 + * @compile/ref=test2.out -XDrawDiagnostics -Xlint:classfile T6365854.java 3.31 * @run main T6365854 3.32 */ 3.33