This commit is contained in:
J. Duke 2017-07-05 16:34:30 +02:00
commit a2a6cc1dd8
432 changed files with 19096 additions and 8845 deletions

1
.hgtags-top-repo Normal file
View File

@ -0,0 +1 @@
cfeea66a3fa8ca3686a7cfa2d0ce8ab0169f168d jdk7-b24

1
.jcheck/conf Normal file
View File

@ -0,0 +1 @@
project=jdk7

139
Makefile
View File

@ -23,25 +23,25 @@
# have any questions. # have any questions.
# #
BUILD_PARENT_DIRECTORY=.
ifndef TOPDIR ifndef TOPDIR
TOPDIR:=$(shell \ TOPDIR:=.
if [ -r ./j2se/make/Makefile -o -r ./jdk/make/Makefile ]; then \
echo "."; \
else \
echo "../.."; \
fi)
endif endif
ifndef CONTROL_TOPDIR ifndef CONTROL_TOPDIR
CONTROL_TOPDIR=$(TOPDIR)/control CONTROL_TOPDIR=$(TOPDIR)
CONTROL_TOPDIR:=$(shell \
if [ -r $(TOPDIR)/control/make/Makefile ]; then \
echo "$(TOPDIR)/control"; \
else \
echo "$(TOPDIR)"; \
fi)
endif 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 ifndef JDK_TOPDIR
JDK_TOPDIR=$(TOPDIR)/jdk JDK_TOPDIR=$(TOPDIR)/jdk
endif endif
@ -55,6 +55,7 @@ include ./make/Defs-internal.gmk
all:: all::
@$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: `$(DATE) '+%y-%m-%d %H:%M'` @$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: `$(DATE) '+%y-%m-%d %H:%M'`
$(MKDIR) -p $(OUTPUTDIR)
# Rules for sanity checks # Rules for sanity checks
include ./make/sanity-rules.gmk include ./make/sanity-rules.gmk
@ -81,11 +82,24 @@ include ./make/deploy-rules.gmk
all:: setup build all:: setup build
setup: setup: openjdk_check
$(MKDIR) -p $(OUTPUTDIR)/j2sdk-image $(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
$(MKDIR) -p $(ABS_OUTPUTDIR)/j2sdk-image
$(MKDIR) -p $(OUTPUTDIR)-fastdebug/j2sdk-image # Check on whether we really can build the openjdk, need source etc.
$(MKDIR) -p $(ABS_OUTPUTDIR)-fastdebug/j2sdk-image 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 build:: sanity
@ -143,7 +157,7 @@ endif
COMMON_DEBUG_FLAGS= \ COMMON_DEBUG_FLAGS= \
DEBUG_NAME=$(DEBUG_NAME) \ DEBUG_NAME=$(DEBUG_NAME) \
ALT_OUTPUTDIR=$(_OUTPUTDIR)-$(DEBUG_NAME) \ ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)-$(DEBUG_NAME) \
NO_DOCS=true NO_DOCS=true
product_build: setup product_build: setup
@ -190,46 +204,64 @@ ifneq ($(SKIP_COMPARE_IMAGES), true)
all :: compare-image all :: compare-image
endif 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 ($(BUILD_JDK), true)
ifeq ($(BUNDLE_RULES_AVAILABLE), 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. OPENJDK_PLUGS=$(ABS_OUTPUTDIR)/$(OPENJDK_BINARY_PLUGS_INAME)
# FIXUP: We should create the openjdk source bundle and build that? OPENJDK_OUTPUTDIR=$(ABS_OUTPUTDIR)/open-output
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 \
= $(OPENJDK_BUILD_NAME_PREFIX)-openjdk-$(OPENJDK_BUILD_NAME_SUFFIX) = openjdk-$(JDK_MINOR_VERSION)-$(BUILD_NUMBER)-$(PLATFORM)-$(ARCH)-$(BUNDLE_DATE)
OPENJDK_BUILD_BINARY_ZIP \ OPENJDK_BUILD_BINARY_ZIP=$(ABS_BIN_BUNDLEDIR)/$(OPENJDK_BUILD_NAME).zip
= $(ABS_BIN_BUNDLEDIR)/$(OPENJDK_BUILD_NAME).zip BUILT_IMAGE=$(ABS_OUTPUTDIR)/j2sdk-image
all :: openjdk-build ifeq ($(PLATFORM)$(ARCH_DATA_MODEL),solaris64)
openjdk-build: OPENJDK_BOOTDIR=$(BOOTDIR)
OPENJDK_IMPORTJDK=$(JDK_IMPORT_PATH)
else
OPENJDK_BOOTDIR=$(BUILT_IMAGE)
OPENJDK_IMPORTJDK=$(BUILT_IMAGE)
endif
openjdk_build:
@$(ECHO) " " @$(ECHO) " "
@$(ECHO) "=================================================" @$(ECHO) "================================================="
@$(ECHO) "Starting openjdk build" @$(ECHO) "Starting openjdk build"
@$(ECHO) " Using: ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR)"
@$(ECHO) "=================================================" @$(ECHO) "================================================="
@$(ECHO) " " @$(ECHO) " "
$(RM) -r $(ABS_OPENJDK_OUTPUTDIR) $(RM) -r $(OPENJDK_OUTPUTDIR)
$(MKDIR) -p $(ABS_OPENJDK_OUTPUTDIR) $(MKDIR) -p $(OPENJDK_OUTPUTDIR)
$(MAKE) OPENJDK=true \ ($(CD) $(OPENJDK_BUILDDIR) && $(MAKE) \
BUILD_LANGTOOLS=$(BUILD_LANGTOOLS) \ OPENJDK=true \
BUILD_CORBA=$(BUILD_CORBA) \ ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR) \
BUILD_JAXP=$(BUILD_JAXP) \ ALT_OUTPUTDIR=$(OPENJDK_OUTPUTDIR) \
BUILD_JAXWS=$(BUILD_JAXWS) \ ALT_BINARY_PLUGS_PATH=$(OPENJDK_PLUGS) \
BUILD_HOTSPOT=$(BUILD_HOTSPOT) \ ALT_BOOTDIR=$(OPENJDK_BOOTDIR) \
ALT_OUTPUTDIR=$(ABS_OPENJDK_OUTPUTDIR) \ ALT_JDK_IMPORT_PATH=$(OPENJDK_IMPORTJDK) \
ALT_BINARY_PLUGS_PATH=$(ABS_OUTPUTDIR)/$(OPENJDK_BINARY_PLUGS_INAME) \ product_build )
ALT_BOOTDIR=$(ABS_OUTPUTDIR)/j2sdk-image \
ALT_JDK_IMPORT_PATH=$(ABS_OUTPUTDIR)/j2sdk-image \
product_build
$(RM) $(OPENJDK_BUILD_BINARY_ZIP) $(RM) $(OPENJDK_BUILD_BINARY_ZIP)
( $(CD) $(ABS_OPENJDK_OUTPUTDIR)/j2sdk-image && \ ( $(CD) $(OPENJDK_OUTPUTDIR)/j2sdk-image && \
$(ZIPEXE) -q -r $(OPENJDK_BUILD_BINARY_ZIP) .) $(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 endif
endif endif
@ -432,11 +464,11 @@ endif
# Cycle build. Build the jdk, use it to build the jdk again. # 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: boot_cycle:
$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTJDK_OUTPUTDIR) product_build $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) product_build
$(MAKE) ALT_BOOTDIR=$(ABS_BOOTJDK_OUTPUTDIR)/j2sdk-image product_build $(MAKE) ALT_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image product_build
################################################################ ################################################################
# JPRT rule to build # JPRT rule to build
@ -452,7 +484,6 @@ include ./make/jprt.gmk
fastdebug_build debug_build product_build setup \ fastdebug_build debug_build product_build setup \
dev dev-build dev-sanity dev-clobber dev dev-build dev-sanity dev-clobber
# FIXUP: Old j2se targets # Force target
j2se_fastdebug_only: jdk_fastdebug_only FRC:
j2se_only: jdk_only

View File

@ -342,32 +342,29 @@
<blockquote> <blockquote>
<p> <p>
The source code for the The source code for the OpenJDK is delivered in a set of
OpenJDK is directories:
delivered in <i>3</i> sibling directories:
<tt>hotspot</tt>, <tt>hotspot</tt>,
<tt>langtools</tt>, <tt>langtools</tt>,
<tt>corba</tt>, <tt>corba</tt>,
<tt>jaxws</tt>, <tt>jaxws</tt>,
<tt>jaxp</tt>, <tt>jaxp</tt>,
<tt>jdk</tt>
and and
<tt>jdk</tt>.
The <tt>hotspot</tt> directory contains the source code and make The <tt>hotspot</tt> directory contains the source code and make
files for files for building the OpenJDK Hotspot Virtual Machine.
building the The <tt>langtools</tt> directory contains the source code and make
OpenJDK files for building the OpenJDK javac and language tools.
Hotspot Virtual Machine. The <tt>corba</tt> directory contains the source code and make
The <tt>jdk</tt> files for building the OpenJDK Corba files.
directory contains the source code and make files for The <tt>jaxws</tt> directory contains the source code and make
building the files for building the OpenJDK JAXWS files.
OpenJDK The <tt>jaxp</tt> directory contains the source code and make
runtime libraries, tools and demos. files for building the OpenJDK JAXP files.
The top level Makefile is used to build the complete OpenJDK The <tt>jdk</tt> directory contains the source code and make files for
release including building the hotspot building the OpenJDK runtime libraries and misc files.
VM, staging the VM binaries, and building the The top level <tt>Makefile</tt>
OpenJDK is used to build the entire OpenJDK.
runtime libraries,
tools and demos.
</blockquote> </blockquote>
<!-- ------------------------------------------------------ --> <!-- ------------------------------------------------------ -->
@ -730,17 +727,15 @@
under an open-source license. under an open-source license.
In order to build an OpenJDK binary from source code, In order to build an OpenJDK binary from source code,
you must first download and install the appropriate 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" During the OpenJDK build process these "binary plugs"
for the encumbered components will be copied into your for the encumbered components will be copied into your
resulting OpenJDK binary build image. resulting OpenJDK binary build image.
These binary plug files are only for the purpose of These binary plug files are only for the purpose of
building an OpenJDK binary. building an OpenJDK binary.
Download the Binary Plugs by selecting the <b>Downloads</b> Make sure you set
link at
<a href="http://openjdk.java.net/">the OpenJDK site</a>,
install the bundle,
and make sure you set
<tt><a href="#ALT_BINARY_PLUGS_PATH">ALT_BINARY_PLUGS_PATH</a></tt> <tt><a href="#ALT_BINARY_PLUGS_PATH">ALT_BINARY_PLUGS_PATH</a></tt>
to the root of this installation. to the root of this installation.
</blockquote> </blockquote>

1
corba/.hgtags Normal file
View File

@ -0,0 +1 @@
55540e827aef970ecc010b7e06b912d991c8e3ce jdk7-b24

1
corba/.jcheck/conf Normal file
View File

@ -0,0 +1 @@
project=jdk7

View File

@ -281,6 +281,13 @@ endif
# Get platform specific settings # Get platform specific settings
include $(BUILDDIR)/common/shared/Defs-$(PLATFORM).gmk 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 # These are the same on all platforms but require the above platform include 1st
# BOOTDIR: Bootstrap JDK, previous released JDK. # BOOTDIR: Bootstrap JDK, previous released JDK.

View File

@ -318,7 +318,7 @@ ORB classes:
11. RequestHandler and ORB 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 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. this? Also, the API would need to be extended to handle shutdown properly.

1
hotspot/.hgtags Normal file
View File

@ -0,0 +1 @@
a61af66fc99eb5ec9d50c05b0c599757b1289ceb jdk7-b24

1
hotspot/.jcheck/conf Normal file
View File

@ -0,0 +1 @@
project=jdk7

1
jaxp/.hgtags Normal file
View File

@ -0,0 +1 @@
6ce5f4757bde08f7470cbb9f0b46da8f2f3d4f56 jdk7-b24

1
jaxp/.jcheck/conf Normal file
View File

@ -0,0 +1 @@
project=jdk7

View File

@ -90,7 +90,6 @@ ifdef ALT_OUTPUTDIR
else else
OUTPUTDIR = .. OUTPUTDIR = ..
endif endif
ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR))
ifdef ALT_LANGTOOLS_DIST ifdef ALT_LANGTOOLS_DIST
ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap
@ -127,7 +126,11 @@ $(ANT_TARGETS):
$(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@ $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@
# Targets for Sun's internal JPRT build system # Targets for Sun's internal JPRT build system
JPRT_ARCHIVE_BUNDLE=$(OUTPUTDIR)/jprt.zip
jprt_build_product jprt_build_debug jprt_build_fastdebug: all 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) # Declare these phony (not filenames)
.PHONY: $(ANT_TARGETS) all clobber \ .PHONY: $(ANT_TARGETS) all clobber \

1
jaxws/.hgtags Normal file
View File

@ -0,0 +1 @@
0961a4a211765fea071b8dac419003ee0c3d5973 jdk7-b24

1
jaxws/.jcheck/conf Normal file
View File

@ -0,0 +1 @@
project=jdk7

View File

@ -69,7 +69,7 @@ else
endif endif
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) # and the somewhat misnamed CLASS_VERSION (-target NN)
ifdef TARGET_CLASS_VERSION ifdef TARGET_CLASS_VERSION
ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION) ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
@ -90,7 +90,6 @@ ifdef ALT_OUTPUTDIR
else else
OUTPUTDIR = .. OUTPUTDIR = ..
endif endif
ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR))
ifdef ALT_LANGTOOLS_DIST ifdef ALT_LANGTOOLS_DIST
ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap
@ -127,7 +126,11 @@ $(ANT_TARGETS):
$(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@ $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@
# Targets for Sun's internal JPRT build system # Targets for Sun's internal JPRT build system
JPRT_ARCHIVE_BUNDLE=$(OUTPUTDIR)/jprt.zip
jprt_build_product jprt_build_debug jprt_build_fastdebug: all 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) # Declare these phony (not filenames)
.PHONY: $(ANT_TARGETS) all clobber \ .PHONY: $(ANT_TARGETS) all clobber \

1
jdk/.hgtags Normal file
View File

@ -0,0 +1 @@
37a05a11f281b4d238e2f9e7ebb67c63f64d0e77 jdk7-b24

1
jdk/.jcheck/conf Normal file
View File

@ -0,0 +1 @@
project=jdk7

View File

@ -50,13 +50,13 @@ CC_DEPEND = -MM
CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g'
ifndef PLATFORM_SRC ifndef PLATFORM_SRC
PLATFORM_SRC = $(JDK_TOPDIR)/src/solaris PLATFORM_SRC = $(BUILDDIR)/../src/solaris
endif # PLATFORM_SRC endif # PLATFORM_SRC
# Platform specific closed sources # Platform specific closed sources
ifndef OPENJDK ifndef OPENJDK
ifndef CLOSED_PLATFORM_SRC ifndef CLOSED_PLATFORM_SRC
CLOSED_PLATFORM_SRC = $(JDK_TOPDIR)/src/closed/solaris CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/solaris
endif endif
endif endif

View File

@ -45,13 +45,13 @@
include $(JDK_MAKE_SHARED_DIR)/Defs.gmk include $(JDK_MAKE_SHARED_DIR)/Defs.gmk
ifndef PLATFORM_SRC ifndef PLATFORM_SRC
PLATFORM_SRC = $(JDK_TOPDIR)/src/solaris PLATFORM_SRC = $(BUILDDIR)/../src/solaris
endif # PLATFORM_SRC endif # PLATFORM_SRC
# Platform specific closed sources # Platform specific closed sources
ifndef OPENJDK ifndef OPENJDK
ifndef CLOSED_PLATFORM_SRC ifndef CLOSED_PLATFORM_SRC
CLOSED_PLATFORM_SRC = $(JDK_TOPDIR)/src/closed/solaris CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/solaris
endif endif
endif endif

View File

@ -51,13 +51,13 @@ ifndef LIB_LOCATION
endif # LIB_LOCATION endif # LIB_LOCATION
ifndef PLATFORM_SRC ifndef PLATFORM_SRC
PLATFORM_SRC = $(JDK_TOPDIR)/src/windows PLATFORM_SRC = $(BUILDDIR)/../src/windows
endif # PLATFORM_SRC endif # PLATFORM_SRC
# Platform specific closed sources # Platform specific closed sources
ifndef OPENJDK ifndef OPENJDK
ifndef CLOSED_PLATFORM_SRC ifndef CLOSED_PLATFORM_SRC
CLOSED_PLATFORM_SRC = $(JDK_TOPDIR)/src/closed/windows CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/windows
endif endif
endif endif
@ -367,7 +367,7 @@ else
endif endif
# Settings for the VERSIONINFO tap on windows. # Settings for the VERSIONINFO tap on windows.
VERSIONINFO_RESOURCE = $(JDK_TOPDIR)/src/windows/resource/version.rc VERSIONINFO_RESOURCE = $(BUILDDIR)/../src/windows/resource/version.rc
ifneq ($(JDK_BUILD_NUMBER),) ifneq ($(JDK_BUILD_NUMBER),)
COOKED_BUILD_NUMBER = $(shell $(ECHO) $(JDK_BUILD_NUMBER) | $(SED) -e 's/^b//' -e 's/^0//') COOKED_BUILD_NUMBER = $(shell $(ECHO) $(JDK_BUILD_NUMBER) | $(SED) -e 's/^b//' -e 's/^0//')

View File

@ -32,6 +32,13 @@
# So when it includes other files, it must use JDK_TOPDIR. # So when it includes other files, it must use JDK_TOPDIR.
# #
# Check for strange explicit settings (change to empty or true)
ifdef OPENJDK
ifneq ($(OPENJDK),true)
x:=$(error "OPENJDK (if defined) can only be set to true")
endif
endif
# #
# On Solaris, the 'make' utility from Sun will not work with these makefiles. # On Solaris, the 'make' utility from Sun will not work with these makefiles.
# This little rule is only understood by Sun's make, and is harmless # This little rule is only understood by Sun's make, and is harmless
@ -41,7 +48,15 @@
SUN_MAKE_TEST:sh = echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33 SUN_MAKE_TEST:sh = echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33
ifndef JDK_TOPDIR ifndef JDK_TOPDIR
ifdef BUILDDIR
JDK_TOPDIR=$(BUILDDIR)/.. JDK_TOPDIR=$(BUILDDIR)/..
else
JDK_TOPDIR:=$(error "ERROR: Cannot define top of jdk repository")
endif
endif
ifndef BUILDDIR
# Hack, due to deploy repository using this file.
BUILDDIR=$(JDK_TOPDIR)/make
endif endif
ifndef JDK_MAKE_SHARED_DIR ifndef JDK_MAKE_SHARED_DIR
JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared
@ -59,13 +74,13 @@ include $(JDK_TOPDIR)/make/common/CancelImplicits.gmk
# there yet. # there yet.
# #
ifndef SHARE_SRC ifndef SHARE_SRC
SHARE_SRC = $(JDK_TOPDIR)/src/share SHARE_SRC = $(BUILDDIR)/../src/share
endif endif
# Files that cannot be included in the OpenJDK distribution are # Files that cannot be included in the OpenJDK distribution are
# collected under a parent directory which contains just those files. # collected under a parent directory which contains just those files.
ifndef CLOSED_SRC ifndef CLOSED_SRC
CLOSED_SRC = $(JDK_TOPDIR)/src/closed CLOSED_SRC = $(BUILDDIR)/../src/closed
endif endif
# If we have no closed directory, force it to an openjdk build # If we have no closed directory, force it to an openjdk build
@ -79,19 +94,6 @@ ifeq ($(CLOSED_SRC_DIR_EXISTS), false)
OPENJDK = true OPENJDK = true
endif endif
# Check for strange explicit settings (change to empty or true)
ifdef OPENJDK
ifeq ($(OPENJDK),false)
# Silently treat as not defined
OPENJDK =
else
ifneq ($(OPENJDK),true)
dummy := $(warning "WARNING: OPENKJDK=$(OPENJDK) being treated as true")
OPENJDK = true
endif
endif
endif
# Define where closed directories are # Define where closed directories are
ifdef OPENJDK ifdef OPENJDK
CLOSED_SRC = CLOSED_SRC =
@ -170,14 +172,6 @@ ifdef OPENJDK
endif endif
endif # OPENJDK endif # OPENJDK
# Default output directory
ifdef OPENJDK
_OUTPUTDIR=$(JDK_TOPDIR)/build/$(PLATFORM)-$(ARCH)$(OPENJDK_SUFFIX)
else
_OUTPUTDIR=$(JDK_TOPDIR)/build/$(PLATFORM)-$(ARCH)
endif
# #
# Get platform definitions # Get platform definitions
# #

View File

@ -36,7 +36,7 @@ ifndef JDK_MAKE_SHARED_DIR
endif endif
ifndef CONTROL_TOPDIR ifndef CONTROL_TOPDIR
CONTROL_TOPDIR=$(TOPDIR)/control CONTROL_TOPDIR=$(TOPDIR)
endif endif
ifndef HOTSPOT_TOPDIR ifndef HOTSPOT_TOPDIR
HOTSPOT_TOPDIR=$(TOPDIR)/hotspot HOTSPOT_TOPDIR=$(TOPDIR)/hotspot
@ -70,7 +70,8 @@ endif
include $(JDK_MAKE_SHARED_DIR)/Platform.gmk include $(JDK_MAKE_SHARED_DIR)/Platform.gmk
# Default output directory # Default output directory
_OUTPUTDIR=$(CONTROL_TOPDIR)/build/$(PLATFORM)-$(ARCH) BUILD_PARENT_DIRECTORY=$(TOPDIR)
_OUTPUTDIR=$(TOPDIR)/build/$(PLATFORM)-$(ARCH)
# Get platform specific settings # Get platform specific settings
include $(JDK_MAKE_SHARED_DIR)/Defs.gmk include $(JDK_MAKE_SHARED_DIR)/Defs.gmk

View File

@ -67,16 +67,6 @@ ifeq ($(PLATFORM),windows)
UTILS_DEVTOOL_PATH=$(DEVTOOLS_PATH) UTILS_DEVTOOL_PATH=$(DEVTOOLS_PATH)
endif endif
# Utilities ant and findbugs
ifndef ANT_HOME
ANT_HOME = $(JDK_DEVTOOLS_DIR)/share/ant/latest
endif
ANT = $(ANT_HOME)/bin/ant
ifndef FINDBUGS_HOME
FINDBUGS_HOME = $(JDK_DEVTOOLS_DIR)/share/findbugs/latest
endif
FINDBUGS = $(FINDBUGS_HOME)/bin/findbugs
# Utilities # Utilities
ADB = $(UTILS_COMMAND_PATH)adb ADB = $(UTILS_COMMAND_PATH)adb
AR = $(UTILS_CCS_BIN_PATH)ar AR = $(UTILS_CCS_BIN_PATH)ar

View File

@ -55,7 +55,10 @@ include $(JDK_MAKE_SHARED_DIR)/Defs-utils.gmk
# Simple pwd path # Simple pwd path
define PwdPath define PwdPath
$(shell cd $1 2> $(DEV_NULL) && pwd) $(shell $(CD) $1 2> $(DEV_NULL) && $(PWD))
endef
define AbsPwdPathCheck
$(shell $(CD) .. 2> $(DEV_NULL) && $(CD) $1 2> $(DEV_NULL) && $(PWD))
endef endef
# Checks an ALT value for spaces (should be one word), # Checks an ALT value for spaces (should be one word),
@ -422,23 +425,54 @@ CACERTS_FILE:=$(call AltCheckSpaces,CACERTS_FILE)
CACERTS_FILE:=$(call AltCheckValue,CACERTS_FILE) CACERTS_FILE:=$(call AltCheckValue,CACERTS_FILE)
# OUTPUTDIR: Location of all output for the build # OUTPUTDIR: Location of all output for the build
_BACKUP_OUTPUTDIR = $(TEMP_DISK)/$(USER)/jdk-outputdir
ifdef ALT_OUTPUTDIR ifdef ALT_OUTPUTDIR
_POSSIBLE_OUTPUTDIR =$(subst \,/,$(ALT_OUTPUTDIR)) OUTPUTDIR:=$(subst \,/,$(ALT_OUTPUTDIR))
# Assumes this is absolute (checks later)
ABS_OUTPUTDIR:=$(OUTPUTDIR)
else else
ifndef _OUTPUTDIR ifndef _OUTPUTDIR
_OUTPUTDIR = $(_BACKUP_OUTPUTDIR) # Default: Get "build" parent directory, which should always exist
ifndef BUILD_PARENT_DIRECTORY
BUILD_PARENT_DIRECTORY=$(BUILDDIR)/..
endif endif
_POSSIBLE_OUTPUTDIR =$(_OUTPUTDIR) ABS_BUILD_PARENT_DIRECTORY:=$(call FullPath,$(BUILD_PARENT_DIRECTORY))
ifdef OPENJDK
_OUTPUTDIRNAME=$(PLATFORM)-$(ARCH)$(OPENJDK_SUFFIX)
else
_OUTPUTDIRNAME=$(PLATFORM)-$(ARCH)
endif endif
_create_outputdir1:=$(shell mkdir -p $(_POSSIBLE_OUTPUTDIR) > $(DEV_NULL) 2>&1) _OUTPUTDIR=$(BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME)
OUTPUTDIR:=$(call WriteDirExists,$(_POSSIBLE_OUTPUTDIR),$(_BACKUP_OUTPUTDIR)) ABS_OUTPUTDIR:=$(ABS_BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME)
_create_outputdir2:=$(shell mkdir -p $(OUTPUTDIR) > $(DEV_NULL) 2>&1)
ifeq "$(OUTPUTDIR)" "$(_BACKUP_OUTPUTDIR)"
_outputdir_warning:=$(warning "WARNING: OUTPUTDIR '$(_POSSIBLE_OUTPUTDIR)' not writable, will use '$(_BACKUP_OUTPUTDIR)'")
endif endif
OUTPUTDIR:=$(_OUTPUTDIR)
endif
# Check for spaces and null value
OUTPUTDIR:=$(call AltCheckSpaces,OUTPUTDIR) OUTPUTDIR:=$(call AltCheckSpaces,OUTPUTDIR)
OUTPUTDIR:=$(call AltCheckValue,OUTPUTDIR) OUTPUTDIR:=$(call AltCheckValue,OUTPUTDIR)
# Create the output directory and make sure it exists and is writable
_create_outputdir:=$(shell $(MKDIR) -p "$(OUTPUTDIR)" > $(DEV_NULL) 2>&1)
ifeq ($(call WriteDirExists,$(OUTPUTDIR),/dev/null),/dev/null)
_outputdir_error:=$(error "ERROR: OUTPUTDIR '$(OUTPUTDIR)' not created or not writable")
endif
# Define absolute path if needed and check for spaces and null value
ifndef ABS_OUTPUTDIR
ABS_OUTPUTDIR:=$(call FullPath,$(OUTPUTDIR))
endif
ABS_OUTPUTDIR:=$(call AltCheckSpaces,ABS_OUTPUTDIR)
ABS_OUTPUTDIR:=$(call AltCheckValue,ABS_OUTPUTDIR)
# Make doubly sure this is a full path
ifeq ($(call AbsPwdPathCheck,$(ABS_OUTPUTDIR)), )
ifdef ALT_OUTPUTDIR
_outputdir_error:=$(error "ERROR: Trouble with the absolute path for OUTPUTDIR '$(OUTPUTDIR)', was ALT_OUTPUTDIR '$(ALT_OUTPUTDIR)' an absolute path?")
else
_outputdir_error:=$(error "ERROR: Trouble with the absolute path for OUTPUTDIR '$(OUTPUTDIR)'")
endif
endif
_dir1:=$(call FullPath,$(ABS_OUTPUTDIR))
_dir2:=$(call FullPath,$(OUTPUTDIR))
ifneq ($(_dir1),$(_dir2))
_outputdir_error:=$(error "ERROR: ABS_OUTPUTDIR '$(ABS_OUTPUTDIR)' is not the same directory as OUTPUTDIR '$(OUTPUTDIR)', '$(_dir1)'!='$(_dir2)'")
endif
# Bin directory # Bin directory
# NOTE: ISA_DIR is usually empty, on Solaris it might be /sparcv9 or /amd64 # NOTE: ISA_DIR is usually empty, on Solaris it might be /sparcv9 or /amd64
@ -469,15 +503,30 @@ JDK_CUPS_HEADERS_PATH=$(JDK_DEVTOOLS_DIR)/share/cups/include
endif endif
endif endif
# Utilities ant and findbugs
ifeq ($(ANT_HOME),)
ANT_HOME := $(call DirExists,/usr/share/ant,$(JDK_DEVTOOLS_DIR)/share/ant/latest,)
endif
ifeq ($(ANT_HOME),)
ANT = ant
else
ANT = $(ANT_HOME)/bin/ant
endif
ifeq ($(FINDBUGS_HOME),)
FINDBUGS_HOME := $(call DirExists,/usr/share/findbugs,$(JDK_DEVTOOLS_DIR)/share/findbugs/latest,)
endif
ifeq ($(FINDBUGS_HOME),)
FINDBUGS = findbugs
else
FINDBUGS = $(FINDBUGS_HOME)/bin/findbugs
endif
ifdef ALT_COPYRIGHT_YEAR ifdef ALT_COPYRIGHT_YEAR
COPYRIGHT_YEAR = $(ALT_COPYRIGHT_YEAR) COPYRIGHT_YEAR = $(ALT_COPYRIGHT_YEAR)
else else
COPYRIGHT_YEAR = $(shell $(DATE) '+%Y') COPYRIGHT_YEAR = $(shell $(DATE) '+%Y')
endif endif
# Absolute path to output directory
ABS_OUTPUTDIR:=$(call FullPath,$(OUTPUTDIR))
# Get shared compiler settings # Get shared compiler settings
include $(JDK_MAKE_SHARED_DIR)/Compiler.gmk include $(JDK_MAKE_SHARED_DIR)/Compiler.gmk

View File

@ -93,20 +93,18 @@ SYSTEM_UNAME := $(shell uname)
# Normal boot jdk is previous release, but a hard requirement is a 1.5 boot # Normal boot jdk is previous release, but a hard requirement is a 1.5 boot
REQUIRED_BOOT_VER = 1.5 REQUIRED_BOOT_VER = 1.5
#This is specific to OpenJDK build # If we are using freetype, this is the required version
ifdef OPENJDK
REQUIRED_FREETYPE_VERSION=2.3.0 REQUIRED_FREETYPE_VERSION=2.3.0
endif
# #
# Prune out all known SCM (Source Code Management) directories # Prune out all known SCM (Source Code Management) directories
# so they will not be included when copying directory trees # so they will not be included when copying directory trees
# or packaging up .jar files, etc. This applies to all workspaces. # or packaging up .jar files, etc. This applies to all workspaces.
# #
SCM_DIRs = .hg .svn CVS RCS SCCS Codemgr_wsdata deleted_files SCM_DIRs = .hg .svn CVS RCS SCCS Codemgr_wsdata deleted_files .hgignore .hgtags
# When changing SCM_DIRs also change SCM_DIRS_rexp and SCM_DIRS_prune: # When changing SCM_DIRs also change SCM_DIRS_rexp and SCM_DIRS_prune:
SCM_DIRS_rexp = ".hg|.svn|CVS|RCS|SCCS|Codemgr_wsdata|deleted_files" SCM_DIRS_rexp = ".hg|.svn|CVS|RCS|SCCS|Codemgr_wsdata|deleted_files|.hgignore|.hgtags"
SCM_DIRS_prune = \( -name .hg -o -name .svn -o -name CVS -o -name RCS -o -name SCCS -o -name Codemgr_wsdata -o -name deleted_files \) -prune SCM_DIRS_prune = \( -name .hg -o -name .svn -o -name CVS -o -name RCS -o -name SCCS -o -name Codemgr_wsdata -o -name deleted_files -o -name .hgignore -o -name .hgtags \) -prune
# Don't define this unless it's not defined # Don't define this unless it's not defined
ifndef VARIANT ifndef VARIANT
@ -272,7 +270,7 @@ ifeq ($(SYSTEM_UNAME), Linux)
REQUIRED_ALSA_VERSION = ^((0[.]9[.][1-9])|(1[.]0[.][0-9]))[0-9]* REQUIRED_ALSA_VERSION = ^((0[.]9[.][1-9])|(1[.]0[.][0-9]))[0-9]*
endif endif
# How much RAM does this machine have: # How much RAM does this machine have:
MB_OF_MEMORY := $(shell free -m | fgrep Mem: | sed -e 's@\ \ *@ @g' | cut -d' ' -f2) MB_OF_MEMORY := $(shell free -m | fgrep Mem: | awk '{print $$2;}' )
endif endif
# Windows with and without CYGWIN will be slightly different # Windows with and without CYGWIN will be slightly different
@ -376,45 +374,35 @@ ifeq ($(PLATFORM), windows)
REQUIRED_DXSDK_VER = 0x0700 REQUIRED_DXSDK_VER = 0x0700
OS_VENDOR = Microsoft OS_VENDOR = Microsoft
# How much RAM does this machine have: # How much RAM does this machine have:
MB_OF_MEMORY := $(shell \ ifeq ($(USING_CYGWIN),true)
if [ -f "C:/cygwin/bin/free.exe" ] ; then \ # CYGWIN has the 'free' utility
( C:/cygwin/bin/bash.exe -c "C:/cygwin/bin/free.exe -m" ) | \ _MB_OF_MEMORY := \
grep Mem: | \ $(shell free -m | grep Mem: | awk '{print $$2;}' )
sed -e 's@\ \ *@ @g' | cut -d' ' -f2 ; \
else \
echo "512"; \
fi)
endif
# Machines with 512Mb or less of real memory are considered low memory
# build machines and adjustments will be made to prevent excessing
# system swapping during the build.
# If we don't know, assume 512. Subtract 128 from MB for VM MAX.
# Don't set VM max over 1024-128=896.
ifneq ($(MB_OF_MEMORY),)
LOW_MEMORY_MACHINE := $(shell \
if [ $(MB_OF_MEMORY) -le 512 ] ; then \
echo "true"; \
else \
echo "false"; \
fi)
MAX_VM_MEMORY := $(shell \
if [ $(MB_OF_MEMORY) -le 1024 ] ; then \
expr $(MB_OF_MEMORY) '-' 128 ; \
else \
echo "896"; \
fi)
MIN_VM_MEMORY := $(shell \
if [ $(MAX_VM_MEMORY) -le 128 ] ; then \
expr $(MAX_VM_MEMORY) '-' 8 ; \
else \
echo "128"; \
fi)
else else
MB_OF_MEMORY := unknown # Windows 2000 has the mem utility, but two memory areas
LOW_MEMORY_MACHINE := true # extended memory is what is beyond 1024M
MAX_VM_MEMORY := 384 _B_OF_EXT_MEMORY := \
MIN_VM_MEMORY := 128 $(shell mem 2> $(DEV_NULL) | grep 'total contiguous extended memory' | awk '{print $$1;}')
ifeq ($(_B_OF_EXT_MEMORY),)
_B_OF_MEMORY := \
$(shell mem 2> $(DEV_NULL) | grep 'total conventional memory' | awk '{print $$1;}')
else
_B_OF_MEMORY := \
$(shell expr 1048576 '+' $(_B_OF_EXT_MEMORY) 2> $(DEV_NULL))
endif
ifeq ($(_B_OF_MEMORY),)
# Windows 2003 has the systeminfo utility use it if mem doesn't work
_MB_OF_MEMORY := \
$(shell systeminfo 2> $(DEV_NULL) | grep 'Total Physical Memory:' | awk '{print $$4;}' | sed -e 's@,@@')
else
_MB_OF_MEMORY := $(shell expr $(_B_OF_MEMORY) '/' 1024 2> $(DEV_NULL))
endif
endif
ifeq ($(shell expr $(_MB_OF_MEMORY) '+' 0 2> $(DEV_NULL)), $(_MB_OF_MEMORY))
MB_OF_MEMORY := $(_MB_OF_MEMORY)
else
MB_OF_MEMORY := 512
endif
endif endif
REQUIRED_ZIP_VER = 2.2 REQUIRED_ZIP_VER = 2.2
@ -454,6 +442,37 @@ ifneq ($(PLATFORM), windows)
ARCH_VM_SUBDIR=jre/lib/$(LIBARCH) ARCH_VM_SUBDIR=jre/lib/$(LIBARCH)
endif endif
# Machines with 512Mb or less of real memory are considered low memory
# build machines and adjustments will be made to prevent excessing
# system swapping during the build.
# If we don't know, assume 512. Subtract 128 from MB for VM MAX.
# Don't set VM max over 1024-128=896.
ifneq ($(MB_OF_MEMORY),)
LOW_MEMORY_MACHINE := $(shell \
if [ $(MB_OF_MEMORY) -le 512 ] ; then \
echo "true"; \
else \
echo "false"; \
fi)
MAX_VM_MEMORY := $(shell \
if [ $(MB_OF_MEMORY) -le 1024 ] ; then \
expr $(MB_OF_MEMORY) '-' 128 2> $(DEV_NULL) ; \
else \
echo "896"; \
fi)
MIN_VM_MEMORY := $(shell \
if [ $(MAX_VM_MEMORY) -le 128 ] ; then \
expr $(MAX_VM_MEMORY) '-' 8 2> $(DEV_NULL) ; \
else \
echo "128"; \
fi)
else
MB_OF_MEMORY := unknown
LOW_MEMORY_MACHINE := true
MAX_VM_MEMORY := 384
MIN_VM_MEMORY := 128
endif
# If blanks in the username, use the first 4 words and pack them together # If blanks in the username, use the first 4 words and pack them together
_USER1:=$(subst ', ,$(_USER)) _USER1:=$(subst ', ,$(_USER))
_USER2:=$(subst ", ,$(_USER1)) _USER2:=$(subst ", ,$(_USER1))

View File

@ -106,11 +106,19 @@ UNZIP_VER :=$(call GetVersion,"$(_UNZIP_VER)")
BOOT_VER :=$(call GetVersion,"$(_BOOT_VER)") BOOT_VER :=$(call GetVersion,"$(_BOOT_VER)")
REQUIRED_ANT_VER := 1.6.3 REQUIRED_ANT_VER := 1.6.3
_ANT_VER :=$(shell $(ANT) -version 2>&1 ) ifeq ($(ANT_HOME),)
_ANT_VER:=$(shell JAVACMD="$(BOOTDIR)/bin/java" $(ANT) -version 2>&1 )
else
_ANT_VER:=$(shell JAVACMD="$(BOOTDIR)/bin/java" ANT_HOME="$(ANT_HOME)" $(ANT) -version 2>&1 )
endif
ANT_VER:=$(call GetVersion,"$(_ANT_VER)") ANT_VER:=$(call GetVersion,"$(_ANT_VER)")
REQUIRED_FINDBUGS_VER := 1.1 REQUIRED_FINDBUGS_VER := 1.2
_FINDBUGS_VER :=$(shell $(FINDBUGS) -version 2>&1 ) ifeq ($(FINDBUGS_HOME),)
_FINDBUGS_VER:=$(shell $(FINDBUGS) -javahome "$(BOOTDIR)" -textui -version 2>&1 )
else
_FINDBUGS_VER:=$(shell FINDBUGS_HOME="$(FINDBUGS_HOME)" $(FINDBUGS) -javahome "$(BOOTDIR)" -textui -version 2>&1 )
endif
FINDBUGS_VER:=$(call GetVersion,"$(_FINDBUGS_VER)") FINDBUGS_VER:=$(call GetVersion,"$(_FINDBUGS_VER)")
ifdef ALT_BINDIR ifdef ALT_BINDIR

View File

@ -85,7 +85,6 @@ SUNWprivate_1.1 {
Java_java_io_FileOutputStream_close0; Java_java_io_FileOutputStream_close0;
Java_java_io_FileOutputStream_initIDs; Java_java_io_FileOutputStream_initIDs;
Java_java_io_FileOutputStream_open; Java_java_io_FileOutputStream_open;
Java_java_io_FileOutputStream_openAppend;
Java_java_io_FileOutputStream_write; Java_java_io_FileOutputStream_write;
Java_java_io_FileOutputStream_writeBytes; Java_java_io_FileOutputStream_writeBytes;
Java_java_io_FileSystem_getFileSystem; Java_java_io_FileSystem_getFileSystem;

View File

@ -107,6 +107,7 @@ endif # PLATFORM
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
EXTRA_LIBS = advapi32.lib \ EXTRA_LIBS = advapi32.lib \
comctl32.lib \
user32.lib user32.lib
JAVALIB = JAVALIB =

View File

@ -43,7 +43,7 @@ include $(BUILDDIR)/common/Defs.gmk
# Override the default version info with our own resource file (see 5106536) # Override the default version info with our own resource file (see 5106536)
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
LDLIBS_COMMON += user32.lib LDLIBS_COMMON += user32.lib comctl32.lib
ifdef OPENJDK ifdef OPENJDK
RC_FLAGS += -i "$(PLATFORM_SRC)/resource/icons" RC_FLAGS += -i "$(PLATFORM_SRC)/resource/icons"
else else

View File

@ -46,7 +46,7 @@ STATIC_JLI = true
include $(BUILDDIR)/common/Defs.gmk include $(BUILDDIR)/common/Defs.gmk
OTHER_CPPFLAGS += -DJAVAW OTHER_CPPFLAGS += -DJAVAW
LDLIBS_COMMON += user32.lib LDLIBS_COMMON += user32.lib comctl32.lib
# Override the default version info with our own resource file (see 5106536) # Override the default version info with our own resource file (see 5106536)
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)

View File

@ -191,7 +191,7 @@ sources: $(SPP) $(FILES_genout)
GEN_BUFFER_SH = genBuffer.sh GEN_BUFFER_SH = genBuffer.sh
GEN_BUFFER_CMD = SPP="$(SPP_CMD)" NAWK=$(NAWK) SED=$(SED) \ GEN_BUFFER_CMD = SPP="$(SPP_CMD)" NAWK=$(NAWK) SED=$(SED) SH=$(SH) \
$(SH) $(GEN_BUFFER_SH) $(SH) $(GEN_BUFFER_SH)
# Public abstract buffer classes # Public abstract buffer classes
@ -582,7 +582,7 @@ $(BUF_GEN)/ByteBufferAsDoubleBuffer%L.java: $(BUF_SRC)/ByteBufferAs-X-Buffer.jav
GEN_CODER_SH = genCoder.sh GEN_CODER_SH = genCoder.sh
GEN_CODER_CMD = SPP="$(SPP_CMD)" SED=$(SED) NAWK=$(NAWK) $(SH) $(GEN_CODER_SH) GEN_CODER_CMD = SPP="$(SPP_CMD)" SED=$(SED) NAWK=$(NAWK) SH=$(SH) $(SH) $(GEN_CODER_SH)
$(CS_GEN)/CharsetDecoder.java: $(CS_SRC)/Charset-X-Coder.java $(GEN_CODER_SH) $(CS_GEN)/CharsetDecoder.java: $(CS_SRC)/Charset-X-Coder.java $(GEN_CODER_SH)
$(prep-target) $(prep-target)
@ -602,7 +602,7 @@ $(CS_GEN)/CharsetEncoder.java: $(CS_SRC)/Charset-X-Coder.java $(GEN_CODER_SH)
GEN_EX_SH = genExceptions.sh GEN_EX_SH = genExceptions.sh
GEN_EX_CMD = NAWK=$(NAWK) $(SHELL) $(GEN_EX_SH) GEN_EX_CMD = NAWK=$(NAWK) SH=$(SH) $(SH) $(GEN_EX_SH)
$(CH_GEN)/%Exception.java: genExceptions.sh $(CH_SRC)/exceptions $(CH_GEN)/%Exception.java: genExceptions.sh $(CH_SRC)/exceptions
$(prep-target) $(prep-target)
@ -635,8 +635,8 @@ $(SCS_GEN)/StandardCharsets.java: genCharsetProvider.sh \
$(HASHER_JARFILE) $(SCS_SRC)/standard-charsets $(HASHER_JARFILE) $(SCS_SRC)/standard-charsets
$(prep-target) $(prep-target)
@$(RM) $@.temp @$(RM) $@.temp
NAWK=$(NAWK) TEMPDIR=$(TEMPDIR) \ NAWK=$(NAWK) TEMPDIR=$(TEMPDIR) SH=$(SH) \
HASHER="$(BOOT_JAVA_CMD) -jar $(HASHER_JARFILE)" \ HASHER="$(BOOT_JAVA_CMD) -jar $(HASHER_JARFILE)" \
$(SHELL) -e genCharsetProvider.sh $(SCS_SRC)/standard-charsets $(SCS_GEN) $(SH) -e genCharsetProvider.sh $(SCS_SRC)/standard-charsets $(SCS_GEN)
.PHONY: sources .PHONY: sources

View File

@ -48,7 +48,7 @@ echo '-->' $OUT
# Header # Header
# #
$SHELL addNotices.sh "$COPYRIGHT_YEARS" > $OUT $SH ./addNotices.sh "$COPYRIGHT_YEARS" > $OUT
cat <<__END__ >>$OUT cat <<__END__ >>$OUT

View File

