Skip to content

Fix type inferencing, syntax highlighting and code navigation for trait property references #1113

@eric-milles

Description

@eric-milles

https://stackoverflow.com/questions/61713375/trait-methods-are-not-fully-visible-in-groovy-eclipse

Consider the following:

trait T {
  String foo
}
class C implements T {
  def m() {
    foo
  }
}

Reference to "foo" is shown as unknown (underlined).

Unlike #953 and #960, the trait is declared in a separate source unit. This issue falls in a gap between #960 and #704. Some trait fields and methods are not represented in the JDT model (GroovyCompilationUnitDeclaration, GroovyTypeDeclaration and SourceTypeBinding) since they are not compatible with Java 7 interfaces and to prevent warnings for unimplemented abstract methods. Thus they are not available in a JDTClassNode that is created for source reference.

To be available for type inferencing, etc. the JDTClassNode for a trait needs to be populated with the missing fields, methods and properties.

image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions