Files
openide/java/java-tests/testData/refactoring/extractMethod/ParametrizedDuplicateFoldArrayElementTwoUsages_after.java
Anna Kozlova f2d460469a extract method: disable array access folding by default for cases where access is performed under condition
pessimistic approach for now: even if the condition consists of array access only; do not depend on the order of found references

GitOrigin-RevId: 0d111aad6b69729404183520d1f4d01cba583a1c
2019-10-11 21:02:34 +00:00

25 lines
604 B
Java

import org.jetbrains.annotations.Nullable;
class DeclaredOutputVariable {
void foo(String[] a, int j) {
String s = newMethod(a, j, 1, "X");
if (s == null) return;
System.out.println(s.length());
}
@Nullable
private String newMethod(String[] a, int j, int i, String x) {
if (a[j] == null) return null;
String s = a[j];
System.out.println(s.charAt(i) + x);
return s;
}
void bar(String[] a, int k) {
String s = newMethod(a, k, 2, "Y");
if (s == null) return;
System.out.println(s.length());
}
}