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

 //   Java source line #454	-> byte code offset #1694
    //   Java source line #457	-> byte code offset #1699
    //   Java source line #458	-> byte code offset #1710
    //   Java source line #459	-> byte code offset #1715
    //   Java source line #461	-> byte code offset #1720
    //   Java source line #462	-> byte code offset #1725
    //   Java source line #465	-> byte code offset #1733
    //   Java source line #468	-> byte code offset #1734
    //   Java source line #469	-> byte code offset #1740
    //   Java source line #473	-> byte code offset #1749
    //   Java source line #474	-> byte code offset #1755
    //   Java source line #476	-> byte code offset #1805
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	1808	0	this	ApiAnalysisBuilder
    //   0	1808	1	kind	int
    //   0	1808	2	args	Map
    //   0	1808	3	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   95	1631	4	localMonitor	org.eclipse.core.runtime.SubMonitor
    //   108	441	5	wbaseline	org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline
    //   139	1667	6	projects	IProject[]
    //   152	1359	7	baseline	org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline
    //   287	264	8	deltas	IResourceDelta[]
    //   873	30	8	e	CoreException
    //   314	93	9	filters	IResourceDelta
    //   880	8	9	status	org.eclipse.core.runtime.IStatus
    //   317	130	10	full	boolean
    //   320	119	11	i	int
    //   502	51	11	state	org.eclipse.jdt.internal.core.builder.State
    //   542	3	12	builder	IncrementalApiBuilder
    //   1188	281	13	localObject	Object
    //   652	43	14	i	int
    //   730	22	14	manifest	IFile
    //   967	43	14	i	int
    //   1045	22	14	manifest	IFile
    //   1250	43	14	i	int
    //   1328	22	14	manifest	IFile
    //   1531	43	14	i	int
    //   1609	22	14	manifest	IFile
    //   657	40	15	max	int
    //   768	3	15	e	Exception
    //   782	8	15	base	IPluginModelBase
    //   972	40	15	max	int
    //   1083	3	15	e	Exception
    //   1097	8	15	base	IPluginModelBase
    //   1255	40	15	max	int
    //   1366	3	15	e	Exception
    //   1380	8	15	base	IPluginModelBase
    //   1536	40	15	max	int
    //   1647	3	15	e	Exception
    //   1661	8	15	base	IPluginModelBase
    //   667	15	16	project	IProject
    //   794	12	16	model	IBuildModel
    //   813	3	16	ce	CoreException
    //   982	15	16	project	IProject
    //   1109	12	16	model	IBuildModel
    //   1128	3	16	ce	CoreException
    //   1265	15	16	project	IProject
    //   1392	12	16	model	IBuildModel
    //   1411	3	16	ce	CoreException
    //   1546	15	16	project	IProject
    //   1673	12	16	model	IBuildModel
    //   1692	3	16	ce	CoreException
    //   576	1	49	localOperationCanceledException1	org.eclipse.core.runtime.OperationCanceledException
    //   854	1	50	localOperationCanceledException2	org.eclipse.core.runtime.OperationCanceledException
    //   1169	1	51	localOperationCanceledException3	org.eclipse.core.runtime.OperationCanceledException
    //   1452	1	52	localOperationCanceledException4	org.eclipse.core.runtime.OperationCanceledException
    //   1733	1	53	localOperationCanceledException5	org.eclipse.core.runtime.OperationCanceledException
    // Exception table:
    //   from	to	target	type
    //   154	573	576	org/eclipse/core/runtime/OperationCanceledException
    //   747	765	768	java/lang/Exception
    //   789	810	813	org/eclipse/core/runtime/CoreException
    //   592	851	854	org/eclipse/core/runtime/OperationCanceledException
    //   154	573	873	org/eclipse/core/runtime/CoreException
    //   1062	1080	1083	java/lang/Exception
    //   1104	1125	1128	org/eclipse/core/runtime/CoreException
    //   907	1166	1169	org/eclipse/core/runtime/OperationCanceledException
    //   154	592	1188	finally
    //   873	907	1188	finally
    //   1345	1363	1366	java/lang/Exception
    //   1387	1408	1411	org/eclipse/core/runtime/CoreException
    //   1190	1449	1452	org/eclipse/core/runtime/OperationCanceledException
    //   1626	1644	1647	java/lang/Exception
    //   1668	1689	1692	org/eclipse/core/runtime/CoreException
    //   1471	1730	1733	org/eclipse/core/runtime/OperationCanceledException
  }
  
  boolean shouldFullBuild(IResourceDelta delta)
  {
    switch (delta.getKind())
    {
    case 4: 
      IResourceDelta subdelta = delta.findMember(MANIFEST_PATH);
      if (subdelta != null)
      {
        IFile file = (IFile)subdelta.getResource();
        return (file.getProject().equals(currentproject)) && (compareManifest(file, buildstate));
      }
      subdelta = delta.findMember(BUILD_PROPERTIES_PATH);
      if (subdelta != null)
      {
        IFile file = (IFile)subdelta.getResource();
        return (file.getProject().equals(currentproject)) && (compareBuildProperties(buildstate));
      }
      break;
    }
    return false;
  }
  
  boolean compareManifest(IFile manifest, BuildState state)
  {
    if (state != null) {
      try
      {
        Map stateheaders = state.getManifestState();
        if (stateheaders != null)
        {
          Map headers = ManifestElement.parseBundleManifest(manifest.getContents(), null);
          Map.Entry entry = null;
          for (Iterator i = stateheaders.entrySet().iterator(); i.hasNext();)
          {
            entry = (Map.Entry)i.next();
            String key = (String)entry.getKey();
            String value = (String)headers.get(key);
            ManifestElement[] e1 = ManifestElement.parseHeader(key, value);
            ManifestElement[] e2 = ManifestElement.parseHeader(key, (String)entry.getValue());
            if ((e1 != null) && (e2 != null) && (e1.length == e2.length))
            {
              Arrays.sort(e1, fgManifestElementComparator);
              Arrays.sort(e2, fgManifestElementComparator);
              for (int j = 0; j < e1.length; j++)
              {
                String[] v1 = e1[j].getValueComponents();
                String[] v2 = e2[j].getValueComponents();
                if (v1.length == v2.length)
                {
                  Arrays.sort(v1);
                  Arrays.sort(v2);
                  for (int k = 0; k < v2.length; k++) {
                    if (!v1[k].equals(v2[k])) {
                      return true;
                    }
                  }
                }
                else
                {
                  return true;
                }
                Enumeration e = e1[j].getDirectiveKeys();
                if (e != null) {
                  while (e.hasMoreElements())
                  {
                    String key2 = (String)e.nextElement();
                    if (!Util.equalsOrNull(e1[j].getDirective(key2), e2[j].getDirective(key2))) {
                      return true;
                    }
                  }
                }
                e = e1[j].getKeys();
                if (e != null) {
                  while (e.hasMoreElements())
                  {
                    String key2 = (String)e.nextElement();
                    if (!Util.equalsOrNull(e1[j].getAttribute(key2), e2[j].getAttribute(key2))) {
                      return true;
                    }
                  }
                }
              }
            }
            else
            {
              return true;
            }
          }
          return false;
        }
      }
      catch (Exception e)
      {
        ApiPlugin.log(e);
        return false;
      }
    }
    return true;
  }
  
  boolean compareBuildProperties(BuildState state)
  {
    if (state != null)
    {
      Map map = state.getBuildPropertiesState();
      if (map != null)
      {
        IPluginModelBase base = PluginRegistry.findModel(currentproject);
        if (base != null) {
          try
          {
            IBuildModel model = PluginRegistry.createBuildModel(base);
            if (model != null)
            {
              IBuild ibuild = model.getBuild();
              for (Iterator i = map.entrySet().iterator(); i.hasNext();)
              {
                Map.Entry entry = (Map.Entry)i.next();
                IBuildEntry be = ibuild.getEntry((String)entry.getKey());
                if ((be != null) && (!entry.getValue().equals(Util.deepToString(be.getTokens())))) {
                  return true;
                }
              }
            }
          }
          catch (CoreException ce)
          {
            ApiPlugin.log(ce);
            return false;
          }
        }
      }
      return false;
    }
    return true;
  }
  
  boolean shouldAbort(IProject project)
    throws CoreException
  {
    return (!project.isAccessible()) || (!project.hasNature("org.eclipse.pde.api.tools.apiAnalysisNature")) || (hasBeenBuilt(project)) || (hasFatalProblems(project));
  }
  
  boolean hasFatalProblems(IProject project)
    throws CoreException
  {
    IMarker[] problems = project.findMarkers("org.eclipse.jdt.core.problem", true, 0);
    if (problems.length > 0)
    {
      cleanupMarkers(project);
      IApiProblem problem = ApiProblemFactory.newFatalProblem(
        Path.EMPTY.toString(), 
        new String[] { project.getName() }, 
        1);
      createMarkerForProblem(
        1879048192, 
        "org.eclipse.pde.api.tools.fatal_problem", 
        problem);
      return true;
    }
    cleanupFatalMarkers(project);
    return false;
  }
  
  boolean worthDoingFullBuild(IProject[] projects)
  {
    Set apiToolingDependentProjects = buildstate.getApiToolingDependentProjects();
    int i = 0;
    for (int max = projects.length; i < max; i++)
    {
      IProject currentProject = projects[i];
      if (Util.isApiProject(currentProject))
      {
        if (!apiToolingDependentProjects.contains(currentProject.getName())) {
          return true;
        }
      }
      else if (apiToolingDependentProjects.contains(currentProject.getName())) {
        return true;
      }
    }
    return false;
  }
  
  /* Error */
  void buildAll(org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline baseline, org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline wbaseline, org.eclipse.core.runtime.IProgressMonitor monitor)
    throws CoreException
  {
    // Byte code:
    //   0: aload_3
    //   1: getstatic 913	org/eclipse/pde/api/tools/internal/builder/BuilderMessages:api_analysis_on_0	Ljava/lang/String;
    //   4: iconst_4
    //   5: invokestatic 957	org/eclipse/core/runtime/SubMonitor:convert	(Lorg/eclipse/core/runtime/IProgressMonitor;Ljava/lang/String;I)Lorg/eclipse/core/runtime/SubMonitor;
    //   8: astore 4
    //   10: aload_0
    //   11: getfield 901	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:currentproject	Lorg/eclipse/core/resources/IProject;
    //   14: aconst_null
    //   15: invokestatic 1014	org/eclipse/pde/api/tools/internal/builder/BuildState:setLastBuiltState	(Lorg/eclipse/core/resources/IProject;Lorg/eclipse/pde/api/tools/internal/builder/BuildState;)V
    //   18: aload_0
    //   19: new 522	org/eclipse/pde/api/tools/internal/builder/BuildState
    //   22: dup
    //   23: invokespecial 1003	org/eclipse/pde/api/tools/internal/builder/BuildState:<init>	()V
    //   26: putfield 907	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:buildstate	Lorg/eclipse/pde/api/tools/internal/builder/BuildState;
    //   29: aload 4
    //   31: getstatic 910	org/eclipse/pde/api/tools/internal/builder/BuilderMessages:ApiAnalysisBuilder_initializing_analyzer	Ljava/lang/String;
    //   34: aload_0
    //   35: getfield 901	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:currentproject	Lorg/eclipse/core/resources/IProject;
    //   38: invokeinterface 1055 1 0
    //   43: invokestatic 968	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   46: invokevirtual 955	org/eclipse/core/runtime/SubMonitor:subTask	(Ljava/lang/String;)V
    //   49: aload_0
    //   50: aload_0
    //   51: getfield 901	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:currentproject	Lorg/eclipse/core/resources/IProject;
    //   54: invokevirtual 984	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:cleanupMarkers	(Lorg/eclipse/core/resources/IResource;)V
    //   57: aload_0
    //   58: invokevirtual 991	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:getCurrentModel	()Lorg/eclipse/pde/core/plugin/IPluginModelBase;
    //   61: astore 5
    //   63: aload 5
    //   65: ifnull +111 -> 176
    //   68: aload 4
    //   70: getstatic 914	org/eclipse/pde/api/tools/internal/builder/BuilderMessages:building_workspace_profile	Ljava/lang/String;
    //   73: invokevirtual 955	org/eclipse/core/runtime/SubMonitor:subTask	(Ljava/lang/String;)V
    //   76: aload 4
    //   78: iconst_1
    //   79: invokestatic 1025	org/eclipse/pde/api/tools/internal/util/Util:updateMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   82: aload 5
    //   84: invokeinterface 1121 1 0
    //   89: invokeinterface 1098 1 0
    //   94: astore 6
    //   96: aload_2
    //   97: aload 6
    //   99: invokeinterface 1105 2 0
    //   104: astore 7
    //   106: aload 7
    //   108: ifnull +68 -> 176
    //   111: aload_0
    //   112: invokevirtual 990	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:getAnalyzer	()Lorg/eclipse/pde/api/tools/internal/provisional/builder/IApiAnalyzer;
    //   115: aload_0
    //   116: getfield 907	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:buildstate	Lorg/eclipse/pde/api/tools/internal/builder/BuildState;
    //   119: aconst_null
    //   120: aconst_null
    //   121: aload_1
    //   122: aload 7
    //   124: new 520	org/eclipse/pde/api/tools/internal/builder/BuildContext
    //   127: dup
    //   128: invokespecial 1001	org/eclipse/pde/api/tools/internal/builder/BuildContext:<init>	()V
    //   131: aload 4
    //   133: iconst_1
    //   134: invokevirtual 956	org/eclipse/core/runtime/SubMonitor:newChild	(I)Lorg/eclipse/core/runtime/SubMonitor;
    //   137: invokeinterface 1103 8 0
    //   142: aload 4
    //   144: iconst_1
    //   145: invokestatic 1025	org/eclipse/pde/api/tools/internal/util/Util:updateMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   148: aload_0
    //   149: invokevirtual 971	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:createMarkers	()V
    //   152: aload 4
    //   154: iconst_1
    //   155: invokestatic 1025	org/eclipse/pde/api/tools/internal/util/Util:updateMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   158: goto +18 -> 176
    //   161: astore 8
    //   163: aload 4
    //   165: ifnull +8 -> 173
    //   168: aload 4
    //   170: invokevirtual 954	org/eclipse/core/runtime/SubMonitor:done	()V
    //   173: aload 8
    //   175: athrow
    //   176: aload 4
    //   178: ifnull +8 -> 186
    //   181: aload 4
    //   183: invokevirtual 954	org/eclipse/core/runtime/SubMonitor:done	()V
    //   186: return
    // Line number table:
    //   Java source line #701	-> byte code offset #0
    //   Java source line #703	-> byte code offset #10
    //   Java source line #704	-> byte code offset #18
    //   Java source line #705	-> byte code offset #29
    //   Java source line #706	-> byte code offset #49
    //   Java source line #707	-> byte code offset #57
    //   Java source line #708	-> byte code offset #63
    //   Java source line #709	-> byte code offset #68
    //   Java source line #710	-> byte code offset #76
    //   Java source line #711	-> byte code offset #82
    //   Java source line #713	-> byte code offset #96
    //   Java source line #714	-> byte code offset #106
    //   Java source line #715	-> byte code offset #111
    //   Java source line #716	-> byte code offset #142
    //   Java source line #717	-> byte code offset #148
    //   Java source line #718	-> byte code offset #152
    //   Java source line #722	-> byte code offset #161
    //   Java source line #723	-> byte code offset #163
    //   Java source line #724	-> byte code offset #168
    //   Java source line #726	-> byte code offset #173
    //   Java source line #723	-> byte code offset #176
    //   Java source line #724	-> byte code offset #181
    //   Java source line #727	-> byte code offset #186
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	187	0	this	ApiAnalysisBuilder
    //   0	187	1	baseline	org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline
    //   0	187	2	wbaseline	org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline
    //   0	187	3	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   8	174	4	localMonitor	org.eclipse.core.runtime.SubMonitor
    //   61	22	5	currentModel	IPluginModelBase
    //   94	4	6	id	String
    //   104	19	7	apiComponent	org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent
    //   161	13	8	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   10	161	161	finally
  }
  
  protected void createMarkers()
  {
    try
    {
      IResource manifest = Util.getManifestFile(currentproject);
      if (manifest != null) {
        manifest.deleteMarkers("org.eclipse.pde.api.tools.version_numbering", false, 0);
      }
      currentproject.deleteMarkers("org.eclipse.pde.api.tools.api_profile", false, 0);
      currentproject.deleteMarkers("org.eclipse.pde.api.tools.api_component_resolution", false, 0);
    }
    catch (CoreException e)
    {
      ApiPlugin.log(e);
    }
    IApiProblem[] problems = getAnalyzer().getProblems();
    String type = null;
    for (int i = 0; i < problems.length; i++)
    {
      int category = problems[i].getCategory();
      type = getProblemTypeFromCategory(category, problems[i].getKind());
      if (type != null)
      {
        if (DEBUG) {
          System.out.println("creating marker for: " + problems[i].toString());
        }
        createMarkerForProblem(category, type, problems[i]);
      }
    }
  }
  
  String getProblemTypeFromCategory(int category, int kind)
  {
    switch (category)
    {
    case 1610612736: 
      return "org.eclipse.pde.api.tools.api_component_resolution";
    case 1342177280: 
      return "org.eclipse.pde.api.tools.api_profile";
    case 268435456: 
      return "org.eclipse.pde.api.tools.compatibility";
    case 1073741824: 
      return "org.eclipse.pde.api.tools.marker.sincetags";
    case 536870912: 
      if (kind == 7) {
        return "org.eclipse.pde.api.tools.unsupported_tags";
      }
      if (kind == 10) {
        return "org.eclipse.pde.api.tools.unused_filters";
      }
      return "org.eclipse.pde.api.tools.api_usage";
    case 805306368: 
      return "org.eclipse.pde.api.tools.version_numbering";
    case -2147483648: 
      return "org.eclipse.pde.api.tools.marker.apiusescan";
    }
    return null;
  }
  
  void createMarkerForProblem(int category, String type, IApiProblem problem)
  {
    IResource resource = resolveResource(problem);
    if (resource == null) {
      return;
    }
    try
    {
      if (category == Integer.MIN_VALUE)
      {
        IMarker[] markers = resource.findMarkers(type, true, 0);
        for (int i = 0; i < markers.length; i++)
        {
          String msg = markers[i].getAttribute("message", null);
          if ((msg == null) || (msg.equalsIgnoreCase(problem.getMessage())))
          {
            int markerSeverity = markers[i].getAttribute("severity", 0);
            int problemSeverity = ApiPlugin.getDefault().getSeverityLevel(ApiProblemFactory.getProblemSeverityId(problem), currentproject);
            if (markerSeverity != problemSeverity) {}
          }
          else
          {
            markers[i].delete();
          }
        }
      }
      IMarker marker = resource.createMarker(type);
      int line = problem.getLineNumber();
      switch (category)
      {
      case 805306368: 
      case 1342177280: 
      case 1610612736: 
      case -2147483648: 
        break;
      default: 
        line++;
      }
      marker.setAttributes(
        new String[] {
        "message", 
        "severity", 
        "lineNumber", 
        "charStart", 
        "charEnd", 
        "sourceId", 
        "problemid" }, 
        new Object[] {
        problem.getMessage(), 
        new Integer(ApiPlugin.getDefault().getSeverityLevel(ApiProblemFactory.getProblemSeverityId(problem), currentproject)), 
        new Integer(line), 
        new Integer(problem.getCharStart()), 
        new Integer(problem.getCharEnd()), 
        "API Tools", 
        new Integer(problem.getId()) });
      
      String[] args = problem.getMessageArguments();
      if (args.length > 0) {
        marker.setAttribute("messagearguments", createArgAttribute(args));
      }
      String typeName = problem.getTypeName();
      if (typeName != null) {
        marker.setAttribute("problemTypeName", typeName);
      }
      if (problem.getExtraMarkerAttributeIds().length > 0) {
        marker.setAttributes(problem.getExtraMarkerAttributeIds(), problem.getExtraMarkerAttributeValues());
      }
      if (DEBUG) {
        System.out.println("Created the marker: " + marker.getId() + " - " + marker.getAttributes().entrySet());
      }
    }
    catch (CoreException localCoreException) {}
  }
  
  IResource resolveResource(IApiProblem problem)
  {
    String resourcePath = problem.getResourcePath();
    if (resourcePath == null) {
      return null;
    }
    IResource resource = currentproject.findMember(new Path(resourcePath));
    if (resource == null)
    {
      IJavaProject jp = JavaCore.create(currentproject);
      try
      {
        IType type = jp.findType(problem.getTypeName());
        if (type != null) {
          return type.getResource();
        }
      }
      catch (JavaModelException localJavaModelException) {}
      return null;
    }
    if (!resource.isAccessible()) {
      return null;
    }
    return resource;
  }
  
  String createArgAttribute(String[] args)
  {
    StringBuffer buff = new StringBuffer();
    for (int i = 0; i < args.length; i++)
    {
      buff.append(args[i]);
      if (i < args.length - 1) {
        buff.append("#");
      }
    }
    return buff.toString();
  }
  
  /* Error */
  protected void clean(org.eclipse.core.runtime.IProgressMonitor monitor)
    throws CoreException
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_0
    //   2: invokevirtual 973	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:getProject	()Lorg/eclipse/core/resources/IProject;
    //   5: putfield 901	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:currentproject	Lorg/eclipse/core/resources/IProject;
    //   8: aload_1
    //   9: getstatic 911	org/eclipse/pde/api/tools/internal/builder/BuilderMessages:CleaningAPIDescription	Ljava/lang/String;
    //   12: iconst_1
    //   13: anewarray 473	java/lang/String
    //   16: dup
    //   17: iconst_0
    //   18: aload_0
    //   19: getfield 901	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:currentproject	Lorg/eclipse/core/resources/IProject;
    //   22: invokeinterface 1055 1 0
    //   27: aastore
    //   28: invokestatic 916	com/ibm/icu/text/MessageFormat:format	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   31: iconst_2
    //   32: invokestatic 957	org/eclipse/core/runtime/SubMonitor:convert	(Lorg/eclipse/core/runtime/IProgressMonitor;Ljava/lang/String;I)Lorg/eclipse/core/runtime/SubMonitor;
    //   35: astore_2
    //   36: aload_0
    //   37: aload_0
    //   38: getfield 901	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:currentproject	Lorg/eclipse/core/resources/IProject;
    //   41: invokevirtual 986	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:cleanupUsageMarkers	(Lorg/eclipse/core/resources/IResource;)V
    //   44: aload_0
    //   45: aload_0
    //   46: getfield 901	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:currentproject	Lorg/eclipse/core/resources/IProject;
    //   49: invokevirtual 982	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:cleanupCompatibilityMarkers	(Lorg/eclipse/core/resources/IResource;)V
    //   52: aload_0
    //   53: aload_0
    //   54: getfield 901	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:currentproject	Lorg/eclipse/core/resources/IProject;
    //   57: invokevirtual 985	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:cleanupUnsupportedTagMarkers	(Lorg/eclipse/core/resources/IResource;)V
    //   60: aload_0
    //   61: getfield 901	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:currentproject	Lorg/eclipse/core/resources/IProject;
    //   64: ldc_w 457
    //   67: iconst_0
    //   68: iconst_2
    //   69: invokeinterface 1057 4 0
    //   74: aload_2
    //   75: iconst_1
    //   76: invokestatic 1025	org/eclipse/pde/api/tools/internal/util/Util:updateMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   79: aload_0
    //   80: aload_0
    //   81: getfield 901	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:currentproject	Lorg/eclipse/core/resources/IProject;
    //   84: invokevirtual 974	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:cleanupApiDescription	(Lorg/eclipse/core/resources/IProject;)V
    //   87: aload_2
    //   88: iconst_1
    //   89: invokestatic 1025	org/eclipse/pde/api/tools/internal/util/Util:updateMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   92: goto +18 -> 110
    //   95: astore_3
    //   96: aload_0
    //   97: getfield 901	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:currentproject	Lorg/eclipse/core/resources/IProject;
    //   100: aconst_null
    //   101: invokestatic 1014	org/eclipse/pde/api/tools/internal/builder/BuildState:setLastBuiltState	(Lorg/eclipse/core/resources/IProject;Lorg/eclipse/pde/api/tools/internal/builder/BuildState;)V
    //   104: aload_2
    //   105: invokevirtual 954	org/eclipse/core/runtime/SubMonitor:done	()V
    //   108: aload_3
    //   109: athrow
    //   110: aload_0
    //   111: getfield 901	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:currentproject	Lorg/eclipse/core/resources/IProject;
    //   114: aconst_null
    //   115: invokestatic 1014	org/eclipse/pde/api/tools/internal/builder/BuildState:setLastBuiltState	(Lorg/eclipse/core/resources/IProject;Lorg/eclipse/pde/api/tools/internal/builder/BuildState;)V
    //   118: aload_2
    //   119: invokevirtual 954	org/eclipse/core/runtime/SubMonitor:done	()V
    //   122: return
    // Line number table:
    //   Java source line #940	-> byte code offset #0
    //   Java source line #941	-> byte code offset #8
    //   Java source line #944	-> byte code offset #36
    //   Java source line #945	-> byte code offset #44
    //   Java source line #946	-> byte code offset #52
    //   Java source line #947	-> byte code offset #60
    //   Java source line #948	-> byte code offset #74
    //   Java source line #950	-> byte code offset #79
    //   Java source line #951	-> byte code offset #87
    //   Java source line #953	-> byte code offset #95
    //   Java source line #954	-> byte code offset #96
    //   Java source line #955	-> byte code offset #104
    //   Java source line #956	-> byte code offset #108
    //   Java source line #954	-> byte code offset #110
    //   Java source line #955	-> byte code offset #118
    //   Java source line #957	-> byte code offset #122
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	123	0	this	ApiAnalysisBuilder
    //   0	123	1	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   35	84	2	localmonitor	org.eclipse.core.runtime.SubMonitor
    //   95	14	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   36	95	95	finally
  }
  
  void cleanupApiDescription(IProject project)
  {
    if ((project != null) && (project.exists())) {
      ApiDescriptionManager.getManager().clean(JavaCore.create(project), true, false);
    }
  }
  
  IPluginModelBase getCurrentModel()
  {
    IPluginModelBase[] workspaceModels = PluginRegistry.getWorkspaceModels();
    IPath location = currentproject.getLocation();
    IPluginModelBase currentModel = null;
    BundleDescription desc = null;
    int i = 0;
    for (int max = workspaceModels.length; i < max; i++)
    {
      desc = workspaceModels[i].getBundleDescription();
      if (desc != null)
      {
        Path path = new Path(desc.getLocation());
        if (path.equals(location))
        {
          currentModel = workspaceModels[i];
          break;
        }
      }
      else if (DEBUG)
      {
        System.out.println("Tried to look up bundle description for: " + workspaceModels[i].toString());
      }
    }
    return currentModel;
  }
  
  IResourceDelta[] getDeltas(IProject[] projects)
  {
    if (DEBUG) {
      System.out.println("Searching for deltas for build of project: " + currentproject.getName());
    }
    ArrayList deltas = new ArrayList();
    IResourceDelta delta = getDelta(currentproject);
    if (delta != null)
    {
      if (DEBUG) {
        System.out.println("Found a delta: " + delta);
      }
      deltas.add(delta);
    }
    for (int i = 0; i < projects.length; i++)
    {
      delta = getDelta(projects[i]);
      if (delta != null)
      {
        if (DEBUG) {
          System.out.println("Found a delta: " + delta);
        }
        deltas.add(delta);
      }
    }
    return (IResourceDelta[])deltas.toArray(new IResourceDelta[deltas.size()]);
  }
  
  protected synchronized IApiAnalyzer getAnalyzer()
  {
    if (analyzer == null) {
      analyzer = new BaseApiAnalyzer();
    }
    return analyzer;
  }
  
  IProject[] getRequiredProjects(boolean includebinaries)
    throws CoreException
  {
    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
    if ((currentproject == null) || (workspaceRoot == null)) {
      return new IProject[0];
    }
    ArrayList projects = new ArrayList();
    try
    {
      IJavaProject javaProject = JavaCore.create(currentproject);
      HashSet blocations = new HashSet();
      blocations.add(javaProject.getOutputLocation());
      output_locs.put(currentproject, blocations);
      HashSet slocations = new HashSet();
      IPackageFragmentRoot[] roots = javaProject.getPackageFragmentRoots();
      for (int i = 0; i < roots.length; i++) {
        if (!roots[i].isArchive()) {
          slocations.add(roots[i].getPath());
        }
      }
      src_locs.put(currentproject, slocations);
      IClasspathEntry[] entries = javaProject.getResolvedClasspath(true);
      int i = 0;
      for (int l = entries.length; i < l; i++)
      {
        IClasspathEntry entry = entries[i];
        IPath path = entry.getPath();
        IProject p = null;
        switch (entry.getEntryKind())
        {
        case 2: 
          p = workspaceRoot.getProject(path.lastSegment());
          if ((isOptional(entry)) && (!p.hasNature("org.eclipse.pde.api.tools.apiAnalysisNature"))) {
            p = null;
          }
          break;
        case 1: 
          if ((includebinaries) && (path.segmentCount() > 1))
          {
            IResource resource = workspaceRoot.findMember(path.segment(0));
            if ((resource instanceof IProject)) {
              p = (IProject)resource;
            }
          }
          break;
        case 3: 
          IPath entrypath = entry.getOutputLocation();
          if (entrypath != null) {
            blocations.add(entrypath);
          }
          break;
        }
        if ((p != null) && (!projects.contains(p)))
        {
          projects.add(p);
          
          javaProject = JavaCore.create(p);
          HashSet bins = new HashSet();
          HashSet srcs = new HashSet();
          if (javaProject.exists())
          {
            bins.add(javaProject.getOutputLocation());
            IClasspathEntry[] source = javaProject.getRawClasspath();
            IPath entrypath = null;
            for (int j = 0; j < source.length; j++) {
              if (source[j].getEntryKind() == 3)
              {
                srcs.add(source[j].getPath());
                entrypath = source[j].getOutputLocation();
                if (entrypath != null) {
                  bins.add(entrypath);
                }
              }
            }
            output_locs.put(p, bins);
            src_locs.put(p, srcs);
          }
        }
      }
    }
    catch (JavaModelException localJavaModelException)
    {
      return new IProject[0];
    }
    IProject[] result = new IProject[projects.size()];
    projects.toArray(result);
    return result;
  }
  
  HashSet getProjectOutputPaths(IProject project)
  {
    return (HashSet)output_locs.get(project);
  }
  
  boolean isOptional(IClasspathEntry entry)
  {
    IClasspathAttribute[] attribs = entry.getExtraAttributes();
    int i = 0;
    for (int length = attribs.length; i < length; i++)
    {
      IClasspathAttribute attribute = attribs[i];
      if (("optional".equals(attribute.getName())) && ("true".equals(attribute.getValue()))) {
        return true;
      }
    }
    return false;
  }
  
  public String toString()
  {
    return NLS.bind(BuilderMessages.ApiAnalysisBuilder_builder_for_project, currentproject.getName());
  }
}

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

