org.eclipse.pde.api.tools_1.0.301.v20111129-2053

ator(); iterator.hasNext();) {
        try
        {
          IApiType typeMember = (IApiType)iterator.next();
          
          IApiDescription apiDescription = component.getApiDescription();
          IApiAnnotations memberTypeElementDescription = apiDescription.resolveAnnotations(typeMember.getHandle());
          int memberTypeVisibility = 0;
          if (memberTypeElementDescription != null) {
            memberTypeVisibility = memberTypeElementDescription.getVisibility();
          }
          if ((memberTypeVisibility & visibilityModifiers) != 0) {
            if ((visibilityModifiers != 1) || (
            
              (!Util.isDefault(typeMember.getModifiers())) && 
              (!Flags.isPrivate(typeMember.getModifiers())))) {
              addDelta(
                getElementType(type1), 
                3, 
                48, 
                memberTypeElementDescription != null ? memberTypeElementDescription.getRestrictions() : 0, 
                typeMember.getModifiers(), 
                0, 
                type1, 
                typeMember.getName(), 
                new String[] { typeMember.getName().replace('$', '.'), Util.getComponentVersionsId(component2) });
            }
          }
        }
        catch (CoreException e)
        {
          reportStatus(e);
        }
      }
    }
    for (Iterator iterator = added.iterator(); iterator.hasNext();) {
      try
      {
        String name = (String)iterator.next();
        int index = name.lastIndexOf('$');
        IApiType typeMember = type2.getMemberType(name.substring(index + 1));
        
        IApiDescription apiDescription2 = component2.getApiDescription();
        IApiAnnotations memberTypeElementDescription2 = apiDescription2.resolveAnnotations(typeMember.getHandle());
        int memberTypeVisibility2 = 0;
        if (memberTypeElementDescription2 != null) {
          memberTypeVisibility2 = memberTypeElementDescription2.getVisibility();
        }
        if ((memberTypeVisibility2 & visibilityModifiers) != 0) {
          if ((visibilityModifiers != 1) || (
          
            (!Util.isDefault(typeMember.getModifiers())) && 
            (!Flags.isPrivate(typeMember.getModifiers())))) {
            addDelta(
              getElementType(type1), 
              1, 
              48, 
              currentDescriptorRestrictions, 
              0, 
              typeMember.getModifiers(), 
              type1, 
              typeMember.getSimpleName(), 
              typeMember.getSimpleName());
          }
        }
      }
      catch (CoreException e)
      {
        reportStatus(e);
      }
    }
  }
  
  private void checkGenericSignature(String signature1, String signature2, IApiMember element1, IApiMember element2)
  {
    if (signature1 == null)
    {
      if (signature2 != null)
      {
        SignatureDescriptor signatureDescriptor2 = getSignatureDescriptor(signature2);
        TypeParameterDescriptor[] typeParameterDescriptors = signatureDescriptor2.getTypeParameterDescriptors();
        if (typeParameterDescriptors.length != 0) {
          addDelta(
            getElementType(element1), 
            1, 
            51, 
            currentDescriptorRestrictions, 
            element1.getModifiers(), 
            element2.getModifiers(), 
            type1, 
            element1.getName(), 
            new String[] { getDataFor(element1, type1) });
        } else if (signatureDescriptor2.getTypeArguments().length != 0) {
          addDelta(
            getElementType(element1), 
            1, 
            47, 
            currentDescriptorRestrictions, 
            element1.getModifiers(), 
            element2.getModifiers(), 
            type1, 
            element1.getName(), 
            new String[] { getDataFor(element1, type1) });
        }
      }
    }
    else if (signature2 == null)
    {
      SignatureDescriptor signatureDescriptor = getSignatureDescriptor(signature1);
      TypeParameterDescriptor[] typeParameterDescriptors = signatureDescriptor.getTypeParameterDescriptors();
      int length = typeParameterDescriptors.length;
      if (length != 0)
      {
        for (int i = 0; i < length; i++)
        {
          TypeParameterDescriptor typeParameterDescriptor = typeParameterDescriptors[i];
          addDelta(
            getElementType(element1), 
            3, 
            49, 
            currentDescriptorRestrictions, 
            element1.getModifiers(), 
            element2.getModifiers(), 
            type1, 
            element1.getName(), 
            new String[] { getDataFor(element1, type1), name });
        }
      }
      else
      {
        String[] typeArguments = signatureDescriptor.getTypeArguments();
        length = typeArguments.length;
        if (length != 0) {
          for (int i = 0; i < length; i++)
          {
            String typeArgument = typeArguments[i];
            addDelta(
              getElementType(element1), 
              3, 
              68, 
              currentDescriptorRestrictions, 
              element1.getModifiers(), 
              element2.getModifiers(), 
              type1, 
              element1.getName(), 
              new String[] { getDataFor(element1, type1), typeArgument });
          }
        }
      }
    }
    else
    {
      SignatureDescriptor signatureDescriptor = getSignatureDescriptor(signature1);
      SignatureDescriptor signatureDescriptor2 = getSignatureDescriptor(signature2);
      
      TypeParameterDescriptor[] typeParameterDescriptors1 = signatureDescriptor.getTypeParameterDescriptors();
      TypeParameterDescriptor[] typeParameterDescriptors2 = signatureDescriptor2.getTypeParameterDescriptors();
      int length = typeParameterDescriptors1.length;
      int length2 = typeParameterDescriptors2.length;
      int min = length;
      int max = length2;
      if (length > length2)
      {
        min = length2;
        max = length;
      }
      for (int i = 0; i < min; i++)
      {
        TypeParameterDescriptor parameterDescriptor1 = typeParameterDescriptors1[i];
        TypeParameterDescriptor parameterDescriptor2 = typeParameterDescriptors2[i];
        String name = name;
        if (!name.equals(name)) {
          addDelta(
            10, 
            2, 
            50, 
            currentDescriptorRestrictions, 
            element1.getModifiers(), 
            element2.getModifiers(), 
            type1, 
            name, 
            new String[] { getDataFor(element1, type1), name });
        }
        if (classBound == null)
        {
          if (classBound != null) {
            addDelta(
              10, 
              1, 
              6, 
              currentDescriptorRestrictions, 
              element1.getModifiers(), 
              element2.getModifiers(), 
              type1, 
              name, 
              new String[] { getDataFor(element1, type1), name });
          }
        }
        else if (classBound == null) {
          addDelta(
            10, 
            3, 
            6, 
            currentDescriptorRestrictions, 
            element1.getModifiers(), 
            element2.getModifiers(), 
            type1, 
            name, 
            new String[] { getDataFor(element1, type1), name });
        } else if (!classBound.equals(classBound)) {
          addDelta(
            10, 
            2, 
            6, 
            currentDescriptorRestrictions, 
            element1.getModifiers(), 
            element2.getModifiers(), 
            type1, 
            name, 
            new String[] { getDataFor(element1, type1), name });
        }
        List interfaceBounds1 = interfaceBounds;
        List interfaceBounds2 = interfaceBounds;
        if (interfaceBounds1 == null)
        {
          if (interfaceBounds2 != null) {
            for (Iterator iterator = interfaceBounds2.iterator(); iterator.hasNext();) {
              addDelta(
                10, 
                1, 
                23, 
                currentDescriptorRestrictions, 
                element1.getModifiers(), 
                element2.getModifiers(), 
                type1, 
                name, 
                new String[] { getDataFor(element1, type1), name, (String)iterator.next() });
            }
          }
        }
        else if (interfaceBounds2 == null)
        {
          for (Iterator iterator = interfaceBounds1.iterator(); iterator.hasNext();) {
            addDelta(
              10, 
              3, 
              23, 
              currentDescriptorRestrictions, 
              element1.getModifiers(), 
              element2.getModifiers(), 
              type1, 
              name, 
              new String[] { getDataFor(element1, type1), name, (String)iterator.next() });
          }
        }
        else
        {
          int size1 = interfaceBounds1.size();
          int size2 = interfaceBounds2.size();
          int boundsMin = size1;
          int boundsMax = size2;
          if (size1 > size2)
          {
            boundsMin = size2;
            boundsMax = size1;
          }
          for (int index = 0; index < boundsMin; index++)
          {
            String currentInterfaceBound = (String)interfaceBounds1.get(index);
            if (!currentInterfaceBound.equals(interfaceBounds2.get(index))) {
              addDelta(
                10, 
                2, 
                23, 
                currentDescriptorRestrictions, 
                element1.getModifiers(), 
                element2.getModifiers(), 
                type1, 
                name, 
                new String[] { getDataFor(element1, type1), name, currentInterfaceBound });
            }
          }
          if (boundsMin != boundsMax)
          {
            boolean added = boundsMax == size2;
            for (; index < boundsMax; index++)
            {
              String currentInterfaceBound = added ? (String)interfaceBounds2.get(index) : (String)interfaceBounds1.get(index);
              addDelta(
                10, 
                added ? 1 : 3, 
                23, 
                currentDescriptorRestrictions, 
                element1.getModifiers(), 
                element2.getModifiers(), 
                type1, 
                element1.getName(), 
                new String[] { getDataFor(element1, type1), name, currentInterfaceBound });
            }
          }
        }
      }
      if (min != max)
      {
        boolean added = max == length2;
        for (; i < max; i++)
        {
          TypeParameterDescriptor currentTypeParameter = added ? typeParameterDescriptors2[i] : typeParameterDescriptors1[i];
          addDelta(
            getElementType(element1), 
            added ? 1 : 3, 
            49, 
            currentDescriptorRestrictions, 
            element1.getModifiers(), 
            element2.getModifiers(), 
            type1, 
            element1.getName(), 
            new String[] { getDataFor(element1, type1), name });
        }
      }
      if ((length2 > 0) || (length > 0)) {
        return;
      }
      String[] typeArguments = signatureDescriptor.getTypeArguments();
      String[] typeArguments2 = signatureDescriptor2.getTypeArguments();
      length = typeArguments.length;
      length2 = typeArguments2.length;
      min = length;
      max = length2;
      if (length > length2)
      {
        min = length2;
        max = length;
      }
      for (i = 0; i < min; i++)
      {
        String currentTypeArgument = typeArguments[i];
        String newTypeArgument = typeArguments2[i];
        if (!currentTypeArgument.equals(newTypeArgument)) {
          addDelta(
            getElementType(element1), 
            2, 
            68, 
            currentDescriptorRestrictions, 
            element1.getModifiers(), 
            element2.getModifiers(), 
            type1, 
            element1.getName(), 
            new String[] { getDataFor(element1, type1), currentTypeArgument, newTypeArgument });
        }
      }
      if (min != max)
      {
        boolean added = max == length2;
        for (; i < max; i++)
        {
          String currentTypeArgument = added ? typeArguments2[i] : typeArguments[i];
          addDelta(
            getElementType(element1), 
            added ? 1 : 3, 
            68, 
            currentDescriptorRestrictions, 
            element1.getModifiers(), 
            element2.getModifiers(), 
            type1, 
            element1.getName(), 
            new String[] { getDataFor(element1, type1), currentTypeArgument });
        }
      }
    }
  }
  
  private void collectAllInterfaces(IApiType type, Set set)
  {
    try
    {
      IApiType[] interfaces = type.getSuperInterfaces();
      if (interfaces != null) {
        for (int i = 0; i < interfaces.length; i++)
        {
          IApiType anInterface = interfaces[i];
          int visibility = 2;
          IApiComponent ifaceComponent = anInterface.getApiComponent();
          IApiDescription apiDescription = ifaceComponent.getApiDescription();
          IApiAnnotations elementDescription = apiDescription.resolveAnnotations(anInterface.getHandle());
          if (elementDescription != null) {
            visibility = elementDescription.getVisibility();
          }
          if ((visibility & visibilityModifiers) != 0) {
            set.add(anInterface);
          }
          collectAllInterfaces(anInterface, set);
        }
      }
      String superclassName = type.getSuperclassName();
      if ((superclassName != null) && (!Util.isJavaLangObject(superclassName)))
      {
        IApiType superclass = type.getSuperclass();
        collectAllInterfaces(superclass, set);
      }
    }
    catch (CoreException e)
    {
      reportStatus(e);
    }
  }
  
  private String getDataFor(IApiMember member, IApiType type)
  {
    switch (member.getType())
    {
    case 2: 
      if (((IApiType)member).isMemberType()) {
        return member.getName().replace('$', '.');
      }
      return member.getName();
    case 6: 
      StringBuffer buffer = new StringBuffer();
      buffer.append(type.getName()).append('.').append(getMethodDisplayName((IApiMethod)member, type));
      return String.valueOf(buffer);
    case 5: 
      StringBuffer buffer = new StringBuffer();
      buffer.append(type.getName()).append('.').append(member.getName());
      return String.valueOf(buffer);
    }
    return null;
  }
  
  private Delta createDelta()
  {
    return new Delta();
  }
  
  public IDelta getDelta(IProgressMonitor monitor)
  {
    SubMonitor localmonitor = SubMonitor.convert(monitor, 10);
    try
    {
      delta = createDelta();
      
      int typeAccess = type1.getModifiers();
      int typeAccess2 = type2.getModifiers();
      IApiDescription component2ApiDescription = component2.getApiDescription();
      IApiAnnotations elementDescription2 = component2ApiDescription.resolveAnnotations(type2.getHandle());
      initialDescriptorRestrictions = 0;
      currentDescriptorRestrictions = 0;
      if (elementDescription2 != null)
      {
        int restrictions2 = elementDescription2.getRestrictions();
        IApiDescription apiDescription = component.getApiDescription();
        if (component.hasApiDescription())
        {
          int restrictions = 0;
          IApiAnnotations componentApiDescription = apiDescription.resolveAnnotations(type1.getHandle());
          if (componentApiDescription != null)
          {
            restrictions = componentApiDescription.getRestrictions();
            initialDescriptorRestrictions = restrictions;
          }
          if (restrictions2 != restrictions) {
            if (type1.isInterface())
            {
              if (((RestrictionModifiers.isImplementRestriction(restrictions2)) && (!RestrictionModifiers.isImplementRestriction(restrictions))) || (
                (RestrictionModifiers.isExtendRestriction(restrictions2)) && (!RestrictionModifiers.isExtendRestriction(restrictions)))) {
                addDelta(
                  getElementType(type1), 
                  1, 
                  37, 
                  restrictions2, 
                  typeAccess, 
                  typeAccess2, 
                  type2, 
                  type2.getName(), 
                  Util.getDescriptorName(type1));
              }
            }
            else
            {
              boolean reportChangedRestrictions = false;
              if ((!Flags.isFinal(typeAccess2)) && (!Flags.isFinal(typeAccess)) && 
                (RestrictionModifiers.isExtendRestriction(restrictions2)) && 
                (!RestrictionModifiers.isExtendRestriction(restrictions)))
              {
                reportChangedRestrictions = true;
                addDelta(
                  getElementType(type1), 
                  1, 
                  37, 
                  restrictions2, 
                  typeAccess, 
                  typeAccess2, 
                  type2, 
                  type2.getName(), 
                  Util.getDescriptorName(type1));
              }
              if ((!reportChangedRestrictions) && 
                (!Flags.isAbstract(typeAccess2)) && 
                (!Flags.isAbstract(typeAccess)) && 
                (RestrictionModifiers.isInstantiateRestriction(restrictions2)) && 
                (!RestrictionModifiers.isInstantiateRestriction(restrictions))) {
                addDelta(
                  getElementType(type1), 
                  1, 
                  37, 
                  restrictions2, 
                  typeAccess, 
                  typeAccess2, 
                  type2, 
                  type2.getName(), 
                  Util.getDescriptorName(type1));
              }
            }
          }
        }
        currentDescriptorRestrictions = restrictions2;
      }
      if (Flags.isFinal(typeAccess2)) {
        currentDescriptorRestrictions |= 0x2;
      }
      if (Flags.isFinal(typeAccess)) {
        initialDescriptorRestrictions |= 0x2;
      }
      if (Flags.isDeprecated(typeAccess))
      {
        if (!Flags.isDeprecated(typeAccess2)) {
          addDelta(
            getElementType(type1), 
            3, 
            72, 
            currentDescriptorRestrictions, 
            typeAccess, 
            typeAccess2, 
            type1, 
            type1.getName(), 
            Util.getDescriptorName(type1));
        }
      }
      else if (Flags.isDeprecated(typeAccess2)) {
        addDelta(
          getElementType(type1), 
          1, 
          72, 
          currentDescriptorRestrictions, 
          typeAccess, 
          typeAccess2, 
          type1, 
          type1.getName(), 
          Util.getDescriptorName(type1));
      }
      Delta localDelta;
      if (Flags.isProtected(typeAccess))
      {
        if ((Flags.isPrivate(typeAccess2)) || (Util.isDefault(typeAccess2)))
        {
          addDelta(
            getElementType(type1), 
            2, 
            11, 
            currentDescriptorRestrictions, 
            typeAccess, 
            typeAccess2, 
            type1, 
            type1.getName(), 
            Util.getDescriptorName(type1));
          return delta;
        }
        if (Flags.isPublic(typeAccess2))
        {
          addDelta(
            getElementType(type1), 
            2, 
            22, 
            currentDescriptorRestrictions, 
            typeAccess, 
            typeAccess2, 
            type1, 
            type1.getName(), 
            Util.getDescriptorName(type1));
          return delta;
        }
      }
      else
      {
        if ((Flags.isPublic(typeAccess)) && (
          (Flags.isProtected(typeAccess2)) || 
          (Flags.isPrivate(typeAccess2)) || 
          (Util.isDefault(typeAccess2))))
        {
          addDelta(
            getElementType(type1), 
            2, 
            11, 
            currentDescriptorRestrictions, 
            typeAccess, 
            typeAccess2, 
            type1, 
            type1.getName(), 
            Util.getDescriptorName(type1));
          return delta;
        }
        if ((Util.isDefault(typeAccess)) && (
          (Flags.isPublic(typeAccess2)) || 
          (Flags.isProtected(typeAccess2))))
        {
          addDelta(
            getElementType(type1), 
            2, 
            22, 
            currentDescriptorRestrictions, 
            typeAccess, 
            typeAccess2, 
            type1, 
            type1.getName(), 
            Util.getDescriptorName(type1));
          return delta;
        }
        if ((Flags.isPrivate(typeAccess)) && (
          (Util.isDefault(typeAccess2)) || 
          (Flags.isPublic(typeAccess2)) || 
          (Flags.isProtected(typeAccess2))))
        {
          addDelta(
            getElementType(type1), 
            2, 
            22, 
            currentDescriptorRestrictions, 
            typeAccess, 
            typeAccess2, 
            type1, 
            type1.getName(), 
            Util.getDescriptorName(type1));
          return delta;
        }
      }
      if (Flags.isAnnotation(typeAccess))
      {
        if (!Flags.isAnnotation(typeAccess2))
        {
          if (Flags.isInterface(typeAccess2)) {
            addDelta(
              1, 
              2, 
              41, 
              currentDescriptorRestrictions, 
              typeAccess, 
              typeAccess2, 
              type1, 
              type1.getName(), 
              new String[] {
              Util.getDescriptorName(type1), 
              Integer.toString(1), 
              Integer.toString(8) });
          } else if (Flags.isEnum(typeAccess2)) {
            addDelta(
              1, 
              2, 
              41, 
              currentDescriptorRestrictions, 
              typeAccess, 
              typeAccess2, 
              type1, 
              type1.getName(), 
              new String[] {
              Util.getDescriptorName(type1), 
              Integer.toString(1), 
              Integer.toString(6) });
          } else {
            addDelta(
              1, 
              2, 
              41, 
              currentDescriptorRestrictions, 
              typeAccess, 
              typeAccess2, 
              type1, 
              type1.getName(), 
              new String[] {
              Util.getDescriptorName(type1), 
              Integer.toString(1), 
              Integer.toString(4) });
          }
          return delta;
        }
      }
      else if (Flags.isInterface(typeAccess))
      {
        if (Flags.isAnnotation(typeAccess2))
        {
          addDelta(
            8, 
            2, 
            41, 
            currentDescriptorRestrictions, 
            typeAccess, 
            typeAccess2, 
            type1, 
            type1.getName(), 
            new String[] {
            Util.getDescriptorName(type1), 
            Integer.toString(8), 
            Integer.toString(1) });
          
          return delta;
        }
        if (!Flags.isInterface(typeAccess2))
        {
          if (Flags.isEnum(typeAccess2)) {
            addDelta(
              8, 
              2, 
              41, 
              currentDescriptorRestrictions, 
              typeAccess, 
              typeAccess2, 
              type1, 
              type1.getName(), 
              new String[] {
              Util.getDescriptorName(type1), 
              Integer.toString(8), 
              Integer.toString(6) });
          } else {
            addDelta(
              8, 
              2, 
              41, 
              currentDescriptorRestrictions, 
              typeAccess, 
              typeAccess2, 
              type1, 
              type1.getName(), 
              new String[] {
              Util.getDescriptorName(type1), 
              Integer.toString(8), 
              Integer.toString(4) });
          }
          return delta;
        }
      }
      else if (Flags.isEnum(typeAccess))
      {
        if (!Flags.isEnum(typeAccess2))
        {
          if (Flags.isAnnotation(typeAccess2)) {
            addDelta(
              6, 
              2, 
              41, 
              currentDescriptorRestrictions, 
              typeAccess, 
              typeAccess2, 
              type1, 
              type1.getName(), 
              new String[] {
              Util.getDescriptorName(type1), 
              Integer.toString(6), 
              Integer.toString(1) });
          } else if (Flags.isInterface(typeAccess2)) {
            addDelta(
              6, 
              2, 
              41, 
              currentDescriptorRestrictions, 
              typeAccess, 
              typeAccess2, 
              type1, 
              type1.getName(), 
              new String[] {
              Util.getDescriptorName(type1), 
              Integer.toString(6), 
              Integer.toString(8) });
          } else {
            addDelta(
              6, 
              2, 
              41, 
              currentDescriptorRestrictions, 
              typeAccess, 
              typeAccess2, 
              type1, 
              type1.getName(), 
              new String[] {
              Util.getDescriptorName(type1), 
              Integer.toString(6), 
              Integer.toString(4) });
          }
          return delta;
        }
      }
      else if (!Util.isClass(typeAccess2))
      {
        if (Flags.isAnnotation(typeAccess2)) {
          addDelta(
            4, 
            2, 
            41, 
            currentDescriptorRestrictions, 
            typeAccess, 
            typeAccess2, 
            type1, 
            type1.getName(), 
            new String[] {
            Util.getDescriptorName(type1), 
            Integer.toString(4), 
            Integer.toString(1) });
        } else if (Flags.isInterface(typeAccess2)) {
          addDelta(
            4, 
            2, 
            41, 
            currentDescriptorRestrictions, 
            typeAccess, 
            typeAccess2, 
            type1, 
            type1.getName(), 
            new String[] {
            Util.getDescriptorName(type1), 
            Integer.toString(4), 
            Integer.toString(8) });
        } else {
          addDelta(
            4, 
            2, 
            41, 
            currentDescriptorRestrictions, 
            typeAccess, 
            typeAccess2, 
            type1, 
            type1.getName(), 
            new String[] {
            Util.getDescriptorName(type1), 
            Integer.toString(4), 
            Integer.toString(6) });
        }
        return delta;
      }
      if (Flags.isStatic(typeAccess))
      {
        if (!Flags.isStatic(typeAccess2)) {
          addDelta(
            getElementType(type1), 
            2, 
            38, 
            currentDescriptorRestrictions, 
            typeAccess, 
            typeAccess2, 
            type1, 
            type1.getName(), 
            Util.getDescriptorName(type1));
        }
      }
      else if (Flags.isStatic(typeAccess2)) {
        addDelta(
          getElementType(type1), 
          2, 
          33, 
          currentDescriptorRestrictions, 
          typeAccess, 
          typeAccess2, 
          type1, 
          type1.getName(), 
          Util.getDescriptorName(type1));
      }
      checkSuperclass();
      
      checkSuperInterfaces();
      
      IApiField[] fields1 = type1.getFields();
      IApiField[] fields2 = type2.getFields();
      Set addedFields = new HashSet(fields2.length);
      for (int i = 0; i < fields2.length; i++) {
        addedFields.add(fields2[i].getName());
      }
      for (int i = 0; i < fields1.length; i++)
      {
        addedFields.remove(fields1[i].getName());
        getDeltaForField(fields1[i]);
      }
      for (Iterator iterator = addedFields.iterator(); iterator.hasNext();)
      {
        IApiField field = type2.getField((String)iterator.next());
        reportFieldAddition(field, type2);
      }
      IApiMethod[] methods1 = type1.getMethods();
      IApiMethod[] methods2 = type2.getMethods();
      Set addedMethods = new HashSet(methods2.length);
      for (int i = 0; i < methods2.length; i++) {
        if (!methods2[i].isSynthetic()) {
          addedMethods.add(methods2[i].getHandle());
        }
      }
      for (int i = 0; i < methods1.length; i++)
      {
        addedMethods.remove(methods1[i].getHandle());
        getDeltaForMethod(methods1[i]);
      }
      for (Iterator iterator = addedMethods.iterator(); iterator.hasNext();)
      {
        IMethodDescriptor md = (IMethodDescriptor)iterator.next();
        IApiMethod method = type2.getMethod(md.getName(), md.getSignature());
        reportMethodAddition(method, type2);
      }
      if (Flags.isAbstract(typeAccess))
      {
        if (!Flags.isAbstract(typeAccess2)) {
          addDelta(
            getElementType(type1), 
            2, 
            1, 
            currentDescriptorRestrictions, 
            typeAccess, 
            typeAccess2, 
            type1, 
            type1.getName(), 
            Util.getDescriptorName(type1));
        }
      }
      else if (Flags.isAbstract(typeAccess2)) {
        if (!RestrictionModifiers.isInstantiateRestriction(initialDescriptorRestrictions)) {
          addDelta(
            getElementType(type1), 
            2, 
            30, 
            currentDescriptorRestrictions, 
            typeAccess, 
            typeAccess2, 
            type1, 
            type1.getName(), 
            Util.getDescriptorName(type1));
        }
      }
      if (Flags.isFinal(typeAccess))
      {
        if (!Flags.isFinal(typeAccess2)) {
          addDelta(
            getElementType(type1), 
            2, 
            18, 
            currentDescriptorRestrictions, 
            typeAccess, 
            typeAccess2, 
            type1, 
            type1.getName(), 
            Util.getDescriptorName(type1));
        }
      }
      else if (Flags.isFinal(typeAccess2)) {
        addDelta(
          getElementType(type1), 
          2, 
          31, 
          initialDescriptorRestrictions, 
          typeAccess, 
          typeAccess2, 
          type1, 
          type1.getName(), 
          Util.getDescriptorName(type1));
      }
      String signature1 = type1.getGenericSignature();
      String signature2 = type2.getGenericSignature();
      checkGenericSignature(signature1, signature2, type1, type2);
      
      checkTypeMembers();
      return delta.isEmpty() ? ApiComparator.NO_DELTA : delta;
    }
    catch (CoreException e)
    {
      reportStatus(e);
      return null;
    }
    finally
    {
      localmonitor.done();
    }
  }
  
  private void getDeltaForField(IApiField field)
  {
    int access = field.getModifiers();
    if (Flags.isSynthetic(access)) {
      return;
    }
    String name = field.getName();
    IApiField field2 = type2.getField(name);
    if (field2 == null)
    {
      if ((Flags.isPrivate(access)) || 
        (Util.isDefault(access)))
      {
        addDelta(
          getElementType(type1), 
          3, 
          16, 
          currentDescriptorRestrictions, 
          access, 
          0, 
          type1, 
          name, 
          new String[] { Util.getDescriptorName(type1), name });
      }
      else
      {
        boolean found = false;
        if (component2 != null) {
          if (type1.isInterface())
          {
            Set interfacesSet = getInterfacesSet(type2);
            if (interfacesSet != null) {
              for (Iterator iterator = interfacesSet.iterator(); iterator.hasNext();)
              {
                IApiType superTypeDescriptor = (IApiType)iterator.next();
                IApiField field3 = superTypeDescriptor.getField(name);
                if (field3 != null)
                {
                  addDelta(
                    getElementType(type1), 
                    3, 
                    17, 
                    currentDescriptorRestrictions, 
                    access, 
                    field3.getModifiers(), 
                    type1, 
                    name, 
                    new String[] { Util.getDescriptorName(type1), name });
                  found = true;
                  break;
                }
              }
            }
          }
          else
          {
            List superclassList = getSuperclassList(type2);
            if ((superclassList != null) && (isStatusOk())) {
              for (Iterator iterator = superclassList.iterator(); iterator.hasNext();)
              {
                IApiType superTypeDescriptor = (IApiType)iterator.next();
                IApiField field3 = superTypeDescriptor.getField(name);
                if (field3 != null)
                {
                  int access3 = field3.getModifiers();
                  if ((Flags.isPublic(access3)) || 
                    (Flags.isProtected(access3)))
                  {
                    addDelta(
                      getElementType(type1), 
                      3, 
                      17, 
                      currentDescriptorRestrictions, 
                      access, 
                      field3.getModifiers(), 
                      type1, 
                      name, 
                      new String[] { Util.getDescriptorName(type1), name });
                    found = true;
                    break;
                  }
                }
              }
            }
          }
        }
        if (!found)
        {
          if ((visibilityModifiers == 1) && (component.hasApiDescription()))
          {
            IApiDescription apiDescription = null;
            try
            {
              apiDescription = component.getApiDescription();
            }
            catch (CoreException e)
            {
              reportStatus(e);
            }
            if (apiDescription != null)
            {
              IApiAnnotations apiAnnotations = apiDescription.resolveAnnotations(field.getHandle());
              if (apiAnnotations != null)
              {
                int restrictions = apiAnnotations.getRestrictions();
                if (RestrictionModifiers.isReferenceRestriction(restrictions)) {
                  return;
                }
              }
            }
          }
          if (field.isEnumConstant())
          {
            addDelta(
              getElementType(type1), 
              3, 
              12, 
              currentDescriptorRestrictions, 
              type1.getModifiers(), 
              type2.getModifiers(), 
              type1, 
              name, 
              new String[] { Util.getDescriptorName(type1), name });
            return;
          }
          addDelta(
            getElementType(type1), 
            3, 
            16, 
            currentDescriptorRestrictions, 
            access, 
            0, 
            type1, 
            name, 
            new String[] { Util.getDescriptorName(type1), name });
        }
      }
      return;
    }
    int restrictions = 0;
    int referenceRestrictions = 0;
    int access2 = field2.getModifiers();
    if (component2.hasApiDescription()) {
      try
      {
        IApiDescription apiDescription = component2.getApiDescription();
        IApiAnnotations resolvedAPIDescription = apiDescription.resolveAnnotations(field2.getHandle());
        if (resolvedAPIDescription != null) {
          restrictions = resolvedAPIDescription.getRestrictions();
        }
      }
      catch (CoreException localCoreException1) {}
    }
    if ((visibilityModifiers == 1) && (component.hasApiDescription()))
    {
      IApiDescription apiDescription = null;
      try
      {
        apiDescription = component.getApiDescription();
      }
      catch (CoreException e)
      {
        reportStatus(e);
      }
      if (apiDescription != null)
      {
        IApiAnnotations apiAnnotations = apiDescription.resolveAnnotations(field.getHandle());
        if (apiAnnotations != null) {
          referenceRestrictions = apiAnnotations.getRestrictions();
        }
      }
      if (RestrictionModifiers.isReferenceRestriction(referenceRestrictions))
      {
        if (!RestrictionModifiers.isReferenceRestriction(restrictions)) {
          if (field2.isEnumConstant()) {
            addDelta(
              getElementType(type2), 
              1, 
              12, 
              currentDescriptorRestrictions, 
              access, 
              access2, 
              type1, 
              name, 
              new String[] { Util.getDescriptorName(type2), name });
          } else {
            addDelta(
              getElementType(type2), 
              1, 
              16, 
              currentDescriptorRestrictions, 
              access, 
              access2, 
              type1, 
              name, 
              new String[] { Util.getDescriptorName(type2), name });
          }
        }
      }
      else if (RestrictionModifiers.isReferenceRestriction(restrictions))
      {
        if (((Flags.isPublic(access2)) || (Flags.isProtected(access2))) && ((Flags.isPublic(access)) || (Flags.isProtected(access))) && 
          (visibilityModifiers == 1)) {
          addDelta(
            getElementType(type2), 
            3, 
            field2.isEnumConstant() ? 64 : 61, 
            restrictions, 
            access, 
            access2, 
            type1, 
            name, 
            new String[] { Util.getDescriptorName(type2), name });
        }
        return;
      }
    }
    restrictions |= currentDescriptorRestrictions;
    if (!field.getSignature().equals(field2.getSignature()))
    {
      addDelta(
        7, 
        2, 
        46, 
        restrictions, 
        access, 
        access2, 
        type1, 
        name, 
        new String[] { Util.getDescriptorName(type1), name });
    }
    else
    {
      String signature1 = field.getGenericSignature();
      String signature2 = field2.getGenericSignature();
      checkGenericSignature(signature1, signature2, field, field2);
    }
    boolean changeFinalToNonFinal = false;
    if (Flags.isProtected(access))
    {
      if ((Flags.isPrivate(access2)) || (Util.isDefault(access2))) {
        addDelta(
          7, 
          2, 
          11, 
          restrictions, 
          access, 
          access2, 
          type1, 
          name, 
          new String[] { Util.getDescriptorName(type1), name });
      } else if (Flags.isPublic(access2)) {
        addDelta(
          7, 
          2, 
          22, 
          restrictions, 
          access, 
          access2, 
          type1, 
          name, 
          new String[] { Util.getDescriptorName(type1), name });
      }
    }
    else if ((Flags.isPublic(access)) && (
      (Flags.isProtected(access2)) || 
      (Flags.isPrivate(access2)) || 
      (Util.isDefault(access2)))) {
      addDelta(
        7, 
        2, 
        11, 
        restrictions, 
        access, 
        access2, 
        type1, 
        name, 
        new String[] { Util.getDescriptorName(type1), name });
    } else if ((Flags.isPrivate(access)) && (
      (Flags.isProtected(access2)) || 
      (Util.isDefault(access2)) || 
      (Flags.isPublic(access2)))) {
      addDelta(
        7, 
        2, 
        22, 
        restrictions, 
        access, 
        access2, 
        type1, 
        name, 
        new String[] { Util.getDescriptorName(type1), name });
    } else if ((Util.isDefault(access)) && (
      (Flags.isProtected(access2)) || 
      (Flags.isPublic(access2)))) {
      addDelta(
        7, 
        2, 
        22, 
        restrictions, 
        access, 
        access2, 
        type1, 
        name, 
        new String[] { Util.getDescriptorName(type1), name });
    }
    if (Flags.isFinal(access))
    {
      if (!Flags.isFinal(access2)) {
        if (!Flags.isStatic(access2))
        {
          addDelta(
            7, 
            2, 
            19, 
  
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd