# HG changeset patch # User mcimadamore # Date 1323625705 0 # Node ID ee702a4f9c5f99bdc4ac19111250d94ad4944d38 # Parent cb6d891ce911dc39d2cb7be64b4c12ded5919e0f 7120266: javac fails to compile hotspot code Summary: Parser changes for method references cause bad intercation with method call syntax Reviewed-by: jjg diff -r cb6d891ce911 -r ee702a4f9c5f langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Sat Dec 10 17:44:46 2011 -0800 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Sun Dec 11 17:48:25 2011 +0000 @@ -1143,49 +1143,49 @@ // typeArgs saved for next loop iteration. t = toP(F.at(pos).Select(t, ident())); break; - case LT: - if ((mode & (TYPE | NOPARAMS)) == 0) { - //could be an unbound method reference whose qualifier - //is a generic type i.e. A#m - mode = EXPR | TYPE; - JCTree.Tag op = JCTree.Tag.LT; - int pos1 = token.pos; - nextToken(); - mode |= EXPR | TYPE | TYPEARG; - JCExpression t1 = term3(); - if ((mode & TYPE) != 0 && - (token.kind == COMMA || token.kind == GT)) { - mode = TYPE; - ListBuffer args = new ListBuffer(); - args.append(t1); - while (token.kind == COMMA) { - nextToken(); - args.append(typeArgument()); - } - accept(GT); - t = toP(F.at(pos1).TypeApply(t, args.toList())); - checkGenerics(); - while (token.kind == DOT) { - nextToken(); - mode = TYPE; - t = toP(F.at(token.pos).Select(t, ident())); - t = typeArgumentsOpt(t); - } - if (token.kind != HASH) { - //method reference expected here - t = illegal(); - } - mode = EXPR; - break; - } else if ((mode & EXPR) != 0) { - //rollback - it was a binary expression - mode = EXPR; - JCExpression e = term2Rest(t1, TreeInfo.shiftPrec); - t = F.at(pos1).Binary(op, t, e); - t = termRest(term1Rest(term2Rest(t, TreeInfo.orPrec))); - } - } - break loop; +// case LT: +// if ((mode & (TYPE | NOPARAMS)) == 0) { +// //could be an unbound method reference whose qualifier +// //is a generic type i.e. A#m +// mode = EXPR | TYPE; +// JCTree.Tag op = JCTree.Tag.LT; +// int pos1 = token.pos; +// nextToken(); +// mode |= EXPR | TYPE | TYPEARG; +// JCExpression t1 = term3(); +// if ((mode & TYPE) != 0 && +// (token.kind == COMMA || token.kind == GT)) { +// mode = TYPE; +// ListBuffer args = new ListBuffer(); +// args.append(t1); +// while (token.kind == COMMA) { +// nextToken(); +// args.append(typeArgument()); +// } +// accept(GT); +// t = toP(F.at(pos1).TypeApply(t, args.toList())); +// checkGenerics(); +// while (token.kind == DOT) { +// nextToken(); +// mode = TYPE; +// t = toP(F.at(token.pos).Select(t, ident())); +// t = typeArgumentsOpt(t); +// } +// if (token.kind != HASH) { +// //method reference expected here +// t = illegal(); +// } +// mode = EXPR; +// break; +// } else if ((mode & EXPR) != 0) { +// //rollback - it was a binary expression +// mode = EXPR; +// JCExpression e = term2Rest(t1, TreeInfo.shiftPrec); +// t = F.at(pos1).Binary(op, t, e); +// t = termRest(term1Rest(term2Rest(t, TreeInfo.orPrec))); +// } +// } +// break loop; default: break loop; } diff -r cb6d891ce911 -r ee702a4f9c5f langtools/test/tools/javac/T7120266.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/T7120266.java Sun Dec 11 17:48:25 2011 +0000 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2011, 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 7120266 + * @summary javac fails to compile hotspot code + * @compile T7120266.java + */ + +class T7120266 { + void test(int i, int len) { that(i < len, "oopmap"); } + void that(boolean b, String s) { }; +} diff -r cb6d891ce911 -r ee702a4f9c5f langtools/test/tools/javac/lambda/MethodReferenceParserTest.java --- a/langtools/test/tools/javac/lambda/MethodReferenceParserTest.java Sat Dec 10 17:44:46 2011 -0800 +++ b/langtools/test/tools/javac/lambda/MethodReferenceParserTest.java Sun Dec 11 17:48:25 2011 +0000 @@ -24,6 +24,7 @@ /* * @test * @bug 7115052 + * @ignore 7120266 * @summary Add parser support for method references */