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

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


  }
}
public void abstractMethodMustBeImplemented(SourceTypeBinding type, MethodBinding abstractMethod) {
  if (type.isEnum() && type.isLocalType()) {
    FieldBinding field = type.scope.enclosingMethodScope().initializedField;
    FieldDeclaration decl = field.sourceField();
    this.handle(
      // Must implement the inherited abstract method %1
      // 8.4.3 - Every non-abstract subclass of an abstract type, A, must provide a concrete implementation of all of A's methods.
      IProblem.EnumConstantMustImplementAbstractMethod,
      new String[] {
              new String(abstractMethod.selector),
              typesAsString(abstractMethod, false),
              new String(decl.name),
      },
      new String[] {
              new String(abstractMethod.selector),
              typesAsString(abstractMethod, true),
              new String(decl.name),
      },
      decl.sourceStart(),
      decl.sourceEnd());
  } else {
    this.handle(
      // Must implement the inherited abstract method %1
      // 8.4.3 - Every non-abstract subclass of an abstract type, A, must provide a concrete implementation of all of A's methods.
      IProblem.AbstractMethodMustBeImplemented,
View Full Code Here


    if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
      TypeDeclaration typeDecl = this.scope.referenceContext;
      FieldDeclaration[] fieldDeclarations = typeDecl.fields;
      int max = fieldDeclarations == null ? 0 : fieldDeclarations.length;
      for (int i = 0; i < max; i++) {
        FieldDeclaration fieldDecl = fieldDeclarations[i];
        if (fieldDecl.binding == existingField) {
          synthField.name = CharOperation.concat(
            TypeConstants.SYNTHETIC_OUTER_LOCAL_PREFIX,
            actualOuterLocalVariable.name,
            ("$" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
View Full Code Here

    if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
      TypeDeclaration typeDecl = this.scope.referenceContext;
      FieldDeclaration[] fieldDeclarations = typeDecl.fields;
      int max = fieldDeclarations == null ? 0 : fieldDeclarations.length;
      for (int i = 0; i < max; i++) {
        FieldDeclaration fieldDecl = fieldDeclarations[i];
        if (fieldDecl.binding == existingField) {
          if (this.scope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_5) {
            synthField.name = CharOperation.concat(
              synthField.name,
              "$".toCharArray()); //$NON-NLS-1$
View Full Code Here

  if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
    TypeDeclaration typeDecl = blockScope.referenceType();
    FieldDeclaration[] typeDeclarationFields = typeDecl.fields;
    int max = typeDeclarationFields == null ? 0 : typeDeclarationFields.length;
    for (int i = 0; i < max; i++) {
      FieldDeclaration fieldDecl = typeDeclarationFields[i];
      if (fieldDecl.binding == existingField) {
        blockScope.problemReporter().duplicateFieldInType(this, fieldDecl);
        break;
      }
    }
View Full Code Here

    FieldBinding existingField;
    if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
      TypeDeclaration typeDecl = this.scope.referenceContext;
      int max = (typeDecl.fields == null) ? 0 : typeDecl.fields.length;
      for (int i = 0; i < max; i++) {
        FieldDeclaration fieldDecl = typeDecl.fields[i];
        if (fieldDecl.binding == existingField) {
          synthField.name = CharOperation.concat(
            TypeConstants.SYNTHETIC_ASSERT_DISABLED,
            ("_" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
          needRecheck = true;
View Full Code Here

    if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
      TypeDeclaration typeDecl = this.scope.referenceContext;
      FieldDeclaration[] fieldDeclarations = typeDecl.fields;
      int max = fieldDeclarations == null ? 0 : fieldDeclarations.length;
      for (int i = 0; i < max; i++) {
        FieldDeclaration fieldDecl = fieldDeclarations[i];
        if (fieldDecl.binding == existingField) {
          synthField.name = CharOperation.concat(
            TypeConstants.SYNTHETIC_ENUM_VALUES,
            ("_" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
          needRecheck = true;
View Full Code Here

    if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
      TypeDeclaration typeDecl = this.scope.referenceContext;
      FieldDeclaration[] fieldDeclarations = typeDecl.fields;
      int max = fieldDeclarations == null ? 0 : fieldDeclarations.length;
      for (int i = 0; i < max; i++) {
        FieldDeclaration fieldDecl = fieldDeclarations[i];
        if (fieldDecl.binding == existingField) {
          synthField.name = CharOperation.concat(
            fieldName,
            ("_" + String.valueOf(index++)).toCharArray()); //$NON-NLS-1$
          needRecheck = true;
View Full Code Here

      ? this.scope.referenceContext.staticInitializerScope
      : this.scope.referenceContext.initializerScope;
    FieldBinding previousField = initializationScope.initializedField;
    try {
      initializationScope.initializedField = field;
      FieldDeclaration fieldDecl = fieldDecls[f];
      TypeBinding fieldType =
        fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT
          ? initializationScope.environment().convertToRawType(this, false /*do not force conversion of enclosing types*/) // enum constant is implicitly of declaring enum type
          : fieldDecl.type.resolveType(initializationScope, true /* check bounds*/);
      field.type = fieldType;
      field.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
      if (fieldType == null) {
        fieldDecl.binding = null;
        return null;
      }
      if (fieldType == TypeBinding.VOID) {
        this.scope.problemReporter().variableTypeCannotBeVoid(fieldDecl);
        fieldDecl.binding = null;
        return null;
      }
      if (fieldType.isArrayType() && ((ArrayBinding) fieldType).leafComponentType == TypeBinding.VOID) {
        this.scope.problemReporter().variableTypeCannotBeVoidArray(fieldDecl);
        fieldDecl.binding = null;
        return null;
      }
      if ((fieldType.tagBits & TagBits.HasMissingType) != 0) {
        field.tagBits |= TagBits.HasMissingType;
      }
      TypeBinding leafType = fieldType.leafComponentType();
      if (leafType instanceof ReferenceBinding && (((ReferenceBinding)leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0) {
        field.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
      }

      // apply null default:
      LookupEnvironment environment = this.scope.environment();
      if (environment.globalOptions.isAnnotationBasedNullAnalysisEnabled) {
        if (fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) {
          // enum constants neither have a type declaration nor can they be null
          field.tagBits |= TagBits.AnnotationNonNull;
        } else {
          initializeNullDefault();
          if (hasNonNullDefault()) {
View Full Code Here

                // completion is inside an initializer
                searchVisibleVariablesAndMethods(scope, this.visibleLocalVariables, this.visibleFields, this.visibleMethods, notInJavadoc);
                break done;
              }
            } else {
              FieldDeclaration fieldDeclaration = fields[i];             
              if (fieldDeclaration.initialization != null) {
                boolean isInsideInitializer = false;
                if (fieldDeclaration.initialization.sourceEnd > 0) {
                  if (fieldDeclaration.initialization.sourceStart <= astNode.sourceStart &&
                      astNode.sourceEnd <= fieldDeclaration.initialization.sourceEnd) {
View Full Code Here

      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
          } finally {
            initScope.insideTypeAnnotation = old;
          }
          fieldConstant = originalField.constant == null ? Constant.NotAConstant : originalField.constant;
        } else {
View Full Code Here

TOP

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

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.