Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invocation.getExecutable().getExecutableDeclaration() returns null in case of enum methods call #793

Closed
fedorov-s-n opened this issue Aug 18, 2016 · 4 comments

Comments

@fedorov-s-n
Copy link
Contributor

Docs say getExecutableDeclaration() should return CtExecutable even if Spoon should use reflection to do it. There is an example it doesn't and invocation.getExecutable().getExecutableDeclaration() returns null.
Steps to reproduce:
Create

enum E {
}

Create call to E.values() and assign invocation to CtInvocation of it. Now invocation.getExecutable().getExecutableDeclaration() returns null.

Possible reason is that class E is not recognized as subclass of java.lang.Enum because E is in source path and java.lang.Enum isn't and there are no extends declaration on E.

@monperrus
Copy link
Collaborator

I agree this is a real problem for end users. I've proposed a solution in #661 , what do you think?

@fedorov-s-n
Copy link
Contributor Author

I wonder why java.lang.Enum isn't reflected as all enum's parent? It actually is! Imho, enum methods aren't different from any other method that is recovered by reflection

@fedorov-s-n
Copy link
Contributor Author

Well, got it, issue is these are synthetic methods of Enum. Yes, looks like generating implicit methods is the only available solution.

@fedorov-s-n
Copy link
Contributor Author

fedorov-s-n commented Aug 18, 2016

#794

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants