Implizit methods (for enum)

When getting all methods from an enum-class, it does not return
"values()". Is there an standard way to get those implizit stuff?

3 comments

The point not to give those in getMethods() is that only methods physically
written in the enum class are returned.
We obtain those through PsiClass.processDeclarations() but you should check
twice if you really need them.

Eugene.

"Sven Steiniger" <sven.steiniger@gmx.de> wrote in message
news:dmmgo3$g9k$1@is.intellij.net...

When getting all methods from an enum-class, it does not return
"values()". Is there an standard way to get those implizit stuff?



0

Thanks. Yes I need them to validate references and provide code
completion.
To use procesDeclarations() I would need to change most of my existing
code. Can I create those methods manually using ElementFactory without
adding them to the class (and using it for reference resolving, code
completion)?


Eugene Vigdorchik (JetBrains) schrieb:

The point not to give those in getMethods() is that only methods physically
written in the enum class are returned.
We obtain those through PsiClass.processDeclarations() but you should check
twice if you really need them.

Eugene.

"Sven Steiniger" <sven.steiniger@gmx.de> wrote in message
news:dmmgo3$g9k$1@is.intellij.net...

>>When getting all methods from an enum-class, it does not return
>>"values()". Is there an standard way to get those implizit stuff?


0

"Sven Steiniger" <sven.steiniger@gmx.de> wrote in message
news:dmp3qh$hlb$1@is.intellij.net...

Thanks. Yes I need them to validate references and provide code
completion.
To use procesDeclarations() I would need to change most of my existing
code. Can I create those methods manually using ElementFactory without
adding them to the class (and using it for reference resolving, code
completion)?



Yep,
that's what we are doing in processDeclarations:)
Be sure to cache the synthetic elements, since creating them every time
resolve is called would be extremely expensive.

Eugene.


0

Please sign in to leave a comment.