org.eclipse.jdt.compiler.tool_1.0.100.v_B79_R37x

16:45:01.072 INFO  jd.cli.Main - Decompiling org.eclipse.jdt.compiler.tool_1.0.100.v_B79_R37x.jar
package org.eclipse.jdt.internal.compiler.tool;

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;

public class Archive
{
  public static final Archive UNKNOWN_ARCHIVE = new Archive();
  ZipFile zipFile;
  File file;
  protected Hashtable<String, ArrayList<String>> packagesCache;
  
  private Archive() {}
  
  public Archive(File file)
    throws ZipException, IOException
  {
    this.file = file;
    zipFile = new ZipFile(file);
    initialize();
  }
  
  private void initialize()
  {
    packagesCache = new Hashtable();
    for (Enumeration<? extends ZipEntry> e = zipFile.entries(); e.hasMoreElements();)
    {
      String fileName = ((ZipEntry)e.nextElement()).getName();
      
      int last = fileName.lastIndexOf('/');
      
      String packageName = fileName.substring(0, last + 1);
      String typeName = fileName.substring(last + 1);
      ArrayList<String> types = (ArrayList)packagesCache.get(packageName);
      if (types == null)
      {
        if (typeName.length() != 0)
        {
          types = new ArrayList();
          types.add(typeName);
          packagesCache.put(packageName, types);
        }
      }
      else {
        types.add(typeName);
      }
    }
  }
  
  public ArchiveFileObject getArchiveFileObject(String entryName, Charset charset)
  {
    return new ArchiveFileObject(file, zipFile, entryName, charset);
  }
  
  public boolean contains(String entryName)
  {
    return zipFile.getEntry(entryName) != null;
  }
  
  public Set<String> allPackages()
  {
    if (packagesCache == null) {
      initialize();
    }
    return packagesCache.keySet();
  }
  
  public ArrayList<String> getTypes(String packageName)
  {
    return (ArrayList)packagesCache.get(packageName);
  }
  
  public void flush()
  {
    packagesCache = null;
  }
  
