Ejemplo n.º 1
0
 @Override
 public boolean visit(ClassInstanceCreationExpression c) {
   ExpressionType clzType;
   if (c.hasBody()) {
     clzType = new ExpressionType(cip.getFullName(c.getBody()));
   } else {
     clzType = c.getId().getExpressionType();
   }
   if (hasMethods(clzType, c)) {
     String fqn = clzType.getClassName();
     ArgumentList al = c.getArgumentList();
     try {
       MethodInformation mi = findMatchingConstructor(fqn, al);
       if (mi == null) {
         diagnostics.report(
             SourceDiagnostics.error(
                 tree.getOrigin(), c.getParsePosition(), "No matching constructor found"));
       } else {
         c.setMethodInformation(mi);
       }
     } catch (IOException e) {
       diagnostics.report(
           SourceDiagnostics.error(
               tree.getOrigin(), c.getParsePosition(), "Failed to read class: " + e));
     }
   }
   return true;
 }
Ejemplo n.º 2
0
 private ExpressionType getOnType(TreeNode on) {
   if (on != null) {
     return on.getExpressionType();
   } else {
     String fqn = cip.getFullName(containingClasses.getLast());
     return new ExpressionType(fqn);
   }
 }