Skip to content

Aliases can not be used in annotaions #260

@AntonPanikov

Description

@AntonPanikov

If your annotation is expecting class value and you aliased it, using alias will raise an error, while using original class name - not. It was working perfectly fine in the past.

I am using groovy eclipse: 2.9.2.xx-201701250356-e46

Here is an example:

package test

class TestClass {
}
package test

@interface TestAnnotation {
    Class<?>[] value()
}
package test

import test.TestClass
import test.TestClass as ALIAS

class Test {

    //@TestAnnotation(value = [TestClass]) // Works
    @TestAnnotation(value = [ALIAS]) // Does not
    static main(args) {
        println 'hello groovy'
    }

}

Groovy eclipse will complain about using alias, but using original class name will work fine. But in both cases code will run fine.

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