Java Doc for JavaCompiler.java in  » 6.0-JDK-Modules-com.sun » tools » com » sun » tools » javac » main » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules com.sun » tools » com.sun.tools.javac.main 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.tools.javac.main.JavaCompiler

All known Subclasses:   com.sun.tools.apt.main.JavaCompiler,  com.sun.tools.javadoc.JavadocTool,
JavaCompiler
public class JavaCompiler implements ClassReader.SourceCompleter(Code)
This class could be the main entry point for GJC when GJC is used as a component in a larger software system. It provides operations to construct a new compiler, and to run a new compiler on a set of source files.

This is NOT part of any API supported by Sun Microsystems. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.



Field Summary
protected  Annotateannotate
     The annotation annotator.
protected  booleanannotationProcessingOccurred
     Flag set if any annotation processing occurred.
protected  Attrattr
     The attributor.
public  booleanattrParseOnly
     Generate attributed parse tree only.
protected  Checkchk
     The attributor.
protected  CompilePolicycompilePolicy
    
final protected static  Context.Key<JavaCompiler>compilerKey
     The context key for the compiler.
final protected  NamecompletionFailureName
    
protected  Contextcontext
    
protected  JavaCompilerdelegateCompiler
     Annotation processing may require and provide a new instance of the compiler to be used for the analyze and generate phases.
protected  booleandevVerbose
    
public  longelapsed_msec
    
public  Stringencoding
     The encoding to be used for source input.
protected  Enterenter
     The module for the symbol table entry phases.
protected  booleanexplicitAnnotationProcessingRequested
    
protected  JavaFileManagerfileManager
     Access to file objects.
protected  Flowflow
     The flow analyzer.
protected  Gengen
     The module for code generation.
public  booleangenEndPos
    
protected  booleanimplicitSourceFilesRead
     Flag set if any implicit source files read.
protected  ImplicitSourcePolicyimplicitSourcePolicy
    
protected  Set<JavaFileObject>inputFiles
     The set of currently compiled inputfiles, needed to ensure we don't accidentally overwrite an input file when -s is set.
public  booleankeepComments
    
public  booleanlineDebugInfo
    
public  Loglog
     The log to be used for error reporting.
 Lowerlower
     The syntactic sugar desweetener.
protected  TreeMakermake
     The tree factory module.
protected  Name.Tablenames
     The name table.
protected  Parser.FactoryparserFactory
     Factory for parsers.
public  booleanprintFlat
     Debug switch: Emit Java sources after inner class flattening.
 JavacProcessingEnvironmentprocEnvImpl
     Object to handle annotation processing.
 booleanprocessAnnotations
     Set to true to enable skeleton annotation processing code.
protected  booleanprocessPcks
    
protected  ClassReaderreader
     The class reader.
 booleanrelax
     Switch: relax some constraints for producing the jsr14 prototype.
protected  Sourcesource
     The language version.
public  booleansourceOutput
     Emit plain Java source files rather than class files.
public  booleanstubOutput
     Emit stub source files rather than class files.
protected  Symtabsyms
     The symbol table.
protected  TaskListenertaskListener
    
public  Todotodo
     A queue of all as yet unattributed classes.
 TransTypestransTypes
     The type eraser.
protected  Typestypes
     Type utilities.
public  booleanverbose
     Verbose output.
public  booleanverboseCompilePolicy
    
protected  ClassWriterwriter
     The class writer.

Constructor Summary
public  JavaCompiler(Context context)
     Construct a new compiler using a shared context.

Method Summary
public  List<Env<AttrContext>>attribute(ListBuffer<Env<AttrContext>> envs)
     Attribute a list of parse trees, such as found on the "todo" list.
public  Env<AttrContext>attribute(Env<AttrContext> env)
     Attribute a parse tree.
public  voidclose()
    
public  voidcompile(List<JavaFileObject> sourceFileObject)
    
public  voidcompile(List<JavaFileObject> sourceFileObjects, List<String> classnames, Iterable<? extends Processor> processors)
    
public  voidcomplete(ClassSymbol c)
     Complete compiling a source file that has been accessed by the class file reader.
public  List<Pair<Env<AttrContext>, JCClassDecl>>desugar(List<Env<AttrContext>> envs)
     Prepare attributed parse trees, in conjunction with their attribution contexts, for source or code generation.
protected  voiddesugar(Env<AttrContext> env, ListBuffer<Pair<Env<AttrContext>, JCClassDecl>> results)
     Prepare attributed parse trees, in conjunction with their attribution contexts, for source or code generation.
public  booleandesugarLater(Env<AttrContext> env)
     Determine if a class needs to be desugared later.
public static  voidenableLogging()
    
public  List<JCCompilationUnit>enterTrees(List<JCCompilationUnit> roots)
     Enter the symbols found in a list of parse trees.
