public class CtRenameLocalVariableRefactoring extends AbstractRenameRefactoring<CtLocalVariable<?>>
RefactoringException
if the model would be not consistent after rename to new name.
The exception is thrown before the model modificatons are started.
CtLocalVariable anLocalVariable = ... RenameLocalVariableRefactor refactor = new RenameLocalVariableRefactor(); refactor.setTarget(anLocalVariable); refactor.setNewName("someNewName"); try { refactor.refactor(); } catch (RefactoringException e) { //handle name conflict or name shadowing problem }
Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
validVariableNameRE |
javaIdentifierRE, newName, newNameValidationRE, target
Constructor and Description |
---|
CtRenameLocalVariableRefactoring() |
Modifier and Type | Method and Description |
---|---|
protected void |
createNameConflictIssue(CtVariable<?> conflictVar)
Override this method to get access to details about this refactoring issue
|
protected void |
createNameConflictIssue(CtVariable<?> conflictVar,
CtVariableReference<?> shadowedVarRef)
Override this method to get access to details about this refactoring issue
|
protected void |
detectNameConflicts()
client may implement this method to check whether
AbstractRenameRefactoring.newName
is in conflict with names of other model elements |
protected void |
refactorNoCheck() |
checkNewNameIsValid, detectIssues, getNewName, getTarget, isJavaIdentifier, refactor, setNewName, setTarget
protected void refactorNoCheck()
refactorNoCheck
in class AbstractRenameRefactoring<CtLocalVariable<?>>
protected void detectNameConflicts()
AbstractRenameRefactoring
AbstractRenameRefactoring.newName
is in conflict with names of other model elementsdetectNameConflicts
in class AbstractRenameRefactoring<CtLocalVariable<?>>
protected void createNameConflictIssue(CtVariable<?> conflictVar)
conflictVar
- - variable which would be in conflict with the `targetVariable` after it's rename to new nameprotected void createNameConflictIssue(CtVariable<?> conflictVar, CtVariableReference<?> shadowedVarRef)
conflictVar
- - variable which would shadow reference to `targetVariable` after it's rename to new nameshadowedVarRef
- - the reference to `targetVariable`, which would be shadowed by `conflictVar`Copyright © 2007–2021 Inria. All rights reserved.