PAMunb / JimpleFramework

A Rascal implementation of the Jimple framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in Decompiler class when processing classes with java 8 stream mechanism

faustocarva opened this issue · comments

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());
		}
	}	

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

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