Package lombok.ast

Examples of lombok.ast.TypeReference


     
      set(node, new Select().astIdentifier(id).rawOperand(toTree(node.getExpression())));
    }
   
    @Override public void visitTypeApply(JCTypeApply node) {
      TypeReference ref = (TypeReference) toTree(node.clazz, FlagKey.TYPE_REFERENCE);
      TypeReferencePart last = ref.astParts().last();
      fillList(node.arguments, last.rawTypeArguments(), FlagKey.TYPE_REFERENCE);
      setPos(node, ref);
      setConversionPositionInfo(last, "<", getPosition(node));
      set(node, ref);
    }
View Full Code Here


      setConversionPositionInfo(last, "<", getPosition(node));
      set(node, ref);
    }
   
    @Override public void visitWildcard(JCWildcard node) {
      TypeReference ref = (TypeReference) toTree(node.getBound(), FlagKey.TYPE_REFERENCE);
      if (ref == null) ref = new TypeReference();
      switch (node.getKind()) {
      case UNBOUNDED_WILDCARD:
        ref.astWildcard(WildcardKind.UNBOUND);
        break;
      case EXTENDS_WILDCARD:
        ref.astWildcard(WildcardKind.EXTENDS);
        setConversionPositionInfo(ref, "extends", getTypeBoundKindPosition(node));
        break;
      case SUPER_WILDCARD:
        ref.astWildcard(WildcardKind.SUPER);
        setConversionPositionInfo(ref, "super", getTypeBoundKindPosition(node));
        break;
      }
      set(node, ref);
    }
View Full Code Here

      fillList(node.bounds, var.rawExtending(), FlagKey.TYPE_REFERENCE);
      set(node, var);
    }
   
    @Override public void visitTypeArray(JCArrayTypeTree node) {
      TypeReference ref = (TypeReference) toTree(node.getType(), FlagKey.TYPE_REFERENCE);
      int currentDim = ref.astArrayDimensions();
      ref.astArrayDimensions(currentDim + 1);
      setConversionPositionInfo(ref, "[]" + currentDim, getPosition(node));
      set(node, ref);
    }
View Full Code Here

        Iterator<Expression> argIterator = args.iterator();
        Expression first = argIterator.next();
        Expression second = argIterator.hasNext() ? argIterator.next() : null;

        boolean specifiesLocale;
        TypeReference parameterType;
        lombok.ast.Node resolved = context.parser.resolve(context, first);
        if (resolved != null) {
            parameterType = context.parser.getType(context, resolved);
        } else {
            parameterType = context.parser.getType(context, first);
        }
        if (parameterType != null) {
            specifiesLocale = parameterType.getTypeName().equals("java.util.Locale"); //$NON-NLS-1$
        } else if (!call.astName().astValue().equals(FORMAT_METHOD)) {
            specifiesLocale = false;
        } else {
            // No type information with this AST; use string patterns instead to make
            // an educated guess
View Full Code Here

                }

                // If the AST supports type resolution, use that for other types
                // of expressions
                if (mContext != null) {
                    TypeReference parameterType;
                    lombok.ast.Node resolved = mContext.parser.resolve(mContext, arg);
                    if (resolved != null) {
                        parameterType = mContext.parser.getType(mContext, resolved);
                    } else {
                        parameterType = mContext.parser.getType(mContext, arg);
                    }
                    if (parameterType != null) {
                        String fqcn = parameterType.getTypeName();
                        if (fqcn.equals("java.lang.String")   //$NON-NLS-1$
                                || fqcn.equals("String")) {   //$NON-NLS-1$
                            return String.class;
                        } else if (fqcn.equals("int")) {      //$NON-NLS-1$
                            return Integer.TYPE;
View Full Code Here

      if (identifierNode != null) {
        classTypeArgs0.setPosition(identifierNode.getPosition());
      }
    }
   
    TypeReference typeReference = new TypeReference().astParts().addToEnd(
        classTypeArgs0.astIdentifier(createIdentifierIfNeeded(identifierNode, currentPos())));
    if (!classTypeArgsCorrect) {
      if (identifier != null && identifier.getValue() != null) {
        typeReference.setPosition(identifier.getValue().getPosition());
      }
    } else {
      positionSpan(typeReference, identifier, classTypeArgs);
    }
   
View Full Code Here

    return node instanceof MethodInvocation || node instanceof ConstructorInvocation;
  }
 
  public boolean typeIsAlsoLegalAsExpression(Node type) {
    if (!(type instanceof TypeReference)) return true;
    TypeReference tr = (TypeReference)type;
    if (tr.astArrayDimensions() > 0) return false;
    if (tr.isPrimitive() || tr.isVoid()) return false;
    for (Node part : tr.rawParts()) {
      if (part instanceof TypeReferencePart) {
        if (!((TypeReferencePart)part).rawTypeArguments().isEmpty()) return false;
      }
    }
   
View Full Code Here

        if (annotations == null) {
            return false;
        }

        for (Annotation annotation : annotations) {
            TypeReference t = annotation.astAnnotationTypeReference();
            String typeName = t.getTypeName();
            if (typeName.endsWith(SUPPRESS_LINT)
                    || typeName.endsWith("SuppressWarnings")) {     //$NON-NLS-1$
                StrictListAccessor<AnnotationElement, Annotation> values =
                        annotation.astElements();
                if (values != null) {
View Full Code Here

        int arrayDimensions = varDefEntry.astArrayDimensions();
        if (arrayDimensions == 0) {
          return true;
        }
        varDefEntry.astArrayDimensions(0);
        TypeReference typeRef = node.astTypeReference();
        typeRef.astArrayDimensions(typeRef.astArrayDimensions() + arrayDimensions);
        return true;
      }
    });
  }
View Full Code Here

TOP

Related Classes of lombok.ast.TypeReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.