--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgtags Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,1 @@
+1cc8dd79fd1cd13d36b385196271a29632c67c3b jdk7-b24
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgtags-top-repo Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,1 @@
+cfeea66a3fa8ca3686a7cfa2d0ce8ab0169f168d jdk7-b24
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.jcheck/conf Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,1 @@
+project=jdk7
--- a/Makefile Tue Apr 01 15:41:23 2008 -0700
+++ b/Makefile Mon Apr 07 17:38:21 2008 -0700
@@ -23,25 +23,25 @@
# have any questions.
#
+BUILD_PARENT_DIRECTORY=.
+
ifndef TOPDIR
- TOPDIR:=$(shell \
- if [ -r ./j2se/make/Makefile -o -r ./jdk/make/Makefile ]; then \
- echo "."; \
- else \
- echo "../.."; \
- fi)
+ TOPDIR:=.
endif
ifndef CONTROL_TOPDIR
- CONTROL_TOPDIR=$(TOPDIR)/control
- CONTROL_TOPDIR:=$(shell \
- if [ -r $(TOPDIR)/control/make/Makefile ]; then \
- echo "$(TOPDIR)/control"; \
- else \
- echo "$(TOPDIR)"; \
- fi)
+ CONTROL_TOPDIR=$(TOPDIR)
endif
+# Openjdk sources (only used if SKIP_OPENJDK_BUILD!=true)
+OPENJDK_SOURCETREE=$(TOPDIR)/openjdk
+OPENJDK_BUILDDIR:=$(shell \
+ if [ -r $(OPENJDK_SOURCETREE)/Makefile ]; then \
+ echo "$(OPENJDK_SOURCETREE)"; \
+ else \
+ echo "."; \
+ fi)
+
ifndef JDK_TOPDIR
JDK_TOPDIR=$(TOPDIR)/jdk
endif
@@ -55,6 +55,7 @@
all::
@$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: `$(DATE) '+%y-%m-%d %H:%M'`
+ $(MKDIR) -p $(OUTPUTDIR)
# Rules for sanity checks
include ./make/sanity-rules.gmk
@@ -81,11 +82,24 @@
all:: setup build
-setup:
+setup: openjdk_check
$(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
- $(MKDIR) -p $(ABS_OUTPUTDIR)/j2sdk-image
- $(MKDIR) -p $(OUTPUTDIR)-fastdebug/j2sdk-image
- $(MKDIR) -p $(ABS_OUTPUTDIR)-fastdebug/j2sdk-image
+
+# Check on whether we really can build the openjdk, need source etc.
+openjdk_check: FRC
+ifneq ($(SKIP_OPENJDK_BUILD), true)
+ @$(ECHO) " "
+ @$(ECHO) "================================================="
+ @if [ ! -r $(OPENJDK_BUILDDIR)/Makefile ] ; then \
+ $(ECHO) "ERROR: No openjdk source tree available at: $(OPENJDK_BUILDDIR)"; \
+ exit 1; \
+ else \
+ $(ECHO) "OpenJDK will be built after JDK is built"; \
+ $(ECHO) " OPENJDK_BUILDDIR=$(OPENJDK_BUILDDIR)"; \
+ fi
+ @$(ECHO) "================================================="
+ @$(ECHO) " "
+endif
build:: sanity
@@ -143,7 +157,7 @@
COMMON_DEBUG_FLAGS= \
DEBUG_NAME=$(DEBUG_NAME) \
- ALT_OUTPUTDIR=$(_OUTPUTDIR)-$(DEBUG_NAME) \
+ ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)-$(DEBUG_NAME) \
NO_DOCS=true
product_build: setup
@@ -190,46 +204,64 @@
all :: compare-image
endif
-ifeq ($(SKIP_OPENJDK_BUILD), false)
+ifneq ($(SKIP_OPENJDK_BUILD), true)
+ all :: openjdk_build
+endif
+
+# If we have bundle rules, we have a chance here to do a complete cycle
+# build, of production and open build.
+# FIXUP: We should create the openjdk source bundle and build that?
+# But how do we reliable create or get at a formal openjdk source tree?
+# The one we have needs to be trimmed of built bits and closed dirs.
+# The repositories might not be available.
+# The openjdk source bundle is probably not available.
+
+ifneq ($(SKIP_OPENJDK_BUILD), true)
ifeq ($(BUILD_JDK), true)
ifeq ($(BUNDLE_RULES_AVAILABLE), true)
- # If we have bundle rules, we have a chance here to do a complete cycle
- # build, of closed and open build.
- # FIXUP: We should create the openjdk source bundle and build that?
- ABS_OPENJDK_PLUGS=$(ABS_OUTPUTDIR)/$(OPENJDK_BINARY_PLUGS_INAME)
- ABS_OPENJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/openjdk
- OPENJDK_BUILD_NAME_PREFIX \
- = $(J2SDK_NAME)-$(JDK_MKTG_UNDERSCORE_VERSION)-$(MILESTONE)
- OPENJDK_BUILD_NAME_SUFFIX \
- = $(BUILD_NUMBER)-$(PLATFORM)-$(ARCH)-$(BUNDLE_DATE)
- OPENJDK_BUILD_NAME \
- = $(OPENJDK_BUILD_NAME_PREFIX)-openjdk-$(OPENJDK_BUILD_NAME_SUFFIX)
- OPENJDK_BUILD_BINARY_ZIP \
- = $(ABS_BIN_BUNDLEDIR)/$(OPENJDK_BUILD_NAME).zip
- all :: openjdk-build
- openjdk-build:
+
+OPENJDK_PLUGS=$(ABS_OUTPUTDIR)/$(OPENJDK_BINARY_PLUGS_INAME)
+OPENJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/open-output
+OPENJDK_BUILD_NAME \
+ = openjdk-$(JDK_MINOR_VERSION)-$(BUILD_NUMBER)-$(PLATFORM)-$(ARCH)-$(BUNDLE_DATE)
+OPENJDK_BUILD_BINARY_ZIP=$(ABS_BIN_BUNDLEDIR)/$(OPENJDK_BUILD_NAME).zip
+BUILT_IMAGE=$(ABS_OUTPUTDIR)/j2sdk-image
+ifeq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64)
+ OPENJDK_BOOTDIR=$(BOOTDIR)
+ OPENJDK_IMPORTJDK=$(JDK_IMPORT_PATH)
+else
+ OPENJDK_BOOTDIR=$(BUILT_IMAGE)
+ OPENJDK_IMPORTJDK=$(BUILT_IMAGE)
+endif
+
+openjdk_build:
@$(ECHO) " "
@$(ECHO) "================================================="
@$(ECHO) "Starting openjdk build"
+ @$(ECHO) " Using: ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR)"
@$(ECHO) "================================================="
@$(ECHO) " "
- $(RM) -r $(ABS_OPENJDK_OUTPUTDIR)
- $(MKDIR) -p $(ABS_OPENJDK_OUTPUTDIR)
- $(MAKE) OPENJDK=true \
- BUILD_LANGTOOLS=$(BUILD_LANGTOOLS) \
- BUILD_CORBA=$(BUILD_CORBA) \
- BUILD_JAXP=$(BUILD_JAXP) \
- BUILD_JAXWS=$(BUILD_JAXWS) \
- BUILD_HOTSPOT=$(BUILD_HOTSPOT) \
- ALT_OUTPUTDIR=$(ABS_OPENJDK_OUTPUTDIR) \
- ALT_BINARY_PLUGS_PATH=$(ABS_OUTPUTDIR)/$(OPENJDK_BINARY_PLUGS_INAME) \
- ALT_BOOTDIR=$(ABS_OUTPUTDIR)/j2sdk-image \
- ALT_JDK_IMPORT_PATH=$(ABS_OUTPUTDIR)/j2sdk-image \
- product_build
+ $(RM) -r $(OPENJDK_OUTPUTDIR)
+ $(MKDIR) -p $(OPENJDK_OUTPUTDIR)
+ ($(CD) $(OPENJDK_BUILDDIR) && $(MAKE) \
+ OPENJDK=true \
+ ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR) \
+ ALT_OUTPUTDIR=$(OPENJDK_OUTPUTDIR) \
+ ALT_BINARY_PLUGS_PATH=$(OPENJDK_PLUGS) \
+ ALT_BOOTDIR=$(OPENJDK_BOOTDIR) \
+ ALT_JDK_IMPORT_PATH=$(OPENJDK_IMPORTJDK) \
+ product_build )
$(RM) $(OPENJDK_BUILD_BINARY_ZIP)
- ( $(CD) $(ABS_OPENJDK_OUTPUTDIR)/j2sdk-image && \
+ ( $(CD) $(OPENJDK_OUTPUTDIR)/j2sdk-image && \
$(ZIPEXE) -q -r $(OPENJDK_BUILD_BINARY_ZIP) .)
- $(RM) -r $(ABS_OPENJDK_OUTPUTDIR)
+ $(RM) -r $(OPENJDK_OUTPUTDIR)
+ @$(ECHO) " "
+ @$(ECHO) "================================================="
+ @$(ECHO) "Finished openjdk build"
+ @$(ECHO) " Binary Bundle: $(OPENJDK_BUILD_BINARY_ZIP)"
+ @$(ECHO) "================================================="
+ @$(ECHO) " "
+
endif
endif
endif
@@ -432,11 +464,11 @@
# Cycle build. Build the jdk, use it to build the jdk again.
################################################################
-ABS_BOOTJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
+ABS_BOOTDIR_OUTPUTDIR=$(ABS_OUTPUTDIR)/bootjdk
boot_cycle:
- $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTJDK_OUTPUTDIR) product_build
- $(MAKE) ALT_BOOTDIR=$(ABS_BOOTJDK_OUTPUTDIR)/j2sdk-image product_build
+ $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) product_build
+ $(MAKE) ALT_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image product_build
################################################################
# JPRT rule to build
@@ -452,7 +484,6 @@
fastdebug_build debug_build product_build setup \
dev dev-build dev-sanity dev-clobber
-# FIXUP: Old j2se targets
-j2se_fastdebug_only: jdk_fastdebug_only
-j2se_only: jdk_only
+# Force target
+FRC:
--- a/README-builds.html Tue Apr 01 15:41:23 2008 -0700
+++ b/README-builds.html Mon Apr 07 17:38:21 2008 -0700
@@ -342,32 +342,29 @@
<blockquote>
<p>
- The source code for the
- OpenJDK is
- delivered in <i>3</i> sibling directories:
+ The source code for the OpenJDK is delivered in a set of
+ directories:
<tt>hotspot</tt>,
<tt>langtools</tt>,
<tt>corba</tt>,
<tt>jaxws</tt>,
<tt>jaxp</tt>,
- <tt>jdk</tt>
and
+ <tt>jdk</tt>.
The <tt>hotspot</tt> directory contains the source code and make
- files for
- building the
- OpenJDK
- Hotspot Virtual Machine.
- The <tt>jdk</tt>
- directory contains the source code and make files for
- building the
- OpenJDK
- runtime libraries, tools and demos.
- The top level Makefile is used to build the complete OpenJDK
- release including building the hotspot
- VM, staging the VM binaries, and building the
- OpenJDK
- runtime libraries,
- tools and demos.
+ files for building the OpenJDK Hotspot Virtual Machine.
+ The <tt>langtools</tt> directory contains the source code and make
+ files for building the OpenJDK javac and language tools.
+ The <tt>corba</tt> directory contains the source code and make
+ files for building the OpenJDK Corba files.
+ The <tt>jaxws</tt> directory contains the source code and make
+ files for building the OpenJDK JAXWS files.
+ The <tt>jaxp</tt> directory contains the source code and make
+ files for building the OpenJDK JAXP files.
+ The <tt>jdk</tt> directory contains the source code and make files for
+ building the OpenJDK runtime libraries and misc files.
+ The top level <tt>Makefile</tt>
+ is used to build the entire OpenJDK.
</blockquote>
<!-- ------------------------------------------------------ -->
@@ -730,17 +727,15 @@
under an open-source license.
In order to build an OpenJDK binary from source code,
you must first download and install the appropriate
- binary plug bundles from the OpenJDK Download area.
+ binary plug bundles from the OpenJDK, go to the
+ <a href="http://openjdk.java.net">OpenJDK</a> site and select
+ the "<b>Bundles(7)</b>" link.
During the OpenJDK build process these "binary plugs"
for the encumbered components will be copied into your
resulting OpenJDK binary build image.
These binary plug files are only for the purpose of
building an OpenJDK binary.
- Download the Binary Plugs by selecting the <b>Downloads</b>
- link at
- <a href="http://openjdk.java.net/">the OpenJDK site</a>,
- install the bundle,
- and make sure you set
+ Make sure you set
<tt><a href="#ALT_BINARY_PLUGS_PATH">ALT_BINARY_PLUGS_PATH</a></tt>
to the root of this installation.
</blockquote>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/corba/.hgtags Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,1 @@
+55540e827aef970ecc010b7e06b912d991c8e3ce jdk7-b24
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/corba/.jcheck/conf Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,1 @@
+project=jdk7
--- a/corba/make/common/shared/Defs.gmk Tue Apr 01 15:41:23 2008 -0700
+++ b/corba/make/common/shared/Defs.gmk Mon Apr 07 17:38:21 2008 -0700
@@ -281,6 +281,13 @@
# Get platform specific settings
include $(BUILDDIR)/common/shared/Defs-$(PLATFORM).gmk
+# Components
+ifdef ALT_LANGTOOLS_DIST
+ LANGTOOLS_DIST :=$(call FullPath,$(ALT_LANGTOOLS_DIST))
+else
+ LANGTOOLS_DIST =
+endif
+
# These are the same on all platforms but require the above platform include 1st
# BOOTDIR: Bootstrap JDK, previous released JDK.
--- a/corba/src/share/classes/com/sun/corba/se/impl/corba/orb_config_design.txt Tue Apr 01 15:41:23 2008 -0700
+++ b/corba/src/share/classes/com/sun/corba/se/impl/corba/orb_config_design.txt Mon Apr 07 17:38:21 2008 -0700
@@ -318,7 +318,7 @@
11. RequestHandler and ORB
- The RH interface is currently implemented in the ORB class, but migūt better be a separate
+ The RH interface is currently implemented in the ORB class, but might better be a separate
class. The API is currently almost the same as a ServerSubcontract. Should we regularize
this? Also, the API would need to be extended to handle shutdown properly.
--- a/corba/src/share/classes/org/omg/CORBA/ir.idl Tue Apr 01 15:41:23 2008 -0700
+++ b/corba/src/share/classes/org/omg/CORBA/ir.idl Mon Apr 07 17:38:21 2008 -0700
@@ -774,18 +774,18 @@
// orbos 98-01-18: Objects By Value -- end
- enum TCKind {
- tk_null, tk_void,
+ enum TCKind {
+ tk_null, tk_void,
tk_short, tk_long, tk_ushort, tk_ulong,
- tk_float, tk_double, tk_boolean, tk_char,
- tk_octet, tk_any, tk_TypeCode, tk_Principal, tk_objref,
- tk_struct, tk_union, tk_enum, tk_string,
- tk_sequence, tk_array, tk_alias, tk_except,
- tk_longlong, tk_ulonglong, tk_longdouble,
- tk_wchar, tk_wstring, tk_fixed,
- tk_value, tk_value_box,
- tk_native,
- tk_abstract_interface
+ tk_float, tk_double, tk_boolean, tk_char,
+ tk_octet, tk_any, tk_TypeCode, tk_Principal, tk_objref,
+ tk_struct, tk_union, tk_enum, tk_string,
+ tk_sequence, tk_array, tk_alias, tk_except,
+ tk_longlong, tk_ulonglong, tk_longdouble,
+ tk_wchar, tk_wstring, tk_fixed,
+ tk_value, tk_value_box,
+ tk_native,
+ tk_abstract_interface
};
interface NativeDef : TypedefDef {
--- a/corba/src/share/classes/org/omg/DynamicAny/DynamicAny.idl Tue Apr 01 15:41:23 2008 -0700
+++ b/corba/src/share/classes/org/omg/DynamicAny/DynamicAny.idl Mon Apr 07 17:38:21 2008 -0700
@@ -1042,24 +1042,24 @@
/**
* DynValueCommon provides operations supported by both the DynValue and DynValueBox interfaces.
*/
- interface DynValueCommon : DynAny {
+ interface DynValueCommon : DynAny {
/**
* Returns true if the DynValueCommon represents a null value type.
*/
- boolean is_null();
+ boolean is_null();
/**
* Changes the representation of a DynValueCommon to a null value type.
*/
- void set_to_null();
+ void set_to_null();
/**
* Replaces a null value type with a newly constructed value. Its components are initialized
* to default values as in DynAnyFactory.create_dyn_any_from_type_code.
* If the DynValueCommon represents a non-null value type, then this operation has no effect.
*/
- void set_to_value();
- };
+ void set_to_value();
+ };
/**
* DynValue objects support the manipulation of IDL non-boxed value types.
@@ -1164,14 +1164,14 @@
* of the boxed type. A DynValueBox representing a null value type has no components
* and a current position of -1.
*/
- interface DynValueBox : DynValueCommon {
+ interface DynValueBox : DynValueCommon {
/**
* Returns the boxed value as an Any.
*
* @exception InvalidValue if this object represents a null value box type
*/
- any get_boxed_value()
+ any get_boxed_value()
raises(InvalidValue);
/**
@@ -1189,7 +1189,7 @@
*
* @exception InvalidValue if this object represents a null value box type
*/
- DynAny get_boxed_value_as_dyn_any()
+ DynAny get_boxed_value_as_dyn_any()
raises(InvalidValue);
/**
@@ -1199,7 +1199,7 @@
* @exception TypeMismatch if this object represents a non-null value box type and the type
* of the parameter is not matching the current boxed value type.
*/
- void set_boxed_value_as_dyn_any(in DynAny boxed)
+ void set_boxed_value_as_dyn_any(in DynAny boxed)
raises(TypeMismatch);
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/.hgtags Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,1 @@
+a61af66fc99eb5ec9d50c05b0c599757b1289ceb jdk7-b24
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/.jcheck/conf Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,1 @@
+project=jdk7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/.hgtags Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,1 @@
+6ce5f4757bde08f7470cbb9f0b46da8f2f3d4f56 jdk7-b24
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/.jcheck/conf Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,1 @@
+project=jdk7
--- a/jaxp/make/Makefile Tue Apr 01 15:41:23 2008 -0700
+++ b/jaxp/make/Makefile Mon Apr 07 17:38:21 2008 -0700
@@ -90,7 +90,6 @@
else
OUTPUTDIR = ..
endif
-ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR))
ifdef ALT_LANGTOOLS_DIST
ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap
@@ -127,7 +126,11 @@
$(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@
# Targets for Sun's internal JPRT build system
+JPRT_ARCHIVE_BUNDLE=$(OUTPUTDIR)/jprt.zip
jprt_build_product jprt_build_debug jprt_build_fastdebug: all
+ $(RM) $(JPRT_ARCHIVE_BUNDLE)
+ ( cd $(OUTPUTDIR)/dist && \
+ zip -q -r $(JPRT_ARCHIVE_BUNDLE) . )
# Declare these phony (not filenames)
.PHONY: $(ANT_TARGETS) all clobber \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/.hgtags Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,1 @@
+0961a4a211765fea071b8dac419003ee0c3d5973 jdk7-b24
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/.jcheck/conf Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,1 @@
+project=jdk7
--- a/jaxws/make/Makefile Tue Apr 01 15:41:23 2008 -0700
+++ b/jaxws/make/Makefile Mon Apr 07 17:38:21 2008 -0700
@@ -69,7 +69,7 @@
endif
endif
-# Note: j2se/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
+# Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
# and the somewhat misnamed CLASS_VERSION (-target NN)
ifdef TARGET_CLASS_VERSION
ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
@@ -90,7 +90,6 @@
else
OUTPUTDIR = ..
endif
-ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR))
ifdef ALT_LANGTOOLS_DIST
ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap
@@ -127,7 +126,11 @@
$(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@
# Targets for Sun's internal JPRT build system
+JPRT_ARCHIVE_BUNDLE=$(OUTPUTDIR)/jprt.zip
jprt_build_product jprt_build_debug jprt_build_fastdebug: all
+ $(RM) $(JPRT_ARCHIVE_BUNDLE)
+ ( cd $(OUTPUTDIR)/dist && \
+ zip -q -r $(JPRT_ARCHIVE_BUNDLE) . )
# Declare these phony (not filenames)
.PHONY: $(ANT_TARGETS) all clobber \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/.hgtags Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,1 @@
+9a66ca7c79fab293c1bb0534e0d208c7e4f58b01 jdk7-b24
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/.jcheck/conf Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,1 @@
+project=jdk7
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java Mon Apr 07 17:38:21 2008 -0700
@@ -194,7 +194,7 @@
return map.get(option);
}
- private final String option;
+ public final String option;
};
/**
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Mon Apr 07 17:38:21 2008 -0700
@@ -25,13 +25,9 @@
package com.sun.tools.javac.code;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.Set;
import java.util.concurrent.Callable;
import javax.lang.model.element.*;
-import javax.lang.model.type.ReferenceType;
-import javax.lang.model.type.TypeMirror;
import javax.tools.JavaFileObject;
import com.sun.tools.javac.util.*;
@@ -1272,8 +1268,14 @@
private static final long serialVersionUID = 0;
public Symbol sym;
+ /** A diagnostic object describing the failure
+ */
+ public JCDiagnostic diag;
+
/** A localized string describing the failure.
+ * @deprecated Use {@code getDetail()} or {@code getMessage()}
*/
+ @Deprecated
public String errmsg;
public CompletionFailure(Symbol sym, String errmsg) {
@@ -1282,8 +1284,26 @@
// this.printStackTrace();//DEBUG
}
+ public CompletionFailure(Symbol sym, JCDiagnostic diag) {
+ this.sym = sym;
+ this.diag = diag;
+// this.printStackTrace();//DEBUG
+ }
+
+ public JCDiagnostic getDiagnostic() {
+ return diag;
+ }
+
+ @Override
public String getMessage() {
- return errmsg;
+ if (diag != null)
+ return diag.getMessage(null);
+ else
+ return errmsg;
+ }
+
+ public Object getDetailValue() {
+ return (diag != null ? diag : errmsg);
}
@Override
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Mon Apr 07 17:38:21 2008 -0700
@@ -2483,7 +2483,7 @@
break;
default:
if (t.isPrimitive())
- return syms.botType;
+ return syms.errType;
}
}
switch (boundkind) {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Apr 07 17:38:21 2008 -0700
@@ -465,12 +465,12 @@
types.setBounds(a, List.of(syms.objectType));
}
}
+ }
+
+ void attribBounds(List<JCTypeParameter> typarams, Env<AttrContext> env) {
for (JCTypeParameter tvar : typarams)
chk.checkNonCyclic(tvar.pos(), (TypeVar)tvar.type);
attribStats(typarams, env);
- }
-
- void attribBounds(List<JCTypeParameter> typarams) {
for (JCTypeParameter typaram : typarams) {
Type bound = typaram.type.getUpperBound();
if (bound != null && bound.tsym instanceof ClassSymbol) {
@@ -581,7 +581,7 @@
try {
chk.checkDeprecatedAnnotation(tree.pos(), m);
- attribBounds(tree.typarams);
+ attribBounds(tree.typarams, env);
// If we override any other methods, check that we do so properly.
// JLS ???
@@ -1609,17 +1609,10 @@
tree.getTag() - JCTree.ASGOffset,
owntype,
operand);
- if (types.isSameType(operator.type.getReturnType(), syms.stringType)) {
- // String assignment; make sure the lhs is a string
- chk.checkType(tree.lhs.pos(),
- owntype,
- syms.stringType);
- } else {
- chk.checkDivZero(tree.rhs.pos(), operator, operand);
- chk.checkCastable(tree.rhs.pos(),
- operator.type.getReturnType(),
- owntype);
- }
+ chk.checkDivZero(tree.rhs.pos(), operator, operand);
+ chk.checkCastable(tree.rhs.pos(),
+ operator.type.getReturnType(),
+ owntype);
}
result = check(tree, owntype, VAL, pkind, pt);
}
@@ -2514,6 +2507,7 @@
log.error(tree.bounds.tail.head.pos(),
"type.var.may.not.be.followed.by.other.bounds");
tree.bounds = List.of(tree.bounds.head);
+ a.bound = bs.head;
}
} else {
// if first bound was a class or interface, accept only interfaces
@@ -2687,7 +2681,7 @@
chk.validateAnnotations(tree.mods.annotations, c);
// Validate type parameters, supertype and interfaces.
- attribBounds(tree.typarams);
+ attribBounds(tree.typarams, env);
chk.validateTypeParams(tree.typarams);
chk.validate(tree.extending);
chk.validate(tree.implementing);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Mon Apr 07 17:38:21 2008 -0700
@@ -173,7 +173,7 @@
* @param ex The failure to report.
*/
public Type completionError(DiagnosticPosition pos, CompletionFailure ex) {
- log.error(pos, "cant.access", ex.sym, ex.errmsg);
+ log.error(pos, "cant.access", ex.sym, ex.getDetailValue());
if (ex instanceof ClassReader.BadClassFile) throw new Abort();
else return syms.errType;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java Mon Apr 07 17:38:21 2008 -0700
@@ -194,14 +194,14 @@
if (that.lobounds.isEmpty())
that.inst = syms.botType;
else if (that.lobounds.tail.isEmpty())
- that.inst = that.lobounds.head;
+ that.inst = that.lobounds.head.isPrimitive() ? syms.errType : that.lobounds.head;
else {
that.inst = types.lub(that.lobounds);
- if (that.inst == null)
+ }
+ if (that.inst == null || that.inst == syms.errType)
throw ambiguousNoInstanceException
.setMessage("no.unique.minimal.instance.exists",
that.qtype, that.lobounds);
- }
// VGJ: sort of inlined maximizeInst() below. Adding
// bounds can cause lobounds that are above hibounds.
if (that.hibounds.isEmpty())
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Mon Apr 07 17:38:21 2008 -0700
@@ -1835,6 +1835,7 @@
+ "" + rval.hashCode()),
type,
currentMethodSym);
+ rval = convert(rval,type);
JCVariableDecl def = make.VarDef(var, (JCExpression)rval); // XXX cast
JCTree built = builder.build(make.Ident(var));
JCTree res = make.LetExpr(def, built);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Mon Apr 07 17:38:21 2008 -0700
@@ -901,9 +901,9 @@
c.flags_field |= DEPRECATED;
annotateLater(tree.mods.annotations, baseEnv, c);
- attr.attribTypeVariables(tree.typarams, baseEnv);
+ chk.checkNonCyclic(tree.pos(), c.type);
- chk.checkNonCyclic(tree.pos(), c.type);
+ attr.attribTypeVariables(tree.typarams, baseEnv);
// Add default constructor if needed.
if ((c.flags() & INTERFACE) == 0 &&
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Mon Apr 07 17:38:21 2008 -0700
@@ -131,6 +131,10 @@
*/
private final JavaFileManager fileManager;
+ /** Factory for diagnostics
+ */
+ JCDiagnostic.Factory diagFactory;
+
/** Can be reassigned from outside:
* the completer to be used for ".java" files. If this remains unassigned
* ".java" files will not be loaded.
@@ -221,6 +225,7 @@
fileManager = context.get(JavaFileManager.class);
if (fileManager == null)
throw new AssertionError("FileManager initialization error");
+ diagFactory = JCDiagnostic.Factory.instance(context);
init(syms, definitive);
log = Log.instance(context);
@@ -256,23 +261,26 @@
* Error Diagnoses
***********************************************************************/
- public static class BadClassFile extends CompletionFailure {
+
+ public class BadClassFile extends CompletionFailure {
private static final long serialVersionUID = 0;
- /**
- * @param msg A localized message.
- */
- public BadClassFile(ClassSymbol c, Object cname, Object msg) {
- super(c, Log.getLocalizedString("bad.class.file.header",
- cname, msg));
+ public BadClassFile(TypeSymbol sym, JavaFileObject file, JCDiagnostic diag) {
+ super(sym, createBadClassFileDiagnostic(file, diag));
}
}
+ // where
+ private JCDiagnostic createBadClassFileDiagnostic(JavaFileObject file, JCDiagnostic diag) {
+ String key = (file.getKind() == JavaFileObject.Kind.SOURCE
+ ? "bad.source.file.header" : "bad.class.file.header");
+ return diagFactory.fragment(key, file, diag);
+ }
public BadClassFile badClassFile(String key, Object... args) {
return new BadClassFile (
currentOwner.enclClass(),
currentClassFile,
- Log.getLocalizedString(key, args));
+ diagFactory.fragment(key, args));
}
/************************************************************************
@@ -1893,10 +1901,10 @@
currentClassFile = previousClassFile;
}
} else {
+ JCDiagnostic diag =
+ diagFactory.fragment("class.file.not.found", c.flatname);
throw
- newCompletionFailure(c,
- Log.getLocalizedString("class.file.not.found",
- c.flatname));
+ newCompletionFailure(c, diag);
}
}
// where
@@ -1934,22 +1942,22 @@
* In practice, only one can be used at a time, so we share one
* to reduce the expense of allocating new exception objects.
*/
- private CompletionFailure newCompletionFailure(ClassSymbol c,
- String localized) {
+ private CompletionFailure newCompletionFailure(TypeSymbol c,
+ JCDiagnostic diag) {
if (!cacheCompletionFailure) {
// log.warning("proc.messager",
// Log.getLocalizedString("class.file.not.found", c.flatname));
// c.debug.printStackTrace();
- return new CompletionFailure(c, localized);
+ return new CompletionFailure(c, diag);
} else {
CompletionFailure result = cachedCompletionFailure;
result.sym = c;
- result.errmsg = localized;
+ result.diag = diag;
return result;
}
}
private CompletionFailure cachedCompletionFailure =
- new CompletionFailure(null, null);
+ new CompletionFailure(null, (JCDiagnostic) null);
{
cachedCompletionFailure.setStackTrace(new StackTraceElement[0]);
}
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Mon Apr 07 17:38:21 2008 -0700
@@ -198,6 +198,10 @@
*/
public Log log;
+ /** Factory for creating diagnostic objects
+ */
+ JCDiagnostic.Factory diagFactory;
+
/** The tree factory module.
*/
protected TreeMaker make;
@@ -304,6 +308,7 @@
names = Name.Table.instance(context);
log = Log.instance(context);
+ diagFactory = JCDiagnostic.Factory.instance(context);
reader = ClassReader.instance(context);
make = TreeMaker.instance(context);
writer = ClassWriter.instance(context);
@@ -318,7 +323,7 @@
syms = Symtab.instance(context);
} catch (CompletionFailure ex) {
// inlined Check.completionError as it is not initialized yet
- log.error("cant.access", ex.sym, ex.errmsg);
+ log.error("cant.access", ex.sym, ex.getDetailValue());
if (ex instanceof ClassReader.BadClassFile)
throw new Abort();
}
@@ -683,16 +688,16 @@
JavaFileObject.Kind.SOURCE);
if (isPkgInfo) {
if (enter.getEnv(tree.packge) == null) {
- String msg
- = log.getLocalizedString("file.does.not.contain.package",
+ JCDiagnostic diag =
+ diagFactory.fragment("file.does.not.contain.package",
c.location());
- throw new ClassReader.BadClassFile(c, filename, msg);
+ throw reader.new BadClassFile(c, filename, diag);
}
} else {
- throw new
- ClassReader.BadClassFile(c, filename, log.
- getLocalizedString("file.doesnt.contain.class",
- c.fullname));
+ JCDiagnostic diag =
+ diagFactory.fragment("file.doesnt.contain.class",
+ c.getQualifiedName());
+ throw reader.new BadClassFile(c, filename, diag);
}
}
@@ -997,7 +1002,7 @@
annotationProcessingOccurred = c.annotationProcessingOccurred = true;
return c;
} catch (CompletionFailure ex) {
- log.error("cant.access", ex.sym, ex.errmsg);
+ log.error("cant.access", ex.sym, ex.getDetailValue());
return this;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavacOption.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavacOption.java Mon Apr 07 17:38:21 2008 -0700
@@ -28,6 +28,8 @@
import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.util.Options;
import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.Collection;
/**
* TODO: describe com.sun.tools.javac.main.JavacOption
@@ -41,19 +43,29 @@
OptionKind getKind();
- /** Does this option take a (separate) operand? */
+ /** Does this option take a (separate) operand?
+ * @return true if this option takes a separate operand
+ */
boolean hasArg();
/** Does argument string match option pattern?
- * @param arg The command line argument string.
+ * @param arg the command line argument string
+ * @return true if {@code arg} matches this option
*/
boolean matches(String arg);
- /** Process the option (with arg). Return true if error detected.
+ /** Process an option with an argument.
+ * @param options the accumulated set of analyzed options
+ * @param option the option to be processed
+ * @param arg the arg for the option to be processed
+ * @return true if an error was detected
*/
boolean process(Options options, String option, String arg);
- /** Process the option (without arg). Return true if error detected.
+ /** Process the option with no argument.
+ * @param options the accumulated set of analyzed options
+ * @param option the option to be processed
+ * @return true if an error was detected
*/
boolean process(Options options, String option);
@@ -65,6 +77,11 @@
HIDDEN,
}
+ enum ChoiceKind {
+ ONEOF,
+ ANYOF
+ }
+
/** This class represents an option recognized by the main program
*/
static class Option implements JavacOption {
@@ -85,6 +102,14 @@
*/
boolean hasSuffix;
+ /** The kind of choices for this option, if any.
+ */
+ ChoiceKind choiceKind;
+
+ /** The choices for this option, if any.
+ */
+ Collection<String> choices;
+
Option(OptionName name, String argsNameKey, String descrKey) {
this.name = name;
this.argsNameKey = argsNameKey;
@@ -92,51 +117,116 @@
char lastChar = name.optionName.charAt(name.optionName.length()-1);
hasSuffix = lastChar == ':' || lastChar == '=';
}
+
Option(OptionName name, String descrKey) {
this(name, null, descrKey);
}
+ Option(OptionName name, String descrKey, ChoiceKind choiceKind, String... choices) {
+ this(name, descrKey, choiceKind, Arrays.asList(choices));
+ }
+
+ Option(OptionName name, String descrKey, ChoiceKind choiceKind, Collection<String> choices) {
+ this(name, null, descrKey);
+ if (choiceKind == null || choices == null)
+ throw new NullPointerException();
+ this.choiceKind = choiceKind;
+ this.choices = choices;
+ }
+
+ @Override
public String toString() {
return name.optionName;
}
- /** Does this option take a (separate) operand?
- */
public boolean hasArg() {
return argsNameKey != null && !hasSuffix;
}
- /** Does argument string match option pattern?
- * @param arg The command line argument string.
- */
- public boolean matches(String arg) {
- return hasSuffix ? arg.startsWith(name.optionName) : arg.equals(name.optionName);
+ public boolean matches(String option) {
+ if (!hasSuffix)
+ return option.equals(name.optionName);
+
+ if (!option.startsWith(name.optionName))
+ return false;
+
+ if (choices != null) {
+ String arg = option.substring(name.optionName.length());
+ if (choiceKind == ChoiceKind.ONEOF)
+ return choices.contains(arg);
+ else {
+ for (String a: arg.split(",+")) {
+ if (!choices.contains(a))
+ return false;
+ }
+ }
+ }
+
+ return true;
}
/** Print a line of documentation describing this option, if standard.
+ * @param out the stream to which to write the documentation
*/
void help(PrintWriter out) {
String s = " " + helpSynopsis();
out.print(s);
- for (int j = s.length(); j < 29; j++) out.print(" ");
+ for (int j = Math.min(s.length(), 28); j < 29; j++) out.print(" ");
Log.printLines(out, Main.getLocalizedString(descrKey));
}
+
String helpSynopsis() {
- return name +
- (argsNameKey == null ? "" :
- ((hasSuffix ? "" : " ") +
- Main.getLocalizedString(argsNameKey)));
+ StringBuilder sb = new StringBuilder();
+ sb.append(name);
+ if (argsNameKey == null) {
+ if (choices != null) {
+ String sep = "{";
+ for (String c: choices) {
+ sb.append(sep);
+ sb.append(c);
+ sep = ",";
+ }
+ sb.append("}");
+ }
+ } else {
+ if (!hasSuffix)
+ sb.append(" ");
+ sb.append(Main.getLocalizedString(argsNameKey));
+ }
+
+ return sb.toString();
}
/** Print a line of documentation describing this option, if non-standard.
+ * @param out the stream to which to write the documentation
*/
void xhelp(PrintWriter out) {}
/** Process the option (with arg). Return true if error detected.
*/
public boolean process(Options options, String option, String arg) {
- if (options != null)
+ if (options != null) {
+ if (choices != null) {
+ if (choiceKind == ChoiceKind.ONEOF) {
+ // some clients like to see just one of option+choice set
+ for (String c: choices)
+ options.remove(option + c);
+ String opt = option + arg;
+ options.put(opt, opt);
+ // some clients like to see option (without trailing ":")
+ // set to arg
+ String nm = option.substring(0, option.length() - 1);
+ options.put(nm, arg);
+ } else {
+ // set option+word for each word in arg
+ for (String a: arg.split(",+")) {
+ String opt = option + a;
+ options.put(opt, opt);
+ }
+ }
+ }
options.put(option, arg);
+ }
return false;
}
@@ -163,8 +253,17 @@
XOption(OptionName name, String descrKey) {
this(name, null, descrKey);
}
+ XOption(OptionName name, String descrKey, ChoiceKind kind, String... choices) {
+ super(name, descrKey, kind, choices);
+ }
+ XOption(OptionName name, String descrKey, ChoiceKind kind, Collection<String> choices) {
+ super(name, descrKey, kind, choices);
+ }
+ @Override
void help(PrintWriter out) {}
+ @Override
void xhelp(PrintWriter out) { super.help(out); }
+ @Override
public OptionKind getKind() { return OptionKind.EXTENDED; }
};
@@ -177,8 +276,11 @@
HiddenOption(OptionName name, String argsNameKey) {
super(name, argsNameKey, null);
}
+ @Override
void help(PrintWriter out) {}
+ @Override
void xhelp(PrintWriter out) {}
+ @Override
public OptionKind getKind() { return OptionKind.HIDDEN; }
};
--- a/langtools/src/share/classes/com/sun/tools/javac/main/OptionName.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/OptionName.java Mon Apr 07 17:38:21 2008 -0700
@@ -37,13 +37,9 @@
public enum OptionName {
G("-g"),
G_NONE("-g:none"),
- G_CUSTOM("-g:{lines,vars,source}"),
+ G_CUSTOM("-g:"),
XLINT("-Xlint"),
- XLINT_CUSTOM("-Xlint:{"
- + "all,"
- + "cast,deprecation,divzero,empty,unchecked,fallthrough,path,serial,finally,overrides,"
- + "-cast,-deprecation,-divzero,-empty,-unchecked,-fallthrough,-path,-serial,-finally,-overrides,"
- + "none}"),
+ XLINT_CUSTOM("-Xlint:"),
NOWARN("-nowarn"),
VERBOSE("-verbose"),
DEPRECATION("-deprecation"),
@@ -58,12 +54,12 @@
DJAVA_EXT_DIRS("-Djava.ext.dirs="),
ENDORSEDDIRS("-endorseddirs"),
DJAVA_ENDORSED_DIRS("-Djava.endorsed.dirs="),
- PROC_CUSTOM("-proc:{none,only}"),
+ PROC("-proc:"),
PROCESSOR("-processor"),
PROCESSORPATH("-processorpath"),
D("-d"),
S("-s"),
- IMPLICIT("-implicit:{none,class}"),
+ IMPLICIT("-implicit:"),
ENCODING("-encoding"),
SOURCE("-source"),
TARGET("-target"),
@@ -86,7 +82,7 @@
XPRINT("-Xprint"),
XPRINTROUNDS("-XprintRounds"),
XPRINTPROCESSORINFO("-XprintProcessorInfo"),
- XPREFER("-Xprefer:{source,newer}"),
+ XPREFER("-Xprefer:"),
O("-O"),
XJCOV("-Xjcov"),
XD("-XD"),
--- a/langtools/src/share/classes/com/sun/tools/javac/main/RecognizedOptions.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/RecognizedOptions.java Mon Apr 07 17:38:21 2008 -0700
@@ -25,21 +25,23 @@
package com.sun.tools.javac.main;
+import com.sun.tools.javac.code.Lint;
import com.sun.tools.javac.code.Source;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.jvm.Target;
import com.sun.tools.javac.main.JavacOption.HiddenOption;
import com.sun.tools.javac.main.JavacOption.Option;
import com.sun.tools.javac.main.JavacOption.XOption;
-import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.util.Options;
import com.sun.tools.javac.processing.JavacProcessingEnvironment;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.EnumSet;
+import java.util.LinkedHashSet;
import java.util.Set;
import java.util.StringTokenizer;
import javax.lang.model.SourceVersion;
@@ -134,7 +136,7 @@
DJAVA_EXT_DIRS,
ENDORSEDDIRS,
DJAVA_ENDORSED_DIRS,
- PROC_CUSTOM,
+ PROC,
PROCESSOR,
PROCESSORPATH,
D,
@@ -195,7 +197,7 @@
NOWARN,
VERBOSE,
DEPRECATION,
- PROC_CUSTOM,
+ PROC,
PROCESSOR,
IMPLICIT,
SOURCE,
@@ -245,79 +247,58 @@
}
/**
- * @param out the writer to use for diagnostic output
+ * Get all the recognized options.
+ * @param helper an {@code OptionHelper} to help when processing options
+ * @return an array of options
*/
public static Option[] getAll(final OptionHelper helper) {
- return new Option[]{
+ return new Option[] {
new Option(G, "opt.g"),
new Option(G_NONE, "opt.g.none") {
+ @Override
public boolean process(Options options, String option) {
options.put("-g:", "none");
return false;
}
},
- new Option(G_CUSTOM, "opt.g.lines.vars.source") {
- public boolean matches(String s) {
- return s.startsWith("-g:");
- }
+ new Option(G_CUSTOM, "opt.g.lines.vars.source",
+ Option.ChoiceKind.ANYOF, "lines", "vars", "source"),
+
+ new XOption(XLINT, "opt.Xlint"),
+ new XOption(XLINT_CUSTOM, "opt.Xlint.suboptlist",
+ Option.ChoiceKind.ANYOF, getXLintChoices()),
+
+ // -nowarn is retained for command-line backward compatibility
+ new Option(NOWARN, "opt.nowarn") {
+ @Override
public boolean process(Options options, String option) {
- String suboptions = option.substring(3);
- options.put("-g:", suboptions);
- // enter all the -g suboptions as "-g:suboption"
- for (StringTokenizer t = new StringTokenizer(suboptions, ","); t.hasMoreTokens(); ) {
- String tok = t.nextToken();
- String opt = "-g:" + tok;
- options.put(opt, opt);
- }
+ options.put("-Xlint:none", option);
return false;
}
},
- new XOption(XLINT, "opt.Xlint"),
- new XOption(XLINT_CUSTOM, "opt.Xlint.suboptlist") {
- public boolean matches(String s) {
- return s.startsWith("-Xlint:");
- }
- public boolean process(Options options, String option) {
- String suboptions = option.substring(7);
- options.put("-Xlint:", suboptions);
- // enter all the -Xlint suboptions as "-Xlint:suboption"
- for (StringTokenizer t = new StringTokenizer(suboptions, ","); t.hasMoreTokens(); ) {
- String tok = t.nextToken();
- String opt = "-Xlint:" + tok;
- options.put(opt, opt);
- }
- return false;
- }
- },
-
- // -nowarn is retained for command-line backward compatibility
- new Option(NOWARN, "opt.nowarn") {
- public boolean process(Options options, String option) {
- options.put("-Xlint:none", option);
- return false;
- }
- },
-
new Option(VERBOSE, "opt.verbose"),
// -deprecation is retained for command-line backward compatibility
new Option(DEPRECATION, "opt.deprecation") {
- public boolean process(Options options, String option) {
- options.put("-Xlint:deprecation", option);
- return false;
- }
- },
+ @Override
+ public boolean process(Options options, String option) {
+ options.put("-Xlint:deprecation", option);
+ return false;
+ }
+ },
new Option(CLASSPATH, "opt.arg.path", "opt.classpath"),
new Option(CP, "opt.arg.path", "opt.classpath") {
+ @Override
public boolean process(Options options, String option, String arg) {
return super.process(options, "-classpath", arg);
}
},
new Option(SOURCEPATH, "opt.arg.path", "opt.sourcepath"),
new Option(BOOTCLASSPATH, "opt.arg.path", "opt.bootclasspath") {
+ @Override
public boolean process(Options options, String option, String arg) {
options.remove("-Xbootclasspath/p:");
options.remove("-Xbootclasspath/a:");
@@ -327,6 +308,7 @@
new XOption(XBOOTCLASSPATH_PREPEND,"opt.arg.path", "opt.Xbootclasspath.p"),
new XOption(XBOOTCLASSPATH_APPEND, "opt.arg.path", "opt.Xbootclasspath.a"),
new XOption(XBOOTCLASSPATH, "opt.arg.path", "opt.bootclasspath") {
+ @Override
public boolean process(Options options, String option, String arg) {
options.remove("-Xbootclasspath/p:");
options.remove("-Xbootclasspath/a:");
@@ -335,48 +317,29 @@
},
new Option(EXTDIRS, "opt.arg.dirs", "opt.extdirs"),
new XOption(DJAVA_EXT_DIRS, "opt.arg.dirs", "opt.extdirs") {
+ @Override
public boolean process(Options options, String option, String arg) {
return super.process(options, "-extdirs", arg);
}
},
new Option(ENDORSEDDIRS, "opt.arg.dirs", "opt.endorseddirs"),
new XOption(DJAVA_ENDORSED_DIRS, "opt.arg.dirs", "opt.endorseddirs") {
+ @Override
public boolean process(Options options, String option, String arg) {
return super.process(options, "-endorseddirs", arg);
}
},
- new Option(PROC_CUSTOM, "opt.proc.none.only") {
- public boolean matches(String s) {
- return s.equals("-proc:none") || s.equals("-proc:only");
- }
-
- public boolean process(Options options, String option) {
- if (option.equals("-proc:none")) {
- options.remove("-proc:only");
- } else {
- options.remove("-proc:none");
- }
- options.put(option, option);
- return false;
- }
- },
+ new Option(PROC, "opt.proc.none.only",
+ Option.ChoiceKind.ONEOF, "none", "only"),
new Option(PROCESSOR, "opt.arg.class.list", "opt.processor"),
new Option(PROCESSORPATH, "opt.arg.path", "opt.processorpath"),
new Option(D, "opt.arg.directory", "opt.d"),
new Option(S, "opt.arg.directory", "opt.sourceDest"),
- new Option(IMPLICIT, "opt.implicit") {
- public boolean matches(String s) {
- return s.equals("-implicit:none") || s.equals("-implicit:class");
- }
- public boolean process(Options options, String option, String operand) {
- int sep = option.indexOf(":");
- options.put(option.substring(0, sep), option.substring(sep+1));
- options.put(option,option);
- return false;
- }
- },
+ new Option(IMPLICIT, "opt.implicit",
+ Option.ChoiceKind.ONEOF, "none", "class"),
new Option(ENCODING, "opt.arg.encoding", "opt.encoding"),
new Option(SOURCE, "opt.arg.release", "opt.source") {
+ @Override
public boolean process(Options options, String option, String operand) {
Source source = Source.lookup(operand);
if (source == null) {
@@ -387,6 +350,7 @@
}
},
new Option(TARGET, "opt.arg.release", "opt.target") {
+ @Override
public boolean process(Options options, String option, String operand) {
Target target = Target.lookup(operand);
if (target == null) {
@@ -397,54 +361,62 @@
}
},
new Option(VERSION, "opt.version") {
+ @Override
public boolean process(Options options, String option) {
helper.printVersion();
return super.process(options, option);
}
},
new HiddenOption(FULLVERSION) {
+ @Override
public boolean process(Options options, String option) {
helper.printFullVersion();
return super.process(options, option);
}
},
new Option(HELP, "opt.help") {
+ @Override
public boolean process(Options options, String option) {
helper.printHelp();
return super.process(options, option);
}
},
new Option(A, "opt.arg.key.equals.value","opt.A") {
- String helpSynopsis() {
- hasSuffix = true;
- return super.helpSynopsis();
- }
+ @Override
+ String helpSynopsis() {
+ hasSuffix = true;
+ return super.helpSynopsis();
+ }
+
+ @Override
+ public boolean matches(String arg) {
+ return arg.startsWith("-A");
+ }
- public boolean matches(String arg) {
- return arg.startsWith("-A");
- }
-
- public boolean hasArg() {
- return false;
+ @Override
+ public boolean hasArg() {
+ return false;
+ }
+ // Mapping for processor options created in
+ // JavacProcessingEnvironment
+ @Override
+ public boolean process(Options options, String option) {
+ int argLength = option.length();
+ if (argLength == 2) {
+ helper.error("err.empty.A.argument");
+ return true;
}
- // Mapping for processor options created in
- // JavacProcessingEnvironment
- public boolean process(Options options, String option) {
- int argLength = option.length();
- if (argLength == 2) {
- helper.error("err.empty.A.argument");
- return true;
- }
- int sepIndex = option.indexOf('=');
- String key = option.substring(2, (sepIndex != -1 ? sepIndex : argLength) );
- if (!JavacProcessingEnvironment.isValidOptionName(key)) {
- helper.error("err.invalid.A.key", option);
- return true;
- }
- return process(options, option, option);
+ int sepIndex = option.indexOf('=');
+ String key = option.substring(2, (sepIndex != -1 ? sepIndex : argLength) );
+ if (!JavacProcessingEnvironment.isValidOptionName(key)) {
+ helper.error("err.invalid.A.key", option);
+ return true;
}
+ return process(options, option, option);
+ }
},
new Option(X, "opt.X") {
+ @Override
public boolean process(Options options, String option) {
helper.printXhelp();
return super.process(options, option);
@@ -454,10 +426,12 @@
// This option exists only for the purpose of documenting itself.
// It's actually implemented by the launcher.
new Option(J, "opt.arg.flag", "opt.J") {
+ @Override
String helpSynopsis() {
hasSuffix = true;
return super.helpSynopsis();
}
+ @Override
public boolean process(Options options, String option) {
throw new AssertionError
("the -J flag should be caught by the launcher.");
@@ -469,6 +443,7 @@
// new Option("-moreinfo", "opt.moreinfo") {
new HiddenOption(MOREINFO) {
+ @Override
public boolean process(Options options, String option) {
Type.moreInfo = true;
return super.process(options, option);
@@ -512,6 +487,7 @@
// display warnings for generic unchecked operations
new HiddenOption(WARNUNCHECKED) {
+ @Override
public boolean process(Options options, String option) {
options.put("-Xlint:unchecked", option);
return false;
@@ -521,6 +497,7 @@
new XOption(XMAXERRS, "opt.arg.number", "opt.maxerrs"),
new XOption(XMAXWARNS, "opt.arg.number", "opt.maxwarns"),
new XOption(XSTDOUT, "opt.arg.file", "opt.Xstdout") {
+ @Override
public boolean process(Options options, String option, String arg) {
try {
helper.setOut(new PrintWriter(new FileWriter(arg), true));
@@ -538,17 +515,8 @@
new XOption(XPRINTPROCESSORINFO, "opt.printProcessorInfo"),
- new XOption(XPREFER, "opt.prefer") {
- public boolean matches(String s) {
- return s.equals("-Xprefer:source") || s.equals("-Xprefer:newer");
- }
- public boolean process(Options options, String option, String operand) {
- int sep = option.indexOf(":");
- options.put(option.substring(0, sep), option.substring(sep+1));
- options.put(option,option);
- return false;
- }
- },
+ new XOption(XPREFER, "opt.prefer",
+ Option.ChoiceKind.ONEOF, "source", "newer"),
/* -O is a no-op, accepted for backward compatibility. */
new HiddenOption(O),
@@ -562,10 +530,12 @@
*/
new HiddenOption(XD) {
String s;
+ @Override
public boolean matches(String s) {
this.s = s;
return s.startsWith(name.optionName);
}
+ @Override
public boolean process(Options options, String option) {
s = s.substring(name.optionName.length());
int eq = s.indexOf('=');
@@ -586,11 +556,13 @@
*/
new HiddenOption(SOURCEFILE) {
String s;
+ @Override
public boolean matches(String s) {
this.s = s;
return s.endsWith(".java") // Java source file
|| SourceVersion.isName(s); // Legal type name
}
+ @Override
public boolean process(Options options, String option) {
if (s.endsWith(".java") ) {
File f = new File(s);
@@ -612,4 +584,15 @@
};
}
+ private static Collection<String> getXLintChoices() {
+ Collection<String> choices = new LinkedHashSet<String>();
+ choices.add("all");
+ for (Lint.LintCategory c : Lint.LintCategory.values())
+ choices.add(c.option);
+ for (Lint.LintCategory c : Lint.LintCategory.values())
+ choices.add("-" + c.option);
+ choices.add("none");
+ return choices;
+ }
+
}
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Mon Apr 07 17:38:21 2008 -0700
@@ -734,7 +734,7 @@
} catch (CompletionFailure ex) {
StringWriter out = new StringWriter();
ex.printStackTrace(new PrintWriter(out));
- log.error("proc.cant.access", ex.sym, ex.errmsg, out.toString());
+ log.error("proc.cant.access", ex.sym, ex.getDetailValue(), out.toString());
return false;
} catch (Throwable t) {
throw new AnnotationProcessingError(t);
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Mon Apr 07 17:38:21 2008 -0700
@@ -827,6 +827,10 @@
bad class file: {0}\n\
{1}\n\
Please remove or make sure it appears in the correct subdirectory of the classpath.
+compiler.misc.bad.source.file.header=\
+bad source file: {0}\n\
+{1}\n\
+Please remove or make sure it appears in the correct subdirectory of the sourcepath.
## The following are all possible strings for the second argument ({1}) of the
## above strings.
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java Mon Apr 07 17:38:21 2008 -0700
@@ -203,6 +203,10 @@
*/
private char[] buf = null;
+ /** The length of useful data in buf
+ */
+ private int bufLen = 0;
+
/** The position in the buffer at which last error was reported
*/
private int bp;
@@ -256,6 +260,7 @@
*/
protected void setBuf(char[] newBuf) {
buf = newBuf;
+ bufLen = buf.length;
bp = 0;
lineStart = 0;
line = 1;
@@ -324,7 +329,7 @@
return;
int lineEnd = lineStart;
- while (lineEnd < buf.length && buf[lineEnd] != CR && buf[lineEnd] != LF)
+ while (lineEnd < bufLen && buf[lineEnd] != CR && buf[lineEnd] != LF)
lineEnd++;
if (lineEnd - lineStart == 0)
return;
@@ -336,12 +341,15 @@
writer.flush();
}
- protected static char[] getCharContent(JavaFileObject fileObject) throws IOException {
+ protected void initBuf(JavaFileObject fileObject) throws IOException {
CharSequence cs = fileObject.getCharContent(true);
if (cs instanceof CharBuffer) {
- return JavacFileManager.toArray((CharBuffer)cs);
+ CharBuffer cb = (CharBuffer) cs;
+ buf = JavacFileManager.toArray(cb);
+ bufLen = cb.limit();
} else {
- return cs.toString().toCharArray();
+ buf = cs.toString().toCharArray();
+ bufLen = buf.length;
}
}
@@ -353,7 +361,7 @@
return false;
try {
if (buf == null) {
- buf = getCharContent(currentSource());
+ initBuf(currentSource());
lineStart = 0;
line = 1;
} else if (lineStart > pos) { // messages don't come in order
@@ -361,10 +369,10 @@
line = 1;
}
bp = lineStart;
- while (bp < buf.length && bp < pos) {
+ while (bp < bufLen && bp < pos) {
switch (buf[bp++]) {
case CR:
- if (bp < buf.length && buf[bp] == LF) bp++;
+ if (bp < bufLen && buf[bp] == LF) bp++;
line++;
lineStart = bp;
break;
@@ -374,7 +382,7 @@
break;
}
}
- return bp <= buf.length;
+ return bp <= bufLen;
} catch (IOException e) {
//e.printStackTrace();
// FIXME: include e.getLocalizedMessage() in error message
@@ -704,7 +712,7 @@
if (findLine(pos)) {
int column = 0;
for (bp = lineStart; bp < pos; bp++) {
- if (bp >= buf.length)
+ if (bp >= bufLen)
return 0;
if (buf[bp] == '\t')
column = (column / TabInc * TabInc) + TabInc;
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Paths.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Paths.java Mon Apr 07 17:38:21 2008 -0700
@@ -38,13 +38,8 @@
import java.util.LinkedHashSet;
import java.util.Iterator;
import java.util.StringTokenizer;
-import java.util.zip.ZipException;
import java.util.zip.ZipFile;
import com.sun.tools.javac.code.Lint;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.Options;
-import com.sun.tools.javac.util.Position;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Lock;
@@ -70,7 +65,10 @@
protected static final Context.Key<Paths> pathsKey =
new Context.Key<Paths>();
- /** Get the Paths instance for this context. */
+ /** Get the Paths instance for this context.
+ * @param context the context
+ * @return the Paths instance for this context
+ */
public static Paths instance(Context context) {
Paths instance = context.get(pathsKey);
if (instance == null)
@@ -89,7 +87,7 @@
private static boolean NON_BATCH_MODE = System.getProperty("nonBatchMode") != null;// TODO: Use -XD compiler switch for this.
private static Map<File, PathEntry> pathExistanceCache = new ConcurrentHashMap<File, PathEntry>();
- private static Map<File, java.util.List<String>> manifestEntries = new ConcurrentHashMap<File, java.util.List<String>>();
+ private static Map<File, java.util.List<File>> manifestEntries = new ConcurrentHashMap<File, java.util.List<File>>();
private static Map<File, Boolean> isDirectory = new ConcurrentHashMap<File, Boolean>();
private static Lock lock = new ReentrantLock();
@@ -369,13 +367,13 @@
// filenames, but if we do, we should redo all path-related code.
private void addJarClassPath(File jarFile, boolean warn) {
try {
- java.util.List<String> manifestsList = manifestEntries.get(jarFile);
+ java.util.List<File> manifestsList = manifestEntries.get(jarFile);
if (!NON_BATCH_MODE) {
lock.lock();
try {
if (manifestsList != null) {
- for (String entr : manifestsList) {
- addFile(new File(entr), warn);
+ for (File entr : manifestsList) {
+ addFile(entr, warn);
}
return;
}
@@ -386,7 +384,7 @@
}
if (!NON_BATCH_MODE) {
- manifestsList = new ArrayList<String>();
+ manifestsList = new ArrayList<File>();
manifestEntries.put(jarFile, manifestsList);
}
@@ -412,7 +410,7 @@
if (!NON_BATCH_MODE) {
lock.lock();
try {
- manifestsList.add(elt);
+ manifestsList.add(f);
}
finally {
lock.unlock();
--- a/langtools/src/share/opensource/javac/Makefile Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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
--- a/langtools/src/share/opensource/javac/README-template.html Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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>
--- a/langtools/src/share/opensource/javac/build.properties Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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
--- a/langtools/src/share/opensource/javac/build.xml Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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>
--- a/langtools/src/share/opensource/javac/doc/document.css Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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 īŋŊ 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}
--- a/langtools/src/share/opensource/javac/doc/javac_lifecycle/Context.html Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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>
--- a/langtools/src/share/opensource/javac/doc/javac_lifecycle/Enter.html Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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>
-
--- a/langtools/src/share/opensource/javac/doc/javac_lifecycle/JavaCompiler.html Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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>
-
--- a/langtools/src/share/opensource/javac/doc/javac_lifecycle/Main.html Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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>
-
--- a/langtools/src/share/opensource/javac/doc/javac_lifecycle/ToDo.html Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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>
-
--- a/langtools/src/share/opensource/javac/doc/javac_lifecycle/contents.html Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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>
--- a/langtools/src/share/opensource/javac/doc/javac_lifecycle/index.html Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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>
--- a/langtools/src/share/opensource/javac/doc/javac_lifecycle/packages.html Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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>
--- a/langtools/src/share/opensource/javac/doc/javac_lifecycle/style.css Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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 }
-
--- a/langtools/src/share/opensource/javac/nbproject/project.xml Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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>
--- a/langtools/src/share/opensource/javac/src/bin/javac.sh Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -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 "$@"
--- a/langtools/test/tools/javac/6341866/T6341866.java Tue Apr 01 15:41:23 2008 -0700
+++ b/langtools/test/tools/javac/6341866/T6341866.java Mon Apr 07 17:38:21 2008 -0700
@@ -186,7 +186,7 @@
}
static void error(String msg) {
- System.err.println(msg);
+ System.err.println("ERROR: " + msg);
}
static File services(Class<?> service) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6668794/badClass/A.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2008 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.
+ */
+
+package q;
+
+class A { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6668794/badClass/B.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,7 @@
+/*
+ * /nodynamiccopyright/
+ */
+
+class B {
+ p.A a;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6668794/badClass/Test.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2008 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.
+ */
+
+/*
+ * @test
+ * @bug 6668794 6668796
+ * @summary javac puts localized text in raw diagnostics
+ * bad diagnostic "bad class file" given for source files
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.tools.*;
+
+public class Test {
+ public static void main(String[] args) throws Exception {
+ new Test().run();
+ }
+
+ void run() throws Exception {
+
+ // compile q.A then move it to p.A
+ compile("A.java");
+
+ File p = new File("p");
+ p.mkdirs();
+ new File("q/A.class").renameTo(new File("p/A.class"));
+
+ // compile B against p.A
+ String[] out = compile("B.java");
+ if (out.length == 0)
+ throw new Error("no diagnostics generated");
+
+ String expected = "B.java:6:6: compiler.err.cant.access: p.A, " +
+ "(- compiler.misc.bad.class.file.header: A.class, " +
+ "(- compiler.misc.class.file.wrong.class: q.A))";
+
+ if (!out[0].equals(expected)) {
+ System.err.println("expected: " + expected);
+ System.err.println(" found: " + out[0]);
+ throw new Error("test failed");
+ }
+ }
+
+ String[] compile(String file) {
+ String[] options = {
+ "-XDrawDiagnostics",
+ "-d", ".",
+ "-classpath", ".",
+ new File(testSrc, file).getPath()
+ };
+
+ System.err.println("compile: " + Arrays.asList(options));
+ StringWriter sw = new StringWriter();
+ PrintWriter out = new PrintWriter(sw);
+ int rc = com.sun.tools.javac.Main.compile(options, out);
+ out.close();
+
+ String outText = sw.toString();
+ System.err.println(outText);
+
+ return sw.toString().split("[\\r\\n]+");
+ }
+
+ File testSrc = new File(System.getProperty("test.src", "."));
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6668794/badSource/Test.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,11 @@
+/*
+ * @test /nodynamiccopyight/
+ * @bug 6668794 6668796
+ * @summary javac puts localized text in raw diagnostics
+ * bad diagnostic "bad class file" given for source files
+ * @compile/fail/ref=Test.out -XDrawDiagnostics Test.java
+ */
+
+class Test {
+ p.A a;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6668794/badSource/Test.out Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,1 @@
+Test.java:10:6: compiler.err.cant.access: p.A, (- compiler.misc.bad.source.file.header: A.java, (- compiler.misc.file.doesnt.contain.class: p.A))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6668794/badSource/p/A.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2008 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.
+ */
+
+package q;
+
+class A { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Paths/6638501/HelloLib/test/HelloImpl.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2007-2008 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.
+ *
+ * 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.
+ */
+
+package test;
+
+public class HelloImpl {
+
+ public void Hello() {
+ java.lang.System.out.println("Hello");
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Paths/6638501/JarFromManifestFailure.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2007-2008 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 6638501
+ * @summary REGRESSION: Java Compiler cannot find jar files referenced by other
+ * @run main JarFromManifestFailure
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.util.*;
+import java.util.jar.*;
+import javax.tools.*;
+import javax.tools.StandardJavaFileManager.*;
+
+public class JarFromManifestFailure {
+ static File testSrc = new File(System.getProperty("test.src", "."));
+ static File testClasses = new File(System.getProperty("test.classes", "."));
+
+ public static void main(String... args) throws Exception {
+ compile(testClasses, null, new File(testSrc, "HelloLib/test/HelloImpl.java"), new File(testSrc, "WsCompileExample.java"));
+ File libFile = new File(testClasses, "lib");
+ libFile.mkdir();
+ jar(new File(libFile, "HelloLib.jar"), new ArrayList(), testClasses, new File("test"));
+
+ ArrayList arList = new ArrayList();
+ arList.add(new File("HelloLib.jar"));
+ jar(new File(libFile, "JarPointer.jar"), arList, testClasses);
+
+ String[] args1 = {
+ "-d", ".",
+ "-cp", new File(libFile, "JarPointer.jar").getPath().replace('\\', '/'),
+ new File(testSrc, "test/SayHello.java").getPath().replace('\\', '/')
+ };
+ System.err.println("First compile!!!");
+ if (com.sun.tools.javac.Main.compile(args1) != 0) {
+ throw new AssertionError("Failure in first compile!");
+ }
+
+ System.err.println("Second compile!!!");
+
+ args1 = new String[] {
+ "-d", ".",
+ "-cp", new File(libFile, "JarPointer.jar").getPath().replace('\\', '/'),
+ new File(testSrc, "test1/SayHelloToo.java").getPath().replace('\\', '/')
+ };
+ if (com.sun.tools.javac.Main.compile(args1) != 0) {
+ throw new AssertionError("Failure in second compile!");
+ }
+ }
+
+ static void compile(File classOutDir, Iterable<File> classPath, File... files) {
+ System.err.println("compile...");
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
+ Iterable<? extends JavaFileObject> fileObjects =
+ fm.getJavaFileObjectsFromFiles(Arrays.asList(files));
+
+ List<String> options = new ArrayList<String>();
+ if (classOutDir != null) {
+ options.add("-d");
+ options.add(classOutDir.getPath());
+ }
+ if (classPath != null) {
+ options.add("-classpath");
+ options.add(join(classPath, File.pathSeparator));
+ }
+ options.add("-verbose");
+
+ JavaCompiler.CompilationTask task =
+ compiler.getTask(null, fm, null, options, null, fileObjects);
+ if (!task.call())
+ throw new AssertionError("compilation failed");
+ }
+
+ static void jar(File jar, Iterable<File> classPath, File base, File... files)
+ throws IOException {
+ System.err.println("jar...");
+ Manifest m = new Manifest();
+ if (classPath != null) {
+ Attributes mainAttrs = m.getMainAttributes();
+ mainAttrs.put(Attributes.Name.MANIFEST_VERSION, "1.0");
+ mainAttrs.put(Attributes.Name.CLASS_PATH, join(classPath, " "));
+ }
+ OutputStream out = new BufferedOutputStream(new FileOutputStream(jar));
+ JarOutputStream j = new JarOutputStream(out, m);
+ add(j, base, files);
+ j.close();
+ }
+
+ static void add(JarOutputStream j, File base, File... files) throws IOException {
+ if (files == null)
+ return;
+
+ for (File f: files)
+ add(j, base, f);
+ }
+
+ static void add(JarOutputStream j, File base, File file) throws IOException {
+ File f = new File(base, file.getPath());
+ if (f.isDirectory()) {
+ JarEntry e = new JarEntry(new String(file.getPath() + File.separator).replace('\\', '/'));
+ e.setSize(file.length());
+ j.putNextEntry(e);
+ String[] children = f.list();
+ if (children != null) {
+ for (String c: children) {
+ add(j, base, new File(file, c));
+ }
+ }
+ } else {
+ JarEntry e = new JarEntry(file.getPath().replace('\\', '/'));
+ e.setSize(f.length());
+ j.putNextEntry(e);
+ j.write(read(f));
+ j.closeEntry();
+ }
+
+ }
+
+ static byte[] read(File f) throws IOException {
+ byte[] buf = new byte[(int) f.length()];
+ BufferedInputStream in = new BufferedInputStream(new FileInputStream(f));
+ int offset = 0;
+ while (offset < buf.length) {
+ int n = in.read(buf, offset, buf.length - offset);
+ if (n < 0)
+ throw new EOFException();
+ offset += n;
+ }
+ return buf;
+ }
+
+ static <T> Iterable<T> iterable(T single) {
+ return Collections.singleton(single);
+ }
+
+ static <T> String join(Iterable<T> iter, String sep) {
+ StringBuilder p = new StringBuilder();
+ for (T t: iter) {
+ if (p.length() > 0)
+ p.append(' ');
+ p.append(t);
+ }
+ return p.toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Paths/6638501/WsCompileExample.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2007-2008 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.
+ *
+ * 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.
+ */
+
+import java.util.List;
+import java.util.ArrayList;
+import java.io.File;
+//for CompilerHelper
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+
+
+public class WsCompileExample {
+ File destDir;
+ File srcDir;
+ protected boolean compilerDebug = false;
+ protected boolean compilerOptimize = false;
+ protected String userClasspath = null;
+
+ public static void main(String[] args) {
+ new WsCompileExample().do_main(args);
+ }
+
+ public void do_main(String[] args) {
+ if(!args[0].equals("-s")) {
+ throw new RuntimeException("specify -s for src");
+ }
+
+ //run it once
+ srcDir = new File(args[1]);
+ if(!args[2].equals("-d")) {
+ throw new RuntimeException("specify -d for dest");
+ }
+ destDir = new File(args[3]);
+ if(!destDir.exists())
+ destDir.mkdirs();
+ System.out.println("----test compile 1-----");
+ compileGeneratedClasses();
+
+ //run it twice
+ srcDir = new File(args[1]+"1");
+ destDir = new File(args[3]+"1");
+ if(!destDir.exists())
+ destDir.mkdirs();
+ System.out.println("----test compile 2-----");
+ compileGeneratedClasses();
+
+ }
+ protected void compileGeneratedClasses() {
+ List sourceFiles = new ArrayList();
+
+ for (File f: srcDir.listFiles()) {
+ if (f.getName().endsWith(".java")) {
+ sourceFiles.add(f.getAbsolutePath());
+ }
+ }
+
+ if (sourceFiles.size() > 0) {
+ String classDir = destDir.getAbsolutePath();
+ String classpathString = createClasspathString();
+ System.out.println("classpathString: " + classpathString);
+
+ String[] args = new String[4 + (compilerDebug == true ? 1 : 0) +
+ (compilerOptimize == true ? 1 : 0) +
+ sourceFiles.size()];
+ args[0] = "-d";
+ args[1] = classDir;
+ args[2] = "-classpath";
+ args[3] = classpathString;
+// args[4]="-DnonBatchMode";
+ int baseIndex = 4;
+ if (compilerDebug) {
+ args[baseIndex++] = "-g";
+ }
+ if (compilerOptimize) {
+ args[baseIndex++] = "-O";
+ }
+ for (int i = 0; i < sourceFiles.size(); ++i) {
+ args[baseIndex + i] = (String)sourceFiles.get(i);
+ }
+
+ // ByteArrayOutputStream javacOutput = new ByteArrayOutputStream();
+ JavaCompilerHelper compilerHelper = new JavaCompilerHelper(System.out);
+ boolean result = compilerHelper.compile(args);
+ if (!result) {
+ System.out.println("wscompile.compilation Failed");
+ }
+ }
+ }
+
+ protected String createClasspathString() {
+ if (userClasspath == null) {
+ userClasspath = "";
+ }
+ String jcp = userClasspath + File.pathSeparator + System.getProperty("java.class.path");
+ return jcp;
+ }
+}
+///////////////////////////////////////////////////////////////////
+class JavaCompilerHelper {
+ public JavaCompilerHelper(OutputStream out) {
+ this.out = out;
+ }
+
+ public boolean compile(String[] args) {
+ return internalCompile(args);
+ }
+
+ protected boolean internalCompile(String[] args) {
+
+ System.out.println("Args: ");
+ for(String arg : args){
+ System.out.print(arg+" ");
+ }
+ System.out.println();
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ Class comSunToolsJavacMainClass = null;
+ try {
+ /* try to use the new compiler */
+ comSunToolsJavacMainClass =
+ cl.loadClass("com.sun.tools.javac.Main");
+ try {
+ Method compileMethod =
+ comSunToolsJavacMainClass.getMethod(
+ "compile",
+ compile141MethodSignature);
+ try {
+ Object result =
+ compileMethod.invoke(
+ null,
+ new Object[] { args, new PrintWriter(out)});
+ if (!(result instanceof Integer)) {
+ return false;
+ }
+ return ((Integer) result).intValue() == 0;
+ } catch (IllegalAccessException e3) {
+ return false;
+ } catch (IllegalArgumentException e3) {
+ return false;
+ } catch (InvocationTargetException e3) {
+ return false;
+ }
+ } catch (NoSuchMethodException e2) {
+ System.out.println("ERROR: Compile failed with error:" + e2.toString() );
+ }
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ return false;
+ } catch (SecurityException e) {
+ return false;
+ }
+ return true;
+ }
+
+ protected String getGenericErrorMessage() {return "javacompiler.error"; }
+ protected void run() { }
+ protected boolean parseArguments(String[] args) {return false;}
+ protected OutputStream out;
+
+ protected static final Class[] compile141MethodSignature;
+ static
+ {
+ compile141MethodSignature = new Class[2];
+ compile141MethodSignature[0] = (new String[0]).getClass();
+ compile141MethodSignature[1] = PrintWriter.class;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Paths/6638501/test/SayHello.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2007-2008 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.
+ *
+ * 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.
+ */
+
+import test.HelloImpl;
+
+public class SayHello extends HelloImpl {
+ public static void main(String... args) {
+ new SayHello().Hello();
+}
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Paths/6638501/test1/SayHelloToo.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2007-2008 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.
+ *
+ * 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.
+ */
+
+import test.HelloImpl;
+
+public class SayHelloToo extends HelloImpl {
+ public static void main(String... args) {
+ new SayHelloToo().Hello();
+}
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/StringConversion2.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2008 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 4741726
+ * @summary allow Object += String
+ */
+
+public class StringConversion2
+{
+ public static void main(String[] args) {
+ Object o = "Hello ";
+ String s = "World!";
+ o += s;
+ if (!o.equals("Hello World!"))
+ throw new Error("test failed");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T6663588.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2008 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 6663588
+ * @summary Compiler goes into infinite loop for Cyclic Inheritance test case
+ * @author Maurizio Cimadamore
+ * @compile/fail T6663588.java
+ */
+
+public class T6663588<T extends T6663588.Inner> extends T6663588 {
+ class Inner extends T6663588.Inner {}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T6668802.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2008 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.
+ */
+
+/*
+ * @test
+ * @bug 6668802
+ * @summary javac handles diagnostics for last line badly, if line not terminated by newline
+ */
+
+import java.io.*;
+import java.util.*;
+
+public class T6668802
+{
+ public static void main(String[] args) throws Exception {
+ new T6668802().run();
+ }
+
+ void run() throws Exception {
+ String test = "public class Test {";
+ File f = writeTestFile("Test.java", test);
+ String[] out = compileBadFile(f);
+ for (String line: out)
+ System.err.println(">>>" + line + "<<<");
+ if (!out[1].equals(test)) {
+ show("expected", test);
+ show(" actual", out[1]);
+ throw new Error("test failed");
+ }
+ }
+
+ File writeTestFile(String path, String contents) throws IOException {
+ File f = new File(path);
+ FileWriter out = new FileWriter(f);
+ out.write(contents);
+ out.close();
+ return f;
+ }
+
+ String[] compileBadFile(File file) throws IOException {
+ List<String> options = new ArrayList<String>();
+ options.add(file.getPath());
+ System.err.println("compile: " + options);
+ String[] opts = options.toArray(new String[options.size()]);
+ StringWriter sw = new StringWriter();
+ PrintWriter out = new PrintWriter(sw);
+ int rc = com.sun.tools.javac.Main.compile(opts, out);
+ if (rc == 0)
+ throw new Error("compilation succeeded unexpectedly");
+ out.close();
+ return sw.toString().split("[\n\r]+");
+ }
+
+ void show(String prefix, String text) {
+ System.err.println(prefix + ": (" + text.length() + ") " + text);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/api/6608214/T6608214.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 6608214
+ * @summary Exception throw while analysing a file with error
+ * @author Maurizio Cimadamore
+ */
+
+import com.sun.source.util.JavacTask;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+import static javax.tools.JavaFileObject.Kind;
+
+public class T6608214 {
+ public static void main(String[] args) throws IOException {
+ JavaFileObject sfo = new SimpleJavaFileObject(URI.create(""),Kind.SOURCE) {
+ public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+ return "class Test<S> { <T extends S & Runnable> void test(){}}";
+ }
+ };
+ List<? extends JavaFileObject> files = Arrays.asList(sfo);
+ String bootPath = System.getProperty("sun.boot.class.path");
+ List<String> opts = Arrays.asList("-bootclasspath", bootPath, "-Xjcov");
+ JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+ JavacTask ct = (JavacTask)tool.getTask(null, null, null,opts,null,files);
+ ct.analyze();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/boxing/T6614974.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2008 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 6614974
+ * @summary javac successfully compiles code that throws java.lang.VerifyError when run
+ * @author mcimadamore
+ */
+public class T6614974<T> {
+
+ private T n;
+
+ public void error() {
+ T6614974<Integer> val = new T6614974<Integer>();
+ val.n = 0;
+ Integer.toString(val.n++);
+ }
+
+ public static void main(String[] args) {
+ T6614974.class.getMethods();
+ }
+}
--- a/langtools/test/tools/javac/expression/ObjectAppend.java Tue Apr 01 15:41:23 2008 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright 2002 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.
- *
- * 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.
- */
-
-/*
- * @test
- * @bug 4642850
- * @summary compiler allows Object += String
- * @author gafter
- *
- * @compile/fail ObjectAppend.java
- */
-
-class ObjectAppend {{
- Object o = null;
- o += "string";
-}}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/T6660289.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2008 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 6660289
+ * @summary declared bound in inner class referring a type variable of the outer class
+ * @author Maurizio Cimadamore
+ * @compile T6660289.java
+ */
+
+public class T6660289<E> {
+ class Inner<S extends E> {}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/6611449/T6611449.java Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 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.
+ *
+ * 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.
+ */
+
+/**
+ * @test
+ * @bug 6611449
+ * @summary Internal Error thrown during generic method/constructor invocation
+ * @compile/fail/ref=T6611449.out -XDstdout -XDrawDiagnostics T6611449.java
+ */
+public class T6611449<S> {
+
+ T6611449() {this(1);}
+
+ <T extends S> T6611449(T t1) {this(t1, 1);}
+
+ <T extends S> T6611449(T t1, T t2) {}
+
+ <T extends S> void m(T t1) {}
+
+ <T extends S> void m(T t1, T t2) {}
+
+ void test() {
+ m1(1);
+ m2(1, 1);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/6611449/T6611449.out Mon Apr 07 17:38:21 2008 -0700
@@ -0,0 +1,5 @@
+T6611449.java:32:17: compiler.err.cant.resolve.location: (- compiler.misc.kindname.constructor), T6611449, (int), , (- compiler.misc.kindname.class), T6611449<S>
+T6611449.java:34:35: compiler.err.cant.resolve.location: (- compiler.misc.kindname.constructor), T6611449, (T,int), , (- compiler.misc.kindname.class), T6611449<S>
+T6611449.java:43:9: compiler.err.cant.resolve.location: (- compiler.misc.kindname.method), m1, (int), , (- compiler.misc.kindname.class), T6611449<S>
+T6611449.java:44:9: compiler.err.cant.resolve.location: (- compiler.misc.kindname.method), m2, (int,int), , (- compiler.misc.kindname.class), T6611449<S>
+4 errors
--- a/make/Defs-internal.gmk Tue Apr 01 15:41:23 2008 -0700
+++ b/make/Defs-internal.gmk Mon Apr 07 17:38:21 2008 -0700
@@ -28,6 +28,12 @@
# not contain rules.
#
+ifdef OPENJDK
+ ifneq ($(OPENJDK),true)
+ x:=$(error "OPENJDK (if defined) can only be set to true")
+ endif
+endif
+
# Define absolute paths to TOPDIRs
ABS_CONTROL_TOPDIR:=$(call OptFullPath,"$(CONTROL_TOPDIR)")
ABS_LANGTOOLS_TOPDIR:=$(call OptFullPath,"$(LANGTOOLS_TOPDIR)")
@@ -96,10 +102,8 @@
endif
ifeq ($(JDK_SRC_AVAILABLE),true)
JDK_CLOSED_SRC_AVAILABLE := $(call MkExists,$(JDK_TOPDIR)/src/closed)
- ifndef OPENJDK
- ifeq ($(JDK_CLOSED_SRC_AVAILABLE),false)
- OPENJDK = true
- endif
+ ifeq ($(JDK_CLOSED_SRC_AVAILABLE),false)
+ OPENJDK = true
endif
endif
@@ -150,8 +154,8 @@
SKIP_OPENJDK_BUILD = true
else
ifndef SKIP_OPENJDK_BUILD
- SKIP_OPENJDK_BUILD = false
- # FIXUP: until freetype fixed on linux and solaris rmi build fixed
+ #SKIP_OPENJDK_BUILD = false
+ # Until 6675289 is resolved, or this feature is removed.
SKIP_OPENJDK_BUILD = true
endif
endif
--- a/make/jdk-rules.gmk Tue Apr 01 15:41:23 2008 -0700
+++ b/make/jdk-rules.gmk Mon Apr 07 17:38:21 2008 -0700
@@ -121,11 +121,3 @@
.PHONY: jdk jdk-build jdk-clobber jdk-sanity
-# FIXUP: Old j2se target names
-j2se-build: jdk-build
-j2se-clobber:: jdk-clobber
-j2se-sanity:: jdk-sanity
-j2se: jdk
-
-.PHONY: j2se j2se-build j2se-clobber j2se-sanity
-