Files
openide/java/java-tests/testData/refactoring/anonymousToInner/localClassNoRename_after.java
Tagir Valeev 013651b75d [java-refactoring] Minor fixes in AnonymousToInnerHandler
1. Adapt messages to speak about local class when applicable
2. Fix when name is not changed, but we have type parameters

GitOrigin-RevId: bd3dbda21922473c9c4e52bccf840a35c55c9d59
2023-07-26 12:45:58 +00:00

40 lines
898 B
Java

import java.util.function.IntFunction;
public class LocalClass {
<T> void test(int x, T t) {
Hello<T> h = new Hello<>(1, x);
IntFunction<Hello<T>> ic = a -> new Hello<>(a, x);
System.out.println(new Hello<T>(1, x) {
void test() {}
});
h.run(t);
}
private static class Hello<T> {
private final int x;
Hello(int a, int x) {
this.x = x;
System.out.println("hi"+x);
}
Hello(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(Hello.class);
var xHello = new Hello<T>(3, x);
System.out.println(xHello);
xHello.run(t);
}
}
}