Skip to content
Advertisement

Calling a class “if”

I’m trying to decompile / recompile an obfuscated Java program. From the decompiled source code, it looks like the obfuscator has managed to call a class if:

JavaScript

Trying to recompile this class of course now results in an error:

JavaScript

Is there a way to tell the java compiler to accept if as a class name? Otherwise, what are my options? renaming the class and finding all the references to it?

Advertisement

Answer

Java source code may have that constraint, but bytecode and classloaders do not care.

It’s the compiler that enforces that. If you use an alternative compiler to javac, or otherwise manipulate or generate some bytecode, then you are potentially able to do things that are normally impossible.

That’s what an obfuscator is likely to do.

The obfuscator is presumably exploiting this impossibility to make deobfuscation either more difficult or fail completely. Basically, the problem you’re having is quite possibly by design.

Is there a way to tell the java compiler to accept if as a class name?

Nope.

Otherwise, what are my options? renaming the class and finding all the references to it?

Yup.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement