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

6: 
            newversion = new Version(refversion.getMajor(), refversion.getMinor() + 1, 0, compversion.getQualifier() != null ? "qualifier" : null);
            problem = createVersionProblem(
              5, 
              new String[] {
              compversionval, 
              componentID }, 
              
              String.valueOf(newversion), 
              "");
          }
          break;
        case 2: 
          info = checkBundleVersionsOfReexportedBundles(reference, component);
          if (info == null) {
            break;
          }
          switch (kind)
          {
          case 5: 
            newversion = new Version(compversion.getMajor() + 1, 0, 0, compversion.getQualifier() != null ? "qualifier" : null);
            problem = createVersionProblem(
              kind, 
              new String[] {
              compversionval, 
              componentID }, 
              
              String.valueOf(newversion), 
              "");
          }
          break;
        case 4: 
          info = checkBundleVersionsOfReexportedBundles(reference, component);
          if (info == null) {
            break;
          }
          switch (kind)
          {
          case 5: 
            newversion = new Version(compversion.getMajor() + 1, 0, 0, compversion.getQualifier() != null ? "qualifier" : null);
            problem = createVersionProblem(
              kind, 
              new String[] {
              compversionval, 
              componentID }, 
              
              String.valueOf(newversion), 
              "");
            break;
          case 6: 
            problem = null;
          }
          break;
        }
      }
      else
      {
        info = checkBundleVersionsOfReexportedBundles(reference, component);
        if (info != null) {
          switch (kind)
          {
          case 5: 
            if (compversion.getMajor() <= refversion.getMajor())
            {
              newversion = new Version(compversion.getMajor() + 1, 0, 0, compversion.getQualifier() != null ? "qualifier" : null);
              problem = createVersionProblem(
                kind, 
                new String[] {
                compversionval, 
                componentID }, 
                
                String.valueOf(newversion), 
                "");
            }
            break;
          case 6: 
            if (compversion.getMinor() <= refversion.getMinor())
            {
              newversion = new Version(compversion.getMajor(), compversion.getMinor() + 1, 0, compversion.getQualifier());
              problem = createVersionProblem(
                kind, 
                new String[] {
                compversionval, 
                componentID }, 
                
                String.valueOf(newversion), 
                "");
            }
            break;
          }
        }
      }
    }
    if (problem != null) {
      addProblem(problem);
    }
  }
  
  private String collectDetails(IDelta[] deltas)
  {
    StringWriter writer = new StringWriter();
    PrintWriter printWriter = new PrintWriter(writer);
    
    int max = Math.min(20, deltas.length);
    for (int i = 0; i < max; i++)
    {
      printWriter.print("- ");
      printWriter.println(deltas[i].getMessage());
      if ((i == max - 1) && (max < deltas.length)) {
        printWriter.println(NLS.bind(BuilderMessages.BaseApiAnalyzer_more_version_problems, new Integer(deltas.length - max)));
      }
    }
    printWriter.flush();
    printWriter.close();
    return String.valueOf(writer.getBuffer());
  }
  
  /* Error */
  private IApiProblem createVersionProblem(int kind, String[] messageargs, String version, String description)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore 5
    //   3: ldc_w 704
    //   6: astore 6
    //   8: aload_0
    //   9: getfield 1386	org/eclipse/pde/api/tools/internal/builder/BaseApiAnalyzer:fJavaProject	Lorg/eclipse/jdt/core/IJavaProject;
    //   12: ifnull +17 -> 29
    //   15: aload_0
    //   16: getfield 1386	org/eclipse/pde/api/tools/internal/builder/BaseApiAnalyzer:fJavaProject	Lorg/eclipse/jdt/core/IJavaProject;
    //   19: invokeinterface 1647 1 0
    //   24: invokestatic 1609	org/eclipse/pde/api/tools/internal/util/Util:getManifestFile	(Lorg/eclipse/core/resources/IProject;)Lorg/eclipse/core/resources/IResource;
    //   27: astore 5
    //   29: iconst_m1
    //   30: istore 7
    //   32: iconst_0
    //   33: istore 8
    //   35: iconst_1
    //   36: istore 9
    //   38: aconst_null
    //   39: checkcast 736	[C
    //   42: astore 10
    //   44: aload 5
    //   46: ifnull +247 -> 293
    //   49: aload 5
    //   51: invokeinterface 1634 1 0
    //   56: iconst_1
    //   57: if_icmpne +236 -> 293
    //   60: aload 5
    //   62: invokeinterface 1635 1 0
    //   67: invokeinterface 1638 1 0
    //   72: astore 6
    //   74: aload 5
    //   76: checkcast 768	org/eclipse/core/resources/IFile
    //   79: astore 11
    //   81: aconst_null
    //   82: astore 12
    //   84: aconst_null
    //   85: astore 13
    //   87: aload 11
    //   89: iconst_1
    //   90: invokeinterface 1632 2 0
    //   95: astore 12
    //   97: aload 12
    //   99: iconst_m1
    //   100: ldc_w 708
    //   103: invokestatic 1602	org/eclipse/pde/api/tools/internal/util/Util:getInputStreamAsCharArray	(Ljava/io/InputStream;ILjava/lang/String;)[C
    //   106: astore 10
    //   108: new 745	java/io/LineNumberReader
    //   111: dup
    //   112: new 742	java/io/BufferedReader
    //   115: dup
    //   116: new 748	java/io/StringReader
    //   119: dup
    //   120: new 756	java/lang/String
    //   123: dup
    //   124: aload 10
    //   126: invokespecial 1430	java/lang/String:<init>	([C)V
    //   129: invokespecial 1419	java/io/StringReader:<init>	(Ljava/lang/String;)V
    //   132: invokespecial 1408	java/io/BufferedReader:<init>	(Ljava/io/Reader;)V
    //   135: invokespecial 1411	java/io/LineNumberReader:<init>	(Ljava/io/Reader;)V
    //   138: astore 13
    //   140: iconst_0
    //   141: istore 14
    //   143: aconst_null
    //   144: astore 15
    //   146: goto +24 -> 170
    //   149: iinc 14 1
    //   152: aload 15
    //   154: ldc_w 679
    //   157: invokevirtual 1435	java/lang/String:startsWith	(Ljava/lang/String;)Z
    //   160: ifeq +10 -> 170
    //   163: iload 14
    //   165: istore 7
    //   167: goto +102 -> 269
    //   170: aload 13
    //   172: invokevirtual 1412	java/io/LineNumberReader:readLine	()Ljava/lang/String;
    //   175: dup
    //   176: astore 15
    //   178: ifnonnull -29 -> 149
    //   181: goto +88 -> 269
    //   184: pop
    //   185: aload 12
    //   187: ifnull +8 -> 195
    //   190: aload 12
    //   192: invokevirtual 1409	java/io/InputStream:close	()V
    //   195: aload 13
    //   197: ifnull +96 -> 293
    //   200: aload 13
    //   202: invokevirtual 1410	java/io/LineNumberReader:close	()V
    //   205: goto +88 -> 293
    //   208: pop
    //   209: goto +84 -> 293
    //   212: pop
    //   213: aload 12
    //   215: ifnull +8 -> 223
    //   218: aload 12
    //   220: invokevirtual 1409	java/io/InputStream:close	()V
    //   223: aload 13
    //   225: ifnull +68 -> 293
    //   228: aload 13
    //   230: invokevirtual 1410	java/io/LineNumberReader:close	()V
    //   233: goto +60 -> 293
    //   236: pop
    //   237: goto +56 -> 293
    //   240: astore 16
    //   242: aload 12
    //   244: ifnull +8 -> 252
    //   247: aload 12
    //   249: invokevirtual 1409	java/io/InputStream:close	()V
    //   252: aload 13
    //   254: ifnull +12 -> 266
    //   257: aload 13
    //   259: invokevirtual 1410	java/io/LineNumberReader:close	()V
    //   262: goto +4 -> 266
    //   265: pop
    //   266: aload 16
    //   268: athrow
    //   269: aload 12
    //   271: ifnull +8 -> 279
    //   274: aload 12
    //   276: invokevirtual 1409	java/io/InputStream:close	()V
    //   279: aload 13
    //   281: ifnull +12 -> 293
    //   284: aload 13
    //   286: invokevirtual 1410	java/io/LineNumberReader:close	()V
    //   289: goto +4 -> 293
    //   292: pop
    //   293: iload 7
    //   295: iconst_m1
    //   296: if_icmpeq +148 -> 444
    //   299: aload 10
    //   301: ifnull +143 -> 444
    //   304: ldc_w 679
    //   307: invokevirtual 1428	java/lang/String:toCharArray	()[C
    //   310: aload 10
    //   312: iconst_1
    //   313: invokestatic 1478	org/eclipse/jdt/core/compiler/CharOperation:indexOf	([C[CZ)I
    //   316: istore 11
    //   318: iload 11
    //   320: ldc_w 679
    //   323: invokevirtual 1427	java/lang/String:length	()I
    //   326: iadd
    //   327: iconst_1
    //   328: iadd
    //   329: istore 12
    //   331: aload 10
    //   333: arraylength
    //   334: istore 13
    //   336: goto +31 -> 367
    //   339: aload 10
    //   341: iload 12
    //   343: caload
    //   344: istore 14
    //   346: iload 14
    //   348: invokestatic 1477	org/eclipse/jdt/core/compiler/CharOperation:isWhitespace	(C)Z
    //   351: ifeq +6 -> 357
    //   354: goto +10 -> 364
    //   357: iload 12
    //   359: istore 8
    //   361: goto +13 -> 374
    //   364: iinc 12 1
    //   367: iload 12
    //   369: iload 13
    //   371: if_icmplt -32 -> 339
    //   374: iload 8
    //   376: iconst_1
    //   377: iadd
    //   378: istore 12
    //   380: aload 10
    //   382: arraylength
    //   383: istore 13
    //   385: goto +49 -> 434
    //   388: aload 10
    //   390: iload 12
    //   392: caload
    //   393: tableswitch	default:+38->431, 10:+31->424, 11:+38->431, 12:+38->431, 13:+31->424
    //   424: iload 12
    //   426: istore 9
    //   428: goto +19 -> 447
    //   431: iinc 12 1
    //   434: iload 12
    //   436: iload 13
    //   438: if_icmplt -50 -> 388
    //   441: goto +6 -> 447
    //   444: iconst_1
    //   445: istore 7
    //   447: aload 6
    //   449: aconst_null
    //   450: aload_2
    //   451: iconst_3
    //   452: anewarray 756	java/lang/String
    //   455: dup
    //   456: iconst_0
    //   457: ldc_w 735
    //   460: aastore
    //   461: dup
    //   462: iconst_1
    //   463: ldc_w 713
    //   466: aastore
    //   467: dup
    //   468: iconst_2
    //   469: ldc_w 718
    //   472: aastore
    //   473: iconst_3
    //   474: anewarray 754	java/lang/Object
    //   477: dup
    //   478: iconst_0
    //   479: aload_3
    //   480: aastore
    //   481: dup
    //   482: iconst_1
    //   483: new 752	java/lang/Integer
    //   486: dup
    //   487: iconst_4
    //   488: invokespecial 1422	java/lang/Integer:<init>	(I)V
    //   491: aastore
    //   492: dup
    //   493: iconst_2
    //   494: aload 4
    //   496: aastore
    //   497: iload 7
    //   499: iload 8
    //   501: iload 9
    //   503: bipush 7
    //   505: iload_1
    //   506: invokestatic 1573	org/eclipse/pde/api/tools/internal/problems/ApiProblemFactory:newApiVersionNumberProblem	(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;IIIII)Lorg/eclipse/pde/api/tools/internal/provisional/problems/IApiProblem;
    //   509: areturn
    // Line number table:
    //   Java source line #2059	-> byte code offset #0
    //   Java source line #2060	-> byte code offset #3
    //   Java source line #2061	-> byte code offset #8
    //   Java source line #2062	-> byte code offset #15
    //   Java source line #2066	-> byte code offset #29
    //   Java source line #2067	-> byte code offset #32
    //   Java source line #2068	-> byte code offset #35
    //   Java source line #2069	-> byte code offset #38
    //   Java source line #2070	-> byte code offset #44
    //   Java source line #2071	-> byte code offset #60
    //   Java source line #2072	-> byte code offset #74
    //   Java source line #2073	-> byte code offset #81
    //   Java source line #2074	-> byte code offset #84
    //   Java source line #2076	-> byte code offset #87
    //   Java source line #2077	-> byte code offset #97
    //   Java source line #2078	-> byte code offset #108
    //   Java source line #2079	-> byte code offset #140
    //   Java source line #2080	-> byte code offset #143
    //   Java source line #2081	-> byte code offset #146
    //   Java source line #2082	-> byte code offset #149
    //   Java source line #2083	-> byte code offset #152
    //   Java source line #2084	-> byte code offset #163
    //   Java source line #2085	-> byte code offset #167
    //   Java source line #2081	-> byte code offset #170
    //   Java source line #2088	-> byte code offset #184
    //   Java source line #2094	-> byte code offset #185
    //   Java source line #2095	-> byte code offset #190
    //   Java source line #2097	-> byte code offset #195
    //   Java source line #2098	-> byte code offset #200
    //   Java source line #2100	-> byte code offset #208
    //   Java source line #2090	-> byte code offset #212
    //   Java source line #2094	-> byte code offset #213
    //   Java source line #2095	-> byte code offset #218
    //   Java source line #2097	-> byte code offset #223
    //   Java source line #2098	-> byte code offset #228
    //   Java source line #2100	-> byte code offset #236
    //   Java source line #2092	-> byte code offset #240
    //   Java source line #2094	-> byte code offset #242
    //   Java source line #2095	-> byte code offset #247
    //   Java source line #2097	-> byte code offset #252
    //   Java source line #2098	-> byte code offset #257
    //   Java source line #2100	-> byte code offset #265
    //   Java source line #2103	-> byte code offset #266
    //   Java source line #2094	-> byte code offset #269
    //   Java source line #2095	-> byte code offset #274
    //   Java source line #2097	-> byte code offset #279
    //   Java source line #2098	-> byte code offset #284
    //   Java source line #2100	-> byte code offset #292
    //   Java source line #2105	-> byte code offset #293
    //   Java source line #2107	-> byte code offset #304
    //   Java source line #2108	-> byte code offset #318
    //   Java source line #2109	-> byte code offset #339
    //   Java source line #2110	-> byte code offset #346
    //   Java source line #2111	-> byte code offset #354
    //   Java source line #2113	-> byte code offset #357
    //   Java source line #2114	-> byte code offset #361
    //   Java source line #2108	-> byte code offset #364
    //   Java source line #2116	-> byte code offset #374
    //   Java source line #2117	-> byte code offset #388
    //   Java source line #2120	-> byte code offset #424
    //   Java source line #2121	-> byte code offset #428
    //   Java source line #2116	-> byte code offset #431
    //   Java source line #2125	-> byte code offset #444
    //   Java source line #2127	-> byte code offset #447
    //   Java source line #2128	-> byte code offset #449
    //   Java source line #2129	-> byte code offset #450
    //   Java source line #2130	-> byte code offset #451
    //   Java source line #2131	-> byte code offset #457
    //   Java source line #2132	-> byte code offset #463
    //   Java source line #2133	-> byte code offset #469
    //   Java source line #2135	-> byte code offset #473
    //   Java source line #2136	-> byte code offset #479
    //   Java source line #2137	-> byte code offset #483
    //   Java source line #2138	-> byte code offset #494
    //   Java source line #2140	-> byte code offset #497
    //   Java source line #2141	-> byte code offset #499
    //   Java source line #2142	-> byte code offset #501
    //   Java source line #2143	-> byte code offset #503
    //   Java source line #2144	-> byte code offset #505
    //   Java source line #2127	-> byte code offset #506
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	510	0	this	BaseApiAnalyzer
    //   0	510	1	kind	int
    //   0	510	2	messageargs	String[]
    //   0	510	3	version	String
    //   0	510	4	description	String
    //   1	74	5	manifestFile	IResource
    //   6	442	6	path	String
    //   30	468	7	lineNumber	int
    //   33	467	8	charStart	int
    //   36	466	9	charEnd	int
    //   42	347	10	contents	char[]
    //   79	9	11	file	org.eclipse.core.resources.IFile
    //   316	3	11	index	int
    //   82	193	12	inputStream	java.io.InputStream
    //   329	39	12	i	int
    //   378	57	12	i	int
    //   85	200	13	reader	java.io.LineNumberReader
    //   334	36	13	max	int
    //   383	54	13	max	int
    //   141	23	14	lineCounter	int
    //   344	3	14	currentCharacter	char
    //   144	33	15	line	String
    //   240	27	16	localObject	Object
    //   184	1	23	localCoreException	CoreException
    //   208	1	24	localIOException1	java.io.IOException
    //   212	1	25	localIOException2	java.io.IOException
    //   236	1	26	localIOException3	java.io.IOException
    //   265	1	27	localIOException4	java.io.IOException
    //   292	1	28	localIOException5	java.io.IOException
    // Exception table:
    //   from	to	target	type
    //   87	181	184	org/eclipse/core/runtime/CoreException
    //   185	205	208	java/io/IOException
    //   87	181	212	java/io/IOException
    //   213	233	236	java/io/IOException
    //   87	185	240	finally
    //   212	213	240	finally
    //   242	262	265	java/io/IOException
    //   269	289	292	java/io/IOException
  }
  
  private void checkDefaultBaselineSet()
  {
    if (ignoreDefaultBaselineCheck())
    {
      if (DEBUG) {
        System.out.println("Ignoring check for default API baseline");
      }
      return;
    }
    if (DEBUG) {
      System.out.println("Checking if the default api baseline is set");
    }
    IApiProblem problem = ApiProblemFactory.newApiBaselineProblem(
      Path.EMPTY.toString(), 
      new String[] { "apiMarkerID" }, 
      new Object[] { new Integer(1) }, 
      7, 
      1);
    addProblem(problem);
  }
  
  private IJavaProject getJavaProject(IApiComponent component)
  {
    if ((component instanceof ProjectComponent))
    {
      ProjectComponent pp = (ProjectComponent)component;
      return pp.getJavaProject();
    }
    return null;
  }
  
  private boolean addProblem(IApiProblem problem)
  {
    if ((problem == null) || (isProblemFiltered(problem))) {
      return false;
    }
    return fProblems.add(problem);
  }
  
  private boolean isProblemFiltered(IApiProblem problem)
  {
    if (fJavaProject == null)
    {
      if (fFilterStore != null)
      {
        boolean filtered = fFilterStore.isFiltered(problem);
        if (filtered) {
          return true;
        }
      }
      if (fPreferences != null)
      {
        String key = ApiProblemFactory.getProblemSeverityId(problem);
        if (key != null)
        {
          String value = fPreferences.getProperty(key, null);
          return "Ignore".equals(value);
        }
      }
      return false;
    }
    IProject project = fJavaProject.getProject();
    if (ApiPlugin.getDefault().getSeverityLevel(ApiProblemFactory.getProblemSeverityId(problem), project) == 0) {
      return true;
    }
    IApiBaselineManager manager = ApiBaselineManager.getManager();
    IApiBaseline baseline = manager.getWorkspaceBaseline();
    if (baseline == null) {
      return false;
    }
    IApiComponent component = baseline.getApiComponent(project);
    if (component != null) {
      try
      {
        IApiFilterStore filterStore = component.getFilterStore();
        if (filterStore != null) {
          return filterStore.isFiltered(problem);
        }
      }
      catch (CoreException localCoreException) {}
    }
    return false;
  }
}

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

import org.eclipse.jdt.internal.core.builder.StringSet;
import org.eclipse.pde.api.tools.internal.provisional.builder.IBuildContext;

public class BuildContext
  implements IBuildContext
{
  private static final String[] NO_TYPES = new String[0];
  private StringSet structualChanges = null;
  private StringSet removedTypes = null;
  private StringSet descriptionChanges = null;
  private StringSet descriptionDepedents = null;
  
  public String[] getStructurallyChangedTypes()
  {
    if (structualChanges == null) {
      return NO_TYPES;
    }
    return structualChanges.values;
  }
  
  public String[] getDescriptionChangedTypes()
  {
    if (descriptionChanges == null) {
      return NO_TYPES;
    }
    return descriptionChanges.values;
  }
  
  public String[] getRemovedTypes()
  {
    if (removedTypes == null) {
      return NO_TYPES;
    }
    return removedTypes.values;
  }
  
  public boolean hasStructuralChanges()
  {
    int count = structualChanges == null ? 0 : structualChanges.elementSize;
    count += (removedTypes == null ? 0 : removedTypes.elementSize);
    return count > 0;
  }
  
  public boolean hasDescriptionChanges()
  {
    return (descriptionChanges == null ? 0 : descriptionChanges.elementSize) > 0;
  }
  
  public boolean hasDescriptionDependents()
  {
    return (descriptionDepedents == null ? 0 : descriptionDepedents.elementSize) > 0;
  }
  
  public boolean hasRemovedTypes()
  {
    return (removedTypes == null ? 0 : removedTypes.elementSize) > 0;
  }
  
  public void recordStructuralChange(String typename)
  {
    if (typename == null) {
      return;
    }
    if (structualChanges == null) {
      structualChanges = new StringSet(16);
    }
    structualChanges.add(typename.replace('/', '.'));
  }
  
  public void recordRemovedType(String typename)
  {
    if (typename == null) {
      return;
    }
    if (removedTypes == null) {
      removedTypes = new StringSet(16);
    }
    removedTypes.add(typename.replace('/', '.'));
  }
  
  public void recordDescriptionChanged(String typename)
  {
    if (typename != null)
    {
      if (descriptionChanges == null) {
        descriptionChanges = new StringSet(16);
      }
      descriptionChanges.add(typename.replace('/', '.'));
    }
  }
  
  public void recordDescriptionDependent(String typename)
  {
    if (typename == null) {
      return;
    }
    if (descriptionDepedents == null) {
      descriptionDepedents = new StringSet(16);
    }
    descriptionDepedents.add(typename.replace('/', '.'));
  }
  
  public void dispose()
  {
    if (structualChanges != null)
    {
      structualChanges.clear();
      structualChanges = null;
    }
    if (removedTypes != null)
    {
      removedTypes.clear();
      removedTypes = null;
    }
    if (descriptionChanges != null)
    {
      descriptionChanges.clear();
      descriptionChanges = null;
    }
    if (descriptionDepedents != null)
    {
      descriptionDepedents.clear();
      descriptionDepedents = null;
    }
  }
  
  public boolean hasTypes()
  {
    return (hasStructuralChanges()) || (hasRemovedTypes()) || (hasDescriptionChanges()) || (hasDescriptionDependents());
  }
  
  public boolean containsStructuralChange(String typename)
  {
    if (typename == null) {
      return false;
    }
    return (structualChanges != null) && (structualChanges.includes(typename.replace('/', '.')));
  }
  
  public boolean containsDescriptionChange(String typename)
  {
    if (typename == null) {
      return false;
    }
    return (descriptionChanges != null) && (descriptionChanges.includes(typename.replace('/', '.')));
  }
  
  public boolean containsDescriptionDependent(String typename)
  {
    if (typename == null) {
      return false;
    }
    return (descriptionDepedents != null) && (descriptionDepedents.includes(typename.replace('/', '.')));
  }
  
  public boolean containsRemovedType(String typename)
  {
    if (typename == null) {
      return false;
    }
    return (removedTypes != null) && (removedTypes.includes(typename.replace('/', '.')));
  }
  
  public String[] getDescriptionDependentTypes()
  {
    if (descriptionDepedents == null) {
      return NO_TYPES;
    }
    return descriptionDepedents.values;
  }
}

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

