Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when decompiling code with reflection call. #14

Open
faustocarva opened this issue Oct 5, 2020 · 0 comments
Open

Error when decompiling code with reflection call. #14

faustocarva opened this issue Oct 5, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@faustocarva
Copy link
Contributor

Hi, the decompile method in Decompiler class is generating an error when processing classes with java reflection mechanism.
Below is the code to reproduce the error:

public class Reflection {
	
  public static void staticInvokeReflection() throws NoSuchMethodException {
    // Invoking static method using reflection
    Method method = A.class.getMethod("staticFoo");
    try {
      method.invoke(null);
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (InvocationTargetException e) {
      e.printStackTrace();
    }
  }
}

The A.java file:

public class A {
	public static void staticFoo() {
		System.out.println("foo");
	}
}

Error message:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running lang.jimple.internal.TestDecompiler
java.lang.ClassCastException: lang.jimple.internal.generated.Immediate$c_iValue cannot be cast to lang.jimple.internal.generated.Immediate$c_local
	at lang.jimple.internal.Decompiler$InstructionSetVisitor.invokeMethodIns(Decompiler.java:698)
	at lang.jimple.internal.Decompiler$InstructionSetVisitor.visitMethodInsn(Decompiler.java:555)
	at org.objectweb.asm.tree.MethodInsnNode.accept(Unknown Source)
	at org.objectweb.asm.tree.InsnList.accept(Unknown Source)
	at lang.jimple.internal.Decompiler$GenerateJimpleClassVisitor.visitMethod(Decompiler.java:210)
	at lang.jimple.internal.Decompiler$GenerateJimpleClassVisitor.visitEnd(Decompiler.java:162)
	at org.objectweb.asm.ClassReader.accept(Unknown Source)

@faustocarva faustocarva added the bug Something isn't working label Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant