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

CFR option uses FernFlower #87

Open
TheKodeToad opened this issue Jul 22, 2022 · 13 comments
Open

CFR option uses FernFlower #87

TheKodeToad opened this issue Jul 22, 2022 · 13 comments

Comments

@TheKodeToad
Copy link

TheKodeToad commented Jul 22, 2022

This is quite weird, and also quite annoying since CFR is one of the better decompilers.
The decompilation report also has no decompiler present, like it's some kind of fallback.

/*
	DECOMPILATION REPORT

	Decompiled from: /my/jar/file.jar
	Total time: 11 ms
	
*/
@jpstotz
Copy link
Collaborator

jpstotz commented Jul 25, 2022

The decompiler names were simply missing for some decompilers. I added them in fd5ef2d

But I wasn't able to reproduce your problem with CFR/FernFlower. Neither when I set CFR as default decompiler nor when I manually select a class to be decompiled by CFR it was always CFR decompiler used.

As FernFlower already had it's name in the DECOMPILATION REPORT I would assume that the used decompiler was really CFR and not FernFlower.

@TheKodeToad
Copy link
Author

For me it is definitely FernFlower being used, as #88 was also an issue and the output identical.

@TheKodeToad TheKodeToad changed the title CFR option uses Fernflower CFR option uses FernFlower Jul 26, 2022
@jpstotz
Copy link
Collaborator

jpstotz commented Jul 26, 2022

Which ECD and Eclipse version do you use?

@TheKodeToad
Copy link
Author

TheKodeToad commented Jul 26, 2022

ECD 3.2.2 on Eclipse IDE for Java Developers 2022-06. This seems to be the latest stable version.

In some cases there are some comments in this format

// $FF: Mission failed

@jpstotz
Copy link
Collaborator

jpstotz commented May 1, 2023

Could you please test the latest version ECD 3.3.0?

@TheKodeToad
Copy link
Author

It still has the same issue.

@jpstotz
Copy link
Collaborator

jpstotz commented May 1, 2023

Just to make sure please to the following:

  1. Make sure you are not in Debug perspective in Eclipse (no decompilation repot when in Debug perspective).
  2. Open a project and there got to the referenced libraries
  3. Select a class file and open it's context menu and select Open Class With-> CFR

@TheKodeToad
Copy link
Author

Yep, same thing is happening

@jpstotz
Copy link
Collaborator

jpstotz commented May 2, 2023

Can you please describe in detail what "same thing happens" means?

What actual decompiled code do you get? Would it be possible that you upload the Jar file or the class file(s) you try to decompile or a sample Eclipse project/workspace?

@TheKodeToad
Copy link
Author

TheKodeToad commented May 2, 2023

In this case I was testing with Gradle's API, and I got the same decompiled code with both CFR and FernFlower!

@jpstotz
Copy link
Collaborator

jpstotz commented May 3, 2023

I finally found the code that causes fallback to FernFlower: https://github.com/ecd-plugin/ecd/blob/master/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/editor/BaseDecompilerSourceMapper.java#L160-L168

Looks like this happens if the selected decompiler has not returned any decompiled code.

@jpstotz
Copy link
Collaborator

jpstotz commented Mar 18, 2024

The reason for this behavior is that CFR has no option to provide code where the line numbers match the original line numbers (thus the code is useful for debugging).

Therefore ECD does not make use of CFR in debugger mode (debugging perspective?). But it seems that the debugger detection doesn't work as expected in some Eclipse versions. If you try to use CFR in debugging mode, then it will fall back to a different decompiler like FernFlower.

@nbauma109
Copy link

See also this discussion on CFR: leibnitz27/cfr#73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants