Skip to content

Commit

Permalink
fix(role): fix wrong roles
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Jun 23, 2017
1 parent 1f6cd87 commit fa95062
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.FIELD })
public @interface MetamodelPropertyField {
CtRole role();
CtRole[] role();
}
7 changes: 3 additions & 4 deletions src/main/java/spoon/reflect/code/CtCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
import spoon.reflect.annotations.PropertyGetter;
import spoon.reflect.annotations.PropertySetter;

import static spoon.reflect.path.CtRole.CASE;

import static spoon.reflect.path.CtRole.EXPRESSION;

/**
* This code element defines a case within a switch-case.
Expand All @@ -40,13 +39,13 @@ public interface CtCase<S> extends CtStatement, CtStatementList {
/**
* Gets the case expression.
*/
@PropertyGetter(role = CASE)
@PropertyGetter(role = EXPRESSION)
CtExpression<S> getCaseExpression();

/**
* Sets the case expression.
*/
@PropertySetter(role = CASE)
@PropertySetter(role = EXPRESSION)
<T extends CtCase<S>> T setCaseExpression(CtExpression<S> caseExpression);

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/spoon/reflect/declaration/CtCodeSnippet.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public interface CtCodeSnippet {
/**
* Sets the textual value of the code.
*/
@PropertyGetter(role = EXPRESSION)
@PropertySetter(role = EXPRESSION)
<C extends CtCodeSnippet> C setValue(String value);

/**
* Gets the textual value of the code.
*/
@PropertySetter(role = EXPRESSION)
@PropertyGetter(role = EXPRESSION)
String getValue();

}
2 changes: 1 addition & 1 deletion src/main/java/spoon/support/reflect/code/CtCaseImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
public class CtCaseImpl<E> extends CtStatementImpl implements CtCase<E> {
private static final long serialVersionUID = 1L;

@MetamodelPropertyField(role = CtRole.CASE)
@MetamodelPropertyField(role = CtRole.EXPRESSION)
CtExpression<E> caseExpression;

@MetamodelPropertyField(role = CtRole.STATEMENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public abstract class CtTypeImpl<T> extends CtNamedElementImpl implements CtType
@MetamodelPropertyField(role = CtRole.MODIFIER)
Set<ModifierKind> modifiers = emptySet();

@MetamodelPropertyField(role = CtRole.FIELD)
@MetamodelPropertyField(role = {CtRole.FIELD, CtRole.EXECUTABLE, CtRole.NESTED_TYPE})
List<CtTypeMember> typeMembers = emptyList();

public CtTypeImpl() {
Expand Down

0 comments on commit fa95062

Please sign in to comment.