diff --git a/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/src/share/classes/com/sun/tools/javac/comp/Resolve.java index bb2da7a2dba4dd847a32abe3de47c4bb24a23d73..030a0841013683e75070b17595ae58d979f399e5 100644 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -251,7 +251,7 @@ public class Resolve { /** An environment is "static" if its static level is greater than * the one of its outer environment */ - static boolean isStatic(Env env) { + protected static boolean isStatic(Env env) { return env.info.staticLevel > env.outer.info.staticLevel; } diff --git a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java index ec9eecceb2ec87712df019bb7166a2cb08fe9858..b80c788da1233a31dd3e2e175b3bcf425aa664a9 100644 --- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java +++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java @@ -2165,27 +2165,10 @@ public class JavacParser implements Parser { while (true) { int pos = token.pos; switch (token.kind) { - case CASE: { - nextToken(); - JCExpression pat = parseExpression(); - accept(COLON); - List stats = blockStatements(); - JCCase c = F.at(pos).Case(pat, stats); - if (stats.isEmpty()) - storeEnd(c, S.prevToken().endPos); - cases.append(c); - break; - } - case DEFAULT: { - nextToken(); - accept(COLON); - List stats = blockStatements(); - JCCase c = F.at(pos).Case(null, stats); - if (stats.isEmpty()) - storeEnd(c, S.prevToken().endPos); - cases.append(c); + case CASE: + case DEFAULT: + cases.append(switchBlockStatementGroup()); break; - } case RBRACE: case EOF: return cases.toList(); default: @@ -2196,6 +2179,32 @@ public class JavacParser implements Parser { } } + protected JCCase switchBlockStatementGroup() { + int pos = token.pos; + List stats; + JCCase c; + switch (token.kind) { + case CASE: + nextToken(); + JCExpression pat = parseExpression(); + accept(COLON); + stats = blockStatements(); + c = F.at(pos).Case(pat, stats); + if (stats.isEmpty()) + storeEnd(c, S.prevToken().endPos); + return c; + case DEFAULT: + nextToken(); + accept(COLON); + stats = blockStatements(); + c = F.at(pos).Case(null, stats); + if (stats.isEmpty()) + storeEnd(c, S.prevToken().endPos); + return c; + } + throw new AssertionError("should not reach here"); + } + /** MoreStatementExpressions = { COMMA StatementExpression } */ > T moreStatementExpressions(int pos, diff --git a/src/share/classes/com/sun/tools/javap/CodeWriter.java b/src/share/classes/com/sun/tools/javap/CodeWriter.java index 56bf415843efe019239f9a4cae170b091643387e..50ce27dcbdf4d8607bb60593d3b00866db047efc 100644 --- a/src/share/classes/com/sun/tools/javap/CodeWriter.java +++ b/src/share/classes/com/sun/tools/javap/CodeWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,8 +45,8 @@ import com.sun.tools.classfile.Method; * This code and its internal interfaces are subject to change or * deletion without notice. */ -class CodeWriter extends BasicWriter { - static CodeWriter instance(Context context) { +public class CodeWriter extends BasicWriter { + public static CodeWriter instance(Context context) { CodeWriter instance = context.get(CodeWriter.class); if (instance == null) instance = new CodeWriter(context);