import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.resources.IProject;

public class BuildStamps
{
  private static Map fStamps = new HashMap();
  
  public static synchronized long getBuildStamp(IProject project)
  {
    long[] stamp = (long[])fStamps.get(project);
    if (stamp != null) {
      return stamp[0];
    }
    return 0L;
  }
  
  public static synchronized void incBuildStamp(IProject project)
  {
    long[] stamp = (long[])fStamps.get(project);
    if (stamp != null)
    {
      int tmp21_20 = 0; long[] tmp21_19 = stamp; long tmp23_22 = tmp21_19[tmp21_20];tmp21_19[tmp21_20] = (tmp23_22 + 1L);stamp[0] = tmp23_22;
    }
    else
    {
      fStamps.put(project, new long[] { 1L });
    }
  }
}

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

import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.zip.CRC32;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.pde.api.tools.internal.comparator.Delta;
import org.eclipse.pde.api.tools.internal.provisional.comparator.IDelta;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent;
import org.eclipse.pde.api.tools.internal.util.Util;
import org.eclipse.pde.core.build.IBuild;
import org.eclipse.pde.core.build.IBuildEntry;
import org.eclipse.pde.core.build.IBuildModel;

public class BuildState
{
  private static final IDelta[] EMPTY_DELTAS = new IDelta[0];
  private static final String[] NO_REEXPORTED_COMPONENTS = new String[0];
  private static final int VERSION = 32;
  private Map compatibleChanges;
  private Map breakingChanges;
  private Map manifestChanges;
  private Map buildPropChanges;
  private String[] reexportedComponents;
  private Set apiToolingDependentProjects;
  private long buildpathCRC = -1L;
  
