private String getAsText(GroovySourceAST typeNode, String defaultText) { GroovySourceAST child = (GroovySourceAST) typeNode.getFirstChild(); return getAsTextCurrent(child, defaultText); }
if (dotChild.getType() == IDENT) { if (dot.length() > 0) dot.append("/"); dot.append(getAsTextCurrent(dotChild, defaultText)); } else if (dotChild.getType() == DOT) { if (dot.length() > 0) dot.append("/"); dot.append(getAsTextCurrent(dotChild, defaultText)); } else if (dotChild.getType() == TYPE_ARGUMENTS) { getTypeArguments(dotChild, dot, defaultText);
private String getTypeNodeAsText(GroovySourceAST typeNode, String defaultText) { // TODO refactor to retain richer type information rather than converting to String if (typeNode == null) { return defaultText; } if (typeNode.getType() == TYPE) { return getAsText(typeNode, defaultText); } else if (typeNode.getType() == TYPE_ARGUMENT) { return getTypeNodeAsText((GroovySourceAST) typeNode.getFirstChild(), defaultText); } else if (typeNode.getType() == WILDCARD_TYPE) { AST next = typeNode.getNextSibling(); if (next == null && typeNode.getFirstChild() != null) { // Java2Groovy produces a slightly different tree structure (TODO fix converter or java.g instead?) next = typeNode.getFirstChild(); } if (next == null) return "?"; String boundType = getTypeNodeAsText((GroovySourceAST) next.getFirstChild(), defaultText); if (next.getType() == TYPE_UPPER_BOUNDS) return "? extends " + boundType; if (next.getType() == TYPE_LOWER_BOUNDS) return "? super " + boundType; } else if (typeNode.getType() == IDENT) { return getAsTextCurrent(typeNode, defaultText); } return defaultText; }
private String getAsText(GroovySourceAST typeNode, String defaultText) { GroovySourceAST child = (GroovySourceAST) typeNode.getFirstChild(); return getAsTextCurrent(child, defaultText); }
private String getAsText(GroovySourceAST typeNode, String defaultText) { GroovySourceAST child = (GroovySourceAST) typeNode.getFirstChild(); return getAsTextCurrent(child, defaultText); }
if (dotChild.getType() == IDENT || dotChild.getType() == DOT) { if (dot.length() > 0) dot.append("/"); dot.append(getAsTextCurrent(dotChild, defaultText)); } else if (dotChild.getType() == TYPE_ARGUMENTS) { getTypeArguments(dotChild, dot, defaultText);
while (child != null) { if (child.getType() == IDENT) { result.add(child.getText()); } else if (child.getType() == DOT) { result.add(getAsTextCurrent(child, defaultText)); } child = (GroovySourceAST) child.getNextSibling();
if (next.getType() == TYPE_LOWER_BOUNDS) return "? super " + boundType; } else if (typeNode.getType() == IDENT) { String ident = getAsTextCurrent(typeNode, defaultText); AST next = typeNode.getNextSibling(); if (next == null && typeNode.getFirstChild() != null) {