Been using lombok for a while. Came across a very specific issue I
think is a bug. Can anyone explain this behavior?
This is all you do
(1) Put the java file at the end of this msg into a directory with
lombok.jar
(2) run the command: javac TestAnnotations.java
(3) Observe that it builds.
(4) run the command: javac -cp lombok.jar TestAnnotations.java
(5) Observe the following error:
TestAnnotations.java:17: incompatible types
found : TestAnnotations.FooEnum
required: TestAnnotations.FooEnum
FooEnum enumParam() default FooEnum.AnythingReally;
^
1 error
This problem also occurs with class wildcards. It doesn't occur with
the eclipse JDT compiler.
Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
Java HotSpot(TM) Client VM (build 14.3-b01-101, mixed mode)
javac 1.6.0_17, mac Snow Leopard. Also doesn't work on ubuntu linux
Sun VM 1.6.0_18 I believe
-------- TestAnnotations.java --------
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
public class TestAnnotations {
//Given an enum, a class, an interface, and an implementation of the
interface
public enum FooEnum {
AnythingReally;
}
//Make an annotation with wildcards
@Target( {ElementType.FIELD, METHOD} ) @Retention(RUNTIME)
public @interface FooAnnotation {
FooEnum enumParam() default FooEnum.AnythingReally;
}
}
FooEnum enumParam() default package.name.FooEnum.
It's *really* annoying and we'll look into finding a way to fix this
ourselves in flying turtle.