We have some enums in our codebase that are excluded from obfuscation using -keep. They don’t appear to be obfuscated, but if you call EnumClass.VALUE.getClass().getEnclosingClass() it returns null, where in their non-obfuscated form it would return EnumClass.class.
I have put together what I think is a minimal reproduction, could someone please tell me if I’m doing something wrong or if this is an issue with ProGuard.
First off, welcome to our community! I’ve cloned your repository and have tried the shell scripts. The clean install of both obfuscated and unobfuscated versions builds fine, but I get the following error when running the test module (mvn test -f test-module/pom.xml):
[ERROR] Failed to execute goal on project test-module: Could not resolve dependencies for project org.example:test-module:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.example:obfuscated-module:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for org.example:obfuscated-module:jar:1.0-SNAPSHOT: Could not find artifact org.example:GetEnclosingClassBugRepro:pom:1.0-SNAPSHOT -> [Help 1]
I’ve also tried the option -U but nothing additional seems to be built i.e. git doesn’t see any new files generated. Perhaps there are missing files in the repo? Or perhaps there should be some modifications to the pom.xml file in the test module so that it points to the snapshot jar file located within the obfuscated-module/target folder? Could you clarify how exactly you build the sample?
Thanks for taking a look. Apologies for that, I moved some stuff around and didn’t re-run it with an empty maven repo. I’ve fixed it now so the ./build_test_(un)obfuscated.sh scripts should work now.