Posted by alexanderschunk on March 26, 2007 at 04:47 AM | Comments (2)
Organization of the code
The code of the Java compiler is organized in packages. There are 22 packages in total that reflect different parts of the compiler.
This Blog focuses on the most important packages. Below is a list of the packages that will be described:
com.sun.tools.javac
com.sun.tools.javac.api
com.sun.tools.javac.code
com.sun.tools.javac.vm
com.sun.tools.javac.main
com.sun.tools.javac.parser
com.sun.tools.javac.processing
These packages hold the core files of the java compiler that deal with its core functions.
Core and additional source entries
When you browse the code you will encounter comments as the following stating that this part of the code may be removed in later versions and use of this code is at your own risk:
/**
* Provides an implementation of Scope.
*
*
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.
*
*
*/
Ignoring these parts the rest of the code provides useful insights of how the compiler works and the language features it uses. All source files use new Java language features including Annotation Types and Generics.
Important files
As I have already mentioned in my previous Blog the most important file is the "Main.java" file of the com.sun.javac package along with the "Launcher.java" file in the same package.
To be continued...
Thats it so far I will continue this Blog later so stay tune :).