Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Information Provided
-
4.0.2
-
None
-
None
-
None
Description
class Reproducer { public static final Map<Role, String> ROLE_MAPPING = EnumMap.of(Role.A, 'a') // public static final Map<Role, String> ROLE_MAPPING = EnumMap.of(Role.A, 'a', Role.B, 'b', Role.C, 'c', Role.D, 'd') static void main(String... args) { println ROLE_MAPPING } } enum Role { A, B, C, D }
Works fine in Groovy 2.5 and 3.x but fails with Groovy 4.
java.lang.ExceptionInInitializerError Caused by: groovy.lang.MissingMethodException: No signature of method: static java.util.EnumMap.of() is applicable for argument types: (Role, String) values: [A, a] Possible solutions: any(), sort(), is(java.lang.Object), notify(), wait(), size() at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1677) at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1663) at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318) at Reproducer.<clinit>(Script1.groovy:2) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ...
Attachments
Issue Links
- is caused by
-
GROOVY-8164 Groovy allows a Java class to inherit static methods from its interface
- Closed