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

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


   
    if ((this.produceAttributes & ClassFileConstants.ATTR_TYPE_ANNOTATION) != 0) {
      List allTypeAnnotationContexts = new ArrayList();
      int invisibleTypeAnnotationsCounter = 0;
      int visibleTypeAnnotationsCounter = 0;
      AbstractMethodDeclaration methodDeclaration = binding.sourceMethod();
      if (methodDeclaration != null) {
        if ((methodDeclaration.bits & ASTNode.HasTypeAnnotations) != 0) {
          Argument[] arguments = methodDeclaration.arguments;
          if (arguments != null) {
            completeArgumentAnnotationInfo(arguments, allTypeAnnotationContexts);
          }
          Receiver receiver = methodDeclaration.receiver;
          if (receiver != null && (receiver.type.bits & ASTNode.HasTypeAnnotations) != 0) {
            receiver.type.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_RECEIVER, allTypeAnnotationContexts);
          }
        }
        Annotation[] annotations = methodDeclaration.annotations;
        if (annotations != null && !methodDeclaration.isClinit() && (methodDeclaration.isConstructor() || binding.returnType.id != T_void)) {
          methodDeclaration.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_RETURN, allTypeAnnotationContexts);
        }
        if (!methodDeclaration.isConstructor() && !methodDeclaration.isClinit() && binding.returnType.id != T_void) {
          MethodDeclaration declaration = (MethodDeclaration) methodDeclaration;
          TypeReference typeReference = declaration.returnType;
          if ((typeReference.bits & ASTNode.HasTypeAnnotations) != 0) {
            typeReference.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_RETURN, allTypeAnnotationContexts);
          }
        }
        TypeReference[] thrownExceptions = methodDeclaration.thrownExceptions;
        if (thrownExceptions != null) {
          for (int i = 0, max = thrownExceptions.length; i < max; i++) {
            TypeReference thrownException = thrownExceptions[i];
            thrownException.getAllAnnotationContexts(AnnotationTargetTypeConstants.THROWS, i, allTypeAnnotationContexts);
          }
        }
        TypeParameter[] typeParameters = methodDeclaration.typeParameters();
        if (typeParameters != null) {
          for (int i = 0, max = typeParameters.length; i < max; i++) {
            TypeParameter typeParameter = typeParameters[i];
            if ((typeParameter.bits & ASTNode.HasTypeAnnotations) != 0) {
              typeParameter.getAllAnnotationContexts(AnnotationTargetTypeConstants.METHOD_TYPE_PARAMETER, i, allTypeAnnotationContexts);
View Full Code Here


    char[] genericSignature = methodBinding.genericSignature();
    if (genericSignature != null) {
      attributesNumber += generateSignatureAttribute(genericSignature);
    }
    if (this.targetJDK >= ClassFileConstants.JDK1_4) {
      AbstractMethodDeclaration methodDeclaration = methodBinding.sourceMethod();
      if (methodBinding instanceof SyntheticMethodBinding) {
        SyntheticMethodBinding syntheticMethod = (SyntheticMethodBinding) methodBinding;
        if (syntheticMethod.purpose == SyntheticMethodBinding.SuperMethodAccess && CharOperation.equals(syntheticMethod.selector, syntheticMethod.targetMethod.selector))
          methodDeclaration = ((SyntheticMethodBinding)methodBinding).targetMethod.sourceMethod();
      }
View Full Code Here

  private int generateMethodParameters(final MethodBinding binding) {
   
    int initialContentsOffset = this.contentsOffset;
    int length = 0; // count of actual parameters
   
    AbstractMethodDeclaration methodDeclaration = binding.sourceMethod();
   
    boolean isConstructor = binding.isConstructor();
    TypeBinding[] targetParameters = binding.parameters;
    ReferenceBinding declaringClass = binding.declaringClass;
View Full Code Here

}
void checkConcreteInheritedMethod(MethodBinding concreteMethod, MethodBinding[] abstractMethods) {
  super.checkConcreteInheritedMethod(concreteMethod, abstractMethods);
  boolean analyseNullAnnotations = this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled;
  // TODO (stephan): unclear if this srcMethod is actually needed
  AbstractMethodDeclaration srcMethod = null;
  if (analyseNullAnnotations && this.type.equals(concreteMethod.declaringClass)) // is currentMethod from the current type?
    srcMethod = concreteMethod.sourceMethod();
  boolean useTypeAnnotations = this.environment.globalOptions.sourceLevel >= ClassFileConstants.JDK1_8;
  boolean hasNonNullDefault = analyseNullAnnotations &&
      concreteMethod.hasNonNullDefaultFor(Binding.DefaultLocationParameter|Binding.DefaultLocationReturnType, useTypeAnnotations);
View Full Code Here

  CompilerOptions options = this.environment.globalOptions;
  if (options.isAnnotationBasedNullAnalysisEnabled
      && (currentMethod.tagBits & TagBits.IsNullnessKnown) == 0)
  {
    // if annotations are inherited these have been checked during STB.resolveTypesFor() (for methods explicit in this.type)
    AbstractMethodDeclaration srcMethod = null;
    if (this.type.equals(currentMethod.declaringClass)) // is currentMethod from the current type?
      srcMethod = currentMethod.sourceMethod();
    boolean useTypeAnnotations = options.sourceLevel >= ClassFileConstants.JDK1_8;
    boolean hasNonNullDefault = currentMethod.hasNonNullDefaultFor(Binding.DefaultLocationParameter|Binding.DefaultLocationReturnType, useTypeAnnotations);
    for (int i = length; --i >= 0;)
View Full Code Here

    if (methodArray[s] == null) continue;
    MethodBinding[] current = (MethodBinding[]) methodArray[s];
    for (int i = 0, length = current.length; i < length; i++) {
      MethodBinding currentMethod = current[i];
      if ((currentMethod.modifiers & (ExtraCompilerModifiers.AccImplementing | ExtraCompilerModifiers.AccOverriding)) == 0) {
        AbstractMethodDeclaration methodDecl = currentMethod.sourceMethod();
        if (methodDecl == null) return;
        TypeBinding [] parameterTypes = currentMethod.parameters;
        Argument[] arguments = methodDecl.arguments;
        for (int j = 0, size = currentMethod.parameters.length; j < size; j++) {
          TypeBinding parameterType = parameterTypes[j];
          Argument arg = arguments[j];
          if (parameterType.leafComponentType().isRawType()
            && compilerOptions.getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore
                && (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
View Full Code Here

  CompilerOptions compilerOptions = this.type.scope.compilerOptions();
  if (compilerOptions.sourceLevel < ClassFileConstants.JDK1_5 // shouldn't whine at all
      || compilerOptions.reportUnavoidableGenericTypeProblems) { // must have already whined
    return;
  }
  AbstractMethodDeclaration methodDecl = currentMethod.sourceMethod();
  if (methodDecl == null) return;
  TypeBinding [] parameterTypes = currentMethod.parameters;
  TypeBinding [] inheritedParameterTypes = inheritedMethod.parameters;
  Argument[] arguments = methodDecl.arguments;
  for (int j = 0, size = currentMethod.parameters.length; j < size; j++) {
    TypeBinding parameterType = parameterTypes[j];
    TypeBinding inheritedParameterType = inheritedParameterTypes[j];
    Argument arg = arguments[j];
    if (parameterType.leafComponentType().isRawType()) {
      if (inheritedParameterType.leafComponentType().isRawType()) {
        arg.binding.tagBits |= TagBits.ForcedToBeRawType;
      } else {
        if (compilerOptions.getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore
            && (arg.type.bits & ASTNode.IgnoreRawTypeCheck) == 0) {
          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 fieldDeclaration;
  }

  private AbstractMethodDeclaration convert(IMethod method, IType type) throws JavaModelException {

    AbstractMethodDeclaration methodDeclaration;

    org.eclipse.jdt.internal.compiler.ast.TypeParameter[] typeParams = null;

    // convert 1.5 specific constructs only if compliance is 1.5 or above
    if (this.has1_5Compliance) {
View Full Code Here

      typeDeclaration.methods[0] = typeDeclaration.createDefaultConstructor(false, false);
    }
    boolean hasAbstractMethods = false;
    count = 0;
    for (int i = 0; i < methodCount; i++) {
      AbstractMethodDeclaration method = convert(methods[i], type);
      if (method != null) {
        boolean isAbstract;
        if ((isAbstract = method.isAbstract()) || isInterface) { // fix-up flag
          method.modifiers |= ExtraCompilerModifiers.AccSemicolonBody;
        }
        if (isAbstract) {
          hasAbstractMethods = true;
        }
View Full Code Here

        } else {
          // we can create a new FieldDeclaration
          typeDecl.bodyDeclarations().add(convertToFieldDeclaration(fieldDeclaration));
        }
      } else if(node instanceof org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration) {
        AbstractMethodDeclaration nextMethodDeclaration = (AbstractMethodDeclaration) node;
        if (!nextMethodDeclaration.isDefaultConstructor() && !nextMethodDeclaration.isClinit()) {
          typeDecl.bodyDeclarations().add(convert(false, nextMethodDeclaration));
        }
      } else if(node instanceof org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) {
        org.eclipse.jdt.internal.compiler.ast.TypeDeclaration nextMemberDeclaration = (org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) node;
        ASTNode nextMemberDeclarationNode = convert(nextMemberDeclaration);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration

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.