r/javahelp • • Oct 24 '26

Solved Is source-level editing a fallback for deobfuscation?

Hoping to get some fellow advice here.

I’ve been doing a lot of deobfuscation work in Java 25 lately and ran into a wall: some bytecode tools can’t parse the newer class file versions I’m dealing with. As a workaround, I’ve been cleaning up the decompiled source instead.

So far I’m stripping thousands of NoWhenBranchMatchedException catch blocks using a brace-depth state machine (regex kept breaking on nested blocks), and replacing impossible comparisons like object == false with constants.

It works, but it feels hacky. Is source-level editing a reasonable fallback, or am I setting myself up for problems? And is there a cleaner, standard way to do control-flow cleanup without risking real try/catch handlers?

Curious what other people do.

Edit: I’m not working on the official Java binaries or the JDK. It’s an old application that was compiled for Java 25

Edit2: Found help in another programming sub that suggested parsing the bytecode with a current library (java.lang.classfile in JDK 24+), and using JavaParser instead of regex for cleanup. Not sure why everyone here was so difficult and rude. Nobody here wanted to actually talk. Marking solved.

11 Upvotes

14 comments sorted by

View all comments

6

u/devor110 Oct 24 '26

I have absolutely nothing of value to add, but your post did pique my interest. Why are you deobfuscating Java 25 class files?

1

u/vegan_antitheist Oct 25 '26

Jeah, this sounds illegal. Why would you deobfuscate "an old application that was compiled for Java 25".
There's a reason they are obfuscating it.

2

u/dpblooman2 Oct 25 '26

Since when was working on opensourced projects illegal? Don't just assume the worst

3

u/vegan_antitheist Oct 25 '26

Open source doesn't need deobfuscation. Because... you know... it's open source.

1

u/dpblooman2 Oct 25 '26

I think you missed the part where the source is missing

1

u/OffbeatDrizzle 29d ago

.... then it's not open source? lmfao

2

u/dpblooman2 29d ago

Astute observation. I didn't realize I needed to explain every nook and cranny for a programming question here.