org.eclipse.jdt.internal.compiler
Class Compiler

java.lang.Object
  extended by org.eclipse.jdt.internal.compiler.Compiler
All Implemented Interfaces:
ITypeRequestor, ProblemSeverities
Direct Known Subclasses:
CodeSnippetCompiler, CompilationUnitProblemFinder, RacCompiler

public class Compiler
extends java.lang.Object
implements ITypeRequestor, ProblemSeverities


Field Summary
 AbstractAnnotationProcessorManager annotationProcessorManager
           
static boolean DEBUG
           
static IDebugRequestor DebugRequestor
           
 JmlBinaryLookup jmlBinaryLookup
           
 JmlSourceLookup jmlSourceLookup
           
 LookupEnvironment lookupEnvironment
           
 CompilerOptions options
           
 Parser parser
           
 int parseThreshold
           
 ProblemReporter problemReporter
           
 CompilationProgress progress
           
 ReferenceBinding[] referenceBindings
           
 int remainingIterations
           
 ICompilerRequestor requestor
           
 CompilerStats stats
           
 int totalUnits
           
 CompilationUnitDeclaration[] unitsToProcess
           
 boolean useSingleThread
           
 
Fields inherited from interface org.eclipse.jdt.internal.compiler.problem.ProblemSeverities
Abort, AbortCompilation, AbortCompilationUnit, AbortMethod, AbortType, Error, Fatal, Ignore, Optional, SecondaryError, Warning
 
Constructor Summary
Compiler(INameEnvironment environment, IErrorHandlingPolicy policy, CompilerOptions options, ICompilerRequestor requestor, IProblemFactory problemFactory)
          Answer a new compiler using the given name environment and compiler options.
Compiler(INameEnvironment environment, IErrorHandlingPolicy policy, CompilerOptions options, ICompilerRequestor requestor, IProblemFactory problemFactory, java.io.PrintWriter out)
          Deprecated.  
Compiler(INameEnvironment environment, IErrorHandlingPolicy policy, CompilerOptions options, ICompilerRequestor requestor, IProblemFactory problemFactory, java.io.PrintWriter out, CompilationProgress progress)
           
Compiler(INameEnvironment environment, IErrorHandlingPolicy policy, java.util.Map settings, ICompilerRequestor requestor, IProblemFactory problemFactory)
          Deprecated. this constructor is kept to preserve 3.1 and 3.2M4 compatibility
Compiler(INameEnvironment environment, IErrorHandlingPolicy policy, java.util.Map settings, ICompilerRequestor requestor, IProblemFactory problemFactory, boolean parseLiteralExpressionsAsConstants)
          Deprecated. this constructor is kept to preserve 3.1 and 3.2M4 compatibility
 
Method Summary
 void accept(IBinaryType binaryType, PackageBinding packageBinding, AccessRestriction accessRestriction)
          Add an additional binary type
 void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction)
          Add an additional compilation unit into the loop -> build compilation unit declarations, their bindings and record their results.
 void accept(ISourceType[] sourceTypes, PackageBinding packageBinding, AccessRestriction accessRestriction)
          Add additional source types
 void compile(ICompilationUnit[] sourceUnits)
          General API -> compile each of supplied files -> recompile any required types for which we have an incomplete principle structure
 CompilationUnitDeclaration getUnitToProcess(int next)
           
 void initializeParser()
           
 void process(CompilationUnitDeclaration unit, int i)
          Process a compilation unit already parsed and build.
 void reset()
           
 CompilationUnitDeclaration resolve(CompilationUnitDeclaration unit, ICompilationUnit sourceUnit, boolean verifyMethods, boolean analyzeCode, boolean generateCode)
          Internal API used to resolve a given compilation unit.
 CompilationUnitDeclaration resolve(ICompilationUnit sourceUnit, boolean verifyMethods, boolean analyzeCode, boolean generateCode)
          Internal API used to resolve a given compilation unit.
 void setBinaryTypes(ReferenceBinding[] binaryTypes)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parser

public Parser parser

requestor

public ICompilerRequestor requestor

options

public CompilerOptions options

problemReporter

public ProblemReporter problemReporter

stats

public CompilerStats stats

progress

public CompilationProgress progress

remainingIterations

public int remainingIterations

unitsToProcess

public CompilationUnitDeclaration[] unitsToProcess

totalUnits

public int totalUnits

lookupEnvironment

public LookupEnvironment lookupEnvironment

DEBUG

public static boolean DEBUG

parseThreshold

public int parseThreshold

annotationProcessorManager

public AbstractAnnotationProcessorManager annotationProcessorManager

referenceBindings

public ReferenceBinding[] referenceBindings

useSingleThread

public boolean useSingleThread

jmlSourceLookup

public final JmlSourceLookup jmlSourceLookup

