fix reflect static interface
This commit is contained in:
parent
a7824c8c29
commit
8e03afd4ae
1 changed files with 2 additions and 12 deletions
|
|
@ -571,27 +571,18 @@ public class MainActivity extends Activity {
|
||||||
Utils.sink(this, newData);
|
Utils.sink(this, newData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Android is broken (what a surprise...), cannot get the Method representation
|
|
||||||
* of a static method implemented in an Interface.
|
|
||||||
*/
|
|
||||||
public void callStaticInheritedInterfaceReflect() throws
|
public void callStaticInheritedInterfaceReflect() throws
|
||||||
ClassNotFoundException,
|
ClassNotFoundException,
|
||||||
NoSuchMethodException,
|
NoSuchMethodException,
|
||||||
IllegalAccessException,
|
IllegalAccessException,
|
||||||
InvocationTargetException
|
InvocationTargetException
|
||||||
{
|
{
|
||||||
Utils.popup(this, "DEBUG", "R11 not implemented due to Android beeing Android");
|
|
||||||
/*
|
|
||||||
String data = Utils.source("R11 reflect static interface");
|
String data = Utils.source("R11 reflect static interface");
|
||||||
ClassLoader cl = MainActivity.class.getClassLoader();
|
ClassLoader cl = MainActivity.class.getClassLoader();
|
||||||
Class clz = cl.loadClass("com.example.theseus.reflection.IReflectee");
|
Class clz = cl.loadClass("com.example.theseus.reflection.IReflectee$-CC"); // <- lol, thanks android <https://r8.googlesource.com/r8/+/refs/heads/main/src/main/java/com/android/tools/r8/ir/desugar/itf/InterfaceMethodRewriter.java>
|
||||||
Utils.popup(this, "DEBUG", Arrays.deepToString(clz.getDeclaredMethods()));
|
Method mth = clz.getDeclaredMethod("staticDefaultInterfaceTransfer", String.class);
|
||||||
Utils.popup(this, "DEBUG", ""+clz.getMethods().length);
|
|
||||||
//Method mth = clz.getDeclaredMethod("staticDefaultInterfaceTransfer", String.class);
|
|
||||||
Method mth = clz.getMethod("staticDefaultInterfaceTransfer", String.class);
|
|
||||||
String newData = (String) mth.invoke(null, data);
|
String newData = (String) mth.invoke(null, data);
|
||||||
Utils.sink(this, newData);
|
Utils.sink(this, newData);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void callVirtualInheritedInterfaceFactory() {
|
public void callVirtualInheritedInterfaceFactory() {
|
||||||
|
|
@ -636,4 +627,3 @@ public class MainActivity extends Activity {
|
||||||
// TODO: call different methods with the same invoke
|
// TODO: call different methods with the same invoke
|
||||||
// TODO: several invoke in same method
|
// TODO: several invoke in same method
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue