use of com.strobel.decompiler.languages.java.ast.ObjectCreationExpression in project j2objc by google.
the class MethodTranslator method visitObjectCreationExpression.
@Override
public TreeNode visitObjectCreationExpression(ObjectCreationExpression node, Void data) {
Type type = (Type) node.getType().acceptVisitor(this, null);
TypeElement typeElement = (TypeElement) ((DeclaredType) type.getTypeMirror()).asElement();
ClassInstanceCreation newNode = new ClassInstanceCreation();
List<String> paramTypes = new ArrayList<>();
for (com.strobel.decompiler.languages.java.ast.Expression arg : node.getArguments()) {
Expression expr = (Expression) arg.acceptVisitor(this, null);
newNode.addArgument(expr);
paramTypes.add(expr.getTypeMirror().toString());
}
ExecutableElement constructor = ElementUtil.findConstructor(typeElement, paramTypes.toArray(new String[0]));
return newNode.setExecutablePair(new ExecutablePair(constructor)).setType(type);
}
Aggregations