Skip to content

Commit

Permalink
fix: Use wildcard type in CtUnaryOperator get/setOperand
Browse files Browse the repository at this point in the history
  • Loading branch information
I-Al-Istannen committed Aug 27, 2023
1 parent dae341a commit 4cb294f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ public <T> void visitCtUnaryOperator(CtUnaryOperator<T> operator)
case PREINC:
case POSTDEC:
case PREDEC:
CtExpression<T> operand = operator.getOperand();
CtExpression<?> operand = operator.getOperand();
Expr prevExpr;
if (operand instanceof CtArrayWrite)
{
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/spoon/reflect/code/CtUnaryOperator.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ public interface CtUnaryOperator<T> extends CtExpression<T>, CtStatement {
* Gets the expression to which the operator is applied.
*/
@PropertyGetter(role = EXPRESSION)
CtExpression<T> getOperand();
CtExpression<?> getOperand();

/**
* Sets the expression to which the operator is applied.
*/
@PropertySetter(role = EXPRESSION)
<C extends CtUnaryOperator> C setOperand(CtExpression<T> expression);
<C extends CtUnaryOperator> C setOperand(CtExpression<?> expression);

/**
* Sets the kind of this operator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public class CtUnaryOperatorImpl<T> extends CtExpressionImpl<T> implements CtUna
String label;

@MetamodelPropertyField(role = EXPRESSION)
CtExpression<T> operand;
CtExpression<?> operand;

@Override
public void accept(CtVisitor visitor) {
visitor.visitCtUnaryOperator(this);
}

@Override
public CtExpression<T> getOperand() {
public CtExpression<?> getOperand() {
return operand;
}

Expand Down Expand Up @@ -76,7 +76,7 @@ public <C extends CtStatement> C insertBefore(CtStatementList statements) {
}

@Override
public <C extends CtUnaryOperator> C setOperand(CtExpression<T> expression) {
public <C extends CtUnaryOperator> C setOperand(CtExpression<?> expression) {
if (expression != null) {
expression.setParent(this);
}
Expand Down

0 comments on commit 4cb294f

Please sign in to comment.