changeset 1142:366c233eb838

7102515: javac running very very long and not returning Summary: Verbose resolution diagnostics slow down with operator resolution Reviewed-by: jjg
author mcimadamore
date Wed, 19 Oct 2011 16:56:05 +0100
parents 3cdfa97e1be9
children d2cbb77469ed
files src/share/classes/com/sun/tools/javac/comp/Resolve.java test/tools/javac/7102515/T7102515.java test/tools/javac/7102515/T7102515.out
diffstat 3 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon Oct 17 12:57:36 2011 +0100
+++ b/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/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/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