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

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


    if (this.referenceContext.memberTypes != null) {
      int size = this.referenceContext.memberTypes.length;
      memberTypeBindings = new ReferenceBinding[size];
      int count = 0;
      nextMember : for (int i = 0; i < size; i++) {
        TypeDeclaration memberContext = this.referenceContext.memberTypes[i];
        switch(TypeDeclaration.kind(memberContext.modifiers)) {
          case TypeDeclaration.INTERFACE_DECL :
          case TypeDeclaration.ANNOTATION_TYPE_DECL :
            problemReporter().illegalLocalTypeDeclaration(memberContext);
            continue nextMember;
View Full Code Here


    if (this.referenceContext.memberTypes != null) {
      int length = this.referenceContext.memberTypes.length;
      memberTypeBindings = new ReferenceBinding[length];
      int count = 0;
      nextMember : for (int i = 0; i < length; i++) {
        TypeDeclaration memberContext = this.referenceContext.memberTypes[i];
        switch(TypeDeclaration.kind(memberContext.modifiers)) {
          case TypeDeclaration.INTERFACE_DECL :
          case TypeDeclaration.ANNOTATION_TYPE_DECL :
            if (sourceType.isNestedType()
                && sourceType.isClass() // no need to check for enum, since implicitly static
View Full Code Here

            modifiers |= ClassFileConstants.AccAbstract;
            break checkAbstractEnum;
          }
          // body of enum constant must implement any inherited abstract methods
          // enum type needs to implement abstract methods if one of its constants does not supply a body
          TypeDeclaration typeDeclaration = this.referenceContext;
          FieldDeclaration[] fields = typeDeclaration.fields;
          int fieldsLength = fields == null ? 0 : fields.length;
          if (fieldsLength == 0) break checkAbstractEnum; // has no constants so must implement the method itself
          AbstractMethodDeclaration[] methods = typeDeclaration.methods;
          int methodsLength = methods == null ? 0 : methods.length;
          // TODO (kent) cannot tell that the superinterfaces are empty or that their methods are implemented
          boolean definesAbstractMethod = typeDeclaration.superInterfaces != null;
          for (int i = 0; i < methodsLength && !definesAbstractMethod; i++)
            definesAbstractMethod = methods[i].isAbstract();
          if (!definesAbstractMethod) break checkAbstractEnum; // all methods have bodies
          boolean needAbstractBit = false;
          for (int i = 0; i < fieldsLength; i++) {
            FieldDeclaration fieldDecl = fields[i];
            if (fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) {
              if (fieldDecl.initialization instanceof QualifiedAllocationExpression) {
                needAbstractBit = true;
              } else {
                break checkAbstractEnum;
              }
            }
          }
          // tag this enum as abstract since an abstract method must be implemented AND all enum constants define an anonymous body
          // as a result, each of its anonymous constants will see it as abstract and must implement each inherited abstract method
          if (needAbstractBit) {
            modifiers |= ClassFileConstants.AccAbstract;
          }
        }
        // final if no enum constant with anonymous body
        checkFinalEnum: {
          TypeDeclaration typeDeclaration = this.referenceContext;
          FieldDeclaration[] fields = typeDeclaration.fields;
          if (fields != null) {
            for (int i = 0, fieldsLength = fields.length; i < fieldsLength; i++) {
              FieldDeclaration fieldDecl = fields[i];
              if (fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) {
View Full Code Here

public long getAnnotationTagBits() {
  MethodBinding originalMethod = original();
  if ((originalMethod.tagBits & TagBits.AnnotationResolved) == 0 && originalMethod.declaringClass instanceof SourceTypeBinding) {
    ClassScope scope = ((SourceTypeBinding) originalMethod.declaringClass).scope;
    if (scope != null) {
      TypeDeclaration typeDecl = scope.referenceContext;
      AbstractMethodDeclaration methodDecl = typeDecl.declarationOf(originalMethod);
      if (methodDecl != null)
        ASTNode.resolveAnnotations(methodDecl.scope, methodDecl.annotations, originalMethod);
    }
  }
  return originalMethod.tagBits;
View Full Code Here

public LocalTypeBinding(ClassScope scope, SourceTypeBinding enclosingType, CaseStatement switchCase, ReferenceBinding anonymousOriginalSuperType) {
  super(
    new char[][] {CharOperation.concat(LocalTypeBinding.LocalTypePrefix, scope.referenceContext.name)},
    scope,
    enclosingType);
  TypeDeclaration typeDeclaration = scope.referenceContext;
  if ((typeDeclaration.bits & ASTNode.IsAnonymousType) != 0) {
    this.tagBits |= TagBits.AnonymousTypeMask;
  } else {
    this.tagBits |= TagBits.LocalTypeMask;
  }
View Full Code Here

      //compilation units to process. Thus the field is NOT from a BinaryTypeBinbing
      FieldBinding originalField = original();
      if (originalField.declaringClass instanceof SourceTypeBinding) {
        SourceTypeBinding sourceType = (SourceTypeBinding) originalField.declaringClass;
        if (sourceType.scope != null) {
          TypeDeclaration typeDecl = sourceType.scope.referenceContext;
          FieldDeclaration fieldDecl = typeDecl.declarationOf(originalField);
          MethodScope initScope = originalField.isStatic() ? typeDecl.staticInitializerScope : typeDecl.initializerScope;
          boolean old = initScope.insideTypeAnnotation;
          try {
            initScope.insideTypeAnnotation = false;
            fieldDecl.resolve(initScope); //side effect on binding
View Full Code Here

    ClassScope scope = ((SourceTypeBinding) originalField.declaringClass).scope;
    if (scope == null) { // synthetic fields do not have a scope nor any annotations
      this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
      return 0;
    }
    TypeDeclaration typeDecl = scope.referenceContext;
    FieldDeclaration fieldDecl = typeDecl.declarationOf(originalField);
    if (fieldDecl != null) {
      MethodScope initializationScope = isStatic() ? typeDecl.staticInitializerScope : typeDecl.initializerScope;
      FieldBinding previousField = initializationScope.initializedField;
      int previousFieldID = initializationScope.lastVisibleFieldID;
      try {
View Full Code Here

  int index = 1;
  do {
    needRecheck = false;
    FieldBinding existingField;
    if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
      TypeDeclaration typeDecl = this.scope.referenceContext;
      for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
        FieldDeclaration fieldDecl = typeDecl.fields[i];
        if (fieldDecl.binding == existingField) {
          synthField.name = CharOperation.concat(
            TypeConstants.SYNTHETIC_OUTER_LOCAL_PREFIX,
View Full Code Here

  boolean needRecheck;
  do {
    needRecheck = false;
    FieldBinding existingField;
    if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
      TypeDeclaration typeDecl = this.scope.referenceContext;
      for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
        FieldDeclaration fieldDecl = typeDecl.fields[i];
        if (fieldDecl.binding == existingField) {
          if (this.scope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_5) {
            synthField.name = CharOperation.concat(
View Full Code Here

    this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].put(targetType, synthField);
  }
  // ensure there is not already such a field defined by the user
  FieldBinding existingField;
  if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
    TypeDeclaration typeDecl = blockScope.referenceType();
    for (int i = 0, max = typeDecl.fields.length; i < max; i++) {
      FieldDeclaration fieldDecl = typeDecl.fields[i];
      if (fieldDecl.binding == existingField) {
        blockScope.problemReporter().duplicateFieldInType(this, fieldDecl);
        break;
View Full Code Here

TOP

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

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.