6510286: Wording of javac error for inner classes

'inner classes cannot have static declarations' message needs to be reworked

Reviewed-by: jjg
This commit is contained in:
Maurizio Cimadamore 2011-01-24 15:45:06 +00:00
parent b77effad6c
commit 13ecf26ded
3 changed files with 6 additions and 5 deletions

View File

@ -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());
}
}

View File

@ -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=\

View File

@ -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