diff --git a/src/share/classes/com/sun/tools/javac/comp/Attr.java b/src/share/classes/com/sun/tools/javac/comp/Attr.java --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -4891,7 +4891,7 @@ */ private Type dummyMethodType(JCMethodDecl md) { Type restype = syms.unknownType; - if (md != null && md.restype.hasTag(TYPEIDENT)) { + if (md != null && md.restype != null && md.restype.hasTag(TYPEIDENT)) { JCPrimitiveTypeTree prim = (JCPrimitiveTypeTree)md.restype; if (prim.typetag == VOID) restype = syms.voidType; @@ -4935,6 +4935,8 @@ } super.visitClassDef(that); } + + private boolean inMethodHeader; @Override public void visitMethodDef(JCMethodDecl that) { @@ -4942,6 +4944,19 @@ if (that.sym == null) { that.sym = new MethodSymbol(0, that.name, that.type, syms.noSymbol); } + scan(that.mods); + scan(that.restype); + scan(that.typarams); + try { + inMethodHeader = true; + scan(that.recvparam); + scan(that.params); + } finally { + inMethodHeader = false; + } + scan(that.thrown); + scan(that.defaultValue); + scan(that.body); super.visitMethodDef(that); } @@ -4949,7 +4964,7 @@ public void visitVarDef(JCVariableDecl that) { initTypeIfNeeded(that); if (that.sym == null) { - that.sym = new VarSymbol(0, that.name, that.type, syms.noSymbol); + that.sym = new VarSymbol(inMethodHeader ? PARAMETER : 0, that.name, that.type, syms.noSymbol); that.sym.adr = 0; } super.visitVarDef(that); diff --git a/src/share/classes/com/sun/tools/javac/comp/Flow.java b/src/share/classes/com/sun/tools/javac/comp/Flow.java --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java @@ -1798,7 +1798,7 @@ for (List l = tree.params; l.nonEmpty(); l = l.tail) { JCVariableDecl def = l.head; scan(def); - Assert.check((def.sym.flags() & PARAMETER) != 0, "Method parameter without PARAMETER flag"); + Assert.check((def.sym.flags() & PARAMETER) != 0 || def.sym.owner == syms.noSymbol, "Method parameter without PARAMETER flag"); /* If we are executing the code from Gen, then there can be * synthetic or mandated variables, ignore them. */