Reputation: 95
I am experiencing a strange behavior with YGuard obfuscation in Java 11. I have a class which has some private fields and methods and inner classes as below.
public class TestClass {
private int age;
public void accessInnerClassVaiable() {
InnerClass innerClz = new InnerClass();
// Below lines throw java.lang.IllegalAccessError after obfuscation.
System.out.println("Inner Class variable value:" + innerClz.innerVar);
innerClz.accessAge();
}
class InnerClass {
private int innerVar = 10;
public void accessAge() {
// Below line throws java.lang.IllegalAccessError after obfuscation.
innerVar = age;
}
}
}
If I compile and run the program, it works fine.
But after obfuscated my class files using YGuard (3.0.0), while running the program the lines mentioned above throws java.lang.IllegalAccessError as
The outer class access the private fields/ methods present in the inner class
The inner class access the private fields/ methods present in the outer class.
Can anyone shed some light on how to overcome this issue?
Thanks in advance.
Upvotes: 1
Views: 217