mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-21 13:20:56 +07:00
Fixes IDEA-218207 Move refactoring doesn't work for local classes Also: Convert anonymous to inner -> do not create fields used in other field initializers only Also: Convert anonymous to inner -> capture implicitly referred type parameters (mentioned in types of captured variables) GitOrigin-RevId: 5d326e0b6fdff4de850ce48582cc3ca0fe003b43
40 lines
948 B
Java
40 lines
948 B
Java
import java.util.function.IntFunction;
|
|
|
|
public class LocalClass {
|
|
<T> void test(int x, T t) {
|
|
|
|
InnerClass<T> h = new InnerClass<>(1, x);
|
|
IntFunction<InnerClass<T>> ic = a -> new InnerClass<>(a, x);
|
|
System.out.println(new InnerClass<T>(1, x) {
|
|
void test() {}
|
|
});
|
|
|
|
h.run(t);
|
|
}
|
|
|
|
private static class InnerClass<T> {
|
|
private final int x;
|
|
|
|
InnerClass(int a, int x) {
|
|
this.x = x;
|
|
System.out.println("hi"+x);
|
|
}
|
|
InnerClass(String a, int x) {
|
|
this.x = x;
|
|
System.out.println("hi"+x);
|
|
}
|
|
|
|
static {
|
|
System.out.println("hello");
|
|
}
|
|
|
|
void run(T t) {
|
|
System.out.println(x);
|
|
System.out.println(InnerClass.class);
|
|
var xHello = new InnerClass<T>(3, x);
|
|
System.out.println(xHello);
|
|
xHello.run(t);
|
|
}
|
|
}
|
|
}
|