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

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


  buffer.getChars(0, nameLength, this.signature, 0);

  return this.signature;
}
public final int sourceEnd() {
  AbstractMethodDeclaration method = sourceMethod();
  if (method == null) {
    if (this.declaringClass instanceof SourceTypeBinding)
      return ((SourceTypeBinding) this.declaringClass).sourceEnd();
    return 0;
  }
View Full Code Here


        return methods[i];
  }
  return null;
}
public final int sourceStart() {
  AbstractMethodDeclaration method = sourceMethod();
  if (method == null) {
    if (this.declaringClass instanceof SourceTypeBinding)
      return ((SourceTypeBinding) this.declaringClass).sourceStart();
    return 0;
  }
View Full Code Here

    for (int i = 0, length = this.methods.length; i < length; i++) {
      MethodBinding method = resolvedMethods[i];
      if (method == null)
        continue;
      char[] selector = method.selector;
      AbstractMethodDeclaration methodDecl = null;
      nextSibling: for (int j = i + 1; j < length; j++) {
        MethodBinding method2 = resolvedMethods[j];
        if (method2 == null)
          continue nextSibling;
        if (!CharOperation.equals(selector, method2.selector))
          break nextSibling; // methods with same selector are contiguous

        if (complyTo15 ? !method.areParameterErasuresEqual(method2) : !method.areParametersEqual(method2))
          continue nextSibling; // otherwise duplicates / name clash
        boolean isEnumSpecialMethod = isEnum() && (CharOperation.equals(selector,TypeConstants.VALUEOF) || CharOperation.equals(selector,TypeConstants.VALUES));
        // report duplicate
        boolean removeMethod2 = true;
        if (methodDecl == null) {
          methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost & may still be null if method is special
          if (methodDecl != null && methodDecl.binding != null) { // ensure its a valid user defined method
            boolean removeMethod = method.returnType == null && method2.returnType != null;
            if (isEnumSpecialMethod) {
              this.scope.problemReporter().duplicateEnumSpecialMethod(this, methodDecl);
              // remove user defined methods & keep the synthetic
              removeMethod = true;
            } else {
              this.scope.problemReporter().duplicateMethodInType(this, methodDecl, method.areParametersEqual(method2));
            }
            if (removeMethod) {
              removeMethod2 = false;
              methodDecl.binding = null;
              // do not alter original method array until resolution is over, due to reentrance (143259)
              if (resolvedMethods == this.methods)
                System.arraycopy(this.methods, 0, resolvedMethods = new MethodBinding[length], 0, length);
              resolvedMethods[i] = null;
              failed++;
            }
          }
        }
        AbstractMethodDeclaration method2Decl = method2.sourceMethod();
        if (method2Decl != null && method2Decl.binding != null) { // ensure its a valid user defined method
          if (isEnumSpecialMethod) {
            this.scope.problemReporter().duplicateEnumSpecialMethod(this, method2Decl);
            removeMethod2 = true;
          } else {
View Full Code Here

  if (isViewedAsDeprecated() && !method.isDeprecated())
    method.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
  if (hasRestrictedAccess())
    method.modifiers |= ExtraCompilerModifiers.AccRestrictedAccess;

  AbstractMethodDeclaration methodDecl = method.sourceMethod();
  if (methodDecl == null) return null; // method could not be resolved in previous iteration


  TypeParameter[] typeParameters = methodDecl.typeParameters();
  if (typeParameters != null) {
    methodDecl.scope.connectTypeVariables(typeParameters, true);
    // Perform deferred bound checks for type variables (only done after type variable hierarchy is connected)
    for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++)
      typeParameters[i].checkBounds(methodDecl.scope);
View Full Code Here

    this.tagBits |= TagBits.LocalTypeMask;
  }
  this.enclosingCase = switchCase;
  this.sourceStart = typeDeclaration.sourceStart;
  MethodScope methodScope = scope.enclosingMethodScope();
  AbstractMethodDeclaration methodDeclaration = methodScope.referenceMethod();
  if (methodDeclaration != null) {
    this.enclosingMethod = methodDeclaration.binding;
  }
}
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

      }
    } else if (currentNode instanceof AbstractTypeDeclaration) {
      org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDecl = (org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) this.ast.getBindingResolver().getCorrespondingNode(currentNode);
      return typeDecl.initializerScope;
    }
    AbstractMethodDeclaration abstractMethodDeclaration = (AbstractMethodDeclaration) this.ast.getBindingResolver().getCorrespondingNode(currentNode);
    return abstractMethodDeclaration.scope;
  }
View Full Code Here

          assert (enclosingType instanceof JClassType);
          return (JMethod) enclosingType.methods.get(1);
        }
      }

      AbstractMethodDeclaration referenceMethod = methodScope.referenceMethod();
      return (JMethod) typeMap.get(referenceMethod.binding);
    }
View Full Code Here

  private boolean resolveMethods(TreeLogger logger, String unitSource,
      JClassType type, AbstractMethodDeclaration[] jmethods) {
    if (jmethods != null) {
      for (int i = 0; i < jmethods.length; i++) {
        AbstractMethodDeclaration jmethod = jmethods[i];
        if (!resolveMethod(logger, unitSource, type, jmethod)) {
          return false;
        }
      }
    }
View Full Code Here

          // init
          assert (enclosingType instanceof JClassType);
          method = enclosingType.methods.get(1);
        }
      } else {
        AbstractMethodDeclaration referenceMethod = methodScope.referenceMethod();
        method = (JMethod) typeMap.get(referenceMethod.binding);
      }
      assert !method.isNative() && !method.isAbstract();
      return (JMethodBody) method.getBody();
    }
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.