Examples of AbstractMethodDeclaration


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

   * Method declared on BindingResolver.
   */
  synchronized IMethodBinding resolveMethod(MethodDeclaration method) {
    Object oldNode = this.newAstToOldAst.get(method);
    if (oldNode instanceof AbstractMethodDeclaration) {
      AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) oldNode;
      IMethodBinding methodBinding = getMethodBinding(methodDeclaration.binding);
      if (methodBinding == null) {
        return null;
      }
      this.bindingsToAstNodes.put(methodBinding, method);
View Full Code Here

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

          }
          return null;
        }
      }
    } else if (node instanceof AbstractMethodDeclaration) {
      AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) node;
      IMethodBinding method = getMethodBinding(methodDeclaration.binding);
      if (method == null) return null;
      return method.getReturnType();
    } else if (node instanceof org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) {
      org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDeclaration = (org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) node;
View Full Code Here

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

        if (typeBinding != null) {
          return typeBinding.getPackage();
        }
      }
    } else if (node instanceof AbstractMethodDeclaration) {
      AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) node;
      IMethodBinding methodBinding = getMethodBinding(methodDeclaration.binding);
      if (methodBinding != null) {
        return methodBinding;
      }
    } else if (node instanceof org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) {
View Full Code Here

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

    LocalDeclaration local = binding.declaration;

    JavaElement parent = null;
    ReferenceContext referenceContext = binding.declaringScope.referenceContext();
    if (referenceContext instanceof AbstractMethodDeclaration) {
      AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) referenceContext;
      parent = this.getJavaElementOfCompilationUnit(methodDeclaration, methodDeclaration.binding);
    } else if (referenceContext instanceof TypeDeclaration){
      // Local variable is declared inside an initializer
      TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext;
View Full Code Here

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

      lastMemberEnd = lastField.declarationSourceEnd;
    }
  }

  if (this.methodCount > 0) {
    AbstractMethodDeclaration lastMethod = this.methods[this.methodCount - 1].methodDeclaration;
    if (lastMemberEnd < lastMethod.declarationSourceEnd && lastMethod.declarationSourceEnd != 0) {
      lastMemberEnd = lastMethod.declarationSourceEnd;
    }
  }
