/*
  * @see ASTVisitor#visit(MethodRefParameter)
  * @since 3.0
  */
 @Override
 public boolean visit(MethodRefParameter node) {
   node.getType().accept(this);
   if (node.getAST().apiLevel() >= JLS3) {
     if (node.isVarargs()) {
       this.fBuffer.append("..."); // $NON-NLS-1$
     }
   }
   if (node.getName() != null) {
     this.fBuffer.append(" "); // $NON-NLS-1$
     node.getName().accept(this);
   }
   return false;
 }
 /*
  * @see ASTVisitor#visit(MethodRef)
  * @since 3.0
  */
 @Override
 public boolean visit(MethodRef node) {
   if (node.getQualifier() != null) {
     node.getQualifier().accept(this);
   }
   this.fBuffer.append("#"); // $NON-NLS-1$
   node.getName().accept(this);
   this.fBuffer.append("("); // $NON-NLS-1$
   for (Iterator<MethodRefParameter> it = node.parameters().iterator(); it.hasNext(); ) {
     MethodRefParameter e = it.next();
     e.accept(this);
     if (it.hasNext()) {
       this.fBuffer.append(","); // $NON-NLS-1$
     }
   }
   this.fBuffer.append(")"); // $NON-NLS-1$
   return false;
 }
Exemple #3
0
 /* (non-Javadoc)
  * @see org.eclipse.jdt.internal.compiler.parser.AbstractCommentParser#createArgumentReference(char[], java.lang.Object, int)
  */
 protected Object createArgumentReference(
     char[] name, int dim, boolean isVarargs, Object typeRef, long[] dimPositions, long argNamePos)
     throws InvalidInputException {
   try {
     MethodRefParameter argument = this.ast.newMethodRefParameter();
     ASTNode node = (ASTNode) typeRef;
     int argStart = node.getStartPosition();
     int argEnd = node.getStartPosition() + node.getLength() - 1;
     if (dim > 0) argEnd = (int) dimPositions[dim - 1];
     if (argNamePos >= 0) argEnd = (int) argNamePos;
     if (name.length != 0) {
       final SimpleName argName = new SimpleName(this.ast);
       argName.internalSetIdentifier(new String(name));
       argument.setName(argName);
       int argNameStart = (int) (argNamePos >>> 32);
       argName.setSourceRange(argNameStart, argEnd - argNameStart + 1);
     }
     Type argType = null;
     if (node.getNodeType() == ASTNode.PRIMITIVE_TYPE) {
       argType = (PrimitiveType) node;
       //				if (dim > 0) {
       //					argType = this.ast.newArrayType(argType, dim);
       //					argType.setSourceRange(argStart, ((int) dimPositions[dim-1])-argStart+1);
       //				}
     } else {
       Name argTypeName = (Name) node;
       argType = this.ast.newSimpleType(argTypeName);
       argType.setSourceRange(argStart, node.getLength());
     }
     if (dim > 0 && !isVarargs) {
       for (int i = 0; i < dim; i++) {
         argType = this.ast.newArrayType(argType);
         argType.setSourceRange(argStart, ((int) dimPositions[i]) - argStart + 1);
       }
     }
     argument.setType(argType);
     argument.setSourceRange(argStart, argEnd - argStart + 1);
     return argument;
   } catch (ClassCastException ex) {
     throw new InvalidInputException();
   }
 }