7102515: javac running very very long and not returning
Summary: Verbose resolution diagnostics slow down with operator resolution
Reviewed-by: jjg
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Mon Oct 17 12:57:36 2011 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Oct 19 16:56:05 2011 +0100
@@ -691,6 +691,7 @@
case ABSENT_MTH:
return wrongMethod.setWrongSym(sym, ex.getDiagnostic());
case WRONG_MTH:
+ if (operator) return bestSoFar;
wrongMethods.addCandidate(currentStep, wrongMethod.sym, wrongMethod.explanation);
case WRONG_MTHS:
return wrongMethods.addCandidate(currentStep, sym, ex.getDiagnostic());
@@ -1685,6 +1686,7 @@
*/
Symbol resolveOperator(DiagnosticPosition pos, int optag,
Env<AttrContext> env, List<Type> argtypes) {
+ startResolution();
Name name = treeinfo.operatorName(optag);
Symbol sym = findMethod(env, syms.predefClass.type, name, argtypes,
null, false, false, true);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/7102515/T7102515.java Wed Oct 19 16:56:05 2011 +0100
@@ -0,0 +1,11 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7102515
+ * @summary javac running very very long and not returning
+ * @compile/fail/ref=T7102515.out -XDrawDiagnostics T7102515.java
+ */
+
+class T7102515 {
+ T7102515 badBinary = new T7102515() + new T7102515();
+ Object badUnary = badBinary++;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/7102515/T7102515.out Wed Oct 19 16:56:05 2011 +0100
@@ -0,0 +1,3 @@
+T7102515.java:9:41: compiler.err.operator.cant.be.applied.1: +, T7102515, T7102515
+T7102515.java:10:32: compiler.err.operator.cant.be.applied: ++, T7102515, null
+2 errors