Bug 52691 - ClassFileSet doesn't support generic parameters
Summary: ClassFileSet doesn't support generic parameters
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: 1.8.2
Hardware: All All
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-17 08:12 UTC by Emmanuel Bourg
Modified: 2012-02-17 15:21 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Emmanuel Bourg 2012-02-17 08:12:26 UTC
The ClassFileSet doesn't retain classes used only in generic signatures. For example if the directory contains two classes Foo and Bar, Bar being only used in Foo as a return parameter such as List<Bar>, the dependency between Foo and Bar will be missed and only Foo will be retained.


This could be fixed by implementing org.apache.tools.ant.util.depend.AbstractAnalyzer with ASM instead of BCEL. The Maven Dependency Analyzer plugin has almost all of the code needed to do this task:

http://maven.apache.org/shared/maven-dependency-analyzer/xref

http://maven.apache.org/shared/maven-dependency-analyzer/xref/org/apache/maven/shared/dependency/analyzer/asm/ASMDependencyAnalyzer.html
Comment 1 Matt Benson 2012-02-17 14:49:23 UTC
An additional layer of indirection over ASM, such as Torsten Curdt's jdependency library, could make this even easier--this is what the maven-shade-plugin uses.
Comment 2 Emmanuel Bourg 2012-02-17 15:02:35 UTC
I have an implementation based on the ASMDependencyAnalyzer from the maven-dependency-analyzer plugin. It works fine but only with classes from the file system, it doesn't support classes embedded in a jar like the current <classfileset>.

If the Ant team thinks it's the right direction I can refine the implementation and contribute a replacement of <classfileset> that's functionally equivalent.
Comment 3 Matt Benson 2012-02-17 15:21:05 UTC
Emmanuel,
  jdependency also didn't support class files in jars until recently, so  this functionality has yet to be released.  We could probably push Torsten for a new release if/when we want to use this.  You're free to rewrite and submit, certainly; I just hate to see anyone write when they can reuse.

br,
Matt