public  interrorCount()
     The number of errors reported so far.
 booleanexplicitAnnotationProcessingRequested()
    
public  List<Env<AttrContext>>flow(List<Env<AttrContext>> envs)
     Perform dataflow checks on attributed parse trees.
public  List<Env<AttrContext>>flow(Env<AttrContext> env)
     Perform dataflow checks on an attributed parse tree.
protected  voidflow(Env<AttrContext> env, ListBuffer<Env<AttrContext>> results)
     Perform dataflow checks on an attributed parse tree.
public static  StringfullVersion()
     The current full version number as a string.
 JavaFileObjectgenCode(Env<AttrContext> env, JCClassDecl cdef)
    
public  voidgenerate(List<Pair<Env<AttrContext>, JCClassDecl>> list)
     Generates the source or class file for a list of classes.
public  voidgenerate(List<Pair<Env<AttrContext>, JCClassDecl>> list, ListBuffer<JavaFileObject> results)
    
protected  Scanner.FactorygetScannerFactory()
    
 Map<JCCompilationUnit, List<Env<AttrContext>>>groupByFile(List<Env<AttrContext>> list)
    
public  voidinitProcessAnnotations(Iterable<? extends Processor> processors)
     Check if we should process annotations.
public  voidinitRound(JavaCompiler prev)
    
public static  JavaCompilerinstance(Context context)
     Get the JavaCompiler instance for this context.
protected  booleankeepComments()
    
protected  JCCompilationUnitparse(JavaFileObject filename, CharSequence content)
     Parse contents of input stream.
public  JCTree.JCCompilationUnitparse(String filename)
     Parse contents of file.
public  JCTree.JCCompilationUnitparse(JavaFileObject filename)
     Parse contents of file.
public  booleanparseErrors()
     Whether or not any parse errors have occurred.
public  List<JCCompilationUnit>parseFiles(List<JavaFileObject> fileObjects)
     Parses a list of files.
protected  voidprintCount(String kind, int count)
     Print numbers of errors and warnings.
 JavaFileObjectprintSource(Env<AttrContext> env, JCClassDecl cdef)
     Emit plain Java source for a class.
protected  voidprintVerbose(String key, Object arg)
     Output for "-verbose" option.
public  JavaCompilerprocessAnnotations(List<JCCompilationUnit> roots)
    
public  JavaCompilerprocessAnnotations(List<JCCompilationUnit> roots, List<String> classnames)
     Process any anotations found in the specifed compilation units.
public  CharSequencereadSource(JavaFileObject filename)
     Try to open input stream with given name.
 JCClassDeclremoveMethodBodies(JCClassDecl cdef)
    
public  voidreportDeferredDiagnostics()
    
public  SymbolresolveIdent(String name)
     Resolve an identifier.
final protected  List<T>stopIfError(ListBuffer<T> listBuffer)
    
final protected  List<T>stopIfError(List<T> list)
    
public static  Stringversion()
     The current version number as a string.
public  intwarningCount()
     The number of warnings reported so far.

Field Detail
annotate
protected Annotate annotate(Code)
The annotation annotator.



annotationProcessingOccurred
protected boolean annotationProcessingOccurred(Code)
Flag set if any annotation processing occurred.



attr
protected Attr attr(Code)
The attributor.



attrParseOnly
public boolean attrParseOnly(Code)
Generate attributed parse tree only.



chk
protected Check chk(Code)
The attributor.



compilePolicy
protected CompilePolicy compilePolicy(Code)
The policy for the order in which to perform the compilation



compilerKey
final protected static Context.Key<JavaCompiler> compilerKey(Code)
The context key for the compiler.



completionFailureName
final protected Name completionFailureName(Code)
Force a completion failure on this name



context
protected Context context(Code)



delegateCompiler
protected JavaCompiler delegateCompiler(Code)
Annotation processing may require and provide a new instance of the compiler to be used for the analyze and generate phases.



devVerbose
protected boolean devVerbose(Code)
Switch: should we debug ignored exceptions



elapsed_msec
public long elapsed_msec(Code)



encoding
public String encoding(Code)
The encoding to be used for source input.



enter
protected Enter enter(Code)
The module for the symbol table entry phases.



explicitAnnotationProcessingRequested
protected boolean explicitAnnotationProcessingRequested(Code)
Switch: is annotation processing requested explitly via CompilationTask.setProcessors?



fileManager
protected JavaFileManager fileManager(Code)
Access to file objects.



flow
protected Flow flow(Code)
The flow analyzer.



gen
protected Gen gen(Code)
The module for code generation.



genEndPos
public boolean genEndPos(Code)
Switch: should we store the ending positions?



implicitSourceFilesRead
protected boolean implicitSourceFilesRead(Code)
Flag set if any implicit source files read.



