Open OlafRoeder opened 3 years ago
It's a known issue; such use before initialization unfortunately occurs once in a while and is not entirely trivial to detect. You can keep the affected fields so their non-null initialization values are not propagated, e.g.
-keepclassmembers,allowshrinking,allowobfuscation class somepackage.SomeClass {
somepackage.SomeType someField;
}
Alternatively, you can disable value propagation for all fields:
-optimizations !field/propagation/value
Hello folks,
I have a situation where a final variable in a subclass is initialized in its constructor, but the superclass calls a method accessing that variable before it is initialized. Works without obfuscation because of a null check, but this very check is removed by obfuscation. SSCCE: https://github.com/OlafRoeder/ProGuardNPEFinalVarWithSetterFromParent
This situation should be detectable by some static code analysis.
Would very much appreciate a fix, but a workaround that does not involve changing code would do, too.
Greetings, Olaf