提交 c604d427 编写于 作者: M mcimadamore

8014643: Parser regression in JDK 8 when compiling super.x

Summary: Fixed latent bug in JavacParser.analyzeParens()
Reviewed-by: jjg, vromero
上级 97a31167
......@@ -1535,11 +1535,18 @@ public class JavacParser implements Parser {
outer: for (int lookahead = 0 ; ; lookahead++) {
TokenKind tk = S.token(lookahead).kind;
switch (tk) {
case EXTENDS: case SUPER: case COMMA:
case COMMA:
type = true;
case QUES: case DOT: case AMP:
case EXTENDS: case SUPER: case DOT: case AMP:
//skip
break;
case QUES:
if (peekToken(lookahead, EXTENDS) ||
peekToken(lookahead, SUPER)) {
//wildcards
type = true;
}
break;
case BYTE: case SHORT: case INT: case LONG: case FLOAT:
case DOUBLE: case BOOLEAN: case CHAR:
if (peekToken(lookahead, RPAREN)) {
......
/*
* Copyright (c) 2013, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8014643
* @summary Parser regression in JDK 8 when compiling super.x
* @compile T8014643.java
*/
class T8014643 {
static class A {
int b = 1;
}
static class B extends A {
int b = 12;
int m() { return (super.b); }
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册