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 fix: contract CtAnnotation and array of values #1935

Merged
merged 14 commits into from
Apr 4, 2018

Conversation

surli
Copy link
Collaborator

@surli surli commented Mar 30, 2018

This PR intends to fix the contract defined after discussion in #1928

* Name of searched value.
* @return the value expression or null if not found.
*/
@PropertyGetter(role = VALUE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add @Derived to this method... otherwise the metamodel based code will be confused.

CtArrayTypeReference typeReference2 = this.getFactory().createArrayTypeReference();
typeReference2.setComponentType(ctExpression.getType().clone());
newArray.setType(typeReference);
newArray.addElement(ctExpression);
Copy link
Collaborator

Choose a reason for hiding this comment

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

newArray.addElement(ctExpression.clone());
clone is missing

@surli surli changed the title WIP Annotation and shadow classes review fix: contract CtAnnotation and array of values Apr 3, 2018

if (ctExpression instanceof CtLiteral) {
CtTypeReference typeReference = this.getAnnotationType();
CtType type = typeReference.getDeclaration();
Copy link
Collaborator

Choose a reason for hiding this comment

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

use getTypeDeclaration?

@monperrus
Copy link
Collaborator

I have a doubt about the name getTypedValue because all values are already typed.

Does this method always return a CtNewArray?

@surli
Copy link
Collaborator Author

surli commented Apr 4, 2018

Does this method always return a CtNewArray?

only if it respects some conditions (it's the only CtLiteral value and the annotation should return an array) else it returns the same value as getValue.

@monperrus
Copy link
Collaborator

monperrus commented Apr 4, 2018 via email

@spoon-bot
Copy link
Collaborator

API changes: 1 (Detected by Revapi)

Old API: fr.inria.gforge.spoon:spoon-core:jar:6.3.0-20180404.073823-36 / New API: fr.inria.gforge.spoon:spoon-core:jar:6.3.0-SNAPSHOT

Method was added to an interface.
Old none
New method CtAnnotation#getWrappedValue(String)
Breaking binary: non_breaking

@monperrus monperrus merged commit 7e7cde2 into INRIA:master Apr 4, 2018
@monperrus
Copy link
Collaborator

Thanks Simon!

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.

4 participants