Running proguard ant task, produces the following exception:
java.lang.UnsupportedOperationException: Method must be overridden in [proguard.optimize.peephole.ClassMerger] if ever called
at proguard.classfile.util.SimplifiedVisitor.visitAnyClass(SimplifiedVisitor.java:48)
at proguard.classfile.util.SimplifiedVisitor.visitLibraryClass(SimplifiedVisitor.java:60)
at proguard.classfile.LibraryClass.accept(LibraryClass.java:306)
at proguard.classfile.ProgramClass.subclassesAccept(ProgramClass.java:445)
at proguard.optimize.peephole.VerticalClassMerger.visitProgramClass(VerticalClassMerger.java:83)
at proguard.classfile.ProgramClass.accept(ProgramClass.java:358)
at proguard.classfile.ClassPool.classesAccept(ClassPool.java:124)
at proguard.optimize.Optimizer.execute(Optimizer.java:688)
at proguard.ProGuard.optimize(ProGuard.java:317)
at proguard.ProGuard.execute(ProGuard.java:126)
at proguard.ant.ProGuardTask.execute(ProGuardTask.java:316)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
I can post more debug info, but this seems like just a missing implementation.
This is the symptom of a library class (-libraryjars) depending on a program class (-injars). ProGuard prints out fatal warnings about it, but you have probably suppressed them with -ignorewarnings or -dontwarn. Such reverse dependencies are not allowed -- see the ProGuard manual > Introduction, and Troubleshooting.
Yes i do have these warnings, but am at a loss as to how to fix them, for instance
i see:
[proguard] Reading library jar [/home/dave/dev/acme_platform-2.0/3rdparty/xerces/xml-apis.jar]
then
[proguard] Note: duplicate definition of library class [org.w3c.dom.NameList]
and later
[proguard] Warning: library class oracle.xml.parser.v2.XMLNameList extends or implements program class org.w3c.dom.NameList
But clearly NameList is in xml-apis.jar
The errors suggest that NameList is also defined in one of the preceding program jars (-injars ...). This version gets precedence, and as a program class, it then conflicts with the library class XMLNameList.
Yes this is true. However, I am using a library jar that requires stuff found in org.w3c.dom, but presumable finds those dependencies from the jdk itself when it compiles. (so some weblogic (library) classes i use, relies on xml-apis.jar.
But my program jars are also dependent on stuff found in org.w3c.dom, and i am using a newer xml-apis.jar that is war/WEB-INF/lib. My webapp is using parent-last loading, and so i use the xml-apis.jar in my war, and the library jar uses the jdk's version.
so xml-apis.jar is infact both a library jar and a application jar (but different jars). i am using -keep org.w3c.** anyway, so it shouldn't matter.
ProGuard can't distinguish between different class loaders, so it can't process two different versions of the same library at once. The most practical solution I see is to exclude xml-apis.jar from the program jars (e.g. using a jar filter) and copy it back into the final result without changes.