View Full Code Here

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

  boolean hasAbstractMethods = false;
  int defaultConstructorIndex = -1;
  if (this.methodCount > 0){
    AbstractMethodDeclaration[] methodDeclarations = new AbstractMethodDeclaration[existingCount + this.methodCount];
    for (int i = 0; i < existingCount; i++){
      AbstractMethodDeclaration m = this.typeDeclaration.methods[i];
      if (m.isDefaultConstructor()) defaultConstructorIndex = i;
      if (m.isAbstract()) hasAbstractMethods = true;
      methodDeclarations[i] = m;
    }
    // may need to update the declarationSourceEnd of the last method
    if (this.methods[this.methodCount - 1].methodDeclaration.declarationSourceEnd == 0){
      int bodyEndValue = bodyEnd();
      this.methods[this.methodCount - 1].methodDeclaration.declarationSourceEnd = bodyEndValue;
      this.methods[this.methodCount - 1].methodDeclaration.bodyEnd = bodyEndValue;
    }
    for (int i = 0; i < this.methodCount; i++){
      AbstractMethodDeclaration updatedMethod = this.methods[i].updatedMethodDeclaration(depth, knownTypes);
      if (updatedMethod.isConstructor()) hasRecoveredConstructor = true;
      if (updatedMethod.isAbstract()) hasAbstractMethods = true;
      methodDeclarations[existingCount + i] = updatedMethod;
    }
    this.typeDeclaration.methods = methodDeclarations;
    if(methodDeclarations[methodDeclarations.length - 1].declarationSourceEnd > lastEnd) {
      lastEnd = methodDeclarations[methodDeclarations.length - 1].declarationSourceEnd;
View Full Code Here

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

    if (typeBinding.isInterface()) {
      // we cannot create problem methods for an interface. So we have to generate a clinit
      // which should contain all the problem
      classFile.addProblemClinit(problemsCopy);
      for (int i = 0, length = methodDecls.length; i < length; i++) {
        AbstractMethodDeclaration methodDecl = methodDecls[i];
        MethodBinding method = methodDecl.binding;
        if (method == null || method.isConstructor()) continue;
        method.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccAbstract;
        classFile.addAbstractMethod(methodDecl, method);
      }
    } else {
      for (int i = 0, length = methodDecls.length; i < length; i++) {
        AbstractMethodDeclaration methodDecl = methodDecls[i];
        MethodBinding method = methodDecl.binding;
        if (method == null) continue;
        if (method.isConstructor()) {
          classFile.addProblemConstructor(methodDecl, method, problemsCopy);
        } else if (method.isAbstract()) {
View Full Code Here

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

      if (typeBinding.isInterface()) {
        // we cannot create problem methods for an interface. So we have to generate a clinit
        // which should contain all the problem
        classFile.addProblemClinit(problemsCopy);
        for (int i = 0, length = methodDecls.length; i < length; i++) {
          AbstractMethodDeclaration methodDecl = methodDecls[i];
          MethodBinding method = methodDecl.binding;
          if (method == null || method.isConstructor()) continue;
          method.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccAbstract;
          classFile.addAbstractMethod(methodDecl, method);
        }
      } else {
        for (int i = 0, length = methodDecls.length; i < length; i++) {
          AbstractMethodDeclaration methodDecl = methodDecls[i];
          MethodBinding method = methodDecl.binding;
          if (method == null) continue;
          if (method.isConstructor()) {
            classFile.addProblemConstructor(methodDecl, method, problemsCopy);
          } else if (method.isAbstract()) {
View Full Code Here

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

    char[] genericSignature = methodBinding.genericSignature();
    if (genericSignature != null) {
      attributesNumber += generateSignatureAttribute(genericSignature);
    }
    if (this.targetJDK >= ClassFileConstants.JDK1_4) {
      AbstractMethodDeclaration methodDeclaration = methodBinding.sourceMethod();
      if (methodDeclaration != null) {
        Annotation[] annotations = methodDeclaration.annotations;
        if (annotations != null) {
          attributesNumber += generateRuntimeAnnotations(annotations);
        }
View Full Code Here

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

    int fieldIndex = 0, fieldCount = (typeDeclaration.fields == null) ? 0 : typeDeclaration.fields.length;
    FieldDeclaration field = fieldCount == 0 ? null : typeDeclaration.fields[fieldIndex];
    int fieldStart = field == null ? Integer.MAX_VALUE : field.declarationSourceStart;

    int methodIndex = 0, methodCount = (typeDeclaration.methods == null) ? 0 : typeDeclaration.methods.length;
    AbstractMethodDeclaration method = methodCount == 0 ? null : typeDeclaration.methods[methodIndex];
    int methodStart = method == null ? Integer.MAX_VALUE : method.declarationSourceStart;

    int typeIndex = 0, typeCount = (typeDeclaration.memberTypes == null) ? 0 : typeDeclaration.memberTypes.length;
    TypeDeclaration type = typeCount == 0 ? null : typeDeclaration.memberTypes[typeIndex];
    int typeStart = type == null ? Integer.MAX_VALUE : type.declarationSourceStart;

    final int memberLength = fieldCount+methodCount+typeCount;
    ASTNode[] members = new ASTNode[memberLength];
    if (memberLength != 0) {
      int index = 0;
      int previousFieldStart = -1;
      do {
        if (fieldStart < methodStart && fieldStart < typeStart) {
          if (field.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) {
            // filter out enum constants
            previousFieldStart = fieldStart;
            if (++fieldIndex < fieldCount) { // find next field if any
              fieldStart = (field = typeDeclaration.fields[fieldIndex]).declarationSourceStart;
            } else {
              fieldStart = Integer.MAX_VALUE;
            }
            continue;
          }
          // next member is a field
          if (fieldStart == previousFieldStart){
            ASTNode previousMember = members[index - 1];
            if (previousMember instanceof MultiFieldDeclaration) {
              MultiFieldDeclaration multiField = (MultiFieldDeclaration) previousMember;
              int length = multiField.declarations.length;
              System.arraycopy(multiField.declarations, 0, multiField.declarations=new FieldDeclaration[length+1], 0, length);
              multiField.declarations[length] = field;
            } else {
              FieldDeclaration fieldDeclaration = (FieldDeclaration)previousMember;
              final MultiFieldDeclaration multiFieldDeclaration = new MultiFieldDeclaration(new FieldDeclaration[]{ fieldDeclaration, field});
              multiFieldDeclaration.annotations = fieldDeclaration.annotations;
              members[index - 1] = multiFieldDeclaration;
            }
          } else {
            members[index++] = field;
          }
          previousFieldStart = fieldStart;
          if (++fieldIndex < fieldCount) { // find next field if any
            fieldStart = (field = typeDeclaration.fields[fieldIndex]).declarationSourceStart;
          } else {
            fieldStart = Integer.MAX_VALUE;
          }
        } else if (methodStart < fieldStart && methodStart < typeStart) {
          // next member is a method
          if (!method.isDefaultConstructor() && !method.isClinit()) {
            members[index++] = method;
          }
          if (++methodIndex < methodCount) { // find next method if any
            methodStart = (method = typeDeclaration.methods[methodIndex]).declarationSourceStart;
          } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.