Skip to content

Static class literal in annotation value shows false compilation error #256

@atrepczik

Description

@atrepczik

When using the shortened Groovy syntax for class literals as values in Annotations like in the code below

package issue

@Issue(InnerClass)
class IssueMain {

    static class InnerClass {
    }

    static main(args) {
        println 'It works!'
    }
}

@interface Issue {
    Class value()
}

Groovy-Eclipse shows a compilation error in line 3 (InnerClass cannot be resolved or is not a field), despite this being valid Groovy code that compiles and runs fine. When adding a.class suffix to InnerClass, the error disappears.

I used the the following to demonstrate the issue:
Spring Tool Suite

Version: 3.8.3.RELEASE
Build Id: 201612191351
Platform: Eclipse Neon.2 (4.6.2)

Groovy-Eclipse Feature 2.9.2.xx-201701200229-e46

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions