Storyyeller / Krakatau

Java decompiler, assembler, and disassembler
GNU General Public License v3.0
1.95k stars 219 forks source link

Krakatau can't decompile lambda methods (invokedynamic) #111

Open GraxCode opened 7 years ago

GraxCode commented 7 years ago

new Thread(/*invokedynamic*/null).start();

Here is the bytecode of an example method: https://hastebin.com/mucecemodi.cs

Starting this with verification works.

Its actually quite easy to handle lambdas. instead of null, there is %objref% -> { //parsed lambda method } %objref% is "()", when the innerdesc of the lambda-method is empty, else its just the localvariables parsed from the desc.

GraxCode commented 7 years ago

here the bytecode in krakatau assembly: https://hastebin.com/ququvibuto.cs

Storyyeller commented 7 years ago

Is there an actual bug here, or is this just a request for lambda support? Because that sadly isn't going to happen in the forseeable future.

GraxCode commented 7 years ago

this is a request for lambda support, but why isn't this going to happen?

Storyyeller commented 7 years ago

Because I don't have much time to work on Krakatau, and it would be a ton of work, and there's a lot of other higher priority things that need to be done and it's not clear how lambdas could be supported anyway.

GraxCode commented 7 years ago

it wouldn't be a ton of lines, it is actually quite easy.

Storyyeller commented 7 years ago

If you think it is easy, you're welcome to try to implement it yourself.

KOLANICH commented 4 years ago

https://ci.appveyor.com/api/buildjobs/gtyiueue5u7joyiv/artifacts/compiler%2Fjvm%2Ftarget%2Fwindows%2Fkaitai-struct-compiler.msi (unpack it for example with lessmsi, contains a bunch of jars inside)

io\kaitai\struct\formats\JavaClassSpecs$.java

cfr:

Log$.MODULE$.importOps().info((Function0<String> & java.io.Serializable & Serializable)() -> new StringContext(Predef$.MODULE$.wrapRefArray((Object[])new String[] {".... cached"})).s(Nil$.MODULE$));

krakatau:

io.kaitai.struct.Log$.MODULE$.importOps().info(/*invokedynamic*/null);
Storyyeller commented 4 years ago

What are you trying to say?

KOLANICH commented 4 years ago

These are just examples of incorrect decompilation. I have planned to create a new issje but found an already existing one, so just dumped its text here.