6510286: Wording of javac error for inner classes

Mon, 24 Jan 2011 15:45:06 +0000

author
mcimadamore
date
Mon, 24 Jan 2011 15:45:06 +0000
changeset 830
02e6e7dd1a64
parent 829
ce6175cfe11e
child 831
812c6251ea78

6510286: Wording of javac error for inner classes
Summary: 'inner classes cannot have static declarations' message needs to be reworked
Reviewed-by: jjg

src/share/classes/com/sun/tools/javac/comp/Attr.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/resources/compiler.properties file | annotate | diff | comparison | revisions
test/tools/javac/InnerNamedConstant_2.out file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Jan 24 15:44:51 2011 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Jan 24 15:45:06 2011 +0000
     1.3 @@ -3156,7 +3156,7 @@
     1.4                  if (sym == null ||
     1.5                      sym.kind != VAR ||
     1.6                      ((VarSymbol) sym).getConstValue() == null)
     1.7 -                    log.error(l.head.pos(), "icls.cant.have.static.decl");
     1.8 +                    log.error(l.head.pos(), "icls.cant.have.static.decl", sym.location());
     1.9              }
    1.10          }
    1.11  
     2.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Jan 24 15:44:51 2011 +0000
     2.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Jan 24 15:45:06 2011 +0000
     2.3 @@ -196,7 +196,8 @@
     2.4      a generic class may not extend java.lang.Throwable
     2.5  
     2.6  compiler.err.icls.cant.have.static.decl=\
     2.7 -    inner classes cannot have static declarations
     2.8 +    Illegal static declaration in inner class {0}\n\
     2.9 +    modifier \''static\'' is only allowed in constant variable declarations
    2.10  compiler.err.illegal.char=\
    2.11      illegal character: \\{0}
    2.12  compiler.err.illegal.char.for.encoding=\
     3.1 --- a/test/tools/javac/InnerNamedConstant_2.out	Mon Jan 24 15:44:51 2011 +0000
     3.2 +++ b/test/tools/javac/InnerNamedConstant_2.out	Mon Jan 24 15:45:06 2011 +0000
     3.3 @@ -1,5 +1,5 @@
     3.4 -InnerNamedConstant_2.java:22:20: compiler.err.icls.cant.have.static.decl
     3.5 -InnerNamedConstant_2.java:23:29: compiler.err.icls.cant.have.static.decl
     3.6 +InnerNamedConstant_2.java:22:20: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner2
     3.7 +InnerNamedConstant_2.java:23:29: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner2
     3.8  InnerNamedConstant_2.java:25:13: compiler.err.cant.assign.val.to.final.var: z
     3.9 -InnerNamedConstant_2.java:34:26: compiler.err.icls.cant.have.static.decl
    3.10 +InnerNamedConstant_2.java:34:26: compiler.err.icls.cant.have.static.decl: InnerNamedConstant_2.Inner3
    3.11  4 errors

mercurial