mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
introduce variable: case with unresolved reference and replace all
EA-90834 - AIOOBE: AbstractInplaceIntroducer.lambda$restoreState$
This commit is contained in:
+1
@@ -405,6 +405,7 @@ public class JavaVariableInplaceIntroducer extends AbstractJavaInplaceIntroducer
|
||||
occurrences.add(createMarker(reference.getElement()));
|
||||
});
|
||||
setOccurrenceMarkers(occurrences);
|
||||
myOccurrences = new PsiExpression[occurrences.size()];
|
||||
}
|
||||
|
||||
final PsiIdentifier identifier = variable.getNameIdentifier();
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
|
||||
class Demo {
|
||||
void d(String s){
|
||||
System.out.println(<caret>s);
|
||||
System.out.println(s);
|
||||
System.out.println(s1);
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
|
||||
class Demo {
|
||||
void d(String s){
|
||||
String expr = s;
|
||||
System.out.println(expr);
|
||||
System.out.println(expr);
|
||||
System.out.println(expr);
|
||||
}
|
||||
|
||||
}
|
||||
+9
@@ -125,6 +125,15 @@ public class InplaceIntroduceVariableTest extends AbstractJavaInplaceIntroduceTe
|
||||
});
|
||||
}
|
||||
|
||||
public void testReplaceAllOnDummyCodeWithSameNameAsGenerated() throws Exception {
|
||||
doTestReplaceChoice(IntroduceVariableBase.JavaReplaceChoice.ALL, new Pass<AbstractInplaceIntroducer>() {
|
||||
@Override
|
||||
public void pass(AbstractInplaceIntroducer inplaceIntroduceFieldPopup) {
|
||||
type("expr");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testRanges() throws Exception {
|
||||
doTest(new Pass<AbstractInplaceIntroducer>() {
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -451,7 +451,7 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
|
||||
}
|
||||
}
|
||||
final List<RangeMarker> occurrenceMarkers = getOccurrenceMarkers();
|
||||
for (int i = 0, occurrenceMarkersSize = occurrenceMarkers.size(); i < occurrenceMarkersSize; i++) {
|
||||
for (int i = 0; i < occurrenceMarkers.size(); i++) {
|
||||
RangeMarker marker = occurrenceMarkers.get(i);
|
||||
if (getExprMarker() != null && marker.getStartOffset() == getExprMarker().getStartOffset() && myExpr != null) {
|
||||
myOccurrences[i] = myExpr;
|
||||
|
||||
Reference in New Issue
Block a user