Skip to content

Commit

Permalink
Place setAddFinal in the correct proposal.
Browse files Browse the repository at this point in the history
- Remove setAddFinal from AssignToVariableAssistProposalCore and place
  it in NewVariableCorrectionProposalCore

This reverts commit 14c5480.
  • Loading branch information
rgrunber committed Apr 16, 2024
1 parent 48468d1 commit c183806
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public class AssignToVariableAssistProposalCore extends LinkedCorrectionProposal
private final List<String> fParamNames;

private VariableDeclarationFragment fExistingFragment;
private boolean fAddFinal;
private final boolean fAddFinal;

public AssignToVariableAssistProposalCore(ICompilationUnit cu, int variableKind, ExpressionStatement node, ITypeBinding typeBinding, int relevance, boolean addFinal) {
super("", cu, null, relevance); //$NON-NLS-1$
Expand Down Expand Up @@ -370,10 +370,6 @@ private boolean needsSemicolon(Expression expression) {
return false;
}

public void setAddFinal (boolean addFinal) {
this.fAddFinal= addFinal;
}

private ASTRewrite doAddField(ASTRewrite rewrite, ASTNode nodeToAssign, ITypeBinding typeBinding, int index) {
boolean isParamToField= nodeToAssign.getNodeType() == ASTNode.SINGLE_VARIABLE_DECLARATION;

Expand Down Expand Up @@ -639,4 +635,4 @@ public int getVariableKind() {
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public class NewVariableCorrectionProposalCore extends LinkedCorrectionProposalC
final private int fVariableKind;
final private SimpleName fOriginalNode;
final private ITypeBinding fSenderBinding;
final private boolean fAddFinal;
private boolean fAddFinal;

public NewVariableCorrectionProposalCore(String label, ICompilationUnit cu, int variableKind, SimpleName node, ITypeBinding senderBinding, int relevance, boolean addFinal) {
super(label, cu, null, relevance);
Expand All @@ -103,7 +103,7 @@ public NewVariableCorrectionProposalCore(String label, ICompilationUnit cu, int
fVariableKind= variableKind;
fOriginalNode= node;
fSenderBinding= senderBinding;
fAddFinal = addFinal;
fAddFinal= addFinal;
}

@Override
Expand Down Expand Up @@ -626,4 +626,8 @@ public int getVariableKind() {
return fVariableKind;
}

public void setAddFinal(boolean addFinal) {
fAddFinal= addFinal;
}

}

0 comments on commit c183806

Please sign in to comment.