jmlBinaryLookup

public final JmlBinaryLookup jmlBinaryLookup

DebugRequestor

public static IDebugRequestor DebugRequestor
Constructor Detail

Compiler

public Compiler(INameEnvironment environment,
                IErrorHandlingPolicy policy,
                java.util.Map settings,
                ICompilerRequestor requestor,
                IProblemFactory problemFactory)
Deprecated. this constructor is kept to preserve 3.1 and 3.2M4 compatibility

Answer a new compiler using the given name environment and compiler options. The environment and options will be in effect for the lifetime of the compiler. When the compiler is run, compilation results are sent to the given requestor.

Parameters:
environment - org.eclipse.jdt.internal.compiler.api.env.INameEnvironment Environment used by the compiler in order to resolve type and package names. The name environment implements the actual connection of the compiler to the outside world (e.g. in batch mode the name environment is performing pure file accesses, reuse previous build state or connection to repositories). Note: the name environment is responsible for implementing the actual classpath rules.
policy - org.eclipse.jdt.internal.compiler.api.problem.IErrorHandlingPolicy Configurable part for problem handling, allowing the compiler client to specify the rules for handling problems (stop on first error or accumulate them all) and at the same time perform some actions such as opening a dialog in UI when compiling interactively.
settings - java.util.Map The settings that control the compiler behavior.
requestor - org.eclipse.jdt.internal.compiler.api.ICompilerRequestor Component which will receive and persist all compilation results and is intended to consume them as they are produced. Typically, in a batch compiler, it is responsible for writing out the actual .class files to the file system.
problemFactory - org.eclipse.jdt.internal.compiler.api.problem.IProblemFactory Factory used inside the compiler to create problem descriptors. It allows the compiler client to supply its own representation of compilation problems in order to avoid object conversions. Note that the factory is not supposed to accumulate the created problems, the compiler will gather them all and hand them back as part of the compilation unit result.
See Also:
DefaultErrorHandlingPolicies, CompilationResult

Compiler

public Compiler(INameEnvironment environment,
                IErrorHandlingPolicy policy,
                java.util.Map settings,
                ICompilerRequestor requestor,
                IProblemFactory problemFactory,
                boolean parseLiteralExpressionsAsConstants)
Deprecated. this constructor is kept to preserve 3.1 and 3.2M4 compatibility

Answer a new compiler using the given name environment and compiler options. The environment and options will be in effect for the lifetime of the compiler. When the compiler is run, compilation results are sent to the given requestor.

Parameters:
environment - org.eclipse.jdt.internal.compiler.api.env.INameEnvironment Environment used by the compiler in order to resolve type and package names. The name environment implements the actual connection of the compiler to the outside world (e.g. in batch mode the name environment is performing pure file accesses, reuse previous build state or connection to repositories). Note: the name environment is responsible for implementing the actual classpath rules.
policy - org.eclipse.jdt.internal.compiler.api.problem.IErrorHandlingPolicy Configurable part for problem handling, allowing the compiler client to specify the rules for handling problems (stop on first error or accumulate them all) and at the same time perform some actions such as opening a dialog in UI when compiling interactively.
settings - java.util.Map The settings that control the compiler behavior.
requestor - org.eclipse.jdt.internal.compiler.api.ICompilerRequestor Component which will receive and persist all compilation results and is intended to consume them as they are produced. Typically, in a batch compiler, it is responsible for writing out the actual .class files to the file system.
problemFactory - org.eclipse.jdt.internal.compiler.api.problem.IProblemFactory Factory used inside the compiler to create problem descriptors. It allows the compiler client to supply its own representation of compilation problems in order to avoid object conversions. Note that the factory is not supposed to accumulate the created problems, the compiler will gather them all and hand them back as part of the compilation unit result.
parseLiteralExpressionsAsConstants - boolean This parameter is used to optimize the literals or leave them as they are in the source. If you put true, "Hello" + " world" will be converted to "Hello world".
See Also:
DefaultErrorHandlingPolicies, CompilationResult

Compiler

public Compiler(INameEnvironment environment,
                IErrorHandlingPolicy policy,
                CompilerOptions options,
                ICompilerRequestor requestor,
                IProblemFactory problemFactory)
Answer a new compiler using the given name environment and compiler options. The environment and options will be in effect for the lifetime of the compiler. When the compiler is run, compilation results are sent to the given requestor.

