private <T> void printConstructorCall(CtConstructorCall<T> ctConstructorCall) { try (Writable _context = context.modify()) { if (ctConstructorCall.getTarget() != null) { scan(ctConstructorCall.getTarget()); printer.writeSeparator("."); _context.ignoreEnclosingClass(true); } if (hasDeclaringTypeWithGenerics(ctConstructorCall.getType())) { _context.ignoreEnclosingClass(true); } printer.writeKeyword("new").writeSpace(); if (!ctConstructorCall.getActualTypeArguments().isEmpty()) { elementPrinterHelper.writeActualTypeArguments(ctConstructorCall); } scan(ctConstructorCall.getType()); } elementPrinterHelper.printList(ctConstructorCall.getArguments(), null, false, "(", false, false, ",", true, false, ")", exp -> scan(exp)); }
@Override public <T> void visitCtConstructorCall(CtConstructorCall<T> ctConstructorCall) { enter(ctConstructorCall); scan(ctConstructorCall.getAnnotations()); scan(ctConstructorCall.getType()); scanReferences(ctConstructorCall.getTypeCasts()); scan(ctConstructorCall.getExecutable()); scan(ctConstructorCall.getTarget()); scan(ctConstructorCall.getArguments()); exit(ctConstructorCall); }
if (getTopLevelType(ctConstructorCall).getReference().equals(ctConstructorCall.getType().getDeclaringType()) && ctConstructorCall.getType().getDeclaringType().getActualTypeArguments().size() > 0) { context.ignoreEnclosingClass = true; scan(ctConstructorCall.getType()); context.ignoreEnclosingClass = false;
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public <T> void visitCtConstructorCall(CtConstructorCall<T> ctConstructorCall) { super.visitCtConstructorCall(ctConstructorCall); String type = ctConstructorCall.getType().getQualifiedName(); List<CtExpression<?>> argumentlist = ctConstructorCall.getArguments(); List<String> orig = resolveTypes(argumentlist); CtClass classname = parser.getClassMap().get(type); if(classname!=null) { Set<CtConstructor<T>> constructors=classname.getConstructors(); for(CtConstructor constructor:constructors) { List<CtParameter> paramlist=constructor.getParameters(); List<String> target=resolveParams(paramlist); transformOneMethod(orig,target,ctConstructorCall); } } else { List<Class[]> params = parser.fetchMethods(type, type); for (Class[] p : params) transformOneConstructor(orig, ctConstructorCall, p); } }