Bug 61196

Summary: Update the dependency on BCEL to 6.0
Product: Ant Reporter: asf+paul
Component: Build ProcessAssignee: Ant Notifications List <notifications>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: 1.10.2   
Hardware: PC   
OS: Mac OS X 10.1   

Description asf+paul 2017-06-18 20:42:34 UTC
Currently when using the classfileset task, it can fail with the following message:

org.apache.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 18
	at org.apache.bcel.classfile.Constant.readConstant(Constant.java:146)
	at org.apache.bcel.classfile.ConstantPool.<init>(ConstantPool.java:67)
	at org.apache.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:222)
	at org.apache.bcel.classfile.ClassParser.parse(ClassParser.java:136)
	at org.apache.tools.ant.util.depend.bcel.FullAnalyzer.determineDependencies(FullAnalyzer.java:95)
	at org.apache.tools.ant.util.depend.AbstractAnalyzer.getClassDependencies(AbstractAnalyzer.java:99)
	at org.apache.tools.ant.types.optional.depend.DependScanner.scan(DependScanner.java:120)
	at org.apache.tools.ant.types.optional.depend.ClassfileSet.getDirectoryScanner(ClassfileSet.java:141)
	at org.apache.tools.ant.taskdefs.Zip.grabResources(Zip.java:1581)
	at org.apache.tools.ant.taskdefs.Zip.getResourcesToAdd(Zip.java:1320)
	at org.apache.tools.ant.taskdefs.Zip.getResourcesToAdd(Zip.java:1254)
	at org.apache.tools.ant.taskdefs.Jar.getResourcesToAdd(Jar.java:880)
	at org.apache.tools.ant.taskdefs.Zip.executeMain(Zip.java:640)
	at org.apache.tools.ant.taskdefs.Zip.execute(Zip.java:592)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:435)
	at org.apache.tools.ant.Target.performTasks(Target.java:456)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
	at org.apache.tools.ant.Main.runBuild(Main.java:851)
	at org.apache.tools.ant.Main.startAnt(Main.java:235)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)


The root cause of the problem is that it doesn't know how to handle the INVOKEDYNAMIC tag, as support for this was added in 6.0, and ant still ships with BCEL 5.2.

Updating to BCEL 6.0 would likely solve this issue.
Comment 1 Stefan Bodewig 2017-07-23 15:52:18 UTC
I've just updated the dependency to 6.0 in master.

We don't ship BCEL, so you must have installed it yourself. It should be possible to simply replace the BCEL jar without updating Ant itself.