Java – why does my compiled class have its method local variables renamed?

I have a kitchen Jar file I need to modify one of its classes I decompile it with JD Then I modified toster Java file and compile it with the following code:

javac -classpath . Toster.java

Then I took it back to kitchen jar:

jar -uf Kitchen.jar Toster.class

All work except one problem When I open the updated kitchen in JD Jar, I see that the local variables in all methods are renamed to locallongvar Why?

The reason I asked was because of kitchen Jar refused to work after modification I suspect it must be a compilation problem Maybe I misused some flags or anything uncertain. I know nothing about Java except the basic syntax

My guess is that I compiled it with the latest version 1.7, and the original jar was compiled with the older JDK This may explain the failure of the operation, but it does not explain the local renaming

example

Random lines from the original jar:

BigInteger[] result = new BigInteger[bis.length / 2];

classmate:

BigInteger[] arrayOfBigInteger1 = new BigInteger[paramArrayOfBigInteger.length * 2];

So its result corresponds to arrayofbiginteger1

Solution

By default, javac deletes debugging information other than source files and line numbers Compile using javac - g or javac - G: vars

From documentation of javac

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>