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

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


/**
* @see org.eclipse.jdt.internal.compiler.lookup.Binding#initializeDeprecatedAnnotationTagBits()
*/
public void initializeDeprecatedAnnotationTagBits() {
  if ((this.tagBits & TagBits.DeprecatedAnnotationResolved) == 0) {
    TypeDeclaration typeDecl = this.scope.referenceContext;
    boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation;
    try {
      typeDecl.staticInitializerScope.insideTypeAnnotation = true;
      ASTNode.resolveDeprecatedAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this);
      this.tagBits |= TagBits.DeprecatedAnnotationResolved;
View Full Code Here


    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

    final LocalVariableBinding localVariableBinding = (LocalVariableBinding) this.binding;
    if (declaringMethod == null) {
      ReferenceContext referenceContext = localVariableBinding.declaringScope.referenceContext();
      if (referenceContext instanceof TypeDeclaration){
        // Local variable is declared inside an initializer
        TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext;
        JavaElement typeHandle = null;
        typeHandle = Util.getUnresolvedJavaElement(
          typeDeclaration.binding,
          defaultBindingResolver.workingCopyOwner,
          defaultBindingResolver.getBindingsToNodesMap());
View Full Code Here

public void generateSyntheticBodyForEnumInitializationMethod(SyntheticMethodBinding methodBinding) {
  // no local used
  this.maxLocals = 0;
  // generate all enum constants
  SourceTypeBinding sourceTypeBinding = (SourceTypeBinding) methodBinding.declaringClass;
  TypeDeclaration typeDeclaration = sourceTypeBinding.scope.referenceContext;
  BlockScope staticInitializerScope = typeDeclaration.staticInitializerScope;
  FieldDeclaration[] fieldDeclarations = typeDeclaration.fields;
  for (int i = methodBinding.startIndex, max = methodBinding.endIndex; i < max; i++) {
    FieldDeclaration fieldDecl = fieldDeclarations[i];
    if (fieldDecl.isStatic()) {
View Full Code Here

    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) {
View Full Code Here

      this.preferences.insert_space_after_comma_in_enum_constant_arguments,
      this.preferences.alignment_for_arguments_in_enum_constant);

    Expression initialization = enumConstant.initialization;
    if (initialization instanceof QualifiedAllocationExpression) {
      TypeDeclaration typeDeclaration = ((QualifiedAllocationExpression) initialization).anonymousType;
      int fieldsCount = typeDeclaration.fields == null ? 0 : typeDeclaration.fields.length;
      int methodsCount = typeDeclaration.methods == null ? 0 : typeDeclaration.methods.length;
      int membersCount = typeDeclaration.memberTypes == null ? 0 : typeDeclaration.memberTypes.length;

      /*
 
View Full Code Here

      this.scribe.exitAlignment(argumentsAlignment, true);
      this.scribe.printNextToken(TerminalTokens.TokenNameRPAREN, this.preferences.insert_space_before_closing_paren_in_method_invocation);
    } else {
      this.scribe.printNextToken(TerminalTokens.TokenNameRPAREN, this.preferences.insert_space_between_empty_parens_in_method_invocation);
    }
    final TypeDeclaration anonymousType = qualifiedAllocationExpression.anonymousType;
    if (anonymousType != null) {
      formatLeftCurlyBrace(line, this.preferences.brace_position_for_anonymous_type_declaration);
      formatAnonymousTypeDeclaration(anonymousType);
    }
    if (numberOfParens > 0) {
View Full Code Here

      TreeLogger cudLogger = logger.branch(TreeLogger.SPAM,
          "Processing types in compilation unit: " + unit.getDisplayLocation());
      Set<CompiledClass> compiledClasses = unit.getCompiledClasses();
      for (CompiledClass compiledClass : compiledClasses) {
        if (unresolvedTypes.contains(compiledClass.getRealClassType())) {
          TypeDeclaration typeDeclaration = compiledClass.getTypeDeclaration();
          if (!resolveTypeDeclaration(cudLogger, unit.getSource(), typeDeclaration)) {
            logger.log(TreeLogger.WARN,
                "Unexpectedly unable to fully resolve type "
                    + compiledClass.getSourceName());
          }
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.