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

neocanable | 166 points

You've used GPL2 code taken from git (hashmap.c) in your Apache 2.0 project.

https://opensource.stackexchange.com/questions/10737/inclusi...

kazinator | 2 days ago

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... )

Sometimes it returns a static string like `g_str_int` and sometimes a newly heap-allocated string, such as returned by `class_type_array_name(g_str_int, depth)`.

Callers have no way to properly release the memory allocated by this function.

gibibit | 3 days ago

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/org.jboss.windup.decompil...

jbellis | 2 days ago

Very cool project! Love the idea of a Java decompiler written in C — the speed must be great.

Any plan to support `.dex` in the future? Also curious how you handle inner classes inside JARs.

appendixv3 | 3 days ago

Nice job! I don't know whether you know https://github.com/java-decompiler/jd-gui or not, but in case you haven't seen it before, maybe you could use it as a reference, since it's written in Java, for extra fun with your adventure?

stefanos82 | 3 days ago

How does the output compare to https://www.decompiler.com/ in terms of correctness?

cosmolev | 3 days ago

By hand or with AI? Fascinating. So much work! What was your motivation for this?

keepamovin | 3 days ago

Can you also write a C decompiler in pure Java language?

ConanRus | 2 days ago

[flagged]

yusina | 3 days ago

I cannot help but wonder why starting a new project in C in 2025. It’s like driving a car with no seat belts. You sure you want to do that?

kamma4434 | 2 days ago
[deleted]
| 3 days ago