  public void close()
  {
    try
    {
      if (zipFile != null) {
        zipFile.close();
      }
      packagesCache = null;
    }
    catch (IOException localIOException) {}
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.compiler.tool.Archive
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.compiler.tool;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.NestingKind;
import javax.tools.JavaFileObject;
import javax.tools.JavaFileObject.Kind;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;

public class ArchiveFileObject
  implements JavaFileObject
{
  private ZipEntry zipEntry;
  private ZipFile zipFile;
  private String entryName;
  private File file;
  private Charset charset;
  
  public ArchiveFileObject(File file, ZipFile zipFile, String entryName, Charset charset)
  {
    this.zipFile = zipFile;
    zipEntry = zipFile.getEntry(entryName);
    this.entryName = entryName;
    this.file = file;
    this.charset = charset;
  }
  
  public Modifier getAccessLevel()
  {
    if (getKind() != JavaFileObject.Kind.CLASS) {
      return null;
    }
    ClassFileReader reader = null;
    try
    {
      reader = ClassFileReader.read(zipFile, entryName);
    }
    catch (ClassFormatException localClassFormatException) {}catch (IOException localIOException) {}
    if (reader == null) {
      return null;
    }
    int accessFlags = reader.accessFlags();
    if ((accessFlags & 0x1) != 0) {
      return Modifier.PUBLIC;
    }
    if ((accessFlags & 0x400) != 0) {
      return Modifier.ABSTRACT;
    }
    if ((accessFlags & 0x10) != 0) {
      return Modifier.FINAL;
    }
    return null;
  }
  
  public JavaFileObject.Kind getKind()
  {
    String name = entryName.toLowerCase();
    if (name.endsWith(CLASSextension)) {
      return JavaFileObject.Kind.CLASS;
    }
    if (name.endsWith(SOURCEextension)) {
      return JavaFileObject.Kind.SOURCE;
    }
    if (name.endsWith(HTMLextension)) {
      return JavaFileObject.Kind.HTML;
    }
    return JavaFileObject.Kind.OTHER;
  }
  
  public NestingKind getNestingKind()
  {
    switch (getKind())
    {
    case CLASS: 
      return NestingKind.TOP_LEVEL;
    case HTML: 
      ClassFileReader reader = null;
      try
      {
        reader = ClassFileReader.read(zipFile, entryName);
      }
      catch (ClassFormatException localClassFormatException) {}catch (IOException localIOException) {}
      if (reader == null) {
        return null;
      }
      if (reader.isAnonymous()) {
        return NestingKind.ANONYMOUS;
      }
      if (reader.isLocal()) {
        return NestingKind.LOCAL;
      }
      if (reader.isMember()) {
        return NestingKind.MEMBER;
      }
      return NestingKind.TOP_LEVEL;
    }
    return null;
  }
  
  public boolean isNameCompatible(String simpleName, JavaFileObject.Kind kind)
  {
    return zipEntry.getName().endsWith(simpleName + extension);
  }
  
  public boolean delete()
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean equals(Object o)
  {
    if (!(o instanceof ArchiveFileObject)) {
      return false;
    }
    ArchiveFileObject archiveFileObject = (ArchiveFileObject)o;
    return archiveFileObject.toUri().equals(toUri());
  }
  
  public CharSequence getCharContent(boolean ignoreEncodingErrors)
    throws IOException
  {
    if (getKind() == JavaFileObject.Kind.SOURCE) {
      return Util.getCharContents(this, ignoreEncodingErrors, org.eclipse.jdt.internal.compiler.util.Util.getZipEntryByteContent(zipEntry, zipFile), charset.name());
    }
    return null;
  }
  
  public long getLastModified()
  {
    return zipEntry.getTime();
  }
  
  public String getName()
  {
    return zipEntry.getName();
  }
  
  public InputStream openInputStream()
    throws IOException
  {
    return zipFile.getInputStream(zipEntry);
  }
  
  public OutputStream openOutputStream()
    throws IOException
  {
    throw new UnsupportedOperationException();
  }
  
  public Reader openReader(boolean ignoreEncodingErrors)
    throws IOException
  {
    throw new UnsupportedOperationException();
  }
  
  public Writer openWriter()
    throws IOException
  {
    throw new UnsupportedOperationException();
  }
  
  public URI toUri()
  {
    try
    {
      return new URI("jar:" + file.toURI().getPath() + "!" + zipEntry.getName());
    }
    catch (URISyntaxException localURISyntaxException) {}
    return null;
  }
  
  public String toString()
  {
    return file.getAbsolutePath() + "[" + zipEntry.getName() + "]";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.compiler.tool.ArchiveFileObject
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.compiler.tool;

import java.util.ArrayList;
import java.util.Locale;
import javax.annotation.processing.Processor;
import javax.tools.JavaCompiler.CompilationTask;

class EclipseCompiler$1
  implements JavaCompiler.CompilationTask
{
  private boolean hasRun = false;
  
  EclipseCompiler$1(EclipseCompiler paramEclipseCompiler, EclipseCompilerImpl paramEclipseCompilerImpl) {}
  
  public Boolean call()
  {
    if (hasRun) {
      throw new IllegalStateException("This task has already been run");
    }
    Boolean value = val$eclipseCompiler2.call() ? Boolean.TRUE : Boolean.FALSE;
    hasRun = true;
    return value;
  }
  
  public void setLocale(Locale locale)
  {
    val$eclipseCompiler2.setLocale(locale);
  }
  
  public void setProcessors(Iterable<? extends Processor> processors)
  {
    ArrayList<Processor> temp = new ArrayList();
    for (Processor processor : processors) {
      temp.add(processor);
    }
    Processor[] processors2 = new Processor[temp.size()];
    temp.toArray(processors2);
    val$eclipseCompiler2.processors = processors2;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.compiler.tool.EclipseCompiler.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.compiler.tool;

import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.net.URI;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import javax.annotation.processing.Processor;
import javax.lang.model.SourceVersion;
import javax.tools.DiagnosticListener;
import javax.tools.JavaCompiler;
import javax.tools.JavaCompiler.CompilationTask;
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import org.eclipse.jdt.internal.compiler.batch.Main;

public class EclipseCompiler
  implements JavaCompiler
{
  private static Set<SourceVersion> SupportedSourceVersions;
  WeakHashMap<Thread, EclipseCompilerImpl> threadCache;
  public DiagnosticListener<? super JavaFileObject> diagnosticListener;
  
  static
  {
    EnumSet<SourceVersion> enumSet = EnumSet.range(SourceVersion.RELEASE_0, SourceVersion.RELEASE_6);
    
    SupportedSourceVersions = Collections.unmodifiableSet(enumSet);
  }
  
  public EclipseCompiler()
  {
    threadCache = new WeakHashMap();
  }
  
  public Set<SourceVersion> getSourceVersions()
  {
    return SupportedSourceVersions;
  }
  
  public StandardJavaFileManager getStandardFileManager(DiagnosticListener<? super JavaFileObject> someDiagnosticListener, Locale locale, Charset charset)
  {
    diagnosticListener = someDiagnosticListener;
    return new EclipseFileManager(locale, charset);
  }
  
  public JavaCompiler.CompilationTask getTask(Writer out, JavaFileManager fileManager, DiagnosticListener<? super JavaFileObject> someDiagnosticListener, Iterable<String> options, Iterable<String> classes, Iterable<? extends JavaFileObject> compilationUnits)
  {
    PrintWriter writerOut = null;
    PrintWriter writerErr = null;
    if (out == null)
    {
      writerOut = new PrintWriter(System.err);
      writerErr = new PrintWriter(System.err);
    }
    else
    {
      writerOut = new PrintWriter(out);
      writerErr = new PrintWriter(out);
    }
    Thread currentThread = Thread.currentThread();
    EclipseCompilerImpl eclipseCompiler = (EclipseCompilerImpl)threadCache.get(currentThread);
    if (eclipseCompiler == null)
    {
      eclipseCompiler = new EclipseCompilerImpl(writerOut, writerErr, false);
      threadCache.put(currentThread, eclipseCompiler);
    }
    else
    {
      eclipseCompiler.initialize(writerOut, writerErr, false, null, null);
    }
    final EclipseCompilerImpl eclipseCompiler2 = new EclipseCompilerImpl(writerOut, writerErr, false);
    compilationUnits = compilationUnits;
    diagnosticListener = someDiagnosticListener;
    if (fileManager != null) {
      fileManager = fileManager;
    } else {
      fileManager = getStandardFileManager(someDiagnosticListener, null, null);
    }
    options.put("org.eclipse.jdt.core.compiler.compliance", "1.6");
    options.put("org.eclipse.jdt.core.compiler.source", "1.6");
    options.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6");
    
    ArrayList<String> allOptions = new ArrayList();
    if (options != null)
    {
      for (Iterator<String> iterator = options.iterator(); iterator.hasNext();) {
        fileManager.handleOption((String)iterator.next(), iterator);
      }
      for (String option : options) {
        allOptions.add(option);
      }
    }
    if (compilationUnits != null) {
      for (JavaFileObject javaFileObject : compilationUnits)
      {
        URI uri = javaFileObject.toUri();
        if (!uri.isAbsolute()) {
          uri = URI.create("file://" + uri.toString());
        }
        allOptions.add(new File(uri).getAbsolutePath());
      }
    }
    if (classes != null)
    {
      allOptions.add("-classNames");
      StringBuilder builder = new StringBuilder();
      int i = 0;
      for (String className : classes)
      {
        if (i != 0) {
          builder.append(',');
        }
        builder.append(className);
        i++;
      }
      allOptions.add(String.valueOf(builder));
    }
    String[] optionsToProcess = new String[allOptions.size()];
    allOptions.toArray(optionsToProcess);
    try
    {
      eclipseCompiler2.configure(optionsToProcess);
    }
    catch (IllegalArgumentException e)
    {
      throw e;
    }
    if ((fileManager instanceof StandardJavaFileManager))
    {
      StandardJavaFileManager javaFileManager = (StandardJavaFileManager)fileManager;
      
      Iterable<? extends File> location = javaFileManager.getLocation(StandardLocation.CLASS_OUTPUT);
      if (location != null) {
        eclipseCompiler2.setDestinationPath(((File)location.iterator().next()).getAbsolutePath());
      }
    }
    new JavaCompiler.CompilationTask()
    {
      private boolean hasRun = false;
      
      public Boolean call()
      {
        if (hasRun) {
          throw new IllegalStateException("This task has already been run");
        }
        Boolean value = eclipseCompiler2.call() ? Boolean.TRUE : Boolean.FALSE;
        hasRun = true;
        return value;
      }
      
      public void setLocale(Locale locale)
      {
        eclipseCompiler2.setLocale(locale);
      }
      
      public void setProcessors(Iterable<? extends Processor> processors)
      {
        ArrayList<Processor> temp = new ArrayList();
        for (Processor processor : processors) {
          temp.add(processor);
        }
        Processor[] processors2 = new Processor[temp.size()];
        temp.toArray(processors2);
        eclipseCompiler2processors = processors2;
      }
    };
  }
  
  public int isSupportedOption(String option)
  {
    return Options.processOptions(option);
  }
  
  public int run(InputStream in, OutputStream out, OutputStream err, String... arguments)
  {
    boolean succeed = new Main(new PrintWriter(new OutputStreamWriter(out)), new PrintWriter(new OutputStreamWriter(err)), true, null, null).compile(arguments);
    return succeed ? 0 : -1;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.compiler.tool.EclipseCompiler
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.compiler.tool;

import java.io.IOException;
import javax.tools.JavaFileObject;
import org.eclipse.jdt.internal.compiler.batch.CompilationUnit;
import org.eclipse.jdt.internal.compiler.problem.AbortCompilationUnit;

class EclipseCompilerImpl$1
  extends CompilationUnit
{
  EclipseCompilerImpl$1(EclipseCompilerImpl paramEclipseCompilerImpl, char[] $anonymous0, String $anonymous1, String $anonymous2, JavaFileObject paramJavaFileObject)
  {
    super($anonymous0, $anonymous1, $anonymous2);
  }
  
  public char[] getContents()
  {
    try
    {
      return val$javaFileObject.getCharContent(true).toString().toCharArray();
    }
    catch (IOException e)
    {
      e.printStackTrace();
      throw new AbortCompilationUnit(null, e, null);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.compiler.tool.EclipseCompilerImpl.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.compiler.tool;

import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;

class EclipseCompilerImpl$2
  implements IErrorHandlingPolicy
{
  EclipseCompilerImpl$2(EclipseCompilerImpl paramEclipseCompilerImpl) {}
  
  public boolean proceedOnErrors()
  {
    return false;
  }
  
  public boolean stopOnFirstError()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.compiler.tool.EclipseCompilerImpl.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.compiler.tool;

import java.io.File;
import java.util.Locale;
import javax.tools.Diagnostic;
import javax.tools.Diagnostic.Kind;
import javax.tools.JavaFileObject;
import javax.tools.JavaFileObject.Kind;

class EclipseCompilerImpl$3$1
  implements Diagnostic<JavaFileObject>
{
  EclipseCompilerImpl$3$1(EclipseCompilerImpl.3 param3, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, String[] paramArrayOfString, int paramInt6, char[] paramArrayOfChar) {}
  
  public String getCode()
  {
    return Integer.toString(val$problemId);
  }
  
  public long getColumnNumber()
  {
    return val$columnNumber;
  }
  
  public long getEndPosition()
  {
    return val$endPosition;
  }
  
  public Diagnostic.Kind getKind()
  {
    if ((val$severity & 0x1) != 0) {
      return Diagnostic.Kind.ERROR;
    }
    if ((val$severity & 0x20) != 0) {
      return Diagnostic.Kind.WARNING;
    }
    if (0 != 0) {
      return Diagnostic.Kind.MANDATORY_WARNING;
    }
    return Diagnostic.Kind.OTHER;
  }
  
  public long getLineNumber()
  {
    return val$lineNumber;
  }
  
  public String getMessage(Locale locale)
  {
    if (locale != null) {
      this$1.setLocale(locale);
    }
    return this$1.getLocalizedMessage(val$problemId, val$problemArguments);
  }
  
  public long getPosition()
  {
    return val$startPosition;
  }
  
  public JavaFileObject getSource()
  {
    File f = new File(new String(val$originatingFileName));
    if (f.exists()) {
      return new EclipseFileObject(null, f.toURI(), JavaFileObject.Kind.SOURCE, null);
    }
    return null;
  }
  
  public long getStartPosition()
  {
    return val$startPosition;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.compiler.tool.EclipseCompilerImpl.3.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.compiler.tool;

import java.io.File;
import java.util.Locale;
import javax.tools.Diagnostic;
import javax.tools.Diagnostic.Kind;
import javax.tools.JavaFileObject;
import javax.tools.JavaFileObject.Kind;

class EclipseCompilerImpl$3$2
  implements Diagnostic<JavaFileObject>
{
  EclipseCompilerImpl$3$2(EclipseCompilerImpl.3 param3, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, String[] paramArrayOfString, int paramInt6, char[] paramArrayOfChar) {}
  
  public String getCode()
  {
    return Integer.toString(val$problemId);
  }
  
  public long getColumnNumber()
  {
    return val$columnNumber;
  }
  
  public long getEndPosition()
  {
    return val$endPosition;
  }
  
  public Diagnostic.Kind getKind()
  {
    if ((val$severity & 0x1) != 0) {
      return Diagnostic.Kind.ERROR;
    }
    if ((val$severity & 0x20) != 0) {
      return Diagnostic.Kind.WARNING;
    }
    if (0 != 0) {
      return Diagnostic.Kind.MANDATORY_WARNING;
    }
    return Diagnostic.Kind.OTHER;
  }
  
  public long getLineNumber()
  {
    return val$lineNumber;
  }
  
  public String getMessage(Locale locale)
  {
    if (locale != null) {
      this$1.setLocale(locale);
    }
    return this$1.getLocalizedMessage(val$problemId, val$problemArguments);
  }
  
  public long getPosition()
  {
    return val$startPosition;
  }
  
  public JavaFileObject getSource()
  {
    File f = new File(new String(val$originatingFileName));
    if (f.exists()) {
      return new EclipseFileObject(null, f.toURI(), JavaFileObject.Kind.SOURCE, null);
    }
    return null;
  }
  
  public long getStartPosition()
  {
    return val$startPosition;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.compiler.tool.EclipseCompilerImpl.3.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.compiler.tool;

import java.io.File;
import java.util.Locale;
import javax.tools.Diagnostic;
import javax.tools.Diagnostic.Kind;
import javax.tools.DiagnosticListener;
import javax.tools.JavaFileObject;
import javax.tools.JavaFileObject.Kind;
import org.eclipse.jdt.core.compiler.CategorizedProblem;
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;

class EclipseCompilerImpl$3
  extends DefaultProblemFactory
{
  EclipseCompilerImpl$3(EclipseCompilerImpl paramEclipseCompilerImpl) {}
  
  public CategorizedProblem createProblem(final char[] originatingFileName, final int problemId, final String[] problemArguments, String[] messageArguments, final int severity, final int startPosition, final int endPosition, final int lineNumber, final int columnNumber)
  {
    DiagnosticListener<? super JavaFileObject> diagListener = this$0.diagnosticListener;
    if (diagListener != null) {
      diagListener.report(new Diagnostic()
      {
        public String getCode()
        {
          return Integer.toString(problemId);
        }
        
        public long getColumnNumber()
        {
          return columnNumber;
        }
        
        public long getEndPosition()
        {
          return endPosition;
        }
        
        public Diagnostic.Kind getKind()
        {
          if ((severity & 0x1) != 0) {
            return Diagnostic.Kind.ERROR;
          }
          if ((severity & 0x20) != 0) {
            return Diagnostic.Kind.WARNING;
          }
          if (0 != 0) {
            return Diagnostic.Kind.MANDATORY_WARNING;
          }
          return Diagnostic.Kind.OTHER;
        }
        
        public long getLineNumber()
        {
          return lineNumber;
        }
        
        public String getMessage(Locale locale)
        {
          if (locale != null) {
            setLocale(locale);
          }
          return getLocalizedMessage(problemId, problemArguments);
        }
        
        public long getPosition()
        {
          return startPosition;
        }
        
        public JavaFileObject getSource()
        {
          File f = new File(new String(originatingFileName));
          if (f.exists()) {
            return new EclipseFileObject(null, f.toURI(), JavaFileObject.Kind.SOURCE, null);
          }
          return null;
        }
        
        public long getStartPosition()
        {
          return startPosition;
        }
      });
    }
    return super.createProblem(originatingFileName, problemId, problemArguments, messageArguments, severity, startPosition, endPosition, lineNumber, columnNumber);
  }
  
  public CategorizedProblem createProblem(final char[] originatingFileName, final int problemId, final String[] problemArguments, int elaborationID, String[] messageArguments, final int severity, final int startPosition, final int endPosition, final int lineNumber, final int columnNumber)
  {
    DiagnosticListener<? super JavaFileObject> diagListener = this$0.diagnosticListener;
    if (diagListener != null) {
      diagListener.report(new Diagnostic()
      {
        public String getCode()
        {
          return Integer.toString(problemId);
        }
        
        public long getColumnNumber()
        {
          return columnNumber;
        }
        
        public long getEndPosition()
        {
          return endPosition;
        }
        
        public Diagnostic.Kind getKind()
        {
          if ((severity & 0x1) != 0) {
            return Diagnostic.Kind.ERROR;
          }
          if ((severity & 0x20) != 0) {
            return Diagnostic.Kind.WARNING;
          }
          if (0 != 0) {
            return Diagnostic.Kind.MANDATORY_WARNING;
          }
          return Diagnostic.Kind.OTHER;
        }
        
        public long getLineNumber()
        {
          return lineNumber;
        }
        
        public String getMessage(Locale locale)
        {
          if (locale != null) {
            setLocale(locale);
          }
          return getLocalizedMessage(problemId, problemArguments);
        }
        
        public long getPosition()
        {
          return startPosition;
        }
        
        public JavaFileObject getSource()
        {
          File f = new File(new String(originatingFileName));
          if (f.exists()) {
            return new EclipseFileObject(null, f.toURI(), JavaFileObject.Kind.SOURCE, null);
          }
          return null;
        }
        
        public long getStartPosition()
        {
          return startPosition;
        }
      });
    }
    return super.createProblem(originatingFileName, problemId, problemArguments, elaborationID, messageArguments, severity, startPosition, endPosition, lineNumber, columnNumber);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.compiler.tool.EclipseCompilerImpl.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.compiler.tool;

import java.io.File;
import java.util.Locale;
import javax.tools.Diagnostic;
import javax.tools.Diagnostic.Kind;
import javax.tools.JavaFileObject;
import javax.tools.JavaFileObject.Kind;
import org.eclipse.jdt.core.compiler.CategorizedProblem;
import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;

class EclipseCompilerImpl$4
  implements Diagnostic<JavaFileObject>
{
  EclipseCompilerImpl$4(EclipseCompilerImpl paramEclipseCompilerImpl, CategorizedProblem paramCategorizedProblem) {}
  
  public String getCode()
  {
    return null;
  }
  
  public long getColumnNumber()
  {
    if ((val$problem instanceof DefaultProblem)) {
      return val$problem).column;
    }
    return -1L;
  }
  
  public long getEndPosition()
  {
    if ((val$problem instanceof DefaultProblem)) {
      return ((DefaultProblem)val$problem).getSourceEnd();
    }
    return -1L;
  }
  
  public Diagnostic.Kind getKind()
  {
    if (val$problem.isError()) {
      return Diagnostic.Kind.ERROR;
    }
    if (val$problem.isWarning()) {
      return Diagnostic.Kind.WARNING;
    }
    return Diagnostic.Kind.OTHER;
  }
  
  public long getLineNumber()
  {
    if ((val$problem instanceof DefaultProblem)) {
      return ((DefaultProblem)val$problem).getSourceLineNumber();
    }
    return -1L;
  }
  
  public String getMessage(Locale locale)
  {
    return val$problem.getMessage();
  }
  
  public long getPosition()
  {
    if ((val$problem instanceof DefaultProblem)) {
      return ((DefaultProblem)val$problem).getSourceStart();
    }
    return -1L;
  }
  
  public JavaFileObject getSource()
  {
    if ((val$problem instanceof DefaultProblem))
    {
      File f = new File(new String(((DefaultProblem)val$problem).getOriginatingFileName()));
      if (f.exists()) {
        return new EclipseFileObject(null, f.toURI(), JavaFileObject.Kind.SOURCE, null);
      }
      return null;
    }
    return null;
  }
  
  public long getStartPosition()
  {
    return getPosition();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.compiler.tool.EclipseCompilerImpl.4
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.compiler.tool;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import javax.annotation.processing.Processor;
import javax.tools.Diagnostic;
import javax.tools.Diagnostic.Kind;
import javax.tools.DiagnosticListener;
import javax.tools.FileObject;
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
import javax.tools.JavaFileObject.Kind;
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import org.eclipse.jdt.core.compiler.CategorizedProblem;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.core.compiler.CompilationProgress;
import org.eclipse.jdt.internal.compiler.AbstractAnnotationProcessorManager;
import org.eclipse.jdt.internal.compiler.ClassFile;
import org.eclipse.jdt.internal.compiler.CompilationResult;
import org.eclipse.jdt.internal.compiler.Compiler;
import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
import org.eclipse.jdt.internal.compiler.IProblemFactory;
import org.eclipse.jdt.internal.compiler.batch.CompilationUnit;
import org.eclipse.jdt.internal.compiler.batch.FileSystem;
import org.eclipse.jdt.internal.compiler.batch.FileSystem.Classpath;
import org.eclipse.jdt.internal.compiler.batch.FileSystem.ClasspathNormalizer;
import org.eclipse.jdt.internal.compiler.batch.Main;
import org.eclipse.jdt.internal.compiler.batch.Main.Logger;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment;
import org.eclipse.jdt.internal.compiler.problem.AbortCompilationUnit;
import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
import org.eclipse.jdt.internal.compiler.util.Messages;
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;

public class EclipseCompilerImpl
  extends Main
{
  private static final CompilationUnit[] NO_UNITS = new CompilationUnit[0];
  private HashMap<CompilationUnit, JavaFileObject> javaFileObjectMap;
  Iterable<? extends JavaFileObject> compilationUnits;
  public JavaFileManager fileManager;
  protected Processor[] processors;
  public DiagnosticListener<? super JavaFileObject> diagnosticListener;
  
  public EclipseCompilerImpl(PrintWriter out, PrintWriter err, boolean systemExitWhenFinished)
  {
    super(out, err, systemExitWhenFinished, null, null);
  }
  
  public boolean call()
  {
    try
    {
      if (proceed)
      {
        globalProblemsCount = 0;
        globalErrorsCount = 0;
        globalWarningsCount = 0;
        globalTasksCount = 0;
        exportedClassFilesCounter = 0;
        
        performCompilation();
      }
    }
    catch (IllegalArgumentException e)
    {
      logger.logException(e);
      if (systemExitWhenFinished)
      {
        cleanup();
        System.exit(-1);
      }
      return false;
    }
    catch (RuntimeException e)
    {
      logger.logException(e);
      return false;
    }
    finally
    {
      cleanup();
    }
    cleanup();
    if (globalErrorsCount == 0) {
      return true;
    }
    return false;
  }
  
  private void cleanup()
  {
    logger.flush();
    logger.close();
    processors = null;
    try
    {
      if (fileManager != null) {
        fileManager.flush();
      }
    }
    catch (IOException localIOException) {}
  }
  
  public CompilationUnit[] getCompilationUnits()
  {
    if (compilationUnits == null) {
      return NO_UNITS;
    }
    ArrayList<CompilationUnit> units = new ArrayList();
    for (final JavaFileObject javaFileObject : compilationUnits)
    {
      if (javaFileObject.getKind() != JavaFileObject.Kind.SOURCE) {
        throw new IllegalArgumentException();
      }
      String name = javaFileObject.getName();
      name = name.replace('\\', '/');
      CompilationUnit compilationUnit = new CompilationUnit(null, 
        name, 
        null)
        {
          public char[] getContents()
          {
            try
            {
              return javaFileObject.getCharContent(true).toString().toCharArray();
            }
            catch (IOException e)
            {
              e.printStackTrace();
              throw new AbortCompilationUnit(null, e, null);
            }
          }
        };
        units.add(compilationUnit);
        javaFileObjectMap.put(compilationUnit, javaFileObject);
      }
      CompilationUnit[] result = new CompilationUnit[units.size()];
      units.toArray(result);
      return result;
    }
    
    public IErrorHandlingPolicy getHandlingPolicy()
    {
      new IErrorHandlingPolicy()
      {
        public boolean proceedOnErrors()
        {
          return false;
        }
        
        public boolean stopOnFirstError()
        {
          return false;
        }
      };
    }
    
    public IProblemFactory getProblemFactory()
    {
      new DefaultProblemFactory()
      {
        public CategorizedProblem createProblem(final char[] originatingFileName, final int problemId, final String[] problemArguments, String[] messageArguments, final int severity, final int startPosition, final int endPosition, final int lineNumber, final int columnNumber)
        {
          DiagnosticListener<? super JavaFileObject> diagListener = diagnosticListener;
          if (diagListener != null) {
            diagListener.report(new Diagnostic()
            {
              public String getCode()
              {
                return Integer.toString(problemId);
              }
              
              public long getColumnNumber()
              {
                return columnNumber;
              }
              
              public long getEndPosition()
              {
                return endPosition;
              }
              
              public Diagnostic.Kind getKind()
              {
                if ((severity & 0x1) != 0) {
                  return Diagnostic.Kind.ERROR;
                }
                if ((severity & 0x20) != 0) {
                  return Diagnostic.Kind.WARNING;
                }
                if (0 != 0) {
                  return Diagnostic.Kind.MANDATORY_WARNING;
                }
                return Diagnostic.Kind.OTHER;
              }
              
              public long getLineNumber()
              {
                return lineNumber;
              }
              
              public String getMessage(Locale locale)
              {
                if (locale != null) {
                  setLocale(locale);
                }
                return getLocalizedMessage(problemId, problemArguments);
              }
              
              public long getPosition()
              {
                return startPosition;
              }
              
              public JavaFileObject getSource()
              {
                File f = new File(new String(originatingFileName));
                if (f.exists()) {
                  return new EclipseFileObject(null, f.toURI(), JavaFileObject.Kind.SOURCE, null);
                }
                return null;
              }
              
              public long getStartPosition()
              {
                return startPosition;
              }
            });
          }
          return super.createProblem(originatingFileName, problemId, problemArguments, messageArguments, severity, startPosition, endPosition, lineNumber, columnNumber);
        }
        
        public CategorizedProblem createProblem(final char[] originatingFileName, final int problemId, final String[] problemArguments, int elaborationID, String[] messageArguments, final int severity, final int startPosition, final int endPosition, final int lineNumber, final int columnNumber)
        {
          DiagnosticListener<? super JavaFileObject> diagListener = diagnosticListener;
          if (diagListener != null) {
            diagListener.report(new Diagnostic()
            {
              public String getCode()
              {
                return Integer.toString(problemId);
              }
              
              public long getColumnNumber()
              {
                return columnNumber;
              }
              
              public long getEndPosition()
              {
                return endPosition;
              }
              
              public Diagnostic.Kind getKind()
              {
                if ((severity & 0x1) != 0) {
                  return Diagnostic.Kind.ERROR;
                }
                if ((severity & 0x20) != 0) {
                  return Diagnostic.Kind.WARNING;
                }
                if (0 != 0) {
                  return Diagnostic.Kind.MANDATORY_WARNING;
                }
                return Diagnostic.Kind.OTHER;
              }
              
              public long getLineNumber()
              {
                return lineNumber;
              }
              
              public String getMessage(Locale locale)
              {
                if (locale != null) {
                  setLocale(locale);
                }
                return getLocalizedMessage(problemId, problemArguments);
              }
              
              public long getPosition()
              {
                return startPosition;
              }
              
              public JavaFileObject getSource()
              {
                File f = new File(new String(originatingFileName));
                if (f.exists()) {
                  return new EclipseFileObject(null, f.toURI(), JavaFileObject.Kind.SOURCE, null);
                }
                return null;
              }
              
              public long getStartPosition()
              {
                return startPosition;
              }
            });
          }
          return super.createProblem(originatingFileName, problemId, problemArguments, elaborationID, messageArguments, severity, startPosition, endPosition, lineNumber, columnNumber);
        }
      };
    }
    
    protected void initialize(PrintWriter outWriter, PrintWriter errWriter, boolean systemExit, Map customDefaultOptions, CompilationProgress compilationProgress)
    {
      super.initialize(outWriter, errWriter, systemExit, customDefaultOptions, compilationProgress);
      javaFileObjectMap = new HashMap();
    }
    
    protected void initializeAnnotationProcessorManager()
    {
      super.initializeAnnotationProcessorManager();
      if ((batchCompiler.annotationProcessorManager != null) && (processors != null)) {
        batchCompiler.annotationProcessorManager.setProcessors(processors);
      } else if (processors != null) {
        throw new UnsupportedOperationException("Cannot handle annotation processing");
      }
    }
    
    public void outputClassFiles(CompilationResult unitResult)
    {
      if ((unitResult != null) && ((!unitResult.hasErrors()) || (proceedOnError)))
      {
        ClassFile[] classFiles = unitResult.getClassFiles();
        boolean generateClasspathStructure = fileManager.hasLocation(StandardLocation.CLASS_OUTPUT);
        String currentDestinationPath = destinationPath;
        File outputLocation = null;
        if (currentDestinationPath != null)
        {
          outputLocation = new File(currentDestinationPath);
          outputLocation.mkdirs();
        }
        int i = 0;
        for (int fileCount = classFiles.length; i < fileCount; i++)
        {
          ClassFile classFile = classFiles[i];
          char[] filename = classFile.fileName();
          int length = filename.length;
          char[] relativeName = new char[length + 6];
          System.arraycopy(filename, 0, relativeName, 0, length);
          System.arraycopy(SuffixConstants.SUFFIX_class, 0, relativeName, length, 6);
          CharOperation.replace(relativeName, '/', File.separatorChar);
          String relativeStringName = new String(relativeName);
          if (compilerOptions.verbose) {
            out.println(
              Messages.bind(
              Messages.compilation_write, 
              new String[] {
              String.valueOf(exportedClassFilesCounter + 1), 
              relativeStringName }));
          }
          try
          {
            JavaFileObject javaFileForOutput = 
              fileManager.getJavaFileForOutput(
              StandardLocation.CLASS_OUTPUT, 
              new String(filename), 
              JavaFileObject.Kind.CLASS, 
              (FileObject)javaFile
1 2 3

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