Live data from Hacker News

Show HN: I wrote a Java decompiler in pure C language

github.com

81–90 of 104 posts

Re: Show HN: I wrote a Java decompiler in pure C language

#81
post #34
post #32

Earlier quoted context omitted.

Things may have changed, but my impression as of several years ago was that JD-GUI was far, far behind the state of the art (Fernflower, aka the built-in IntelliJ decompiler) in terms of correctness, re-sugaring, support for modern Java features, and so on. Fernflower is open source as part of IntelliJ: https://github.com/fesh0r/fernflower

Is there a good GUI for this a la jadx-gui that isn't an entire IDE?

Recaf

Re: Show HN: I wrote a Java decompiler in pure C language

#82

You've used GPL2 code taken from git (hashmap.c) in your Apache 2.0 project. https://opensource.stackexchange.com/questions/10737/inclusi...

I'm curious, how did you notice this? Do you have a scanner that checks these sorts of things or is it something that you are passionate about?

I'm not them, but it does straight up say in hashmap.c that the code was copied from https://github.com/git/git/blob/master/hashmap.c, which is under the GPL license.

Re: Show HN: I wrote a Java decompiler in pure C language

#83
post #71

I don't think it's available in a standalone repo but it IS available as a standalone library, IntelliJ's FernFlower decompiler is the gold standard https://github.com/JetBrains/intellij-community/blob/master/... https://www.jetbrains.com/intellij-repository/releases I guess there's some history there that I'm not familiar with because JBoss also has a FernFlower decompiler library https://mvnrepository.com/artifact/…

https://github.com/Vineflower/vineflower

Re: Show HN: I wrote a Java decompiler in pure C language

#85

You've used GPL2 code taken from git (hashmap.c) in your Apache 2.0 project. https://opensource.stackexchange.com/questions/10737/inclusi...

I'm curious, how did you notice this? Do you have a scanner that checks these sorts of things or is it something that you are passionate about?

By the following very short garden path:

1. How silly to write such a thing in C from scratch. Such a project will invariably invent half of Lisp in order to have the right kind of infrastructure for doing this and that.

2. Let's look for some of it up and down the tree. Oh look, there is a bitset and hashmap, see? I don't see test cases for these anywhere; is it original work from this project or battle-tested code taken from elsewhere?

3. Open hashmap.c ...

GPL violation found in half a minute.

Re: Show HN: I wrote a Java decompiler in pure C language

#86
post #75

Earlier quoted context omitted.

I am writing the part of decompiling dex and apk. The current speed is about 10 times faster than that of Java, and it takes up less resources than Java. And the compiled binary is smaller, only about 300k. Thank you for your attention.

> 10 times faster than that of Java I was hoping that these days' Java would be "almost" as fast C/C++. Oh well.

In the process of writing this, I learned a lot about JVM. JVM has done well enough, even surpassing C/C++ in some cases.

Re: Show HN: I wrote a Java decompiler in pure C language

#87
post #27

I am always curious how different C programs decide how to manage memory. In this case there are is a custom string library. Functions returned owned heap-allocated strings. However, I think there's a problem where static strings are used interchangably with heap-allocated strings, such as in the function `string class_simple_name(string full)` ( https://github.com/neocanable/garlic/blob/72357ddbcffdb75641... ) Somet…

In the same file:

  static bool is_java_identifier_start(char c)
  {
    return (isalpha(c) || c == '_' || c == '$');
  }
Undefined behavior in isalpha if c happens to be negative (and not equal to EOF), like some UTF-8 byte.

I think some implementations are hardened against this issue, but not all.

Re: Show HN: I wrote a Java decompiler in pure C language

#88

Earlier quoted context omitted.

I'm curious, how did you notice this? Do you have a scanner that checks these sorts of things or is it something that you are passionate about?

By the following very short garden path: 1. How silly to write such a thing in C from scratch. Such a project will invariably invent half of Lisp in order to have the right kind of infrastructure for doing this and that. 2. Let's look for some of it up and down the tree. Oh look, there is a bitset and hashmap, see? I don't see test cases for these anywhere; is it original work from this project or battle-tested code…

Yea I'm not criticizing you. Was just genuinely curious. Thanks

Re: Show HN: I wrote a Java decompiler in pure C language

#89

Earlier quoted context omitted.

I'm curious, how did you notice this? Do you have a scanner that checks these sorts of things or is it something that you are passionate about?

I'm not them, but it does straight up say in hashmap.c that the code was copied from https://github.com/git/git/blob/master/hashmap.c , which is under the GPL license.

Yea I saw that after looking it up. I wasn't questioning the statement, but me personally I wouldn't look at each file and look for license violations. That's all.
Post reply on HN