implicitSourcePolicy
protected ImplicitSourcePolicy implicitSourcePolicy(Code)
The policy for what to do with implicitly read source files



inputFiles
protected Set<JavaFileObject> inputFiles(Code)
The set of currently compiled inputfiles, needed to ensure we don't accidentally overwrite an input file when -s is set. initialized by `compile'.



keepComments
public boolean keepComments(Code)



lineDebugInfo
public boolean lineDebugInfo(Code)
Generate code with the LineNumberTable attribute for debugging



log
public Log log(Code)
The log to be used for error reporting.



lower
Lower lower(Code)
The syntactic sugar desweetener.



make
protected TreeMaker make(Code)
The tree factory module.



names
protected Name.Table names(Code)
The name table.



parserFactory
protected Parser.Factory parserFactory(Code)
Factory for parsers.



printFlat
public boolean printFlat(Code)
Debug switch: Emit Java sources after inner class flattening.



procEnvImpl
JavacProcessingEnvironment procEnvImpl(Code)
Object to handle annotation processing.



processAnnotations
boolean processAnnotations(Code)
Set to true to enable skeleton annotation processing code. Currently, we assume this variable will be replaced more advanced logic to figure out if annotation processing is needed.



processPcks
protected boolean processPcks(Code)
Switch: should we (annotation) process packages as well



reader
protected ClassReader reader(Code)
The class reader.



relax
boolean relax(Code)
Switch: relax some constraints for producing the jsr14 prototype.



source
protected Source source(Code)
The language version.



sourceOutput
public boolean sourceOutput(Code)
Emit plain Java source files rather than class files.



stubOutput
public boolean stubOutput(Code)
Emit stub source files rather than class files.



syms
protected Symtab syms(Code)
The symbol table.



taskListener
protected TaskListener taskListener(Code)
Optional listener for progress events



todo
public Todo todo(Code)
A queue of all as yet unattributed classes.



transTypes
TransTypes transTypes(Code)
The type eraser.



types
protected Types types(Code)
Type utilities.



verbose
public boolean verbose(Code)
Verbose output.



verboseCompilePolicy
public boolean verboseCompilePolicy(Code)
Report activity related to compilePolicy



writer
protected ClassWriter writer(Code)
The class writer.




Constructor Detail
JavaCompiler
public JavaCompiler(Context context)(Code)
Construct a new compiler using a shared context.




Method Detail
attribute
public List<Env<AttrContext>> attribute(ListBuffer<Env<AttrContext>> envs)(Code)
Attribute a list of parse trees, such as found on the "todo" list. Note that attributing classes may cause additional files to be parsed and entered via the SourceCompleter. Attribution of the entries in the list does not stop if any errors occur.



attribute
public Env<AttrContext> attribute(Env<AttrContext> env)(Code)
Attribute a parse tree.



close
public void close()(Code)
Close the compiler, flushing the logs



compile
public void compile(List<JavaFileObject> sourceFileObject) throws Throwable(Code)



compile
public void compile(List<JavaFileObject> sourceFileObjects, List<String> classnames, Iterable<? extends Processor> processors) throws IOException(Code)
Main method: compile a list of files, return all compiled classes
Parameters:
  sourceFileObjects - file objects to be compiled
Parameters:
  classnames - class names to process for annotations
Parameters:
  processors - user provided annotation processors to bypassdiscovery, null means that no processors were provided



complete
public void complete(ClassSymbol c) throws CompletionFailure(Code)
Complete compiling a source file that has been accessed by the class file reader.
Parameters:
  c - The class the source file of which needs to be compiled.
Parameters:
  filename - The name of the source file.
Parameters:
  f - An input stream that reads the source file.



desugar
public List<Pair<Env<AttrContext>, JCClassDecl>> desugar(List<Env<AttrContext>> envs)(Code)
Prepare attributed parse trees, in conjunction with their attribution contexts, for source or code generation. If any errors occur, an empty list will be returned.



desugar
protected void desugar(Env<AttrContext> env, ListBuffer<Pair<Env<AttrContext>, JCClassDecl>> results)(Code)
Prepare attributed parse trees, in conjunction with their attribution contexts, for source or code generation. If the file was not listed on the command line, the current implicitSourcePolicy is taken into account. The preparation stops as soon as an error is found.



desugarLater
public boolean desugarLater(Env<AttrContext> env)(Code)
Determine if a class needs to be desugared later. As erasure (TransTypes) destroys information needed in flow analysis, we need to ensure that supertypes are translated before derived types are translated.



enableLogging
public static void enableLogging()(Code)



enterTrees
public List<JCCompilationUnit> enterTrees(List<JCCompilationUnit> roots)(Code)
Enter the symbols found in a list of parse trees. As a side-effect, this puts elements on the "todo" list. Also stores a list of all top level classes in rootClasses.



errorCount
public int errorCount()(Code)
The number of errors reported so far.



