Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4161

Source locations for added default constructors are incorrect

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.2
    • 1.7.3, 1.8-beta-1
    • None
    • None

    Description

      Groovy Eclipse has just upgraded to Groovy 1.7.2 from 1.7.0 and there is a change to Verifier.addDefaultConstructors() that is breaking us.

      The code is now:

      BlockStatement empty = new BlockStatement();
      empty.setSourcePosition(node); 
      ConstructorNode constructor = new ConstructorNode(ACC_PUBLIC, empty);
      constructor.setSourcePosition(node);
      

      Is there a reason why the source location for the empty blockstatement and its containing constructor is set to be the source location of the entire class?

      This is breaking content assist in Groovy-Eclipse. We would prefer to have these kinds of synthetic methods not have any source location at all.

      I propose to change it to this:

      BlockStatement empty = new BlockStatement();
      ConstructorNode constructor = new ConstructorNode(ACC_PUBLIC, empty);
      

      (As above, but just remove the calls to "setSourcePosition".)

      Attachments

        Activity

          People

            roshandawrani Roshan Dawrani
            werdna Andrew Eisenberg
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: