changeset 1122:d37897312d31 jdk7u2-b11

7102515: javac running very very long and not returning Reviewed-by: jjg, mcimadamore
author jjh
date Thu, 20 Oct 2011 14:32:52 -0700
parents 0dbfce4dcd64
children ac81179d8969
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	Tue Oct 18 14:45:09 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Oct 20 14:32:52 2011 -0700
@@ -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	Thu Oct 20 14:32:52 2011 -0700
@@ -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	Thu Oct 20 14:32:52 2011 -0700
@@ -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