Is it possible to compute name of class which was used to access static method?
To better understand question:
class S {
public static String method() {
return "S";// TODO compute class name here
}
}
class S1 extends S {
}
class S2 extends S {
}
public class Main {
public static void main(String[] args) {
System.out.println(S.method()); //should print S
System.out.println(S1.method()); //should print S1
System.out.println(S2.method()); //should print S2
}
}
It seems that I can't use neither stacktrace nor type parameter technique.
Thanks