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

source line #185	-> byte code offset #355
    //   Java source line #186	-> byte code offset #368
    //   Java source line #147	-> byte code offset #375
    //   Java source line #190	-> byte code offset #385
    //   Java source line #191	-> byte code offset #391
    //   Java source line #192	-> byte code offset #402
    //   Java source line #193	-> byte code offset #407
    //   Java source line #194	-> byte code offset #414
    //   Java source line #195	-> byte code offset #424
    //   Java source line #196	-> byte code offset #433
    //   Java source line #198	-> byte code offset #445
    //   Java source line #199	-> byte code offset #447
    //   Java source line #200	-> byte code offset #451
    //   Java source line #201	-> byte code offset #452
    //   Java source line #202	-> byte code offset #453
    //   Java source line #203	-> byte code offset #454
    //   Java source line #204	-> byte code offset #455
    //   Java source line #205	-> byte code offset #456
    //   Java source line #206	-> byte code offset #458
    //   Java source line #199	-> byte code offset #460
    //   Java source line #198	-> byte code offset #463
    //   Java source line #191	-> byte code offset #466
    //   Java source line #210	-> byte code offset #476
    //   Java source line #213	-> byte code offset #494
    //   Java source line #210	-> byte code offset #499
    //   Java source line #212	-> byte code offset #502
    //   Java source line #213	-> byte code offset #504
    //   Java source line #214	-> byte code offset #509
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	512	0	referenceBaseline	IApiBaseline
    //   0	512	1	baseline	IApiBaseline
    //   0	512	2	visibilityModifiers	int
    //   0	512	3	force	boolean
    //   0	512	4	monitor	IProgressMonitor
    //   6	499	5	localmonitor	SubMonitor
    //   32	45	6	apiComponents	IApiComponent[]
    //   40	368	7	apiComponents2	IApiComponent[]
    //   49	385	8	apiComponentsIds	Set
    //   58	433	9	globalDelta	Delta
    //   61	318	10	i	int
    //   392	78	10	i	int
    //   66	315	11	max	int
    //   397	75	11	max	int
    //   81	133	12	apiComponent	IApiComponent
    //   412	13	12	apiComponent	IApiComponent
    //   100	216	13	id	String
    //   431	28	13	id	String
    //   110	106	14	apiComponent2	IApiComponent
    //   113	258	15	delta	IDelta
    //   158	168	16	versionString	String
    //   167	30	17	versionString2	String
    //   180	10	18	bundleVersionChangesDelta	IDelta
    //   211	128	19	time	long
    //   234	61	21	localObject1	Object
    //   502	8	22	localObject2	Object
    //   492	8	23	localDelta1	Delta
    // Exception table:
    //   from	to	target	type
    //   213	234	234	finally
    //   8	494	502	finally
  }
  
  /* Error */
  public static IDelta compare(IApiComponent component, IApiBaseline referenceBaseline, int visibilityModifiers, boolean force, IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload 4
    //   2: iconst_2
    //   3: invokestatic 422	org/eclipse/core/runtime/SubMonitor:convert	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/SubMonitor;
    //   6: astore 5
    //   8: aload_0
    //   9: ifnonnull +13 -> 22
    //   12: new 210	java/lang/IllegalArgumentException
    //   15: dup
    //   16: ldc 6
    //   18: invokespecial 410	java/lang/IllegalArgumentException:<init>	(Ljava/lang/String;)V
    //   21: athrow
    //   22: aload_1
    //   23: ifnonnull +13 -> 36
    //   26: new 210	java/lang/IllegalArgumentException
    //   29: dup
    //   30: ldc 7
    //   32: invokespecial 410	java/lang/IllegalArgumentException:<init>	(Ljava/lang/String;)V
    //   35: athrow
    //   36: aload 5
    //   38: iconst_1
    //   39: invokestatic 450	org/eclipse/pde/api/tools/internal/util/Util:updateMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   42: aconst_null
    //   43: astore 6
    //   45: aload_0
    //   46: invokeinterface 473 1 0
    //   51: ifne +247 -> 298
    //   54: aload_0
    //   55: invokeinterface 474 1 0
    //   60: astore 7
    //   62: aload_1
    //   63: aload 7
    //   65: invokeinterface 472 2 0
    //   70: astore 8
    //   72: aload 8
    //   74: ifnonnull +24 -> 98
    //   77: new 222	org/eclipse/pde/api/tools/internal/comparator/Delta
    //   80: dup
    //   81: aconst_null
    //   82: iconst_3
    //   83: iconst_1
    //   84: iconst_3
    //   85: aconst_null
    //   86: aload 7
    //   88: aload 7
    //   90: invokespecial 434	org/eclipse/pde/api/tools/internal/comparator/Delta:<init>	(Ljava/lang/String;IIILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    //   93: astore 6
    //   95: goto +178 -> 273
    //   98: aload_0
    //   99: invokeinterface 475 1 0
    //   104: aload 8
    //   106: invokeinterface 475 1 0
    //   111: invokevirtual 412	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   114: ifeq +7 -> 121
    //   117: iload_3
    //   118: ifeq +155 -> 273
    //   121: invokestatic 417	java/lang/System:currentTimeMillis	()J
    //   124: lstore 9
    //   126: aload 8
    //   128: aload_0
    //   129: iload_2
    //   130: aload 5
    //   132: iconst_1
    //   133: invokevirtual 420	org/eclipse/core/runtime/SubMonitor:newChild	(I)Lorg/eclipse/core/runtime/SubMonitor;
    //   136: invokestatic 437	org/eclipse/pde/api/tools/internal/provisional/comparator/ApiComparator:compare	(Lorg/eclipse/pde/api/tools/internal/provisional/model/IApiComponent;Lorg/eclipse/pde/api/tools/internal/provisional/model/IApiComponent;ILorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/pde/api/tools/internal/provisional/comparator/IDelta;
    //   139: astore 6
    //   141: goto +70 -> 211
    //   144: astore 11
    //   146: getstatic 406	org/eclipse/pde/api/tools/internal/provisional/comparator/ApiComparator:DEBUG	Z
    //   149: ifeq +59 -> 208
    //   152: getstatic 405	java/lang/System:out	Ljava/io/PrintStream;
    //   155: new 213	java/lang/StringBuffer
    //   158: dup
    //   159: ldc 8
    //   161: invokespecial 414	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   164: aload 7
    //   166: invokevirtual 416	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   169: ldc 1
    //   171: invokevirtual 416	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   174: aload_0
    //   175: invokeinterface 475 1 0
    //   180: invokevirtual 416	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   183: ldc 2
    //   185: invokevirtual 416	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   188: invokestatic 417	java/lang/System:currentTimeMillis	()J
    //   191: lload 9
    //   193: lsub
    //   194: invokevirtual 415	java/lang/StringBuffer:append	(J)Ljava/lang/StringBuffer;
    //   197: ldc 9
    //   199: invokevirtual 416	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   202: invokevirtual 413	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   205: invokevirtual 409	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   208: aload 11
    //   210: athrow
    //   211: getstatic 406	org/eclipse/pde/api/tools/internal/provisional/comparator/ApiComparator:DEBUG	Z
    //   214: ifeq +59 -> 273
    //   217: getstatic 405	java/lang/System:out	Ljava/io/PrintStream;
    //   220: new 213	java/lang/StringBuffer
    //   223: dup
    //   224: ldc 8
    //   226: invokespecial 414	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   229: aload 7
    //   231: invokevirtual 416	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   234: ldc 1
    //   236: invokevirtual 416	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   239: aload_0
    //   240: invokeinterface 475 1 0
    //   245: invokevirtual 416	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   248: ldc 2
    //   250: invokevirtual 416	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   253: invokestatic 417	java/lang/System:currentTimeMillis	()J
    //   256: lload 9
    //   258: lsub
    //   259: invokevirtual 415	java/lang/StringBuffer:append	(J)Ljava/lang/StringBuffer;
    //   262: ldc 9
    //   264: invokevirtual 416	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   267: invokevirtual 413	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   270: invokevirtual 409	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   273: aload 6
    //   275: ifnull +23 -> 298
    //   278: aload 6
    //   280: getstatic 407	org/eclipse/pde/api/tools/internal/provisional/comparator/ApiComparator:NO_DELTA	Lorg/eclipse/pde/api/tools/internal/provisional/comparator/IDelta;
    //   283: if_acmpeq +15 -> 298
    //   286: aload 6
    //   288: astore 13
    //   290: aload 5
    //   292: invokevirtual 419	org/eclipse/core/runtime/SubMonitor:done	()V
    //   295: aload 13
    //   297: areturn
    //   298: getstatic 407	org/eclipse/pde/api/tools/internal/provisional/comparator/ApiComparator:NO_DELTA	Lorg/eclipse/pde/api/tools/internal/provisional/comparator/IDelta;
    //   301: astore 13
    //   303: aload 5
    //   305: invokevirtual 419	org/eclipse/core/runtime/SubMonitor:done	()V
    //   308: aload 13
    //   310: areturn
    //   311: astore 12
    //   313: aload 5
    //   315: invokevirtual 419	org/eclipse/core/runtime/SubMonitor:done	()V
    //   318: aload 12
    //   320: athrow
    // Line number table:
    //   Java source line #238	-> byte code offset #0
    //   Java source line #240	-> byte code offset #8
    //   Java source line #241	-> byte code offset #12
    //   Java source line #243	-> byte code offset #22
    //   Java source line #244	-> byte code offset #26
    //   Java source line #246	-> byte code offset #36
    //   Java source line #247	-> byte code offset #42
    //   Java source line #248	-> byte code offset #45
    //   Java source line #249	-> byte code offset #54
    //   Java source line #250	-> byte code offset #62
    //   Java source line #251	-> byte code offset #72
    //   Java source line #254	-> byte code offset #77
    //   Java source line #255	-> byte code offset #81
    //   Java source line #256	-> byte code offset #82
    //   Java source line #257	-> byte code offset #83
    //   Java source line #258	-> byte code offset #84
    //   Java source line #259	-> byte code offset #85
    //   Java source line #260	-> byte code offset #86
    //   Java source line #261	-> byte code offset #88
    //   Java source line #254	-> byte code offset #90
    //   Java source line #253	-> byte code offset #93
    //   Java source line #263	-> byte code offset #98
    //   Java source line #264	-> byte code offset #117
    //   Java source line #265	-> byte code offset #121
    //   Java source line #267	-> byte code offset #126
    //   Java source line #268	-> byte code offset #144
    //   Java source line #269	-> byte code offset #146
    //   Java source line #270	-> byte code offset #152
    //   Java source line #272	-> byte code offset #208
    //   Java source line #269	-> byte code offset #211
    //   Java source line #270	-> byte code offset #217
    //   Java source line #275	-> byte code offset #273
    //   Java source line #276	-> byte code offset #286
    //   Java source line #282	-> byte code offset #290
    //   Java source line #276	-> byte code offset #295
    //   Java source line #279	-> byte code offset #298
    //   Java source line #282	-> byte code offset #303
    //   Java source line #279	-> byte code offset #308
    //   Java source line #281	-> byte code offset #311
    //   Java source line #282	-> byte code offset #313
    //   Java source line #283	-> byte code offset #318
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	321	0	component	IApiComponent
    //   0	321	1	referenceBaseline	IApiBaseline
    //   0	321	2	visibilityModifiers	int
    //   0	321	3	force	boolean
    //   0	321	4	monitor	IProgressMonitor
    //   6	308	5	localmonitor	SubMonitor
    //   43	244	6	delta	IDelta
    //   60	170	7	id	String
    //   70	57	8	apiComponent2	IApiComponent
    //   124	133	9	time	long
    //   144	65	11	localObject1	Object
    //   311	8	12	localObject2	Object
    //   288	21	13	localIDelta1	IDelta
    // Exception table:
    //   from	to	target	type
    //   126	144	144	finally
    //   8	290	311	finally
    //   298	303	311	finally
  }
  
  public static IDelta compare(IApiComponent referenceComponent, IApiComponent component2, IApiBaseline referenceBaseline, IApiBaseline baseline, int visibilityModifiers, IProgressMonitor monitor)
  {
    SubMonitor localmonitor = SubMonitor.convert(monitor, 3);
    try
    {
      Object localObject2;
      if (referenceComponent == null)
      {
        if (component2 == null) {
          throw new IllegalArgumentException("Both components cannot be null");
        }
        return new Delta(
          null, 
          3, 
          1, 
          3, 
          null, 
          component2.getSymbolicName(), 
          Util.getComponentVersionsId(component2));
      }
      if (component2 == null)
      {
        String referenceComponentId = referenceComponent.getSymbolicName();
        return new Delta(
          null, 
          3, 
          3, 
          3, 
          null, 
          referenceComponentId, 
          Util.getComponentVersionsId(referenceComponent));
      }
      Util.updateMonitor(localmonitor, 1);
      if ((referenceBaseline == null) || (baseline == null)) {
        throw new IllegalArgumentException("The baselines cannot be null");
      }
      String referenceComponentId = referenceComponent.getSymbolicName();
      Delta globalDelta = new Delta();
      
      Set referenceEEs = Util.convertAsSet(referenceComponent.getExecutionEnvironments());
      Set componentsEEs = Util.convertAsSet(component2.getExecutionEnvironments());
      Util.updateMonitor(localmonitor, 1);
      for (Iterator iterator = referenceEEs.iterator(); iterator.hasNext();)
      {
        Util.updateMonitor(localmonitor);
        String currentEE = (String)iterator.next();
        if (!componentsEEs.remove(currentEE)) {
          globalDelta.add(
            new Delta(
            Util.getDeltaComponentVersionsId(referenceComponent), 
            2, 
            3, 
            13, 
            0, 
            0, 
            0, 
            0, 
            null, 
            referenceComponentId, 
            new String[] { currentEE, Util.getComponentVersionsId(referenceComponent) }));
        }
      }
      for (Iterator iterator = componentsEEs.iterator(); iterator.hasNext();)
      {
        Util.updateMonitor(localmonitor);
        String currentEE = (String)iterator.next();
        globalDelta.add(
          new Delta(
          Util.getDeltaComponentVersionsId(referenceComponent), 
          2, 
          1, 
          13, 
          0, 
          0, 
          0, 
          0, 
          null, 
          referenceComponentId, 
          new String[] { currentEE, Util.getComponentVersionsId(referenceComponent) }));
      }
      return internalCompare(referenceComponent, component2, referenceBaseline, baseline, visibilityModifiers, globalDelta, localmonitor.newChild(1));
    }
    catch (CoreException localCoreException)
    {
      return null;
    }
    finally
    {
      localmonitor.done();
    }
  }
  
  public static IDelta compare(IApiComponent referenceComponent, IApiComponent component, int visibilityModifiers, IProgressMonitor monitor)
  {
    try
    {
      return compare(referenceComponent, component, referenceComponent == null ? null : referenceComponent.getBaseline(), component.getBaseline(), visibilityModifiers, monitor);
    }
    catch (CoreException e)
    {
      ApiPlugin.log(e);
    }
    return null;
  }
  
  public static IDelta compare(IApiTypeRoot typeRoot2, IApiComponent component, IApiComponent component2, IApiComponent reexporter, IApiBaseline referenceBaseline, IApiBaseline baseline, int visibilityModifiers, IProgressMonitor monitor)
  {
    if (typeRoot2 == null) {
      throw new IllegalArgumentException("The given class file is null");
    }
    if ((component == null) || (component2 == null)) {
      throw new IllegalArgumentException("One of the given components is null");
    }
    if ((referenceBaseline == null) || (baseline == null)) {
      throw new IllegalArgumentException("One of the given baselines is null");
    }
    SubMonitor localmonitor = SubMonitor.convert(monitor, 6);
    try
    {
      IApiType typeDescriptor2 = typeRoot2.getStructure();
      Object localObject2;
      if ((typeDescriptor2.isMemberType()) || (typeDescriptor2.isAnonymous()) || (typeDescriptor2.isLocal())) {
        return NO_DELTA;
      }
      String typeName = typeRoot2.getTypeName();
      IApiTypeRoot typeRoot = null;
      String id = component.getSymbolicName();
      if ("org.eclipse.swt".equals(id)) {
        typeRoot = component.findTypeRoot(typeName);
      } else {
        typeRoot = component.findTypeRoot(typeName, id);
      }
      IApiDescription apiDescription2 = component2.getApiDescription();
      IApiAnnotations elementDescription2 = apiDescription2.resolveAnnotations(typeDescriptor2.getHandle());
      int visibility = 0;
      if (elementDescription2 != null) {
        visibility = elementDescription2.getVisibility();
      }
      Util.updateMonitor(localmonitor, 1);
      IApiDescription referenceApiDescription = component.getApiDescription();
      IApiAnnotations refElementDescription = referenceApiDescription.resolveAnnotations(typeDescriptor2.getHandle());
      int refVisibility = 0;
      if (refElementDescription != null) {
        refVisibility = refElementDescription.getVisibility();
      }
      Util.updateMonitor(localmonitor, 1);
      String deltaComponentID = Util.getDeltaComponentVersionsId(component2);
      if (typeRoot == null)
      {
        if (Util.isAPI(visibility, typeDescriptor2)) {
          return new Delta(
            deltaComponentID, 
            2, 
            1, 
            reexporter == null ? 46 : 70, 
            elementDescription2 != null ? elementDescription2.getRestrictions() : 0, 
            0, 
            0, 
            typeDescriptor2.getModifiers(), 
            typeName, 
            typeName, 
            new String[] { typeName, Util.getComponentVersionsId(component2) });
        }
        return NO_DELTA;
      }
      Util.updateMonitor(localmonitor, 1);
      IApiType typeDescriptor = typeRoot.getStructure();
      if ((visibility & visibilityModifiers) == 0)
      {
        if ((refVisibility & visibilityModifiers) == 0) {
          return NO_DELTA;
        }
        if (Util.isAPI(refVisibility, typeDescriptor)) {
          return new Delta(
            deltaComponentID, 
            2, 
            3, 
            56, 
            elementDescription2 != null ? elementDescription2.getRestrictions() : 0, 
            0, 
            typeDescriptor.getModifiers(), 
            typeDescriptor2.getModifiers(), 
            typeName, 
            typeName, 
            new String[] { typeName, Util.getComponentVersionsId(component2) });
        }
      }
      else if ((!Util.isAPI(refVisibility, typeDescriptor)) && 
        (Util.isAPI(visibility, typeDescriptor2)))
      {
        return new Delta(
          deltaComponentID, 
          2, 
          1, 
          46, 
          elementDescription2 != null ? elementDescription2.getRestrictions() : 0, 
          0, 
          typeDescriptor.getModifiers(), 
          typeDescriptor2.getModifiers(), 
          typeName, 
          typeName, 
          new String[] { typeName, Util.getComponentVersionsId(component2) });
      }
      Util.updateMonitor(localmonitor, 1);
      if (visibilityModifiers == 1) {
        if ((Util.isDefault(typeDescriptor2.getModifiers())) || 
          (Flags.isPrivate(typeDescriptor2.getModifiers())))
        {
          if ((Flags.isPublic(typeDescriptor.getModifiers())) || 
            (Flags.isProtected(typeDescriptor.getModifiers()))) {
            return new Delta(
              deltaComponentID, 
              2, 
              3, 
              56, 
              elementDescription2 != null ? elementDescription2.getRestrictions() : 0, 
              0, 
              typeDescriptor.getModifiers(), 
              typeDescriptor2.getModifiers(), 
              typeName, 
              typeName, 
              new String[] { typeName, Util.getComponentVersionsId(component2) });
          }
          return NO_DELTA;
        }
      }
      Util.updateMonitor(localmonitor, 1);
      ClassFileComparator comparator = new ClassFileComparator(typeDescriptor, typeRoot2, component, component2, referenceBaseline, baseline, visibilityModifiers);
      IDelta delta = comparator.getDelta(localmonitor.newChild(1));
      if (DEBUG)
      {
        IStatus status = comparator.getStatus();
        if (status != null) {
          ApiPlugin.log(status);
        }
      }
      return delta;
    }
    catch (CoreException localCoreException)
    {
      return null;
    }
    finally
    {
      localmonitor.done();
    }
  }
  
  public static IDelta compare(IApiTypeRoot typeRoot, IApiTypeRoot typeRoot2, IApiComponent component, IApiComponent component2, IApiBaseline referenceBaseline, IApiBaseline baseline, int visibilityModifiers, IProgressMonitor monitor)
  {
    if ((typeRoot == null) || (typeRoot2 == null)) {
      throw new IllegalArgumentException("One of the given class files is null");
    }
    if ((component == null) || (component2 == null)) {
      throw new IllegalArgumentException("One of the given components is null");
    }
    if ((referenceBaseline == null) || (baseline == null)) {
      throw new IllegalArgumentException("One of the given baselines is null");
    }
    IDelta delta = null;
    try
    {
      ClassFileComparator comparator = 
        new ClassFileComparator(
        typeRoot, 
        typeRoot2, 
        component, 
        component2, 
        referenceBaseline, 
        baseline, 
        visibilityModifiers);
      delta = comparator.getDelta(SubMonitor.convert(monitor));
      if (DEBUG)
      {
        IStatus status = comparator.getStatus();
        if (status != null) {
          ApiPlugin.log(status);
        }
      }
    }
    catch (CoreException e)
    {
      ApiPlugin.log(e);
    }
    return delta;
  }
  
  public static IDelta compare(IApiScope scope, IApiBaseline baseline, int visibilityModifiers, boolean force, IProgressMonitor monitor)
    throws CoreException
  {
    if ((scope == null) || (baseline == null)) {
      throw new IllegalArgumentException("None of the scope or the baseline must be null");
    }
    SubMonitor localmonitor = SubMonitor.convert(monitor, 2);
    try
    {
      Set deltas = new HashSet();
      CompareApiScopeVisitor visitor = new CompareApiScopeVisitor(deltas, baseline, force, visibilityModifiers, localmonitor.newChild(1));
      scope.accept(visitor);
      if (visitor.containsError()) {
        return null;
      }
      Object localObject2;
      if (deltas.isEmpty()) {
        return NO_DELTA;
      }
      Delta globalDelta = new Delta();
      for (Iterator iterator = deltas.iterator(); iterator.hasNext();)
      {
        IDelta delta = (IDelta)iterator.next();
        delta.accept(new DeltaVisitor()
        {
          public void endVisit(IDelta localDelta)
          {
            if (localDelta.getChildren().length == 0) {
              switch (localDelta.getElementType())
              {
              case 1: 
              case 2: 
              case 3: 
              case 4: 
              case 5: 
              case 6: 
              case 7: 
              case 8: 
              case 9: 
                add(localDelta);
              }
            }
          }
        });
      }
      Util.updateMonitor(localmonitor, 1);
      return globalDelta.isEmpty() ? NO_DELTA : globalDelta;
    }
    finally
    {
      localmonitor.done();
    }
  }
  
  static boolean filterType(int visibilityModifiers, IApiAnnotations elementDescription, IApiType typeDescriptor)
  {
    if ((elementDescription != null) && ((elementDescription.getVisibility() & visibilityModifiers) == 0)) {
      return true;
    }
    if (visibilityModifiers == 1) {
      if ((elementDescription == null) || 
        (Util.isDefault(typeDescriptor.getModifiers())) || 
        (Flags.isPrivate(typeDescriptor.getModifiers()))) {
        return true;
      }
    }
    return false;
  }
  
  private static IDelta internalCompare(IApiComponent component, IApiComponent component2, IApiBaseline referenceBaseline, IApiBaseline baseline, int visibilityModifiers, Delta globalDelta, IProgressMonitor monitor)
    throws CoreException
  {
    Set typeRootBaseLineNames = new HashSet();
    String id = component.getSymbolicName();
    IApiTypeContainer[] typeRootContainers = (IApiTypeContainer[])null;
    IApiTypeContainer[] typeRootContainers2 = (IApiTypeContainer[])null;
    SubMonitor localmonitor = SubMonitor.convert(monitor, 4);
    boolean isSWT = "org.eclipse.swt".equals(id);
    if (isSWT)
    {
      typeRootContainers = component.getApiTypeContainers();
      typeRootContainers2 = component2.getApiTypeContainers();
    }
    else
    {
      typeRootContainers = component.getApiTypeContainers(id);
      typeRootContainers2 = component2.getApiTypeContainers(id);
    }
    IApiDescription apiDescription = component.getApiDescription();
    IApiDescription apiDescription2 = component2.getApiDescription();
    Util.updateMonitor(localmonitor, 1);
    if (typeRootContainers != null)
    {
      int i = 0;
      for (int max = typeRootContainers.length; i < max; i++)
      {
        Util.updateMonitor(localmonitor);
        IApiTypeContainer container = typeRootContainers[i];
        try
        {
          container.accept(new ApiTypeContainerVisitor()
          {
            private final IApiDescription val$apiDescription;
            private final boolean val$isSWT;
            private final IApiComponent val$component2;
            private final String val$id;
            private final IApiDescription val$apiDescription2;
            private final int val$visibilityModifiers;
            private final Delta val$globalDelta;
            private final Set val$typeRootBaseLineNames;
            private final IApiComponent val$component;
            private final IApiBaseline val$referenceBaseline;
            private final IApiBaseline val$baseline;
            
            public void visit(String packageName, IApiTypeRoot typeRoot)
            {
              Util.updateMonitor(ApiComparator.this);
              String typeName = typeRoot.getTypeName();
              try
              {
                IApiType typeDescriptor = typeRoot.getStructure();
                IApiAnnotations elementDescription = val$apiDescription.resolveAnnotations(typeDescriptor.getHandle());
                if ((typeDescriptor.isMemberType()) || (typeDescriptor.isAnonymous()) || (typeDescriptor.isLocal())) {
                  return;
                }
                int visibility = 0;
                if (elementDescription != null) {
                  visibility = elementDescription.getVisibility();
                }
                IApiTypeRoot typeRoot2 = null;
                if (val$isSWT) {
                  typeRoot2 = val$component2.findTypeRoot(typeName);
                } else {
                  typeRoot2 = val$component2.findTypeRoot(typeName, val$id);
                }
                String deltaComponentID = null;
                IApiComponent provider = null;
                IApiDescription providerApiDesc = null;
                boolean reexported = false;
                if (typeRoot2 == null)
                {
                  IApiComponent[] providers = val$component2.getBaseline().resolvePackage(val$component2, packageName);
                  int index = 0;
                  do
                  {
                    Util.updateMonitor(ApiComparator.this);
                    IApiComponent p = providers[index];
                    if (!p.equals(val$component2))
                    {
                      String id2 = p.getSymbolicName();
                      if ("org.eclipse.swt".equals(id2)) {
                        typeRoot2 = p.findTypeRoot(typeName);
                      } else {
                        typeRoot2 = p.findTypeRoot(typeName, id2);
                      }
                      if (typeRoot2 != null)
                      {
                        provider = p;
                        providerApiDesc = p.getApiDescription();
                        IRequiredComponentDescription[] required = val$component2.getRequiredComponents();
                        for (int k = 0; k < required.length; k++)
                        {
                          IRequiredComponentDescription description = required[k];
                          if (description.getId().equals(id2))
                          {
                            reexported = description.isExported();
                            break;
                          }
                        }
                      }
                    }
                    index++;
                    if (typeRoot2 != null) {
                      break;
                    }
                  } while (index < providers.length);
                }
                else
                {
                  provider = val$component2;
                  providerApiDesc = val$apiDescription2;
                }
                Util.updateMonitor(ApiComparator.this);
                deltaComponentID = Util.getDeltaComponentVersionsId(val$component2);
                if (typeRoot2 == null)
                {
                  if ((visibility & val$visibilityModifiers) == 0) {
                    return;
                  }
                  if (val$visibilityModifiers == 1) {
                    if ((Util.isDefault(typeDescriptor.getModifiers())) || 
                      (Flags.isPrivate(typeDescriptor.getModifiers()))) {
                      return;
                    }
                  }
                  val$globalDelta.add(
                    new Delta(
                    deltaComponentID, 
                    2, 
                    3, 
                    46, 
                    0, 
                    0, 
                    typeDescriptor.getModifiers(), 
                    0, 
                    typeName, 
                    typeName, 
                    new String[] { typeName, Util.getComponentVersionsId(val$component2) }));
                }
                else
                {
                  if ((visibility & val$visibilityModifiers) == 0) {
                    return;
                  }
                  IApiType typeDescriptor2 = typeRoot2.getStructure();
                  IApiAnnotations elementDescription2 = providerApiDesc.resolveAnnotations(typeDescriptor2.getHandle());
                  int visibility2 = 0;
                  if (elementDescription2 != null) {
                    visibility2 = elementDescription2.getVisibility();
                  }
                  if (val$visibilityModifiers == 1) {
                    if ((Util.isDefault(typeDescriptor.getModifiers())) || 
                      (Flags.isPrivate(typeDescriptor.getModifiers()))) {
                      return;
                    }
                  }
                  if ((Util.isAPI(visibility, typeDescriptor)) && 
                    (!Util.isAPI(visibility2, typeDescriptor2)))
                  {
                    val$globalDelta.add(
                      new Delta(
                      deltaComponentID, 
                      2, 
                      3, 
                      reexported ? 71 : 56, 
                      elementDescription2 != null ? elementDescription2.getRestrictions() : 0, 
                      0, 
                      typeDescriptor.getModifiers(), 
                      typeDescriptor2.getModifiers(), 
                      typeName, 
                      typeName, 
                      new String[] { typeName, Util.getComponentVersionsId(val$component2) }));
                    return;
                  }
                  if ((visibility2 & val$visibilityModifiers) == 0) {
                    val$globalDelta.add(
                      new Delta(
                      deltaComponentID, 
                      2, 
                      2, 
                      52, 
                      elementDescription2 != null ? elementDescription2.getRestrictions() : 0, 
                      0, 
                      typeDescriptor.getModifiers(), 
                      typeDescriptor2.getModifiers(), 
                      typeName, 
                      typeName, 
                      new String[] { typeName, Util.getComponentVersionsId(val$component2) }));
                  }
                  val$typeRootBaseLineNames.add(typeName);
                  ClassFileComparator comparator = new ClassFileComparator(typeDescriptor, typeRoot2, val$component, provider, val$referenceBaseline, val$baseline, val$visibilityModifiers);
                  IDelta delta = comparator.getDelta(newChild(1));
                  if (ApiComparator.DEBUG)
                  {
                    IStatus status = comparator.getStatus();
                    if (status != null) {
                      ApiPlugin.log(status);
                    }
                  }
                  if ((delta != null) && (delta != ApiComparator.NO_DELTA)) {
                    val$globalDelta.add(delta);
                  }
                }
                Util.updateMonitor(ApiComparator.this);
              }
              catch (CoreException e)
              {
                ApiPlugin.log(e);
              }
            }
          });
        }
        catch (CoreException e)
        {
          ApiPlugin.log(e);
        }
      }
    }
    Util.updateMonitor(localmonitor, 1);
    IRequiredComponentDescription[] requiredComponents = component.getRequiredComponents();
    int length = requiredComponents.length;
    if (length != 0) {
      for (int j = 0; j < length; j++)
      {
        Util.updateMonitor(localmonitor);
        IRequiredComponentDescription description = requiredComponents[j];
        if (description.isExported())
        {
          String currentComponentID = Util.getDeltaComponentVersionsId(component);
          String descriptionID = description.getId();
          IApiComponent currentRequiredApiComponent = referenceBaseline.getApiComponent(descriptionID);
          if (currentRequiredApiComponent != null)
          {
            IApiDescription reexportedApiDescription = currentRequiredApiComponent.getApiDescription();
            IApiTypeContainer[] apiTypeContainers = currentRequiredApiComponent.getApiTypeContainers();
            if (apiTypeContainers != null)
            {
              int i = 0;
              for (int max = apiTypeContainers.length; i < max; i++)
              {
                Util.updateMonitor(localmonitor);
                IApiTypeContainer container = apiTypeContainers[i];
                try
                {
                  container.accept(new ApiTypeContainerVisitor()
                  {
                    private final IApiDescription val$reexportedApiDescription;
                    private final boolean val$isSWT;
                    private final IApiComponent val$component2;
                    private final String val$id;
                    private final IApiDescription val$apiDescription2;
                    private final int val$visibilityModifiers;
                    private final Delta val$globalDelta;
                    private final String val$currentComponentID;
                    private final IApiComponent val$component;
                    private final Set val$typeRootBaseLineNames;
                    
                    public void visit(String packageName, IApiTypeRoot typeRoot)
                    {
                      Util.updateMonitor(ApiComparator.this);
                      String typeName = typeRoot.getTypeName();
                      try
                      {
                        IApiType typeDescriptor = typeRoot.getStructure();
                        IApiAnnotations elementDescription = val$reexportedApiDescription.resolveAnnotations(typeDescriptor.getHandle());
                        if ((typeDescriptor.isMemberType()) || (typeDescriptor.isAnonymous()) || (typeDescriptor.isLocal())) {
                          return;
                        }
                        int visibility = 0;
                        if (elementDescription != null) {
                          visibility = elementDescription.getVisibility();
                        }
                        IApiTypeRoot typeRoot2 = null;
                        if (val$isSWT) {
                          typeRoot2 = val$component2.findTypeRoot(typeName);
                        } else {
                          typeRoot2 = val$component2.findTypeRoot(typeName, val$id);
                        }
                        IApiDescription providerApiDesc = null;
                        if (typeRoot2 == null)
                        {
                          IApiComponent[] providers = val$component2.getBaseline().resolvePackage(val$component2, packageName);
                          int index = 0;
                          do
                          {
                            IApiComponent p = providers[index];
                            if (!p.equals(val$component2))
                            {
                              String id2 = p.getSymbolicName();
                              if ("org.eclipse.swt".equals(id2)) {
                                typeRoot2 = p.findTypeRoot(typeName);
                              } else {
                                typeRoot2 = p.findTypeRoot(typeName, id2);
                              }
                              if (typeRoot2 != null) {
                                providerApiDesc = p.getApiDescription();
                              }
                            }
                            index++;
                            if (typeRoot2 != null) {
                              break;
                            }
                          } while (index < providers.length);
                        }
                        else
                        {
                          providerApiDesc = val$apiDescription2;
                        }
                        if (typeRoot2 == null)
                        {
                          if ((visibility & val$visibilityModifiers) == 0) {
                            return;
                          }
                          if (val$visibilityModifiers == 1) {
                            if ((Util.isDefault(typeDescriptor.getModifiers())) || 
                              (Flags.isPrivate(typeDescriptor.getModifiers()))) {
                              return;
                            }
                          }
                          val$globalDelta.add(
                            new Delta(
                            val$currentComponentID, 
                            2, 
                            3, 
                            70, 
                            0, 
                            0, 
                            typeDescriptor.getModifiers(), 
                            0, 
                            typeName, 
                            typeName, 
                            new String[] { typeName, Util.getComponentVersionsId(val$component) }));
                   
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