开发者

where do the alphabet naming java class files come from?

开发者 https://www.devze.com 2023-02-01 17:58 出处:网络
guys, I used a decompiler jd-gui today and found something quite weird to me. Let\'s say I have a jar file, lib.jar, I decompiled it. It came out that there were some class files named like A.class,

guys, I used a decompiler jd-gui today and found something quite weird to me.

Let's say I have a jar file, lib.jar, I decompiled it. It came out that there were some class files named like A.class, B.class, a.class, etc, under same package. When I tried to paste the decompiled source files into eclipse project, but IDE said it would not accept A.class and a.class under the same folder. How could it be? I guess no one named his/her cl开发者_开发技巧ass files from a to z. But the decompiler told me so.

Also I tried to import lib.jar in my project, found that I cannot touch any public class or interface under that package where a.class and A.class resides in. No tips came out when I typed into that package, e.g., "import firm.tools."

Could anyone tell me the reason? Thanks in advance, and happy new year!


The jar file you have probably contains obfuscated class files. Obfuscated files have identifiers renamed to make them harder to understand by human readers. (Obfuscation does much more than just rename identifiers, but that's one of the things obfuscation usually does.)


but IDE said it would not accept A.class and a.class under the same folder.

This part is likely due to the fact that you're using a case-insensitive filesystem (e.g. NTFS on Windows). Thus it isn't possible for the IDE to create distinct files for A.class and a.class since the OS views them as equivalent filenames. This is not true for all systems, nor for the Java specification - hence it is possible to define Java classes that differ only in case (though this is not recommended due to the problem you've just illustrated).

(As for the names themselves, I agree with Chris that this is likely the result of obfuscation.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号