6559315: Inconsistent non-standard Sun copyright in src/share/opensource/javac/doc/document.css
Remove obsolete files Reviewed-by: mcimadamore
This commit is contained in:
parent
7dbe0828de
commit
d3dcc1c115
@ -1,275 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
|
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
#
|
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU General Public License version 2 only, as
|
|
||||||
# published by the Free Software Foundation. Sun designates this
|
|
||||||
# particular file as subject to the "Classpath" exception as provided
|
|
||||||
# by Sun in the LICENSE file that accompanied this code.
|
|
||||||
#
|
|
||||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
# version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
# accompanied this code).
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License version
|
|
||||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
#
|
|
||||||
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
||||||
# CA 95054 USA or visit www.sun.com if you need additional information or
|
|
||||||
# have any questions.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Simple Makefile for javac
|
|
||||||
|
|
||||||
BUILD = build
|
|
||||||
BUILD_BOOTCLASSES = $(BUILD)/bootclasses
|
|
||||||
BUILD_CLASSES = $(BUILD)/classes
|
|
||||||
BUILD_JAVAC_SRCFILES = $(BUILD)/javac.srcfiles
|
|
||||||
GENSRCDIR = $(BUILD)/gensrc
|
|
||||||
DIST = dist
|
|
||||||
DIST_JAVAC = $(DIST)
|
|
||||||
ABS_DIST_JAVAC = $(shell cd $(DIST_JAVAC) ; pwd)
|
|
||||||
SRC_BIN = src/bin
|
|
||||||
SRC_CLASSES = src/share/classes
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# version info for generated compiler
|
|
||||||
|
|
||||||
JDK_VERSION = 1.7.0
|
|
||||||
RELEASE=$(JDK_VERSION)-opensource
|
|
||||||
BUILD_NUMBER = b00
|
|
||||||
USER_RELEASE_SUFFIX := $(shell echo $(USER)_`date '+%d_%b_%Y_%H_%M' | tr "A-Z" "a-z"`)
|
|
||||||
FULL_VERSION = $(RELEASE)-$(USER_RELEASE_SUFFIX)-$(BUILD_NUMBER)
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
CAT = /bin/cat
|
|
||||||
CHMOD = /bin/chmod
|
|
||||||
CP = /bin/cp
|
|
||||||
MKDIR = /bin/mkdir
|
|
||||||
RM = /bin/rm
|
|
||||||
SED = /bin/sed
|
|
||||||
|
|
||||||
|
|
||||||
SYSTEM_UNAME := $(shell uname)
|
|
||||||
|
|
||||||
# Platform settings specific to Solaris
|
|
||||||
ifeq ($(SYSTEM_UNAME), SunOS)
|
|
||||||
# Intrinsic unix command, with backslash-escaped character interpretation
|
|
||||||
# (not using -e will cause build failure when using /bin/bash)
|
|
||||||
# (using -e breaks something else)
|
|
||||||
ECHO = /usr/bin/echo
|
|
||||||
PLATFORM = solaris
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Platform settings specific to Linux
|
|
||||||
ifeq ($(SYSTEM_UNAME), Linux)
|
|
||||||
# Intrinsic unix command, with backslash-escaped character interpretation
|
|
||||||
ECHO = echo -e
|
|
||||||
PLATFORM = linux
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
# Set BOOTDIR to specify the JDK used to build the compiler
|
|
||||||
ifdef BOOTDIR
|
|
||||||
JAR = $(BOOTDIR)/bin/jar
|
|
||||||
JAVA = $(BOOTDIR)/bin/java
|
|
||||||
JAVAC = $(BOOTDIR)/bin/javac
|
|
||||||
JAVADOC = $(BOOTDIR)/bin/javadoc
|
|
||||||
else
|
|
||||||
JAR = jar
|
|
||||||
JAVA = java
|
|
||||||
JAVAC = javac
|
|
||||||
JAVADOC = javadoc
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef JTREG
|
|
||||||
ifdef JTREG_HOME
|
|
||||||
JTREG = $(JTREG_HOME)/$(PLATFORM)/bin/jtreg
|
|
||||||
else
|
|
||||||
JTREG = jtreg
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef JTREG_OPTS
|
|
||||||
JTREG_OPTS = -s -verbose:summary
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef JTREG_TESTS
|
|
||||||
JTREG_TESTS = test/tools/javac
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Set this to the baseline version of JDK used for the tests
|
|
||||||
# TESTJDKHOME =
|
|
||||||
|
|
||||||
COMPILER_SOURCE_LEVEL = 1.5
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------------------
|
|
||||||
SCM_DIRS = -name .hg -o -name .svn -o -name CVS -o -name RCS -o -name SCCS
|
|
||||||
JAVAC_SRCS = $(shell find \
|
|
||||||
$(SRC_CLASSES)/javax/annotation/processing \
|
|
||||||
$(SRC_CLASSES)/javax/lang/model \
|
|
||||||
$(SRC_CLASSES)/javax/tools \
|
|
||||||
$(SRC_CLASSES)/com/sun/source \
|
|
||||||
$(SRC_CLASSES)/com/sun/tools/javac \
|
|
||||||
\( $(SCM_DIRS) -o -name \*-template.\* \) -prune -o -name \*.java -print )
|
|
||||||
|
|
||||||
JAVAC_RESOURCES = $(shell ls $(SRC_CLASSES)/com/sun/tools/javac/resources/*.properties | $(SED) -e 's/-template//' )
|
|
||||||
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
default: build
|
|
||||||
|
|
||||||
all: build docs
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(RM) -rf $(BUILD) $(DIST)
|
|
||||||
|
|
||||||
build: sanity $(DIST_JAVAC)/lib/javac.jar $(DIST_JAVAC)/bin/javac
|
|
||||||
|
|
||||||
|
|
||||||
# javac.jar
|
|
||||||
|
|
||||||
$(DIST_JAVAC)/lib/javac.jar: \
|
|
||||||
$(JAVAC_SRCS) \
|
|
||||||
$(patsubst $(SRC_CLASSES)/%,$(BUILD_BOOTCLASSES)/%,$(JAVAC_RESOURCES)) \
|
|
||||||
$(patsubst $(SRC_CLASSES)/%,$(BUILD_CLASSES)/%,$(JAVAC_RESOURCES))
|
|
||||||
@$(ECHO) $(JAVAC_SRCS) > $(BUILD_JAVAC_SRCFILES)
|
|
||||||
$(JAVAC) -d $(BUILD_BOOTCLASSES) -source $(COMPILER_SOURCE_LEVEL) -g:source,lines @$(BUILD_JAVAC_SRCFILES)
|
|
||||||
$(JAVA) -cp $(BUILD_BOOTCLASSES) com.sun.tools.javac.Main \
|
|
||||||
-d $(BUILD_CLASSES) -g:source,lines @$(BUILD_JAVAC_SRCFILES)
|
|
||||||
( $(ECHO) "Main-Class: com.sun.tools.javac.Main" ; \
|
|
||||||
$(ECHO) "Built-By: $$USER" ; \
|
|
||||||
$(ECHO) "Built-At: `date`" ) > $(BUILD)/javac.MF
|
|
||||||
$(MKDIR) -p $(DIST_JAVAC)/lib
|
|
||||||
$(JAR) -cmf $(BUILD)/javac.MF $(DIST_JAVAC)/lib/javac.jar -C ${BUILD_CLASSES} .
|
|
||||||
|
|
||||||
|
|
||||||
# javac resources
|
|
||||||
|
|
||||||
$(BUILD_BOOTCLASSES)/com/sun/tools/javac/resources/version.properties \
|
|
||||||
$(BUILD_CLASSES)/com/sun/tools/javac/resources/version.properties: \
|
|
||||||
$(SRC_CLASSES)/com/sun/tools/javac/resources/version-template.properties
|
|
||||||
$(MKDIR) -p $(@D)
|
|
||||||
$(SED) -e 's/$$(JDK_VERSION)/$(JDK_VERSION)/' \
|
|
||||||
-e 's/$$(FULL_VERSION)/$(FULL_VERSION)/' \
|
|
||||||
-e 's/$$(RELEASE)/$(RELEASE)/' \
|
|
||||||
< $< > $@
|
|
||||||
|
|
||||||
$(BUILD_BOOTCLASSES)/com/sun/tools/javac/resources/%.properties: \
|
|
||||||
$(SRC_CLASSES)/com/sun/tools/javac/resources/%.properties
|
|
||||||
$(MKDIR) -p $(@D)
|
|
||||||
$(CP) $^ $@
|
|
||||||
|
|
||||||
$(BUILD_CLASSES)/com/sun/tools/javac/resources/%.properties: \
|
|
||||||
$(SRC_CLASSES)/com/sun/tools/javac/resources/%.properties
|
|
||||||
$(MKDIR) -p $(@D)
|
|
||||||
$(CP) $^ $@
|
|
||||||
|
|
||||||
|
|
||||||
# javac wrapper script
|
|
||||||
|
|
||||||
$(DIST_JAVAC)/bin/javac: $(SRC_BIN)/javac.sh
|
|
||||||
$(MKDIR) -p $(@D)
|
|
||||||
$(CP) $^ $@
|
|
||||||
$(CHMOD) +x $@
|
|
||||||
|
|
||||||
# javadoc
|
|
||||||
|
|
||||||
JLS3_URL = http://java.sun.com/docs/books/jls/
|
|
||||||
JLS3_CITE = <a href="$(JLS3_URL)"> \
|
|
||||||
The Java Language Specification, Third Edition</a>
|
|
||||||
TAG_JLS3 = -tag 'jls3:a:See <cite>$(JLS3_CITE)</cite>:'
|
|
||||||
|
|
||||||
TAGS = $(IGNORED_TAGS:%=-tag %:X) $(TAG_JLS3)
|
|
||||||
|
|
||||||
docs:
|
|
||||||
$(JAVADOC) -sourcepath $(SRC_CLASSES) -d $(DIST_JAVAC)/doc/api \
|
|
||||||
$(TAGS) \
|
|
||||||
-subpackages javax.annotation.processing:javax.lang.model:javax.tools:com.sun.source:com.sun.tools.javac
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
test: test-sanity $(DIST_JAVAC)/lib/javac.jar
|
|
||||||
$(JTREG) $(JTREG_OPTS) -noshell \
|
|
||||||
-jdk:$(TESTJDKHOME) \
|
|
||||||
-Xbootclasspath/p:$(ABS_DIST_JAVAC)/lib/javac.jar \
|
|
||||||
-w:$(BUILD)/jtreg/work \
|
|
||||||
-r:$(BUILD)/jtreg/report \
|
|
||||||
$(JTREG_TESTS)
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifndef ERROR_FILE
|
|
||||||
ERROR_FILE = $(BUILD)/sanityCheckErrors.txt
|
|
||||||
endif
|
|
||||||
|
|
||||||
presanity:
|
|
||||||
@$(RM) -f $(ERROR_FILE)
|
|
||||||
@$(MKDIR) -p `dirname $(ERROR_FILE)`
|
|
||||||
|
|
||||||
######################################################
|
|
||||||
# CLASSPATH cannot be set, unless you are insane.
|
|
||||||
######################################################
|
|
||||||
sane-classpath:
|
|
||||||
ifdef CLASSPATH
|
|
||||||
@$(ECHO) "ERROR: Your CLASSPATH environment variable is set. This will \n" \
|
|
||||||
" most likely cause the build to fail. Please unset it \n" \
|
|
||||||
" and start your build again. \n" \
|
|
||||||
"" >> $(ERROR_FILE)
|
|
||||||
endif
|
|
||||||
|
|
||||||
######################################################
|
|
||||||
# JAVA_HOME cannot be set, unless you are insane.
|
|
||||||
######################################################
|
|
||||||
sane-java_home:
|
|
||||||
ifdef JAVA_HOME
|
|
||||||
@$(ECHO) "ERROR: Your JAVA_HOME environment variable is set. This will \n" \
|
|
||||||
" most likely cause the build to fail. Please unset it \n" \
|
|
||||||
" and start your build again. \n" \
|
|
||||||
"" >> $(ERROR_FILE)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
######################################################
|
|
||||||
# TESTJDKHOME needs to be set to run tests
|
|
||||||
######################################################
|
|
||||||
sane-testjdk:
|
|
||||||
ifndef TESTJDKHOME
|
|
||||||
@$(ECHO) "ERROR: TESTJDKHOME needs to be set to the baseline version \n" \
|
|
||||||
" version of JDK used to run the compiler tests.\n" \
|
|
||||||
"" >> $(ERROR_FILE)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
sane-lastrule:
|
|
||||||
@if [ -r $(ERROR_FILE) ]; then \
|
|
||||||
if [ "x$(INSANE)" = x ]; then \
|
|
||||||
$(ECHO) "Exiting because of the above error(s). \n" \
|
|
||||||
"">> $(ERROR_FILE); \
|
|
||||||
fi ; \
|
|
||||||
$(CAT) $(ERROR_FILE) ; \
|
|
||||||
if [ "x$(INSANE)" = x ]; then \
|
|
||||||
exit 1 ; \
|
|
||||||
fi ; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
sanity \
|
|
||||||
build-sanity: presanity sane-classpath sane-java_home sane-lastrule
|
|
||||||
|
|
||||||
test-sanity: presanity sane-classpath sane-java_home sane-testjdk sane-lastrule
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
.PHONY: all build clean default docs prep test \
|
|
||||||
presanity sanity build-sanity test-sanity \
|
|
||||||
sane-classpath sane-java_home sane-testjdk sane-lastrule
|
|
@ -1,330 +0,0 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
||||||
<!--
|
|
||||||
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
||||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
|
|
||||||
This code is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License version 2 only, as
|
|
||||||
published by the Free Software Foundation. Sun designates this
|
|
||||||
particular file as subject to the "Classpath" exception as provided
|
|
||||||
by Sun in the LICENSE file that accompanied this code.
|
|
||||||
|
|
||||||
This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
accompanied this code).
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License version
|
|
||||||
2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
||||||
CA 95054 USA or visit www.sun.com if you need additional information or
|
|
||||||
have any questions.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta name="jdk-version" content="$(JDK_VERSION)">
|
|
||||||
<meta name="full-version" content="$(FULL_VERSION)">
|
|
||||||
<meta name="release" content="$(RELEASE)">
|
|
||||||
<meta name="date" content="$(BUILD_DATE)">
|
|
||||||
<link href="doc/document.css" rel="stylesheet">
|
|
||||||
<title>OpenJDK: javac -- README</title>
|
|
||||||
<style type="text/css">
|
|
||||||
p.noteX { margin-left:18pt; text-indent:-18pt }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" border="0"
|
|
||||||
summary="This table is for formatting purposes only.">
|
|
||||||
<tr>
|
|
||||||
<td class="sun-darkblue"> </td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="sun-darkblue">
|
|
||||||
<h1>README</h1>
|
|
||||||
|
|
||||||
<h2>Open JDK™ Java programming language compiler (<code>javac</code>)<br>
|
|
||||||
Version $(RELEASE)
|
|
||||||
<!--$(FULL_VERSION)--></h2>
|
|
||||||
<h4>$(BUILD_DATE)</h4>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="sun-lightblue"> </td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<a name="top"></a>
|
|
||||||
|
|
||||||
<!--<p class="nav-link">[<a href="#intro">Skip TOC</a>]</p>-->
|
|
||||||
|
|
||||||
<h2>Table of Contents</h2>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li><a href="#intro">Introduction</a></li>
|
|
||||||
<li><a href="#files">Files and Directories</a></li>
|
|
||||||
<li><a href="#specs">Specifications</a></li>
|
|
||||||
<li><a href="#build">Building the compiler</a></li>
|
|
||||||
<li><a href="#run">Running the compiler</a></li>
|
|
||||||
<li><a href="#test">Testing the compiler</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2><a name="intro">Introduction</a></h2>
|
|
||||||
<p>This bundle contains the source code for <code>javac</code>, a compiler for
|
|
||||||
the Java™ programming language.
|
|
||||||
Build files are provided for use with
|
|
||||||
<a href="http://www.netbeans.org">NetBeans</a>,
|
|
||||||
<a href="http://ant.apache.org/">Apache Ant</a> or
|
|
||||||
<a href="http://www.gnu.org/software/make/">GNU make</a>.
|
|
||||||
The bundle also contains a set of compiler tests, for use with the
|
|
||||||
<a href="https://openjdk.dev.java.net/jtreg/">jtreg</a> test harness.
|
|
||||||
|
|
||||||
|
|
||||||
<h2><a name="files">Files and Directories</a></h2>
|
|
||||||
When you install the compiler bundle, a directory named
|
|
||||||
<code>compiler</code> will be created, containing the following:
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr><th>Name<th>Description
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>README.html</td>
|
|
||||||
<td>This file.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>nbproject/project.xml</td>
|
|
||||||
<td>A NetBeans project file.
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>src/share/classes/</td>
|
|
||||||
<td>The source files for the compiler.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>build.xml</td>
|
|
||||||
<td>A build file for building the compiler, suitable for
|
|
||||||
use with NetBeans and Apache Ant.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>build.properties</td>
|
|
||||||
<td>Build properties, used by build.xml.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Makefile</td>
|
|
||||||
<td>A Makefile for building the compiler, suitable for use
|
|
||||||
with GNU make.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>test/tools/javac/</td>
|
|
||||||
<td>Regression tests for the compiler, for use with the JDK regression
|
|
||||||
test harness, jtreg.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><a href="doc">doc/</a></td>
|
|
||||||
<td>Additional notes about the compiler.</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h2><a name="specs">Specifications</a></h2>
|
|
||||||
<p>The compiler is a program for compiling source code written in the Java
|
|
||||||
programming language into class files suitable for execution on a Java
|
|
||||||
virtual machine. It also provides API for annotation processing,
|
|
||||||
and invoking the compiler programmatically.
|
|
||||||
<p>These behaviors are governed by the following specifications:
|
|
||||||
<ul>
|
|
||||||
<li>Java Language Specification (JLS)</li>
|
|
||||||
<li>Java Virtual Machine Specification (JVMS)</li>
|
|
||||||
<li>Java Compiler API (JSR 199)</li>
|
|
||||||
<li>Pluggable Annotation Processing API (JSR 269)</li>
|
|
||||||
</ul>
|
|
||||||
<p>For more details on these specifications, see the
|
|
||||||
<a href="http://download.java.net/jdk6/docs/technotes/guides/javac/index.html">javac Guide</a>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>These specifications are controlled by the Java Community Process
|
|
||||||
(<a href="http://jcp.org/">JCP</a>.) All implementations of these specifications
|
|
||||||
must pass the appropriate test suites.</p>
|
|
||||||
|
|
||||||
<p><b>Notice regarding JSR 199 and JSR 269:</b>
|
|
||||||
This is an implementation of an early-draft
|
|
||||||
specification developed under the Java Community Process (JCP)
|
|
||||||
and is made available for testing and evaluation purposes only.
|
|
||||||
The code is not compatible with any specification of the JCP.
|
|
||||||
|
|
||||||
<h2><a name="build">Building the compiler</a></h2>
|
|
||||||
|
|
||||||
<h3>System Requirements</h3>
|
|
||||||
<p><code>javac</code> is written in the Java programming language.
|
|
||||||
As a general rule, it can normally be compiled using tools in the
|
|
||||||
latest released version of the JDK.
|
|
||||||
(That is, a development version of <code>javac</code> version 7
|
|
||||||
can be built with JDK version 6, etc.)
|
|
||||||
To <a href="#bootstrap">bootstrap</a> the compiler, you should also have
|
|
||||||
a copy of the target JDK.</p>
|
|
||||||
|
|
||||||
<p>You can build <code>javac</code> using
|
|
||||||
<a href="#build.netbeans">NetBeans</a>,
|
|
||||||
<a href="#build.ant">Apache Ant</a>,
|
|
||||||
or <a href="#build.make">GNU make</a>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>To run the compiler tests, you will need the
|
|
||||||
<a href="https://openjdk.dev.java.net/jtreg/">jtreg test harness</a>.
|
|
||||||
|
|
||||||
<h3><a name="bootstrap">Bootstrapping the compiler</a></h3>
|
|
||||||
|
|
||||||
<p>The source for the compiler is such that it can be compiled using the latest
|
|
||||||
publicly released version of the JDK.In practice, it is typically desirable
|
|
||||||
to compile it first using the latest publicly released version of the JDK,
|
|
||||||
and then again using itself, and the target platform on which it will be run.
|
|
||||||
This not only provides a good initial test of the newly built compiler, it
|
|
||||||
also means the compiler is built with the latest compiler sources, against
|
|
||||||
the target libraries.
|
|
||||||
|
|
||||||
<h3><a name="build.netbeans">Building with NetBeans</a></h3>
|
|
||||||
<p>The installation directory for the compiler is set up as a free-form NetBeans project,
|
|
||||||
so to build the compiler using NetBeans, you just have to open the
|
|
||||||
project and build it in the normal way, for example, by using the operations
|
|
||||||
on the <code>Build</code> menu.
|
|
||||||
<p>To run the tests, you will have to edit properties in the
|
|
||||||
<code>build.properties</code> file, to specify where you have installed
|
|
||||||
the <code>jtreg</code> harness and, possibly, a different version of
|
|
||||||
JDK to use when running the tests.
|
|
||||||
|
|
||||||
<h3><a name="build.ant">Building with Apache Ant</a></h3>
|
|
||||||
<p>To build the compiler, go to the compiler installation directory, and run "ant".</p>
|
|
||||||
<pre>
|
|
||||||
% cd <i>install-dir</i>
|
|
||||||
% ant
|
|
||||||
</pre>
|
|
||||||
<p>To run the tests, you will have to edit properties in the
|
|
||||||
<code>build.properties</code> file, to specify where you have installed
|
|
||||||
the <code>jtreg</code> harness and, possibly, a different version of
|
|
||||||
JDK to use when running the tests. Then, you can run the tests using the
|
|
||||||
"test" target.
|
|
||||||
|
|
||||||
<h3><a name="build.make">Building with GNU make</a></h3>
|
|
||||||
<p>To build the compiler, go to the compiler installation directory, and type "make".</p>
|
|
||||||
You should not have CLASSPATH and JAVAHOME environment variables set when you
|
|
||||||
do this.
|
|
||||||
<pre>
|
|
||||||
% cd <i>install-dir</i>
|
|
||||||
% make
|
|
||||||
</pre>
|
|
||||||
<p>To run the tests, you will have to specify where you have installed
|
|
||||||
the <code>jtreg</code> harness and, possibly, a different version of
|
|
||||||
JDK to use when running the tests. Then, you can run the tests using the
|
|
||||||
"test" target. You can specify the values by giving them on the command
|
|
||||||
line when you run <code>make</code> or by editing the values into the Makefile.
|
|
||||||
|
|
||||||
<h3>What gets built?</h3>
|
|
||||||
<p>Whichever build tool you use, the results are put in the <code>dist</code>
|
|
||||||
subdirectory of your installation directory. The following files will be built.
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr><th>Name<th>Description
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>dist/lib/javac.jar</td>
|
|
||||||
<td>This is an executable jar file containing the compiler.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>dist/bin/javac</td>
|
|
||||||
<td>This is a simple shell script to invoke the compiler.</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h3>Notes</h3>
|
|
||||||
|
|
||||||
<p class="note"><i>Property files:</i>
|
|
||||||
It is possible to compile the resource property files into equivalent
|
|
||||||
class files, for a minor performance improvement. For simplicity, that
|
|
||||||
feature is not included here.</p>
|
|
||||||
|
|
||||||
<p class="note"><i>The launcher:</i>
|
|
||||||
JDK uses a program informally called "the launcher" which is used as
|
|
||||||
a wrapper for all JDK tools, including <code>java</code>,
|
|
||||||
<code>javac</code>, <code>javadoc</code>, and so on. The program is a deployed
|
|
||||||
as a platform-dependent binary, thus obviating the need for a shell
|
|
||||||
script to invoke the tools. Again for simplicity, and because that program
|
|
||||||
is not normally considered part of <code>javac</code>, that program is
|
|
||||||
not included here.</p
|
|
||||||
|
|
||||||
<h2><a name="run">Running the compiler</a></h2>
|
|
||||||
<p>Once you have built the compiler, you can run it in a number of ways.
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<p>Use the generated script, perhaps by putting it on your shell's
|
|
||||||
command execution path.</p>
|
|
||||||
<pre> % <i>install-dir</i>/dist/bin/javac HelloWorld.java</pre>
|
|
||||||
<p>or</p>
|
|
||||||
<pre> % javac HelloWorld.java</pre>
|
|
||||||
</li>
|
|
||||||
<li><p>Execute javac.jar with the <code>java</code> command.</p>
|
|
||||||
<pre> % java -jar <i>install-dir</i>/dist/lib/javac.jar HelloWorld.java</pre>
|
|
||||||
</li>
|
|
||||||
<li><p>Execute javac.jar directly. Depending on your operating system,
|
|
||||||
you may be able to execute the jar file directly.</p>
|
|
||||||
<pre> % <i>install-dir</i>/dist/lib/javac.jar HelloWorld.java</pre>
|
|
||||||
<p>See the
|
|
||||||
<a href="http://java.sun.com/j2se/1.5.0/docs/guide/jar/jarGuide.html">Jar File Overview</a>
|
|
||||||
for details.</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2><a name="test">Testing the compiler with <code>jtreg</code></h2>
|
|
||||||
<p>This bundle contains a large test suite of unit and regression tests
|
|
||||||
used to test <code>javac</code>. They are part of the JDK Regression Test
|
|
||||||
Suite, which uses the
|
|
||||||
<a href="https://openjdk.dev.java.net/jtreg/">jtreg test harness</a>.
|
|
||||||
This harness is
|
|
||||||
designed to run both API-style tests, and command-line tests, such as
|
|
||||||
found in the tests for <code>javac</code>.</p>
|
|
||||||
|
|
||||||
<p>The simplest way to run the tests is to prepend the newly created
|
|
||||||
copy of <code>javac.jar</code> to the bootstrap class path of a
|
|
||||||
compatible version of JDK (meaning, it must accept the class file
|
|
||||||
versions of newly compiled classes.) To do this, you can use
|
|
||||||
the <code>-Xbootclasspath/p:</code><i><path></i> option
|
|
||||||
for <code>jtreg</code>. This option is similar to the equivalent
|
|
||||||
option for the <code>java</code> command.
|
|
||||||
|
|
||||||
<p><i><b>Note:</b>Some of the tests, written as shell tests, do not yet
|
|
||||||
support this mode of operation. You should use the
|
|
||||||
<code>-noshell</code> to disable these tests for the time being.
|
|
||||||
This restriction will be lifted in the near future.</i>
|
|
||||||
|
|
||||||
<p><i><b>Note:</b>Four additional tests are ignored, using the <code>jtreg</code>
|
|
||||||
<code>@ignore</code> tag, because of problems caused by bugs that have not yet
|
|
||||||
been addressed.
|
|
||||||
|
|
||||||
<p>You can run the compiler tests with a command such as the following:</p>
|
|
||||||
|
|
||||||
<pre> % jtreg -jdk:<i>jdk</i> -Xbootclasspath/p:<i>my-javac.jar</i> -verbose -noshell test/tools/javac</pre>
|
|
||||||
|
|
||||||
<p>Depending on the verbose options used, some amount of detail of the result
|
|
||||||
of each test is written to the console. In addition, an HTML report about the
|
|
||||||
entire test run is written to a report directory, and a results file is written for
|
|
||||||
each test, in a "work" directory. The location of these directories can be
|
|
||||||
specified on the <code>jtreg</code> command line; the actual locations used
|
|
||||||
are reported to the console at the conclusion of the test run.
|
|
||||||
|
|
||||||
<p>For more information on <code>jtreg</code>, use the
|
|
||||||
the <code>-help</code> option for command-line help, or
|
|
||||||
the <code>-onlineHelp</code> option for the built-in online help.
|
|
||||||
Both of these options may optionally be followed by search
|
|
||||||
keywords</p>
|
|
||||||
|
|
||||||
<p><code>jtreg</code> can also be run from Ant. See
|
|
||||||
<code>jtreg -onlineHelp ant</code> for details.</p>
|
|
||||||
|
|
||||||
<p>Both <code>build.xml</code> and <code>Makefile</code> contain "test" targets for running the tests.
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,13 +0,0 @@
|
|||||||
build.jdk.version = 1.7.0
|
|
||||||
build.release = ${build.jdk.version}-opensource
|
|
||||||
build.number = b00
|
|
||||||
build.user.release.suffix = ${user.name}_${build.fullversion.time}
|
|
||||||
build.full.version = ${build.release}-${build.user.release.suffix}-${build.number}
|
|
||||||
|
|
||||||
# Set jtreg.home to jtreg installation directory
|
|
||||||
# jtreg.home =
|
|
||||||
|
|
||||||
# Set test.jdk.home to baseline JDK used to run the tests
|
|
||||||
# test.jdk.home =
|
|
||||||
|
|
||||||
compiler.source.level = 1.5
|
|
@ -1,163 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
||||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
|
|
||||||
This code is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License version 2 only, as
|
|
||||||
published by the Free Software Foundation. Sun designates this
|
|
||||||
particular file as subject to the "Classpath" exception as provided
|
|
||||||
by Sun in the LICENSE file that accompanied this code.
|
|
||||||
|
|
||||||
This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
accompanied this code).
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License version
|
|
||||||
2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
||||||
CA 95054 USA or visit www.sun.com if you need additional information or
|
|
||||||
have any questions.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project name="os-javac" default="build" basedir=".">
|
|
||||||
<property name="src" value="src"/>
|
|
||||||
<property name="src.bin" value="${src}/bin"/>
|
|
||||||
<property name="src.classes" value="${src}/share/classes"/>
|
|
||||||
<property name="build" value ="build"/>
|
|
||||||
<property name="build.bootclasses" value="${build}/bootclasses"/>
|
|
||||||
<property name="build.classes" value="${build}/classes"/>
|
|
||||||
<property name="build.jtreg" value="${build}/jtreg"/>
|
|
||||||
<property name="dist" value="dist"/>
|
|
||||||
<property name="dist.javac" value="${dist}"/>
|
|
||||||
|
|
||||||
<patternset id="src.javac">
|
|
||||||
<include name="javax/annotation/processing/**/*.java"/>
|
|
||||||
<include name="javax/lang/model/**/*.java"/>
|
|
||||||
<include name="javax/tools/**/*.java"/>
|
|
||||||
<include name="com/sun/source/**/*.java"/>
|
|
||||||
<include name="com/sun/tools/javac/**/*.java"/>
|
|
||||||
</patternset>
|
|
||||||
|
|
||||||
<fileset id="javac.resources" dir="${src.classes}">
|
|
||||||
<include name="com/sun/tools/javac/resources/*.properties"/>
|
|
||||||
<exclude name="**/*-template.*"/>
|
|
||||||
</fileset>
|
|
||||||
|
|
||||||
<target name="prep">
|
|
||||||
<mkdir dir="${build.bootclasses}"/>
|
|
||||||
<mkdir dir="${build.classes}"/>
|
|
||||||
<mkdir dir="${dist.javac}/bin"/>
|
|
||||||
<mkdir dir="${dist.javac}/lib"/>
|
|
||||||
<tstamp>
|
|
||||||
<format property="build.time" pattern="MM/dd/yyyy hh:mm aa"/>
|
|
||||||
<format property="build.fullversion.time" pattern="MM/dd/yyyy_HH_mm"/>
|
|
||||||
</tstamp>
|
|
||||||
<property file="build.properties"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="check-javac.isuptodate">
|
|
||||||
<uptodate targetfile="${dist.javac}/lib/javac.jar" property="javac.is.uptodate">
|
|
||||||
<srcfiles dir="${src.classes}">
|
|
||||||
<patternset refid="src.javac"/>
|
|
||||||
<include name="${src.classes}/com/sun/tools/javac/resources/*.properties"/>
|
|
||||||
</srcfiles>
|
|
||||||
</uptodate>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build" depends="prep,build-lib.javac.jar,build-bin.javac"/>
|
|
||||||
|
|
||||||
<target name="build-lib.javac.jar" depends="check-javac.isuptodate" unless="javac.is.uptodate">
|
|
||||||
<!-- to compile javac, set includeAntRuntime=no to prevent javac's
|
|
||||||
own tools.jar incorrectly appearing on the classpath -->
|
|
||||||
<javac srcdir="${src.classes}" destdir="${build.bootclasses}"
|
|
||||||
source="${compiler.source.level}" debug="true" debuglevel="source,lines"
|
|
||||||
includeAntRuntime="no">
|
|
||||||
<patternset refid="src.javac"/>
|
|
||||||
</javac>
|
|
||||||
<copy todir="${build.bootclasses}">
|
|
||||||
<fileset refid="javac.resources"/>
|
|
||||||
</copy>
|
|
||||||
<echo message="recompiling compiler with itself"/>
|
|
||||||
<pathconvert pathsep=" " property="src.javac.files">
|
|
||||||
<path>
|
|
||||||
<fileset dir="${src.classes}">
|
|
||||||
<patternset refid="src.javac"/>
|
|
||||||
</fileset>
|
|
||||||
</path>
|
|
||||||
</pathconvert>
|
|
||||||
<java fork="true" classpath="${build.bootclasses}" classname="com.sun.tools.javac.Main">
|
|
||||||
<arg value="-sourcepath"/>
|
|
||||||
<arg value=""/>
|
|
||||||
<arg value="-d"/>
|
|
||||||
<arg file="${build.classes}"/>
|
|
||||||
<arg value="-g:source,lines"/>
|
|
||||||
<arg line="${src.javac.files}"/>
|
|
||||||
</java>
|
|
||||||
<copy todir="${build.classes}">
|
|
||||||
<fileset refid="javac.resources"/>
|
|
||||||
</copy>
|
|
||||||
<copy file="${src.classes}/com/sun/tools/javac/resources/version-template.properties"
|
|
||||||
tofile="${build.classes}/com/sun/tools/javac/resources/version.properties">
|
|
||||||
<filterset begintoken="$(" endtoken=")">
|
|
||||||
<filter token="JDK_VERSION" value="${build.jdk.version}"/>
|
|
||||||
<filter token="RELEASE" value="${build.release}"/>
|
|
||||||
<filter token="FULL_VERSION" value="${build.full.version}"/>
|
|
||||||
</filterset>
|
|
||||||
</copy>
|
|
||||||
<jar destfile="${dist.javac}/lib/javac.jar" basedir="${build.classes}">
|
|
||||||
<manifest>
|
|
||||||
<attribute name="Built-By" value="${user.name}"/>
|
|
||||||
<attribute name="Built-At" value="${build.time}"/>
|
|
||||||
<attribute name="Main-Class" value="com.sun.tools.javac.Main"/>
|
|
||||||
</manifest>
|
|
||||||
</jar>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build-bin.javac">
|
|
||||||
<copy tofile="${dist.javac}/bin/javac" file="${src.bin}/javac.sh"/>
|
|
||||||
<chmod file="${dist.javac}/bin/javac" perm="+x"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<property name="javadoc.jls3.url" value="http://java.sun.com/docs/books/jls/"/>
|
|
||||||
<property name="javadoc.jls3.cite" value="<a href="${javadoc.jls3.url}">The Java Language Specification, Third Edition</a>"/>
|
|
||||||
|
|
||||||
<target name="docs" depends="prep">
|
|
||||||
<javadoc sourcepath="${src.classes}" destdir="${dist}/doc/api"
|
|
||||||
bootclasspath="${java.home}/lib/rt.jar" classpath="">
|
|
||||||
<package name="javax.annotation.processing.*"/>
|
|
||||||
<package name="javax.lang.model.*"/>
|
|
||||||
<package name="javax.tools.*"/>
|
|
||||||
<package name="com.sun.source.*"/>
|
|
||||||
<package name="com.sun.tools.javac.*"/>
|
|
||||||
<arg value="-tag"/>
|
|
||||||
<arg value="jls3:a:See <cite>${javadoc.jls3.cite}</cite>:"/>
|
|
||||||
</javadoc>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="test" depends="xtest" />
|
|
||||||
|
|
||||||
<!-- can't call it test, because NetBeans associates that with JUnit -->
|
|
||||||
<target name="xtest" depends="build">
|
|
||||||
<fail unless="jtreg.home" message="Property 'jtreg.home' needs to be set to the jtreg installation directory."/>
|
|
||||||
<taskdef name="jtreg" classpath="${jtreg.home}/lib/jtreg.jar" classname="com.sun.javatest.regtest.Main$$Ant"/>
|
|
||||||
<fail unless="test.jdk.home" message="Property 'test.jdk.home' needs to be set to the baseline JDK to be used to run the tests"/>
|
|
||||||
<jtreg dir="test" samevm="true" verbose="summary"
|
|
||||||
jdk="${test.jdk.home}"
|
|
||||||
workDir="${build.jtreg}/work"
|
|
||||||
reportDir="${build.jtreg}/report">
|
|
||||||
<arg value="-noshell"/>
|
|
||||||
<arg value="-Xbootclasspath/p:${dist.javac}/lib/javac.jar"/>
|
|
||||||
<include name="tools/javac"/>
|
|
||||||
</jtreg>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="clean">
|
|
||||||
<delete dir="${build}"/>
|
|
||||||
<delete dir="${dist}"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
*
|
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation. Sun designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Sun in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
||||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
||||||
* have any questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright <EFBFBD> 2005 Sun Microsystems, Inc. All rights reserved.
|
|
||||||
* Use is subject to license terms.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
body { background-color: #FFFFFF; font-family: Arial, Helvetica, sans-serif;
|
|
||||||
border-top-width: 0px; border-right-width: 0px;
|
|
||||||
border-bottom-width: 0px; border-left-width: 0px}
|
|
||||||
h1 { font-family: Arial, Helvetica, sans-serif}
|
|
||||||
h2 { font-family: Arial, Helvetica, sans-serif; padding-top: 25px}
|
|
||||||
h3 { font-family: Arial, Helvetica, sans-serif}
|
|
||||||
h4 { font-family: Arial, Helvetica, sans-serif}
|
|
||||||
li { font-family: Arial, Helvetica, sans-serif}
|
|
||||||
table { font-family: Arial, Helvetica, sans-serif;
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
margin-top: 0px; padding-top: 0px;
|
|
||||||
border-top-width: 0px; border-right-width: 0px;
|
|
||||||
border-bottom-width: 0px; border-left-width: 0px;
|
|
||||||
margin-bottom: 10px; margin-left: 0px;
|
|
||||||
padding-bottom: 5px; padding-left: 5px}
|
|
||||||
td { vertical-align: top; font-family: Arial, Helvetica, sans-serif}
|
|
||||||
td h1 { text-align: center}
|
|
||||||
td h2 { text-align: center; padding-top: 0px}
|
|
||||||
td h4 { text-align: center}
|
|
||||||
th { font-family: Arial, Helvetica, sans-serif; text-align: left;
|
|
||||||
padding-top: 10px; padding-right: 10px; padding-bottom: 0px;
|
|
||||||
padding-left: 10px; white-space: nowrap}
|
|
||||||
|
|
||||||
.sun-darkblue { font-family: Arial, Helvetica, sans-serif ;
|
|
||||||
color: #FFFFFF; background-color: #666699}
|
|
||||||
.sun-lightblue { background-color: #9999CC}
|
|
||||||
.nav-link { font-family: Arial, Helvetica, sans-serif; font-size: x-small}
|
|
||||||
code { font-family: Courier, serif}
|
|
@ -1,107 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
||||||
<!--
|
|
||||||
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
||||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
|
|
||||||
This code is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License version 2 only, as
|
|
||||||
published by the Free Software Foundation. Sun designates this
|
|
||||||
particular file as subject to the "Classpath" exception as provided
|
|
||||||
by Sun in the LICENSE file that accompanied this code.
|
|
||||||
|
|
||||||
This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
accompanied this code).
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License version
|
|
||||||
2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
||||||
CA 95054 USA or visit www.sun.com if you need additional information or
|
|
||||||
have any questions.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
|
|
||||||
<meta name="author" content="Jonathan Gibbons">
|
|
||||||
<link type="text/css" rel=stylesheet href="style.css">
|
|
||||||
<title>com.sun.tools.javac.comp.Enter</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h3>com.sun.tools.javac.util.Context</h3>
|
|
||||||
|
|
||||||
<p>Contexts provides a way to share data between the different parts of
|
|
||||||
the compiler.</p>
|
|
||||||
|
|
||||||
<p>They provide support for an abstract context, modelled loosely after
|
|
||||||
ThreadLocal but using a user-provided context instead of the current
|
|
||||||
thread.</p>
|
|
||||||
|
|
||||||
<p>Within the compiler, a single Context is used for each
|
|
||||||
invocation of the compiler. The context is then used to ensure a
|
|
||||||
single copy of each compiler phase exists per compiler invocation.</p>
|
|
||||||
|
|
||||||
<p>The context can be used to assist in extending the compiler by
|
|
||||||
extending its components. To do that, the extended component must
|
|
||||||
be registered before the base component. We break initialization
|
|
||||||
cycles by (1) registering a factory for the component rather than
|
|
||||||
the component itself, and (2) a convention for a pattern of usage
|
|
||||||
in which each base component registers itself by calling an
|
|
||||||
instance method that is overridden in extended components. A base
|
|
||||||
phase supporting extension would look something like this:</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
public class Phase {
|
|
||||||
protected static final Context.Key<Phase> phaseKey =
|
|
||||||
new Context.Key<Phase>();
|
|
||||||
|
|
||||||
public static Phase instance(Context context) {
|
|
||||||
Phase instance = context.get(phaseKey);
|
|
||||||
if (instance == null)
|
|
||||||
// the phase has not been overridden
|
|
||||||
instance = new Phase(context);
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Phase(Context context) {
|
|
||||||
context.put(phaseKey, this);
|
|
||||||
// other intitialization follows...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<p>In the compiler, we simply use Phase.instance(context) to get
|
|
||||||
the reference to the phase. But in extensions of the compiler, we
|
|
||||||
must register extensions of the phases to replace the base phase,
|
|
||||||
and this must be done before any reference to the phase is accessed
|
|
||||||
using Phase.instance(). An extended phase might be declared thus:</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
public class NewPhase extends Phase {
|
|
||||||
protected NewPhase(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
public static void preRegister(final Context context) {
|
|
||||||
context.put(phaseKey, new Context.Factory<Phase>() {
|
|
||||||
public Phase make() {
|
|
||||||
return new NewPhase(context);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<p>And is registered early in the extended compiler like this:</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
NewPhase.preRegister(context);
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,90 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
||||||
<!--
|
|
||||||
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
||||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
|
|
||||||
This code is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License version 2 only, as
|
|
||||||
published by the Free Software Foundation. Sun designates this
|
|
||||||
particular file as subject to the "Classpath" exception as provided
|
|
||||||
by Sun in the LICENSE file that accompanied this code.
|
|
||||||
|
|
||||||
This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
accompanied this code).
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License version
|
|
||||||
2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
||||||
CA 95054 USA or visit www.sun.com if you need additional information or
|
|
||||||
have any questions.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
|
|
||||||
<meta name="author" content="Jonathan Gibbons">
|
|
||||||
<link type="text/css" rel=stylesheet href="style.css">
|
|
||||||
<title>com.sun.tools.javac.comp.Enter</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h3>com.sun.tools.javac.comp.Enter</h3>
|
|
||||||
|
|
||||||
This enters symbols for all encountered definitions into
|
|
||||||
the symbol table. The pass consists of two phases, organized as
|
|
||||||
follows:
|
|
||||||
|
|
||||||
<ol>
|
|
||||||
<li><p>In the first phase, all class symbols are entered into their
|
|
||||||
enclosing scope, descending recursively down the tree for classes
|
|
||||||
which are members of other classes. The class symbols are given a
|
|
||||||
MemberEnter object as completer.</p></li>
|
|
||||||
|
|
||||||
<p><a name="package-info"></a>In addition,
|
|
||||||
if any <span class=code>package-info.java</span> files are found,
|
|
||||||
containing package annotations, then the TopLevel tree node for
|
|
||||||
the package-info.java file is put on the "to do" as well.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<li><p>In the second phase, classes are completed using
|
|
||||||
MemberEnter.complete(). Completion might occur on demand, but
|
|
||||||
any classes that are not completed that way will be eventually
|
|
||||||
completed by processing the `uncompleted' queue. Completion
|
|
||||||
entails
|
|
||||||
<ul><li>(1) determination of a class's parameters, supertype and
|
|
||||||
interfaces, as well as <li>(2) entering all symbols defined in the
|
|
||||||
class into its scope, with the exception of class symbols which
|
|
||||||
have been entered in phase 1.</li>
|
|
||||||
</ul>
|
|
||||||
(2) depends on (1) having been
|
|
||||||
completed for a class and all its superclasses and enclosing
|
|
||||||
classes. That's why, after doing (1), we put classes in a
|
|
||||||
`halfcompleted' queue. Only when we have performed (1) for a class
|
|
||||||
and all it's superclasses and enclosing classes, we proceed to
|
|
||||||
(2).</p></li>
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
<p>Whereas the first phase is organized as a sweep through all
|
|
||||||
compiled syntax trees, the second phase is demand. Members of a
|
|
||||||
class are entered when the contents of a class are first
|
|
||||||
accessed. This is accomplished by installing completer objects in
|
|
||||||
class symbols for compiled classes which invoke the member-enter
|
|
||||||
phase for the corresponding class tree.</p>
|
|
||||||
|
|
||||||
<p>Classes migrate from one phase to the next via queues:</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
class enter -> (Enter.uncompleted) --> member enter (1)
|
|
||||||
-> (MemberEnter.halfcompleted) --> member enter (2)
|
|
||||||
-> (Todo) --> attribute
|
|
||||||
(only for toplevel classes)
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
||||||
<!--
|
|
||||||
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
||||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
|
|
||||||
This code is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License version 2 only, as
|
|
||||||
published by the Free Software Foundation. Sun designates this
|
|
||||||
particular file as subject to the "Classpath" exception as provided
|
|
||||||
by Sun in the LICENSE file that accompanied this code.
|
|
||||||
|
|
||||||
This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
accompanied this code).
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License version
|
|
||||||
2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
||||||
CA 95054 USA or visit www.sun.com if you need additional information or
|
|
||||||
have any questions.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
|
|
||||||
<meta name="author" content="Jonathan Gibbons">
|
|
||||||
<link type="text/css" rel=stylesheet href="style.css">
|
|
||||||
<title>JavaCompiler</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h3>com.sun.tools.javac.main.JavaCompiler</h3>
|
|
||||||
<p>
|
|
||||||
<code>JavaCompiler</code> provides (and enforces) a use-once method to compile a list of source files.
|
|
||||||
It invokes the various phases of the compiler to cause those source files to be compiled.
|
|
||||||
</p>
|
|
||||||
<ul>
|
|
||||||
<li>All the files given on the command line are parsed, to build a
|
|
||||||
list of parse trees. Lexing and parsing are done with
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/parser/Scanner.java" class=code>Scanner</a> and
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/parser/Parser.java" class=code>Parser</a>.
|
|
||||||
Lexical and syntax errors will be detected here.
|
|
||||||
<p class=note>
|
|
||||||
Note: Additional files may be parsed later, if they are found on the class/source path, and if they are newer than their matching class file.
|
|
||||||
</p>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>For each of the parse trees, their symbols are "entered", using
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/comp/Enter.java" class=code>Enter</a>. This will also set up a "to do" list of additional work to be done to compile those parse trees.
|
|
||||||
<i>(<a href="Enter.html">more...</a>)</i>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>If source code or stub code will be generated, a list is made
|
|
||||||
(in rootClasses) of all the top level classes defined in the parse trees. This will be used later, to check whether a class being processed was directly provided on the command line or not.
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>Then, for as long as there is work on the "to do" list,
|
|
||||||
<code>JavaCompiler</code> processes entries from the "to do" list.
|
|
||||||
In so doing, the compiler might find additional classes that need to be
|
|
||||||
processed, which may result in additional entries being added to the
|
|
||||||
"to do" list. <i>(<a href="ToDo.html">more...</a>)</i>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>Print final messages.</li>
|
|
||||||
|
|
||||||
<li>Return a list of class symbols, perhaps just those from
|
|
||||||
final lower (may not include top level classes)
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
||||||
<!--
|
|
||||||
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
||||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
|
|
||||||
This code is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License version 2 only, as
|
|
||||||
published by the Free Software Foundation. Sun designates this
|
|
||||||
particular file as subject to the "Classpath" exception as provided
|
|
||||||
by Sun in the LICENSE file that accompanied this code.
|
|
||||||
|
|
||||||
This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
accompanied this code).
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License version
|
|
||||||
2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
||||||
CA 95054 USA or visit www.sun.com if you need additional information or
|
|
||||||
have any questions.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
|
|
||||||
<meta name="author" content="Jonathan Gibbons">
|
|
||||||
<link type="text/css" rel="stylesheet" href="style.css">
|
|
||||||
<title>Main</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h3>com.sun.tools.javac.main.Main</h3>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
The normal main entry point is
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/main/Main.java" class=code>com.sun.tools.javac.main.Main</a>,
|
|
||||||
with a public API entry point at
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/Main.java" class=code>com.sun.tools.javac.Main</a> which just calls down to <code>com.sun.tools.javac.main.Main</code>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>The various parts of the compiler share common information by means of a
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/util/Context.java" class=code>Context</a>.
|
|
||||||
Every invocation of the compiler must have its own Context.
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<code>com.sun.tools.javac.main.Main</code> does command line processing to determine the list of files to be compiled, and any applicable options. There are four types of options:
|
|
||||||
<ul>
|
|
||||||
<li>standard public options, e.g. <code>-classpath</code>
|
|
||||||
<li>extended public options, beginning -X, e.g. <code>-Xlint</code>
|
|
||||||
<li>hidden options -- not public or documented, e.g. -fullversion
|
|
||||||
<li>even more hidden options -- typically for debugging the compiler, beginning -XD, e.g. -XDrawDiagnostics
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
If there are files to be compiled, <code>Main</code> invokes
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/main/JavaCompiler.java" class=code>JavaCompiler</a> <i>(<a href="JavaCompiler.html">more...</a>)</i>
|
|
||||||
After <code>JavaCompiler</code> completes, the list of class symbols that was returned is discarded.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Any and all exceptions are caught and handled, and a return code is
|
|
||||||
determined. Finally, the compiler exits.
|
|
||||||
<p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@ -1,167 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
||||||
<!--
|
|
||||||
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
||||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
|
|
||||||
This code is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License version 2 only, as
|
|
||||||
published by the Free Software Foundation. Sun designates this
|
|
||||||
particular file as subject to the "Classpath" exception as provided
|
|
||||||
by Sun in the LICENSE file that accompanied this code.
|
|
||||||
|
|
||||||
This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
accompanied this code).
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License version
|
|
||||||
2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
||||||
CA 95054 USA or visit www.sun.com if you need additional information or
|
|
||||||
have any questions.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
|
|
||||||
<meta name="author" content="Jonathan Gibbons">
|
|
||||||
<link type="text/css" rel=stylesheet href="style.css">
|
|
||||||
<title>JavaCompiler's "to do" list</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h3>com.sun.tools.javac.main.JavaCompiler's "to do" list</h3>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
After the source files have been parsed, and their symbols entered
|
|
||||||
in the symbol table, the top level classes and some other items end
|
|
||||||
up on JavaCompiler's "to do" list.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
For each entry on the "to do" list, <code>JavaCompiler</code>
|
|
||||||
processes it as follows:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li><p>Some parts of the compilation involve modifying the parse tree,
|
|
||||||
so a copy of the root of the tree is kept prior to such manipulation.
|
|
||||||
</p>
|
|
||||||
<p class="note">
|
|
||||||
Note: this copy is just used to check whether the class is one of those
|
|
||||||
found in a compilation unit on the command line (i.e. in rootClasses).
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<li><p>The top level classes are "attributed", using
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/comp/Attr.java" class="code">Attr</a>,
|
|
||||||
meaning that names and other elements within the parse tree are resolved
|
|
||||||
and associated with the corresponding types and symbols. Many semantic
|
|
||||||
errors may be detected here, either by <code>Attr</code>, or by
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/comp/Check.java" class="code">Check</a>.
|
|
||||||
</p>
|
|
||||||
<p>While attributing the tree, class files will be read as necessary.
|
|
||||||
In addition, if a class is required, and a source file for the class is found
|
|
||||||
that is newer than the class file, the source file will be automatically parsed
|
|
||||||
and put on the "to do" list. This is done by registering JavaCompiler as an
|
|
||||||
implementation of
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/comp/Attr.java" class="code">Attr</a><span class=code>.SourceCompleter</span>.
|
|
||||||
</p>
|
|
||||||
<p class=note>
|
|
||||||
Note: there is a hidden option <code>-attrparseonly</code> which can be used to skip
|
|
||||||
the rest of the processing for this file. In so doing, it "breaks" the
|
|
||||||
protocol use to save and restore the source file used to report error
|
|
||||||
messages (Log.useSource). There is a "try finally" block which
|
|
||||||
could reasonably be used/extended to restore the source file correctly.
|
|
||||||
</p>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li><p>If there are no errors so far, flow analysis will be done for the class, using
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/comp/Flow.java" class="code">Flow</a>.
|
|
||||||
Flow analysis is used to check for definite assignment to variables,
|
|
||||||
and unreachable statements, which may result in additional errors.
|
|
||||||
</p>
|
|
||||||
<p class="note">Note: flow analysis can be suppressed with the hidden
|
|
||||||
option <code>-relax</code>.
|
|
||||||
</p>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>If the "to do" item is a TopLevel tree, it will be the contents of a
|
|
||||||
<span class="code">package-info.java</span> file, containing annotations for a package.
|
|
||||||
(See notes for <a href="Enter.html#package-info">Enter</a>.)
|
|
||||||
<ul>
|
|
||||||
<li>Syntactic sugar is processed, using
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/comp/Lower.java" class="code">Lower</a>.
|
|
||||||
<code>Lower</code> is defined to return a list of trees for the translated classes
|
|
||||||
and all the translated inner classes.</li>
|
|
||||||
<li>If <code>Lower</code> returns a non-empty list, there is an assertion that
|
|
||||||
the list has a single element, in which case, code is generated, using
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/jvm/Gen.java" class="code">Gen</a>,
|
|
||||||
and the resulting code is written out using
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java" class="code">ClassWriter</a>.
|
|
||||||
</li>
|
|
||||||
<li>No further processing is done on this "to do" item.<br>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<p class=note>Note that <a href="Enter.html">Enter</a> will have processed all other TopLevel
|
|
||||||
putting the individual classes that it finds there on the "to do"
|
|
||||||
(and not the TopLevel node itself.)
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<li>If stub outputs have been requested, with the hidden <code>-stubs</code> option,
|
|
||||||
<ul>
|
|
||||||
<li>If the class was one of those mentioned on the command line and is in
|
|
||||||
<span class=code>java.lang</span>,
|
|
||||||
pretty print the source with no method bodies.</li>
|
|
||||||
<li>No further processing is done on this "to do" item. </li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<li>Code involving generic types is translated to code without generic types, using
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/comp/TransTypes.java" class="code">TransTypes</a>.
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>If source output has been requested, with the hidden <code>-s</code> option
|
|
||||||
<ul>
|
|
||||||
<li>If the original tree was from command line, pretty print the source code
|
|
||||||
</li>
|
|
||||||
<li>No further processing is done on this "to do" item.</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<li>Syntactic sugar is processed, using
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/comp/Lower.java" class="code">Lower</a>.
|
|
||||||
This takes care of inner classes, class literals, assertions, foreach
|
|
||||||
loops, etc.
|
|
||||||
<code>Lower</code> is defined to return a list of trees for the translated classes
|
|
||||||
and all the translated inner classes.</li>
|
|
||||||
|
|
||||||
<p class=note>
|
|
||||||
Note: see also the use of <code>Lower</code> earlier in the loop, when processing
|
|
||||||
TopLevel trees.</p>
|
|
||||||
|
|
||||||
<li>For each class returned by <code>Lower</code><br>
|
|
||||||
<ul>
|
|
||||||
<li>If source has been requestion with the hidden <code>-printflat</code>
|
|
||||||
option, the source of the class is printed.
|
|
||||||
<li>Otherwise, code for the class is generated, using
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/jvm/Gen.java" class="code">Gen</a>,
|
|
||||||
and the resulting code is written out using
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java" class="code">ClassWriter</a>.
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h4>Issues</h4>
|
|
||||||
The "to do" list is mostly organized by top level classes, and not by
|
|
||||||
compilation units. This means that if a compilation unit contains several
|
|
||||||
classes, it is possible for code to be generated for some of the classes
|
|
||||||
in the file, at which point at error may be detected for one of the
|
|
||||||
remaining classes, preventing code from being generated for that and any
|
|
||||||
subsequent classes. This means that the compilation unit will be partially
|
|
||||||
compiled, with some but not all of the class files being generated.
|
|
||||||
(Bug <a href="http://monaco.sfbay.sun.com/detail.jsf?cr=5011101">5011101</a>)
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
||||||
<!--
|
|
||||||
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
||||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
|
|
||||||
This code is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License version 2 only, as
|
|
||||||
published by the Free Software Foundation. Sun designates this
|
|
||||||
particular file as subject to the "Classpath" exception as provided
|
|
||||||
by Sun in the LICENSE file that accompanied this code.
|
|
||||||
|
|
||||||
This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
accompanied this code).
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License version
|
|
||||||
2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
||||||
CA 95054 USA or visit www.sun.com if you need additional information or
|
|
||||||
have any questions.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
|
|
||||||
<meta name="author" content="Jonathan Gibbons">
|
|
||||||
<link type="text/css" rel="stylesheet" href="style.css">
|
|
||||||
<title>com.sun.tools.javac.comp.Enter</title>
|
|
||||||
</head>
|
|
||||||
<body class="contents">
|
|
||||||
<a target=main href="packages.html">Packages</a><br>
|
|
||||||
<br>
|
|
||||||
Classes<br>
|
|
||||||
<a target=main href="Context.html">Context</a><br>
|
|
||||||
<a target=main href="Enter.html">Enter</a><br>
|
|
||||||
<a target=main href="JavaCompiler.html">JavaCompiler</a><br>
|
|
||||||
<a target=main href="Main.html">Main</a><br>
|
|
||||||
<a target=main href="ToDo.html">ToDo</a><br>
|
|
||||||
</body>
|
|
@ -1,40 +0,0 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
|
|
||||||
<!--
|
|
||||||
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
||||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
|
|
||||||
This code is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License version 2 only, as
|
|
||||||
published by the Free Software Foundation. Sun designates this
|
|
||||||
particular file as subject to the "Classpath" exception as provided
|
|
||||||
by Sun in the LICENSE file that accompanied this code.
|
|
||||||
|
|
||||||
This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
accompanied this code).
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License version
|
|
||||||
2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
||||||
CA 95054 USA or visit www.sun.com if you need additional information or
|
|
||||||
have any questions.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>javac life cycle</title>
|
|
||||||
</head>
|
|
||||||
<frameset cols="150,*" border="0" frameborder="0" framespacing="0">
|
|
||||||
<frame name="contents" scrolling="no" frameborder="0" src="contents.html">
|
|
||||||
<frame name="main" scrolling="auto" frameborder="0" src="packages.html">
|
|
||||||
<noframes>
|
|
||||||
<body>
|
|
||||||
<p>This page uses frames, but your browser doesn't support them.</p>
|
|
||||||
</body>
|
|
||||||
</noframes>
|
|
||||||
</frameset>
|
|
||||||
</html>
|
|
@ -1,91 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
||||||
<!--
|
|
||||||
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
||||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
|
|
||||||
This code is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License version 2 only, as
|
|
||||||
published by the Free Software Foundation. Sun designates this
|
|
||||||
particular file as subject to the "Classpath" exception as provided
|
|
||||||
by Sun in the LICENSE file that accompanied this code.
|
|
||||||
|
|
||||||
This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
accompanied this code).
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License version
|
|
||||||
2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
||||||
CA 95054 USA or visit www.sun.com if you need additional information or
|
|
||||||
have any questions.
|
|
||||||
|
|
||||||
-->
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
|
|
||||||
<meta name="author" content="Jonathan Gibbons">
|
|
||||||
<link type="text/css" rel="stylesheet" href="style.css">
|
|
||||||
<title>Packages</title>
|
|
||||||
<style type="text/css">
|
|
||||||
th { text-align:left }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h3>javac Packages</h3>
|
|
||||||
|
|
||||||
<p>With the exception of a publicly supported entry point at
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/Main.java" class="code">com.sun.tools.javac.Main</a>,
|
|
||||||
javac is organized as a set of packages under
|
|
||||||
<span class="code">com.sun.tools.javac</span>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr><th>Sub-package<th>Description
|
|
||||||
<tr>
|
|
||||||
<td valign=top><span class=code>code</code>
|
|
||||||
<td>Classes to represent the internal semantics of a Java program --
|
|
||||||
types, symbols, etc.
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td valign=top><span class=code>comp</code>
|
|
||||||
<td>Classes that analyse and annotate the parse tree with semantic
|
|
||||||
details, such as determining the types and symbols referred to by identifiers.
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td valign=top><span class=code>jvm</code>
|
|
||||||
<td>Back end classes to read and write class files.
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td valign=top><span class=code>main</code>
|
|
||||||
<td>Top-level driver classes. The standard entry point to the compiler is
|
|
||||||
<a href="../../src/share/classes/com/sun/tools/javac/main/Main.java" class="code">com.sun.tools.javac.main.Main</a> <i>(<a href="Main.html">more...</a>)</i>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td valign=top><span class=code>parser</code>
|
|
||||||
<td>Classes to read a Java source file and create a corresponding parse tree.
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td valign=top><span class=code>resources</code>
|
|
||||||
<td>Resource classes for messages generated by the compiler. Two of the
|
|
||||||
three classes are automagically generated by a "property file compiler"
|
|
||||||
from a property source file; the third is automagically generated during
|
|
||||||
the build to contain build version information.
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td valign=top><span class=code>tree</code>
|
|
||||||
<td>Classes representing an annotated syntax tree for a Java program.
|
|
||||||
The top level node, representing the contents of a source file is
|
|
||||||
<span sclass="code">Tree.TopLevel</code>.
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td valign=top><span class=code>util</code>
|
|
||||||
<td>Utility classes used throughout the compiler, providing support for
|
|
||||||
diagnostics, access to the file system, and javac's collection classes.
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
*
|
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation. Sun designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Sun in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
||||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
||||||
* have any questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
body { color: black; background-color: #eeffee }
|
|
||||||
body.contents { background-color: #ddffdd }
|
|
||||||
|
|
||||||
li { margin-top:10px }
|
|
||||||
p.note { font-size:smaller }
|
|
||||||
|
|
||||||
.code { font-family:monospace }
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
||||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
|
|
||||||
This code is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License version 2 only, as
|
|
||||||
published by the Free Software Foundation. Sun designates this
|
|
||||||
particular file as subject to the "Classpath" exception as provided
|
|
||||||
by Sun in the LICENSE file that accompanied this code.
|
|
||||||
|
|
||||||
This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
accompanied this code).
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License version
|
|
||||||
2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
||||||
CA 95054 USA or visit www.sun.com if you need additional information or
|
|
||||||
have any questions.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
|
||||||
<type>org.netbeans.modules.ant.freeform</type>
|
|
||||||
<configuration>
|
|
||||||
<general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
|
|
||||||
<!-- Do not use Project Properties customizer when editing this file manually. -->
|
|
||||||
<name>openjdk-javac</name>
|
|
||||||
<properties/>
|
|
||||||
<folders>
|
|
||||||
<source-folder>
|
|
||||||
<label>src/share/classes</label>
|
|
||||||
<type>java</type>
|
|
||||||
<location>src/share/classes</location>
|
|
||||||
</source-folder>
|
|
||||||
</folders>
|
|
||||||
<ide-actions>
|
|
||||||
<action name="build">
|
|
||||||
<target>build</target>
|
|
||||||
</action>
|
|
||||||
<action name="clean">
|
|
||||||
<target>clean</target>
|
|
||||||
</action>
|
|
||||||
<action name="javadoc">
|
|
||||||
<target>docs</target>
|
|
||||||
</action>
|
|
||||||
<action name="rebuild">
|
|
||||||
<target>clean</target>
|
|
||||||
<target>build</target>
|
|
||||||
</action>
|
|
||||||
<action name="test">
|
|
||||||
<target>xtest</target>
|
|
||||||
</action>
|
|
||||||
</ide-actions>
|
|
||||||
<view>
|
|
||||||
<items>
|
|
||||||
<source-folder style="packages">
|
|
||||||
<label>src/share/classes</label>
|
|
||||||
<location>src/share/classes</location>
|
|
||||||
</source-folder>
|
|
||||||
<source-file>
|
|
||||||
<location>build.properties</location>
|
|
||||||
</source-file>
|
|
||||||
<source-file>
|
|
||||||
<location>build.xml</location>
|
|
||||||
</source-file>
|
|
||||||
</items>
|
|
||||||
<context-menu>
|
|
||||||
<ide-action name="build"/>
|
|
||||||
<ide-action name="clean"/>
|
|
||||||
<ide-action name="javadoc"/>
|
|
||||||
<ide-action name="rebuild"/>
|
|
||||||
</context-menu>
|
|
||||||
</view>
|
|
||||||
</general-data>
|
|
||||||
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
|
|
||||||
<compilation-unit>
|
|
||||||
<package-root>src/share/classes</package-root>
|
|
||||||
<source-level>1.5</source-level>
|
|
||||||
</compilation-unit>
|
|
||||||
</java-data>
|
|
||||||
</configuration>
|
|
||||||
</project>
|
|
@ -1,30 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
#
|
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU General Public License version 2 only, as
|
|
||||||
# published by the Free Software Foundation. Sun designates this
|
|
||||||
# particular file as subject to the "Classpath" exception as provided
|
|
||||||
# by Sun in the LICENSE file that accompanied this code.
|
|
||||||
#
|
|
||||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
# version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
# accompanied this code).
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License version
|
|
||||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
#
|
|
||||||
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
||||||
# CA 95054 USA or visit www.sun.com if you need additional information or
|
|
||||||
# have any questions.
|
|
||||||
#
|
|
||||||
|
|
||||||
mydir="`dirname $0`"
|
|
||||||
|
|
||||||
java -jar "${mydir}"/../lib/javac.jar "$@"
|
|
Loading…
x
Reference in New Issue
Block a user