--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Sep 06 13:13:35 2018 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Sep 06 05:44:47 2018 -0700
@@ -1002,15 +1002,17 @@
public void visitVarDef(JCVariableDecl tree) {
VarSymbol v = tree.sym;
- code.newLocal(v);
if (tree.init != null) {
checkStringConstant(tree.init.pos(), v.getConstValue());
if (v.getConstValue() == null || varDebugInfo) {
Assert.check(code.isStatementStart());
+ code.newLocal(v);
genExpr(tree.init, v.erasure(types)).load();
items.makeLocalItem(v).store();
Assert.check(code.isStatementStart());
}
+ } else {
+ code.newLocal(v);
}
checkDimension(tree.pos(), v.type);
}