Revision: e26603cd0be7 Author: Pekka Klärck Date: Thu Aug 30 05:12:32 2012 Log: libdoc: handle varargs in java based libs correctly
Update issue 1213 Status: Done http://code.google.com/p/robotframework/source/detail?r=e26603cd0be7 Modified: /atest/robot/libdoc/java_library.txt /atest/testdata/libdoc/Example.java /src/robot/libdocpkg/javabuilder.py ======================================= --- /atest/robot/libdoc/java_library.txt Tue May 29 06:52:32 2012 +++ /atest/robot/libdoc/java_library.txt Thu Aug 30 05:12:32 2012 @@ -44,6 +44,8 @@ Keyword Arguments Keyword Arguments Should Be 0 arg Keyword Arguments Should Be 1 + Keyword Arguments Should Be -2 *varargs + Keyword Arguments Should Be -1 normal *varargs Keyword Documentation Keyword Doc Should Start With 0 ======================================= --- /atest/testdata/libdoc/Example.java Wed Feb 29 06:56:34 2012 +++ /atest/testdata/libdoc/Example.java Thu Aug 30 05:12:32 2012 @@ -29,7 +29,7 @@ /** * Should not be visible in library documentation */ - private Example(String[] args) { + private Example(double dontShowMe) { } /** @@ -50,6 +50,18 @@ */ public void keyword(String arg) { } + + /** + * Creating varargs using `type[]`. + */ + public void varargs1(String[] varargs) { + } + + /** + * Creating varargs using `type...`. + */ + public void varargs2(int normal, int... varargs) { + } /** * Hyv\u00e4\u00e4 y\u00f6t\u00e4. ======================================= --- /src/robot/libdocpkg/javabuilder.py Tue May 29 06:52:32 2012 +++ /src/robot/libdocpkg/javabuilder.py Thu Aug 30 05:12:32 2012 @@ -55,10 +55,17 @@ def _keyword_doc(self, method): return KeywordDoc( name=utils.printable_name(method.name(), code_style=True), - args=[param.name() for param in method.parameters()], + args=list(self._yield_keyword_arguments(method)), doc=self._get_doc(method) ) + def _yield_keyword_arguments(self, method): + for param in method.parameters(): + name = param.name() + if param.type().dimension() == '[]': + name = '*' + name + yield name + def _intializers(self, doc): inits = [self._keyword_doc(init) for init in doc.constructors()] if len(inits) == 1 and not inits[0].args: @@ -86,7 +93,7 @@ context = Context() Messager.preRegister(context, 'libdoc') jdoctool = JavadocTool.make0(context) - filter = ModifierFilter(PUBLIC) + filter = ModifierFilter(PUBLIC) java_names = List.of(path) root = jdoctool.getRootDocImpl('en', 'utf-8', filter, java_names, List.nil(), False, List.nil(),
