0

I have 2 traits:

trait LinkTrait<D> {
  String compositeKey
}

trait Named<D> {
  String name
}

and a class:

class Project implements LinkTrait<Project>, Named<Project> {

  String company

  def beforeValidate() {
    if( company && name ) setCompositeKey company + '_' + name
  }
}

The code compiles and executes just fine.

The problem is, that in Eclipse 2020-03 and

Eclipse Groovy Development Tools

Version: 3.8.0.v202004242058-e2003

the code looks like:

enter image description here

Here the name field and setCompositeKey() method are suggested in code-completion, but are both underlined as unknown and neither Ctrl+Click nor F3 do not open its' declarations.

Is this a bug or some "misconfiguration"?

injecteer
  • 20,038
  • 4
  • 45
  • 89
  • 1
    New issue created in Groovy-Eclipse: https://github.com/groovy/groovy-eclipse/issues/1113 – emilles May 12 '20 at 19:00
  • Until a fix is available, you can 1) define the traits in the same source file as the implementing class or 2) add interface methods for get and set of each property. This can help the IDE along and will not negatively impact the compiled class files. – emilles May 12 '20 at 19:02
  • thanks for reaction. Looking forward to see the fix in release – injecteer May 13 '20 at 10:45

0 Answers0