Examples of TypeDeclaration


Examples of org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration

   * the member (field/method) then grabbing the annotations.
   *
   * @return an array of (eclipse form) annotations on this member
   */
  private Annotation[] getEclipseAnnotations() {
    TypeDeclaration tDecl = getTypeDeclaration();
    // two possible reasons for it being null:
    // 1. code is broken
    // 2. this resolvedmember is an EclipseResolvedMember created up front to represent a privileged'd accessed member
    if (tDecl != null) {
      if (realBinding instanceof MethodBinding) {
        MethodBinding methodBinding = (MethodBinding) realBinding;
        AbstractMethodDeclaration methodDecl = tDecl.declarationOf(methodBinding);
        if (methodDecl == null) {
          // pr284862
          // bindings may have been trashed by InterTypeMemberFinder.addInterTypeMethod() - and so we need to take
          // a better look. Really this EclipseResolvedMember is broken...

          // Grab the set of bindings with matching selector
          MethodBinding[] mb = ((MethodBinding) realBinding).declaringClass.getMethods(methodBinding.selector);
          if (mb != null) {
            for (int m = 0, max = mb.length; m < max; m++) {
              MethodBinding candidate = mb[m];
              if (candidate instanceof InterTypeMethodBinding) {
                if (InterTypeMemberFinder.matches(mb[m], methodBinding)) {
                  InterTypeMethodBinding intertypeMethodBinding = (InterTypeMethodBinding) candidate;
                  Annotation[] annos = intertypeMethodBinding.sourceMethod.annotations;
                  return annos;
                }
              }
            }
          }
          return null; // give up! kind of assuming here that the code has other problems (and they will be reported)
        }
        return methodDecl.annotations;
      } else if (realBinding instanceof FieldBinding) {
        FieldDeclaration fieldDecl = tDecl.declarationOf((FieldBinding) realBinding);
        return fieldDecl.annotations;
      }
    }
    return null;
  }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration

      case Scope.METHOD_SCOPE :
        IType parentType = (IType) createElement(scope.parent, elementPosition, unit, existingElements, knownScopes);
        MethodScope methodScope = (MethodScope) scope;
        if (methodScope.isInsideInitializer()) {
          // inside field or initializer, must find proper one
          TypeDeclaration type = methodScope.referenceType();
          int occurenceCount = 1;
          for (int i = 0, length = type.fields.length; i < length; i++) {
            FieldDeclaration field = type.fields[i];
            if (field.declarationSourceStart < elementPosition && field.declarationSourceEnd > elementPosition) {
              switch (field.getKind()) {
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration

  }

  protected void consumeAspectHeaderName(boolean isPrivileged) {
    // (isPrivileged == false) -> AspectHeaderName ::= Modifiersopt 'aspect' 'Identifier'
    // (isPrivileged == true) -> AspectHeaderName ::= Modifiersopt 'privileged' Modifiersopt 'aspect' 'Identifier'
    TypeDeclaration aspectDecl = declarationFactory.createAspect(this.compilationUnit.compilationResult);
    if (this.nestedMethod[this.nestedType] == 0) {
      if (this.nestedType != 0) {
        aspectDecl.bits |= ASTNode.IsMemberType;
      }
    } else {
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration

    this.display();
  }

  protected void consumeAspectHeaderNameWithTypeParameters(boolean isPriviliged) {
    TypeDeclaration typeDecl = (TypeDeclaration)this.astStack[this.astPtr];

    // consume type parameters
    int length = this.genericsLengthStack[this.genericsLengthPtr--];
    this.genericsPtr -= length;
    System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeDecl.typeParameters = new TypeParameter[length], 0, length);
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration

    concatNodeLists();
    this.display();
    ASTNode pseudoTokens = popPseudoTokens("{");
    println("pseudo: " + pseudoTokens);

    TypeDeclaration aspectDecl = (TypeDeclaration) astStack[astPtr];
   
    declarationFactory.setDominatesPatternFrom(aspectDecl,pseudoTokens,this);
    declarationFactory.setPerClauseFrom(aspectDecl,pseudoTokens,this);
    // XXX handle dominates
  }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration

 
  // Helpers
 

  private void consumeIntertypeClassHeader() {
    TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr]
    if (this.currentToken == TokenNameLBRACE) {
      typeDecl.bodyStart = this.scanner.currentPosition;
    }
    if (this.currentElement != null) {
      this.restartRecovery = true; // used to avoid branching back into the regular automaton   
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration

      //there are length declarations
      //dispatch according to the type of the declarations
      dispatchDeclarationInto(length);
    }

    TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr];

    // mark initializers with local type mark if needed
    markInitializersWithLocalType(typeDecl);

    //convert constructor that do not have the type's name into methods
    boolean hasConstructor = typeDecl.checkConstructors((Parser)this);
   
    //add the default constructor when needed (interface don't have it)
    if (!hasConstructor) {
      switch(TypeDeclaration.kind(typeDecl.modifiers)) {
        case TypeDeclaration.CLASS_DECL :
        case TypeDeclaration.ENUM_DECL :
          boolean insideFieldInitializer = false;
          if (this.diet) {
            for (int i = this.nestedType; i > 0; i--){
              if (this.variablesCounter[i] > 0) {
                insideFieldInitializer = true;
                break;
              }
            }
          }
          typeDecl.createDefaultConstructor(!this.diet || insideFieldInitializer, true);
      }
    }
    //always add <clinit> (will be remove at code gen time if empty)
    if (this.scanner.containsAssertKeyword) {
      typeDecl.bits |= ASTNode.ContainsAssertion;
    }
    typeDecl.addClinit();
    typeDecl.bodyEnd = this.endStatementPosition;
    if (length == 0 && !containsComment(typeDecl.bodyStart, typeDecl.bodyEnd)) {
      typeDecl.bits |= ASTNode.UndocumentedEmptyBlock;
    }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration

    typeDecl.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition);
   
  }

  private void consumeIntertypeTypeHeaderNameWithTypeParameters() {
    TypeDeclaration typeDecl = (TypeDeclaration)this.astStack[this.astPtr];

    // consume type parameters
    int length = this.genericsLengthStack[this.genericsLengthPtr--];
    this.genericsPtr -= length;
    System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeDecl.typeParameters = new TypeParameter[length], 0, length);
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration

      this.lastCheckPoint = typeDecl.bodyStart;
    }   
  }

  private void consumeIntertypeClassHeaderName(boolean b) { 
    TypeDeclaration typeDecl = declarationFactory.createIntertypeMemberClassDeclaration(this.compilationUnit.compilationResult);
    if (this.nestedMethod[this.nestedType] == 0) {
      if (this.nestedType != 0) {
        typeDecl.bits |= ASTNode.IsMemberType;
      }
    } else {
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration

        if (parentRef != null) {
          TypeBinding parentBinding = parentRef.resolvedType;
          if (parentBinding instanceof SourceTypeBinding) {
            SourceTypeBinding parentSTB = (SourceTypeBinding) parentBinding;
            if (parentSTB.scope != null) {
              TypeDeclaration parentDecl = parentSTB.scope.referenceContext;
              if (isAspect(parentDecl)) {
                typeDecl.scope.problemReporter().signalError(typeDecl.sourceStart, typeDecl.sourceEnd,
                    "a class cannot extend an aspect");
              }
            }
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.