Open
Description
Describe the bug
I'm trying to find and invoke methods that are defined within individual enum constants, but I'm unable to locate these methods.
To Reproduce
Steps to reproduce the behavior:
- Try to access methods defined in the enum constants
Example code with ToNumberPolicy
enum implementing ToNumberStrategy
:
public interface ToNumberStrategy {
public Number readNumber(JsonReader in) throws IOException;
}
public enum ToNumberPolicy implements ToNumberStrategy {
DOUBLE {
@Override
public Double readNumber(JsonReader in) throws IOException {
return in.nextDouble();
}
},
LAZILY_PARSED_NUMBER {
@Override
public Number readNumber(JsonReader in) throws IOException {
return new LazilyParsedNumber(in.nextString());
}
},
// Other enum constants with their own implementations...
}
Expected behavior
I expect to be able to find the readNumber
method for each enum constant via reflection, as each constant has its own implementation of the method.
Additional context
The issue appears to be that each enum constant is actually an anonymous inner class of ToNumberPolicy
.
However, I need to access these methods with codeanalyzer.