Hi, I'm trying to obfuscate our application that runs fine when not obfuscated. The application is built on the Spring framework, and apparently I'm having problems getting Spring and ProGuard to play nicely with one another.
At this point I've told ProGuard to keep every thing about the offending class, but it still seems it feels the need to optimize even after telling it -dontoptimize. My big suspicion is that it has something to do with an optimization of a switch call. The output map shows the following:
My concern is with this de.aeromaritime.messaging.roudistsrv.data.RdsDAO$1 -> de.aeromaritime.messaging.roudistsrv.data.RdsDAO$1:
int[] $SwitchMap$de$aeromaritime$messaging$mail$type$SortType -> a as this is not an internal class we're dealing with just a simple switch. Even stranger when I use a decompiler to view this a.class created here I find it basically empty. Just the standard class items. Now I have no idea if this is what it should look like or not but it looks wrong. The worse part is that I cannot get Spring to see this file or its annotations even though I've told ProGuard to -keep, -keepnames, -keepmembernames and as well as to -keepattributes Annotation.
Any help to get this figured out would be most appreciated.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
With -dontoptimize, the bytecode is left unchanged, but classes, fields, and methods may still be removed (if unused) or renamed (if possible).
"de.....data.RdsDAO$1" is an anonymous inner class of RdsDAO. ProGuard has not renamed it, probably because you have a -keep option for it.
"$SwitchMap$...$SortTyp" is a field of type "int[]" in this inner class. The javac compiler has added this synthetic field to implement a switch statement on an enum type "de.....type.SortTyp". ProGuard has renamed the field to "a". So in this context, "a" is not a class, just a field. You can preserve the class, its fields, and its methods, with their original names, with:
-keep class de.aeromaritime.messaging.roudistsrv.data.RdsDAO$1 {
*;
}
You can tweak the option to keep more or fewer classes, fields, and methods.
Without details on the actual errors, I can't really tell if this is related to the problems with Spring. Spring uses a lot of reflection to access classes, fields, and/or methods, so you may need to preserve those. If you are using annotations, you indeed want to preserve those:
-keepattributes *Annotation*
For some frameworks, you need to preserve other attributes as well:
Hi, I'm trying to obfuscate our application that runs fine when not obfuscated. The application is built on the Spring framework, and apparently I'm having problems getting Spring and ProGuard to play nicely with one another.
At this point I've told ProGuard to keep every thing about the offending class, but it still seems it feels the need to optimize even after telling it -dontoptimize. My big suspicion is that it has something to do with an optimization of a
switch
call. The output map shows the following:My concern is with this de.aeromaritime.messaging.roudistsrv.data.RdsDAO$1 -> de.aeromaritime.messaging.roudistsrv.data.RdsDAO$1:
int[] $SwitchMap$de$aeromaritime$messaging$mail$type$SortType -> a as this is not an internal class we're dealing with just a simple switch. Even stranger when I use a decompiler to view this a.class created here I find it basically empty. Just the standard class items. Now I have no idea if this is what it should look like or not but it looks wrong. The worse part is that I cannot get Spring to see this file or its annotations even though I've told ProGuard to -keep, -keepnames, -keepmembernames and as well as to -keepattributes Annotation.
Any help to get this figured out would be most appreciated.
With -dontoptimize, the bytecode is left unchanged, but classes, fields, and methods may still be removed (if unused) or renamed (if possible).
"de.....data.RdsDAO$1" is an anonymous inner class of RdsDAO. ProGuard has not renamed it, probably because you have a -keep option for it.
"$SwitchMap$...$SortTyp" is a field of type "int[]" in this inner class. The javac compiler has added this synthetic field to implement a switch statement on an enum type "de.....type.SortTyp". ProGuard has renamed the field to "a". So in this context, "a" is not a class, just a field. You can preserve the class, its fields, and its methods, with their original names, with:
You can tweak the option to keep more or fewer classes, fields, and methods.
Without details on the actual errors, I can't really tell if this is related to the problems with Spring. Spring uses a lot of reflection to access classes, fields, and/or methods, so you may need to preserve those. If you are using annotations, you indeed want to preserve those:
For some frameworks, you need to preserve other attributes as well:
Thanks, that moved me further. At least now I can get to the next error in the line :D.
Any progress is good progress.