Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8243074

Misplaced and/or duplicate super or this constructor invocation not attributed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 15
    • None
    • tools
    • None
    • b20

      Consider code like:
      ---
      class Constructors extends BaseWithConstructor {
              Constructors(String name) {
                  System.err.println();
                  this(name.length());
                  super(name.length());
                  this(name.length());
              }
              Constructors(int i) {super(i);}
      }
      class BaseWithConstructor {
          BaseWithConstructor(int len) {}
      }
      ---

      Attr.visitApply will not attribute the this/super constructor invocations inside Constructors(String name), as it only attributes the first this/super constructor invocation (if any). As a result Trees.getElement (or Trees.getTypeMirror) will not return good results on AST node from inside these this/super constructor invocations.

            jlahoda Jan Lahoda
            jlahoda Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: