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

set #153
        //   Java source line #144	-> byte code offset #159
        //   Java source line #147	-> byte code offset #197
        //   Java source line #148	-> byte code offset #207
        //   Java source line #149	-> byte code offset #219
        //   Java source line #150	-> byte code offset #228
        //   Java source line #151	-> byte code offset #249
        //   Java source line #153	-> byte code offset #258
        //   Java source line #155	-> byte code offset #266
        //   Java source line #157	-> byte code offset #270
        //   Java source line #158	-> byte code offset #277
        //   Java source line #159	-> byte code offset #282
        //   Java source line #162	-> byte code offset #286
        //   Java source line #163	-> byte code offset #301
        //   Java source line #164	-> byte code offset #311
        //   Java source line #165	-> byte code offset #323
        //   Java source line #166	-> byte code offset #333
        //   Java source line #168	-> byte code offset #343
        //   Java source line #171	-> byte code offset #357
        //   Java source line #175	-> byte code offset #372
        //   Java source line #176	-> byte code offset #374
        //   Java source line #177	-> byte code offset #379
        //   Java source line #176	-> byte code offset #382
        //   Java source line #178	-> byte code offset #387
        //   Java source line #179	-> byte code offset #395
        //   Java source line #181	-> byte code offset #406
        //   Java source line #182	-> byte code offset #407
        //   Java source line #184	-> byte code offset #414
        //   Java source line #185	-> byte code offset #415
        //   Java source line #187	-> byte code offset #419
        // Local variable table:
        //   start	length	slot	name	signature
        //   0	423	0	this	1
        //   0	423	1	monitor	org.eclipse.core.runtime.IProgressMonitor
        //   48	316	2	localmonitor	org.eclipse.core.runtime.SubMonitor
        //   406	2	2	ce	CoreException
        //   414	2	2	ioe	java.io.IOException
        //   61	72	3	project	IProject
        //   130	141	4	xml	String
        //   146	212	5	file	org.eclipse.core.resources.IFile
        //   217	33	6	folder	org.eclipse.core.resources.IFolder
        //   275	108	6	xstream	java.io.InputStream
        //   321	13	7	folder	org.eclipse.core.resources.IFolder
        //   372	8	8	localObject	Object
        // Exception table:
        //   from	to	target	type
        //   286	372	372	finally
        //   44	118	406	org/eclipse/core/runtime/CoreException
        //   119	269	406	org/eclipse/core/runtime/CoreException
        //   270	285	406	org/eclipse/core/runtime/CoreException
        //   286	403	406	org/eclipse/core/runtime/CoreException
        //   44	118	414	java/io/IOException
        //   119	269	414	java/io/IOException
        //   270	285	414	java/io/IOException
        //   286	403	414	java/io/IOException
      }
    };
    job.setSystem(true);
    job.setPriority(10);
    job.schedule();
  }
  
  public synchronized void addFilters(IApiProblemFilter[] filters)
  {
    if (filters == null)
    {
      if (DEBUG) {
        System.out.println("null filters array, not adding filters");
      }
      return;
    }
    initializeApiFilters();
    for (int i = 0; i < filters.length; i++)
    {
      IApiProblem problem = filters[i].getUnderlyingProblem();
      String resourcePath = problem.getResourcePath();
      if (resourcePath != null)
      {
        IResource resource = fProject.getProject().findMember(new Path(resourcePath));
        if (resource != null)
        {
          Map pTypeNames = (HashMap)fFilterMap.get(resource);
          String typeName = problem.getTypeName();
          if (typeName == null) {
            typeName = "!global!";
          }
          Set pfilters = null;
          if (pTypeNames == null)
          {
            pTypeNames = new HashMap();
            pfilters = new HashSet();
            pTypeNames.put(typeName, pfilters);
            fFilterMap.put(resource, pTypeNames);
          }
          else
          {
            pfilters = (Set)pTypeNames.get(typeName);
            if (pfilters == null)
            {
              pfilters = new HashSet();
              pTypeNames.put(typeName, pfilters);
            }
          }
          fNeedsSaving |= pfilters.add(filters[i]);
        }
      }
    }
    persistApiFilters();
  }
  
  public synchronized void addFiltersFor(IApiProblem[] problems)
  {
    if (problems == null)
    {
      if (DEBUG) {
        System.out.println("null problems array: not addding filters");
      }
      return;
    }
    if (problems.length < 1)
    {
      if (DEBUG) {
        System.out.println("empty problem array: not addding filters");
      }
      return;
    }
    initializeApiFilters();
    internalAddFilters(problems, null, true);
  }
  
  public synchronized IApiProblemFilter[] getFilters(IResource resource)
  {
    initializeApiFilters();
    Map pTypeNames = (Map)fFilterMap.get(resource);
    if (pTypeNames == null) {
      return NO_FILTERS;
    }
    List allFilters = new ArrayList();
    for (Iterator iterator = pTypeNames.values().iterator(); iterator.hasNext();)
    {
      Set values = (Set)iterator.next();
      allFilters.addAll(values);
    }
    return (IApiProblemFilter[])allFilters.toArray(new IApiProblemFilter[allFilters.size()]);
  }
  
  public synchronized boolean isFiltered(IApiProblem problem)
  {
    initializeApiFilters();
    String resourcePath = problem.getResourcePath();
    if (resourcePath == null) {
      return false;
    }
    IResource resource = fProject.getProject().findMember(new Path(resourcePath));
    if (resource == null)
    {
      if (DEBUG) {
        System.out.println("no resource exists: [" + resourcePath + "]");
      }
      return false;
    }
    IApiProblemFilter[] filters = getFilters(resource);
    if (filters == null)
    {
      if (DEBUG) {
        System.out.println("no filters defined for [" + resourcePath + "] return not filtered");
      }
      return false;
    }
    IApiProblemFilter filter = null;
    int i = 0;
    for (int max = filters.length; i < max; i++)
    {
      filter = filters[i];
      if (filter.getUnderlyingProblem().equals(problem))
      {
        if (DEBUG) {
          System.out.println("recording filter used: [" + filter.toString() + "]");
        }
        recordFilterUsed(resource, filter);
        return true;
      }
    }
    if (DEBUG) {
      System.out.println("no filter defined for problem: [" + problem.toString() + "]");
    }
    return false;
  }
  
  public void dispose()
  {
    persistApiFilters();
    clearFilters();
    if (fUnusedFilters != null)
    {
      fUnusedFilters.clear();
      fUnusedFilters = null;
    }
    ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
  }
  
  public synchronized IResource[] getResources()
  {
    initializeApiFilters();
    Collection resources = fFilterMap.keySet();
    return (IResource[])resources.toArray(new IResource[resources.size()]);
  }
  
  public synchronized boolean removeFilters(IApiProblemFilter[] filters)
  {
    if (filters == null)
    {
      if (DEBUG) {
        System.out.println("null filters array, not removing");
      }
      return false;
    }
    if (fFilterMap == null)
    {
      if (DEBUG) {
        System.out.println("null filter map, not removing");
      }
      return false;
    }
    boolean success = true;
    for (int i = 0; i < filters.length; i++)
    {
      IApiProblem underlyingProblem = filters[i].getUnderlyingProblem();
      String resourcePath = underlyingProblem.getResourcePath();
      if (resourcePath != null)
      {
        IResource resource = fProject.getProject().findMember(new Path(resourcePath));
        if (resource == null) {
          resource = fProject.getProject().getFile(resourcePath);
        }
        Map pTypeNames = (Map)fFilterMap.get(resource);
        if (pTypeNames != null)
        {
          String typeName = underlyingProblem.getTypeName();
          if (typeName == null) {
            typeName = "!global!";
          }
          Set pfilters = (Set)pTypeNames.get(typeName);
          if ((pfilters != null) && (pfilters.remove(filters[i])))
          {
            if (DEBUG) {
              System.out.println("removed filter: [" + filters[i] + "]");
            }
            fNeedsSaving |= true;
            success &= true;
            if (pfilters.isEmpty())
            {
              pTypeNames.remove(typeName);
              if (pTypeNames.isEmpty()) {
                success &= fFilterMap.remove(resource) != null;
              }
            }
          }
          else
          {
            success &= false;
          }
        }
      }
    }
    persistApiFilters();
    return success;
  }
  
  synchronized String getStoreAsXml(Map filtermap)
    throws CoreException
  {
    if (filtermap == null)
    {
      if (DEBUG) {
        System.out.println("no filter map returning null XML for project [" + fProject.getElementName() + "]");
      }
      return null;
    }
    if (filtermap.isEmpty())
    {
      if (DEBUG) {
        System.out.println("empty filter map returning null XML for project [" + fProject.getElementName() + "]");
      }
      return null;
    }
    Document document = Util.newDocument();
    Element root = document.createElement("component");
    document.appendChild(root);
    root.setAttribute("id", fProject.getElementName());
    root.setAttribute("version", IApiXmlConstants.API_FILTER_STORE_CURRENT_VERSION);
    Set allFiltersEntrySet = filtermap.entrySet();
    List allFiltersEntries = new ArrayList(allFiltersEntrySet.size());
    allFiltersEntries.addAll(allFiltersEntrySet);
    Collections.sort(allFiltersEntries, new Comparator()
    {
      public int compare(Object o1, Object o2)
      {
        Map.Entry entry1 = (Map.Entry)o1;
        Map.Entry entry2 = (Map.Entry)o2;
        String path1 = ((IResource)entry1.getKey()).getFullPath().toOSString();
        String path2 = ((IResource)entry2.getKey()).getFullPath().toOSString();
        return path1.compareTo(path2);
      }
    });
    for (Iterator iter = allFiltersEntries.iterator(); iter.hasNext();)
    {
      Map.Entry allFiltersEntry = (Map.Entry)iter.next();
      IResource resource = (IResource)allFiltersEntry.getKey();
      Map pTypeNames = (Map)allFiltersEntry.getValue();
      if (pTypeNames != null)
      {
        Set allTypeNamesEntriesSet = pTypeNames.entrySet();
        List allTypeNamesEntries = new ArrayList(allTypeNamesEntriesSet.size());
        allTypeNamesEntries.addAll(allTypeNamesEntriesSet);
        Collections.sort(allTypeNamesEntries, new Comparator()
        {
          public int compare(Object o1, Object o2)
          {
            Map.Entry entry1 = (Map.Entry)o1;
            Map.Entry entry2 = (Map.Entry)o2;
            String typeName1 = (String)entry1.getKey();
            String typeName2 = (String)entry2.getKey();
            return typeName1.compareTo(typeName2);
          }
        });
        for (Iterator iterator = allTypeNamesEntries.iterator(); iterator.hasNext();)
        {
          Map.Entry entry = (Map.Entry)iterator.next();
          String typeName = (String)entry.getKey();
          Set filters = (Set)entry.getValue();
          if (!filters.isEmpty())
          {
            Element relement = document.createElement("resource");
            relement.setAttribute("path", resource.getProjectRelativePath().toPortableString());
            boolean typeNameIsInitialized = false;
            if (typeName != "!global!")
            {
              relement.setAttribute("type", typeName);
              typeNameIsInitialized = true;
            }
            root.appendChild(relement);
            typeName = null;
            List filtersList = new ArrayList(filters.size());
            filtersList.addAll(filters);
            Collections.sort(filtersList, new Comparator()
            {
              public int compare(Object o1, Object o2)
              {
                IApiProblem p1 = ((IApiProblemFilter)o1).getUnderlyingProblem();
                IApiProblem p2 = ((IApiProblemFilter)o2).getUnderlyingProblem();
                int problem1Id = p1.getId();
                int problem2Id = p2.getId();
                int ids = problem1Id - problem2Id;
                if (ids == 0)
                {
                  String[] args1 = p1.getMessageArguments();
                  String[] args2 = p2.getMessageArguments();
                  int length = args1.length < args2.length ? args1.length : args2.length;
                  for (int i = 0; i < length; i++)
                  {
                    int args = args1[i].compareTo(args2[i]);
                    if (args != 0) {
                      return args;
                    }
                  }
                  return args1.length - args2.length;
                }
                return ids;
              }
            });
            for (Iterator iterator2 = filtersList.iterator(); iterator2.hasNext();)
            {
              IApiProblemFilter filter = (IApiProblemFilter)iterator2.next();
              IApiProblem problem = filter.getUnderlyingProblem();
              typeName = problem.getTypeName();
              Element filterElement = document.createElement("filter");
              filterElement.setAttribute("id", Integer.toString(problem.getId()));
              String comment = filter.getComment();
              if (comment != null) {
                filterElement.setAttribute("comment", comment);
              }
              String[] messageArguments = problem.getMessageArguments();
              int length = messageArguments.length;
              if (length > 0)
              {
                Element messageArgumentsElement = document.createElement("message_arguments");
                for (int j = 0; j < length; j++)
                {
                  Element messageArgumentElement = document.createElement("message_argument");
                  messageArgumentElement.setAttribute("value", String.valueOf(messageArguments[j]));
                  messageArgumentsElement.appendChild(messageArgumentElement);
                }
                filterElement.appendChild(messageArgumentsElement);
              }
              relement.appendChild(filterElement);
            }
            if ((typeName != null) && (!typeNameIsInitialized) && (typeName.length() != 0)) {
              relement.setAttribute("type", typeName);
            }
          }
        }
      }
    }
    return Util.serializeDocument(document);
  }
  
  /* Error */
  private synchronized void initializeApiFilters()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 583	org/eclipse/pde/api/tools/internal/ApiFilterStore:fFilterMap	Ljava/util/HashMap;
    //   4: ifnull +4 -> 8
    //   7: return
    //   8: getstatic 580	org/eclipse/pde/api/tools/internal/ApiFilterStore:DEBUG	Z
    //   11: ifeq +40 -> 51
    //   14: getstatic 579	java/lang/System:out	Ljava/io/PrintStream;
    //   17: new 332	java/lang/StringBuffer
    //   20: dup
    //   21: ldc_w 303
    //   24: invokespecial 601	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   27: aload_0
    //   28: getfield 585	org/eclipse/pde/api/tools/internal/ApiFilterStore:fProject	Lorg/eclipse/jdt/core/IJavaProject;
    //   31: invokeinterface 703 1 0
    //   36: invokevirtual 603	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   39: ldc_w 295
    //   42: invokevirtual 603	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   45: invokevirtual 600	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   48: invokevirtual 590	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   51: aload_0
    //   52: new 337	java/util/HashMap
    //   55: dup
    //   56: iconst_5
    //   57: invokespecial 613	java/util/HashMap:<init>	(I)V
    //   60: putfield 583	org/eclipse/pde/api/tools/internal/ApiFilterStore:fFilterMap	Ljava/util/HashMap;
    //   63: aload_0
    //   64: iconst_1
    //   65: invokevirtual 631	org/eclipse/pde/api/tools/internal/ApiFilterStore:getFilterFilePath	(Z)Lorg/eclipse/core/runtime/IPath;
    //   68: astore_1
    //   69: invokestatic 620	org/eclipse/core/resources/ResourcesPlugin:getWorkspace	()Lorg/eclipse/core/resources/IWorkspace;
    //   72: invokeinterface 698 1 0
    //   77: aload_1
    //   78: iconst_1
    //   79: invokeinterface 700 3 0
    //   84: astore_2
    //   85: aload_2
    //   86: ifnonnull +47 -> 133
    //   89: getstatic 580	org/eclipse/pde/api/tools/internal/ApiFilterStore:DEBUG	Z
    //   92: ifeq +40 -> 132
    //   95: getstatic 579	java/lang/System:out	Ljava/io/PrintStream;
    //   98: new 332	java/lang/StringBuffer
    //   101: dup
    //   102: ldc_w 291
    //   105: invokespecial 601	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   108: aload_0
    //   109: getfield 585	org/eclipse/pde/api/tools/internal/ApiFilterStore:fProject	Lorg/eclipse/jdt/core/IJavaProject;
    //   112: invokeinterface 703 1 0
    //   117: invokevirtual 603	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   120: ldc_w 295
    //   123: invokevirtual 603	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   126: invokevirtual 600	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   129: invokevirtual 590	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   132: return
    //   133: aconst_null
    //   134: astore_3
    //   135: aconst_null
    //   136: astore 4
    //   138: aload_2
    //   139: checkcast 344	org/eclipse/core/resources/IFile
    //   142: astore 5
    //   144: aload 5
    //   146: invokeinterface 677 1 0
    //   151: ifeq +99 -> 250
    //   154: aload 5
    //   156: invokeinterface 679 1 0
    //   161: astore 4
    //   163: new 331	java/lang/String
    //   166: dup
    //   167: aload 4
    //   169: iconst_m1
    //   170: ldc_w 294
    //   173: invokestatic 648	org/eclipse/pde/api/tools/internal/util/Util:getInputStreamAsCharArray	(Ljava/io/InputStream;ILjava/lang/String;)[C
    //   176: invokespecial 597	java/lang/String:<init>	([C)V
    //   179: astore_3
    //   180: goto +70 -> 250
    //   183: astore 5
    //   185: aload 5
    //   187: invokestatic 645	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   190: aload 4
    //   192: ifnull +72 -> 264
    //   195: aload 4
    //   197: invokevirtual 589	java/io/InputStream:close	()V
    //   200: goto +64 -> 264
    //   203: pop
    //   204: goto +60 -> 264
    //   207: astore 5
    //   209: aload 5
    //   211: invokestatic 645	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   214: aload 4
    //   216: ifnull +48 -> 264
    //   219: aload 4
    //   221: invokevirtual 589	java/io/InputStream:close	()V
    //   224: goto +40 -> 264
    //   227: pop
    //   228: goto +36 -> 264
    //   231: astore 6
    //   233: aload 4
    //   235: ifnull +12 -> 247
    //   238: aload 4
    //   240: invokevirtual 589	java/io/InputStream:close	()V
    //   243: goto +4 -> 247
    //   246: pop
    //   247: aload 6
    //   249: athrow
    //   250: aload 4
    //   252: ifnull +12 -> 264
    //   255: aload 4
    //   257: invokevirtual 589	java/io/InputStream:close	()V
    //   260: goto +4 -> 264
    //   263: pop
    //   264: aload_3
    //   265: ifnonnull +4 -> 269
    //   268: return
    //   269: aconst_null
    //   270: astore 5
    //   272: aload_3
    //   273: invokestatic 651	org/eclipse/pde/api/tools/internal/util/Util:parseDocument	(Ljava/lang/String;)Lorg/w3c/dom/Element;
    //   276: astore 5
    //   278: goto +10 -> 288
    //   281: astore 6
    //   283: aload 6
    //   285: invokestatic 645	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   288: aload 5
    //   290: ifnonnull +4 -> 294
    //   293: return
    //   294: aload 5
    //   296: invokeinterface 715 1 0
    //   301: ldc_w 298
    //   304: invokevirtual 598	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   307: ifne +4 -> 311
    //   310: return
    //   311: aload 5
    //   313: ldc_w 301
    //   316: invokeinterface 716 2 0
    //   321: astore 6
    //   323: aload 6
    //   325: invokevirtual 596	java/lang/String:length	()I
    //   328: ifne +4 -> 332
    //   331: return
    //   332: aload 5
    //   334: ldc_w 320
    //   337: invokeinterface 716 2 0
    //   342: astore 7
    //   344: getstatic 587	org/eclipse/pde/api/tools/internal/IApiXmlConstants:API_FILTER_STORE_CURRENT_VERSION	Ljava/lang/String;
    //   347: invokestatic 592	java/lang/Integer:parseInt	(Ljava/lang/String;)I
    //   350: istore 8
    //   352: iconst_0
    //   353: istore 9
    //   355: aload 7
    //   357: invokevirtual 596	java/lang/String:length	()I
    //   360: ifeq +14 -> 374
    //   363: aload 7
    //   365: invokestatic 592	java/lang/Integer:parseInt	(Ljava/lang/String;)I
    //   368: istore 9
    //   370: goto +4 -> 374
    //   373: pop
    //   374: iload 9
    //   376: iload 8
    //   378: if_icmpeq +13 -> 391
    //   381: aload_0
    //   382: iconst_1
    //   383: putfield 581	org/eclipse/pde/api/tools/internal/ApiFilterStore:fNeedsSaving	Z
    //   386: aload_0
    //   387: invokevirtual 630	org/eclipse/pde/api/tools/internal/ApiFilterStore:persistApiFilters	()V
    //   390: return
    //   391: aload 5
    //   393: ldc_w 317
    //   396: invokeinterface 719 2 0
    //   401: astore 10
    //   403: new 334	java/util/ArrayList
    //   406: dup
    //   407: invokespecial 605	java/util/ArrayList:<init>	()V
    //   410: astore 11
    //   412: new 334	java/util/ArrayList
    //   415: dup
    //   416: invokespecial 605	java/util/ArrayList:<init>	()V
    //   419: astore 12
    //   421: iconst_0
    //   422: istore 13
    //   424: goto +368 -> 792
    //   427: aload 10
    //   429: iload 13
    //   431: invokeinterface 721 2 0
    //   436: checkcast 374	org/w3c/dom/Element
    //   439: astore 14
    //   441: aload 14
    //   443: ldc_w 311
    //   446: invokeinterface 716 2 0
    //   451: astore 15
    //   453: aload 15
    //   455: invokevirtual 596	java/lang/String:length	()I
    //   458: ifne +6 -> 464
    //   461: goto +328 -> 789
    //   464: aload 14
    //   466: ldc_w 318
    //   469: invokeinterface 716 2 0
    //   474: astore 16
    //   476: aload 16
    //   478: invokevirtual 596	java/lang/String:length	()I
    //   481: ifne +6 -> 487
    //   484: aconst_null
    //   485: astore 16
    //   487: invokestatic 620	org/eclipse/core/resources/ResourcesPlugin:getWorkspace	()Lorg/eclipse/core/resources/IWorkspace;
    //   490: invokeinterface 698 1 0
    //   495: aload 6
    //   497: invokeinterface 699 2 0
    //   502: checkcast 345	org/eclipse/core/resources/IProject
    //   505: astore 17
    //   507: aload 17
    //   509: ifnonnull +6 -> 515
    //   512: goto +277 -> 789
    //   515: aload 17
    //   517: new 357	org/eclipse/core/runtime/Path
    //   520: dup
    //   521: aload 15
    //   523: invokespecial 625	org/eclipse/core/runtime/Path:<init>	(Ljava/lang/String;)V
    //   526: invokeinterface 683 2 0
    //   531: astore 18
    //   533: aload 18
    //   535: ifnonnull +6 -> 541
    //   538: goto +251 -> 789
    //   541: aload 14
    //   543: ldc_w 300
    //   546: invokeinterface 719 2 0
    //   551: astore 19
    //   553: iconst_0
    //   554: istore 20
    //   556: goto +221 -> 777
    //   559: aload 19
    //   561: iload 20
    //   563: invokeinterface 721 2 0
    //   568: checkcast 374	org/w3c/dom/Element
    //   571: astore 14
    //   573: aload 14
    //   575: ldc_w 301
    //   578: invokestatic 634	org/eclipse/pde/api/tools/internal/ApiFilterStore:loadIntegerAttribute	(Lorg/w3c/dom/Element;Ljava/lang/String;)I
    //   581: istore 21
    //   583: iload 21
    //   585: ifgt +6 -> 591
    //   588: goto +186 -> 774
    //   591: aconst_null
    //   592: checkcast 321	[Ljava/lang/String;
    //   595: astore 22
    //   597: aload 14
    //   599: ldc_w 305
    //   602: invokeinterface 719 2 0
    //   607: astore 23
    //   609: aload 23
    //   611: invokeinterface 720 1 0
    //   616: iconst_1
    //   617: if_icmpeq +6 -> 623
    //   620: goto +154 -> 774
    //   623: aload 23
    //   625: iconst_0
    //   626: invokeinterface 721 2 0
    //   631: checkcast 374	org/w3c/dom/Element
    //   634: astore 24
    //   636: aload 24
    //   638: ldc_w 304
    //   641: invokeinterface 719 2 0
    //   646: astore 25
    //   648: aload 25
    //   650: invokeinterface 720 1 0
    //   655: istore 26
    //   657: iload 26
    //   659: anewarray 331	java/lang/String
    //   662: astore 22
    //   664: iconst_0
    //   665: istore 27
    //   667: goto +35 -> 702
    //   670: aload 25
    //   672: iload 27
    //   674: invokeinterface 721 2 0
    //   679: checkcast 374	org/w3c/dom/Element
    //   682: astore 28
    //   684: aload 22
    //   686: iload 27
    //   688: aload 28
    //   690: ldc_w 319
    //   693: invokeinterface 716 2 0
    //   698: aastore
    //   699: iinc 27 1
    //   702: iload 27
    //   704: iload 26
    //   706: if_icmplt -36 -> 670
    //   709: aload 14
    //   711: ldc_w 297
    //   714: invokeinterface 716 2 0
    //   719: astore 27
    //   721: aload 12
    //   723: aload 27
    //   725: invokevirtual 596	java/lang/String:length	()I
    //   728: iconst_1
    //   729: if_icmpge +7 -> 736
    //   732: aconst_null
    //   733: goto +5 -> 738
    //   736: aload 27
    //   738: invokevirtual 608	java/util/ArrayList:add	(Ljava/lang/Object;)Z
    //   741: pop
    //   742: aload 11
    //   744: aload 18
    //   746: invokeinterface 688 1 0
    //   751: invokeinterface 701 1 0
    //   756: aload 16
    //   758: aload 22
    //   760: aconst_null
    //   761: aconst_null
    //   762: iconst_m1
    //   763: iconst_m1
    //   764: iconst_m1
    //   765: iload 21
    //   767: invokestatic 642	org/eclipse/pde/api/tools/internal/problems/ApiProblemFactory:newApiProblem	(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;IIII)Lorg/eclipse/pde/api/tools/internal/provisional/problems/IApiProblem;
    //   770: invokevirtual 608	java/util/ArrayList:add	(Ljava/lang/Object;)Z
    //   773: pop
    //   774: iinc 20 1
    //   777: iload 20
    //   779: aload 19
    //   781: invokeinterface 720 1 0
    //   786: if_icmplt -227 -> 559
    //   789: iinc 13 1
    //   792: iload 13
    //   794: aload 10
    //   796: invokeinterface 720 1 0
    //   801: if_icmplt -374 -> 427
    //   804: aload_0
    //   805: aload 11
    //   807: aload 11
    //   809: invokevirtual 604	java/util/ArrayList:size	()I
    //   812: anewarray 370	org/eclipse/pde/api/tools/internal/provisional/problems/IApiProblem
    //   815: invokevirtual 609	java/util/ArrayList:toArray	([Ljava/lang/Object;)[Ljava/lang/Object;
    //   818: checkcast 323	[Lorg/eclipse/pde/api/tools/internal/provisional/problems/IApiProblem;
    //   821: aload 12
    //   823: aload 12
    //   825: invokevirtual 604	java/util/ArrayList:size	()I
    //   828: anewarray 331	java/lang/String
    //   831: invokevirtual 609	java/util/ArrayList:toArray	([Ljava/lang/Object;)[Ljava/lang/Object;
    //   834: checkcast 321	[Ljava/lang/String;
    //   837: iconst_0
    //   838: invokespecial 633	org/eclipse/pde/api/tools/internal/ApiFilterStore:internalAddFilters	([Lorg/eclipse/pde/api/tools/internal/provisional/problems/IApiProblem;[Ljava/lang/String;Z)V
    //   841: aload 11
    //   843: invokevirtual 606	java/util/ArrayList:clear	()V
    //   846: return
    // Line number table:
    //   Java source line #531	-> byte code offset #0
    //   Java source line #532	-> byte code offset #7
    //   Java source line #534	-> byte code offset #8
    //   Java source line #535	-> byte code offset #14
    //   Java source line #537	-> byte code offset #51
    //   Java source line #538	-> byte code offset #63
    //   Java source line #539	-> byte code offset #69
    //   Java source line #540	-> byte code offset #85
    //   Java source line #541	-> byte code offset #89
    //   Java source line #542	-> byte code offset #95
    //   Java source line #544	-> byte code offset #132
    //   Java source line #546	-> byte code offset #133
    //   Java source line #547	-> byte code offset #135
    //   Java source line #549	-> byte code offset #138
    //   Java source line #550	-> byte code offset #144
    //   Java source line #551	-> byte code offset #154
    //   Java source line #552	-> byte code offset #163
    //   Java source line #555	-> byte code offset #183
    //   Java source line #556	-> byte code offset #185
    //   Java source line #562	-> byte code offset #190
    //   Java source line #564	-> byte code offset #195
    //   Java source line #565	-> byte code offset #203
    //   Java source line #558	-> byte code offset #207
    //   Java source line #559	-> byte code offset #209
    //   Java source line #562	-> byte code offset #214
    //   Java source line #564	-> byte code offset #219
    //   Java source line #565	-> byte code offset #227
    //   Java source line #561	-> byte code offset #231
    //   Java source line #562	-> byte code offset #233
    //   Java source line #564	-> byte code offset #238
    //   Java source line #565	-> byte code offset #246
    //   Java source line #569	-> byte code offset #247
    //   Java source line #562	-> byte code offset #250
    //   Java source line #564	-> byte code offset #255
    //   Java source line #565	-> byte code offset #263
    //   Java source line #570	-> byte code offset #264
    //   Java source line #571	-> byte code offset #268
    //   Java source line #573	-> byte code offset #269
    //   Java source line #575	-> byte code offset #272
    //   Java source line #577	-> byte code offset #281
    //   Java source line #578	-> byte code offset #283
    //   Java source line #580	-> byte code offset #288
    //   Java source line #581	-> byte code offset #293
    //   Java source line #583	-> byte code offset #294
    //   Java source line #584	-> byte code offset #310
    //   Java source line #586	-> byte code offset #311
    //   Java source line #587	-> byte code offset #323
    //   Java source line #588	-> byte code offset #331
    //   Java source line #590	-> byte code offset #332
    //   Java source line #591	-> byte code offset #344
    //   Java source line #592	-> byte code offset #352
    //   Java source line #593	-> byte code offset #355
    //   Java source line #595	-> byte code offset #363
    //   Java source line #596	-> byte code offset #373
    //   Java source line #600	-> byte code offset #374
    //   Java source line #602	-> byte code offset #381
    //   Java source line #603	-> byte code offset #386
    //   Java source line #604	-> byte code offset #390
    //   Java source line #606	-> byte code offset #391
    //   Java source line #607	-> byte code offset #403
    //   Java source line #608	-> byte code offset #412
    //   Java source line #609	-> byte code offset #421
    //   Java source line #610	-> byte code offset #427
    //   Java source line #611	-> byte code offset #441
    //   Java source line #612	-> byte code offset #453
    //   Java source line #613	-> byte code offset #461
    //   Java source line #615	-> byte code offset #464
    //   Java source line #616	-> byte code offset #476
    //   Java source line #617	-> byte code offset #484
    //   Java source line #619	-> byte code offset #487
    //   Java source line #620	-> byte code offset #507
    //   Java source line #621	-> byte code offset #512
    //   Java source line #623	-> byte code offset #515
    //   Java source line #624	-> byte code offset #533
    //   Java source line #625	-> byte code offset #538
    //   Java source line #627	-> byte code offset #541
    //   Java source line #628	-> byte code offset #553
    //   Java source line #629	-> byte code offset #559
    //   Java source line #630	-> byte code offset #573
    //   Java source line #631	-> byte code offset #583
    //   Java source line #632	-> byte code offset #588
    //   Java source line #634	-> byte code offset #591
    //   Java source line #635	-> byte code offset #597
    //   Java source line #636	-> byte code offset #609
    //   Java source line #637	-> byte code offset #623
    //   Java source line #638	-> byte code offset #636
    //   Java source line #639	-> byte code offset #648
    //   Java source line #640	-> byte code offset #657
    //   Java source line #641	-> byte code offset #664
    //   Java source line #642	-> byte code offset #670
    //   Java source line #643	-> byte code offset #684
    //   Java source line #641	-> byte code offset #699
    //   Java source line #645	-> byte code offset #709
    //   Java source line #646	-> byte code offset #721
    //   Java source line #647	-> byte code offset #742
    //   Java source line #648	-> byte code offset #756
    //   Java source line #649	-> byte code offset #758
    //   Java source line #647	-> byte code offset #767
    //   Java source line #628	-> byte code offset #774
    //   Java source line #609	-> byte code offset #789
    //   Java source line #652	-> byte code offset #804
    //   Java source line #653	-> byte code offset #821
    //   Java source line #654	-> byte code offset #837
    //   Java source line #652	-> byte code offset #838
    //   Java source line #655	-> byte code offset #841
    //   Java source line #656	-> byte code offset #846
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	847	0	this	ApiFilterStore
    //   68	10	1	filepath	IPath
    //   84	55	2	file	IResource
    //   134	139	3	xml	String
    //   136	120	4	contents	java.io.InputStream
    //   142	13	5	filterFile	org.eclipse.core.resources.IFile
    //   183	3	5	e	CoreException
    //   207	3	5	e	java.io.IOException
    //   270	122	5	root	Element
    //   231	17	6	localObject	Object
    //   281	3	6	ce	CoreException
    //   321	175	6	component	String
    //   342	22	7	versionValue	String
    //   350	27	8	currentVersion	int
    //   353	22	9	version	int
    //   401	394	10	resources	org.w3c.dom.NodeList
    //   410	432	11	newfilters	ArrayList
    //   419	405	12	comments	ArrayList
    //   422	371	13	i	int
    //   439	271	14	element	Element
    //   451	71	15	path	String
    //   474	283	16	typeName	String
    //   505	11	17	project	IProject
    //   531	214	18	resource	IResource
    //   551	229	19	filters	org.w3c.dom.NodeList
    //   554	224	20	j	int
    //   581	185	21	id	int
    //   595	164	22	messageargs	String[]
    //   607	17	23	elements	org.w3c.dom.NodeList
    //   634	3	24	messageArguments	Element
    //   646	25	25	arguments	org.w3c.dom.NodeList
    //   655	50	26	length	int
    //   665	38	27	k	int
    //   719	18	27	comment	String
    //   682	7	28	messageArgument	Element
    //   203	1	35	localIOException1	java.io.IOException
    //   227	1	36	localIOException2	java.io.IOException
    //   246	1	37	localIOException3	java.io.IOException
    //   263	1	38	localIOException4	java.io.IOException
    //   373	1	39	localNumberFormatException	NumberFormatException
    // Exception table:
    //   from	to	target	type
    //   138	180	183	org/eclipse/core/runtime/CoreException
    //   195	200	203	java/io/IOException
    //   138	180	207	java/io/IOException
    //   219	224	227	java/io/IOException
    //   138	190	231	finally
    //   207	214	231	finally
    //   238	243	246	java/io/IOException
    //   255	260	263	java/io/IOException
    //   272	278	281	org/eclipse/core/runtime/CoreException
    //   363	370	373	java/lang/NumberFormatException
  }
  
  private synchronized void internalAddFilters(IApiProblem[] problems, String[] comments, boolean persist)
  {
    Set filters = null;
    for (int i = 0; i < problems.length; i++)
    {
      IApiProblem problem = problems[i];
      IApiProblemFilter filter = new ApiProblemFilter(fProject.getElementName(), problem, comments == null ? null : comments[i]);
      String resourcePath = problem.getResourcePath();
      if (resourcePath != null)
      {
        IResource resource = fProject.getProject().findMember(new Path(resourcePath));
        if (resource != null)
        {
          Map pTypeNames = (Map)fFilterMap.get(resource);
          String typeName = problem.getTypeName();
          if (typeName == null) {
            typeName = "!global!";
          }
          if (pTypeNames == null)
          {
            filters = new HashSet();
            pTypeNames = new HashMap();
            pTypeNames.put(typeName, filters);
            fFilterMap.put(resource, pTypeNames);
          }
          else
          {
            filters = (Set)pTypeNames.get(typeName);
            if (filters == null)
            {
              filters = new HashSet();
              pTypeNames.put(typeName, filters);
            }
          }
          fNeedsSaving |= filters.add(filter);
        }
      }
    }
    if (persist) {
      persistApiFilters();
    } else {
      fNeedsSaving = false;
    }
  }
  
  public void needsSaving()
  {
    fNeedsSaving = true;
  }
  
  private static int loadIntegerAttribute(Element element, String name)
  {
    String value = element.getAttribute(name);
    if (value.length() == 0) {
      return -1;
    }
    try
    {
      return Integer.parseInt(value);
    }
    catch (NumberFormatException localNumberFormatException) {}
    return -1;
  }
  
  IPath getFilterFilePath(boolean includeproject)
  {
    if (includeproject)
    {
      IPath path = fProject.getPath();
      return path.append(".settings").append(".api_filters");
    }
    return new Path(".settings").append(".api_filters");
  }
  
  public synchronized void recordFilterUsage()
  {
    initializeApiFilters();
    fUnusedFilters = new HashMap();
    IResource resource = null;
    Map types = null;
    Set values = null;
    Iterator iter2;
    for (Iterator iter = fFilterMap.keySet().iterator(); iter.hasNext(); iter2.hasNext())
    {
      resource = (IResource)iter.next();
      types = (Map)fFilterMap.get(resource);
      values = new HashSet();
      fUnusedFilters.put(resource, values);
      iter2 = types.keySet().iterator(); continue;
      values.addAll((Set)types.get(iter2.next()));
    }
  }
  
  private void recordFilterUsed(IResource resource, IApiProblemFilter filter)
  {
    if (fUnusedFilters != null)
    {
      Set unused = (Set)fUnusedFilters.get(resource);
      if (unused != null)
      {
        unused.remove(filter);
        if (unused.isEmpty()) {
          fUnusedFilters.remove(resource);
        }
      }
    }
  }
  
  public IApiProblemFilter[] getUnusedFilters(IResource resource, String typeName, int[] categories)
  {
    if (fUnusedFilters != null)
    {
      Set unused = new HashSet();
      Set set = null;
      if (resource != null)
      {
        set = (Set)fUnusedFilters.get(resource);
        if (set != null) {
          collectFilterFor(set, typeName, unused, categories);
        }
        if (Util.isManifest(resource.getProjectRelativePath()))
        {
          IResource res = null;
          for (Iterator iter = fUnusedFilters.keySet().iterator(); iter.hasNext();)
          {
            res = (IResource)iter.next();
            if (!res.exists()) {
              if (res.getProject().equals(resource.getProject()))
              {
                set = (Set)fUnusedFilters.get(res);
                collectFilterFor(set, typeName, unused, categories);
              }
            }
          }
        }
      }
      
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