  BuildState()
  {
    compatibleChanges = new HashMap();
    breakingChanges = new HashMap();
    manifestChanges = new HashMap();
    buildPropChanges = new HashMap();
  }
  
  public static BuildState read(DataInputStream in)
    throws IOException
  {
    String pluginID = in.readUTF();
    if (!pluginID.equals("org.eclipse.pde.api.tools")) {
      throw new IOException(BuilderMessages.build_wrongFileFormat);
    }
    String kind = in.readUTF();
    if (!kind.equals("STATE")) {
      throw new IOException(BuilderMessages.build_wrongFileFormat);
    }
    if (in.readInt() != 32) {
      return null;
    }
    if (in.readBoolean())
    {
      BuildState state = new BuildState();
      buildpathCRC = in.readLong();
      int count = in.readInt();
      for (int i = 0; i < count; i++) {
        state.addCompatibleChange(readDelta(in));
      }
      count = in.readInt();
      for (int i = 0; i < count; i++) {
        state.addBreakingChange(readDelta(in));
      }
      count = in.readInt();
      
      String[] components = new String[count];
      for (int i = 0; i < count; i++) {
        components[i] = in.readUTF();
      }
      reexportedComponents = components;
      count = in.readInt();
      for (int i = 0; i < count; i++) {
        state.addApiToolingDependentProject(in.readUTF());
      }
      if (in.available() > 0)
      {
        count = in.readInt();
        if (count > 0)
        {
          HashMap map = new HashMap(count);
          for (int i = 0; i < count; i++)
          {
            String key = in.readUTF();
            String value = in.readUTF();
            map.put(key, value);
          }
          state.setManifestState(map);
        }
        count = in.readInt();
        if (count > 0)
        {
          HashMap map = new HashMap(count);
          for (int i = 0; i < count; i++)
          {
            String key = in.readUTF();
            String value = in.readUTF();
            map.put(key, value);
          }
          state.setBuildPropertiesState(map);
        }
      }
      return state;
    }
    return null;
  }
  
  public static void write(BuildState state, DataOutputStream out)
    throws IOException
  {
    out.writeUTF("org.eclipse.pde.api.tools");
    out.writeUTF("STATE");
    out.writeInt(32);
    out.writeBoolean(true);
    out.writeLong(buildpathCRC);
    IDelta[] compatibleChangesDeltas = state.getCompatibleChanges();
    int length = compatibleChangesDeltas.length;
    out.writeInt(length);
    for (int i = 0; i < length; i++) {
      writeDelta(compatibleChangesDeltas[i], out);
    }
    IDelta[] breakingChangesDeltas = state.getBreakingChanges();
    length = breakingChangesDeltas.length;
    out.writeInt(length);
    for (int i = 0; i < length; i++) {
      writeDelta(breakingChangesDeltas[i], out);
    }
    String[] reexportedComponents = state.getReexportedComponents();
    length = reexportedComponents.length;
    out.writeInt(length);
    for (int i = 0; i < length; i++) {
      out.writeUTF(reexportedComponents[i]);
    }
    Set apiToolingDependentsProjects = state.getApiToolingDependentProjects();
    length = apiToolingDependentsProjects.size();
    out.writeInt(length);
    for (Iterator iterator = apiToolingDependentsProjects.iterator(); iterator.hasNext();) {
      out.writeUTF((String)iterator.next());
    }
    Map map = state.getManifestState();
    out.writeInt(map.size());
    Map.Entry entry = null;
    for (Iterator i = map.entrySet().iterator(); i.hasNext();)
    {
      entry = (Map.Entry)i.next();
      out.writeUTF((String)entry.getKey());
      out.writeUTF((String)entry.getValue());
    }
    map = state.getBuildPropertiesState();
    out.writeInt(map.size());
    entry = null;
    for (Iterator i = map.entrySet().iterator(); i.hasNext();)
    {
      entry = (Map.Entry)i.next();
      out.writeUTF((String)entry.getKey());
      out.writeUTF((String)entry.getValue());
    }
  }
  
  private static IDelta readDelta(DataInputStream in)
    throws IOException
  {
    boolean hasComponentID = in.readBoolean();
    String componentID = null;
    if (hasComponentID) {
      in.readUTF();
    }
    int elementType = in.readInt();
    int kind = in.readInt();
    int flags = in.readInt();
    int restrictions = in.readInt();
    int modifiers = in.readInt();
    String typeName = in.readUTF();
    String key = in.readUTF();
    int length = in.readInt();
    String[] datas = (String[])null;
    if (length != 0)
    {
      ArrayList arguments = new ArrayList();
      for (int i = 0; i < length; i++) {
        arguments.add(in.readUTF());
      }
      datas = new String[length];
      arguments.toArray(datas);
    }
    else
    {
      datas = new String[1];
      datas[0] = typeName.replace('$', '.');
    }
    int oldModifiers = modifiers & 0xFFFF;
    int newModifiers = modifiers >>> 16;
    int previousRestrictions = restrictions >>> 16;
    int currentRestrictions = restrictions & 0xFFFF;
    return new Delta(componentID, elementType, kind, flags, currentRestrictions, previousRestrictions, oldModifiers, newModifiers, typeName, key, datas);
  }
  
  private static void writeDelta(IDelta delta, DataOutputStream out)
    throws IOException
  {
    String apiComponentID = delta.getComponentVersionId();
    boolean hasComponentID = apiComponentID != null;
    out.writeBoolean(hasComponentID);
    if (hasComponentID) {
      out.writeUTF(apiComponentID);
    }
    out.writeInt(delta.getElementType());
    out.writeInt(delta.getKind());
    out.writeInt(delta.getFlags());
    out.writeInt(delta.getCurrentRestrictions());
    int modifiers = delta.getNewModifiers() << 16 | delta.getOldModifiers();
    out.writeInt(modifiers);
    out.writeUTF(delta.getTypeName());
    out.writeUTF(delta.getKey());
    String[] arguments = delta.getArguments();
    int length = arguments.length;
    out.writeInt(length);
    for (int i = 0; i < length; i++) {
      out.writeUTF(arguments[i]);
    }
  }
  
  public void addCompatibleChange(IDelta delta)
  {
    String typeName = delta.getTypeName();
    Set object = (Set)compatibleChanges.get(typeName);
    if (object == null)
    {
      Set changes = new HashSet();
      changes.add(delta);
      compatibleChanges.put(typeName, changes);
    }
    else
    {
      object.add(delta);
    }
  }
  
  public void addBreakingChange(IDelta delta)
  {
    String typeName = delta.getTypeName();
    Set object = (Set)breakingChanges.get(typeName);
    if (object == null)
    {
      Set changes = new HashSet();
      changes.add(delta);
      breakingChanges.put(typeName, changes);
    }
    else
    {
      object.add(delta);
    }
  }
  
  public IDelta[] getBreakingChanges()
  {
    if ((breakingChanges == null) || (breakingChanges.size() == 0)) {
      return EMPTY_DELTAS;
    }
    HashSet collector = new HashSet();
    Collection values = breakingChanges.values();
    for (Iterator iterator = values.iterator(); iterator.hasNext();) {
      collector.addAll((HashSet)iterator.next());
    }
    return (IDelta[])collector.toArray(new IDelta[collector.size()]);
  }
  
  public IDelta[] getCompatibleChanges()
  {
    if ((compatibleChanges == null) || (compatibleChanges.size() == 0)) {
      return EMPTY_DELTAS;
    }
    HashSet collector = new HashSet();
    Collection values = compatibleChanges.values();
    for (Iterator iterator = values.iterator(); iterator.hasNext();) {
      collector.addAll((HashSet)iterator.next());
    }
    return (IDelta[])collector.toArray(new IDelta[collector.size()]);
  }
  
  public String[] getReexportedComponents()
  {
    if (reexportedComponents == null) {
      return NO_REEXPORTED_COMPONENTS;
    }
    return reexportedComponents;
  }
  
  public void cleanup(String typeName)
  {
    breakingChanges.remove(typeName);
    compatibleChanges.remove(typeName);
    reexportedComponents = null;
  }
  
