diff --git a/java2python/config/default.py b/java2python/config/default.py index 92c4a27..be7906a 100644 --- a/java2python/config/default.py +++ b/java2python/config/default.py @@ -149,6 +149,7 @@ (Type('FALSE'), transform.false2False), (Type('TRUE'), transform.true2True), (Type('IDENT'), transform.keywordSafeIdent), + (Type('GENERIC_TYPE_ARG_LIST'), transform.deleteGenericTypeArgList), (Type('DECIMAL_LITERAL'), transform.syntaxSafeDecimalLiteral), (Type('FLOATING_POINT_LITERAL'), transform.syntaxSafeFloatLiteral), diff --git a/java2python/mod/transform.py b/java2python/mod/transform.py index 9b2e567..c3d057c 100644 --- a/java2python/mod/transform.py +++ b/java2python/mod/transform.py @@ -33,6 +33,12 @@ def keywordSafeIdent(node, config, invalid=invalidPythonNames()): if ident in invalid: node.token.text = '%s_' % ident +def deleteGenericTypeArgList(node, config, invalid=invalidPythonNames()): + """Remove the parametrized types of the form T so they get + translated only to A. + """ + while node.getChildCount() > 0: + node.deleteChild(0) def makeConst(v): """ Returns a closure that indiscriminately changes node text to a value. """