use of com.google.devtools.j2objc.ast.Type in project j2objc by google.
the class StatementGenerator method printMultiCatch.
private void printMultiCatch(CatchClause node) {
SingleVariableDeclaration exception = node.getException();
for (Type exceptionType : ((UnionType) exception.getType()).getTypes()) {
buffer.append("@catch (");
exceptionType.accept(this);
buffer.append(" *");
buffer.append(nameTable.getVariableQualifiedName(exception.getVariableElement()));
buffer.append(") {\n");
printStatements(node.getBody().getStatements());
buffer.append("}\n");
}
}
use of com.google.devtools.j2objc.ast.Type in project j2objc by google.
the class TreeConverter method convertArrayType.
private static TreeNode convertArrayType(org.eclipse.jdt.core.dom.ArrayType node) {
ArrayType newNode = new ArrayType();
convertType(node, newNode);
// This could also be implemented as an element type and dimensions for JLS8, but we mainly deal
// with ArrayTypes through the ArrayType(ITypeBinding) initializer, in the ArrayRewriter, for
// which we use ITypeBinding's componentType anyway.
Type componentType = (Type) Type.newType(BindingConverter.getType(node.resolveBinding().getComponentType()));
return newNode.setComponentType(componentType);
}
use of com.google.devtools.j2objc.ast.Type in project j2objc by google.
the class TreeConverter method convertSingleVariableDeclaration.
private static TreeNode convertSingleVariableDeclaration(org.eclipse.jdt.core.dom.SingleVariableDeclaration node) {
SingleVariableDeclaration newNode = new SingleVariableDeclaration();
convertVariableDeclaration(node, newNode);
for (Object modifier : node.modifiers()) {
if (modifier instanceof org.eclipse.jdt.core.dom.Annotation) {
newNode.addAnnotation((Annotation) TreeConverter.convert(modifier));
}
}
return newNode.setType((Type) TreeConverter.convert(node.getType())).setIsVarargs(node.isVarargs());
}
Aggregations