我注意到Proguard删除了方法的桥修饰符,即使该类被排除在具有apply
属性的混淆之外。我该如何避免这种行为?它打破了与第三方库的集成。
所以我有一个Scala函数对象,它有方法scala> classOf[TestFunction].getMethods.filter(m => m.getName == "apply" && !m.isBridge)
res0: Array[java.lang.reflect.Method] = Array(public final double TestFunction.apply(java.lang.Object))
。在混淆之前:
scala> classOf[TestFunction].getMethods.filter(m => m.getName == "apply" && !m.isBridge)
res0: Array[java.lang.reflect.Method] = Array(public final double TestFunction.apply(java.lang.Object), public final java.lang.Object TestFunction.apply(java.lang.Object))
混淆后:
-keepattributes Signature,*Annotation*
-keepattributes InnerClasses,EnclosingMethod
-keepattributes SourceFile,MethodParameters,Synthetic,Code,LineNumberTable
我需要这2个案例相似。
Proguard版本为5.3
UPD 我还保留以下属性:
HttpBaseProtocolFilter filter = new HttpBaseProtocolFilter();
filter.CacheControl.WriteBehavior = HttpCacheWriteBehavior.NoCache;
filter.CacheControl.ReadBehavior = HttpCacheReadBehavior.MostRecent;
filter.ServerCredential = new PasswordCredential(resourceUri.ToString(), username, password);
HttpClient client = new HttpClient(filter);