The code at https://github.com/Tiller/jdt-annot-issue/tree/genericscast gives the following error in eclipse (4.37 & 4.38 nightly, haven't tested before) but works with javac
Cannot cast from Enum<Enum> to Test.MyEnum Test.java /test/src/main/java/test line 16 Java Problem
public void test() {
assertThatEquals((MyEnum) enumExpression.valueOf("test.Test.MyEnum", "A")).test(MyEnum.A);
}
public static <T> Predicate<T> assertThatEquals(T elm) {
return elm2 -> Objects.equals(elm, elm2);
}
public <T extends Enum<T>> T valueOf(String fqdn, String value) {
...
}
Workaround is to not cast but explicitly provide the type:
assertThatEquals(enumExpression.<MyEnum>valueOf("test.Test.MyEnum", "A")).test(MyEnum.A);
(sorry for all the issues guys, I have had some time this week so I create what I have laying around, I have at most one other to create :D)
The code at https://github.com/Tiller/jdt-annot-issue/tree/genericscast gives the following error in eclipse (4.37 & 4.38 nightly, haven't tested before) but works with javac
Workaround is to not cast but explicitly provide the type:
(sorry for all the issues guys, I have had some time this week so I create what I have laying around, I have at most one other to create :D)