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 in Decompiler class when processing classes with java 8 stream mechanism #8

Open
faustocarva opened this issue Sep 24, 2020 · 2 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 stream mechanism.
Below the code to reproduce the error:

package samples;

import java.util.Arrays;
import java.util.List; 

public class StreamSupportSample {

	public static void main(String[] args) {

		List<String> myList = Arrays.asList("a1", "a2", "b1", "c2", "c1");

		myList.stream().filter(s -> s.startsWith("c")).map(String::toUpperCase).sorted().forEach(System.out::println);
		
	}

}

Error message:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running lang.jimple.internal.TestDecompiler
java.util.EmptyStackException
	at java.util.Stack.peek(Stack.java:102)
	at java.util.Stack.pop(Stack.java:84)
	at lang.jimple.internal.Decompiler$InstructionSetVisitor.invokeMethodIns(Decompiler.java:669)
	at lang.jimple.internal.Decompiler$InstructionSetVisitor.visitMethodInsn(Decompiler.java:529)
	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:203)
	at lang.jimple.internal.Decompiler$GenerateJimpleClassVisitor.visitEnd(Decompiler.java:154)

Code to test the class:

	@Test 
	public void decompileStreamSupport() {
		try {
			File classFile = new File("./target/test-classes/samples/StreamSupportSample.class"); 			
			assertNotNull(classFile);
			
			IValueFactory vf = ValueFactory.getInstance();
			Decompiler decompiler = new Decompiler(vf);
			IConstructor c = decompiler.decompile(new FileInputStream(classFile), null);
			
			assertNotNull(c);
		}
		catch(Exception e) {
			e.printStackTrace();
			fail(e.getLocalizedMessage());
		}
	}	

@faustocarva
Copy link
Contributor Author

@rbonifacio this one is already done, corret? Can I close it?

@rbonifacio
Copy link
Collaborator

Not really @faustocarva . I have not fixed this issue yet.

@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

2 participants