GNOME Bugzilla – Bug 307685
bug in the treatment of java generics
Last modified: 2009-02-08 16:17:31 UTC
There is a bug in the treatment of java generics. This happens with 1.4.2 as well as with 1.4.3 (didn't try other versions). the following java code (test1) produces no member/function doc at all, while test2 does. test3 still produces no docs, but emits a non-sensical warning at line 43: C:/Projects/test/test.java:43: Warning: documented function `test3::Map' was not defined. test3 is a stripped down version of some real world java code. It has been stripped down as much as possible. Further stripping makes the warning go away! 1 import java.util.*; 2 3 public class test1 { 4 private Map<String,ArrayList<String>> hash; 5 public void clear () { 6 hash.clear(); 7 } 8 } 9 10 class test2 { 11 private Map<String,Object> hash; 12 public void clear () { 13 hash.clear(); 14 } 15 } 16 17 class test3 { 18 private Map<String,ArrayList<String>> hash = new HashMap<String,ArrayList<String>>(); 19 20 private String tag; 21 22 public void parseFile (String fileName) throws Exception { 23 BufferedReader in = new BufferedReader(new FileReader(fileName)); 24 String line; 25 while ((line = in.readLine()) != null) { 26 if (line.length() > 0 && !line.startsWith("#")) { 27 int bra = line.indexOf("<"), ket = line.indexOf(">"); 28 if (bra >= 0 && ket > 0 && bra < ket) { 29 tag = line.substring(bra+1, ket); 30 } 31 } 32 } 33 in.close(); 34 } 35 36 private void update (String param) { 37 ArrayList<String> list = hash.get(tag); 38 if (list == null) hash.put(tag, list = new ArrayList<String>()); 39 if (param != null && param.length() > 0) list.add(param); 40 } 41 42 public boolean hasParam (String aTag) { 43 ArrayList<String> list = hash.get(aTag); 44 return (list != null && list.size() > 0); 45 } 46 } I'll attach a zip file containing test.java, the cfg file used, a log of the doxygen run and three html files produced.
Created attachment 47769 [details] zip file containing test.java, the cfg file used, a log of the doxygen run and three html files produced
Support for java generics has not been explicitly added, so it is not too strange if something is not yet working. I guess it now somewhat works because it looks a lot like C++ templates.
Created attachment 121263 [details] Test case for Java generics type parameters.
I've tried both example with doxygen 1.5.8, but didn't see any problems anymore. So I'm closing this bug report. Please reopen it if you can attach a related example that does not work with the latest release.