  public void setReexportedComponents(IApiComponent[] components)
  {
    if (components == null) {
      return;
    }
    if (reexportedComponents == null)
    {
      int length = components.length;
      String[] result = new String[length];
      for (int i = 0; i < length; i++) {
        result[i] = components[i].getSymbolicName();
      }
      reexportedComponents = result;
    }
  }
  
  public void addApiToolingDependentProject(String projectName)
  {
    if (apiToolingDependentProjects == null) {
      apiToolingDependentProjects = new HashSet(3);
    }
    apiToolingDependentProjects.add(projectName);
  }
  
  public Set getApiToolingDependentProjects()
  {
    return apiToolingDependentProjects == null ? Collections.EMPTY_SET : apiToolingDependentProjects;
  }
  
  public void setManifestState(Map state)
  {
    if (state != null)
    {
      Map compact = new HashMap(7);
      for (Iterator i = ApiAnalysisBuilder.IMPORTANT_HEADERS.iterator(); i.hasNext();)
      {
        String key = (String)i.next();
        Object val = state.get(key);
        if (val != null) {
          compact.put(key, val);
        }
      }
      manifestChanges = compact;
    }
    else
    {
      manifestChanges.clear();
    }
  }
  
  public Map getManifestState()
  {
    return manifestChanges;
  }
  
  public void setBuildPropertiesState(IBuildModel model)
  {
    if (model != null)
    {
      IBuildEntry[] entries = model.getBuild().getBuildEntries();
      String name = null;
      for (int i = 0; i < entries.length; i++)
      {
        name = entries[i].getName();
        if ("custom".equals(name)) {
          buildPropChanges.put("custom", Util.deepToString(entries[i].getTokens()));
        } else if (name.startsWith("source.")) {
          buildPropChanges.put(name, Util.deepToString(entries[i].getTokens()));
        } else if (name.startsWith("extra.")) {
          buildPropChanges.put(name, Util.deepToString(entries[i].getTokens()));
        }
      }
    }
    else
    {
      buildPropChanges.clear();
    }
  }
  
  void setBuildPropertiesState(Map map)
  {
    if (map != null) {
      buildPropChanges = map;
    } else {
      buildPropChanges.clear();
    }
  }
  
  public Map getBuildPropertiesState()
  {
    return buildPropChanges;
  }
  
  public long getBuildPathCRC()
  {
    return buildpathCRC;
  }
  
  public void setBuildPathCRC(long crc32)
  {
    buildpathCRC = crc32;
  }
  
  public static BuildState getLastBuiltState(IProject project)
    throws CoreException
  {
    if (!Util.isApiProject(project)) {
      return null;
    }
    return readState(project);
  }
  
  static BuildState readState(IProject project)
    throws CoreException
  {
    File file = getSerializationFile(project);
    if ((file != null) && (file.exists())) {
      try
      {
        DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
        try
        {
          return read(in);
        }
        finally
        {
          if (ApiAnalysisBuilder.DEBUG) {
            System.out.println("Saved state thinks last build failed for " + project.getName());
          }
          in.close();
        }
        if (!ApiAnalysisBuilder.DEBUG) {
          break label243;
        }
      }
      catch (Exception e)
      {
        e.printStackTrace();
        throw new CoreException(new Status(4, "org.eclipse.jdt.core", 2, "Error reading last build state for project " + project.getName(), e));
      }
    }
    if (file == null) {
      System.out.println("Project does not exist: " + project);
    } else {
      System.out.println("Build state file " + file.getPath() + " does not exist");
    }
    label243:
    return null;
  }
  
  public static void setLastBuiltState(IProject project, BuildState state)
    throws CoreException
  {
    if (Util.isApiProject(project)) {
      if (state != null) {
        saveBuiltState(project, state);
      } else {
        try
        {
          File file = getSerializationFile(project);
          if ((file != null) && (file.exists())) {
            file.delete();
          }
        }
        catch (SecurityException localSecurityException) {}
      }
    }
  }
  
  static File getSerializationFile(IProject project)
  {
    if (!project.exists()) {
      return null;
    }
    IPath workingLocation = project.getWorkingLocation("org.eclipse.pde.api.tools");
    return workingLocation.append("state.dat").toFile();
  }
  
  /* Error */
  static void saveBuiltState(IProject project, BuildState state)
    throws CoreException
  {
    // Byte code:
    //   0: getstatic 477	org/eclipse/pde/api/tools/internal/builder/ApiAnalysisBuilder:DEBUG	Z
    //   3: ifeq +31 -> 34
    //   6: getstatic 475	java/lang/System:out	Ljava/io/PrintStream;
    //   9: new 261	java/lang/StringBuffer
    //   12: dup
    //   13: ldc_w 239
    //   16: invokespecial 521	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   19: aload_0
    //   20: invokeinterface 582 1 0
    //   25: invokevirtual 523	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   28: invokevirtual 520	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   31: invokevirtual 512	java/io/PrintStream:println	(Ljava/lang/String;)V
    //  
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-2017. Infinite Loop Ltd