6510286: Wording of javac error for inner classes
authormcimadamore
Mon, 24 Jan 2011 15:45:06 +0000
changeset 8046 376310825f60
parent 8045 df2ca0edfbaa
child 8047 c7f08cdb5c3c
6510286: Wording of javac error for inner classes Summary: 'inner classes cannot have static declarations' message needs to be reworked Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
langtools/test/tools/javac/InnerNamedConstant_2.out
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Jan 24 15:44:51 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Jan 24 15:45:06 2011 +0000
@@ -3156,7 +3156,7 @@
                 if (sym == null ||
                     sym.kind != VAR ||
                     ((VarSymbol) sym).getConstValue() == null)
-                    log.error(l.head.pos(), "icls.cant.have.static.decl");
+                    log.error(l.head.pos(), "icls.cant.have.static.decl", sym.location());
             }
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Jan 24 15:44:51 2011 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Jan 24 15:45:06 2011 +0000
@@ -196,7 +196,8 @@
     a generic class may not extend java.lang.Throwable
 
 compiler.err.icls.cant.have.static.decl=\
-    inner classes cannot have static declarations
+    Illegal static declaration in inner class {0}\n\
+    modifier \''static\'' is only allowed in constant variable declarations
 compiler.err.illegal.char=\
     illegal character: \\{0}
 compiler.err.illegal.char.for.encoding=\
--- a/langtools/test/tools/javac/InnerNamedConstant_2.out	Mon Jan 24 15:44:51 2011 +0000
+++ b/langtools/test/tools/javac/InnerNamedConstant_2.out	Mon Jan 24 15:45:06 2011 +0000
@@ -1,5 +1,5 @@
-InnerNamedConstant_2.java:22:20: compiler.err.icls.cant.have.static.decl
-InnerNamedConstant_2.java:23:29: compiler.err.icls.cant.have.static.decl
+InnerNamedConstant_2.java:22:20: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner2
+InnerNamedConstant_2.java:23:29: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner2
 InnerNamedConstant_2.java:25:13: compiler.err.cant.assign.val.to.final.var: z
-InnerNamedConstant_2.java:34:26: compiler.err.icls.cant.have.static.decl
+InnerNamedConstant_2.java:34:26: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner3
 4 errors