Open
Description
Describe the bug
I recently noticed that when using Refactoring.changeLocalVariableName(...)
on a LocalVariable
declared in a Type Pattern, references will not be renamed.
I suspect this is because the LocalVariableReference
s are not linked to the declaration.
Source code you are trying to analyze/transform
public class SomeOtherClass extends SomeClass{ }
public class SomeClass {
public void someMethod(SomeClass someParameter) {
SomeOtherClass b;
if (someParameter instanceof SomeOtherClass i) {
b = i;
}
}
}
Source code for your Spoon processing
Actual output
`getDeclaration()` returns `null`
Expected output
The `CtLocalVariableReference` should link to the CtLocalVariable declaration under the TypePattern
Spoon Version
JVM Version
openjdk 24.0.1 2025-04-15
What operating system are you using?
Arch Linux