Parameters:
environment - org.eclipse.jdt.internal.compiler.api.env.INameEnvironment Environment used by the compiler in order to resolve type and package names. The name environment implements the actual connection of the compiler to the outside world (e.g. in batch mode the name environment is performing pure file accesses, reuse previous build state or connection to repositories). Note: the name environment is responsible for implementing the actual classpath rules.
policy - org.eclipse.jdt.internal.compiler.api.problem.IErrorHandlingPolicy Configurable part for problem handling, allowing the compiler client to specify the rules for handling problems (stop on first error or accumulate them all) and at the same time perform some actions such as opening a dialog in UI when compiling interactively.
options - org.eclipse.jdt.internal.compiler.impl.CompilerOptions The options that control the compiler behavior.
requestor - org.eclipse.jdt.internal.compiler.api.ICompilerRequestor Component which will receive and persist all compilation results and is intended to consume them as they are produced. Typically, in a batch compiler, it is responsible for writing out the actual .class files to the file system.
problemFactory - org.eclipse.jdt.internal.compiler.api.problem.IProblemFactory Factory used inside the compiler to create problem descriptors. It allows the compiler client to supply its own representation of compilation problems in order to avoid object conversions. Note that the factory is not supposed to accumulate the created problems, the compiler will gather them all and hand them back as part of the compilation unit result.
See Also:
DefaultErrorHandlingPolicies, CompilationResult

Compiler

public Compiler(INameEnvironment environment,
                IErrorHandlingPolicy policy,
                CompilerOptions options,
                ICompilerRequestor requestor,
                IProblemFactory problemFactory,
                java.io.PrintWriter out)
Deprecated. 

Answer a new compiler using the given name environment and compiler options. The environment and options will be in effect for the lifetime of the compiler. When the compiler is run, compilation results are sent to the given requestor.

Parameters:
environment - org.eclipse.jdt.internal.compiler.api.env.INameEnvironment Environment used by the compiler in order to resolve type and package names. The name environment implements the actual connection of the compiler to the outside world (e.g. in batch mode the name environment is performing pure file accesses, reuse previous build state or connection to repositories). Note: the name environment is responsible for implementing the actual classpath rules.
policy - org.eclipse.jdt.internal.compiler.api.problem.IErrorHandlingPolicy Configurable part for problem handling, allowing the compiler client to specify the rules for handling problems (stop on first error or accumulate them all) and at the same time perform some actions such as opening a dialog in UI when compiling interactively.
options - org.eclipse.jdt.internal.compiler.impl.CompilerOptions The options that control the compiler behavior.
requestor - org.eclipse.jdt.internal.compiler.api.ICompilerRequestor Component which will receive and persist all compilation results and is intended to consume them as they are produced. Typically, in a batch compiler, it is responsible for writing out the actual .class files to the file system.
problemFactory - org.eclipse.jdt.internal.compiler.api.problem.IProblemFactory Factory used inside the compiler to create problem descriptors. It allows the compiler client to supply its own representation of compilation problems in order to avoid object conversions. Note that the factory is not supposed to accumulate the created problems, the compiler will gather them all and hand them back as part of the compilation unit result.
See Also:
DefaultErrorHandlingPolicies, CompilationResult

Compiler

public Compiler(INameEnvironment environment,
                IErrorHandlingPolicy policy,
                CompilerOptions options,
                ICompilerRequestor requestor,
                IProblemFactory problemFactory,
                java.io.PrintWriter out,
                CompilationProgress progress)
Method Detail

accept

public void accept(IBinaryType binaryType,
                   PackageBinding packageBinding,
                   AccessRestriction accessRestriction)
Add an additional binary type

Specified by:
accept in interface ITypeRequestor

accept

public void accept(ICompilationUnit sourceUnit,
                   AccessRestriction accessRestriction)
Add an additional compilation unit into the loop -> build compilation unit declarations, their bindings and record their results.

Specified by:
accept in interface ITypeRequestor

accept

public void accept(ISourceType[] sourceTypes,
                   PackageBinding packageBinding,
                   AccessRestriction accessRestriction)
Add additional source types

Specified by:
accept in interface ITypeRequestor

compile

public void compile(ICompilationUnit[] sourceUnits)
General API -> compile each of supplied files -> recompile any required types for which we have an incomplete principle structure


getUnitToProcess

public CompilationUnitDeclaration getUnitToProcess(int next)

setBinaryTypes

public void setBinaryTypes(ReferenceBinding[] binaryTypes)

initializeParser

public void initializeParser()

process

public void process(CompilationUnitDeclaration unit,
                    int i)
Process a compilation unit already parsed and build.


reset

public void reset()

resolve

public CompilationUnitDeclaration resolve(CompilationUnitDeclaration unit,
                                          ICompilationUnit sourceUnit,
                                          boolean verifyMethods,
                                          boolean analyzeCode,
                                          boolean generateCode)
Internal API used to resolve a given compilation unit. Can run a subset of the compilation process


resolve

public CompilationUnitDeclaration resolve(ICompilationUnit sourceUnit,
                                          boolean verifyMethods,
                                          boolean analyzeCode,
                                          boolean generateCode)
Internal API used to resolve a given compilation unit. Can run a subset of the compilation process