For the one impatients of using jdk5 like me, here is a workaround I use to be able to get generics, and still have xdoclet running :
I add a small ant task that parse all my sources with a regex, removing all the generics, and all the declaration of the foreach loops.
The resulting code isn't functional, but it's good enough to run xdoclet on it.
Note, the regex works fine for me, but it might need to be improved for more complex cases.
Right now, the most complex handled case is simething like :
Code:
<String,byte[]>
So, here is the ant task :
Code:
<target name="remove-generics" depends="init">
<!-- Since XDoclet isn't already able to parse java 1.5 source code,
we remove all references to generics and for each loops. -->
<property name="generics.match.pattern" value="<[\w\[\]]+(<\w+>)?,?[\w\[\]]*(<\w+>)?>|(for\s?\(.+:.+\))"/>
<echo message="Pattern used to remove generics : ${generics.match.pattern}"/>
<copy toDir="${build.generate.dir}/java" overwrite="true">
<fileset dir="${src.main.dir}">
<include name="**/*.java"/>
</fileset>
</copy>
<replaceregexp byline="true" flags="g">
<fileset dir="${build.generate.dir}/java">
<include name="**/*.java"/>
</fileset>
<regexp pattern="${generics.match.pattern}"/>
<substitution expression=""/>
</replaceregexp>
</target>