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

feat: check if a CtType is an array type #2882

Merged
merged 11 commits into from
Mar 8, 2019
Merged

Conversation

monperrus
Copy link
Collaborator

I'm not satisfied by this answer. Do you see another working solution?

@pvojtechovsky would you have a look at the bug in isSubTypeOf?

@pvojtechovsky
Copy link
Collaborator

bug in isSubTypeOf

I will try to give it some time next week.

@pvojtechovsky
Copy link
Collaborator

I fixed the problem CtArrayTypeReference isSubtypeOf java.lang.Array

There remains: the call of getTypeDeclaration on CtArrayTypeReference should return null or throw an exception.
The pretending that

class int[] implements Serializable, Cloneble {}

is something real, is a bad idea from my point of view
WDYT?

@monperrus
Copy link
Collaborator Author

monperrus commented Mar 3, 2019

Thanks for the fix!

There remains: the call of getTypeDeclaration on CtArrayTypeReference should return null or throw an exception.

null would be dangerous NPEs for client code, I would not go this way. An exception is an option but may require specific handlers in client code. What about returning a shadow class of java.lang.reflect.Array or java.lang.Object?

@pvojtechovsky
Copy link
Collaborator

What about returning a shadow class of java.lang.reflect.Array or java.lang.Object?

It is an interesting idea. I would probably expect more java.lang.reflect.Array then Object.

@monperrus
Copy link
Collaborator Author

monperrus commented Mar 4, 2019 via email

@pvojtechovsky
Copy link
Collaborator

I have not enough time to finish the pull requests I already started. So I have currently no time to do that one too. But this change should be quite simple, so any Spoon newcomer might do it too.

@monperrus monperrus changed the title WIP: is there a way to check if a CtType is an array type? feat: check if a CtType is an array type Mar 4, 2019
@monperrus
Copy link
Collaborator Author

I'm done here

@nharrand nharrand merged commit d4f8c0c into INRIA:master Mar 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants