Is there an explicit way to stop ProGuard from changing a class from implementing an interface?
I have a class that implements java.io.Serializable , let's call it com.my.package.name.Foo . I found that after starting ProGuard it no longer implements Serializable . I get null after I cast from Serializable to Foo and false if I test an instance with instanceof Serializable . I made sure that ProGuard ignores this class:
-keep class com.my.package.name.Foo
I also tried:
-keep class com.my.package.name.Foo { *; }
and I also tried the whole package by doing the following:
-keep class com.my.package.name.** { *; }
or
-keep class com.my.package.** { *; }
and also just save all the classes Serializable :
-keep class * implements java.io.Serializable { *; }
but to no avail. I have another class in the sibling package (approximately: com.my.package.name2.Bar ) that also implements Serializable and is used in a similar way, but has no problems.
I'm not sure if this is relevant, but I collect it in a bank for use with Android. The code that uses these classes includes their placement in the Bundle , so I need Serializable . I thought that maybe somehow ProGuard thinks that Foo never used as Serializable , but it seems unlikely given that I pass it as a parameter to Bundle.putSerializable(String, Serializable) , and also I do an implicit listing : Serializable serializable = foo; . In fact, when I debug, I can see that Foo get put in the Bundle , and I can check the Bundle and see the instance of Foo there, but it gets reset when it is received.
kabuko
source share