/**
  * Create a compilation unit that can be serialized from another {@link CompilationUnit}.
  *
  * @param unit A unit to copy
  * @param sourceToken A valid {@DiskCache} token for this unit's source code.
  * @param astToken A valid {@DiskCache} token for this unit's serialized AST types.
  */
 @SuppressWarnings("deprecation")
 CachedCompilationUnit(CompilationUnit unit, long sourceToken, long astToken) {
   assert unit != null;
   this.compiledClasses = unit.getCompiledClasses();
   this.contentId = unit.getContentId();
   this.dependencies = unit.getDependencies();
   this.resourceLocation = unit.getResourceLocation();
   this.resourcePath = unit.getResourcePath();
   this.jsniMethods = unit.getJsniMethods();
   this.lastModified = unit.getLastModified();
   this.methodArgNamesLookup = unit.getMethodArgs();
   this.typeName = unit.getTypeName();
   this.isError = unit.isError();
   this.isGenerated = unit.isGenerated();
   this.isSuperSource = unit.isSuperSource();
   CategorizedProblem[] problemsIn = unit.getProblems();
   if (problemsIn == null) {
     this.problems = null;
   } else {
     this.problems = new CategorizedProblem[problemsIn.length];
     for (int i = 0; i < problemsIn.length; i++) {
       this.problems[i] = new SerializableCategorizedProblem(problemsIn[i]);
     }
   }
   this.astToken = new DiskCacheToken(astToken);
   this.astVersion = GwtAstBuilder.getSerializationVersion();
   this.sourceToken = new DiskCacheToken(sourceToken);
 }