felix-search-webconsole-plugin icon indicating copy to clipboard operation
felix-search-webconsole-plugin copied to clipboard

Multi decompiler + FernFlower

Open ielali opened this issue 3 years ago • 15 comments

Hello again, finally had some time to work on this project.

I ended up creating a branch with a drop down for all the compilers I've discovered so far. Even if we don't go with that option it's still very useful to compare and choose the decompiler for the next release.

I was finally able to make FurnFlower work but not without difficulty. As I mentionned before there are no official maven releases for this decompiler since it's destined to be an IntelliJ plugin. The only mirror that does a release is 4 years old, quite stale. So I ended up including the jar in the project and adding a maven system dependency. The maven bundle plugin needed an upgrade for this type of dependency to be embedded correctly. I also had to implement code to be able to target a single class in the bundle jar.

I didn't find any improvements over JD-Core which in my opinion still produce the best source code output. But I will let you test on your own and come back to me.

ielali avatar Feb 25 '21 23:02 ielali

great job. I was suspecting that Fernflower will produce the best outputs. So interesting. I will check that JD too.

Now I need to find some time to work on this too. It will be not so easy but I hope during next week I will prepare feedback for you. And I am not saying no to the multi-compiler release. If some compiler will not work on some runtime, there will be an option to try another one.

About embedding Fernflower and system dependency. Don't worry.  I don't take care. It's rather dev-tool ;) It just must work, that's all ;)

pun-ky avatar Feb 26 '21 07:02 pun-ky

One more proposal, bundle tree exploration source displayed in the same window for an easier exploration within a given bundle. I used a simple grid css based layout. Let me know what you think.

ielali avatar Mar 04 '21 00:03 ielali

just cloned your branch and tried building... :/

pun-ky avatar Mar 04 '21 19:03 pun-ky

I corrected cfr to 0.151 and now

pun-ky avatar Mar 04 '21 19:03 pun-ky

ok, switched java from 8 to 11 and works.... this is new constraint unfortunately :/

pun-ky avatar Mar 04 '21 19:03 pun-ky

how about that ? "could not load..."

pun-ky avatar Mar 04 '21 19:03 pun-ky

CFR seems to not work properly, inner classes not working :/ other compilers are working well with that class:

pun-ky avatar Mar 04 '21 19:03 pun-ky

With fernflower I had this issue with inner classes and I was forced to extract to a temporary directory all inner classes before being able to decompile. Maybe need the same fix.

ielali avatar Mar 04 '21 19:03 ielali

css need to be fixed; finally, I could correct styling, no worries ;)

 

pun-ky avatar Mar 04 '21 19:03 pun-ky

3 decompilers with that switch is generally fancy and I am opting for keeping it. However, it depends on you and your power to provide enough stability/quality in the final implementation.

saying that the next version will be 2.0.0 and java supported will be at least 11 is also fine.

so keep up at good work ;)

finally, I will probably tune a little bit UI then release it but at first, please resolve CFR issues

pun-ky avatar Mar 04 '21 20:03 pun-ky

CFR inner class issue corrected, working fine in AEM (6.5). Found the issue with Sling Starter, the bundle jar resolution was not working. Apparently it's now sourcing jars directly from maven repository. So now if the jar is not found through the bundle dir we try to resolve the bundle location. Don't know if you have a better approach. | ~/Development/Tools/sling-org-apache-sling-starter/launcher/framework @ C02WP09MHV2R (imad.elali) (master) | => cat bundle99/bundle.info 99 reference:file:/Users/imad.elali/.m2/repository/org/apache/jackrabbit/oak-jackrabbit-api/1.32.0/oak-jackrabbit-api-1.32.0.jar 32 15 1614898569593 0

ielali avatar Mar 04 '21 23:03 ielali

@ielali I remember about work you did and I will consume it when I find some time for sure ;)

pun-ky avatar Mar 15 '21 11:03 pun-ky

hmm strange

java.lang.IllegalArgumentException: No enum constant com.neva.felix.webconsole.plugins.search.decompiler.Decompilers.
	at java.base/java.lang.Enum.valueOf(Enum.java:240)
	at com.neva.felix.webconsole.plugins.search.decompiler.Decompilers.valueOf(Decompilers.java:3)
	at com.neva.felix.webconsole.plugins.search.rest.ClassDecompileServlet.doGet(ClassDecompileServlet.java:71)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:123)
	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:86)
	at com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:308)

pun-ky avatar Feb 16 '22 13:02 pun-ky

hmm strange

java.lang.IllegalArgumentException: No enum constant com.neva.felix.webconsole.plugins.search.decompiler.Decompilers.
	at java.base/java.lang.Enum.valueOf(Enum.java:240)
	at com.neva.felix.webconsole.plugins.search.decompiler.Decompilers.valueOf(Decompilers.java:3)
	at com.neva.felix.webconsole.plugins.search.rest.ClassDecompileServlet.doGet(ClassDecompileServlet.java:71)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:123)
	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:86)
	at com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:308)

In with environment did you get this? the bundle is working fine in AEM 6.5

ielali avatar Feb 17 '22 06:02 ielali

Aem 6.5.11, jdk 11, mac

krystian-panek-wttech avatar Feb 17 '22 10:02 krystian-panek-wttech