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

ckageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.pde.api.tools.internal.builder.BuildStamps;
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin;
import org.eclipse.pde.api.tools.internal.provisional.RestrictionModifiers;
import org.eclipse.pde.api.tools.internal.provisional.VisibilityModifiers;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IElementDescriptor;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IPackageDescriptor;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IReferenceTypeDescriptor;
import org.eclipse.pde.api.tools.internal.provisional.scanner.TagScanner;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

class ProjectApiDescription$TypeNode
  extends ApiDescription.ManifestNode
{
  long fTimeStamp;
  long fBuildStamp;
  private boolean fRefreshing;
  IType fType;
  final ProjectApiDescription this$0;
  
  public ProjectApiDescription$TypeNode(ProjectApiDescription paramProjectApiDescription, IType type, ApiDescription.ManifestNode parent, IElementDescriptor element, int visibility, int restrictions)
  {
    super(paramProjectApiDescription, parent, element, visibility, restrictions);this$0 = paramProjectApiDescription;fTimeStamp = -1L;fBuildStamp = -1L;fRefreshing = false;
    fType = type;
    if ((parent instanceof TypeNode))
    {
      fTimeStamp = fTimeStamp;
      fBuildStamp = fBuildStamp;
    }
  }
  
  protected synchronized ApiDescription.ManifestNode refresh()
  {
    if (fRefreshing)
    {
      if (ProjectApiDescription.DEBUG)
      {
        StringBuffer buffer = new StringBuffer();
        buffer.append("Refreshing manifest node: ");
        buffer.append(this);
        buffer.append(" aborted because a refresh is already in progress");
        System.out.println(buffer.toString());
      }
      return this;
    }
    try
    {
      fRefreshing = true;
      int parentVis = this$0.resolveVisibility(parent);
      if (VisibilityModifiers.isAPI(parentVis))
      {
        ICompilationUnit unit = fType.getCompilationUnit();
        if (unit != null)
        {
          IResource resource = null;
          try
          {
            resource = unit.getUnderlyingResource();
          }
          catch (JavaModelException e)
          {
            if (ProjectApiDescription.DEBUG)
            {
              StringBuffer buffer = new StringBuffer();
              buffer.append("Failed to get underlying resource for compilation unit: ");
              buffer.append(unit);
              System.out.println(buffer.toString());
            }
            if (!e.getJavaModelStatus().isDoesNotExist())
            {
              ApiPlugin.log(e.getStatus());
              return this;
            }
          }
          if ((resource != null) && (resource.exists()))
          {
            long stamp = resource.getModificationStamp();
            if (stamp != fTimeStamp)
            {
              CRCVisitor visitor = new CRCVisitor();
              this$0.visitType(this, visitor);
              long crc = visitor.getValue();
              if (ProjectApiDescription.DEBUG)
              {
                StringBuffer buffer = new StringBuffer();
                buffer.append("Resource has changed for type manifest node: ");
                buffer.append(this);
                buffer.append(" tag scanning the new type");
                buffer.append(" (CRC ");
                buffer.append(crc);
                buffer.append(')');
                System.out.println(buffer.toString());
              }
              this$0.modified();
              children.clear();
              restrictions = 0;
              fTimeStamp = resource.getModificationStamp();
              try
              {
                TagScanner.newScanner().scan(unit, this$0, 
                  this$0.getApiTypeContainer((IPackageFragmentRoot)fType.getPackageFragment().getParent()), null);
              }
              catch (CoreException e)
              {
                ApiPlugin.log(e.getStatus());
              }
              visitor = new CRCVisitor();
              this$0.visitType(this, visitor);
              long crc2 = visitor.getValue();
              if (crc != crc2)
              {
                fBuildStamp = BuildStamps.getBuildStamp(resource.getProject());
                if (ProjectApiDescription.DEBUG)
                {
                  StringBuffer buffer = new StringBuffer();
                  buffer.append("CRC changed for type manifest node: ");
                  buffer.append(this);
                  buffer.append(" (CRC ");
                  buffer.append(crc2);
                  buffer.append(')');
                  System.out.println(buffer.toString());
                }
              }
            }
          }
          else
          {
            if (ProjectApiDescription.DEBUG)
            {
              StringBuffer buffer = new StringBuffer();
              buffer.append("Underlying resource for the type manifest node: ");
              buffer.append(this);
              buffer.append(" does not exist or is null");
              System.out.println(buffer.toString());
            }
            this$0.modified();
            parent.children.remove(element);
            return null;
          }
        }
        else if (ProjectApiDescription.DEBUG)
        {
          StringBuffer buffer = new StringBuffer();
          buffer.append("Failed to look up compilation unit for ");
          buffer.append(fType);
          buffer.append(" refreshing type manifest node: ");
          buffer.append(this);
          System.out.println(buffer.toString());
        }
      }
    }
    finally
    {
      fRefreshing = false;
    }
    fRefreshing = false;
    
    return this;
  }
  
  void persistXML(Document document, Element parent)
  {
    if (hasApiVisibility(this))
    {
      Element type = document.createElement("type");
      type.setAttribute("handle", fType.getHandleIdentifier());
      persistAnnotations(type);
      type.setAttribute("modificationStamp", Long.toString(fTimeStamp));
      this$0.persistChildren(document, type, children);
      parent.appendChild(type);
    }
  }
  
  public String toString()
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append("Type Node: ").append(fType.getFullyQualifiedName());
    buffer.append("\nVisibility: ").append(VisibilityModifiers.getVisibilityName(visibility));
    buffer.append("\nRestrictions: ").append(RestrictionModifiers.getRestrictionText(restrictions));
    if (parent != null)
    {
      String pname = parent.element.getElementType() == 1 ? 
        ((IPackageDescriptor)parent.element).getName() : ((IReferenceTypeDescriptor)parent.element).getQualifiedName();
      buffer.append("\nParent: ").append(pname);
    }
    return buffer.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.ProjectApiDescription.TypeNode
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaModelStatus;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.pde.api.tools.internal.builder.BuildStamps;
import org.eclipse.pde.api.tools.internal.model.ProjectComponent;
import org.eclipse.pde.api.tools.internal.provisional.ApiDescriptionVisitor;
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin;
import org.eclipse.pde.api.tools.internal.provisional.Factory;
import org.eclipse.pde.api.tools.internal.provisional.IApiAnnotations;
import org.eclipse.pde.api.tools.internal.provisional.RestrictionModifiers;
import org.eclipse.pde.api.tools.internal.provisional.VisibilityModifiers;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IElementDescriptor;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IPackageDescriptor;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IReferenceTypeDescriptor;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiTypeContainer;
import org.eclipse.pde.api.tools.internal.provisional.scanner.TagScanner;
import org.eclipse.pde.api.tools.internal.util.Util;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class ProjectApiDescription
  extends ApiDescription
{
  private IJavaProject fProject;
  public long fPackageTimeStamp = 0L;
  private boolean fRefreshingInProgress = false;
  public IFile fManifestFile;
  private boolean fInSynch = false;
  
  class PackageNode
    extends ApiDescription.ManifestNode
  {
    IPackageFragment[] fFragments;
    
    public PackageNode(IPackageFragment[] fragments, ApiDescription.ManifestNode parent, IElementDescriptor element, int visibility, int restrictions)
    {
      super(parent, element, visibility, restrictions);
      fFragments = fragments;
    }
    
    protected ApiDescription.ManifestNode refresh()
    {
      refreshPackages();
      for (int i = 0; i < fFragments.length; i++) {
        if (!fFragments[i].exists())
        {
          modified();
          return null;
        }
      }
      return this;
    }
    
    void persistXML(Document document, Element parent)
    {
      if (hasApiVisibility(this))
      {
        Element pkg = document.createElement("package");
        for (int i = 0; i < fFragments.length; i++)
        {
          Element fragment = document.createElement("fragment");
          fragment.setAttribute("handle", fFragments[i].getHandleIdentifier());
          pkg.appendChild(fragment);
        }
        pkg.setAttribute("visibility", Integer.toString(visibility));
        persistChildren(document, pkg, children);
        parent.appendChild(pkg);
      }
    }
    
    public String toString()
    {
      StringBuffer buffer = new StringBuffer();
      String name = ((IPackageDescriptor)element).getName();
      buffer.append("Package Node: ").append(name.equals("") ? "<default package>" : name);
      buffer.append("\nVisibility: ").append(VisibilityModifiers.getVisibilityName(visibility));
      buffer.append("\nRestrictions: ").append(RestrictionModifiers.getRestrictionText(restrictions));
      if (fFragments != null)
      {
        buffer.append("\nFragments:");
        IPackageFragment fragment = null;
        for (int i = 0; i < fFragments.length; i++)
        {
          fragment = fFragments[i];
          buffer.append("\n\t").append(fragment.getElementName());
          buffer.append(" [");
          buffer.append(fragment.getParent().getElementName());
          buffer.append("]");
        }
      }
      return buffer.toString();
    }
  }
  
  class TypeNode
    extends ApiDescription.ManifestNode
  {
    long fTimeStamp = -1L;
    long fBuildStamp = -1L;
    private boolean fRefreshing = false;
    IType fType;
    
    public TypeNode(IType type, ApiDescription.ManifestNode parent, IElementDescriptor element, int visibility, int restrictions)
    {
      super(parent, element, visibility, restrictions);
      fType = type;
      if ((parent instanceof TypeNode))
      {
        fTimeStamp = fTimeStamp;
        fBuildStamp = fBuildStamp;
      }
    }
    
    protected synchronized ApiDescription.ManifestNode refresh()
    {
      if (fRefreshing)
      {
        if (ProjectApiDescription.DEBUG)
        {
          StringBuffer buffer = new StringBuffer();
          buffer.append("Refreshing manifest node: ");
          buffer.append(this);
          buffer.append(" aborted because a refresh is already in progress");
          System.out.println(buffer.toString());
        }
        return this;
      }
      try
      {
        fRefreshing = true;
        int parentVis = resolveVisibility(parent);
        if (VisibilityModifiers.isAPI(parentVis))
        {
          ICompilationUnit unit = fType.getCompilationUnit();
          if (unit != null)
          {
            IResource resource = null;
            try
            {
              resource = unit.getUnderlyingResource();
            }
            catch (JavaModelException e)
            {
              if (ProjectApiDescription.DEBUG)
              {
                StringBuffer buffer = new StringBuffer();
                buffer.append("Failed to get underlying resource for compilation unit: ");
                buffer.append(unit);
                System.out.println(buffer.toString());
              }
              if (!e.getJavaModelStatus().isDoesNotExist())
              {
                ApiPlugin.log(e.getStatus());
                return this;
              }
            }
            if ((resource != null) && (resource.exists()))
            {
              long stamp = resource.getModificationStamp();
              if (stamp != fTimeStamp)
              {
                CRCVisitor visitor = new CRCVisitor();
                visitType(this, visitor);
                long crc = visitor.getValue();
                if (ProjectApiDescription.DEBUG)
                {
                  StringBuffer buffer = new StringBuffer();
                  buffer.append("Resource has changed for type manifest node: ");
                  buffer.append(this);
                  buffer.append(" tag scanning the new type");
                  buffer.append(" (CRC ");
                  buffer.append(crc);
                  buffer.append(')');
                  System.out.println(buffer.toString());
                }
                modified();
                children.clear();
                restrictions = 0;
                fTimeStamp = resource.getModificationStamp();
                try
                {
                  TagScanner.newScanner().scan(unit, ProjectApiDescription.this, 
                    getApiTypeContainer((IPackageFragmentRoot)fType.getPackageFragment().getParent()), null);
                }
                catch (CoreException e)
                {
                  ApiPlugin.log(e.getStatus());
                }
                visitor = new CRCVisitor();
                visitType(this, visitor);
                long crc2 = visitor.getValue();
                if (crc != crc2)
                {
                  fBuildStamp = BuildStamps.getBuildStamp(resource.getProject());
                  if (ProjectApiDescription.DEBUG)
                  {
                    StringBuffer buffer = new StringBuffer();
                    buffer.append("CRC changed for type manifest node: ");
                    buffer.append(this);
                    buffer.append(" (CRC ");
                    buffer.append(crc2);
                    buffer.append(')');
                    System.out.println(buffer.toString());
                  }
                }
              }
            }
            else
            {
              if (ProjectApiDescription.DEBUG)
              {
                StringBuffer buffer = new StringBuffer();
                buffer.append("Underlying resource for the type manifest node: ");
                buffer.append(this);
                buffer.append(" does not exist or is null");
                System.out.println(buffer.toString());
              }
              modified();
              parent.children.remove(element);
              return null;
            }
          }
          else if (ProjectApiDescription.DEBUG)
          {
            StringBuffer buffer = new StringBuffer();
            buffer.append("Failed to look up compilation unit for ");
            buffer.append(fType);
            buffer.append(" refreshing type manifest node: ");
            buffer.append(this);
            System.out.println(buffer.toString());
          }
        }
      }
      finally
      {
        fRefreshing = false;
      }
      fRefreshing = false;
      
      return this;
    }
    
    void persistXML(Document document, Element parent)
    {
      if (hasApiVisibility(this))
      {
        Element type = document.createElement("type");
        type.setAttribute("handle", fType.getHandleIdentifier());
        persistAnnotations(type);
        type.setAttribute("modificationStamp", Long.toString(fTimeStamp));
        persistChildren(document, type, children);
        parent.appendChild(type);
      }
    }
    
    public String toString()
    {
      StringBuffer buffer = new StringBuffer();
      buffer.append("Type Node: ").append(fType.getFullyQualifiedName());
      buffer.append("\nVisibility: ").append(VisibilityModifiers.getVisibilityName(visibility));
      buffer.append("\nRestrictions: ").append(RestrictionModifiers.getRestrictionText(restrictions));
      if (parent != null)
      {
        String pname = parent.element.getElementType() == 1 ? 
          ((IPackageDescriptor)parent.element).getName() : ((IReferenceTypeDescriptor)parent.element).getQualifiedName();
        buffer.append("\nParent: ").append(pname);
      }
      return buffer.toString();
    }
  }
  
  public ProjectApiDescription(IJavaProject project)
  {
    super(project.getElementName());
    fProject = project;
  }
  
  /* Error */
  public synchronized void accept(ApiDescriptionVisitor visitor, org.eclipse.core.runtime.IProgressMonitor monitor)
  {
    // Byte code:
    //   0: iconst_1
    //   1: istore_3
    //   2: aload_0
    //   3: getfield 480	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fInSynch	Z
    //   6: ifeq +12 -> 18
    //   9: aload_0
    //   10: aload_1
    //   11: aload_2
    //   12: invokespecial 512	org/eclipse/pde/api/tools/internal/ApiDescription:accept	(Lorg/eclipse/pde/api/tools/internal/provisional/ApiDescriptionVisitor;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   15: goto +307 -> 322
    //   18: aload_0
    //   19: invokespecial 519	org/eclipse/pde/api/tools/internal/ProjectApiDescription:getLocalPackageFragments	()[Lorg/eclipse/jdt/core/IPackageFragment;
    //   22: astore 4
    //   24: aconst_null
    //   25: checkcast 227	[Lorg/eclipse/jdt/core/IJavaElement;
    //   28: astore 5
    //   30: aconst_null
    //   31: astore 6
    //   33: aconst_null
    //   34: astore 7
    //   36: iconst_0
    //   37: istore 8
    //   39: goto +225 -> 264
    //   42: getstatic 479	org/eclipse/pde/api/tools/internal/ProjectApiDescription:DEBUG	Z
    //   45: ifeq +34 -> 79
    //   48: getstatic 475	java/lang/System:out	Ljava/io/PrintStream;
    //   51: new 232	java/lang/StringBuffer
    //   54: dup
    //   55: ldc 1
    //   57: invokespecial 496	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   60: aload 4
    //   62: iload 8
    //   64: aaload
    //   65: invokeinterface 571 1 0
    //   70: invokevirtual 498	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   73: invokevirtual 495	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   76: invokevirtual 489	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   79: aload 4
    //   81: iload 8
    //   83: aaload
    //   84: invokeinterface 571 1 0
    //   89: invokestatic 539	org/eclipse/pde/api/tools/internal/provisional/Factory:packageDescriptor	(Ljava/lang/String;)Lorg/eclipse/pde/api/tools/internal/provisional/descriptors/IPackageDescriptor;
    //   92: astore 9
    //   94: aload_0
    //   95: aload 9
    //   97: iconst_0
    //   98: invokevirtual 522	org/eclipse/pde/api/tools/internal/ProjectApiDescription:findNode	(Lorg/eclipse/pde/api/tools/internal/provisional/descriptors/IElementDescriptor;Z)Lorg/eclipse/pde/api/tools/internal/ApiDescription$ManifestNode;
    //   101: astore 10
    //   103: aload 10
    //   105: ifnull +156 -> 261
    //   108: aload_0
    //   109: aload 10
    //   111: aload 9
    //   113: invokevirtual 527	org/eclipse/pde/api/tools/internal/ProjectApiDescription:resolveAnnotations	(Lorg/eclipse/pde/api/tools/internal/ApiDescription$ManifestNode;Lorg/eclipse/pde/api/tools/internal/provisional/descriptors/IElementDescriptor;)Lorg/eclipse/pde/api/tools/internal/provisional/IApiAnnotations;
    //   116: astore 11
    //   118: aload_1
    //   119: aload 9
    //   121: aload 11
    //   123: invokevirtual 537	org/eclipse/pde/api/tools/internal/provisional/ApiDescriptionVisitor:visitElement	(Lorg/eclipse/pde/api/tools/internal/provisional/descriptors/IElementDescriptor;Lorg/eclipse/pde/api/tools/internal/provisional/IApiAnnotations;)Z
    //   126: ifeq +125 -> 251
    //   129: aload 4
    //   131: iload 8
    //   133: aaload
    //   134: invokeinterface 572 1 0
    //   139: astore 5
    //   141: iconst_0
    //   142: istore 12
    //   144: goto +96 -> 240
    //   147: aload 5
    //   149: iload 12
    //   151: aaload
    //   152: astore 6
    //   154: aload 6
    //   156: instanceof 249
    //   159: ifeq +55 -> 214
    //   162: aload 6
    //   164: checkcast 249	org/eclipse/jdt/core/ICompilationUnit
    //   167: astore 7
    //   169: aload 7
    //   171: invokeinterface 560 1 0
    //   176: astore 13
    //   178: aload 13
    //   180: iconst_0
    //   181: aload 13
    //   183: invokevirtual 491	java/lang/String:length	()I
    //   186: ldc 2
    //   188: invokevirtual 491	java/lang/String:length	()I
    //   191: isub
    //   192: invokevirtual 492	java/lang/String:substring	(II)Ljava/lang/String;
    //   195: astore 14
    //   197: aload_0
    //   198: aload_1
    //   199: aload 7
    //   201: aload 14
    //   203: invokeinterface 562 2 0
    //   208: invokespecial 521	org/eclipse/pde/api/tools/internal/ProjectApiDescription:visit	(Lorg/eclipse/pde/api/tools/internal/provisional/ApiDescriptionVisitor;Lorg/eclipse/jdt/core/IType;)V
    //   211: goto +26 -> 237
    //   214: aload 6
    //   216: instanceof 247
    //   219: ifeq +18 -> 237
    //   222: aload_0
    //   223: aload_1
    //   224: aload 6
    //   226: checkcast 247	org/eclipse/jdt/core/IClassFile
    //   229: invokeinterface 558 1 0
    //   234: invokespecial 521	org/eclipse/pde/api/tools/internal/ProjectApiDescription:visit	(Lorg/eclipse/pde/api/tools/internal/provisional/ApiDescriptionVisitor;Lorg/eclipse/jdt/core/IType;)V
    //   237: iinc 12 1
    //   240: iload 12
    //   242: aload 5
    //   244: arraylength
    //   245: if_icmplt -98 -> 147
    //   248: goto +5 -> 253
    //   251: iconst_0
    //   252: istore_3
    //   253: aload_1
    //   254: aload 9
    //   256: aload 11
    //   258: invokevirtual 536	org/eclipse/pde/api/tools/internal/provisional/ApiDescriptionVisitor:endVisitElement	(Lorg/eclipse/pde/api/tools/internal/provisional/descriptors/IElementDescriptor;Lorg/eclipse/pde/api/tools/internal/provisional/IApiAnnotations;)V
    //   261: iinc 8 1
    //   264: iload 8
    //   266: aload 4
    //   268: arraylength
    //   269: if_icmplt -227 -> 42
    //   272: goto +41 -> 313
    //   275: astore 4
    //   277: iconst_0
    //   278: istore_3
    //   279: aload 4
    //   281: invokevirtual 507	org/eclipse/jdt/core/JavaModelException:getStatus	()Lorg/eclipse/core/runtime/IStatus;
    //   284: invokestatic 538	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Lorg/eclipse/core/runtime/IStatus;)V
    //   287: iload_3
    //   288: ifeq +34 -> 322
    //   291: aload_0
    //   292: iconst_1
    //   293: putfield 480	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fInSynch	Z
    //   296: goto +26 -> 322
    //   299: astore 15
    //   301: iload_3
    //   302: ifeq +8 -> 310
    //   305: aload_0
    //   306: iconst_1
    //   307: putfield 480	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fInSynch	Z
    //   310: aload 15
    //   312: athrow
    //   313: iload_3
    //   314: ifeq +8 -> 322
    //   317: aload_0
    //   318: iconst_1
    //   319: putfield 480	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fInSynch	Z
    //   322: return
    // Line number table:
    //   Java source line #352	-> byte code offset #0
    //   Java source line #353	-> byte code offset #2
    //   Java source line #354	-> byte code offset #9
    //   Java source line #357	-> byte code offset #18
    //   Java source line #358	-> byte code offset #24
    //   Java source line #359	-> byte code offset #30
    //   Java source line #360	-> byte code offset #33
    //   Java source line #361	-> byte code offset #36
    //   Java source line #362	-> byte code offset #42
    //   Java source line #363	-> byte code offset #48
    //   Java source line #365	-> byte code offset #79
    //   Java source line #367	-> byte code offset #94
    //   Java source line #368	-> byte code offset #103
    //   Java source line #369	-> byte code offset #108
    //   Java source line #370	-> byte code offset #118
    //   Java source line #371	-> byte code offset #129
    //   Java source line #372	-> byte code offset #141
    //   Java source line #373	-> byte code offset #147
    //   Java source line #374	-> byte code offset #154
    //   Java source line #375	-> byte code offset #162
    //   Java source line #376	-> byte code offset #169
    //   Java source line #377	-> byte code offset #178
    //   Java source line #378	-> byte code offset #197
    //   Java source line #379	-> byte code offset #214
    //   Java source line #380	-> byte code offset #222
    //   Java source line #372	-> byte code offset #237
    //   Java source line #384	-> byte code offset #251
    //   Java source line #386	-> byte code offset #253
    //   Java source line #361	-> byte code offset #261
    //   Java source line #389	-> byte code offset #275
    //   Java source line #390	-> byte code offset #277
    //   Java source line #391	-> byte code offset #279
    //   Java source line #393	-> byte code offset #287
    //   Java source line #394	-> byte code offset #291
    //   Java source line #392	-> byte code offset #299
    //   Java source line #393	-> byte code offset #301
    //   Java source line #394	-> byte code offset #305
    //   Java source line #396	-> byte code offset #310
    //   Java source line #393	-> byte code offset #313
    //   Java source line #394	-> byte code offset #317
    //   Java source line #398	-> byte code offset #322
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	323	0	this	ProjectApiDescription
    //   0	323	1	visitor	ApiDescriptionVisitor
    //   0	323	2	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   1	313	3	completeVisit	boolean
    //   22	245	4	fragments	IPackageFragment[]
    //   275	5	4	e	JavaModelException
    //   28	215	5	children	IJavaElement[]
    //   31	194	6	child	IJavaElement
    //   34	166	7	unit	ICompilationUnit
    //   37	228	8	j	int
    //   92	163	9	packageDescriptor	IPackageDescriptor
    //   101	9	10	pkgNode	ApiDescription.ManifestNode
    //   116	141	11	annotations	IApiAnnotations
    //   142	99	12	k	int
    //   176	6	13	cuName	String
    //   195	7	14	tName	String
    //   299	12	15	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   18	272	275	org/eclipse/jdt/core/JavaModelException
    //   18	287	299	finally
  }
  
  private void visit(ApiDescriptionVisitor visitor, IType type)
  {
    IElementDescriptor element = getElementDescriptor(type);
    ApiDescription.ManifestNode typeNode = findNode(element, false);
    if (typeNode != null) {
      visitType(typeNode, visitor);
    }
  }
  
  void visitType(ApiDescription.ManifestNode node, ApiDescriptionVisitor visitor)
  {
    IApiAnnotations annotations = resolveAnnotations(node, element);
    if (visitor.visitElement(element, annotations)) {
      if (children != null) {
        visitChildren(visitor, children, null);
      }
    }
    visitor.endVisitElement(element, annotations);
  }
  
  protected boolean isInsertOnResolve(IElementDescriptor elementDescriptor)
  {
    switch (elementDescriptor.getElementType())
    {
    case 5: 
    case 6: 
      return false;
    case 2: 
      return ((IReferenceTypeDescriptor)elementDescriptor).getEnclosingType() == null;
    }
    return true;
  }
  
  protected ApiDescription.ManifestNode createNode(ApiDescription.ManifestNode parentNode, IElementDescriptor element)
  {
    switch (element.getElementType())
    {
    case 1: 
      try
      {
        IPackageDescriptor pkg = (IPackageDescriptor)element;
        IPackageFragmentRoot[] roots = getJavaProject().getPackageFragmentRoots();
        List fragments = new ArrayList(1);
        for (int i = 0; i < roots.length; i++)
        {
          IPackageFragmentRoot root = roots[i];
          IClasspathEntry entry = root.getRawClasspathEntry();
          switch (entry.getEntryKind())
          {
          case 1: 
          case 3: 
            IPackageFragment fragment = root.getPackageFragment(pkg.getName());
            if (fragment.exists()) {
              fragments.add(fragment);
            }
            break;
          case 2: 
          default: 
            if ((!root.isArchive()) && 
              (root.getKind() == 2))
            {
              IPackageFragment fragment = root.getPackageFragment(pkg.getName());
              if (fragment.exists()) {
                fragments.add(fragment);
              }
            }
            break;
          }
        }
        if (fragments.isEmpty()) {
          return null;
        }
        return newPackageNode((IPackageFragment[])fragments.toArray(new IPackageFragment[fragments.size()]), parentNode, element, 2, 0);
      }
      catch (CoreException localCoreException1)
      {
        return null;
      }
    case 2: 
      IReferenceTypeDescriptor descriptor = (IReferenceTypeDescriptor)element;
      try
      {
        IType type = null;
        String name = descriptor.getName();
        if ((parentNode instanceof PackageNode))
        {
          IPackageFragment[] fragments = fFragments;
          for (int i = 0; i < fragments.length; i++)
          {
            IPackageFragment fragment = fragments[i];
            if (fragment.getKind() == 1)
            {
              ICompilationUnit unit = fragment.getCompilationUnit(name + ".java");
              try
              {
                IResource resource = unit.getUnderlyingResource();
                if (resource == null) {
                  continue;
                }
                type = unit.getType(name);
              }
              catch (JavaModelException jme)
              {
                if (jme.getJavaModelStatus().isDoesNotExist()) {
                  continue;
                }
              }
              throw jme;
            }
            else
            {
              IClassFile file = fragment.getClassFile(name + ".class");
              if (file.exists()) {
                type = file.getType();
              }
            }
          }
        }
        else if ((parentNode instanceof TypeNode))
        {
          type = fType.getType(name);
        }
        if (type != null) {
          return newTypeNode(type, parentNode, element, 0, 0);
        }
      }
      catch (CoreException localCoreException2)
      {
        return null;
      }
      return null;
    }
    return super.createNode(parentNode, element);
  }
  
  public PackageNode newPackageNode(IPackageFragment[] fragments, ApiDescription.ManifestNode parent, IElementDescriptor descriptor, int vis, int res)
  {
    return new PackageNode(fragments, parent, descriptor, vis, res);
  }
  
  TypeNode newTypeNode(IType type, ApiDescription.ManifestNode parent, IElementDescriptor descriptor, int vis, int res)
  {
    return new TypeNode(type, parent, descriptor, vis, res);
  }
  
  ApiDescription.ManifestNode newNode(ApiDescription.ManifestNode parent, IElementDescriptor element, int vis, int res)
  {
    return new ApiDescription.ManifestNode(this, parent, element, vis, res);
  }
  
  /* Error */
  synchronized void refreshPackages()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 481	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fRefreshingInProgress	Z
    //   4: ifeq +50 -> 54
    //   7: getstatic 479	org/eclipse/pde/api/tools/internal/ProjectApiDescription:DEBUG	Z
    //   10: ifeq +43 -> 53
    //   13: new 232	java/lang/StringBuffer
    //   16: dup
    //   17: invokespecial 494	java/lang/StringBuffer:<init>	()V
    //   20: astore_1
    //   21: aload_1
    //   22: ldc_w 219
    //   25: invokevirtual 498	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   28: pop
    //   29: aload_1
    //   30: aload_0
    //   31: invokevirtual 497	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   34: pop
    //   35: aload_1
    //   36: ldc_w 214
    //   39: invokevirtual 498	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   42: pop
    //   43: getstatic 475	java/lang/System:out	Ljava/io/PrintStream;
    //   46: aload_1
    //   47: invokevirtual 495	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   50: invokevirtual 489	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   53: return
    //   54: aload_0
    //   55: getfield 483	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fManifestFile	Lorg/eclipse/core/resources/IFile;
    //   58: ifnull +20 -> 78
    //   61: aload_0
    //   62: getfield 483	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fManifestFile	Lorg/eclipse/core/resources/IFile;
    //   65: invokeinterface 552 1 0
    //   70: aload_0
    //   71: getfield 478	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fPackageTimeStamp	J
    //   74: lcmp
    //   75: ifeq +188 -> 263
    //   78: aload_0
    //   79: invokevirtual 517	org/eclipse/pde/api/tools/internal/ProjectApiDescription:modified	()V
    //   82: aload_0
    //   83: iconst_1
    //   84: putfield 481	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fRefreshingInProgress	Z
    //   87: aload_0
    //   88: getfield 482	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fPackageMap	Ljava/util/HashMap;
    //   91: invokevirtual 502	java/util/HashMap:values	()Ljava/util/Collection;
    //   94: invokeinterface 543 1 0
    //   99: astore_1
    //   100: goto +18 -> 118
    //   103: aload_1
    //   104: invokeinterface 545 1 0
    //   109: checkcast 261	org/eclipse/pde/api/tools/internal/ProjectApiDescription$PackageNode
    //   112: astore_2
    //   113: aload_2
    //   114: iconst_2
    //   115: putfield 485	org/eclipse/pde/api/tools/internal/ProjectApiDescription$PackageNode:visibility	I
    //   118: aload_1
    //   119: invokeinterface 544 1 0
    //   124: ifne -21 -> 103
    //   127: aload_0
    //   128: aload_0
    //   129: invokespecial 518	org/eclipse/pde/api/tools/internal/ProjectApiDescription:getJavaProject	()Lorg/eclipse/jdt/core/IJavaProject;
    //   132: invokeinterface 567 1 0
    //   137: ldc_w 217
    //   140: invokeinterface 555 2 0
    //   145: putfield 483	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fManifestFile	Lorg/eclipse/core/resources/IFile;
    //   148: aload_0
    //   149: getfield 483	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fManifestFile	Lorg/eclipse/core/resources/IFile;
    //   152: invokeinterface 553 1 0
    //   157: ifeq +101 -> 258
    //   160: aload_0
    //   161: invokespecial 519	org/eclipse/pde/api/tools/internal/ProjectApiDescription:getLocalPackageFragments	()[Lorg/eclipse/jdt/core/IPackageFragment;
    //   164: astore_2
    //   165: new 237	java/util/HashSet
    //   168: dup
    //   169: invokespecial 503	java/util/HashSet:<init>	()V
    //   172: astore_3
    //   173: iconst_0
    //   174: istore 4
    //   176: goto +22 -> 198
    //   179: aload_3
    //   180: aload_2
    //   181: iload 4
    //   183: aaload
    //   184: invokeinterface 571 1 0
    //   189: invokeinterface 551 2 0
    //   194: pop
    //   195: iinc 4 1
    //   198: iload 4
    //   200: aload_2
    //   201: arraylength
    //   202: if_icmplt -23 -> 179
    //   205: aload_0
    //   206: invokespecial 520	org/eclipse/pde/api/tools/internal/ProjectApiDescription:getApiComponent	()Lorg/eclipse/pde/api/tools/internal/model/ProjectComponent;
    //   209: astore 4
    //   211: aload_0
    //   212: aload 4
    //   214: invokevirtual 534	org/eclipse/pde/api/tools/internal/model/ProjectComponent:getBundleDescription	()Lorg/eclipse/osgi/service/resolver/BundleDescription;
    //   217: aload_3
    //   218: invokestatic 533	org/eclipse/pde/api/tools/internal/model/BundleComponent:initializeApiDescription	(Lorg/eclipse/pde/api/tools/internal/provisional/IApiDescription;Lorg/eclipse/osgi/service/resolver/BundleDescription;Ljava/util/Set;)V
    //   221: aload_0
    //   222: aload_0
    //   223: getfield 483	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fManifestFile	Lorg/eclipse/core/resources/IFile;
    //   226: invokeinterface 552 1 0
    //   231: putfield 478	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fPackageTimeStamp	J
    //   234: goto +24 -> 258
    //   237: astore_2
    //   238: aload_2
    //   239: invokevirtual 504	org/eclipse/core/runtime/CoreException:getStatus	()Lorg/eclipse/core/runtime/IStatus;
    //   242: invokestatic 538	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Lorg/eclipse/core/runtime/IStatus;)V
    //   245: goto +13 -> 258
    //   248: astore 5
    //   250: aload_0
    //   251: iconst_0
    //   252: putfield 481	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fRefreshingInProgress	Z
    //   255: aload 5
    //   257: athrow
    //   258: aload_0
    //   259: iconst_0
    //   260: putfield 481	org/eclipse/pde/api/tools/internal/ProjectApiDescription:fRefreshingInProgress	Z
    //   263: return
    // Line number table:
    //   Java source line #571	-> byte code offset #0
    //   Java source line #572	-> byte code offset #7
    //   Java source line #573	-> byte code offset #13
    //   Java source line #574	-> byte code offset #21
    //   Java source line #575	-> byte code offset #29
    //   Java source line #576	-> byte code offset #35
    //   Java source line #577	-> byte code offset #43
    //   Java source line #579	-> byte code offset #53
    //   Java source line #582	-> byte code offset #54
    //   Java source line #584	-> byte code offset #78
    //   Java source line #585	-> byte code offset #82
    //   Java source line #588	-> byte code offset #87
    //   Java source line #589	-> byte code offset #100
    //   Java source line #590	-> byte code offset #103
    //   Java source line #591	-> byte code offset #113
    //   Java source line #589	-> byte code offset #118
    //   Java source line #593	-> byte code offset #127
    //   Java source line #594	-> byte code offset #148
    //   Java source line #596	-> byte code offset #160
    //   Java source line #597	-> byte code offset #165
    //   Java source line #598	-> byte code offset #173
    //   Java source line #599	-> byte code offset #179
    //   Java source line #598	-> byte code offset #195
    //   Java source line #601	-> byte code offset #205
    //   Java source line #602	-> byte code offset #211
    //   Java source line #603	-> byte code offset #221
    //   Java source line #604	-> b
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