Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8271254: javac generates unreachable code when using empty semicolon statement #5495

wants to merge 4 commits into from
Changes from 1 commit
File filter

Filter by extension

Filter by extension

Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1471,7 +1471,7 @@ void genLast() {
}; = new ListBuffer<>();
genTry(tree.body, List.nil(), syncEnv, false);
genTry(tree.body, List.nil(), syncEnv);

@@ -1505,16 +1505,15 @@ void afterBody() {

}; = new ListBuffer<>();
genTry(tree.body, tree.catchers, tryEnv, true);
genTry(tree.body, tree.catchers, tryEnv);
/** Generate code for a try or synchronized statement
* @param body The body of the try or synchronized statement.
* @param catchers The list of catch clauses.
* @param env The current environment of the body.
* @param actualTry Identify try or synchronized statement, true for try and false for synchronized.
void genTry(JCTree body, List<JCCatch> catchers, Env<GenContext> env, boolean actualTry) {
void genTry(JCTree body, List<JCCatch> catchers, Env<GenContext> env) {
int limit = code.nextreg;
int startpc = code.curCP();
Code.State stateTry = code.state.dup();
@@ -1525,6 +1524,7 @@ void genTry(JCTree body, List<JCCatch> catchers, Env<GenContext> env, boolean ac
Chain exitChain;
boolean actualTry = env.tree.hasTag(TRY);
if (startpc == endpc && actualTry) {
exitChain = code.branch(dontgoto);
} else {