“38b9c760b078c291d6267551778168f4a3153491”上不存在“zh-cn/contribute/Readme-CN.md”
提交 140774a1 编写于 作者: M mcimadamore

6510286: Wording of javac error for inner classes

Summary: 'inner classes cannot have static declarations' message needs to be reworked
Reviewed-by: jjg
上级 80ef4f44
...@@ -3156,7 +3156,7 @@ public class Attr extends JCTree.Visitor { ...@@ -3156,7 +3156,7 @@ public class Attr extends JCTree.Visitor {
if (sym == null || if (sym == null ||
sym.kind != VAR || sym.kind != VAR ||
((VarSymbol) sym).getConstValue() == null) ((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());
} }
} }
......
...@@ -196,7 +196,8 @@ compiler.err.generic.throwable=\ ...@@ -196,7 +196,8 @@ compiler.err.generic.throwable=\
a generic class may not extend java.lang.Throwable a generic class may not extend java.lang.Throwable
compiler.err.icls.cant.have.static.decl=\ 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=\ compiler.err.illegal.char=\
illegal character: \\{0} illegal character: \\{0}
compiler.err.illegal.char.for.encoding=\ compiler.err.illegal.char.for.encoding=\
......
InnerNamedConstant_2.java:22:20: 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.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: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 4 errors
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册