7102515: javac running very very long and not returning

Wed, 19 Oct 2011 16:56:05 +0100

author
mcimadamore
date
Wed, 19 Oct 2011 16:56:05 +0100
changeset 1110
366c233eb838
parent 1109
3cdfa97e1be9
child 1111
d2cbb77469ed

7102515: javac running very very long and not returning
Summary: Verbose resolution diagnostics slow down with operator resolution
Reviewed-by: jjg

src/share/classes/com/sun/tools/javac/comp/Resolve.java file | annotate | diff | comparison | revisions
test/tools/javac/7102515/T7102515.java file | annotate | diff | comparison | revisions
test/tools/javac/7102515/T7102515.out file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon Oct 17 12:57:36 2011 +0100
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Oct 19 16:56:05 2011 +0100
     1.3 @@ -691,6 +691,7 @@
     1.4              case ABSENT_MTH:
     1.5                  return wrongMethod.setWrongSym(sym, ex.getDiagnostic());
     1.6              case WRONG_MTH:
     1.7 +                if (operator) return bestSoFar;
     1.8                  wrongMethods.addCandidate(currentStep, wrongMethod.sym, wrongMethod.explanation);
     1.9              case WRONG_MTHS:
    1.10                  return wrongMethods.addCandidate(currentStep, sym, ex.getDiagnostic());
    1.11 @@ -1685,6 +1686,7 @@
    1.12       */
    1.13      Symbol resolveOperator(DiagnosticPosition pos, int optag,
    1.14                             Env<AttrContext> env, List<Type> argtypes) {
    1.15 +        startResolution();
    1.16          Name name = treeinfo.operatorName(optag);
    1.17          Symbol sym = findMethod(env, syms.predefClass.type, name, argtypes,
    1.18                                  null, false, false, true);
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/tools/javac/7102515/T7102515.java	Wed Oct 19 16:56:05 2011 +0100
     2.3 @@ -0,0 +1,11 @@
     2.4 +/*
     2.5 + * @test /nodynamiccopyright/
     2.6 + * @bug 7102515
     2.7 + * @summary javac running very very long and not returning
     2.8 + * @compile/fail/ref=T7102515.out -XDrawDiagnostics T7102515.java
     2.9 + */
    2.10 +
    2.11 +class T7102515 {
    2.12 +    T7102515 badBinary = new T7102515() + new T7102515();
    2.13 +    Object badUnary = badBinary++;
    2.14 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/test/tools/javac/7102515/T7102515.out	Wed Oct 19 16:56:05 2011 +0100
     3.3 @@ -0,0 +1,3 @@
     3.4 +T7102515.java:9:41: compiler.err.operator.cant.be.applied.1: +, T7102515, T7102515
     3.5 +T7102515.java:10:32: compiler.err.operator.cant.be.applied: ++, T7102515, null
     3.6 +2 errors

mercurial