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

Use CtTypeAccess for CtFieldRead of .class and instanceof #458

Merged
merged 2 commits into from
Jan 4, 2016
Merged

Use CtTypeAccess for CtFieldRead of .class and instanceof #458

merged 2 commits into from
Jan 4, 2016

Conversation

GerardPaligot
Copy link
Contributor

No description provided.

@@ -25,4 +25,7 @@
* type in the expression.
*/
public interface CtTypeAccess<T> extends CtExpression<T> {
boolean isClassType();
Copy link
Collaborator

Choose a reason for hiding this comment

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

to be discussed. I'm not sure this have to explicit in the metamodel, it may be inferred from the context where it is used (e.g. with the parent)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm agree that should be discussed. Me, I prefer come back to CtFieldRead.

CtBinaryOperator<?> op = (CtBinaryOperator<?>) ass.getDefaultExpression();
assertEquals("Class", op.getLeftHandOperand().getType().getSimpleName());
assertFalse(op.getLeftHandOperand().getType().isPrimitive());
assertEquals("short", op.getRightHandOperand().getType().getSimpleName());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should return Class and op.getLeftHandOperand().getTarget().getSimpleName() return short.

@GerardPaligot GerardPaligot changed the title Changes CtLiteral for CtTypeAccess Use CtTypeAccess for CtFieldRead of .class and instanceof Jan 4, 2016
@GerardPaligot
Copy link
Contributor Author

@monperrus PR ok for me. If ok for you, you can merge it.

@monperrus monperrus merged commit b7b52af into INRIA:master Jan 4, 2016
@GerardPaligot GerardPaligot deleted the feat_type_access branch January 4, 2016 14:24
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.

2 participants