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

review: feature: put generics information concerning method return types and parameters inside shadow classes #1352

Merged
merged 9 commits into from Jun 6, 2017

Conversation

surli
Copy link
Collaborator

@surli surli commented Jun 1, 2017

No description provided.

@surli surli changed the title WiP: generics are not treated the same way in shadow classes and standard classes review: feature: put generics information concerning method return types and parameters inside shadow classes Jun 2, 2017
launcher.addInputResource("src/test/java/spoon/test/generics/testclasses/FakeTpl.java");
launcher.buildModel();

CtInterface<?> fakeTplItf = factory.Interface().get("spoon.test.generics.testclasses.FakeTpl");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, you do not get the shadow class but the normal spoon model built from source. To obtain the shadow class
remove launcher.addInputResource("src/test/java/spoon/test/generics/testclasses/FakeTpl.java");

replace this one by factory.Interface().get(spoon.test.generics.testclasses.FakeTpl.class)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm doing it line 1003: here, I'm testing that everything is as expected from the model built from source.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, for a more readable test, it would be great to extract in an assertion and then you would write

// normal class
checkFakeTpl(factory.Interface().get("spoon.test.generics.testclasses.FakeTpl"))
//shadow class
checkFakeTpl(factory2.Interface().get(spoon.test.generics.testclasses.FakeTpl.class))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@spoon-bot
Copy link
Collaborator

Revapi Analysis results

Old API: fr.inria.gforge.spoon:spoon-core:jar:5.8.0-20170602.141932-6

New API: fr.inria.gforge.spoon:spoon-core:jar:5.8.0-SNAPSHOT

Detected changes: 2.

Change 1

Name Element
Old method void spoon.support.visitor.java.reflect.RtMethod::(java.lang.Class, java.lang.String, java.lang.Class, java.lang.reflect.TypeVariable<java.lang.reflect.Method>[], java.lang.Class[], java.lang.Class[], int, java.lang.annotation.Annotation[], java.lang.annotation.Annotation[][], boolean, boolean)
New method void spoon.support.visitor.java.reflect.RtMethod::(java.lang.Class, java.lang.String, java.lang.Class, java.lang.reflect.Type, java.lang.reflect.TypeVariable<java.lang.reflect.Method>[], java.lang.Class[], java.lang.reflect.Type[], java.lang.Class[], int, java.lang.annotation.Annotation[], java.lang.annotation.Annotation[][], boolean, boolean)
Code java.method.numberOfParametersChanged
Description The number of parameters of the method have changed.
Breaking source: breaking,

Change 2

Name Element
Old method void spoon.support.visitor.java.reflect.RtParameter::(java.lang.String, java.lang.Class<?>, spoon.support.visitor.java.reflect.RtMethod, java.lang.reflect.Constructor, int)
New method void spoon.support.visitor.java.reflect.RtParameter::(java.lang.String, java.lang.Class<?>, java.lang.reflect.Type, spoon.support.visitor.java.reflect.RtMethod, java.lang.reflect.Constructor, int)
Code java.method.numberOfParametersChanged
Description The number of parameters of the method have changed.
Breaking source: breaking,

@monperrus monperrus merged commit e95e933 into INRIA:master Jun 6, 2017
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

Successfully merging this pull request may close these issues.

None yet

3 participants