import java.util.List;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.pde.api.tools.internal.provisional.IApiFilterStore;
import org.eclipse.pde.api.tools.internal.provisional.problems.IApiProblemFilter;

class BaseApiAnalyzer$1
  implements IWorkspaceRunnable
{
  final BaseApiAnalyzer this$0;
  private final IApiFilterStore val$store;
  private final List val$filterlist;
  
  BaseApiAnalyzer$1(BaseApiAnalyzer paramBaseApiAnalyzer, IApiFilterStore paramIApiFilterStore, List paramList)
  {
    this$0 = paramBaseApiAnalyzer;val$store = paramIApiFilterStore;val$filterlist = paramList;
  }
  
  public void run(IProgressMonitor monitor)
    throws CoreException
  {
    val$store.removeFilters((IApiProblemFilter[])val$filterlist.toArray(new IApiProblemFilter[val$filterlist.size()]));
  }
}

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

class BaseApiAnalyzer$ReexportedBundleVersionInfo
{
  String componentID;
  int kind;
  
  BaseApiAnalyzer$ReexportedBundleVersionInfo(String componentID, int kind)
  {
    this.componentID = componentID;
    this.kind = kind;
  }
}

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

import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeRoot;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.osgi.util.NLS;
import org.eclipse.pde.api.tools.internal.ApiBaselineManager;
import org.eclipse.pde.api.tools.internal.comparator.Delta;
import org.eclipse.pde.api.tools.internal.model.ProjectComponent;
import org.eclipse.pde.api.tools.internal.problems.ApiProblemFactory;
import org.eclipse.pde.api.tools.internal.problems.ApiProblemFilter;
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.IApiBaselineManager;
import org.eclipse.pde.api.tools.internal.provisional.IApiDescription;
import org.eclipse.pde.api.tools.internal.provisional.IApiFilterStore;
import org.eclipse.pde.api.tools.internal.provisional.IRequiredComponentDescription;
import org.eclipse.pde.api.tools.internal.provisional.IVersionRange;
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.builder.IApiAnalyzer;
import org.eclipse.pde.api.tools.internal.provisional.builder.IBuildContext;
import org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator;
import org.eclipse.pde.api.tools.internal.provisional.comparator.DeltaProcessor;
import org.eclipse.pde.api.tools.internal.provisional.comparator.IDelta;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IComponentDescriptor;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IMemberDescriptor;
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.IApiComponent;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiType;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiTypeContainer;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiTypeRoot;
import org.eclipse.pde.api.tools.internal.provisional.problems.IApiProblem;
import org.eclipse.pde.api.tools.internal.provisional.problems.IApiProblemFilter;
import org.eclipse.pde.api.tools.internal.search.IReferenceDescriptor;
import org.eclipse.pde.api.tools.internal.util.Signatures;
import org.eclipse.pde.api.tools.internal.util.SinceTagVersion;
import org.eclipse.pde.api.tools.internal.util.Util;
import org.osgi.framework.Version;

public class BaseApiAnalyzer
  implements IApiAnalyzer
{
  private static final String QUALIFIER = "qualifier";
  static final String[] NO_TYPES = new String[0];
  
  private static class ReexportedBundleVersionInfo
  {
    String componentID;
    int kind;
    
    ReexportedBundleVersionInfo(String componentID, int kind)
    {
      this.componentID = componentID;
      this.kind = kind;
    }
  }
  
  private static boolean DEBUG = Util.DEBUG;
  private ArrayList fProblems = new ArrayList(25);
  private List fPendingDeltaInfos = new ArrayList(3);
  private BuildState fBuildState = null;
  private IApiFilterStore fFilterStore = null;
  private IJavaProject fJavaProject = null;
  private Properties fPreferences = null;
  
  public static void setDebug(boolean debugValue)
  {
    DEBUG = (debugVa
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