@ -41,7 +41,7 @@ gen() {
echo '-->' $DST/$ID.java echo '-->' $DST/$ID.java
out=$DST/${ID}.java out=$DST/${ID}.java
$SHELL addNotices.sh "$COPYRIGHT_YEARS" > $out $SH ./addNotices.sh "$COPYRIGHT_YEARS" > $out
cat >>$out <<__END__ cat >>$out <<__END__

View File

@ -85,3 +85,13 @@ vpath %.c $(PLATFORM_SRC)/native/$(PKGDIR)/splashscreen
CPPFLAGS += -I$(PLATFORM_SRC)/native/$(PKGDIR)/splashscreen -I$(SHARE_SRC)/native/$(PKGDIR)/splashscreen CPPFLAGS += -I$(PLATFORM_SRC)/native/$(PKGDIR)/splashscreen -I$(SHARE_SRC)/native/$(PKGDIR)/splashscreen
CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/image/jpeg -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3 CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/image/jpeg -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3
ifeq ($(PLATFORM), linux)
ifeq ($(ARCH_DATA_MODEL), 64)
# 64-bit gcc has problems compiling MMX instructions.
# Google it for more details. Possibly the newer versions of
# the PNG-library and/or the new compiler will not need this
# option in the future.
CPPFLAGS += -DPNG_NO_MMX_CODE
endif
endif

View File

@ -1,5 +1,5 @@
# #
# Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. # Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -260,6 +260,7 @@ generated.clean:
$(RM) -r $(WRAPPER_GENERATOR_TEMPDIR) $(RM) -r $(WRAPPER_GENERATOR_TEMPDIR)
$(RM) -r $(WRAPPER_GENERATOR_DIR) $(RM) -r $(WRAPPER_GENERATOR_DIR)
$(RM) -r $(GEN_DIR)/*.java $(RM) -r $(GEN_DIR)/*.java
$(RM) -r $(TEMPDIR)/.gen_icons
ifdef OPENJDK ifdef OPENJDK
ICONS_PATH_PREFIX=$(PLATFORM_SRC) ICONS_PATH_PREFIX=$(PLATFORM_SRC)

View File

@ -38,7 +38,14 @@ FT_TEST_PATH = $(TEMPDIR)/$(FT_TEST)
all: $(FT_TEST_PATH) all: $(FT_TEST_PATH)
FT_OPTIONS = -I$(FT_HEADERS) -I$(FT_HEADERS)/freetype2 # Start with CFLAGS (which gets us the required -xarch setting on solaris)
ifeq ($(PLATFORM), windows)
FT_OPTIONS =
else
FT_OPTIONS = $(CFLAGS)
endif
FT_OPTIONS += -I$(FT_HEADERS) -I$(FT_HEADERS)/freetype2
FT_OPTIONS += $(XARCH) FT_OPTIONS += $(XARCH)
#add runtime library search path #add runtime library search path

View File

@ -26,13 +26,16 @@
/* Test program for freetype sanity check. /* Test program for freetype sanity check.
Prints "Failed" messages to STDOUT if check fails. */ Prints "Failed" messages to STDOUT if check fails. */
#include <stdio.h>
#include <string.h>
#include "ft2build.h" #include "ft2build.h"
#include FT_FREETYPE_H #include FT_FREETYPE_H
#define QUOTEMACRO(x) QUOTEME(x) #define QUOTEMACRO(x) QUOTEME(x)
#define QUOTEME(x) #x #define QUOTEME(x) #x
int main(char** argv, int argc) { int main(int argc, char** argv) {
char v[50]; char v[50];
FT_Int major, minor, patch; FT_Int major, minor, patch;
FT_Library library; FT_Library library;

View File

@ -32,9 +32,9 @@ class CommandNode extends AbstractCommandNode {
void constrain(Context ctx) { void constrain(Context ctx) {
if (components.size() == 3) { if (components.size() == 3) {
Node out = (Node)components.get(0); Node out = components.get(0);
Node reply = (Node)components.get(1); Node reply = components.get(1);
Node error = (Node)components.get(2); Node error = components.get(2);
if (!(out instanceof OutNode)) { if (!(out instanceof OutNode)) {
error("Expected 'Out' item, got: " + out); error("Expected 'Out' item, got: " + out);
} }
@ -45,7 +45,7 @@ class CommandNode extends AbstractCommandNode {
error("Expected 'ErrorSet' item, got: " + error); error("Expected 'ErrorSet' item, got: " + error);
} }
} else if (components.size() == 1) { } else if (components.size() == 1) {
Node evt = (Node)components.get(0); Node evt = components.get(0);
if (!(evt instanceof EventNode)) { if (!(evt instanceof EventNode)) {
error("Expected 'Event' item, got: " + evt); error("Expected 'Event' item, got: " + evt);
} }

View File

@ -98,7 +98,7 @@ class ConstantSetNode extends AbstractNamedNode {
if (constantMap == null) { if (constantMap == null) {
return ""; return "";
} }
String com = (String) constantMap.get(key); String com = constantMap.get(key);
if(com == null){ if(com == null){
return ""; return "";
} else { } else {

View File

@ -37,7 +37,7 @@ class RepeatNode extends AbstractTypeNode {
if (components.size() != 1) { if (components.size() != 1) {
error("Repeat must have exactly one member, use Group for more"); error("Repeat must have exactly one member, use Group for more");
} }
member = (Node)(components.get(0)); member = components.get(0);
if (!(member instanceof TypeNode)) { if (!(member instanceof TypeNode)) {
error("Repeat member must be type specifier"); error("Repeat member must be type specifier");
} }

0
jdk/make/tools/winver/bin/winver.exe Normal file → Executable file
View File

View File

@ -205,9 +205,7 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */
_wc_enabled = cpwildcard; _wc_enabled = cpwildcard;
_ergo_policy = ergo; _ergo_policy = ergo;
if (javaw == JNI_TRUE) InitLauncher(javaw);
SetJavaw();
DumpState(); DumpState();
/* /*

View File

@ -172,7 +172,6 @@ const char* GetDotVersion();
const char* GetFullVersion(); const char* GetFullVersion();
jboolean IsJavaArgs(); jboolean IsJavaArgs();
jboolean IsJavaw(); jboolean IsJavaw();
void SetJavaw();
jint GetErgoPolicy(); jint GetErgoPolicy();
jboolean ServerClassMachine(); jboolean ServerClassMachine();
@ -180,5 +179,9 @@ jboolean ServerClassMachine();
static int ContinueInNewThread(InvocationFunctions* ifn, int argc, char** argv, static int ContinueInNewThread(InvocationFunctions* ifn, int argc, char** argv,
char* jarfile, char* classname, int ret); char* jarfile, char* classname, int ret);
/*
* Initialize platform specific settings
*/
void InitLauncher(jboolean javaw);
#endif /* _JAVA_H_ */ #endif /* _JAVA_H_ */

View File

@ -64,8 +64,6 @@ main(int argc, char ** argv)
margv = argv; margv = argv;
#endif /* JAVAW */ #endif /* JAVAW */
JLI_SetTraceLauncher();
return JLI_Launch(margc, margv, return JLI_Launch(margc, margv,
sizeof(const_jargs) / sizeof(char *), const_jargs, sizeof(const_jargs) / sizeof(char *), const_jargs,
sizeof(const_appclasspath) / sizeof(char *), const_appclasspath, sizeof(const_appclasspath) / sizeof(char *), const_appclasspath,

View File

@ -34,6 +34,7 @@ import java.security.KeyRep;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;
import java.security.InvalidKeyException; import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.spec.InvalidKeySpecException; import java.security.spec.InvalidKeySpecException;
import javax.crypto.Mac; import javax.crypto.Mac;
import javax.crypto.SecretKey; import javax.crypto.SecretKey;
@ -107,12 +108,17 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
throw new InvalidKeySpecException("Key length is negative"); throw new InvalidKeySpecException("Key length is negative");
} }
try { try {
this.prf = Mac.getInstance(prfAlgo, new SunJCE()); this.prf = Mac.getInstance(prfAlgo, "SunJCE");
} catch (NoSuchAlgorithmException nsae) { } catch (NoSuchAlgorithmException nsae) {
// not gonna happen; re-throw just in case // not gonna happen; re-throw just in case
InvalidKeySpecException ike = new InvalidKeySpecException(); InvalidKeySpecException ike = new InvalidKeySpecException();
ike.initCause(nsae); ike.initCause(nsae);
throw ike; throw ike;
} catch (NoSuchProviderException nspe) {
// Again, not gonna happen; re-throw just in case
InvalidKeySpecException ike = new InvalidKeySpecException();
ike.initCause(nspe);
throw ike;
} }
this.key = deriveKey(prf, passwdBytes, salt, iterCount, keyLength); this.key = deriveKey(prf, passwdBytes, salt, iterCount, keyLength);
} }

View File

@ -3,3 +3,4 @@
# #
DisplayName.Devanagari = Devanagari Input Method DisplayName.Devanagari = Devanagari Input Method

View File

@ -3,3 +3,4 @@
# #
DisplayName.Thai = Thai Input Method DisplayName.Thai = Thai Input Method

View File

@ -43,6 +43,13 @@ import javax.management.MBeanInfo;
import javax.management.NotCompliantMBeanException; import javax.management.NotCompliantMBeanException;
import com.sun.jmx.mbeanserver.Util; import com.sun.jmx.mbeanserver.Util;
import com.sun.jmx.remote.util.EnvHelp;
import java.beans.BeanInfo;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import javax.management.AttributeNotFoundException;
import javax.management.openmbean.CompositeData;
/** /**
* This class contains the methods for performing all the tests needed to verify * This class contains the methods for performing all the tests needed to verify
@ -482,4 +489,33 @@ public class Introspector {
return null; return null;
} }
public static Object elementFromComplex(Object complex, String element)
throws AttributeNotFoundException {
try {
if (complex.getClass().isArray() && element.equals("length")) {
return Array.getLength(complex);
} else if (complex instanceof CompositeData) {
return ((CompositeData) complex).get(element);
} else {
// Java Beans introspection
//
BeanInfo bi = java.beans.Introspector.getBeanInfo(complex.getClass());
PropertyDescriptor[] pds = bi.getPropertyDescriptors();
for (PropertyDescriptor pd : pds)
if (pd.getName().equals(element))
return pd.getReadMethod().invoke(complex);
throw new AttributeNotFoundException(
"Could not find the getter method for the property " +
element + " using the Java Beans introspector");
}
} catch (InvocationTargetException e) {
throw new IllegalArgumentException(e);
} catch (AttributeNotFoundException e) {
throw e;
} catch (Exception e) {
throw EnvHelp.initCause(
new AttributeNotFoundException(e.getMessage()), e);
}
}
} }

View File

@ -91,9 +91,7 @@ abstract public class EventRequestSpec {
void attemptImmediateResolve(VirtualMachine vm) { void attemptImmediateResolve(VirtualMachine vm) {
// try to resolve immediately // try to resolve immediately
Iterator iter = vm.allClasses().iterator(); for (ReferenceType refType : vm.allClasses()) {
while (iter.hasNext()) {
ReferenceType refType = (ReferenceType)iter.next();
if (refSpec.matches(refType)) { if (refSpec.matches(refType)) {
try { try {
resolve(refType); resolve(refType);

View File

@ -47,9 +47,8 @@ class EventRequestSpecList {
*/ */
void resolve(ReferenceType refType) { void resolve(ReferenceType refType) {
synchronized(eventRequestSpecs) { synchronized(eventRequestSpecs) {
Iterator iter = eventRequestSpecs.iterator(); for (EventRequestSpec spec : eventRequestSpecs) {
while (iter.hasNext()) { spec.attemptResolve(refType);
((EventRequestSpec)iter.next()).attemptResolve(refType);
} }
} }
} }
@ -79,7 +78,7 @@ class EventRequestSpecList {
BreakpointSpec BreakpointSpec
createMethodBreakpoint(String classPattern, createMethodBreakpoint(String classPattern,
String methodId, List methodArgs) { String methodId, List<String> methodArgs) {
ReferenceTypeSpec refSpec = ReferenceTypeSpec refSpec =
new PatternReferenceTypeSpec(classPattern); new PatternReferenceTypeSpec(classPattern);
return new MethodBreakpointSpec(this, refSpec, return new MethodBreakpointSpec(this, refSpec,
@ -132,47 +131,48 @@ class EventRequestSpecList {
// -------- notify routines -------------------- // -------- notify routines --------------------
private Vector specListeners() { @SuppressWarnings("unchecked")
return (Vector)runtime.specListeners.clone(); private Vector<SpecListener> specListeners() {
return (Vector<SpecListener>)runtime.specListeners.clone();
} }
void notifySet(EventRequestSpec spec) { void notifySet(EventRequestSpec spec) {
Vector l = specListeners(); Vector<SpecListener> l = specListeners();
SpecEvent evt = new SpecEvent(spec); SpecEvent evt = new SpecEvent(spec);
for (int i = 0; i < l.size(); i++) { for (int i = 0; i < l.size(); i++) {
spec.notifySet((SpecListener)l.elementAt(i), evt); spec.notifySet(l.elementAt(i), evt);
} }
} }
void notifyDeferred(EventRequestSpec spec) { void notifyDeferred(EventRequestSpec spec) {
Vector l = specListeners(); Vector<SpecListener> l = specListeners();
SpecEvent evt = new SpecEvent(spec); SpecEvent evt = new SpecEvent(spec);
for (int i = 0; i < l.size(); i++) { for (int i = 0; i < l.size(); i++) {
spec.notifyDeferred((SpecListener)l.elementAt(i), evt); spec.notifyDeferred(l.elementAt(i), evt);
} }
} }
void notifyDeleted(EventRequestSpec spec) { void notifyDeleted(EventRequestSpec spec) {
Vector l = specListeners(); Vector<SpecListener> l = specListeners();
SpecEvent evt = new SpecEvent(spec); SpecEvent evt = new SpecEvent(spec);
for (int i = 0; i < l.size(); i++) { for (int i = 0; i < l.size(); i++) {
spec.notifyDeleted((SpecListener)l.elementAt(i), evt); spec.notifyDeleted(l.elementAt(i), evt);
} }
} }
void notifyResolved(EventRequestSpec spec) { void notifyResolved(EventRequestSpec spec) {
Vector l = specListeners(); Vector<SpecListener> l = specListeners();
SpecEvent evt = new SpecEvent(spec); SpecEvent evt = new SpecEvent(spec);
for (int i = 0; i < l.size(); i++) { for (int i = 0; i < l.size(); i++) {
spec.notifyResolved((SpecListener)l.elementAt(i), evt); spec.notifyResolved(l.elementAt(i), evt);
} }
} }
void notifyError(EventRequestSpec spec, Exception exc) { void notifyError(EventRequestSpec spec, Exception exc) {
Vector l = specListeners(); Vector<SpecListener> l = specListeners();
SpecErrorEvent evt = new SpecErrorEvent(spec, exc); SpecErrorEvent evt = new SpecErrorEvent(spec, exc);
for (int i = 0; i < l.size(); i++) { for (int i = 0; i < l.size(); i++) {
spec.notifyError((SpecListener)l.elementAt(i), evt); spec.notifyError(l.elementAt(i), evt);
} }
} }
} }

View File

@ -232,10 +232,7 @@ public class ExecutionManager {
if (pattern.startsWith("*.")) { if (pattern.startsWith("*.")) {
// Wildcard matches any leading package name. // Wildcard matches any leading package name.
pattern = pattern.substring(1); pattern = pattern.substring(1);
List classes = vm().allClasses(); for (ReferenceType type : vm().allClasses()) {
Iterator iter = classes.iterator();
while (iter.hasNext()) {
ReferenceType type = ((ReferenceType)iter.next());
if (type.name().endsWith(pattern)) { if (type.name().endsWith(pattern)) {
result.add(type); result.add(type);
} }
@ -278,7 +275,7 @@ public class ExecutionManager {
public ThreadGroupReference systemThreadGroup() public ThreadGroupReference systemThreadGroup()
throws NoSessionException { throws NoSessionException {
ensureActiveSession(); ensureActiveSession();
return (ThreadGroupReference)vm().topLevelThreadGroups().get(0); return vm().topLevelThreadGroups().get(0);
} }
/* /*
@ -349,10 +346,9 @@ public class ExecutionManager {
* attach sessions. * attach sessions.
*/ */
VirtualMachineManager mgr = Bootstrap.virtualMachineManager(); VirtualMachineManager mgr = Bootstrap.virtualMachineManager();
List connectors = mgr.attachingConnectors(); AttachingConnector connector = mgr.attachingConnectors().get(0);
AttachingConnector connector = (AttachingConnector)connectors.get(0);
Map<String, Connector.Argument> arguments = connector.defaultArguments(); Map<String, Connector.Argument> arguments = connector.defaultArguments();
((Connector.Argument)arguments.get("port")).setValue(portName); arguments.get("port").setValue(portName);
Session newSession = internalAttach(connector, arguments); Session newSession = internalAttach(connector, arguments);
if (newSession != null) { if (newSession != null) {
@ -504,10 +500,7 @@ public class ExecutionManager {
* if so, it gets removed here. * if so, it gets removed here.
*/ */
EventRequestManager mgr = vm().eventRequestManager(); EventRequestManager mgr = vm().eventRequestManager();
List requests = mgr.stepRequests(); for (StepRequest request : mgr.stepRequests()) {
Iterator iter = requests.iterator();
while (iter.hasNext()) {
StepRequest request = (StepRequest)iter.next();
if (request.thread().equals(thread)) { if (request.thread().equals(thread)) {
mgr.deleteEventRequest(request); mgr.deleteEventRequest(request);
break; break;
@ -591,7 +584,7 @@ public class ExecutionManager {
if (session == null || thread == null) { if (session == null || thread == null) {
return null; return null;
} }
ThreadInfo info = (ThreadInfo)threadInfoMap.get(thread); ThreadInfo info = threadInfoMap.get(thread);
if (info == null) { if (info == null) {
//### Should not hardcode initial frame count and prefetch here! //### Should not hardcode initial frame count and prefetch here!
//info = new ThreadInfo(thread, 10, 10); //info = new ThreadInfo(thread, 10, 10);
@ -607,24 +600,22 @@ public class ExecutionManager {
void validateThreadInfo() { void validateThreadInfo() {
session.interrupted = true; session.interrupted = true;
Iterator iter = threadInfoList.iterator(); for (ThreadInfo threadInfo : threadInfoList) {
while (iter.hasNext()) { threadInfo.validate();
((ThreadInfo)iter.next()).validate();
} }
} }
private void invalidateThreadInfo() { private void invalidateThreadInfo() {
if (session != null) { if (session != null) {
session.interrupted = false; session.interrupted = false;
Iterator iter = threadInfoList.iterator(); for (ThreadInfo threadInfo : threadInfoList) {
while (iter.hasNext()) { threadInfo.invalidate();
((ThreadInfo)iter.next()).invalidate();
} }
} }
} }
void removeThreadInfo(ThreadReference thread) { void removeThreadInfo(ThreadReference thread) {
ThreadInfo info = (ThreadInfo)threadInfoMap.get(thread); ThreadInfo info = threadInfoMap.get(thread);
if (info != null) { if (info != null) {
info.invalidate(); info.invalidate();
threadInfoMap.remove(thread); threadInfoMap.remove(thread);
@ -702,7 +693,7 @@ public class ExecutionManager {
while (inputBuffer.size() < 1) { while (inputBuffer.size() < 1) {
inputLock.wait(); inputLock.wait();
} }
line = (String)inputBuffer.removeLast(); line = inputBuffer.removeLast();
} catch (InterruptedException e) {} } catch (InterruptedException e) {}
} }
} }
@ -774,7 +765,7 @@ public class ExecutionManager {
public BreakpointSpec public BreakpointSpec
createMethodBreakpoint(String classPattern, createMethodBreakpoint(String classPattern,
String methodId, List methodArgs) { String methodId, List<String> methodArgs) {
return specList.createMethodBreakpoint(classPattern, return specList.createMethodBreakpoint(classPattern,
methodId, methodArgs); methodId, methodArgs);
} }
@ -811,7 +802,7 @@ public class ExecutionManager {
specList.install(spec, vm()); specList.install(spec, vm());
} }
public List eventRequestSpecs() { public List<EventRequestSpec> eventRequestSpecs() {
return specList.eventRequestSpecs(); return specList.eventRequestSpecs();
} }
} }

View File

@ -82,9 +82,7 @@ class JDIEventSource extends Thread {
boolean interrupted = es.suspendedAll(); boolean interrupted = es.suspendedAll();
es.notify(firstListener); es.notify(firstListener);
boolean wantInterrupt = JDIEventSource.this.wantInterrupt; boolean wantInterrupt = JDIEventSource.this.wantInterrupt;
for (Iterator it = session.runtime.jdiListeners.iterator(); for (JDIListener jl : session.runtime.jdiListeners) {
it.hasNext(); ) {
JDIListener jl = (JDIListener)it.next();
es.notify(jl); es.notify(jl);
} }
if (interrupted && !wantInterrupt) { if (interrupted && !wantInterrupt) {

View File

@ -58,12 +58,12 @@ public class LineBreakpointSpec extends BreakpointSpec {
LineNotFoundException { LineNotFoundException {
Location location = null; Location location = null;
try { try {
List locs = clazz.locationsOfLine(lineNumber()); List<Location> locs = clazz.locationsOfLine(lineNumber());
if (locs.size() == 0) { if (locs.size() == 0) {
throw new LineNotFoundException(); throw new LineNotFoundException();
} }
// TODO handle multiple locations // TODO handle multiple locations
location = (Location)locs.get(0); location = locs.get(0);
if (location.method() == null) { if (location.method() == null) {
throw new LineNotFoundException(); throw new LineNotFoundException();
} }

View File

@ -34,11 +34,11 @@ import java.util.Iterator;
public class MethodBreakpointSpec extends BreakpointSpec { public class MethodBreakpointSpec extends BreakpointSpec {
String methodId; String methodId;
List methodArgs; List<String> methodArgs;
MethodBreakpointSpec(EventRequestSpecList specs, MethodBreakpointSpec(EventRequestSpecList specs,
ReferenceTypeSpec refSpec, ReferenceTypeSpec refSpec,
String methodId, List methodArgs) { String methodId, List<String> methodArgs) {
super(specs, refSpec); super(specs, refSpec);
this.methodId = methodId; this.methodId = methodId;
this.methodArgs = methodArgs; this.methodArgs = methodArgs;
@ -76,7 +76,7 @@ public class MethodBreakpointSpec extends BreakpointSpec {
return methodId; return methodId;
} }
public List methodArgs() { public List<String> methodArgs() {
return methodArgs; return methodArgs;
} }
@ -120,14 +120,13 @@ public class MethodBreakpointSpec extends BreakpointSpec {
buffer.append('.'); buffer.append('.');
buffer.append(methodId); buffer.append(methodId);
if (methodArgs != null) { if (methodArgs != null) {
Iterator iter = methodArgs.iterator();
boolean first = true; boolean first = true;
buffer.append('('); buffer.append('(');
while (iter.hasNext()) { for (String name : methodArgs) {
if (!first) { if (!first) {
buffer.append(','); buffer.append(',');
} }
buffer.append((String)iter.next()); buffer.append(name);
first = false; first = false;
} }
buffer.append(")"); buffer.append(")");
@ -151,8 +150,8 @@ public class MethodBreakpointSpec extends BreakpointSpec {
* and if the number of arguments in the method matches the * and if the number of arguments in the method matches the
* number of names passed * number of names passed
*/ */
private boolean compareArgTypes(Method method, List nameList) { private boolean compareArgTypes(Method method, List<String> nameList) {
List argTypeNames = method.argumentTypeNames(); List<String> argTypeNames = method.argumentTypeNames();
// If argument counts differ, we can stop here // If argument counts differ, we can stop here
if (argTypeNames.size() != nameList.size()) { if (argTypeNames.size() != nameList.size()) {
@ -162,8 +161,8 @@ public class MethodBreakpointSpec extends BreakpointSpec {
// Compare each argument type's name // Compare each argument type's name
int nTypes = argTypeNames.size(); int nTypes = argTypeNames.size();
for (int i = 0; i < nTypes; ++i) { for (int i = 0; i < nTypes; ++i) {
String comp1 = (String)argTypeNames.get(i); String comp1 = argTypeNames.get(i);
String comp2 = (String)nameList.get(i); String comp2 = nameList.get(i);
if (! comp1.equals(comp2)) { if (! comp1.equals(comp2)) {
/* /*
* We have to handle varargs. EG, the * We have to handle varargs. EG, the
@ -288,22 +287,17 @@ public class MethodBreakpointSpec extends BreakpointSpec {
List<String> argTypeNames = null; List<String> argTypeNames = null;
if (methodArgs() != null) { if (methodArgs() != null) {
argTypeNames = new ArrayList<String>(methodArgs().size()); argTypeNames = new ArrayList<String>(methodArgs().size());
Iterator iter = methodArgs().iterator(); for (String name : methodArgs()) {
while (iter.hasNext()) {
String name = (String)iter.next();
name = normalizeArgTypeName(name); name = normalizeArgTypeName(name);
argTypeNames.add(name); argTypeNames.add(name);
} }
} }
// Check each method in the class for matches // Check each method in the class for matches
Iterator iter = clazz.methods().iterator();
Method firstMatch = null; // first method with matching name Method firstMatch = null; // first method with matching name
Method exactMatch = null; // (only) method with same name & sig Method exactMatch = null; // (only) method with same name & sig
int matchCount = 0; // > 1 implies overload int matchCount = 0; // > 1 implies overload
while (iter.hasNext()) { for (Method candidate : clazz.methods()) {
Method candidate = (Method)iter.next();
if (candidate.name().equals(methodName())) { if (candidate.name().equals(methodName())) {
matchCount++; matchCount++;

View File

@ -36,7 +36,7 @@ import java.util.Iterator;
* Descend the tree of thread groups. * Descend the tree of thread groups.
* @author Robert G. Field * @author Robert G. Field
*/ */
public class ThreadGroupIterator implements Iterator { public class ThreadGroupIterator implements Iterator<ThreadGroupReference> {
private final Stack<Iterator<ThreadGroupReference>> stack private final Stack<Iterator<ThreadGroupReference>> stack
= new Stack<Iterator<ThreadGroupReference>>(); = new Stack<Iterator<ThreadGroupReference>>();
@ -56,8 +56,8 @@ public class ThreadGroupIterator implements Iterator {
} }
*/ */
private Iterator top() { private Iterator<ThreadGroupReference> top() {
return (Iterator)stack.peek(); return stack.peek();
} }
/** /**
@ -77,12 +77,12 @@ public class ThreadGroupIterator implements Iterator {
return !stack.isEmpty(); return !stack.isEmpty();
} }
public Object next() { public ThreadGroupReference next() {
return nextThreadGroup(); return nextThreadGroup();
} }
public ThreadGroupReference nextThreadGroup() { public ThreadGroupReference nextThreadGroup() {
ThreadGroupReference tg = (ThreadGroupReference)top().next(); ThreadGroupReference tg = top().next();
push(tg.threadGroups()); push(tg.threadGroups());
return tg; return tg;
} }

View File

@ -30,8 +30,8 @@ import com.sun.jdi.ThreadReference;
import java.util.List; import java.util.List;
import java.util.Iterator; import java.util.Iterator;
public class ThreadIterator implements Iterator { public class ThreadIterator implements Iterator<ThreadReference> {
Iterator it = null; Iterator<ThreadReference> it = null;
ThreadGroupIterator tgi; ThreadGroupIterator tgi;
public ThreadIterator(ThreadGroupReference tg) { public ThreadIterator(ThreadGroupReference tg) {
@ -53,12 +53,12 @@ public class ThreadIterator implements Iterator {
return true; return true;
} }
public Object next() { public ThreadReference next() {
return it.next(); return it.next();
} }
public ThreadReference nextThread() { public ThreadReference nextThread() {
return (ThreadReference)next(); return next();
} }
public void remove() { public void remove() {

View File

@ -191,11 +191,12 @@ abstract class LValue {
return field; return field;
} }
static List methodsByName(ReferenceType refType, String name, int kind) { static List<Method> methodsByName(ReferenceType refType,
List list = refType.methodsByName(name); String name, int kind) {
Iterator iter = list.iterator(); List<Method> list = refType.methodsByName(name);
Iterator<Method> iter = list.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
Method method = (Method)iter.next(); Method method = iter.next();
boolean isStatic = method.isStatic(); boolean isStatic = method.isStatic();
if (((kind == STATIC) && !isStatic) || if (((kind == STATIC) && !isStatic) ||
((kind == INSTANCE) && isStatic)) { ((kind == INSTANCE) && isStatic)) {
@ -231,21 +232,21 @@ abstract class LValue {
* argType is not assignable from the type of the argument value. * argType is not assignable from the type of the argument value.
* IE, one is an Apple and the other is an Orange. * IE, one is an Apple and the other is an Orange.
*/ */
static int argumentsMatch(List argTypes, List arguments) { static int argumentsMatch(List<Type> argTypes, List<Value> arguments) {
if (argTypes.size() != arguments.size()) { if (argTypes.size() != arguments.size()) {
return DIFFERENT; return DIFFERENT;
} }
Iterator typeIter = argTypes.iterator(); Iterator<Type> typeIter = argTypes.iterator();
Iterator valIter = arguments.iterator(); Iterator<Value> valIter = arguments.iterator();
int result = SAME; int result = SAME;
// If any pair aren't the same, change the // If any pair aren't the same, change the
// result to ASSIGNABLE. If any pair aren't // result to ASSIGNABLE. If any pair aren't
// assignable, return DIFFERENT // assignable, return DIFFERENT
while (typeIter.hasNext()) { while (typeIter.hasNext()) {
Type argType = (Type)typeIter.next(); Type argType = typeIter.next();
Value value = (Value)valIter.next(); Value value = valIter.next();
if (value == null) { if (value == null) {
// Null values can be passed to any non-primitive argument // Null values can be passed to any non-primitive argument
if (primitiveTypeNames.contains(argType.name())) { if (primitiveTypeNames.contains(argType.name())) {
@ -333,7 +334,7 @@ abstract class LValue {
if (fromType instanceof ArrayType) { if (fromType instanceof ArrayType) {
return isArrayAssignableTo((ArrayType)fromType, toType); return isArrayAssignableTo((ArrayType)fromType, toType);
} }
List interfaces; List<InterfaceType> interfaces;
if (fromType instanceof ClassType) { if (fromType instanceof ClassType) {
ClassType superclazz = ((ClassType)fromType).superclass(); ClassType superclazz = ((ClassType)fromType).superclass();
if ((superclazz != null) && isAssignableTo(superclazz, toType)) { if ((superclazz != null) && isAssignableTo(superclazz, toType)) {
@ -344,9 +345,7 @@ abstract class LValue {
// fromType must be an InterfaceType // fromType must be an InterfaceType
interfaces = ((InterfaceType)fromType).superinterfaces(); interfaces = ((InterfaceType)fromType).superinterfaces();
} }
Iterator iter = interfaces.iterator(); for (InterfaceType interfaze : interfaces) {
while (iter.hasNext()) {
InterfaceType interfaze = (InterfaceType)iter.next();
if (isAssignableTo(interfaze, toType)) { if (isAssignableTo(interfaze, toType)) {
return true; return true;
} }
@ -354,7 +353,8 @@ abstract class LValue {
return false; return false;
} }
static Method resolveOverload(List overloads, List arguments) static Method resolveOverload(List<Method> overloads,
List<Value> arguments)
throws ParseException { throws ParseException {
// If there is only one method to call, we'll just choose // If there is only one method to call, we'll just choose
@ -362,7 +362,7 @@ abstract class LValue {
// the invoke will return a better error message than we // the invoke will return a better error message than we
// could generate here. // could generate here.
if (overloads.size() == 1) { if (overloads.size() == 1) {
return (Method)overloads.get(0); return overloads.get(0);
} }
// Resolving overloads is beyond the scope of this exercise. // Resolving overloads is beyond the scope of this exercise.
@ -374,12 +374,10 @@ abstract class LValue {
// methods to call. And, since casts aren't implemented, // methods to call. And, since casts aren't implemented,
// the user can't use them to pick a particular overload to call. // the user can't use them to pick a particular overload to call.
// IE, the user is out of luck in this case. // IE, the user is out of luck in this case.
Iterator iter = overloads.iterator();
Method retVal = null; Method retVal = null;
int assignableCount = 0; int assignableCount = 0;
while (iter.hasNext()) { for (Method mm : overloads) {
Method mm = (Method)iter.next(); List<Type> argTypes;
List argTypes;
try { try {
argTypes = mm.argumentTypes(); argTypes = mm.argumentTypes();
} catch (ClassNotLoadedException ee) { } catch (ClassNotLoadedException ee) {
@ -443,7 +441,7 @@ abstract class LValue {
final ObjectReference obj; final ObjectReference obj;
final ThreadReference thread; final ThreadReference thread;
final Field matchingField; final Field matchingField;
final List overloads; final List<Method> overloads;
Method matchingMethod = null; Method matchingMethod = null;
List<Value> methodArguments = null; List<Value> methodArguments = null;
@ -510,7 +508,7 @@ abstract class LValue {
final ReferenceType refType; final ReferenceType refType;
final ThreadReference thread; final ThreadReference thread;
final Field matchingField; final Field matchingField;
final List overloads; final List<Method> overloads;
Method matchingMethod = null; Method matchingMethod = null;
List<Value> methodArguments = null; List<Value> methodArguments = null;
@ -765,7 +763,7 @@ abstract class LValue {
static LValue makeNewObject(VirtualMachine vm, static LValue makeNewObject(VirtualMachine vm,
ExpressionParser.GetFrame frameGetter, ExpressionParser.GetFrame frameGetter,
String className, List<Value> arguments) throws ParseException { String className, List<Value> arguments) throws ParseException {
List classes = vm.classesByName(className); List<ReferenceType> classes = vm.classesByName(className);
if (classes.size() == 0) { if (classes.size() == 0) {
throw new ParseException("No class named: " + className); throw new ParseException("No class named: " + className);
} }
@ -774,7 +772,7 @@ abstract class LValue {
throw new ParseException("More than one class named: " + throw new ParseException("More than one class named: " +
className); className);
} }
ReferenceType refType = (ReferenceType)classes.get(0); ReferenceType refType = classes.get(0);
if (!(refType instanceof ClassType)) { if (!(refType instanceof ClassType)) {
@ -784,9 +782,9 @@ abstract class LValue {
ClassType classType = (ClassType)refType; ClassType classType = (ClassType)refType;
List<Method> methods = new ArrayList<Method>(classType.methods()); // writable List<Method> methods = new ArrayList<Method>(classType.methods()); // writable
Iterator iter = methods.iterator(); Iterator<Method> iter = methods.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
Method method = (Method)iter.next(); Method method = iter.next();
if (!method.isConstructor()) { if (!method.isConstructor()) {
iter.remove(); iter.remove();
} }
@ -858,13 +856,13 @@ abstract class LValue {
} }
// check for class name // check for class name
while (izer.hasMoreTokens()) { while (izer.hasMoreTokens()) {
List classes = vm.classesByName(first); List<ReferenceType> classes = vm.classesByName(first);
if (classes.size() > 0) { if (classes.size() > 0) {
if (classes.size() > 1) { if (classes.size() > 1) {
throw new ParseException("More than one class named: " + throw new ParseException("More than one class named: " +
first); first);
} else { } else {
ReferenceType refType = (ReferenceType)classes.get(0); ReferenceType refType = classes.get(0);
LValue lval = new LValueStaticMember(refType, LValue lval = new LValueStaticMember(refType,
izer.nextToken(), thread); izer.nextToken(), thread);
return nFields(lval, izer, thread); return nFields(lval, izer, thread);

View File

@ -124,9 +124,7 @@ public class ClassTreeTool extends JPanel {
public void sessionStart(EventObject e) { public void sessionStart(EventObject e) {
// Get system classes and any others loaded before attaching. // Get system classes and any others loaded before attaching.
try { try {
Iterator iter = runtime.allClasses().iterator(); for (ReferenceType type : runtime.allClasses()) {
while (iter.hasNext()) {
ReferenceType type = ((ReferenceType)iter.next());
root.addClass(type); root.addClass(type);
} }
} catch (VMDisconnectedException ee) { } catch (VMDisconnectedException ee) {

View File

@ -77,7 +77,7 @@ public class CommandInterpreter {
while (ti.hasNext()) { while (ti.hasNext()) {
tlist.add(ti.nextThread()); tlist.add(ti.nextThread());
} }
threads = (ThreadReference[])tlist.toArray(new ThreadReference[tlist.size()]); threads = tlist.toArray(new ThreadReference[tlist.size()]);
} }
return threads; return threads;
} }
@ -146,11 +146,9 @@ public class CommandInterpreter {
// Command: classes // Command: classes
private void commandClasses() throws NoSessionException { private void commandClasses() throws NoSessionException {
List list = runtime.allClasses();
OutputSink out = env.getOutputSink(); OutputSink out = env.getOutputSink();
//out.println("** classes list **"); //out.println("** classes list **");
for (int i = 0 ; i < list.size() ; i++) { for (ReferenceType refType : runtime.allClasses()) {
ReferenceType refType = (ReferenceType)list.get(i);
out.println(refType.name()); out.println(refType.name());
} }
out.show(); out.show();
@ -167,16 +165,16 @@ public class CommandInterpreter {
String idClass = t.nextToken(); String idClass = t.nextToken();
ReferenceType cls = findClass(idClass); ReferenceType cls = findClass(idClass);
if (cls != null) { if (cls != null) {
List methods = cls.allMethods(); List<Method> methods = cls.allMethods();
OutputSink out = env.getOutputSink(); OutputSink out = env.getOutputSink();
for (int i = 0; i < methods.size(); i++) { for (int i = 0; i < methods.size(); i++) {
Method method = (Method)methods.get(i); Method method = methods.get(i);
out.print(method.declaringType().name() + " " + out.print(method.declaringType().name() + " " +
method.name() + "("); method.name() + "(");
Iterator it = method.argumentTypeNames().iterator(); Iterator<String> it = method.argumentTypeNames().iterator();
if (it.hasNext()) { if (it.hasNext()) {
while (true) { while (true) {
out.print((String)it.next()); out.print(it.next());
if (!it.hasNext()) { if (!it.hasNext()) {
break; break;
} }
@ -193,10 +191,10 @@ public class CommandInterpreter {
} }
private ReferenceType findClass(String pattern) throws NoSessionException { private ReferenceType findClass(String pattern) throws NoSessionException {
List results = runtime.findClassesMatchingPattern(pattern); List<ReferenceType> results = runtime.findClassesMatchingPattern(pattern);
if (results.size() > 0) { if (results.size() > 0) {
//### Should handle multiple results sensibly. //### Should handle multiple results sensibly.
return (ReferenceType)results.get(0); return results.get(0);
} }
return null; return null;
} }
@ -235,11 +233,11 @@ public class CommandInterpreter {
private int printThreadGroup(OutputSink out, ThreadGroupReference tg, int iThread) { private int printThreadGroup(OutputSink out, ThreadGroupReference tg, int iThread) {
out.println("Group " + tg.name() + ":"); out.println("Group " + tg.name() + ":");
List tlist = tg.threads(); List<ThreadReference> tlist = tg.threads();
int maxId = 0; int maxId = 0;
int maxName = 0; int maxName = 0;
for (int i = 0 ; i < tlist.size() ; i++) { for (int i = 0 ; i < tlist.size() ; i++) {
ThreadReference thr = (ThreadReference)tlist.get(i); ThreadReference thr = tlist.get(i);
int len = Utils.description(thr).length(); int len = Utils.description(thr).length();
if (len > maxId) if (len > maxId)
maxId = len; maxId = len;
@ -254,7 +252,7 @@ public class CommandInterpreter {
String maxNumString = String.valueOf(iThread + tlist.size()); String maxNumString = String.valueOf(iThread + tlist.size());
int maxNumDigits = maxNumString.length(); int maxNumDigits = maxNumString.length();
for (int i = 0 ; i < tlist.size() ; i++) { for (int i = 0 ; i < tlist.size() ; i++) {
ThreadReference thr = (ThreadReference)tlist.get(i); ThreadReference thr = tlist.get(i);
char buf[] = new char[80]; char buf[] = new char[80];
for (int j = 0; j < 79; j++) { for (int j = 0; j < 79; j++) {
buf[j] = ' '; buf[j] = ' ';
@ -283,9 +281,7 @@ public class CommandInterpreter {
sbOut.setLength(79); sbOut.setLength(79);
out.println(sbOut.toString()); out.println(sbOut.toString());
} }
List tglist = tg.threadGroups(); for (ThreadGroupReference tg0 : tg.threadGroups()) {
for (int ig = 0; ig < tglist.size(); ig++) {
ThreadGroupReference tg0 = (ThreadGroupReference)tglist.get(ig);
if (!tg.equals(tg0)) { // TODO ref mgt if (!tg.equals(tg0)) { // TODO ref mgt
iThread += printThreadGroup(out, tg0, iThread + tlist.size()); iThread += printThreadGroup(out, tg0, iThread + tlist.size());
} }
@ -733,7 +729,7 @@ public class CommandInterpreter {
if (token.toLowerCase().equals("all")) { if (token.toLowerCase().equals("all")) {
ThreadIterator it = allThreads(); ThreadIterator it = allThreads();
while (it.hasNext()) { while (it.hasNext()) {
ThreadReference thread = (ThreadReference)it.next(); ThreadReference thread = it.next();
out.println(thread.name() + ": "); out.println(thread.name() + ": ");
dumpStack(thread, showPC); dumpStack(thread, showPC);
} }
@ -755,7 +751,7 @@ public class CommandInterpreter {
//env.failure("Target VM must be in interrupted state."); //env.failure("Target VM must be in interrupted state.");
//env.failure("Current thread isn't suspended."); //env.failure("Current thread isn't suspended.");
//### Should handle extremely long stack traces sensibly for user. //### Should handle extremely long stack traces sensibly for user.
List stack = null; List<StackFrame> stack = null;
try { try {
stack = thread.frames(); stack = thread.frames();
} catch (IncompatibleThreadStateException e) { } catch (IncompatibleThreadStateException e) {
@ -772,7 +768,7 @@ public class CommandInterpreter {
OutputSink out = env.getOutputSink(); OutputSink out = env.getOutputSink();
int nFrames = stack.size(); int nFrames = stack.size();
for (int i = frameIndex; i < nFrames; i++) { for (int i = frameIndex; i < nFrames; i++) {
StackFrame frame = (StackFrame)stack.get(i); StackFrame frame = stack.get(i);
Location loc = frame.location(); Location loc = frame.location();
Method meth = loc.method(); Method meth = loc.method();
out.print(" [" + (i + 1) + "] "); out.print(" [" + (i + 1) + "] ");
@ -780,7 +776,7 @@ public class CommandInterpreter {
out.print('.'); out.print('.');
out.print(meth.name()); out.print(meth.name());
out.print(" ("); out.print(" (");
if (meth instanceof Method && ((Method)meth).isNative()) { if (meth.isNative()) {
out.print("native method"); out.print("native method");
} else if (loc.lineNumber() != -1) { } else if (loc.lineNumber() != -1) {
try { try {
@ -806,14 +802,13 @@ public class CommandInterpreter {
private void listEventRequests() throws NoSessionException { private void listEventRequests() throws NoSessionException {
// Print set breakpoints // Print set breakpoints
Iterator iter = runtime.eventRequestSpecs().iterator(); List<EventRequestSpec> specs = runtime.eventRequestSpecs();
if (!iter.hasNext()) { if (specs.isEmpty()) {
env.notice("No breakpoints/watchpoints/exceptions set."); env.notice("No breakpoints/watchpoints/exceptions set.");
} else { } else {
OutputSink out = env.getOutputSink(); OutputSink out = env.getOutputSink();
out.println("Current breakpoints/watchpoints/exceptions set:"); out.println("Current breakpoints/watchpoints/exceptions set:");
while (iter.hasNext()) { for (EventRequestSpec bp : specs) {
EventRequestSpec bp = (EventRequestSpec)iter.next();
out.println("\t" + bp); out.println("\t" + bp);
} }
out.show(); out.show();
@ -926,13 +921,13 @@ public class CommandInterpreter {
//### need 'clear all' //### need 'clear all'
BreakpointSpec bpSpec = parseBreakpointSpec(t.nextToken()); BreakpointSpec bpSpec = parseBreakpointSpec(t.nextToken());
if (bpSpec != null) { if (bpSpec != null) {
Iterator iter = runtime.eventRequestSpecs().iterator(); List<EventRequestSpec> specs = runtime.eventRequestSpecs();
if (!iter.hasNext()) {
if (specs.isEmpty()) {
env.notice("No breakpoints set."); env.notice("No breakpoints set.");
} else { } else {
List<BreakpointSpec> toDelete = new ArrayList<BreakpointSpec>(); List<EventRequestSpec> toDelete = new ArrayList<EventRequestSpec>();
while (iter.hasNext()) { for (EventRequestSpec spec : specs) {
BreakpointSpec spec = (BreakpointSpec)iter.next();
if (spec.equals(bpSpec)) { if (spec.equals(bpSpec)) {
toDelete.add(spec); toDelete.add(spec);
} }
@ -941,7 +936,7 @@ public class CommandInterpreter {
if (toDelete.size() <= 1) { if (toDelete.size() <= 1) {
env.notice("No matching breakpoint set."); env.notice("No matching breakpoint set.");
} }
for (BreakpointSpec spec : toDelete) { for (EventRequestSpec spec : toDelete) {
runtime.delete(spec); runtime.delete(spec);
} }
} }
@ -988,7 +983,7 @@ public class CommandInterpreter {
lineno = Integer.valueOf(id).intValue(); lineno = Integer.valueOf(id).intValue();
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
// It isn't -- see if it's a method name. // It isn't -- see if it's a method name.
List meths = refType.methodsByName(id); List<Method> meths = refType.methodsByName(id);
if (meths == null || meths.size() == 0) { if (meths == null || meths.size() == 0) {
env.failure(id + env.failure(id +
" is not a valid line number or " + " is not a valid line number or " +
@ -1001,7 +996,7 @@ public class CommandInterpreter {
refType.name()); refType.name());
return; return;
} }
loc = ((Method)meths.get(0)).location(); loc = meths.get(0).location();
lineno = loc.lineNumber(); lineno = loc.lineNumber();
} }
} }
@ -1121,7 +1116,7 @@ public class CommandInterpreter {
return; return;
} }
List vars; List<LocalVariable> vars;
try { try {
vars = frame.visibleVariables(); vars = frame.visibleVariables();
if (vars == null || vars.size() == 0) { if (vars == null || vars.size() == 0) {
@ -1136,15 +1131,13 @@ public class CommandInterpreter {
OutputSink out = env.getOutputSink(); OutputSink out = env.getOutputSink();
out.println("Method arguments:"); out.println("Method arguments:");
for (Iterator it = vars.iterator(); it.hasNext(); ) { for (LocalVariable var : vars) {
LocalVariable var = (LocalVariable)it.next();
if (var.isArgument()) { if (var.isArgument()) {
printVar(out, var, frame); printVar(out, var, frame);
} }
} }
out.println("Local variables:"); out.println("Local variables:");
for (Iterator it = vars.iterator(); it.hasNext(); ) { for (LocalVariable var : vars) {
LocalVariable var = (LocalVariable)it.next();
if (!var.isArgument()) { if (!var.isArgument()) {
printVar(out, var, frame); printVar(out, var, frame);
} }
@ -1245,8 +1238,7 @@ public class CommandInterpreter {
private void dump(OutputSink out, private void dump(OutputSink out,
ObjectReference obj, ReferenceType refType, ObjectReference obj, ReferenceType refType,
ReferenceType refTypeBase) { ReferenceType refTypeBase) {
for (Iterator it = refType.fields().iterator(); it.hasNext(); ) { for (Field field : refType.fields()) {
Field field = (Field)it.next();
out.print(" "); out.print(" ");
if (!refType.equals(refTypeBase)) { if (!refType.equals(refTypeBase)) {
out.print(refType.name() + "."); out.print(refType.name() + ".");
@ -1261,9 +1253,8 @@ public class CommandInterpreter {
dump(out, obj, sup, refTypeBase); dump(out, obj, sup, refTypeBase);
} }
} else if (refType instanceof InterfaceType) { } else if (refType instanceof InterfaceType) {
List sups = ((InterfaceType)refType).superinterfaces(); for (InterfaceType sup : ((InterfaceType)refType).superinterfaces()) {
for (Iterator it = sups.iterator(); it.hasNext(); ) { dump(out, obj, sup, refTypeBase);
dump(out, obj, (ReferenceType)it.next(), refTypeBase);
} }
} }
} }

View File

@ -201,11 +201,11 @@ public class JDBFileFilter extends FileFilter {
if(description == null || isExtensionListInDescription()) { if(description == null || isExtensionListInDescription()) {
fullDescription = description==null ? "(" : description + " ("; fullDescription = description==null ? "(" : description + " (";
// build the description from the extension list // build the description from the extension list
Enumeration extensions = filters.keys(); Enumeration<String> extensions = filters.keys();
if(extensions != null) { if(extensions != null) {
fullDescription += "." + (String) extensions.nextElement(); fullDescription += "." + extensions.nextElement();
while (extensions.hasMoreElements()) { while (extensions.hasMoreElements()) {
fullDescription += ", " + (String) extensions.nextElement(); fullDescription += ", " + extensions.nextElement();
} }
} }
fullDescription += ")"; fullDescription += ")";

View File

@ -131,14 +131,13 @@ class LaunchTool {
final JPanel radioPanel = new JPanel(); final JPanel radioPanel = new JPanel();
final ButtonGroup radioGroup = new ButtonGroup(); final ButtonGroup radioGroup = new ButtonGroup();
VirtualMachineManager manager = Bootstrap.virtualMachineManager(); VirtualMachineManager manager = Bootstrap.virtualMachineManager();
List all = manager.allConnectors(); List<Connector> all = manager.allConnectors();
Map<ButtonModel, Connector> modelToConnector = new HashMap<ButtonModel, Connector>(all.size(), 0.5f); Map<ButtonModel, Connector> modelToConnector = new HashMap<ButtonModel, Connector>(all.size(), 0.5f);
dialog.setModal(true); dialog.setModal(true);
dialog.setTitle("Select Connector Type"); dialog.setTitle("Select Connector Type");
radioPanel.setLayout(new BoxLayout(radioPanel, BoxLayout.Y_AXIS)); radioPanel.setLayout(new BoxLayout(radioPanel, BoxLayout.Y_AXIS));
for (Iterator it = all.iterator(); it.hasNext(); ) { for (Connector connector : all) {
Connector connector = (Connector)it.next();
JRadioButton radio = new JRadioButton(connector.description()); JRadioButton radio = new JRadioButton(connector.description());
modelToConnector.put(radio.getModel(), connector); modelToConnector.put(radio.getModel(), connector);
radioPanel.add(radio); radioPanel.add(radio);
@ -166,7 +165,7 @@ class LaunchTool {
dialog.show(); dialog.show();
return oked[0] ? return oked[0] ?
(Connector)(modelToConnector.get(radioGroup.getSelection())) : modelToConnector.get(radioGroup.getSelection()) :
null; null;
} }
@ -188,13 +187,12 @@ class LaunchTool {
// guts.add(new JLabel(connector.description())); // guts.add(new JLabel(connector.description()));
final List<ArgRep> argReps = new ArrayList<ArgRep>(args.size()); final List<ArgRep> argReps = new ArrayList<ArgRep>(args.size());
for (Iterator it = args.values().iterator(); it.hasNext(); ) { for (Connector.Argument arg : args.values()) {
Object arg = it.next();
ArgRep ar; ArgRep ar;
if (arg instanceof Connector.BooleanArgument) { if (arg instanceof Connector.BooleanArgument) {
ar = new BooleanArgRep((Connector.BooleanArgument)arg, guts); ar = new BooleanArgRep((Connector.BooleanArgument)arg, guts);
} else { } else {
ar = new StringArgRep((Connector.Argument)arg, guts); ar = new StringArgRep(arg, guts);
} }
argReps.add(ar); argReps.add(ar);
} }
@ -202,8 +200,7 @@ class LaunchTool {
JPanel buttonPanel = okCancel( dialog, new ActionListener() { JPanel buttonPanel = okCancel( dialog, new ActionListener() {
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
for (Iterator it = argReps.iterator(); it.hasNext(); ) { for (ArgRep ar : argReps) {
ArgRep ar = (ArgRep)it.next();
if (!ar.isSpecified()) { if (!ar.isSpecified()) {
JOptionPane.showMessageDialog(dialog, JOptionPane.showMessageDialog(dialog,
ar.arg.label() + ar.arg.label() +

View File

@ -42,7 +42,7 @@ public class SearchPath {
dlist.add(st.nextToken()); dlist.add(st.nextToken());
} }
pathString = searchPath; pathString = searchPath;
pathArray = (String[])dlist.toArray(new String[dlist.size()]); pathArray = dlist.toArray(new String[dlist.size()]);
} }
public boolean isEmpty() { public boolean isEmpty() {
@ -54,7 +54,7 @@ public class SearchPath {
} }
public String[] asArray() { public String[] asArray() {
return (String[])pathArray.clone(); return pathArray.clone();
} }
public File resolve(String relativeFileName) { public File resolve(String relativeFileName) {
@ -89,7 +89,7 @@ public class SearchPath {
} }
} }
} }
return (String[])s.toArray(new String[s.size()]); return s.toArray(new String[s.size()]);
} }
} }

View File

@ -113,7 +113,7 @@ public class SourceManager {
* Returns null if not available. * Returns null if not available.
*/ */
public SourceModel sourceForClass(ReferenceType refType) { public SourceModel sourceForClass(ReferenceType refType) {
SourceModel sm = (SourceModel)classToSource.get(refType); SourceModel sm = classToSource.get(refType);
if (sm != null) { if (sm != null) {
return sm; return sm;
} }
@ -140,10 +140,10 @@ public class SourceManager {
*/ */
//### Use hash table for this? //### Use hash table for this?
public SourceModel sourceForFile(File path) { public SourceModel sourceForFile(File path) {
Iterator iter = sourceList.iterator(); Iterator<SourceModel> iter = sourceList.iterator();
SourceModel sm = null; SourceModel sm = null;
while (iter.hasNext()) { while (iter.hasNext()) {
SourceModel candidate = (SourceModel)iter.next(); SourceModel candidate = iter.next();
if (candidate.fileName().equals(path)) { if (candidate.fileName().equals(path)) {
sm = candidate; sm = candidate;
iter.remove(); // Will move to start of list. iter.remove(); // Will move to start of list.

View File

@ -187,22 +187,17 @@ public class SourceModel extends AbstractListModel {
* when sourceLines is set. * when sourceLines is set.
*/ */
private void markClassLines(ReferenceType refType) { private void markClassLines(ReferenceType refType) {
List methods = refType.methods(); for (Method meth : refType.methods()) {
for (Iterator mit = methods.iterator(); mit.hasNext();) {
Method meth = (Method)mit.next();
try { try {
List lines = meth.allLineLocations(); for (Location loc : meth.allLineLocations()) {
for (Iterator lit = lines.iterator(); lit.hasNext();) {
Location loc = (Location)lit.next();
showExecutable(loc.lineNumber(), refType); showExecutable(loc.lineNumber(), refType);
} }
} catch (AbsentInformationException exc) { } catch (AbsentInformationException exc) {
// do nothing // do nothing
} }
} }
List bps = env.getExecutionManager().eventRequestManager().breakpointRequests(); for (BreakpointRequest bp :
for (Iterator it = bps.iterator(); it.hasNext();) { env.getExecutionManager().eventRequestManager().breakpointRequests()) {
BreakpointRequest bp = (BreakpointRequest)it.next();
if (bp.location() != null) { if (bp.location() != null) {
Location loc = bp.location(); Location loc = bp.location();
if (loc.declaringType().equals(refType)) { if (loc.declaringType().equals(refType)) {
@ -224,8 +219,8 @@ public class SourceModel extends AbstractListModel {
} finally { } finally {
reader.close(); reader.close();
} }
for (Iterator it = classes.iterator(); it.hasNext();) { for (ReferenceType refType : classes) {
markClassLines((ClassType)it.next()); markClassLines(refType);
} }
} }

View File

@ -139,7 +139,7 @@ public class StackTraceTool extends JPanel {
String methName = String methName =
meth.declaringType().name() + '.' + meth.name(); meth.declaringType().name() + '.' + meth.name();
String position = ""; String position = "";
if (meth instanceof Method && ((Method)meth).isNative()) { if (meth.isNative()) {
position = " (native method)"; position = " (native method)";
} else if (loc.lineNumber() != -1) { } else if (loc.lineNumber() != -1) {
position = ":" + loc.lineNumber(); position = ":" + loc.lineNumber();

View File

@ -133,9 +133,7 @@ public class ThreadTreeTool extends JPanel {
public void sessionStart(EventObject e) { public void sessionStart(EventObject e) {
try { try {
Iterator iter = runtime.allThreads().iterator(); for (ThreadReference thread : runtime.allThreads()) {
while (iter.hasNext()) {
ThreadReference thread = ((ThreadReference)iter.next());
root.addThread(thread); root.addThread(thread);
} }
} catch (VMDisconnectedException ee) { } catch (VMDisconnectedException ee) {
@ -244,16 +242,16 @@ public class ThreadTreeTool extends JPanel {
} }
} }
private void addThread(List threadPath, ThreadReference thread) { private void addThread(List<String> threadPath, ThreadReference thread) {
int size = threadPath.size(); int size = threadPath.size();
if (size == 0) { if (size == 0) {
return; return;
} else if (size == 1) { } else if (size == 1) {
String name = (String)threadPath.get(0); String name = threadPath.get(0);
insertNode(name, thread); insertNode(name, thread);
} else { } else {
String head = (String)threadPath.get(0); String head = threadPath.get(0);
List tail = threadPath.subList(1, size); List<String> tail = threadPath.subList(1, size);
ThreadTreeNode child = insertNode(head, null); ThreadTreeNode child = insertNode(head, null);
child.addThread(tail, thread); child.addThread(tail, thread);
} }
@ -288,17 +286,17 @@ public class ThreadTreeTool extends JPanel {
} }
} }
private void removeThread(List threadPath, ThreadReference thread) { private void removeThread(List<String> threadPath, ThreadReference thread) {
int size = threadPath.size(); int size = threadPath.size();
if (size == 0) { if (size == 0) {
return; return;
} else if (size == 1) { } else if (size == 1) {
String name = (String)threadPath.get(0); String name = threadPath.get(0);
ThreadTreeNode child = findLeafNode(thread, name); ThreadTreeNode child = findLeafNode(thread, name);
treeModel.removeNodeFromParent(child); treeModel.removeNodeFromParent(child);
} else { } else {
String head = (String)threadPath.get(0); String head = threadPath.get(0);
List tail = threadPath.subList(1, size); List<String> tail = threadPath.subList(1, size);
ThreadTreeNode child = findInternalNode(head); ThreadTreeNode child = findInternalNode(head);
child.removeThread(tail, thread); child.removeThread(tail, thread);
if (child.isThreadGroup() && child.getChildCount() < 1) { if (child.isThreadGroup() && child.getChildCount() < 1) {

View File

@ -34,7 +34,7 @@ import java.util.Iterator;
class BreakpointSpec extends EventRequestSpec { class BreakpointSpec extends EventRequestSpec {
String methodId; String methodId;
List methodArgs; List<String> methodArgs;
int lineNumber; int lineNumber;
BreakpointSpec(ReferenceTypeSpec refSpec, int lineNumber) { BreakpointSpec(ReferenceTypeSpec refSpec, int lineNumber) {
@ -45,7 +45,7 @@ class BreakpointSpec extends EventRequestSpec {
} }
BreakpointSpec(ReferenceTypeSpec refSpec, String methodId, BreakpointSpec(ReferenceTypeSpec refSpec, String methodId,
List methodArgs) throws MalformedMemberNameException { List<String> methodArgs) throws MalformedMemberNameException {
super(refSpec); super(refSpec);
this.methodId = methodId; this.methodId = methodId;
this.methodArgs = methodArgs; this.methodArgs = methodArgs;
@ -83,7 +83,7 @@ class BreakpointSpec extends EventRequestSpec {
return lineNumber; return lineNumber;
} }
List methodArgs() { List<String> methodArgs() {
return methodArgs; return methodArgs;
} }
@ -146,14 +146,13 @@ class BreakpointSpec extends EventRequestSpec {
buffer.append('.'); buffer.append('.');
buffer.append(methodId); buffer.append(methodId);
if (methodArgs != null) { if (methodArgs != null) {
Iterator iter = methodArgs.iterator();
boolean first = true; boolean first = true;
buffer.append('('); buffer.append('(');
while (iter.hasNext()) { for (String arg : methodArgs) {
if (!first) { if (!first) {
buffer.append(','); buffer.append(',');
} }
buffer.append((String)iter.next()); buffer.append(arg);
first = false; first = false;
} }
buffer.append(")"); buffer.append(")");
@ -176,12 +175,12 @@ class BreakpointSpec extends EventRequestSpec {
location = method.location(); location = method.location();
} else { } else {
// let AbsentInformationException be thrown // let AbsentInformationException be thrown
List locs = refType.locationsOfLine(lineNumber()); List<Location> locs = refType.locationsOfLine(lineNumber());
if (locs.size() == 0) { if (locs.size() == 0) {
throw new LineNotFoundException(); throw new LineNotFoundException();
} }
// TO DO: handle multiple locations // TO DO: handle multiple locations
location = (Location)locs.get(0); location = locs.get(0);
if (location.method() == null) { if (location.method() == null) {
throw new LineNotFoundException(); throw new LineNotFoundException();
} }
@ -202,8 +201,8 @@ class BreakpointSpec extends EventRequestSpec {
* and if the number of arguments in the method matches the * and if the number of arguments in the method matches the
* number of names passed * number of names passed
*/ */
private boolean compareArgTypes(Method method, List nameList) { private boolean compareArgTypes(Method method, List<String> nameList) {
List argTypeNames = method.argumentTypeNames(); List<String> argTypeNames = method.argumentTypeNames();
// If argument counts differ, we can stop here // If argument counts differ, we can stop here
if (argTypeNames.size() != nameList.size()) { if (argTypeNames.size() != nameList.size()) {
@ -213,8 +212,8 @@ class BreakpointSpec extends EventRequestSpec {
// Compare each argument type's name // Compare each argument type's name
int nTypes = argTypeNames.size(); int nTypes = argTypeNames.size();
for (int i = 0; i < nTypes; ++i) { for (int i = 0; i < nTypes; ++i) {
String comp1 = (String)argTypeNames.get(i); String comp1 = argTypeNames.get(i);
String comp2 = (String)nameList.get(i); String comp2 = nameList.get(i);
if (! comp1.equals(comp2)) { if (! comp1.equals(comp2)) {
/* /*
* We have to handle varargs. EG, the * We have to handle varargs. EG, the
@ -331,22 +330,17 @@ class BreakpointSpec extends EventRequestSpec {
List<String> argTypeNames = null; List<String> argTypeNames = null;
if (methodArgs() != null) { if (methodArgs() != null) {
argTypeNames = new ArrayList<String>(methodArgs().size()); argTypeNames = new ArrayList<String>(methodArgs().size());
Iterator iter = methodArgs().iterator(); for (String name : methodArgs()) {
while (iter.hasNext()) {
String name = (String)iter.next();
name = normalizeArgTypeName(name); name = normalizeArgTypeName(name);
argTypeNames.add(name); argTypeNames.add(name);
} }
} }
// Check each method in the class for matches // Check each method in the class for matches
Iterator iter = refType.methods().iterator();
Method firstMatch = null; // first method with matching name Method firstMatch = null; // first method with matching name
Method exactMatch = null; // (only) method with same name & sig Method exactMatch = null; // (only) method with same name & sig
int matchCount = 0; // > 1 implies overload int matchCount = 0; // > 1 implies overload
while (iter.hasNext()) { for (Method candidate : refType.methods()) {
Method candidate = (Method)iter.next();
if (candidate.name().equals(methodName())) { if (candidate.name().equals(methodName())) {
matchCount++; matchCount++;

View File

@ -157,16 +157,16 @@ class Commands {
buf.append(method.name()); buf.append(method.name());
buf.append("("); buf.append("(");
List args = method.argumentTypeNames(); List<String> args = method.argumentTypeNames();
int lastParam = args.size() - 1; int lastParam = args.size() - 1;
// output param types except for the last // output param types except for the last
for (int ii = 0; ii < lastParam; ii++) { for (int ii = 0; ii < lastParam; ii++) {
buf.append((String)args.get(ii)); buf.append(args.get(ii));
buf.append(", "); buf.append(", ");
} }
if (lastParam >= 0) { if (lastParam >= 0) {
// output the last param // output the last param
String lastStr = (String)args.get(lastParam); String lastStr = args.get(lastParam);
if (method.isVarArgs()) { if (method.isVarArgs()) {
// lastParam is an array. Replace the [] with ... // lastParam is an array. Replace the [] with ...
buf.append(lastStr.substring(0, lastStr.length() - 2)); buf.append(lastStr.substring(0, lastStr.length() - 2));
@ -180,12 +180,11 @@ class Commands {
} }
void commandConnectors(VirtualMachineManager vmm) { void commandConnectors(VirtualMachineManager vmm) {
Iterator iter = vmm.allConnectors().iterator(); Collection<Connector> ccs = vmm.allConnectors();
if (iter.hasNext()) { if (ccs.isEmpty()) {
MessageOutput.println("Connectors available"); MessageOutput.println("Connectors available");
} }
while (iter.hasNext()) { for (Connector cc : ccs) {
Connector cc = (Connector)iter.next();
String transportName = String transportName =
cc.transport() == null ? "null" : cc.transport().name(); cc.transport() == null ? "null" : cc.transport().name();
MessageOutput.println(); MessageOutput.println();
@ -193,10 +192,7 @@ class Commands {
new Object [] {cc.name(), transportName}); new Object [] {cc.name(), transportName});
MessageOutput.println("Connector description", cc.description()); MessageOutput.println("Connector description", cc.description());
Iterator argIter = cc.defaultArguments().values().iterator(); for (Connector.Argument aa : cc.defaultArguments().values()) {
if (argIter.hasNext()) {
while (argIter.hasNext()) {
Connector.Argument aa = (Connector.Argument)argIter.next();
MessageOutput.println(); MessageOutput.println();
boolean requiredArgument = aa.mustSpecify(); boolean requiredArgument = aa.mustSpecify();
@ -215,16 +211,12 @@ class Commands {
} }
} }
}
} }
void commandClasses() { void commandClasses() {
List list = Env.vm().allClasses();
StringBuffer classList = new StringBuffer(); StringBuffer classList = new StringBuffer();
for (int i = 0 ; i < list.size() ; i++) { for (ReferenceType refType : Env.vm().allClasses()) {
ReferenceType refType = (ReferenceType)list.get(i);
classList.append(refType.name()); classList.append(refType.name());
classList.append("\n"); classList.append("\n");
} }
@ -232,7 +224,7 @@ class Commands {
} }
void commandClass(StringTokenizer t) { void commandClass(StringTokenizer t) {
List list = Env.vm().allClasses(); List<ReferenceType> list = Env.vm().allClasses();
if (!t.hasMoreTokens()) { if (!t.hasMoreTokens()) {
MessageOutput.println("No class specified."); MessageOutput.println("No class specified.");
@ -265,51 +257,31 @@ class Commands {
superclass = showAll ? superclass.superclass() : null; superclass = showAll ? superclass.superclass() : null;
} }
List interfaces = showAll ? clazz.allInterfaces() List<InterfaceType> interfaces =
: clazz.interfaces(); showAll ? clazz.allInterfaces() : clazz.interfaces();
Iterator iter = interfaces.iterator(); for (InterfaceType interfaze : interfaces) {
while (iter.hasNext()) {
InterfaceType interfaze = (InterfaceType)iter.next();
MessageOutput.println("implements:", interfaze.name()); MessageOutput.println("implements:", interfaze.name());
} }
List subs = clazz.subclasses(); for (ClassType sub : clazz.subclasses()) {
iter = subs.iterator();
while (iter.hasNext()) {
ClassType sub = (ClassType)iter.next();
MessageOutput.println("subclass:", sub.name()); MessageOutput.println("subclass:", sub.name());
} }
List nested = clazz.nestedTypes(); for (ReferenceType nest : clazz.nestedTypes()) {
iter = nested.iterator();
while (iter.hasNext()) {
ReferenceType nest = (ReferenceType)iter.next();
MessageOutput.println("nested:", nest.name()); MessageOutput.println("nested:", nest.name());
} }
} else if (type instanceof InterfaceType) { } else if (type instanceof InterfaceType) {
InterfaceType interfaze = (InterfaceType)type; InterfaceType interfaze = (InterfaceType)type;
MessageOutput.println("Interface:", interfaze.name()); MessageOutput.println("Interface:", interfaze.name());
List supers = interfaze.superinterfaces(); for (InterfaceType superinterface : interfaze.superinterfaces()) {
Iterator iter = supers.iterator();
while (iter.hasNext()) {
InterfaceType superinterface = (InterfaceType)iter.next();
MessageOutput.println("extends:", superinterface.name()); MessageOutput.println("extends:", superinterface.name());
} }
List subs = interfaze.subinterfaces(); for (InterfaceType sub : interfaze.subinterfaces()) {
iter = subs.iterator();
while (iter.hasNext()) {
InterfaceType sub = (InterfaceType)iter.next();
MessageOutput.println("subinterface:", sub.name()); MessageOutput.println("subinterface:", sub.name());
} }
List implementors = interfaze.implementors(); for (ClassType implementor : interfaze.implementors()) {
iter = implementors.iterator();
while (iter.hasNext()) {
ClassType implementor = (ClassType)iter.next();
MessageOutput.println("implementor:", implementor.name()); MessageOutput.println("implementor:", implementor.name());
} }
List nested = interfaze.nestedTypes(); for (ReferenceType nest : interfaze.nestedTypes()) {
iter = nested.iterator();
while (iter.hasNext()) {
ReferenceType nest = (ReferenceType)iter.next();
MessageOutput.println("nested:", nest.name()); MessageOutput.println("nested:", nest.name());
} }
} else { // array type } else { // array type
@ -327,10 +299,8 @@ class Commands {
String idClass = t.nextToken(); String idClass = t.nextToken();
ReferenceType cls = Env.getReferenceTypeFromToken(idClass); ReferenceType cls = Env.getReferenceTypeFromToken(idClass);
if (cls != null) { if (cls != null) {
List methods = cls.allMethods();
StringBuffer methodsList = new StringBuffer(); StringBuffer methodsList = new StringBuffer();
for (int i = 0; i < methods.size(); i++) { for (Method method : cls.allMethods()) {
Method method = (Method)methods.get(i);
methodsList.append(method.declaringType().name()); methodsList.append(method.declaringType().name());
methodsList.append(" "); methodsList.append(" ");
methodsList.append(typedName(method)); methodsList.append(typedName(method));
@ -351,11 +321,10 @@ class Commands {
String idClass = t.nextToken(); String idClass = t.nextToken();
ReferenceType cls = Env.getReferenceTypeFromToken(idClass); ReferenceType cls = Env.getReferenceTypeFromToken(idClass);
if (cls != null) { if (cls != null) {
List fields = cls.allFields(); List<Field> fields = cls.allFields();
List visible = cls.visibleFields(); List<Field> visible = cls.visibleFields();
StringBuffer fieldsList = new StringBuffer(); StringBuffer fieldsList = new StringBuffer();
for (int i = 0; i < fields.size(); i++) { for (Field field : fields) {
Field field = (Field)fields.get(i);
String s; String s;
if (!visible.contains(field)) { if (!visible.contains(field)) {
s = MessageOutput.format("list field typename and name hidden", s = MessageOutput.format("list field typename and name hidden",
@ -386,7 +355,7 @@ class Commands {
int maxIdLength = 0; int maxIdLength = 0;
int maxNameLength = 0; int maxNameLength = 0;
while (threadIter.hasNext()) { while (threadIter.hasNext()) {
ThreadReference thr = (ThreadReference)threadIter.next(); ThreadReference thr = threadIter.next();
maxIdLength = Math.max(maxIdLength, maxIdLength = Math.max(maxIdLength,
Env.description(thr).length()); Env.description(thr).length());
maxNameLength = Math.max(maxNameLength, maxNameLength = Math.max(maxNameLength,
@ -395,7 +364,7 @@ class Commands {
threadIter = new ThreadIterator(tg); threadIter = new ThreadIterator(tg);
while (threadIter.hasNext()) { while (threadIter.hasNext()) {
ThreadReference thr = (ThreadReference)threadIter.next(); ThreadReference thr = threadIter.next();
if (thr.threadGroup() == null) { if (thr.threadGroup() == null) {
continue; continue;
} }
@ -588,9 +557,7 @@ class Commands {
private List<ThreadReference> allThreads(ThreadGroupReference group) { private List<ThreadReference> allThreads(ThreadGroupReference group) {
List<ThreadReference> list = new ArrayList<ThreadReference>(); List<ThreadReference> list = new ArrayList<ThreadReference>();
list.addAll(group.threads()); list.addAll(group.threads());
Iterator iter = group.threadGroups().iterator(); for (ThreadGroupReference child : group.threadGroups()) {
while (iter.hasNext()) {
ThreadGroupReference child = (ThreadGroupReference)iter.next();
list.addAll(allThreads(child)); list.addAll(allThreads(child));
} }
return list; return list;
@ -641,10 +608,7 @@ class Commands {
* if so, it gets removed here. * if so, it gets removed here.
*/ */
EventRequestManager mgr = Env.vm().eventRequestManager(); EventRequestManager mgr = Env.vm().eventRequestManager();
List requests = mgr.stepRequests(); for (StepRequest request : mgr.stepRequests()) {
Iterator iter = requests.iterator();
while (iter.hasNext()) {
StepRequest request = (StepRequest)iter.next();
if (request.thread().equals(thread)) { if (request.thread().equals(thread)) {
mgr.deleteEventRequest(request); mgr.deleteEventRequest(request);
break; break;
@ -768,9 +732,7 @@ class Commands {
boolean noExceptions = true; boolean noExceptions = true;
// Print a listing of the catch patterns currently in place // Print a listing of the catch patterns currently in place
Iterator iter = Env.specList.eventRequestSpecs().iterator(); for (EventRequestSpec spec : Env.specList.eventRequestSpecs()) {
while (iter.hasNext()) {
EventRequestSpec spec = (EventRequestSpec)iter.next();
if (spec instanceof ExceptionSpec) { if (spec instanceof ExceptionSpec) {
if (noExceptions) { if (noExceptions) {
noExceptions = false; noExceptions = false;
@ -928,7 +890,7 @@ class Commands {
} }
private void dumpStack(ThreadInfo threadInfo, boolean showPC) { private void dumpStack(ThreadInfo threadInfo, boolean showPC) {
List stack = null; List<StackFrame> stack = null;
try { try {
stack = threadInfo.getStack(); stack = threadInfo.getStack();
} catch (IncompatibleThreadStateException e) { } catch (IncompatibleThreadStateException e) {
@ -940,7 +902,7 @@ class Commands {
} else { } else {
int nFrames = stack.size(); int nFrames = stack.size();
for (int i = threadInfo.getCurrentFrameIndex(); i < nFrames; i++) { for (int i = threadInfo.getCurrentFrameIndex(); i < nFrames; i++) {
StackFrame frame = (StackFrame)stack.get(i); StackFrame frame = stack.get(i);
dumpFrame (i, showPC, frame); dumpFrame (i, showPC, frame);
} }
} }
@ -956,7 +918,7 @@ class Commands {
long lineNumber = loc.lineNumber(); long lineNumber = loc.lineNumber();
String methodInfo = null; String methodInfo = null;
if (meth instanceof Method && ((Method)meth).isNative()) { if (meth.isNative()) {
methodInfo = MessageOutput.format("native method"); methodInfo = MessageOutput.format("native method");
} else if (lineNumber != -1) { } else if (lineNumber != -1) {
try { try {
@ -994,9 +956,7 @@ class Commands {
} else { } else {
String token = t.nextToken(); String token = t.nextToken();
if (token.toLowerCase().equals("all")) { if (token.toLowerCase().equals("all")) {
Iterator iter = ThreadInfo.threads().iterator(); for (ThreadInfo threadInfo : ThreadInfo.threads()) {
while (iter.hasNext()) {
ThreadInfo threadInfo = (ThreadInfo)iter.next();
MessageOutput.println("Thread:", MessageOutput.println("Thread:",
threadInfo.getThread().name()); threadInfo.getThread().name());
dumpStack(threadInfo, showPC); dumpStack(threadInfo, showPC);
@ -1051,9 +1011,7 @@ class Commands {
boolean noBreakpoints = true; boolean noBreakpoints = true;
// Print set breakpoints // Print set breakpoints
Iterator iter = Env.specList.eventRequestSpecs().iterator(); for (EventRequestSpec spec : Env.specList.eventRequestSpecs()) {
while (iter.hasNext()) {
EventRequestSpec spec = (EventRequestSpec)iter.next();
if (spec instanceof BreakpointSpec) { if (spec instanceof BreakpointSpec) {
if (noBreakpoints) { if (noBreakpoints) {
noBreakpoints = false; noBreakpoints = false;
@ -1075,7 +1033,7 @@ class Commands {
protected BreakpointSpec parseBreakpointSpec(StringTokenizer t, protected BreakpointSpec parseBreakpointSpec(StringTokenizer t,
String atForm, String inForm) { String atForm, String inForm) {
EventRequestSpec breakpoint = null; BreakpointSpec breakpoint = null;
try { try {
String token = t.nextToken(":( \t\n\r"); String token = t.nextToken(":( \t\n\r");
@ -1149,7 +1107,7 @@ class Commands {
printBreakpointCommandUsage(atForm, inForm); printBreakpointCommandUsage(atForm, inForm);
return null; return null;
} }
return (BreakpointSpec)breakpoint; return breakpoint;
} }
private void resolveNow(EventRequestSpec spec) { private void resolveNow(EventRequestSpec spec) {
@ -1209,8 +1167,8 @@ class Commands {
} }
} }
private List<EventRequestSpec> parseWatchpointSpec(StringTokenizer t) { private List<WatchpointSpec> parseWatchpointSpec(StringTokenizer t) {
List<EventRequestSpec> list = new ArrayList<EventRequestSpec>(); List<WatchpointSpec> list = new ArrayList<WatchpointSpec>();
boolean access = false; boolean access = false;
boolean modification = false; boolean modification = false;
int suspendPolicy = EventRequest.SUSPEND_ALL; int suspendPolicy = EventRequest.SUSPEND_ALL;
@ -1242,7 +1200,7 @@ class Commands {
fieldName = fieldName.substring(dot+1); fieldName = fieldName.substring(dot+1);
try { try {
EventRequestSpec spec; WatchpointSpec spec;
if (access) { if (access) {
spec = Env.specList.createAccessWatchpoint(className, spec = Env.specList.createAccessWatchpoint(className,
fieldName); fieldName);
@ -1269,9 +1227,8 @@ class Commands {
return; return;
} }
Iterator iter = parseWatchpointSpec(t).iterator(); for (WatchpointSpec spec : parseWatchpointSpec(t)) {
while (iter.hasNext()) { resolveNow(spec);
resolveNow((WatchpointSpec)iter.next());
} }
} }
@ -1281,9 +1238,7 @@ class Commands {
return; return;
} }
Iterator iter = parseWatchpointSpec(t).iterator(); for (WatchpointSpec spec : parseWatchpointSpec(t)) {
while (iter.hasNext()) {
WatchpointSpec spec = (WatchpointSpec)iter.next();
if (Env.specList.delete(spec)) { if (Env.specList.delete(spec)) {
MessageOutput.println("Removed:", spec.toString()); MessageOutput.println("Removed:", spec.toString());
} else { } else {
@ -1482,7 +1437,7 @@ class Commands {
lineno = n.intValue(); lineno = n.intValue();
} catch (java.text.ParseException jtpe) { } catch (java.text.ParseException jtpe) {
// It isn't -- see if it's a method name. // It isn't -- see if it's a method name.
List meths = refType.methodsByName(id); List<Method> meths = refType.methodsByName(id);
if (meths == null || meths.size() == 0) { if (meths == null || meths.size() == 0) {
MessageOutput.println("is not a valid line number or method name for", MessageOutput.println("is not a valid line number or method name for",
new Object [] {id, refType.name()}); new Object [] {id, refType.name()});
@ -1492,7 +1447,7 @@ class Commands {
new Object [] {id, refType.name()}); new Object [] {id, refType.name()});
return; return;
} }
loc = ((Method)meths.get(0)).location(); loc = meths.get(0).location();
lineno = loc.lineNumber(); lineno = loc.lineNumber();
} }
} }
@ -1539,14 +1494,11 @@ class Commands {
try { try {
ReferenceType refType = Env.getReferenceTypeFromToken(idClass); ReferenceType refType = Env.getReferenceTypeFromToken(idClass);
if (refType != null) { if (refType != null) {
List lines = null; List<Location> lines = null;
if (idMethod == null) { if (idMethod == null) {
lines = refType.allLineLocations(); lines = refType.allLineLocations();
} else { } else {
List methods = refType.allMethods(); for (Method method : refType.allMethods()) {
Iterator iter = methods.iterator();
while (iter.hasNext()) {
Method method = (Method)iter.next();
if (method.name().equals(idMethod)) { if (method.name().equals(idMethod)) {
lines = method.allLineLocations(); lines = method.allLineLocations();
} }
@ -1555,9 +1507,7 @@ class Commands {
MessageOutput.println("is not a valid method name", idMethod); MessageOutput.println("is not a valid method name", idMethod);
} }
} }
Iterator iter = lines.iterator(); for (Location line : lines) {
while (iter.hasNext()) {
Location line = (Location)iter.next();
MessageOutput.printDirectln(line.toString());// Special case: use printDirectln() MessageOutput.printDirectln(line.toString());// Special case: use printDirectln()
} }
} else { } else {
@ -1620,21 +1570,19 @@ class Commands {
MessageOutput.println("No local variables"); MessageOutput.println("No local variables");
return; return;
} }
Map values = frame.getValues(vars); Map<LocalVariable, Value> values = frame.getValues(vars);
MessageOutput.println("Method arguments:"); MessageOutput.println("Method arguments:");
for (Iterator it = vars.iterator(); it.hasNext(); ) { for (LocalVariable var : vars) {
LocalVariable var = (LocalVariable)it.next();
if (var.isArgument()) { if (var.isArgument()) {
Value val = (Value)values.get(var); Value val = values.get(var);
printVar(var, val); printVar(var, val);
} }
} }
MessageOutput.println("Local variables:"); MessageOutput.println("Local variables:");
for (Iterator it = vars.iterator(); it.hasNext(); ) { for (LocalVariable var : vars) {
LocalVariable var = (LocalVariable)it.next();
if (!var.isArgument()) { if (!var.isArgument()) {
Value val = (Value)values.get(var); Value val = values.get(var);
printVar(var, val); printVar(var, val);
} }
} }
@ -1647,9 +1595,8 @@ class Commands {
private void dump(ObjectReference obj, ReferenceType refType, private void dump(ObjectReference obj, ReferenceType refType,
ReferenceType refTypeBase) { ReferenceType refTypeBase) {
for (Iterator it = refType.fields().iterator(); it.hasNext(); ) { for (Field field : refType.fields()) {
StringBuffer o = new StringBuffer(); StringBuffer o = new StringBuffer();
Field field = (Field)it.next();
o.append(" "); o.append(" ");
if (!refType.equals(refTypeBase)) { if (!refType.equals(refTypeBase)) {
o.append(refType.name()); o.append(refType.name());
@ -1666,14 +1613,13 @@ class Commands {
dump(obj, sup, refTypeBase); dump(obj, sup, refTypeBase);
} }
} else if (refType instanceof InterfaceType) { } else if (refType instanceof InterfaceType) {
List sups = ((InterfaceType)refType).superinterfaces(); for (InterfaceType sup : ((InterfaceType)refType).superinterfaces()) {
for (Iterator it = sups.iterator(); it.hasNext(); ) { dump(obj, sup, refTypeBase);
dump(obj, (ReferenceType)it.next(), refTypeBase);
} }
} else { } else {
/* else refType is an instanceof ArrayType */ /* else refType is an instanceof ArrayType */
if (obj instanceof ArrayReference) { if (obj instanceof ArrayReference) {
for (Iterator it = ((ArrayReference)obj).getValues().iterator(); for (Iterator<Value> it = ((ArrayReference)obj).getValues().iterator();
it.hasNext(); ) { it.hasNext(); ) {
MessageOutput.printDirect(it.next().toString());// Special case: use printDirect() MessageOutput.printDirect(it.next().toString());// Special case: use printDirect()
if (it.hasNext()) { if (it.hasNext()) {
@ -1770,13 +1716,11 @@ class Commands {
new Object [] {owner.name(), new Object [] {owner.name(),
new Integer (object.entryCount())}); new Integer (object.entryCount())});
} }
List waiters = object.waitingThreads(); List<ThreadReference> waiters = object.waitingThreads();
if (waiters.size() == 0) { if (waiters.size() == 0) {
MessageOutput.println("No waiters"); MessageOutput.println("No waiters");
} else { } else {
Iterator iter = waiters.iterator(); for (ThreadReference waiter : waiters) {
while (iter.hasNext()) {
ThreadReference waiter = (ThreadReference)iter.next();
MessageOutput.println("Waiting thread:", waiter.name()); MessageOutput.println("Waiting thread:", waiter.name());
} }
} }
@ -1800,13 +1744,11 @@ class Commands {
ThreadReference thread = threadInfo.getThread(); ThreadReference thread = threadInfo.getThread();
try { try {
MessageOutput.println("Monitor information for thread", thread.name()); MessageOutput.println("Monitor information for thread", thread.name());
List owned = thread.ownedMonitors(); List<ObjectReference> owned = thread.ownedMonitors();
if (owned.size() == 0) { if (owned.size() == 0) {
MessageOutput.println("No monitors owned"); MessageOutput.println("No monitors owned");
} else { } else {
Iterator iter = owned.iterator(); for (ObjectReference monitor : owned) {
while (iter.hasNext()) {
ObjectReference monitor = (ObjectReference)iter.next();
MessageOutput.println("Owned monitor:", monitor.toString()); MessageOutput.println("Owned monitor:", monitor.toString());
} }
} }
@ -1833,9 +1775,7 @@ class Commands {
} }
String token = t.nextToken(); String token = t.nextToken();
if (token.toLowerCase().equals("all")) { if (token.toLowerCase().equals("all")) {
Iterator iter = ThreadInfo.threads().iterator(); for (ThreadInfo threadInfo : ThreadInfo.threads()) {
while (iter.hasNext()) {
ThreadInfo threadInfo = (ThreadInfo)iter.next();
printThreadLockInfo(threadInfo); printThreadLockInfo(threadInfo);
} }
} else { } else {
@ -1930,14 +1870,12 @@ class Commands {
void commandSave(final StringTokenizer t) { // Undocumented command: useful for testing. void commandSave(final StringTokenizer t) { // Undocumented command: useful for testing.
if (!t.hasMoreTokens()) { if (!t.hasMoreTokens()) {
Set keys = Env.getSaveKeys(); Set<String> keys = Env.getSaveKeys();
Iterator iter = keys.iterator(); if (keys.isEmpty()) {
if (!iter.hasNext()) {
MessageOutput.println("No saved values"); MessageOutput.println("No saved values");
return; return;
} }
while (iter.hasNext()) { for (String key : keys) {
String key = (String)iter.next();
Value value = Env.getSavedValue(key); Value value = Env.getSavedValue(key);
if ((value instanceof ObjectReference) && if ((value instanceof ObjectReference) &&
((ObjectReference)value).isCollected()) { ((ObjectReference)value).isCollected()) {
@ -1976,7 +1914,7 @@ class Commands {
// Overloading is not handled here. // Overloading is not handled here.
String methodName = t.nextToken(); String methodName = t.nextToken();
List classes = Env.vm().classesByName(className); List<ReferenceType> classes = Env.vm().classesByName(className);
// TO DO: handle multiple classes found // TO DO: handle multiple classes found
if (classes.size() == 0) { if (classes.size() == 0) {
if (className.indexOf('.') < 0) { if (className.indexOf('.') < 0) {
@ -1987,17 +1925,14 @@ class Commands {
return; return;
} }
ReferenceType rt = (ReferenceType)classes.get(0); ReferenceType rt = classes.get(0);
if (!(rt instanceof ClassType)) { if (!(rt instanceof ClassType)) {
MessageOutput.println("not a class", className); MessageOutput.println("not a class", className);
return; return;
} }
byte[] bytecodes = null; byte[] bytecodes = null;
List list = rt.methodsByName(methodName); for (Method method : rt.methodsByName(methodName)) {
Iterator iter = list.iterator();
while (iter.hasNext()) {
Method method = (Method)iter.next();
if (!method.isAbstract()) { if (!method.isAbstract()) {
bytecodes = method.bytecodes(); bytecodes = method.bytecodes();
break; break;
@ -2047,7 +1982,7 @@ class Commands {
MessageOutput.println("Specify classes to redefine"); MessageOutput.println("Specify classes to redefine");
} else { } else {
String className = t.nextToken(); String className = t.nextToken();
List classes = Env.vm().classesByName(className); List<ReferenceType> classes = Env.vm().classesByName(className);
if (classes.size() == 0) { if (classes.size() == 0) {
MessageOutput.println("No class named", className); MessageOutput.println("No class named", className);
return; return;
@ -2057,7 +1992,7 @@ class Commands {
return; return;
} }
Env.setSourcePath(Env.getSourcePath()); Env.setSourcePath(Env.getSourcePath());
ReferenceType refType = (ReferenceType)classes.get(0); ReferenceType refType = classes.get(0);
if (!t.hasMoreTokens()) { if (!t.hasMoreTokens()) {
MessageOutput.println("Specify file name for class", className); MessageOutput.println("Specify file name for class", className);
return; return;
@ -2074,7 +2009,8 @@ class Commands {
new Object [] {fileName, exc.toString()}); new Object [] {fileName, exc.toString()});
return; return;
} }
Map<ReferenceType, byte[]> map = new HashMap<ReferenceType, byte[]>(); Map<ReferenceType, byte[]> map
= new HashMap<ReferenceType, byte[]>();
map.put(refType, bytes); map.put(refType, bytes);
try { try {
Env.vm().redefineClasses(map); Env.vm().redefineClasses(map);

View File

@ -89,7 +89,7 @@ class Env {
sourceCache.clear(); sourceCache.clear();
} }
static void setSourcePath(List srcList) { static void setSourcePath(List<String> srcList) {
sourceMapper = new SourceMapper(srcList); sourceMapper = new SourceMapper(srcList);
sourceCache.clear(); sourceCache.clear();
} }
@ -106,10 +106,8 @@ class Env {
} }
static String excludesString() { static String excludesString() {
Iterator iter = excludes().iterator();
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
while (iter.hasNext()) { for (String pattern : excludes()) {
String pattern = (String)iter.next();
buffer.append(pattern); buffer.append(pattern);
buffer.append(","); buffer.append(",");
} }
@ -117,25 +115,19 @@ class Env {
} }
static void addExcludes(StepRequest request) { static void addExcludes(StepRequest request) {
Iterator iter = excludes().iterator(); for (String pattern : excludes()) {
while (iter.hasNext()) {
String pattern = (String)iter.next();
request.addClassExclusionFilter(pattern); request.addClassExclusionFilter(pattern);
} }
} }
static void addExcludes(MethodEntryRequest request) { static void addExcludes(MethodEntryRequest request) {
Iterator iter = excludes().iterator(); for (String pattern : excludes()) {
while (iter.hasNext()) {
String pattern = (String)iter.next();
request.addClassExclusionFilter(pattern); request.addClassExclusionFilter(pattern);
} }
} }
static void addExcludes(MethodExitRequest request) { static void addExcludes(MethodExitRequest request) {
Iterator iter = excludes().iterator(); for (String pattern : excludes()) {
while (iter.hasNext()) {
String pattern = (String)iter.next();
request.addClassExclusionFilter(pattern); request.addClassExclusionFilter(pattern);
} }
} }
@ -175,10 +167,10 @@ class Env {
try { try {
String fileName = location.sourceName(); String fileName = location.sourceName();
Iterator iter = sourceCache.iterator(); Iterator<SourceCode> iter = sourceCache.iterator();
SourceCode code = null; SourceCode code = null;
while (iter.hasNext()) { while (iter.hasNext()) {
SourceCode candidate = (SourceCode)iter.next(); SourceCode candidate = iter.next();
if (candidate.fileName().equals(fileName)) { if (candidate.fileName().equals(fileName)) {
code = candidate; code = candidate;
iter.remove(); iter.remove();
@ -269,10 +261,7 @@ class Env {
// loaded class whose name matches this limited regular // loaded class whose name matches this limited regular
// expression is selected. // expression is selected.
idToken = idToken.substring(1); idToken = idToken.substring(1);
List classes = Env.vm().allClasses(); for (ReferenceType type : Env.vm().allClasses()) {
Iterator iter = classes.iterator();
while (iter.hasNext()) {
ReferenceType type = ((ReferenceType)iter.next());
if (type.name().endsWith(idToken)) { if (type.name().endsWith(idToken)) {
cls = type; cls = type;
break; break;
@ -280,21 +269,21 @@ class Env {
} }
} else { } else {
// It's a class name // It's a class name
List classes = Env.vm().classesByName(idToken); List<ReferenceType> classes = Env.vm().classesByName(idToken);
if (classes.size() > 0) { if (classes.size() > 0) {
// TO DO: handle multiples // TO DO: handle multiples
cls = (ReferenceType)classes.get(0); cls = classes.get(0);
} }
} }
return cls; return cls;
} }
static Set getSaveKeys() { static Set<String> getSaveKeys() {
return savedValues.keySet(); return savedValues.keySet();
} }
static Value getSavedValue(String key) { static Value getSavedValue(String key) {
return (Value)savedValues.get(key); return savedValues.get(key);
} }
static void setSavedValue(String key, Value value) { static void setSavedValue(String key, Value value) {
@ -327,7 +316,7 @@ class Env {
if (index >= sourceLines.size()) { if (index >= sourceLines.size()) {
return null; return null;
} else { } else {
return (String)sourceLines.get(index); return sourceLines.get(index);
} }
} }
} }

View File

@ -150,7 +150,7 @@ public class EventHandler implements Runnable {
EventSet eventSet = queue.remove(); EventSet eventSet = queue.remove();
EventIterator iter = eventSet.eventIterator(); EventIterator iter = eventSet.eventIterator();
while (iter.hasNext()) { while (iter.hasNext()) {
handleExitEvent((Event)iter.next()); handleExitEvent(iter.next());
} }
} catch (InterruptedException exc) { } catch (InterruptedException exc) {
// ignore // ignore
@ -183,7 +183,7 @@ public class EventHandler implements Runnable {
* If any event in the set has a thread associated with it, * If any event in the set has a thread associated with it,
* they all will, so just grab the first one. * they all will, so just grab the first one.
*/ */
Event event = (Event)set.iterator().next(); // Is there a better way? Event event = set.iterator().next(); // Is there a better way?
thread = eventThread(event); thread = eventThread(event);
} else { } else {
thread = null; thread = null;

View File

@ -101,10 +101,8 @@ abstract class EventRequestSpec {
* so that is all we need to examine. * so that is all we need to examine.
*/ */
ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>(); ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
Iterator iter = for (ExceptionRequest er :
Env.vm().eventRequestManager().exceptionRequests().iterator(); Env.vm().eventRequestManager().exceptionRequests()) {
while (iter.hasNext()) {
ExceptionRequest er = (ExceptionRequest)iter.next();
if (prs.matches(er.exception())) { if (prs.matches(er.exception())) {
deleteList.add (er); deleteList.add (er);
} }
@ -115,9 +113,7 @@ abstract class EventRequestSpec {
} }
private EventRequest resolveAgainstPreparedClasses() throws Exception { private EventRequest resolveAgainstPreparedClasses() throws Exception {
Iterator iter = Env.vm().allClasses().iterator(); for (ReferenceType refType : Env.vm().allClasses()) {
while (iter.hasNext()) {
ReferenceType refType = (ReferenceType)iter.next();
if (refType.isPrepared() && refSpec.matches(refType)) { if (refType.isPrepared() && refSpec.matches(refType)) {
resolved = resolveEventRequest(refType); resolved = resolveEventRequest(refType);
} }

View File

@ -55,9 +55,7 @@ class EventRequestSpecList {
boolean resolve(ClassPrepareEvent event) { boolean resolve(ClassPrepareEvent event) {
boolean failure = false; boolean failure = false;
synchronized(eventRequestSpecs) { synchronized(eventRequestSpecs) {
Iterator iter = eventRequestSpecs.iterator(); for (EventRequestSpec spec : eventRequestSpecs) {
while (iter.hasNext()) {
EventRequestSpec spec = (EventRequestSpec)iter.next();
if (!spec.isResolved()) { if (!spec.isResolved()) {
try { try {
EventRequest eventRequest = spec.resolve(event); EventRequest eventRequest = spec.resolve(event);
@ -77,9 +75,7 @@ class EventRequestSpecList {
} }
void resolveAll() { void resolveAll() {
Iterator iter = eventRequestSpecs.iterator(); for (EventRequestSpec spec : eventRequestSpecs) {
while (iter.hasNext()) {
EventRequestSpec spec = (EventRequestSpec)iter.next();
try { try {
EventRequest eventRequest = spec.resolveEagerly(); EventRequest eventRequest = spec.resolveEagerly();
if (eventRequest != null) { if (eventRequest != null) {
@ -106,16 +102,16 @@ class EventRequestSpecList {
} }
} }
EventRequestSpec createBreakpoint(String classPattern, BreakpointSpec createBreakpoint(String classPattern, int line)
int line) throws ClassNotFoundException { throws ClassNotFoundException {
ReferenceTypeSpec refSpec = ReferenceTypeSpec refSpec =
new PatternReferenceTypeSpec(classPattern); new PatternReferenceTypeSpec(classPattern);
return new BreakpointSpec(refSpec, line); return new BreakpointSpec(refSpec, line);
} }
EventRequestSpec createBreakpoint(String classPattern, BreakpointSpec createBreakpoint(String classPattern,
String methodId, String methodId,
List methodArgs) List<String> methodArgs)
throws MalformedMemberNameException, throws MalformedMemberNameException,
ClassNotFoundException { ClassNotFoundException {
ReferenceTypeSpec refSpec = ReferenceTypeSpec refSpec =
@ -132,7 +128,7 @@ class EventRequestSpecList {
return new ExceptionSpec(refSpec, notifyCaught, notifyUncaught); return new ExceptionSpec(refSpec, notifyCaught, notifyUncaught);
} }
EventRequestSpec createAccessWatchpoint(String classPattern, WatchpointSpec createAccessWatchpoint(String classPattern,
String fieldId) String fieldId)
throws MalformedMemberNameException, throws MalformedMemberNameException,
ClassNotFoundException { ClassNotFoundException {
@ -141,7 +137,7 @@ class EventRequestSpecList {
return new AccessWatchpointSpec(refSpec, fieldId); return new AccessWatchpointSpec(refSpec, fieldId);
} }
EventRequestSpec createModificationWatchpoint(String classPattern, WatchpointSpec createModificationWatchpoint(String classPattern,
String fieldId) String fieldId)
throws MalformedMemberNameException, throws MalformedMemberNameException,
ClassNotFoundException { ClassNotFoundException {
@ -154,7 +150,7 @@ class EventRequestSpecList {
synchronized (eventRequestSpecs) { synchronized (eventRequestSpecs) {
int inx = eventRequestSpecs.indexOf(proto); int inx = eventRequestSpecs.indexOf(proto);
if (inx != -1) { if (inx != -1) {
EventRequestSpec spec = (EventRequestSpec)eventRequestSpecs.get(inx); EventRequestSpec spec = eventRequestSpecs.get(inx);
spec.remove(); spec.remove();
eventRequestSpecs.remove(inx); eventRequestSpecs.remove(inx);
return true; return true;

View File

@ -39,15 +39,13 @@ class SourceMapper {
private final String[] dirs; private final String[] dirs;
SourceMapper(List sourcepath) { SourceMapper(List<String> sourcepath) {
/* /*
* sourcepath can arrive from the debugee as a List. * sourcepath can arrive from the debugee as a List.
* (via PathSearchingVirtualMachine.classPath()) * (via PathSearchingVirtualMachine.classPath())
*/ */
List<String> dirList = new ArrayList<String>(); List<String> dirList = new ArrayList<String>();
Iterator iter = sourcepath.iterator(); for (String element : sourcepath) {
while (iter.hasNext()) {
String element = (String)iter.next();
//XXX remove .jar and .zip files; we want only directories on //XXX remove .jar and .zip files; we want only directories on
//the source path. (Bug ID 4186582) //the source path. (Bug ID 4186582)
if ( ! (element.endsWith(".jar") || if ( ! (element.endsWith(".jar") ||
@ -55,7 +53,7 @@ class SourceMapper {
dirList.add(element); dirList.add(element);
} }
} }
dirs = (String[])dirList.toArray(new String[0]); dirs = dirList.toArray(new String[0]);
} }
SourceMapper(String sourcepath) { SourceMapper(String sourcepath) {
@ -79,7 +77,7 @@ class SourceMapper {
dirList.add(s); dirList.add(s);
} }
} }
dirs = (String[])dirList.toArray(new String[0]); dirs = dirList.toArray(new String[0]);
} }
/* /*

View File

@ -160,9 +160,7 @@ public class TTY implements EventNotifier {
// here the next time. // here the next time.
Env.setAtExitMethod(null); Env.setAtExitMethod(null);
EventRequestManager erm = Env.vm().eventRequestManager(); EventRequestManager erm = Env.vm().eventRequestManager();
Iterator it = erm.methodExitRequests().iterator(); for (EventRequest eReq : erm.methodExitRequests()) {
while (it.hasNext()) {
EventRequest eReq = (EventRequest)it.next();
if (eReq.equals(me.request())) { if (eReq.equals(me.request())) {
eReq.disable(); eReq.disable();
} }
@ -178,9 +176,8 @@ public class TTY implements EventNotifier {
public void vmInterrupted() { public void vmInterrupted() {
Thread.yield(); // fetch output Thread.yield(); // fetch output
printCurrentLocation(); printCurrentLocation();
Iterator it = monitorCommands.iterator(); for (String cmd : monitorCommands) {
while (it.hasNext()) { StringTokenizer t = new StringTokenizer(cmd);
StringTokenizer t = new StringTokenizer((String)it.next());
t.nextToken(); // get rid of monitor number t.nextToken(); // get rid of monitor number
executeCommand(t); executeCommand(t);
} }
@ -563,9 +560,8 @@ public class TTY implements EventNotifier {
++monitorCount; ++monitorCount;
monitorCommands.add(monitorCount + ": " + t.nextToken("")); monitorCommands.add(monitorCount + ": " + t.nextToken(""));
} else { } else {
Iterator it = monitorCommands.iterator(); for (String cmd : monitorCommands) {
while (it.hasNext()) { MessageOutput.printDirectln(cmd);// Special case: use printDirectln()
MessageOutput.printDirectln((String)it.next());// Special case: use printDirectln()
} }
} }
} }
@ -581,9 +577,7 @@ public class TTY implements EventNotifier {
return; return;
} }
String monStr = monTok + ":"; String monStr = monTok + ":";
Iterator it = monitorCommands.iterator(); for (String cmd : monitorCommands) {
while (it.hasNext()) {
String cmd = (String)it.next();
StringTokenizer ct = new StringTokenizer(cmd); StringTokenizer ct = new StringTokenizer(cmd);
if (ct.nextToken().equals(monStr)) { if (ct.nextToken().equals(monStr)) {
monitorCommands.remove(cmd); monitorCommands.remove(cmd);
@ -768,10 +762,8 @@ public class TTY implements EventNotifier {
} }
private static boolean supportsSharedMemory() { private static boolean supportsSharedMemory() {
List connectors = Bootstrap.virtualMachineManager().allConnectors(); for (Connector connector :
Iterator iter = connectors.iterator(); Bootstrap.virtualMachineManager().allConnectors()) {
while (iter.hasNext()) {
Connector connector = (Connector)iter.next();
if (connector.transport() == null) { if (connector.transport() == null) {
continue; continue;
} }

View File

@ -36,7 +36,7 @@ import java.util.Iterator;
* Descend the tree of thread groups. * Descend the tree of thread groups.
* @author Robert G. Field * @author Robert G. Field
*/ */
class ThreadGroupIterator implements Iterator { class ThreadGroupIterator implements Iterator<ThreadGroupReference> {
private final Stack<Iterator<ThreadGroupReference>> stack = new Stack<Iterator<ThreadGroupReference>>(); private final Stack<Iterator<ThreadGroupReference>> stack = new Stack<Iterator<ThreadGroupReference>>();
ThreadGroupIterator(List<ThreadGroupReference> tgl) { ThreadGroupIterator(List<ThreadGroupReference> tgl) {
@ -53,8 +53,8 @@ class ThreadGroupIterator implements Iterator {
this(Env.vm().topLevelThreadGroups()); this(Env.vm().topLevelThreadGroups());
} }
private Iterator top() { private Iterator<ThreadGroupReference> top() {
return (Iterator)stack.peek(); return stack.peek();
} }
/** /**
@ -74,12 +74,12 @@ class ThreadGroupIterator implements Iterator {
return !stack.isEmpty(); return !stack.isEmpty();
} }
public Object next() { public ThreadGroupReference next() {
return nextThreadGroup(); return nextThreadGroup();
} }
public ThreadGroupReference nextThreadGroup() { public ThreadGroupReference nextThreadGroup() {
ThreadGroupReference tg = (ThreadGroupReference)top().next(); ThreadGroupReference tg = top().next();
push(tg.threadGroups()); push(tg.threadGroups());
return tg; return tg;
} }

View File

@ -56,9 +56,7 @@ class ThreadInfo {
private static void initThreads() { private static void initThreads() {
if (!gotInitialThreads) { if (!gotInitialThreads) {
Iterator iter = Env.vm().allThreads().iterator(); for (ThreadReference thread : Env.vm().allThreads()) {
while (iter.hasNext()) {
ThreadReference thread = (ThreadReference)iter.next();
threads.add(new ThreadInfo(thread)); threads.add(new ThreadInfo(thread));
} }
gotInitialThreads = true; gotInitialThreads = true;
@ -113,9 +111,7 @@ class ThreadInfo {
current = null; current = null;
group = null; group = null;
synchronized (threads) { synchronized (threads) {
Iterator iter = threads().iterator(); for (ThreadInfo ti : threads()) {
while (iter.hasNext()) {
ThreadInfo ti = (ThreadInfo)iter.next();
ti.invalidate(); ti.invalidate();
} }
} }
@ -163,8 +159,7 @@ class ThreadInfo {
if (group == null) { if (group == null) {
// Current thread group defaults to the first top level // Current thread group defaults to the first top level
// thread group. // thread group.
setThreadGroup((ThreadGroupReference) setThreadGroup(Env.vm().topLevelThreadGroups().get(0));
Env.vm().topLevelThreadGroups().get(0));
} }
return group; return group;
} }
@ -173,9 +168,7 @@ class ThreadInfo {
ThreadInfo retInfo = null; ThreadInfo retInfo = null;
synchronized (threads) { synchronized (threads) {
Iterator iter = threads().iterator(); for (ThreadInfo ti : threads()) {
while (iter.hasNext()) {
ThreadInfo ti = (ThreadInfo)iter.next();
if (ti.thread.uniqueID() == id) { if (ti.thread.uniqueID() == id) {
retInfo = ti; retInfo = ti;
break; break;
@ -208,7 +201,7 @@ class ThreadInfo {
* *
* @return a <code>List</code> of the stack frames. * @return a <code>List</code> of the stack frames.
*/ */
List getStack() throws IncompatibleThreadStateException { List<StackFrame> getStack() throws IncompatibleThreadStateException {
return thread.frames(); return thread.frames();
} }

View File

@ -30,8 +30,8 @@ import com.sun.jdi.ThreadReference;
import java.util.List; import java.util.List;
import java.util.Iterator; import java.util.Iterator;
class ThreadIterator implements Iterator { class ThreadIterator implements Iterator<ThreadReference> {
Iterator it = null; Iterator<ThreadReference> it = null;
ThreadGroupIterator tgi; ThreadGroupIterator tgi;
ThreadIterator(ThreadGroupReference tg) { ThreadIterator(ThreadGroupReference tg) {
@ -56,12 +56,12 @@ class ThreadIterator implements Iterator {
return true; return true;
} }
public Object next() { public ThreadReference next() {
return it.next(); return it.next();
} }
public ThreadReference nextThread() { public ThreadReference nextThread() {
return (ThreadReference)next(); return next();
} }
public void remove() { public void remove() {

View File

@ -61,10 +61,8 @@ class VMConnection {
} }
private Connector findConnector(String name) { private Connector findConnector(String name) {
List connectors = Bootstrap.virtualMachineManager().allConnectors(); for (Connector connector :
Iterator iter = connectors.iterator(); Bootstrap.virtualMachineManager().allConnectors()) {
while (iter.hasNext()) {
Connector connector = (Connector)iter.next();
if (connector.name().equals(name)) { if (connector.name().equals(name)) {
return connector; return connector;
} }
@ -108,7 +106,7 @@ class VMConnection {
String value = token.substring(index + 1, String value = token.substring(index + 1,
token.length() - 1); // Remove comma delimiter token.length() - 1); // Remove comma delimiter
Connector.Argument argument = (Connector.Argument)arguments.get(name); Connector.Argument argument = arguments.get(name);
if (argument == null) { if (argument == null) {
throw new IllegalArgumentException throw new IllegalArgumentException
(MessageOutput.format("Argument is not defined for connector:", (MessageOutput.format("Argument is not defined for connector:",
@ -195,7 +193,7 @@ class VMConnection {
return false; return false;
} }
Connector.Argument argument = (Connector.Argument)connectorArgs.get(name); Connector.Argument argument = connectorArgs.get(name);
if (argument == null) { if (argument == null) {
return false; return false;
} }
@ -204,7 +202,7 @@ class VMConnection {
} }
String connectorArg(String name) { String connectorArg(String name) {
Connector.Argument argument = (Connector.Argument)connectorArgs.get(name); Connector.Argument argument = connectorArgs.get(name);
if (argument == null) { if (argument == null) {
return ""; return "";
} }

View File

@ -99,8 +99,7 @@ class ClassQuery extends QueryHandler {
} }
out.println("<h2>Instance Data Members:</h2>"); out.println("<h2>Instance Data Members:</h2>");
JavaField[] ff = clazz.getFields(); JavaField[] ff = clazz.getFields().clone();
ff = (JavaField[]) ff.clone();
ArraySorter.sort(ff, new Comparer() { ArraySorter.sort(ff, new Comparer() {
public int compare(Object lhs, Object rhs) { public int compare(Object lhs, Object rhs) {
JavaField left = (JavaField) lhs; JavaField left = (JavaField) lhs;

View File

@ -90,9 +90,7 @@ public class PlatformClasses {
// is the right thing to do anyway. // is the right thing to do anyway.
} }
} }
int num = list.size(); names = list.toArray(new String[list.size()]);
names = new String[num];
names = (String[]) list.toArray(names);
} }
return names; return names;
} }

View File

@ -119,7 +119,7 @@ abstract class AbstractLauncher extends ConnectorImpl implements LaunchingConnec
String[] tokenArray = new String[tokenList.size()]; String[] tokenArray = new String[tokenList.size()];
for (int i = 0; i < tokenList.size(); i++) { for (int i = 0; i < tokenList.size(); i++) {
tokenArray[i] = (String)tokenList.get(i); tokenArray[i] = tokenList.get(i);
} }
return tokenArray; return tokenArray;
} }

View File

@ -95,11 +95,8 @@ public class ClassTypeImpl extends ReferenceTypeImpl
} }
public List<ClassType> subclasses() { public List<ClassType> subclasses() {
List<ReferenceType> all = vm.allClasses();
List<ClassType> subs = new ArrayList<ClassType>(); List<ClassType> subs = new ArrayList<ClassType>();
Iterator iter = all.iterator(); for (ReferenceType refType : vm.allClasses()) {
while (iter.hasNext()) {
ReferenceType refType = (ReferenceType)iter.next();
if (refType instanceof ClassType) { if (refType instanceof ClassType) {
ClassType clazz = (ClassType)refType; ClassType clazz = (ClassType)refType;
ClassType superclass = clazz.superclass(); ClassType superclass = clazz.superclass();
@ -223,7 +220,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments); List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments);
ValueImpl[] args = (ValueImpl[])arguments.toArray(new ValueImpl[0]); ValueImpl[] args = arguments.toArray(new ValueImpl[0]);
JDWP.ClassType.InvokeMethod ret; JDWP.ClassType.InvokeMethod ret;
try { try {
PacketStream stream = PacketStream stream =
@ -271,7 +268,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
List<Value> arguments = method.validateAndPrepareArgumentsForInvoke( List<Value> arguments = method.validateAndPrepareArgumentsForInvoke(
origArguments); origArguments);
ValueImpl[] args = (ValueImpl[])arguments.toArray(new ValueImpl[0]); ValueImpl[] args = arguments.toArray(new ValueImpl[0]);
JDWP.ClassType.NewInstance ret = null; JDWP.ClassType.NewInstance ret = null;
try { try {
PacketStream stream = PacketStream stream =
@ -301,11 +298,8 @@ public class ClassTypeImpl extends ReferenceTypeImpl
} }
public Method concreteMethodByName(String name, String signature) { public Method concreteMethodByName(String name, String signature) {
List methods = visibleMethods();
Method method = null; Method method = null;
Iterator iter = methods.iterator(); for (Method candidate : visibleMethods()) {
while (iter.hasNext()) {
Method candidate = (Method)iter.next();
if (candidate.name().equals(name) && if (candidate.name().equals(name) &&
candidate.signature().equals(signature) && candidate.signature().equals(signature) &&
!candidate.isAbstract()) { !candidate.isAbstract()) {
@ -330,9 +324,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
* Avoid duplicate checking on each method by iterating through * Avoid duplicate checking on each method by iterating through
* duplicate-free allInterfaces() rather than recursing * duplicate-free allInterfaces() rather than recursing
*/ */
Iterator iter = allInterfaces().iterator(); for (InterfaceType interfaze : allInterfaces()) {
while (iter.hasNext()) {
InterfaceType interfaze = (InterfaceType)iter.next();
list.addAll(interfaze.methods()); list.addAll(interfaze.methods());
} }

View File

@ -247,7 +247,7 @@ public class ConcreteMethodImpl extends MethodImpl {
public byte[] bytecodes() { public byte[] bytecodes() {
byte[] bytecodes = (bytecodesRef == null) ? null : byte[] bytecodes = (bytecodesRef == null) ? null :
(byte[])bytecodesRef.get(); bytecodesRef.get();
if (bytecodes == null) { if (bytecodes == null) {
try { try {
bytecodes = JDWP.Method.Bytecodes. bytecodes = JDWP.Method.Bytecodes.
@ -262,7 +262,7 @@ public class ConcreteMethodImpl extends MethodImpl {
* to return the cached bytecodes directly; instead, we * to return the cached bytecodes directly; instead, we
* make a clone at the cost of using more memory. * make a clone at the cost of using more memory.
*/ */
return (byte[])bytecodes.clone(); return bytecodes.clone();
} }
int argSlotCount() throws AbsentInformationException { int argSlotCount() throws AbsentInformationException {
@ -279,7 +279,7 @@ public class ConcreteMethodImpl extends MethodImpl {
String stratumID = stratum.id(); String stratumID = stratum.id();
SoftLocationXRefs info = SoftLocationXRefs info =
(softOtherLocationXRefsRef == null) ? null : (softOtherLocationXRefsRef == null) ? null :
(SoftLocationXRefs)softOtherLocationXRefsRef.get(); softOtherLocationXRefsRef.get();
if (info != null && info.stratumID.equals(stratumID)) { if (info != null && info.stratumID.equals(stratumID)) {
return info; return info;
} }
@ -348,7 +348,7 @@ public class ConcreteMethodImpl extends MethodImpl {
private SoftLocationXRefs getBaseLocations() { private SoftLocationXRefs getBaseLocations() {
SoftLocationXRefs info = (softBaseLocationXRefsRef == null) ? null : SoftLocationXRefs info = (softBaseLocationXRefsRef == null) ? null :
(SoftLocationXRefs)softBaseLocationXRefsRef.get(); softBaseLocationXRefsRef.get();
if (info != null) { if (info != null) {
return info; return info;
} }

View File

@ -56,10 +56,8 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet {
public String toString() { public String toString() {
String string = "event set, policy:" + suspendPolicy + String string = "event set, policy:" + suspendPolicy +
", count:" + this.size() + " = {"; ", count:" + this.size() + " = {";
Iterator iter = this.iterator();
boolean first = true; boolean first = true;
while (iter.hasNext()) { for (Event event : this) {
Event event = (Event)iter.next();
if (!first) { if (!first) {
string += ", "; string += ", ";
} }
@ -787,9 +785,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet {
} }
private ThreadReference eventThread() { private ThreadReference eventThread() {
Iterator iter = this.iterator(); for (Event event : this) {
while (iter.hasNext()) {
Event event = (Event)iter.next();
if (event instanceof ThreadedEventImpl) { if (event instanceof ThreadedEventImpl) {
return ((ThreadedEventImpl)event).thread(); return ((ThreadedEventImpl)event).thread();
} }
@ -846,7 +842,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet {
} }
public Event nextEvent() { public Event nextEvent() {
return (Event)next(); return next();
} }
public void remove() { public void remove() {

View File

@ -82,7 +82,7 @@ public class JNITypeParser {
} }
String typeName() { String typeName() {
return (String)typeNameList().get(typeNameList().size()-1); return typeNameList().get(typeNameList().size()-1);
} }
List<String> argumentTypeNames() { List<String> argumentTypeNames() {
@ -90,7 +90,7 @@ public class JNITypeParser {
} }
String signature() { String signature() {
return (String)signatureList().get(signatureList().size()-1); return signatureList().get(signatureList().size()-1);
} }
List<String> argumentSignatures() { List<String> argumentSignatures() {

View File

@ -158,7 +158,7 @@ public abstract class MethodImpl extends TypeComponentImpl
Type argumentType(int index) throws ClassNotLoadedException { Type argumentType(int index) throws ClassNotLoadedException {
ReferenceTypeImpl enclosing = (ReferenceTypeImpl)declaringType(); ReferenceTypeImpl enclosing = (ReferenceTypeImpl)declaringType();
String signature = (String)argumentSignatures().get(index); String signature = argumentSignatures().get(index);
return enclosing.findType(signature); return enclosing.findType(signature);
} }
@ -263,10 +263,10 @@ public abstract class MethodImpl extends TypeComponentImpl
return argumentType(index); return argumentType(index);
} }
public String typeName(){ public String typeName(){
return (String)argumentTypeNames().get(index); return argumentTypeNames().get(index);
} }
public String signature() { public String signature() {
return (String)argumentSignatures().get(index); return argumentSignatures().get(index);
} }
public Type findType(String signature) throws ClassNotLoadedException { public Type findType(String signature) throws ClassNotLoadedException {
return MethodImpl.this.findType(signature); return MethodImpl.this.findType(signature);
@ -307,7 +307,7 @@ public abstract class MethodImpl extends TypeComponentImpl
arguments.add(argArray); arguments.add(argArray);
return; return;
} }
Value nthArgValue = (Value)arguments.get(paramCount - 1); Value nthArgValue = arguments.get(paramCount - 1);
if (nthArgValue == null) { if (nthArgValue == null) {
return; return;
} }
@ -371,7 +371,7 @@ public abstract class MethodImpl extends TypeComponentImpl
} }
for (int i = 0; i < argSize; i++) { for (int i = 0; i < argSize; i++) {
Value value = (Value)arguments.get(i); Value value = arguments.get(i);
value = ValueImpl.prepareForAssignment(value, value = ValueImpl.prepareForAssignment(value,
new ArgumentContainer(i)); new ArgumentContainer(i));
arguments.set(i, value); arguments.set(i, value);
@ -386,11 +386,11 @@ public abstract class MethodImpl extends TypeComponentImpl
sb.append(name()); sb.append(name());
sb.append("("); sb.append("(");
boolean first = true; boolean first = true;
for (Iterator it = argumentTypeNames().iterator(); it.hasNext();) { for (String name : argumentTypeNames()) {
if (!first) { if (!first) {
sb.append(", "); sb.append(", ");
} }
sb.append((String)it.next()); sb.append(name);
first = false; first = false;
} }
sb.append(")"); sb.append(")");

View File

@ -383,7 +383,7 @@ public class ObjectReferenceImpl extends ValueImpl
List<Value> arguments = method.validateAndPrepareArgumentsForInvoke( List<Value> arguments = method.validateAndPrepareArgumentsForInvoke(
origArguments); origArguments);
ValueImpl[] args = (ValueImpl[])arguments.toArray(new ValueImpl[0]); ValueImpl[] args = arguments.toArray(new ValueImpl[0]);
JDWP.ObjectReference.InvokeMethod ret; JDWP.ObjectReference.InvokeMethod ret;
try { try {
PacketStream stream = PacketStream stream =
@ -583,7 +583,7 @@ public class ObjectReferenceImpl extends ValueImpl
// Validate assignment // Validate assignment
ReferenceType destType = (ReferenceTypeImpl)destination.type(); ReferenceType destType = (ReferenceTypeImpl)destination.type();
ReferenceTypeImpl myType = (ReferenceTypeImpl)referenceType(); ReferenceTypeImpl myType = (ReferenceTypeImpl)referenceType();
if (!myType.isAssignableTo((ReferenceType)destType)) { if (!myType.isAssignableTo(destType)) {
JNITypeParser parser = new JNITypeParser(destType.signature()); JNITypeParser parser = new JNITypeParser(destType.signature());
String destTypeName = parser.typeName(); String destTypeName = parser.typeName();
throw new InvalidTypeException("Can't assign " + throw new InvalidTypeException("Can't assign " +

View File

@ -485,7 +485,7 @@ class PacketStream {
* Read field represented as vm specific byte sequence. * Read field represented as vm specific byte sequence.
*/ */
Field readField() { Field readField() {
ReferenceTypeImpl refType = (ReferenceTypeImpl)readReferenceType(); ReferenceTypeImpl refType = readReferenceType();
long fieldRef = readFieldRef(); long fieldRef = readFieldRef();
return refType.getFieldMirror(fieldRef); return refType.getFieldMirror(fieldRef);
} }

View File

@ -59,7 +59,7 @@ implements ReferenceType {
private boolean constantPoolInfoGotten = false; private boolean constantPoolInfoGotten = false;
private int constanPoolCount; private int constanPoolCount;
private byte[] constantPoolBytes; private byte[] constantPoolBytes;
private SoftReference constantPoolBytesRef = null; private SoftReference<byte[]> constantPoolBytesRef = null;
/* to mark a SourceFile request that returned a genuine JDWP.Error.ABSENT_INFORMATION */ /* to mark a SourceFile request that returned a genuine JDWP.Error.ABSENT_INFORMATION */
private static final String ABSENT_BASE_SOURCE_NAME = "**ABSENT_BASE_SOURCE_NAME**"; private static final String ABSENT_BASE_SOURCE_NAME = "**ABSENT_BASE_SOURCE_NAME**";
@ -352,13 +352,10 @@ implements ReferenceType {
abstract List<? extends ReferenceType> inheritedTypes(); abstract List<? extends ReferenceType> inheritedTypes();
void addVisibleFields(List<Field> visibleList, Map<String, Field> visibleTable, List<String> ambiguousNames) { void addVisibleFields(List<Field> visibleList, Map<String, Field> visibleTable, List<String> ambiguousNames) {
List<Field> list = visibleFields(); for (Field field : visibleFields()) {
Iterator iter = list.iterator();
while (iter.hasNext()) {
Field field = (Field)iter.next();
String name = field.name(); String name = field.name();
if (!ambiguousNames.contains(name)) { if (!ambiguousNames.contains(name)) {
Field duplicate = (Field)visibleTable.get(name); Field duplicate = visibleTable.get(name);
if (duplicate == null) { if (duplicate == null) {
visibleList.add(field); visibleList.add(field);
visibleTable.put(name, field); visibleTable.put(name, field);
@ -402,10 +399,8 @@ implements ReferenceType {
* hide. * hide.
*/ */
List<Field> retList = new ArrayList<Field>(fields()); List<Field> retList = new ArrayList<Field>(fields());
iter = retList.iterator(); for (Field field : retList) {
while (iter.hasNext()) { Field hidden = visibleTable.get(field.name());
Field field = (Field)iter.next();
Field hidden = (Field)visibleTable.get(field.name());
if (hidden != null) { if (hidden != null) {
visibleList.remove(hidden); visibleList.remove(hidden);
} }
@ -515,12 +510,9 @@ implements ReferenceType {
* methods. * methods.
*/ */
void addToMethodMap(Map<String, Method> methodMap, List<Method> methodList) { void addToMethodMap(Map<String, Method> methodMap, List<Method> methodList) {
Iterator iter = methodList.iterator(); for (Method method : methodList)
while (iter.hasNext()) {
Method method = (Method)iter.next();
methodMap.put(method.name().concat(method.signature()), method); methodMap.put(method.name().concat(method.signature()), method);
} }
}
abstract void addVisibleMethods(Map<String, Method> methodMap); abstract void addVisibleMethods(Map<String, Method> methodMap);
@ -549,9 +541,7 @@ implements ReferenceType {
public List<Method> methodsByName(String name) { public List<Method> methodsByName(String name) {
List<Method> methods = visibleMethods(); List<Method> methods = visibleMethods();
ArrayList<Method> retList = new ArrayList<Method>(methods.size()); ArrayList<Method> retList = new ArrayList<Method>(methods.size());
Iterator iter = methods.iterator(); for (Method candidate : methods) {
while (iter.hasNext()) {
Method candidate = (Method)iter.next();
if (candidate.name().equals(name)) { if (candidate.name().equals(name)) {
retList.add(candidate); retList.add(candidate);
} }
@ -563,9 +553,7 @@ implements ReferenceType {
public List<Method> methodsByName(String name, String signature) { public List<Method> methodsByName(String name, String signature) {
List<Method> methods = visibleMethods(); List<Method> methods = visibleMethods();
ArrayList<Method> retList = new ArrayList<Method>(methods.size()); ArrayList<Method> retList = new ArrayList<Method>(methods.size());
Iterator iter = methods.iterator(); for (Method candidate : methods) {
while (iter.hasNext()) {
Method candidate = (Method)iter.next();
if (candidate.name().equals(name) && if (candidate.name().equals(name) &&
candidate.signature().equals(signature)) { candidate.signature().equals(signature)) {
retList.add(candidate); retList.add(candidate);
@ -706,7 +694,7 @@ implements ReferenceType {
} }
public String sourceName() throws AbsentInformationException { public String sourceName() throws AbsentInformationException {
return (String)(sourceNames(vm.getDefaultStratum()).get(0)); return sourceNames(vm.getDefaultStratum()).get(0);
} }
public List<String> sourceNames(String stratumID) public List<String> sourceNames(String stratumID)
@ -796,7 +784,7 @@ implements ReferenceType {
if (!vm.canGetSourceDebugExtension()) { if (!vm.canGetSourceDebugExtension()) {
return NO_SDE_INFO_MARK; return NO_SDE_INFO_MARK;
} }
SDE sde = (sdeRef == null) ? null : (SDE)sdeRef.get(); SDE sde = (sdeRef == null) ? null : sdeRef.get();
if (sde == null) { if (sde == null) {
String extension = null; String extension = null;
try { try {
@ -1034,13 +1022,13 @@ implements ReferenceType {
throw exc; throw exc;
} }
if (constantPoolBytesRef != null) { if (constantPoolBytesRef != null) {
byte[] cpbytes = (byte[])constantPoolBytesRef.get(); byte[] cpbytes = constantPoolBytesRef.get();
/* /*
* Arrays are always modifiable, so it is a little unsafe * Arrays are always modifiable, so it is a little unsafe
* to return the cached bytecodes directly; instead, we * to return the cached bytecodes directly; instead, we
* make a clone at the cost of using more memory. * make a clone at the cost of using more memory.
*/ */
return (byte[])cpbytes.clone(); return cpbytes.clone();
} else { } else {
return null; return null;
} }

View File

@ -327,7 +327,7 @@ class SDE {
ignoreWhite(); ignoreWhite();
while (((ch = sdeRead()) != '\n') && (ch != '\r')) { while (((ch = sdeRead()) != '\n') && (ch != '\r')) {
sb.append((char)ch); sb.append(ch);
} }
// check for CR LF // check for CR LF
if ((ch == '\r') && (sdePeek() == '\n')) { if ((ch == '\r') && (sdePeek() == '\n')) {

View File

@ -162,7 +162,7 @@ public class StackFrameImpl extends MirrorImpl
for (LocalVariable variable : allVariables) { for (LocalVariable variable : allVariables) {
String name = variable.name(); String name = variable.name();
if (variable.isVisible(this)) { if (variable.isVisible(this)) {
LocalVariable existing = (LocalVariable)map.get(name); LocalVariable existing = map.get(name);
if ((existing == null) || if ((existing == null) ||
((LocalVariableImpl)variable).hides(existing)) { ((LocalVariableImpl)variable).hides(existing)) {
map.put(name, variable); map.put(name, variable);
@ -330,7 +330,7 @@ public class StackFrameImpl extends MirrorImpl
slot = 1; slot = 1;
} }
for (int ii = 0; ii < count; ++ii) { for (int ii = 0; ii < count; ++ii) {
char sigChar = (char)argSigs.get(ii).charAt(0); char sigChar = argSigs.get(ii).charAt(0);
slots[ii] = new JDWP.StackFrame.GetValues.SlotInfo(slot++,(byte)sigChar); slots[ii] = new JDWP.StackFrame.GetValues.SlotInfo(slot++,(byte)sigChar);
if (sigChar == 'J' || sigChar == 'D') { if (sigChar == 'J' || sigChar == 'D') {
slot++; slot++;

View File

@ -148,7 +148,7 @@ public class TargetVM implements Runnable {
idString = String.valueOf(p.id); idString = String.valueOf(p.id);
synchronized(waitingQueue) { synchronized(waitingQueue) {
p2 = (Packet)waitingQueue.get(idString); p2 = waitingQueue.get(idString);
if (p2 != null) if (p2 != null)
waitingQueue.remove(idString); waitingQueue.remove(idString);

View File

@ -86,30 +86,22 @@ public class ThreadGroupReferenceImpl extends ObjectReferenceImpl
} }
public void suspend() { public void suspend() {
List threads = threads(); for (ThreadReference thread : threads()) {
Iterator iter = threads.iterator(); thread.suspend();
while (iter.hasNext()) {
((ThreadReference)iter.next()).suspend();
} }
List groups = threadGroups(); for (ThreadGroupReference threadGroup : threadGroups()) {
iter = groups.iterator(); threadGroup.suspend();
while (iter.hasNext()) {
((ThreadGroupReference)iter.next()).suspend();
} }
} }
public void resume() { public void resume() {
List threads = threads(); for (ThreadReference thread : threads()) {
Iterator iter = threads.iterator(); thread.resume();
while (iter.hasNext()) {
((ThreadReference)iter.next()).resume();
} }
List groups = threadGroups(); for (ThreadGroupReference threadGroup : threadGroups()) {
iter = groups.iterator(); threadGroup.resume();
while (iter.hasNext()) {
((ThreadGroupReference)iter.next()).resume();
} }
} }

View File

@ -1191,8 +1191,7 @@ class VirtualMachineImpl extends MirrorImpl
} }
requests = new JDWP.VirtualMachine.DisposeObjects.Request[size]; requests = new JDWP.VirtualMachine.DisposeObjects.Request[size];
for (int i = 0; i < requests.length; i++) { for (int i = 0; i < requests.length; i++) {
SoftObjectReference ref = SoftObjectReference ref = batchedDisposeRequests.get(i);
(SoftObjectReference)batchedDisposeRequests.get(i);
if ((traceFlags & TRACE_OBJREFS) != 0) { if ((traceFlags & TRACE_OBJREFS) != 0) {
printTrace("Disposing object " + ref.key().longValue() + printTrace("Disposing object " + ref.key().longValue() +
" (ref count = " + ref.count() + ")"); " (ref count = " + ref.count() + ")");
@ -1436,7 +1435,7 @@ class VirtualMachineImpl extends MirrorImpl
} }
ObjectReferenceImpl object() { ObjectReferenceImpl object() {
return (ObjectReferenceImpl)get(); return get();
} }
} }
} }

View File

@ -92,7 +92,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManagerService {
Connector connector; Connector connector;
try { try {
connector = (Connector)connectors.next(); connector = connectors.next();
} catch (ThreadDeath x) { } catch (ThreadDeath x) {
throw x; throw x;
} catch (Exception x) { } catch (Exception x) {
@ -121,7 +121,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManagerService {
TransportService transportService; TransportService transportService;
try { try {
transportService = (TransportService)transportServices.next(); transportService = transportServices.next();
} catch (ThreadDeath x) { } catch (ThreadDeath x) {
throw x; throw x;
} catch (Exception x) { } catch (Exception x) {

View File

@ -634,6 +634,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
*/ */
private PropertyChangeSupport changeSupport; private PropertyChangeSupport changeSupport;
private transient final Object changeSupportLock = new Object();
private Object getChangeSupportLock() {
return changeSupportLock;
}
boolean isPacked = false; boolean isPacked = false;
/** /**
@ -935,24 +940,26 @@ public abstract class Component implements ImageObserver, MenuContainer,
*/ */
public GraphicsConfiguration getGraphicsConfiguration() { public GraphicsConfiguration getGraphicsConfiguration() {
synchronized(getTreeLock()) { synchronized(getTreeLock()) {
GraphicsConfiguration gc = graphicsConfig; if (graphicsConfig != null) {
Component parent = getParent(); return graphicsConfig;
while ((gc == null) && (parent != null)) { } else if (getParent() != null) {
gc = parent.getGraphicsConfiguration(); return getParent().getGraphicsConfiguration();
parent = parent.getParent(); } else {
return null;
} }
return gc;
} }
} }
final GraphicsConfiguration getGraphicsConfiguration_NoClientCode() { final GraphicsConfiguration getGraphicsConfiguration_NoClientCode() {
GraphicsConfiguration gc = this.graphicsConfig; GraphicsConfiguration graphicsConfig = this.graphicsConfig;
Component par = this.parent; Container parent = this.parent;
while ((gc == null) && (par != null)) { if (graphicsConfig != null) {
gc = par.getGraphicsConfiguration_NoClientCode(); return graphicsConfig;
par = par.parent; } else if (parent != null) {
return parent.getGraphicsConfiguration_NoClientCode();
} else {
return null;
} }
return gc;
} }
/** /**
@ -4602,7 +4609,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
e.isPopupTrigger(), e.isPopupTrigger(),
e.getScrollType(), e.getScrollType(),
e.getScrollAmount(), e.getScrollAmount(),
e.getWheelRotation()); e.getWheelRotation(),
e.getPreciseWheelRotation());
((AWTEvent)e).copyPrivateDataInto(newMWE); ((AWTEvent)e).copyPrivateDataInto(newMWE);
// When dispatching a wheel event to // When dispatching a wheel event to
// ancestor, there is no need trying to find descendant // ancestor, there is no need trying to find descendant
@ -6484,7 +6492,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
// will need some help. // will need some help.
Container parent = this.parent; Container parent = this.parent;
if (parent != null && parent.peer instanceof LightweightPeer) { if (parent != null && parent.peer instanceof LightweightPeer) {
nativeInLightFixer = new NativeInLightFixer(); relocateComponent();
} }
} }
invalidate(); invalidate();
@ -6595,10 +6603,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
} }
} }
if (nativeInLightFixer != null) {
nativeInLightFixer.uninstall();
}
ComponentPeer p = peer; ComponentPeer p = peer;
if (p != null) { if (p != null) {
boolean isLightweight = isLightweight(); boolean isLightweight = isLightweight();
@ -7836,8 +7840,9 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see #getPropertyChangeListeners * @see #getPropertyChangeListeners
* @see #addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener) * @see #addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
*/ */
public synchronized void addPropertyChangeListener( public void addPropertyChangeListener(
PropertyChangeListener listener) { PropertyChangeListener listener) {
synchronized (getChangeSupportLock()) {
if (listener == null) { if (listener == null) {
return; return;
} }
@ -7846,6 +7851,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
} }
changeSupport.addPropertyChangeListener(listener); changeSupport.addPropertyChangeListener(listener);
} }
}
/** /**
* Removes a PropertyChangeListener from the listener list. This method * Removes a PropertyChangeListener from the listener list. This method
@ -7860,13 +7866,15 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see #getPropertyChangeListeners * @see #getPropertyChangeListeners
* @see #removePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener) * @see #removePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener)
*/ */
public synchronized void removePropertyChangeListener( public void removePropertyChangeListener(
PropertyChangeListener listener) { PropertyChangeListener listener) {
synchronized (getChangeSupportLock()) {
if (listener == null || changeSupport == null) { if (listener == null || changeSupport == null) {
return; return;
} }
changeSupport.removePropertyChangeListener(listener); changeSupport.removePropertyChangeListener(listener);
} }
}
/** /**
* Returns an array of all the property change listeners * Returns an array of all the property change listeners
@ -7882,12 +7890,14 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see java.beans.PropertyChangeSupport#getPropertyChangeListeners * @see java.beans.PropertyChangeSupport#getPropertyChangeListeners
* @since 1.4 * @since 1.4
*/ */
public synchronized PropertyChangeListener[] getPropertyChangeListeners() { public PropertyChangeListener[] getPropertyChangeListeners() {
synchronized (getChangeSupportLock()) {
if (changeSupport == null) { if (changeSupport == null) {
return new PropertyChangeListener[0]; return new PropertyChangeListener[0];
} }
return changeSupport.getPropertyChangeListeners(); return changeSupport.getPropertyChangeListeners();
} }
}
/** /**
* Adds a PropertyChangeListener to the listener list for a specific * Adds a PropertyChangeListener to the listener list for a specific
@ -7920,9 +7930,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see #getPropertyChangeListeners(java.lang.String) * @see #getPropertyChangeListeners(java.lang.String)
* @see #addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener) * @see #addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
*/ */
public synchronized void addPropertyChangeListener( public void addPropertyChangeListener(
String propertyName, String propertyName,
PropertyChangeListener listener) { PropertyChangeListener listener) {
synchronized (getChangeSupportLock()) {
if (listener == null) { if (listener == null) {
return; return;
} }
@ -7931,6 +7942,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
} }
changeSupport.addPropertyChangeListener(propertyName, listener); changeSupport.addPropertyChangeListener(propertyName, listener);
} }
}
/** /**
* Removes a <code>PropertyChangeListener</code> from the listener * Removes a <code>PropertyChangeListener</code> from the listener
@ -7948,14 +7960,16 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see #getPropertyChangeListeners(java.lang.String) * @see #getPropertyChangeListeners(java.lang.String)
* @see #removePropertyChangeListener(java.beans.PropertyChangeListener) * @see #removePropertyChangeListener(java.beans.PropertyChangeListener)
*/ */
public synchronized void removePropertyChangeListener( public void removePropertyChangeListener(
String propertyName, String propertyName,
PropertyChangeListener listener) { PropertyChangeListener listener) {
synchronized (getChangeSupportLock()) {
if (listener == null || changeSupport == null) { if (listener == null || changeSupport == null) {
return; return;
} }
changeSupport.removePropertyChangeListener(propertyName, listener); changeSupport.removePropertyChangeListener(propertyName, listener);
} }
}
/** /**
* Returns an array of all the listeners which have been associated * Returns an array of all the listeners which have been associated
@ -7971,13 +7985,15 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see #getPropertyChangeListeners * @see #getPropertyChangeListeners
* @since 1.4 * @since 1.4
*/ */
public synchronized PropertyChangeListener[] getPropertyChangeListeners( public PropertyChangeListener[] getPropertyChangeListeners(
String propertyName) { String propertyName) {
synchronized (getChangeSupportLock()) {
if (changeSupport == null) { if (changeSupport == null) {
return new PropertyChangeListener[0]; return new PropertyChangeListener[0];
} }
return changeSupport.getPropertyChangeListeners(propertyName); return changeSupport.getPropertyChangeListeners(propertyName);
} }
}
/** /**
* Support for reporting bound property changes for Object properties. * Support for reporting bound property changes for Object properties.
@ -7991,7 +8007,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
*/ */
protected void firePropertyChange(String propertyName, protected void firePropertyChange(String propertyName,
Object oldValue, Object newValue) { Object oldValue, Object newValue) {
PropertyChangeSupport changeSupport = this.changeSupport; PropertyChangeSupport changeSupport;
synchronized (getChangeSupportLock()) {
changeSupport = this.changeSupport;
}
if (changeSupport == null || if (changeSupport == null ||
(oldValue != null && newValue != null && oldValue.equals(newValue))) { (oldValue != null && newValue != null && oldValue.equals(newValue))) {
return; return;
@ -8491,8 +8510,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
setComponentOrientation(orientation); setComponentOrientation(orientation);
} }
transient NativeInLightFixer nativeInLightFixer;
/** /**
* Checks that this component meets the prerequesites to be focus owner: * Checks that this component meets the prerequesites to be focus owner:
* - it is enabled, visible, focusable * - it is enabled, visible, focusable
@ -8518,189 +8535,26 @@ public abstract class Component implements ImageObserver, MenuContainer,
} }
/** /**
* This odd class is to help out a native component that has been * Fix the location of the HW component in a LW container hierarchy.
* embedded in a lightweight component. Moving lightweight
* components around and changing their visibility is not seen
* by the native window system. This is a feature for lightweights,
* but a problem for native components that depend upon the
* lightweights. An instance of this class listens to the lightweight
* parents of an associated native component (the outer class).
*
* @author Timothy Prinzing
*/ */
final class NativeInLightFixer implements ComponentListener, ContainerListener { final void relocateComponent() {
NativeInLightFixer() {
lightParents = new Vector();
install(parent);
}
void install(Container parent) {
lightParents.clear();
Container p = parent;
boolean isLwParentsVisible = true;
// stash a reference to the components that are being observed so that
// we can reliably remove ourself as a listener later.
for (; p.peer instanceof LightweightPeer; p = p.parent) {
// register listeners and stash a reference
p.addComponentListener(this);
p.addContainerListener(this);
lightParents.addElement(p);
isLwParentsVisible &= p.isVisible();
}
// register with the native host (native parent of associated native)
// to get notified if the top-level lightweight is removed.
nativeHost = p;
p.addContainerListener(this);
// kick start the fixup. Since the event isn't looked at
// we can simulate movement notification.
componentMoved(null);
if (!isLwParentsVisible) {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
if (peer != null) { if (peer == null) {
peer.hide(); return;
} }
}
}
}
void uninstall() {
if (nativeHost != null) {
removeReferences();
}
}
// --- ComponentListener -------------------------------------------
/**
* Invoked when one of the lightweight parents has been resized.
* This doesn't change the position of the native child so it
* is ignored.
*/
public void componentResized(ComponentEvent e) {
}
/**
* Invoked when one of the lightweight parents has been moved.
* The native peer must be told of the new position which is
* relative to the native container that is hosting the
* lightweight components.
*/
public void componentMoved(ComponentEvent e) {
synchronized (getTreeLock()) {
int nativeX = x; int nativeX = x;
int nativeY = y; int nativeY = y;
for(Component c = parent; (c != null) && for (Component cont = getContainer();
(c.peer instanceof LightweightPeer); cont != null && cont.isLightweight();
c = c.parent) { cont = cont.getContainer())
{
nativeX += c.x; nativeX += cont.x;
nativeY += c.y; nativeY += cont.y;
} }
if (peer != null) {
peer.setBounds(nativeX, nativeY, width, height, peer.setBounds(nativeX, nativeY, width, height,
ComponentPeer.SET_LOCATION); ComponentPeer.SET_LOCATION);
} }
} }
}
/**
* Invoked when a lightweight parent component has been
* shown. The associated native component must also be
* shown if it hasn't had an overriding hide done on it.
*/
public void componentShown(ComponentEvent e) {
if (shouldShow()) {
synchronized (getTreeLock()) {
if (peer != null) {
peer.show();
}
}
}
}
/**
* Invoked when one of the lightweight parents become visible.
* Returns true if component and all its lightweight
* parents are visible.
*/
private boolean shouldShow() {
boolean isLwParentsVisible = visible;
for (int i = lightParents.size() - 1;
i >= 0 && isLwParentsVisible;
i--)
{
isLwParentsVisible &=
((Container) lightParents.elementAt(i)).isVisible();
}
return isLwParentsVisible;
}
/**
* Invoked when component has been hidden.
*/
public void componentHidden(ComponentEvent e) {
if (visible) {
synchronized (getTreeLock()) {
if (peer != null) {
peer.hide();
}
}
}
}
// --- ContainerListener ------------------------------------
/**
* Invoked when a component has been added to a lightweight
* parent. This doesn't effect the native component.
*/
public void componentAdded(ContainerEvent e) {
}
/**
* Invoked when a lightweight parent has been removed.
* This means the services of this listener are no longer
* required and it should remove all references (ie
* registered listeners).
*/
public void componentRemoved(ContainerEvent e) {
Component c = e.getChild();
if (c == Component.this) {
removeReferences();
} else {
int n = lightParents.size();
for (int i = 0; i < n; i++) {
Container p = (Container) lightParents.elementAt(i);
if (p == c) {
removeReferences();
break;
}
}
}
}
/**
* Removes references to this object so it can be
* garbage collected.
*/
void removeReferences() {
int n = lightParents.size();
for (int i = 0; i < n; i++) {
Container c = (Container) lightParents.elementAt(i);
c.removeComponentListener(this);
c.removeContainerListener(this);
}
nativeHost.removeContainerListener(this);
lightParents.clear();
nativeHost = null;
}
Vector lightParents;
Container nativeHost;
}
/** /**
* Returns the <code>Window</code> ancestor of the component. * Returns the <code>Window</code> ancestor of the component.
@ -9452,6 +9306,19 @@ public abstract class Component implements ImageObserver, MenuContainer,
// ************************** MIXING CODE ******************************* // ************************** MIXING CODE *******************************
/**
* Check whether we can trust the current bounds of the component.
* The return value of false indicates that the container of the
* component is invalid, and therefore needs to be layed out, which would
* probably mean changing the bounds of its children.
* Null-layout of the container or absence of the container mean
* the bounds of the component are final and can be trusted.
*/
private boolean areBoundsValid() {
Container cont = getContainer();
return cont == null || cont.isValid() || cont.getLayout() == null;
}
/** /**
* Applies the shape to the component * Applies the shape to the component
* @param shape Shape to be applied to the component * @param shape Shape to be applied to the component
@ -9475,7 +9342,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
// to modify the object outside of the mixing code. // to modify the object outside of the mixing code.
this.compoundShape = shape; this.compoundShape = shape;
if (isValid()) { if (areBoundsValid()) {
Point compAbsolute = getLocationOnWindow(); Point compAbsolute = getLocationOnWindow();
if (mixingLog.isLoggable(Level.FINER)) { if (mixingLog.isLoggable(Level.FINER)) {
@ -9602,7 +9469,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
void applyCurrentShape() { void applyCurrentShape() {
checkTreeLock(); checkTreeLock();
if (!isValid()) { if (!areBoundsValid()) {
return; // Because applyCompoundShape() ignores such components anyway return; // Because applyCompoundShape() ignores such components anyway
} }
if (mixingLog.isLoggable(Level.FINE)) { if (mixingLog.isLoggable(Level.FINE)) {

View File

@ -832,16 +832,8 @@ public class Container extends Component {
} }
if (!comp.isLightweight() && isLightweight()) { if (!comp.isLightweight() && isLightweight()) {
// If component is heavyweight and one of the containers is lightweight // If component is heavyweight and one of the containers is lightweight
// some NativeInLightFixer activity should be performed // the location of the component should be fixed.
if (!curParent.isLightweight()) { comp.relocateComponent();
// Moving from heavyweight container to lightweight container - should create NativeInLightFixer
// since addNotify does this
comp.nativeInLightFixer = new NativeInLightFixer();
} else {
// Component already has NativeInLightFixer - just reinstall it
// because hierarchy changed and he needs to rebuild list of parents to listen.
comp.nativeInLightFixer.install(this);
}
} }
} }
} }
@ -2267,6 +2259,7 @@ public class Container extends Component {
EventTargetFilter filter, EventTargetFilter filter,
boolean searchHeavyweightChildren, boolean searchHeavyweightChildren,
boolean searchHeavyweightDescendants) { boolean searchHeavyweightDescendants) {
synchronized (getTreeLock()) {
int ncomponents = this.ncomponents; int ncomponents = this.ncomponents;
Component component[] = this.component; Component component[] = this.component;
@ -2279,11 +2272,12 @@ public class Container extends Component {
!(comp.peer instanceof LightweightPeer))) && !(comp.peer instanceof LightweightPeer))) &&
comp.contains(x - comp.x, y - comp.y)) { comp.contains(x - comp.x, y - comp.y)) {
// found a component that intersects the point, see if there is // found a component that intersects the point, see if there
// a deeper possibility. // is a deeper possibility.
if (comp instanceof Container) { if (comp instanceof Container) {
Container child = (Container) comp; Container child = (Container) comp;
Component deeper = child.getMouseEventTarget(x - child.x, Component deeper = child.getMouseEventTarget(
x - child.x,
y - child.y, y - child.y,
includeSelf, includeSelf,
filter, filter,
@ -2293,8 +2287,8 @@ public class Container extends Component {
} }
} else { } else {
if (filter.accept(comp)) { if (filter.accept(comp)) {
// there isn't a deeper target, but this component is a // there isn't a deeper target, but this component
// target // is a target
return comp; return comp;
} }
} }
@ -2307,14 +2301,15 @@ public class Container extends Component {
isPeerOK = (peer instanceof LightweightPeer) || includeSelf; isPeerOK = (peer instanceof LightweightPeer) || includeSelf;
isMouseOverMe = contains(x,y); isMouseOverMe = contains(x,y);
// didn't find a child target, return this component if it's a possible // didn't find a child target, return this component if it's
// target // a possible target
if (isMouseOverMe && isPeerOK && filter.accept(this)) { if (isMouseOverMe && isPeerOK && filter.accept(this)) {
return this; return this;
} }
// no possible target // no possible target
return null; return null;
} }
}
static interface EventTargetFilter { static interface EventTargetFilter {
boolean accept(final Component comp); boolean accept(final Component comp);
@ -3950,6 +3945,83 @@ public class Container extends Component {
} }
} }
private void recursiveShowHeavyweightChildren() {
if (!hasHeavyweightDescendants() || !isVisible()) {
return;
}
for (int index = 0; index < getComponentCount(); index++) {
Component comp = getComponent(index);
if (comp.isLightweight()) {
if (comp instanceof Container) {
((Container)comp).recursiveShowHeavyweightChildren();
}
} else {
if (comp.isVisible()) {
ComponentPeer peer = comp.getPeer();
if (peer != null) {
peer.show();
}
}
}
}
}
private void recursiveHideHeavyweightChildren() {
if (!hasHeavyweightDescendants()) {
return;
}
for (int index = 0; index < getComponentCount(); index++) {
Component comp = getComponent(index);
if (comp.isLightweight()) {
if (comp instanceof Container) {
((Container)comp).recursiveHideHeavyweightChildren();
}
} else {
if (comp.isVisible()) {
ComponentPeer peer = comp.getPeer();
if (peer != null) {
peer.hide();
}
}
}
}
}
private void recursiveRelocateHeavyweightChildren(Point origin) {
for (int index = 0; index < getComponentCount(); index++) {
Component comp = getComponent(index);
if (comp.isLightweight()) {
if (comp instanceof Container &&
((Container)comp).hasHeavyweightDescendants())
{
final Point newOrigin = new Point(origin);
newOrigin.translate(comp.getX(), comp.getY());
((Container)comp).recursiveRelocateHeavyweightChildren(newOrigin);
}
} else {
ComponentPeer peer = comp.getPeer();
if (peer != null) {
peer.setBounds(origin.x + comp.getX(), origin.y + comp.getY(),
comp.getWidth(), comp.getHeight(),
ComponentPeer.SET_LOCATION);
}
}
}
}
/*
* Consider the heavyweight container hides or shows the HW descendants
* automatically. Therefore we care of LW containers' visibility only.
*/
private boolean isRecursivelyVisibleUpToHeavyweightContainer() {
if (!isLightweight()) {
return true;
}
return isVisible() && (getContainer() == null ||
getContainer().isRecursivelyVisibleUpToHeavyweightContainer());
}
@Override
void mixOnShowing() { void mixOnShowing() {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
if (mixingLog.isLoggable(Level.FINE)) { if (mixingLog.isLoggable(Level.FINE)) {
@ -3958,6 +4030,10 @@ public class Container extends Component {
boolean isLightweight = isLightweight(); boolean isLightweight = isLightweight();
if (isLightweight && isRecursivelyVisibleUpToHeavyweightContainer()) {
recursiveShowHeavyweightChildren();
}
if (!isLightweight || (isLightweight && hasHeavyweightDescendants())) { if (!isLightweight || (isLightweight && hasHeavyweightDescendants())) {
recursiveApplyCurrentShape(); recursiveApplyCurrentShape();
} }
@ -3966,6 +4042,42 @@ public class Container extends Component {
} }
} }
@Override
void mixOnHiding(boolean isLightweight) {
synchronized (getTreeLock()) {
if (mixingLog.isLoggable(Level.FINE)) {
mixingLog.fine("this = " + this +
"; isLightweight=" + isLightweight);
}
if (isLightweight) {
recursiveHideHeavyweightChildren();
}
super.mixOnHiding(isLightweight);
}
}
@Override
void mixOnReshaping() {
synchronized (getTreeLock()) {
if (mixingLog.isLoggable(Level.FINE)) {
mixingLog.fine("this = " + this);
}
if (isLightweight() && hasHeavyweightDescendants()) {
final Point origin = new Point(getX(), getY());
for (Container cont = getContainer();
cont != null && cont.isLightweight();
cont = cont.getContainer())
{
origin.translate(cont.getX(), cont.getY());
}
recursiveRelocateHeavyweightChildren(origin);
}
super.mixOnReshaping();
}
}
@Override
void mixOnZOrderChanging(int oldZorder, int newZorder) { void mixOnZOrderChanging(int oldZorder, int newZorder) {
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
if (mixingLog.isLoggable(Level.FINE)) { if (mixingLog.isLoggable(Level.FINE)) {
@ -4431,7 +4543,8 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
e.isPopupTrigger(), e.isPopupTrigger(),
((MouseWheelEvent)e).getScrollType(), ((MouseWheelEvent)e).getScrollType(),
((MouseWheelEvent)e).getScrollAmount(), ((MouseWheelEvent)e).getScrollAmount(),
((MouseWheelEvent)e).getWheelRotation()); ((MouseWheelEvent)e).getWheelRotation(),
((MouseWheelEvent)e).getPreciseWheelRotation());
} }
else { else {
retargeted = new MouseEvent(target, retargeted = new MouseEvent(target,

View File

@ -154,7 +154,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
private boolean doRestoreFocus(Component toFocus, Component vetoedComponent, private boolean doRestoreFocus(Component toFocus, Component vetoedComponent,
boolean clearOnFailure) boolean clearOnFailure)
{ {
if (toFocus.isShowing() && toFocus.isFocusable() && if (toFocus != vetoedComponent && toFocus.isShowing() && toFocus.isFocusable() &&
toFocus.requestFocus(false, CausedFocusEvent.Cause.ROLLBACK)) { toFocus.requestFocus(false, CausedFocusEvent.Cause.ROLLBACK)) {
return true; return true;
} else { } else {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,7 +24,6 @@
*/ */
package java.awt; package java.awt;
import java.applet.Applet;
import java.awt.event.*; import java.awt.event.*;
import java.awt.im.InputContext; import java.awt.im.InputContext;
import java.awt.image.BufferStrategy; import java.awt.image.BufferStrategy;
@ -355,18 +354,21 @@ public class Window extends Container implements Accessible {
static class WindowDisposerRecord implements sun.java2d.DisposerRecord { static class WindowDisposerRecord implements sun.java2d.DisposerRecord {
final WeakReference<Window> owner; final WeakReference<Window> owner;
final WeakReference weakThis; final WeakReference weakThis;
final AppContext context; final WeakReference<AppContext> context;
WindowDisposerRecord(AppContext context, Window victim) { WindowDisposerRecord(AppContext context, Window victim) {
owner = new WeakReference<Window>(victim.getOwner()); owner = new WeakReference<Window>(victim.getOwner());
weakThis = victim.weakThis; weakThis = victim.weakThis;
this.context = context; this.context = new WeakReference<AppContext>(context);
} }
public void dispose() { public void dispose() {
Window parent = owner.get(); Window parent = owner.get();
if (parent != null) { if (parent != null) {
parent.removeOwnedWindow(weakThis); parent.removeOwnedWindow(weakThis);
} }
Window.removeFromWindowList(context, weakThis); AppContext ac = context.get();
if (null != ac) {
Window.removeFromWindowList(ac, weakThis);
}
} }
} }
@ -824,7 +826,10 @@ public class Window extends Container implements Accessible {
static private final AtomicBoolean static private final AtomicBoolean
beforeFirstWindowShown = new AtomicBoolean(true); beforeFirstWindowShown = new AtomicBoolean(true);
static final void closeSplashScreen() { final void closeSplashScreen() {
if (isTrayIconWindow) {
return;
}
if (beforeFirstWindowShown.getAndSet(false)) { if (beforeFirstWindowShown.getAndSet(false)) {
SunToolkit.closeSplashScreen(); SunToolkit.closeSplashScreen();
} }

Some files were not shown because too many files have changed in this diff Show More