Package org.eclipse.jdt.internal.compiler.lookup

Examples of org.eclipse.jdt.internal.compiler.lookup.FieldBinding


    type.sourceStart(),
    type.sourceEnd());
}
public void abstractMethodInAbstractClass(SourceTypeBinding type, AbstractMethodDeclaration methodDecl) {
  if (type.isEnum() && type.isLocalType()) {
    FieldBinding field = type.scope.enclosingMethodScope().initializedField;
    FieldDeclaration decl = field.sourceField();
    String[] arguments = new String[] {new String(decl.name), new String(methodDecl.selector)};
    this.handle(
      IProblem.AbstractMethodInEnum,
      arguments,
      arguments,
View Full Code Here


      methodDecl.sourceEnd);
  }
}
public void abstractMethodInConcreteClass(SourceTypeBinding type) {
  if (type.isEnum() && type.isLocalType()) {
    FieldBinding field = type.scope.enclosingMethodScope().initializedField;
    FieldDeclaration decl = field.sourceField();
    String[] arguments = new String[] {new String(decl.name)};
    this.handle(
      IProblem.EnumConstantCannotDefineAbstractMethod,
      arguments,
      arguments,
View Full Code Here

      type.sourceEnd());
  }
}
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[] {
View Full Code Here

      new String(type.sourceName())},
    reference.sourceStart,
    reference.sourceEnd);
}
public void duplicateTargetInTargetAnnotation(TypeBinding annotationType, NameReference reference) {
  FieldBinding field = reference.fieldBinding();
  String name =   new String(field.name);
  this.handle(
    IProblem.DuplicateTargetInTargetAnnotation,
    new String[] { name, new String(annotationType.readableName())},
    new String[] {  name, new String(annotationType.shortReadableName())},
View Full Code Here

    NoArgument,
    sourceStart,
    sourceEnd);
}
public void fieldHiding(FieldDeclaration fieldDecl, Binding hiddenVariable) {
  FieldBinding field = fieldDecl.binding;
  if (CharOperation.equals(TypeConstants.SERIALVERSIONUID, field.name)
      && field.isStatic()
      && field.isPrivate()
      && field.isFinal()
      && TypeBinding.LONG == field.type) {
    ReferenceBinding referenceBinding = field.declaringClass;
    if (referenceBinding != null) {
      if (referenceBinding.findSuperTypeOriginatingFrom(TypeIds.T_JavaIoSerializable, false /*Serializable is not a class*/) != null) {
        return; // do not report field hiding for serialVersionUID field for class that implements Serializable
      }
    }
  }
  if (CharOperation.equals(TypeConstants.SERIALPERSISTENTFIELDS, field.name)
      && field.isStatic()
      && field.isPrivate()
      && field.isFinal()
      && field.type.dimensions() == 1
      && CharOperation.equals(TypeConstants.CharArray_JAVA_IO_OBJECTSTREAMFIELD, field.type.leafComponentType().readableName())) {
    ReferenceBinding referenceBinding = field.declaringClass;
    if (referenceBinding != null) {
      if (referenceBinding.findSuperTypeOriginatingFrom(TypeIds.T_JavaIoSerializable, false /*Serializable is not a class*/) != null) {
        return; // do not report field hiding for serialPersistenFields field for class that implements Serializable
      }
    }
  }
  boolean isLocal = hiddenVariable instanceof LocalVariableBinding;
  int severity = computeSeverity(isLocal ? IProblem.FieldHidingLocalVariable : IProblem.FieldHidingField);
  if (severity == ProblemSeverities.Ignore) return;
  if (isLocal) {
    this.handle(
      IProblem.FieldHidingLocalVariable,
      new String[] {new String(field.declaringClass.readableName()), new String(field.name) },
      new String[] {new String(field.declaringClass.shortReadableName()), new String(field.name) },
      severity,
      nodeSourceStart(hiddenVariable, fieldDecl),
      nodeSourceEnd(hiddenVariable, fieldDecl));
  } else if (hiddenVariable instanceof FieldBinding) {
    FieldBinding hiddenField = (FieldBinding) hiddenVariable;
    this.handle(
      IProblem.FieldHidingField,
      new String[] {new String(field.declaringClass.readableName()), new String(field.name) , new String(hiddenField.declaringClass.readableName())  },
      new String[] {new String(field.declaringClass.shortReadableName()), new String(field.name) , new String(hiddenField.declaringClass.shortReadableName()) },
      severity,
View Full Code Here

    location.sourceEnd);
}
public void importProblem(ImportReference importRef, Binding expectedImport) {
  if (expectedImport instanceof FieldBinding) {
    int id = IProblem.UndefinedField;
    FieldBinding field = (FieldBinding) expectedImport;
    String[] readableArguments = null;
    String[] shortArguments = null;
    switch (expectedImport.problemId()) {
      case ProblemReasons.NotVisible :
        id = IProblem.NotVisibleField;
        readableArguments = new String[] {CharOperation.toString(importRef.tokens), new String(field.declaringClass.readableName())};
        shortArguments = new String[] {CharOperation.toString(importRef.tokens), new String(field.declaringClass.shortReadableName())};
        break;
      case ProblemReasons.Ambiguous :
        id = IProblem.AmbiguousField;
        readableArguments = new String[] {new String(field.readableName())};
        shortArguments = new String[] {new String(field.readableName())};
        break;
      case ProblemReasons.ReceiverTypeNotVisible :
        id = IProblem.NotVisibleType;
        readableArguments = new String[] {new String(field.declaringClass.leafComponentType().readableName())};
        shortArguments = new String[] {new String(field.declaringClass.leafComponentType().shortReadableName())};
View Full Code Here

}
public void invalidField(FieldReference fieldRef, TypeBinding searchedType) {
  if(isRecoveredName(fieldRef.token)) return;

  int id = IProblem.UndefinedField;
  FieldBinding field = fieldRef.binding;
  switch (field.problemId()) {
    case ProblemReasons.NotFound :
      if ((searchedType.tagBits & TagBits.HasMissingType) != 0) {
        this.handle(
            IProblem.UndefinedType,
            new String[] {new String(searchedType.leafComponentType().readableName())},
            new String[] {new String(searchedType.leafComponentType().shortReadableName())},
            fieldRef.receiver.sourceStart,
            fieldRef.receiver.sourceEnd);
          return;
      }
      id = IProblem.UndefinedField;
/* also need to check that the searchedType is the receiver type
      if (searchedType.isHierarchyInconsistent())
        severity = SecondaryError;
*/
      break;
    case ProblemReasons.NotVisible :
      this.handle(
        IProblem.NotVisibleField,
        new String[] {new String(fieldRef.token), new String(field.declaringClass.readableName())},
        new String[] {new String(fieldRef.token), new String(field.declaringClass.shortReadableName())},
        nodeSourceStart(field, fieldRef),
        nodeSourceEnd(field, fieldRef));
      return;
    case ProblemReasons.Ambiguous :
      id = IProblem.AmbiguousField;
      break;
    case ProblemReasons.NonStaticReferenceInStaticContext :
      id = IProblem.NonStaticFieldFromStaticInvocation;
      break;
    case ProblemReasons.NonStaticReferenceInConstructorInvocation :
      id = IProblem.InstanceFieldDuringConstructorInvocation;
      break;
    case ProblemReasons.InheritedNameHidesEnclosingName :
      id = IProblem.InheritedFieldHidesEnclosingName;
      break;
    case ProblemReasons.ReceiverTypeNotVisible :
      this.handle(
        IProblem.NotVisibleType, // cannot occur in javadoc comments
        new String[] {new String(searchedType.leafComponentType().readableName())},
        new String[] {new String(searchedType.leafComponentType().shortReadableName())},
        fieldRef.receiver.sourceStart,
        fieldRef.receiver.sourceEnd);
      return;

    case ProblemReasons.NoError : // 0
    default :
      needImplementation(fieldRef); // want to fail to see why we were here...
      break;
  }

  String[] arguments = new String[] {new String(field.readableName())};
  this.handle(
    id,
    arguments,
    arguments,
    nodeSourceStart(field, fieldRef),
View Full Code Here

    int id = (local instanceof Argument)
        ? IProblem.ArgumentHidingField
        : IProblem.LocalVariableHidingField;
    int severity = computeSeverity(id);
    if (severity == ProblemSeverities.Ignore) return;
    FieldBinding field = (FieldBinding) hiddenVariable;
    this.handle(
      id,
      new String[] {new String(local.name) , new String(field.declaringClass.readableName()) },
      new String[] {new String(local.name), new String(field.declaringClass.shortReadableName()) },
      severity,
View Full Code Here

}

public void missingDeprecatedAnnotationForField(FieldDeclaration field) {
  int severity = computeSeverity(IProblem.FieldMissingDeprecatedAnnotation);
  if (severity == ProblemSeverities.Ignore) return;
  FieldBinding binding = field.binding;
  this.handle(
    IProblem.FieldMissingDeprecatedAnnotation,
    new String[] {new String(binding.declaringClass.readableName()), new String(binding.name), },
    new String[] {new String(binding.declaringClass.shortReadableName()), new String(binding.name), },
    severity,
View Full Code Here

public void unusedPrivateField(FieldDeclaration fieldDecl) {

  int severity = computeSeverity(IProblem.UnusedPrivateField);
  if (severity == ProblemSeverities.Ignore) return;

  FieldBinding field = fieldDecl.binding;

  if (CharOperation.equals(TypeConstants.SERIALVERSIONUID, field.name)
      && field.isStatic()
      && field.isFinal()
      && TypeBinding.LONG == field.type) {
    ReferenceBinding referenceBinding = field.declaringClass;
    if (referenceBinding != null) {
      if (referenceBinding.findSuperTypeOriginatingFrom(TypeIds.T_JavaIoSerializable, false /*Serializable is not a class*/) != null) {
        return; // do not report unused serialVersionUID field for class that implements Serializable
      }
    }
  }
  if (CharOperation.equals(TypeConstants.SERIALPERSISTENTFIELDS, field.name)
      && field.isStatic()
      && field.isFinal()
      && field.type.dimensions() == 1
      && CharOperation.equals(TypeConstants.CharArray_JAVA_IO_OBJECTSTREAMFIELD, field.type.leafComponentType().readableName())) {
    ReferenceBinding referenceBinding = field.declaringClass;
    if (referenceBinding != null) {
      if (referenceBinding.findSuperTypeOriginatingFrom(TypeIds.T_JavaIoSerializable, false /*Serializable is not a class*/) != null) {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.lookup.FieldBinding

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.