diff --git a/src/share/classes/com/sun/tools/javac/comp/Attr.java b/src/share/classes/com/sun/tools/javac/comp/Attr.java index c4873d0563ac126a705d890e99f853238e8001c1..2c94bad474d46d2ebcf0308aefccbc8e0c72e252 100644 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -3156,7 +3156,7 @@ public class Attr extends JCTree.Visitor { 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()); } } diff --git a/src/share/classes/com/sun/tools/javac/resources/compiler.properties b/src/share/classes/com/sun/tools/javac/resources/compiler.properties index d3d05bdc6f444e3bae32faa0e4f99476d40f5d6d..6f171cc3373d202e24a5b2ff2c397d4e841729ad 100644 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -196,7 +196,8 @@ compiler.err.generic.throwable=\ 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=\ diff --git a/test/tools/javac/InnerNamedConstant_2.out b/test/tools/javac/InnerNamedConstant_2.out index 659006c8380d4d52fb27e8dccbe827c87bbdde4d..58e5ff55c7a1d899bccc4a05ba4274cdac718096 100644 --- a/test/tools/javac/InnerNamedConstant_2.out +++ b/test/tools/javac/InnerNamedConstant_2.out @@ -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