explicitAnnotationProcessingRequested
boolean explicitAnnotationProcessingRequested()(Code)



flow
public List<Env<AttrContext>> flow(List<Env<AttrContext>> envs)(Code)
Perform dataflow checks on attributed parse trees. These include checks for definite assignment and unreachable statements. If any errors occur, an empty list will be returned.



flow
public List<Env<AttrContext>> flow(Env<AttrContext> env)(Code)
Perform dataflow checks on an attributed parse tree.



flow
protected void flow(Env<AttrContext> env, ListBuffer<Env<AttrContext>> results)(Code)
Perform dataflow checks on an attributed parse tree.



fullVersion
public static String fullVersion()(Code)
The current full version number as a string.



genCode
JavaFileObject genCode(Env<AttrContext> env, JCClassDecl cdef) throws IOException(Code)
Generate code and emit a class file for a given class
Parameters:
  env - The attribution environment of the outermost classcontaining this class.
Parameters:
  cdef - The class definition from which code is generated.



generate
public void generate(List<Pair<Env<AttrContext>, JCClassDecl>> list)(Code)
Generates the source or class file for a list of classes. The decision to generate a source file or a class file is based upon the compiler's options. Generation stops if an error occurs while writing files.



generate
public void generate(List<Pair<Env<AttrContext>, JCClassDecl>> list, ListBuffer<JavaFileObject> results)(Code)



getScannerFactory
protected Scanner.Factory getScannerFactory()(Code)



groupByFile
Map<JCCompilationUnit, List<Env<AttrContext>>> groupByFile(List<Env<AttrContext>> list)(Code)



initProcessAnnotations
public void initProcessAnnotations(Iterable<? extends Processor> processors)(Code)
Check if we should process annotations. If so, and if no scanner is yet registered, then set up the DocCommentScanner to catch doc comments, and set keepComments so the parser records them in the compilation unit.
Parameters:
  processors - user provided annotation processors to bypassdiscovery, null means that no processors were provided



initRound
public void initRound(JavaCompiler prev)(Code)



instance
public static JavaCompiler instance(Context context)(Code)
Get the JavaCompiler instance for this context.



keepComments
protected boolean keepComments()(Code)



parse
protected JCCompilationUnit parse(JavaFileObject filename, CharSequence content)(Code)
Parse contents of input stream.
Parameters:
  filename - The name of the file from which input stream comes.
Parameters:
  input - The input stream to be parsed.



parse
public JCTree.JCCompilationUnit parse(String filename) throws IOException(Code)
Parse contents of file.
Parameters:
  filename - The name of the file to be parsed.



parse
public JCTree.JCCompilationUnit parse(JavaFileObject filename)(Code)
Parse contents of file.
Parameters:
  filename - The name of the file to be parsed.



parseErrors
public boolean parseErrors()(Code)
Whether or not any parse errors have occurred.



parseFiles
public List<JCCompilationUnit> parseFiles(List<JavaFileObject> fileObjects) throws IOException(Code)
Parses a list of files.



printCount
protected void printCount(String kind, int count)(Code)
Print numbers of errors and warnings.



printSource
JavaFileObject printSource(Env<AttrContext> env, JCClassDecl cdef) throws IOException(Code)
Emit plain Java source for a class.
Parameters:
  env - The attribution environment of the outermost classcontaining this class.
Parameters:
  cdef - The class definition to be printed.



printVerbose
protected void printVerbose(String key, Object arg)(Code)
Output for "-verbose" option.
Parameters:
  key - The key to look up the correct internationalized string.
Parameters:
  arg - An argument for substitution into the output string.



processAnnotations
public JavaCompiler processAnnotations(List<JCCompilationUnit> roots) throws IOException(Code)



processAnnotations
public JavaCompiler processAnnotations(List<JCCompilationUnit> roots, List<String> classnames) throws IOException(Code)
Process any anotations found in the specifed compilation units.
Parameters:
  roots - a list of compilation units an instance of the compiler in which to complete the compilation



readSource
public CharSequence readSource(JavaFileObject filename)(Code)
Try to open input stream with given name. Report an error if this fails.
Parameters:
  filename - The file name of the input stream to be opened.



removeMethodBodies
JCClassDecl removeMethodBodies(JCClassDecl cdef)(Code)



reportDeferredDiagnostics
public void reportDeferredDiagnostics()(Code)



resolveIdent
public Symbol resolveIdent(String name)(Code)
Resolve an identifier.
Parameters:
  name - The identifier to resolve



stopIfError
final protected List<T> stopIfError(ListBuffer<T> listBuffer)(Code)



stopIfError
final protected List<T> stopIfError(List<T> list)(Code)



version
public static String version()(Code)
The current version number as a string.



warningCount
public int warningCount()(Code)
The number of warnings reported so far.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.