如何使用 Proguard 缩小 scala swing 库?
我尝试使用 Proguard 来缩小和混淆我的 Scala/Java 程序。当我只使用 scala-library.jar 时,一切都很好,但是当我将 scala-swing.jar 添加到我的 jar 中时,我得到以下信息:
Warning: scala.swing.ComboBox: can't find referenced class scala.swing.ComboBox$selection
Warning: scala.swing.ListView: can't find referenced class scala.swing.ListView$selection
Warning: scala.swing.ListView$selection$: can't find referenced class scala.swing.ListView$selection$indices
Warning: scala.swing.ListView$selection$: can't find referenced class scala.swing.ListView$selection$items
Warning: scala.swing.ListView$selection$$anon$7: can't find referenced class scala.swing.ListView$selection
Warning: scala.swing.ListView$selection$Indices: can't find referenced class scala.swing.ListView$selection
Warning: scala.swing.ListView$selection$indices$: can't find referenced class scala.swing.ListView$selection$indices
Warning: scala.swing.ListView$selection$indices$: can't find referenced class scala.swing.ListView$selection$indices
Warning: scala.swing.ListView$selection$indices$: can't find referenced class scala.swing.ListView$selection
Warning: scala.swing.ListView$selection$items$: can't find referenced class scala.swing.ListView$selection
如果我查看该 jar,我发现实际上没有这样的文件 -有 scala.swing.ComboBox$selection$.class
而不是 scala.swing.ComboBox$selection.class
。手动重命名并不能解决问题 - 然后它会抱怨该文件包含具有不同名称的类。
那么,scala-swing.jar 中的这些引用是非法的吗?还是 Proguard 中的错误?
你能建议一个解决方法吗?
编辑:我正在使用 Scala 2.9.0.1 和 Proguard 4.6
编辑2:使用 Scala 2.9.1.final jar 没有帮助。
I tried to shrink and obfuscate my Scala/Java program using Proguard. While I was using only scala-library.jar, everything was fine, but when I add scala-swing.jar to my jars, I get the following:
Warning: scala.swing.ComboBox: can't find referenced class scala.swing.ComboBox$selection
Warning: scala.swing.ListView: can't find referenced class scala.swing.ListView$selection
Warning: scala.swing.ListView$selection$: can't find referenced class scala.swing.ListView$selection$indices
Warning: scala.swing.ListView$selection$: can't find referenced class scala.swing.ListView$selection$items
Warning: scala.swing.ListView$selection$anon$7: can't find referenced class scala.swing.ListView$selection
Warning: scala.swing.ListView$selection$Indices: can't find referenced class scala.swing.ListView$selection
Warning: scala.swing.ListView$selection$indices$: can't find referenced class scala.swing.ListView$selection$indices
Warning: scala.swing.ListView$selection$indices$: can't find referenced class scala.swing.ListView$selection$indices
Warning: scala.swing.ListView$selection$indices$: can't find referenced class scala.swing.ListView$selection
Warning: scala.swing.ListView$selection$items$: can't find referenced class scala.swing.ListView$selection
If I look into the jar, I see that there are really no such files - there is scala.swing.ComboBox$selection$.class
instead of scala.swing.ComboBox$selection.class
. Manually renaming does not do the trick - it then complains that the file contains class with different name.
So, are these illegal references in scala-swing.jar? Or a bug in Proguard?
Can you suggest a workaround?
EDIT: I'm using Scala 2.9.0.1 and Proguard 4.6
EDIT2: Using Scala 2.9.1.final jars didn't help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它看起来像是 scala 编译器中的一个错误。例如,类文件 scala/swing/ComboBox.class 包含以下方法:
在内部,方法签名表示如下:
看起来不错。但是,该方法还有一个 Signature 属性来跟踪已删除的泛型:
如您所见,签名末尾缺少 $。在 ProGuard 中,您可以通过指定来解决该问题
It looks like a bug in the scala compiler. For instance, the class file scala/swing/ComboBox.class contains the following method:
Internally, the method signature is represented as follows:
That looks ok. However, the method also has a Signature attribute to keep track of erased generics:
As you can see, the signature is missing a $ at the end. In ProGuard, you can work around the problem by specifying