提交 35f12d20 编写于 作者: M mcimadamore

6967002: JDK7 b99 javac compilation error (java.lang.AssertionError)

Summary: bug in JavacParser related to parsing of type annotations in varargs position
Reviewed-by: jjg
Contributed-by: mahmood@notnoop.com
上级 095f0872
......@@ -1151,8 +1151,12 @@ public class JavacParser implements Parser {
t = toP(F.at(pos).Select(t, ident()));
break;
case ELLIPSIS:
assert this.permitTypeAnnotationsPushBack;
typeAnnotationsPushedBack = annos;
if (this.permitTypeAnnotationsPushBack) {
this.typeAnnotationsPushedBack = annos;
} else if (annos.nonEmpty()) {
// Don't return here -- error recovery attempt
illegal(annos.head.pos);
}
break loop;
default:
break loop;
......
/*
* Copyright (c) 2010, 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 6967002
* @summary JDK7 b99 javac compilation error (java.lang.AssertionError)
* @author Maurizio Cimadamore
* @compile/fail/ref=T6967002.out -XDrawDiagnostics T6967002.java
*/
class Test {
private static void m(byte[] octets) {
return m(octets..., ?);
}
}
T6967002.java:33:22: compiler.err.expected: ')'
T6967002.java:33:25: compiler.err.illegal.start.of.expr
T6967002.java:33:28: compiler.err.illegal.start.of.expr
T6967002.java:33:29: compiler.err.illegal.start.of.expr
T6967002.java:33:27: compiler.err.not.stmt
T6967002.java:33:30: compiler.err.expected: ';'
T6967002.java:35:2: compiler.err.premature.eof
7 errors
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册