mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-11 02:39:37 +07:00
The object may be only shallowly unmodifiable GitOrigin-RevId: 41c0a0b46fc80169ff334d6337d9f8708e689448
17 lines
340 B
Java
17 lines
340 B
Java
import java.util.*;
|
|
|
|
public class ArrayElementWrappedInPureMethod {
|
|
public static void main(String[] args) {
|
|
int[] data = {-1};
|
|
List<int[]> wrapped = wrap(data);
|
|
wrapped.get(0)[0] = 0;
|
|
if (data[0] == 0) {
|
|
System.out.println("oops");
|
|
}
|
|
}
|
|
|
|
static List<int[]> wrap(int[] data) {
|
|
return List.of(data);
|
|
}
|
|
}
|