Package org.eclipse.jdt.internal.compiler.ast

Examples of org.eclipse.jdt.internal.compiler.ast.TypeReference


        }

        /*
         * Print the method return type
         */
        final TypeReference returnType = methodDeclaration.returnType;
   
        if (returnType != null) {
          returnType.traverse(this, methodDeclarationScope);
        }
        this.scribe.alignFragment(methodDeclAlignment, ++fragmentIndex);

        /*
         * Print the method name
View Full Code Here


                && (arg.type.bits & ASTNode.IgnoreRawTypeCheck) == 0) {
            methodDecl.scope.problemReporter().rawTypeReference(arg.type, parameterType);
            }
        }
        if (!methodDecl.isConstructor() && methodDecl instanceof MethodDeclaration) {
          TypeReference returnType = ((MethodDeclaration) methodDecl).returnType;
          TypeBinding methodType = currentMethod.returnType;
          if (returnType != null) {
            if (methodType.leafComponentType().isRawType()
                && compilerOptions.getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore
                && (returnType.bits & ASTNode.IgnoreRawTypeCheck) == 0) {
View Full Code Here

          methodDecl.scope.problemReporter().rawTypeReference(arg.type, parameterType);
        }
      }
      }
    }
  TypeReference returnType = null;
  if (!methodDecl.isConstructor() && methodDecl instanceof MethodDeclaration && (returnType = ((MethodDeclaration) methodDecl).returnType) != null) {
    final TypeBinding inheritedMethodType = inheritedMethod.returnType;
    final TypeBinding methodType = currentMethod.returnType;
    if (methodType.leafComponentType().isRawType()) {
      if (inheritedMethodType.leafComponentType().isRawType()) {
View Full Code Here

    return typeDeclaration;
  }

  private FieldDeclaration convert(IField field, IType type) throws JavaModelException {
    TypeReference typeReference = createTypeReference(field.getTypeSignature());
    if (typeReference == null) return null;
    FieldDeclaration fieldDeclaration = new FieldDeclaration();

    fieldDeclaration.name = field.getElementName().toCharArray();
    fieldDeclaration.type = typeReference;
View Full Code Here

      decl.typeParameters = typeParams;
      methodDeclaration = decl;
    } else {
      MethodDeclaration decl = type.isAnnotation() ? new AnnotationMethodDeclaration(this.compilationResult) : new MethodDeclaration(this.compilationResult);
      /* convert return type */
      TypeReference typeReference = createTypeReference(method.getReturnType());
      if (typeReference == null) return null;
      decl.returnType = typeReference;
      decl.typeParameters = typeParams;
      methodDeclaration = decl;
    }
    methodDeclaration.selector = method.getElementName().toCharArray();
    int flags = method.getFlags();
    boolean isVarargs = Flags.isVarargs(flags);
    methodDeclaration.modifiers = flags & ~Flags.AccVarargs;

    /* convert arguments */
    String[] argumentTypeNames = method.getParameterTypes();
    String[] argumentNames = method.getParameterNames();
    int argumentCount = argumentTypeNames == null ? 0 : argumentTypeNames.length;
    // Ignore synthetic arguments (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=212224)
    int startIndex = (method.isConstructor() && type.isMember() && !Flags.isStatic(type.getFlags())) ? 1 : 0;
    argumentCount -= startIndex;
    methodDeclaration.arguments = new Argument[argumentCount];
    for (int i = 0; i < argumentCount; i++) {
      String argumentTypeName = argumentTypeNames[startIndex+i];
      TypeReference typeReference = createTypeReference(argumentTypeName);
      if (typeReference == null) return null;
      if (isVarargs && i == argumentCount-1) {
        typeReference.bits |= ASTNode.IsVarArgs;
      }
      methodDeclaration.arguments[i] = new Argument(
        argumentNames[i].toCharArray(),
        0,
        typeReference,
        ClassFileConstants.AccDefault);
      // do not care whether was final or not
    }

    /* convert thrown exceptions */
    String[] exceptionTypeNames = method.getExceptionTypes();
    int exceptionCount = exceptionTypeNames == null ? 0 : exceptionTypeNames.length;
    if(exceptionCount > 0) {
      methodDeclaration.thrownExceptions = new TypeReference[exceptionCount];
      for (int i = 0; i < exceptionCount; i++) {
        TypeReference typeReference = createTypeReference(exceptionTypeNames[i]);
        if (typeReference == null) return null;
        methodDeclaration.thrownExceptions[i] = typeReference;
      }
    }
    return methodDeclaration;
View Full Code Here

    typeDeclaration.modifiers = type.getFlags();


    /* set superclass and superinterfaces */
    if (type.getSuperclassName() != null) {
      TypeReference typeReference = createTypeReference(type.getSuperclassTypeSignature());
      if (typeReference != null) {
        typeDeclaration.superclass = typeReference;
        typeDeclaration.superclass.bits |= ASTNode.IsSuperType;
      }
    }

    String[] interfaceTypes = type.getSuperInterfaceTypeSignatures();
    int interfaceCount = interfaceTypes == null ? 0 : interfaceTypes.length;
    typeDeclaration.superInterfaces = new TypeReference[interfaceCount];
    int count = 0;
    for (int i = 0; i < interfaceCount; i++) {
      TypeReference typeReference = createTypeReference(interfaceTypes[i]);
      if (typeReference != null) {
        typeDeclaration.superInterfaces[count] = typeReference;
        typeDeclaration.superInterfaces[count++].bits |= ASTNode.IsSuperType;
      }
    }
View Full Code Here

    return result;
  }

  private TypeReference createTypeReference(String typeSignature) {
    TypeReference result = createTypeReference(typeSignature, 0, 0);
    if (this.typeNames != null && result instanceof QualifiedTypeReference) {
      this.typeNames.add(((QualifiedTypeReference)result).tokens);
    }
    return result;
  }
View Full Code Here

    if (thrownExceptionsLength > 0) {
      if (this.ast.apiLevel() < AST.JLS8) {
        Name thrownException;
        int i = 0;
        do {
          TypeReference typeRef = thrownExceptions[i++];
          thrownException = convert(typeRef);
          if (typeRef.annotations != null && typeRef.annotations.length > 0) {
            thrownException.setFlags(thrownException.getFlags() | ASTNode.MALFORMED);
          }
          internalThownExceptions(methodDecl).add(thrownException);
View Full Code Here

    int start = argument.sourceStart;
    int nameEnd = argument.sourceEnd;
    name.setSourceRange(start, nameEnd - start + 1);
    variableDecl.setName(name);
    final int typeSourceEnd = argument.type.sourceEnd;
    TypeReference typeReference = argument.type;
    final int extraDimensions = typeReference.extraDimensions();
    if (this.ast.apiLevel >= AST.JLS8) {
      setExtraAnnotatedDimensions(nameEnd + 1, typeSourceEnd, typeReference,
                    variableDecl.extraDimensions(), extraDimensions);
    } else {
      internalSetExtraDimensions(variableDecl, extraDimensions);
View Full Code Here

  }

  public CastExpression convert(org.eclipse.jdt.internal.compiler.ast.CastExpression expression) {
    CastExpression castExpression = new CastExpression(this.ast);
    castExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
    TypeReference type = expression.type;
    trimWhiteSpacesAndComments(type);
    castExpression.setType(convertType(type));
    castExpression.setExpression(convert(expression.expression));
    if (this.resolveBindings) {
      recordNodes(castExpression, expression);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.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.