Skip to content
New issue

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

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

Already on GitHub? # to your account

bug: superInterfaces on shadow type miss actual type arguments #1906

Closed
pvojtechovsky opened this issue Mar 11, 2018 · 8 comments
Closed

bug: superInterfaces on shadow type miss actual type arguments #1906

pvojtechovsky opened this issue Mar 11, 2018 · 8 comments
Labels

Comments

@pvojtechovsky
Copy link
Collaborator

I am refactoring SpoonMetaModel by way it can be created without spoon sources - just using spoon runtime reflection. And I have found this problem. For example CtConditionalImpl is defined like this

class CtConditionalImpl<T> implements CtConditional<T>

but when I get shadow CtClass of CtConditionalImpl, then getSuperInterfaces() returns CtTypeReference without actuall type arguments. So it looks like this

class CtConditionalImpl<T> implements CtConditional

I need that actual type argument on interface references, in ClassTypingContext.

This information was not available until Class#getAnnotatedInterfaces() was introduced in Java8. Could you please use that new method to deliver actual type arguments of extended interfaces too?

I created a branch with a failing test https://github.com/pvojtechovsky/spoon/tree/fixSuperIfaceArgs

@monperrus
Copy link
Collaborator

I am refactoring SpoonMetaModel by way it can be created without spoon sources - just using spoon runtime reflection

Excellent!

Could you please use that new method to deliver actual type arguments of extended interfaces too?

I'm not sure to understand, what do you mean?

@pvojtechovsky
Copy link
Collaborator Author

pvojtechovsky commented Mar 11, 2018

what do you mean?

to make the failing tests in https://github.com/pvojtechovsky/spoon/tree/fixSuperIfaceArgs passing

CtTypeReference ifaceRef = factory.Type.get(CtConditionalImpl.class).getSuperInterfaces().get(0);
ifaceRef.getActualTypeArguments() should return <T> but actually returns empty collection

@monperrus
Copy link
Collaborator

Do you mean that the JavaReflectionBuilder should be changed?

Are you working on this fix?

@pvojtechovsky
Copy link
Collaborator Author

Do you mean that the JavaReflectionBuilder should be changed?

yes

Are you working on this fix?

no. I do not know this code yet and I silently hope that somebody else might do it ;-)

I am actually cleaning new Template matching / generating code.... so we can start review/merging process soon.

@monperrus monperrus changed the title superInterfaces on shadow type miss actual type arguments bug: superInterfaces on shadow type miss actual type arguments Mar 13, 2018
@monperrus
Copy link
Collaborator

@surli would you have look at this bug with a failing test case?

@surli
Copy link
Collaborator

surli commented Mar 13, 2018

I'll look at it on the next days

@surli surli added the bug label Mar 13, 2018
@monperrus
Copy link
Collaborator

monperrus commented Mar 13, 2018 via email

@pvojtechovsky
Copy link
Collaborator Author

Thank you :-) 👍

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

No branches or pull requests

3 participants