Skip to content

Commit

Permalink
fix: Use wildcard type in CtUnaryOperator get/setOperand (#5399)
Browse files Browse the repository at this point in the history
  • Loading branch information
I-Al-Istannen authored Aug 28, 2023
1 parent 335bcc9 commit 3dcff6a
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 3dcff6a

Please sign in to comment.