These are workaround ideas, so please excuse the design choices.
// anonymous inner approach
enum E {
A() {
final String thing = "DEV_PR"
// add read-only properties or getter methods for Type1.M2, Type1.DEVELOPER,
"Progr", "Programmer", [cat.WHITE_COLLAR, cat.PROPELLERHEAD]
},
B() {
final String thing = "value for B"
},
...;
abstract String getThing()
// abstract getter methods for each property you want to expose
}
enum E {
A, B, C ... Z;
// switch-based approach
String getThing() {
switch (this) {
case A:
return "DEV_PR"
case B:
return "value for B"
}
}
// map-based approach -- each property could be moved to a separate class if
space or verbosity is a concern
private static Map<E,String> THINGS = new EnumMap(E) // inline map literal
may be possible here instead of "E" and static puts below
static {
// these could be divided into several static methods if the initializer
gets too long
THINGS.put(A,"DEV_PR")
...
}
String getThing() {
THINGS.get(this)
}
}
Sorry, no idea if in your case any of these also run into method too large
exceptions. And for the switch or map-based approaches, you could make
"getThing()" a static method in some separate class or an extension method so
you can access it like it is part of the enum constant instances.
In terms of the root cause, can you share the bytecode for the initializer up
through the first 2 or 3 enum constants? We may be able to make it more
efficient. And in the case of large enums, break it up into separate methods.
Not sure how javac handles this and what the ultimate upper limit is for enum
constants.