提交 8f110054 编写于 作者: L lana

Merge

37a05a11f281b4d238e2f9e7ebb67c63f64d0e77 jdk7-b24
75fca0b0ab83ab1392e615910cea020f66535390 jdk7-b25
......@@ -50,13 +50,13 @@ CC_DEPEND = -MM
CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g'
ifndef PLATFORM_SRC
PLATFORM_SRC = $(JDK_TOPDIR)/src/solaris
PLATFORM_SRC = $(BUILDDIR)/../src/solaris
endif # PLATFORM_SRC
# Platform specific closed sources
ifndef OPENJDK
ifndef CLOSED_PLATFORM_SRC
CLOSED_PLATFORM_SRC = $(JDK_TOPDIR)/src/closed/solaris
CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/solaris
endif
endif
......
......@@ -45,13 +45,13 @@
include $(JDK_MAKE_SHARED_DIR)/Defs.gmk
ifndef PLATFORM_SRC
PLATFORM_SRC = $(JDK_TOPDIR)/src/solaris
PLATFORM_SRC = $(BUILDDIR)/../src/solaris
endif # PLATFORM_SRC
# Platform specific closed sources
ifndef OPENJDK
ifndef CLOSED_PLATFORM_SRC
CLOSED_PLATFORM_SRC = $(JDK_TOPDIR)/src/closed/solaris
CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/solaris
endif
endif
......
......@@ -51,13 +51,13 @@ ifndef LIB_LOCATION
endif # LIB_LOCATION
ifndef PLATFORM_SRC
PLATFORM_SRC = $(JDK_TOPDIR)/src/windows
PLATFORM_SRC = $(BUILDDIR)/../src/windows
endif # PLATFORM_SRC
# Platform specific closed sources
ifndef OPENJDK
ifndef CLOSED_PLATFORM_SRC
CLOSED_PLATFORM_SRC = $(JDK_TOPDIR)/src/closed/windows
CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/windows
endif
endif
......@@ -367,7 +367,7 @@ else
endif
# 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),)
COOKED_BUILD_NUMBER = $(shell $(ECHO) $(JDK_BUILD_NUMBER) | $(SED) -e 's/^b//' -e 's/^0//')
......
......@@ -32,6 +32,13 @@
# 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.
# 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
ifndef JDK_TOPDIR
JDK_TOPDIR=$(BUILDDIR)/..
ifdef 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
ifndef JDK_MAKE_SHARED_DIR
JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared
......@@ -59,13 +74,13 @@ include $(JDK_TOPDIR)/make/common/CancelImplicits.gmk
# there yet.
#
ifndef SHARE_SRC
SHARE_SRC = $(JDK_TOPDIR)/src/share
SHARE_SRC = $(BUILDDIR)/../src/share
endif
# Files that cannot be included in the OpenJDK distribution are
# collected under a parent directory which contains just those files.
ifndef CLOSED_SRC
CLOSED_SRC = $(JDK_TOPDIR)/src/closed
CLOSED_SRC = $(BUILDDIR)/../src/closed
endif
# If we have no closed directory, force it to an openjdk build
......@@ -79,19 +94,6 @@ ifeq ($(CLOSED_SRC_DIR_EXISTS), false)
OPENJDK = true
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
ifdef OPENJDK
CLOSED_SRC =
......@@ -170,14 +172,6 @@ ifdef OPENJDK
endif
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
#
......
......@@ -36,7 +36,7 @@ ifndef JDK_MAKE_SHARED_DIR
endif
ifndef CONTROL_TOPDIR
CONTROL_TOPDIR=$(TOPDIR)/control
CONTROL_TOPDIR=$(TOPDIR)
endif
ifndef HOTSPOT_TOPDIR
HOTSPOT_TOPDIR=$(TOPDIR)/hotspot
......@@ -70,7 +70,8 @@ endif
include $(JDK_MAKE_SHARED_DIR)/Platform.gmk
# Default output directory
_OUTPUTDIR=$(CONTROL_TOPDIR)/build/$(PLATFORM)-$(ARCH)
BUILD_PARENT_DIRECTORY=$(TOPDIR)
_OUTPUTDIR=$(TOPDIR)/build/$(PLATFORM)-$(ARCH)
# Get platform specific settings
include $(JDK_MAKE_SHARED_DIR)/Defs.gmk
......
......@@ -67,16 +67,6 @@ ifeq ($(PLATFORM),windows)
UTILS_DEVTOOL_PATH=$(DEVTOOLS_PATH)
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
ADB = $(UTILS_COMMAND_PATH)adb
AR = $(UTILS_CCS_BIN_PATH)ar
......
......@@ -55,7 +55,10 @@ include $(JDK_MAKE_SHARED_DIR)/Defs-utils.gmk
# Simple pwd path
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
# 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)
# OUTPUTDIR: Location of all output for the build
_BACKUP_OUTPUTDIR = $(TEMP_DISK)/$(USER)/jdk-outputdir
ifdef ALT_OUTPUTDIR
_POSSIBLE_OUTPUTDIR =$(subst \,/,$(ALT_OUTPUTDIR))
OUTPUTDIR:=$(subst \,/,$(ALT_OUTPUTDIR))
# Assumes this is absolute (checks later)
ABS_OUTPUTDIR:=$(OUTPUTDIR)
else
ifndef _OUTPUTDIR
_OUTPUTDIR = $(_BACKUP_OUTPUTDIR)
# Default: Get "build" parent directory, which should always exist
ifndef BUILD_PARENT_DIRECTORY
BUILD_PARENT_DIRECTORY=$(BUILDDIR)/..
endif
ABS_BUILD_PARENT_DIRECTORY:=$(call FullPath,$(BUILD_PARENT_DIRECTORY))
ifdef OPENJDK
_OUTPUTDIRNAME=$(PLATFORM)-$(ARCH)$(OPENJDK_SUFFIX)
else
_OUTPUTDIRNAME=$(PLATFORM)-$(ARCH)
endif
_OUTPUTDIR=$(BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME)
ABS_OUTPUTDIR:=$(ABS_BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME)
endif
_POSSIBLE_OUTPUTDIR =$(_OUTPUTDIR)
endif
_create_outputdir1:=$(shell mkdir -p $(_POSSIBLE_OUTPUTDIR) > $(DEV_NULL) 2>&1)
OUTPUTDIR:=$(call WriteDirExists,$(_POSSIBLE_OUTPUTDIR),$(_BACKUP_OUTPUTDIR))
_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)'")
OUTPUTDIR:=$(_OUTPUTDIR)
endif
# Check for spaces and null value
OUTPUTDIR:=$(call AltCheckSpaces,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
# 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
# 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
COPYRIGHT_YEAR = $(ALT_COPYRIGHT_YEAR)
else
COPYRIGHT_YEAR = $(shell $(DATE) '+%Y')
endif
# Absolute path to output directory
ABS_OUTPUTDIR:=$(call FullPath,$(OUTPUTDIR))
# Get shared compiler settings
include $(JDK_MAKE_SHARED_DIR)/Compiler.gmk
......@@ -93,20 +93,18 @@ SYSTEM_UNAME := $(shell uname)
# Normal boot jdk is previous release, but a hard requirement is a 1.5 boot
REQUIRED_BOOT_VER = 1.5
#This is specific to OpenJDK build
ifdef OPENJDK
REQUIRED_FREETYPE_VERSION=2.3.0
endif
# If we are using freetype, this is the required version
REQUIRED_FREETYPE_VERSION=2.3.0
#
# Prune out all known SCM (Source Code Management) directories
# so they will not be included when copying directory trees
# 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:
SCM_DIRS_rexp = ".hg|.svn|CVS|RCS|SCCS|Codemgr_wsdata|deleted_files"
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_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 -o -name .hgignore -o -name .hgtags \) -prune
# Don't define this unless it's not defined
ifndef VARIANT
......@@ -272,7 +270,7 @@ ifeq ($(SYSTEM_UNAME), Linux)
REQUIRED_ALSA_VERSION = ^((0[.]9[.][1-9])|(1[.]0[.][0-9]))[0-9]*
endif
# 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
# Windows with and without CYGWIN will be slightly different
......@@ -376,45 +374,35 @@ ifeq ($(PLATFORM), windows)
REQUIRED_DXSDK_VER = 0x0700
OS_VENDOR = Microsoft
# How much RAM does this machine have:
MB_OF_MEMORY := $(shell \
if [ -f "C:/cygwin/bin/free.exe" ] ; then \
( C:/cygwin/bin/bash.exe -c "C:/cygwin/bin/free.exe -m" ) | \
grep Mem: | \
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
MB_OF_MEMORY := unknown
LOW_MEMORY_MACHINE := true
MAX_VM_MEMORY := 384
MIN_VM_MEMORY := 128
ifeq ($(USING_CYGWIN),true)
# CYGWIN has the 'free' utility
_MB_OF_MEMORY := \
$(shell free -m | grep Mem: | awk '{print $$2;}' )
else
# Windows 2000 has the mem utility, but two memory areas
# extended memory is what is beyond 1024M
_B_OF_EXT_MEMORY := \
$(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
REQUIRED_ZIP_VER = 2.2
......@@ -454,6 +442,37 @@ ifneq ($(PLATFORM), windows)
ARCH_VM_SUBDIR=jre/lib/$(LIBARCH)
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
_USER1:=$(subst ', ,$(_USER))
_USER2:=$(subst ", ,$(_USER1))
......
......@@ -105,13 +105,21 @@ ZIP_VER :=$(call GetVersion,"$(_ZIP_VER)")
UNZIP_VER :=$(call GetVersion,"$(_UNZIP_VER)")
BOOT_VER :=$(call GetVersion,"$(_BOOT_VER)")
REQUIRED_ANT_VER := 1.6.3
_ANT_VER :=$(shell $(ANT) -version 2>&1 )
ANT_VER :=$(call GetVersion,"$(_ANT_VER)")
REQUIRED_ANT_VER := 1.6.3
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)")
REQUIRED_FINDBUGS_VER := 1.1
_FINDBUGS_VER :=$(shell $(FINDBUGS) -version 2>&1 )
FINDBUGS_VER :=$(call GetVersion,"$(_FINDBUGS_VER)")
REQUIRED_FINDBUGS_VER := 1.2
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)")
ifdef ALT_BINDIR
ALT_BINDIR_VERSION := $(shell $(ALT_BINDIR)/java$(EXE_SUFFIX) -version 2>&1 | $(NAWK) -F'"' '{ print $$2 }')
......@@ -1564,31 +1572,31 @@ ifeq ($(ARCH_DATA_MODEL), 32)
endif
######################################################
# SECURITY_BASELINE_142 test
######################################################
security_baseline_142:
ifeq ($(PLATFORM), windows)
@if [ -z "$(SECURITY_BASELINE_142)" ]; then \
$(ECHO) "WARNING: Your SECURITY_BASELINE_142 setting is empty.\n" \
" Setting it to the default value of 1.4.2_10.\n" \
" It is recommended to set SECURITY_BASELINE_142.\n" \
"" >> $(WARNING_FILE) ; \
fi
endif
######################################################
# SECURITY_BASELINE_150 test
######################################################
security_baseline_150:
ifeq ($(PLATFORM), windows)
@if [ -z "$(SECURITY_BASELINE_150)" ]; then \
$(ECHO) "WARNING: Your SECURITY_BASELINE_150 setting is empty.\n" \
" Setting it to the default value of 1.5.0_07.\n" \
" It is recommended to set SECURITY_BASELINE_150.\n" \
"" >> $(WARNING_FILE) ; \
fi
endif
######################################################
# SECURITY_BASELINE_142 test
######################################################
security_baseline_142:
ifeq ($(PLATFORM), windows)
@if [ -z "$(SECURITY_BASELINE_142)" ]; then \
$(ECHO) "WARNING: Your SECURITY_BASELINE_142 setting is empty.\n" \
" Setting it to the default value of 1.4.2_10.\n" \
" It is recommended to set SECURITY_BASELINE_142.\n" \
"" >> $(WARNING_FILE) ; \
fi
endif
######################################################
# SECURITY_BASELINE_150 test
######################################################
security_baseline_150:
ifeq ($(PLATFORM), windows)
@if [ -z "$(SECURITY_BASELINE_150)" ]; then \
$(ECHO) "WARNING: Your SECURITY_BASELINE_150 setting is empty.\n" \
" Setting it to the default value of 1.5.0_07.\n" \
" It is recommended to set SECURITY_BASELINE_150.\n" \
"" >> $(WARNING_FILE) ; \
fi
endif
######################################################
......
......@@ -49,8 +49,8 @@ EXCLUDE_PKGS = \
# ACTIVE_JSR_PKGS are packages that are part of an active JSR process--
# one that is doing its own review. These packages are not included when
# creating diff pages for the platform's JCP process.
#
# (see /java/pubs/apisrc/jdk/6.0/beta/make/docs/active_jsr_pkgs)
#
# (see /java/pubs/apisrc/jdk/6.0/beta/make/docs/active_jsr_pkgs)
# Note:
# This is a list of regular expressions. So foo.* matches "foo" and "foo.bar".
#
......@@ -72,13 +72,13 @@ ACTIVE_JSR_PKGS= \
# CORE_PKGS is the list of packages that form the
# Java API Specification.
#
### ***IMPORTANT NOTE***
### There is also a "REGEXP" variable in the docs/makefile that
### determines which table the packages go in on the main page.
### Currently, there is only table ("Platform Packages") and
### everything goes in it, so REGEXP is "*". But if that policy
### changes, packages added will need to be reflected in that
### list of wildcard expressions, as well.
### ***IMPORTANT NOTE***
### There is also a "REGEXP" variable in the docs/makefile that
### determines which table the packages go in on the main page.
### Currently, there is only table ("Platform Packages") and
### everything goes in it, so REGEXP is "*". But if that policy
### changes, packages added will need to be reflected in that
### list of wildcard expressions, as well.
###
CORE_PKGS = \
java.applet \
......
......@@ -85,7 +85,6 @@ SUNWprivate_1.1 {
Java_java_io_FileOutputStream_close0;
Java_java_io_FileOutputStream_initIDs;
Java_java_io_FileOutputStream_open;
Java_java_io_FileOutputStream_openAppend;
Java_java_io_FileOutputStream_write;
Java_java_io_FileOutputStream_writeBytes;
Java_java_io_FileSystem_getFileSystem;
......
......@@ -107,6 +107,7 @@ endif # PLATFORM
ifeq ($(PLATFORM), windows)
EXTRA_LIBS = advapi32.lib \
comctl32.lib \
user32.lib
JAVALIB =
......
......@@ -43,7 +43,7 @@ include $(BUILDDIR)/common/Defs.gmk
# Override the default version info with our own resource file (see 5106536)
ifeq ($(PLATFORM), windows)
LDLIBS_COMMON += user32.lib
LDLIBS_COMMON += user32.lib comctl32.lib
ifdef OPENJDK
RC_FLAGS += -i "$(PLATFORM_SRC)/resource/icons"
else
......
......@@ -46,7 +46,7 @@ STATIC_JLI = true
include $(BUILDDIR)/common/Defs.gmk
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)
ifeq ($(PLATFORM), windows)
......
......@@ -191,7 +191,7 @@ sources: $(SPP) $(FILES_genout)
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)
# 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_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)
$(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_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
$(prep-target)
......@@ -635,8 +635,8 @@ $(SCS_GEN)/StandardCharsets.java: genCharsetProvider.sh \
$(HASHER_JARFILE) $(SCS_SRC)/standard-charsets
$(prep-target)
@$(RM) $@.temp
NAWK=$(NAWK) TEMPDIR=$(TEMPDIR) \
NAWK=$(NAWK) TEMPDIR=$(TEMPDIR) SH=$(SH) \
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
......@@ -48,7 +48,7 @@ echo '-->' $OUT
# Header
#
$SHELL addNotices.sh "$COPYRIGHT_YEARS" > $OUT
$SH ./addNotices.sh "$COPYRIGHT_YEARS" > $OUT
cat <<__END__ >>$OUT
......
......@@ -41,7 +41,7 @@ gen() {
echo '-->' $DST/$ID.java
out=$DST/${ID}.java
$SHELL addNotices.sh "$COPYRIGHT_YEARS" > $out
$SH ./addNotices.sh "$COPYRIGHT_YEARS" > $out
cat >>$out <<__END__
......
......@@ -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$(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
#
# 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.
#
# This code is free software; you can redistribute it and/or modify it
......@@ -246,7 +246,7 @@ $(SIZES): $(SIZERS)
@if [ "$(DOCOMPARE)$(suffix $@)" = "true.64" ]; then \
$(ECHO) COMPARING $@ and $(STORED_SIZES_TMPL_$(PLATFORM)_$(LIBARCH)); \
$(DIFF) $@ $(STORED_SIZES_TMPL_$(PLATFORM)_$(LIBARCH)); \
fi
fi
$(TEMPDIR)/.gen.wrappers: $(SIZES) $(WRAPPER_GENERATOR_CLASS) $(XLIBTYPES)
$(BOOT_JAVA_CMD) -cp $(WRAPPER_GENERATOR_TEMPDIR) WrapperGenerator \
......@@ -256,10 +256,11 @@ touch.wrappers: $(TEMPDIR)/.gen.wrappers
$(MKDIR) -p $(TEMPDIR)
$(TOUCH) $(TEMPDIR)/.gen.wrappers
generated.clean:
generated.clean:
$(RM) -r $(WRAPPER_GENERATOR_TEMPDIR)
$(RM) -r $(WRAPPER_GENERATOR_DIR)
$(RM) -r $(GEN_DIR)/*.java
$(RM) -r $(TEMPDIR)/.gen_icons
ifdef OPENJDK
ICONS_PATH_PREFIX=$(PLATFORM_SRC)
......
......@@ -38,7 +38,14 @@ FT_TEST_PATH = $(TEMPDIR)/$(FT_TEST)
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)
#add runtime library search path
......
......@@ -26,13 +26,16 @@
/* Test program for freetype sanity check.
Prints "Failed" messages to STDOUT if check fails. */
#include <stdio.h>
#include <string.h>
#include "ft2build.h"
#include FT_FREETYPE_H
#define QUOTEMACRO(x) QUOTEME(x)
#define QUOTEME(x) #x
int main(char** argv, int argc) {
int main(int argc, char** argv) {
char v[50];
FT_Int major, minor, patch;
FT_Library library;
......
......@@ -32,9 +32,9 @@ class CommandNode extends AbstractCommandNode {
void constrain(Context ctx) {
if (components.size() == 3) {
Node out = (Node)components.get(0);
Node reply = (Node)components.get(1);
Node error = (Node)components.get(2);
Node out = components.get(0);
Node reply = components.get(1);
Node error = components.get(2);
if (!(out instanceof OutNode)) {
error("Expected 'Out' item, got: " + out);
}
......@@ -45,7 +45,7 @@ class CommandNode extends AbstractCommandNode {
error("Expected 'ErrorSet' item, got: " + error);
}
} else if (components.size() == 1) {
Node evt = (Node)components.get(0);
Node evt = components.get(0);
if (!(evt instanceof EventNode)) {
error("Expected 'Event' item, got: " + evt);
}
......
......@@ -98,7 +98,7 @@ class ConstantSetNode extends AbstractNamedNode {
if (constantMap == null) {
return "";
}
String com = (String) constantMap.get(key);
String com = constantMap.get(key);
if(com == null){
return "";
} else {
......
......@@ -37,7 +37,7 @@ class RepeatNode extends AbstractTypeNode {
if (components.size() != 1) {
error("Repeat must have exactly one member, use Group for more");
}
member = (Node)(components.get(0));
member = components.get(0);
if (!(member instanceof TypeNode)) {
error("Repeat member must be type specifier");
}
......
文件模式从 100644 更改为 100755
......@@ -205,9 +205,7 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */
_wc_enabled = cpwildcard;
_ergo_policy = ergo;
if (javaw == JNI_TRUE)
SetJavaw();
InitLauncher(javaw);
DumpState();
/*
......
......@@ -172,7 +172,6 @@ const char* GetDotVersion();
const char* GetFullVersion();
jboolean IsJavaArgs();
jboolean IsJavaw();
void SetJavaw();
jint GetErgoPolicy();
jboolean ServerClassMachine();
......@@ -180,5 +179,9 @@ jboolean ServerClassMachine();
static int ContinueInNewThread(InvocationFunctions* ifn, int argc, char** argv,
char* jarfile, char* classname, int ret);
/*
* Initialize platform specific settings
*/
void InitLauncher(jboolean javaw);
#endif /* _JAVA_H_ */
......@@ -64,8 +64,6 @@ main(int argc, char ** argv)
margv = argv;
#endif /* JAVAW */
JLI_SetTraceLauncher();
return JLI_Launch(margc, margv,
sizeof(const_jargs) / sizeof(char *), const_jargs,
sizeof(const_appclasspath) / sizeof(char *), const_appclasspath,
......
......@@ -34,6 +34,7 @@ import java.security.KeyRep;
import java.security.GeneralSecurityException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.spec.InvalidKeySpecException;
import javax.crypto.Mac;
import javax.crypto.SecretKey;
......@@ -107,12 +108,17 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
throw new InvalidKeySpecException("Key length is negative");
}
try {
this.prf = Mac.getInstance(prfAlgo, new SunJCE());
this.prf = Mac.getInstance(prfAlgo, "SunJCE");
} catch (NoSuchAlgorithmException nsae) {
// not gonna happen; re-throw just in case
InvalidKeySpecException ike = new InvalidKeySpecException();
ike.initCause(nsae);
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);
}
......
#
# Default Input method display names for Indic input methods
#
DisplayName.Devanagari = Devanagari Input Method
#
# Default Input method display names for Indic input methods
#
DisplayName.Devanagari = Devanagari Input Method
#
# Default Input method display names for Thai input methods
#
DisplayName.Thai = Thai Input Method
#
# Default Input method display names for Thai input methods
#
DisplayName.Thai = Thai Input Method
......@@ -43,6 +43,13 @@ import javax.management.MBeanInfo;
import javax.management.NotCompliantMBeanException;
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
......@@ -482,4 +489,33 @@ public class Introspector {
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);
}
}
}
<?xml version='1.0' encoding='UTF-8' ?>
<!ELEMENT Configuration (CanonicalizationMethods , TransformAlgorithms , JCEAlgorithmMappings , Log4J , ResourceBundles , UnitTests , ResourceResolvers , KeyResolvers)>
<!ATTLIST Configuration xmlns CDATA #FIXED 'http://www.xmlsecurity.org/NS/#configuration'
target CDATA #IMPLIED>
<!ELEMENT CanonicalizationMethods (CanonicalizationMethod+)>
<!ATTLIST CanonicalizationMethods JAVACLASS CDATA #FIXED 'com.sun.org.apache.xml.internal.security.c14n.Canonicalizer' >
<!ELEMENT CanonicalizationMethod EMPTY>
<!ATTLIST CanonicalizationMethod URI CDATA #REQUIRED
JAVACLASS CDATA #REQUIRED >
<!ELEMENT TransformAlgorithms (TransformAlgorithm+)>
<!ATTLIST TransformAlgorithms JAVACLASS CDATA #FIXED 'com.sun.org.apache.xml.internal.security.transforms.Transform' >
<!ELEMENT TransformAlgorithm EMPTY>
<!ATTLIST TransformAlgorithm URI CDATA #REQUIRED
JAVACLASS CDATA #REQUIRED >
<!ELEMENT JCEAlgorithmMappings (Providers , Algorithms)>
<!ELEMENT Providers (Provider+)>
<!ELEMENT Provider EMPTY>
<!ATTLIST Provider Id ID #REQUIRED
Class CDATA #REQUIRED
Info CDATA #IMPLIED
ProviderURL CDATA #IMPLIED >
<!ELEMENT Algorithms (Algorithm+)>
<!ELEMENT Algorithm (ProviderAlgo+)>
<!ATTLIST Algorithm URI CDATA #REQUIRED
Description CDATA #IMPLIED
AlgorithmClass CDATA #IMPLIED >
<!ELEMENT ProviderAlgo EMPTY>
<!ATTLIST ProviderAlgo ProviderId IDREF #REQUIRED
JCEName CDATA #REQUIRED
JCEAlias CDATA #IMPLIED >
<!ELEMENT Log4J EMPTY>
<!ATTLIST Log4J configFile CDATA 'data/log4j.xml' >
<!ELEMENT ResourceBundles (ResourceBundle+)>
<!ATTLIST ResourceBundles defaultLanguageCode CDATA 'de'
defaultCountryCode CDATA 'DE' >
<!ELEMENT ResourceBundle EMPTY>
<!ATTLIST ResourceBundle LanguageCode CDATA #REQUIRED
CountryCode CDATA #REQUIRED
LOCATION CDATA #REQUIRED >
<!ELEMENT UnitTests (UnitTest+)>
<!ATTLIST UnitTests JAVACLASS CDATA #FIXED 'com.sun.org.apache.xml.internal.security.test.AllTests' >
<!ELEMENT ResourceResolvers (Resolver+)>
<!ELEMENT Resolver EMPTY>
<!ATTLIST Resolver JAVACLASS CDATA #REQUIRED
DESCRIPTION CDATA #IMPLIED >
<!ELEMENT KeyResolvers (KeyResolver+)>
<!ATTLIST KeyResolvers JAVACLASS CDATA #FIXED 'com.sun.org.apache.xml.internal.security.keys.KeyResolver' >
<!ELEMENT KeyResolver EMPTY>
<!ATTLIST KeyResolver URI CDATA #REQUIRED
JAVACLASS CDATA #REQUIRED >
<!ELEMENT UnitTest (#PCDATA)>
<!ATTLIST UnitTest JAVACLASS CDATA #REQUIRED >
<?xml version='1.0' encoding='UTF-8' ?>
<!ELEMENT Configuration (CanonicalizationMethods , TransformAlgorithms , JCEAlgorithmMappings , Log4J , ResourceBundles , UnitTests , ResourceResolvers , KeyResolvers)>
<!ATTLIST Configuration xmlns CDATA #FIXED 'http://www.xmlsecurity.org/NS/#configuration'
target CDATA #IMPLIED>
<!ELEMENT CanonicalizationMethods (CanonicalizationMethod+)>
<!ATTLIST CanonicalizationMethods JAVACLASS CDATA #FIXED 'com.sun.org.apache.xml.internal.security.c14n.Canonicalizer' >
<!ELEMENT CanonicalizationMethod EMPTY>
<!ATTLIST CanonicalizationMethod URI CDATA #REQUIRED
JAVACLASS CDATA #REQUIRED >
<!ELEMENT TransformAlgorithms (TransformAlgorithm+)>
<!ATTLIST TransformAlgorithms JAVACLASS CDATA #FIXED 'com.sun.org.apache.xml.internal.security.transforms.Transform' >
<!ELEMENT TransformAlgorithm EMPTY>
<!ATTLIST TransformAlgorithm URI CDATA #REQUIRED
JAVACLASS CDATA #REQUIRED >
<!ELEMENT JCEAlgorithmMappings (Providers , Algorithms)>
<!ELEMENT Providers (Provider+)>
<!ELEMENT Provider EMPTY>
<!ATTLIST Provider Id ID #REQUIRED
Class CDATA #REQUIRED
Info CDATA #IMPLIED
ProviderURL CDATA #IMPLIED >
<!ELEMENT Algorithms (Algorithm+)>
<!ELEMENT Algorithm (ProviderAlgo+)>
<!ATTLIST Algorithm URI CDATA #REQUIRED
Description CDATA #IMPLIED
AlgorithmClass CDATA #IMPLIED >
<!ELEMENT ProviderAlgo EMPTY>
<!ATTLIST ProviderAlgo ProviderId IDREF #REQUIRED
JCEName CDATA #REQUIRED
JCEAlias CDATA #IMPLIED >
<!ELEMENT Log4J EMPTY>
<!ATTLIST Log4J configFile CDATA 'data/log4j.xml' >
<!ELEMENT ResourceBundles (ResourceBundle+)>
<!ATTLIST ResourceBundles defaultLanguageCode CDATA 'de'
defaultCountryCode CDATA 'DE' >
<!ELEMENT ResourceBundle EMPTY>
<!ATTLIST ResourceBundle LanguageCode CDATA #REQUIRED
CountryCode CDATA #REQUIRED
LOCATION CDATA #REQUIRED >
<!ELEMENT UnitTests (UnitTest+)>
<!ATTLIST UnitTests JAVACLASS CDATA #FIXED 'com.sun.org.apache.xml.internal.security.test.AllTests' >
<!ELEMENT ResourceResolvers (Resolver+)>
<!ELEMENT Resolver EMPTY>
<!ATTLIST Resolver JAVACLASS CDATA #REQUIRED
DESCRIPTION CDATA #IMPLIED >
<!ELEMENT KeyResolvers (KeyResolver+)>
<!ATTLIST KeyResolvers JAVACLASS CDATA #FIXED 'com.sun.org.apache.xml.internal.security.keys.KeyResolver' >
<!ELEMENT KeyResolver EMPTY>
<!ATTLIST KeyResolver URI CDATA #REQUIRED
JAVACLASS CDATA #REQUIRED >
<!ELEMENT UnitTest (#PCDATA)>
<!ATTLIST UnitTest JAVACLASS CDATA #REQUIRED >
......@@ -91,9 +91,7 @@ abstract public class EventRequestSpec {
void attemptImmediateResolve(VirtualMachine vm) {
// try to resolve immediately
Iterator iter = vm.allClasses().iterator();
while (iter.hasNext()) {
ReferenceType refType = (ReferenceType)iter.next();
for (ReferenceType refType : vm.allClasses()) {
if (refSpec.matches(refType)) {
try {
resolve(refType);
......
......@@ -47,9 +47,8 @@ class EventRequestSpecList {
*/
void resolve(ReferenceType refType) {
synchronized(eventRequestSpecs) {
Iterator iter = eventRequestSpecs.iterator();
while (iter.hasNext()) {
((EventRequestSpec)iter.next()).attemptResolve(refType);
for (EventRequestSpec spec : eventRequestSpecs) {
spec.attemptResolve(refType);
}
}
}
......@@ -79,7 +78,7 @@ class EventRequestSpecList {
BreakpointSpec
createMethodBreakpoint(String classPattern,
String methodId, List methodArgs) {
String methodId, List<String> methodArgs) {
ReferenceTypeSpec refSpec =
new PatternReferenceTypeSpec(classPattern);
return new MethodBreakpointSpec(this, refSpec,
......@@ -132,47 +131,48 @@ class EventRequestSpecList {
// -------- notify routines --------------------
private Vector specListeners() {
return (Vector)runtime.specListeners.clone();
@SuppressWarnings("unchecked")
private Vector<SpecListener> specListeners() {
return (Vector<SpecListener>)runtime.specListeners.clone();
}
void notifySet(EventRequestSpec spec) {
Vector l = specListeners();
Vector<SpecListener> l = specListeners();
SpecEvent evt = new SpecEvent(spec);
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) {
Vector l = specListeners();
Vector<SpecListener> l = specListeners();
SpecEvent evt = new SpecEvent(spec);
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) {
Vector l = specListeners();
Vector<SpecListener> l = specListeners();
SpecEvent evt = new SpecEvent(spec);
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) {
Vector l = specListeners();
Vector<SpecListener> l = specListeners();
SpecEvent evt = new SpecEvent(spec);
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) {
Vector l = specListeners();
Vector<SpecListener> l = specListeners();
SpecErrorEvent evt = new SpecErrorEvent(spec, exc);
for (int i = 0; i < l.size(); i++) {
spec.notifyError((SpecListener)l.elementAt(i), evt);
spec.notifyError(l.elementAt(i), evt);
}
}
}
......@@ -232,10 +232,7 @@ public class ExecutionManager {
if (pattern.startsWith("*.")) {
// Wildcard matches any leading package name.
pattern = pattern.substring(1);
List classes = vm().allClasses();
Iterator iter = classes.iterator();
while (iter.hasNext()) {
ReferenceType type = ((ReferenceType)iter.next());
for (ReferenceType type : vm().allClasses()) {
if (type.name().endsWith(pattern)) {
result.add(type);
}
......@@ -278,7 +275,7 @@ public class ExecutionManager {
public ThreadGroupReference systemThreadGroup()
throws NoSessionException {
ensureActiveSession();
return (ThreadGroupReference)vm().topLevelThreadGroups().get(0);
return vm().topLevelThreadGroups().get(0);
}
/*
......@@ -349,10 +346,9 @@ public class ExecutionManager {
* attach sessions.
*/
VirtualMachineManager mgr = Bootstrap.virtualMachineManager();
List connectors = mgr.attachingConnectors();
AttachingConnector connector = (AttachingConnector)connectors.get(0);
AttachingConnector connector = mgr.attachingConnectors().get(0);
Map<String, Connector.Argument> arguments = connector.defaultArguments();
((Connector.Argument)arguments.get("port")).setValue(portName);
arguments.get("port").setValue(portName);
Session newSession = internalAttach(connector, arguments);
if (newSession != null) {
......@@ -504,10 +500,7 @@ public class ExecutionManager {
* if so, it gets removed here.
*/
EventRequestManager mgr = vm().eventRequestManager();
List requests = mgr.stepRequests();
Iterator iter = requests.iterator();
while (iter.hasNext()) {
StepRequest request = (StepRequest)iter.next();
for (StepRequest request : mgr.stepRequests()) {
if (request.thread().equals(thread)) {
mgr.deleteEventRequest(request);
break;
......@@ -591,7 +584,7 @@ public class ExecutionManager {
if (session == null || thread == null) {
return null;
}
ThreadInfo info = (ThreadInfo)threadInfoMap.get(thread);
ThreadInfo info = threadInfoMap.get(thread);
if (info == null) {
//### Should not hardcode initial frame count and prefetch here!
//info = new ThreadInfo(thread, 10, 10);
......@@ -607,24 +600,22 @@ public class ExecutionManager {
void validateThreadInfo() {
session.interrupted = true;
Iterator iter = threadInfoList.iterator();
while (iter.hasNext()) {
((ThreadInfo)iter.next()).validate();
for (ThreadInfo threadInfo : threadInfoList) {
threadInfo.validate();
}
}
private void invalidateThreadInfo() {
if (session != null) {
session.interrupted = false;
Iterator iter = threadInfoList.iterator();
while (iter.hasNext()) {
((ThreadInfo)iter.next()).invalidate();
for (ThreadInfo threadInfo : threadInfoList) {
threadInfo.invalidate();
}
}
}
void removeThreadInfo(ThreadReference thread) {
ThreadInfo info = (ThreadInfo)threadInfoMap.get(thread);
ThreadInfo info = threadInfoMap.get(thread);
if (info != null) {
info.invalidate();
threadInfoMap.remove(thread);
......@@ -702,7 +693,7 @@ public class ExecutionManager {
while (inputBuffer.size() < 1) {
inputLock.wait();
}
line = (String)inputBuffer.removeLast();
line = inputBuffer.removeLast();
} catch (InterruptedException e) {}
}
}
......@@ -774,7 +765,7 @@ public class ExecutionManager {
public BreakpointSpec
createMethodBreakpoint(String classPattern,
String methodId, List methodArgs) {
String methodId, List<String> methodArgs) {
return specList.createMethodBreakpoint(classPattern,
methodId, methodArgs);
}
......@@ -811,7 +802,7 @@ public class ExecutionManager {
specList.install(spec, vm());
}
public List eventRequestSpecs() {
public List<EventRequestSpec> eventRequestSpecs() {
return specList.eventRequestSpecs();
}
}
......@@ -82,9 +82,7 @@ class JDIEventSource extends Thread {
boolean interrupted = es.suspendedAll();
es.notify(firstListener);
boolean wantInterrupt = JDIEventSource.this.wantInterrupt;
for (Iterator it = session.runtime.jdiListeners.iterator();
it.hasNext(); ) {
JDIListener jl = (JDIListener)it.next();
for (JDIListener jl : session.runtime.jdiListeners) {
es.notify(jl);
}
if (interrupted && !wantInterrupt) {
......
......@@ -58,12 +58,12 @@ public class LineBreakpointSpec extends BreakpointSpec {
LineNotFoundException {
Location location = null;
try {
List locs = clazz.locationsOfLine(lineNumber());
List<Location> locs = clazz.locationsOfLine(lineNumber());
if (locs.size() == 0) {
throw new LineNotFoundException();
}
// TODO handle multiple locations
location = (Location)locs.get(0);
location = locs.get(0);
if (location.method() == null) {
throw new LineNotFoundException();
}
......
......@@ -34,11 +34,11 @@ import java.util.Iterator;
public class MethodBreakpointSpec extends BreakpointSpec {
String methodId;
List methodArgs;
List<String> methodArgs;
MethodBreakpointSpec(EventRequestSpecList specs,
ReferenceTypeSpec refSpec,
String methodId, List methodArgs) {
String methodId, List<String> methodArgs) {
super(specs, refSpec);
this.methodId = methodId;
this.methodArgs = methodArgs;
......@@ -76,7 +76,7 @@ public class MethodBreakpointSpec extends BreakpointSpec {
return methodId;
}
public List methodArgs() {
public List<String> methodArgs() {
return methodArgs;
}
......@@ -120,14 +120,13 @@ public class MethodBreakpointSpec extends BreakpointSpec {
buffer.append('.');
buffer.append(methodId);
if (methodArgs != null) {
Iterator iter = methodArgs.iterator();
boolean first = true;
buffer.append('(');
while (iter.hasNext()) {
for (String name : methodArgs) {
if (!first) {
buffer.append(',');
}
buffer.append((String)iter.next());
buffer.append(name);
first = false;
}
buffer.append(")");
......@@ -151,8 +150,8 @@ public class MethodBreakpointSpec extends BreakpointSpec {
* and if the number of arguments in the method matches the
* number of names passed
*/
private boolean compareArgTypes(Method method, List nameList) {
List argTypeNames = method.argumentTypeNames();
private boolean compareArgTypes(Method method, List<String> nameList) {
List<String> argTypeNames = method.argumentTypeNames();
// If argument counts differ, we can stop here
if (argTypeNames.size() != nameList.size()) {
......@@ -162,8 +161,8 @@ public class MethodBreakpointSpec extends BreakpointSpec {
// Compare each argument type's name
int nTypes = argTypeNames.size();
for (int i = 0; i < nTypes; ++i) {
String comp1 = (String)argTypeNames.get(i);
String comp2 = (String)nameList.get(i);
String comp1 = argTypeNames.get(i);
String comp2 = nameList.get(i);
if (! comp1.equals(comp2)) {
/*
* We have to handle varargs. EG, the
......@@ -288,22 +287,17 @@ public class MethodBreakpointSpec extends BreakpointSpec {
List<String> argTypeNames = null;
if (methodArgs() != null) {
argTypeNames = new ArrayList<String>(methodArgs().size());
Iterator iter = methodArgs().iterator();
while (iter.hasNext()) {
String name = (String)iter.next();
for (String name : methodArgs()) {
name = normalizeArgTypeName(name);
argTypeNames.add(name);
}
}
// Check each method in the class for matches
Iterator iter = clazz.methods().iterator();
Method firstMatch = null; // first method with matching name
Method exactMatch = null; // (only) method with same name & sig
int matchCount = 0; // > 1 implies overload
while (iter.hasNext()) {
Method candidate = (Method)iter.next();
for (Method candidate : clazz.methods()) {
if (candidate.name().equals(methodName())) {
matchCount++;
......
......@@ -36,7 +36,7 @@ import java.util.Iterator;
* Descend the tree of thread groups.
* @author Robert G. Field
*/
public class ThreadGroupIterator implements Iterator {
public class ThreadGroupIterator implements Iterator<ThreadGroupReference> {
private final Stack<Iterator<ThreadGroupReference>> stack
= new Stack<Iterator<ThreadGroupReference>>();
......@@ -56,8 +56,8 @@ public class ThreadGroupIterator implements Iterator {
}
*/
private Iterator top() {
return (Iterator)stack.peek();
private Iterator<ThreadGroupReference> top() {
return stack.peek();
}
/**
......@@ -77,12 +77,12 @@ public class ThreadGroupIterator implements Iterator {
return !stack.isEmpty();
}
public Object next() {
public ThreadGroupReference next() {
return nextThreadGroup();
}
public ThreadGroupReference nextThreadGroup() {
ThreadGroupReference tg = (ThreadGroupReference)top().next();
ThreadGroupReference tg = top().next();
push(tg.threadGroups());
return tg;
}
......
......@@ -30,8 +30,8 @@ import com.sun.jdi.ThreadReference;
import java.util.List;
import java.util.Iterator;
public class ThreadIterator implements Iterator {
Iterator it = null;
public class ThreadIterator implements Iterator<ThreadReference> {
Iterator<ThreadReference> it = null;
ThreadGroupIterator tgi;
public ThreadIterator(ThreadGroupReference tg) {
......@@ -53,12 +53,12 @@ public class ThreadIterator implements Iterator {
return true;
}
public Object next() {
public ThreadReference next() {
return it.next();
}
public ThreadReference nextThread() {
return (ThreadReference)next();
return next();
}
public void remove() {
......
......@@ -191,11 +191,12 @@ abstract class LValue {
return field;
}
static List methodsByName(ReferenceType refType, String name, int kind) {
List list = refType.methodsByName(name);
Iterator iter = list.iterator();
static List<Method> methodsByName(ReferenceType refType,
String name, int kind) {
List<Method> list = refType.methodsByName(name);
Iterator<Method> iter = list.iterator();
while (iter.hasNext()) {
Method method = (Method)iter.next();
Method method = iter.next();
boolean isStatic = method.isStatic();
if (((kind == STATIC) && !isStatic) ||
((kind == INSTANCE) && isStatic)) {
......@@ -231,21 +232,21 @@ abstract class LValue {
* argType is not assignable from the type of the argument value.
* 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()) {
return DIFFERENT;
}
Iterator typeIter = argTypes.iterator();
Iterator valIter = arguments.iterator();
Iterator<Type> typeIter = argTypes.iterator();
Iterator<Value> valIter = arguments.iterator();
int result = SAME;
// If any pair aren't the same, change the
// result to ASSIGNABLE. If any pair aren't
// assignable, return DIFFERENT
while (typeIter.hasNext()) {
Type argType = (Type)typeIter.next();
Value value = (Value)valIter.next();
Type argType = typeIter.next();
Value value = valIter.next();
if (value == null) {
// Null values can be passed to any non-primitive argument
if (primitiveTypeNames.contains(argType.name())) {
......@@ -333,7 +334,7 @@ abstract class LValue {
if (fromType instanceof ArrayType) {
return isArrayAssignableTo((ArrayType)fromType, toType);
}
List interfaces;
List<InterfaceType> interfaces;
if (fromType instanceof ClassType) {
ClassType superclazz = ((ClassType)fromType).superclass();
if ((superclazz != null) && isAssignableTo(superclazz, toType)) {
......@@ -344,9 +345,7 @@ abstract class LValue {
// fromType must be an InterfaceType
interfaces = ((InterfaceType)fromType).superinterfaces();
}
Iterator iter = interfaces.iterator();
while (iter.hasNext()) {
InterfaceType interfaze = (InterfaceType)iter.next();
for (InterfaceType interfaze : interfaces) {
if (isAssignableTo(interfaze, toType)) {
return true;
}
......@@ -354,7 +353,8 @@ abstract class LValue {
return false;
}
static Method resolveOverload(List overloads, List arguments)
static Method resolveOverload(List<Method> overloads,
List<Value> arguments)
throws ParseException {
// 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
// could generate here.
if (overloads.size() == 1) {
return (Method)overloads.get(0);
return overloads.get(0);
}
// 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,
// the user can't use them to pick a particular overload to call.
// IE, the user is out of luck in this case.
Iterator iter = overloads.iterator();
Method retVal = null;
int assignableCount = 0;
while (iter.hasNext()) {
Method mm = (Method)iter.next();
List argTypes;
for (Method mm : overloads) {
List<Type> argTypes;
try {
argTypes = mm.argumentTypes();
} catch (ClassNotLoadedException ee) {
......@@ -443,7 +441,7 @@ abstract class LValue {
final ObjectReference obj;
final ThreadReference thread;
final Field matchingField;
final List overloads;
final List<Method> overloads;
Method matchingMethod = null;
List<Value> methodArguments = null;
......@@ -510,7 +508,7 @@ abstract class LValue {
final ReferenceType refType;
final ThreadReference thread;
final Field matchingField;
final List overloads;
final List<Method> overloads;
Method matchingMethod = null;
List<Value> methodArguments = null;
......@@ -765,7 +763,7 @@ abstract class LValue {
static LValue makeNewObject(VirtualMachine vm,
ExpressionParser.GetFrame frameGetter,
String className, List<Value> arguments) throws ParseException {
List classes = vm.classesByName(className);
List<ReferenceType> classes = vm.classesByName(className);
if (classes.size() == 0) {
throw new ParseException("No class named: " + className);
}
......@@ -774,7 +772,7 @@ abstract class LValue {
throw new ParseException("More than one class named: " +
className);
}
ReferenceType refType = (ReferenceType)classes.get(0);
ReferenceType refType = classes.get(0);
if (!(refType instanceof ClassType)) {
......@@ -784,9 +782,9 @@ abstract class LValue {
ClassType classType = (ClassType)refType;
List<Method> methods = new ArrayList<Method>(classType.methods()); // writable
Iterator iter = methods.iterator();
Iterator<Method> iter = methods.iterator();
while (iter.hasNext()) {
Method method = (Method)iter.next();
Method method = iter.next();
if (!method.isConstructor()) {
iter.remove();
}
......@@ -858,13 +856,13 @@ abstract class LValue {
}
// check for class name
while (izer.hasMoreTokens()) {
List classes = vm.classesByName(first);
List<ReferenceType> classes = vm.classesByName(first);
if (classes.size() > 0) {
if (classes.size() > 1) {
throw new ParseException("More than one class named: " +
first);
} else {
ReferenceType refType = (ReferenceType)classes.get(0);
ReferenceType refType = classes.get(0);
LValue lval = new LValueStaticMember(refType,
izer.nextToken(), thread);
return nFields(lval, izer, thread);
......
......@@ -124,9 +124,7 @@ public class ClassTreeTool extends JPanel {
public void sessionStart(EventObject e) {
// Get system classes and any others loaded before attaching.
try {
Iterator iter = runtime.allClasses().iterator();
while (iter.hasNext()) {
ReferenceType type = ((ReferenceType)iter.next());
for (ReferenceType type : runtime.allClasses()) {
root.addClass(type);
}
} catch (VMDisconnectedException ee) {
......
......@@ -77,7 +77,7 @@ public class CommandInterpreter {
while (ti.hasNext()) {
tlist.add(ti.nextThread());
}
threads = (ThreadReference[])tlist.toArray(new ThreadReference[tlist.size()]);
threads = tlist.toArray(new ThreadReference[tlist.size()]);
}
return threads;
}
......@@ -146,11 +146,9 @@ public class CommandInterpreter {
// Command: classes
private void commandClasses() throws NoSessionException {
List list = runtime.allClasses();
OutputSink out = env.getOutputSink();
//out.println("** classes list **");
for (int i = 0 ; i < list.size() ; i++) {
ReferenceType refType = (ReferenceType)list.get(i);
for (ReferenceType refType : runtime.allClasses()) {
out.println(refType.name());
}
out.show();
......@@ -167,16 +165,16 @@ public class CommandInterpreter {
String idClass = t.nextToken();
ReferenceType cls = findClass(idClass);
if (cls != null) {
List methods = cls.allMethods();
List<Method> methods = cls.allMethods();
OutputSink out = env.getOutputSink();
for (int i = 0; i < methods.size(); i++) {
Method method = (Method)methods.get(i);
Method method = methods.get(i);
out.print(method.declaringType().name() + " " +
method.name() + "(");
Iterator it = method.argumentTypeNames().iterator();
Iterator<String> it = method.argumentTypeNames().iterator();
if (it.hasNext()) {
while (true) {
out.print((String)it.next());
out.print(it.next());
if (!it.hasNext()) {
break;
}
......@@ -193,10 +191,10 @@ public class CommandInterpreter {
}
private ReferenceType findClass(String pattern) throws NoSessionException {
List results = runtime.findClassesMatchingPattern(pattern);
List<ReferenceType> results = runtime.findClassesMatchingPattern(pattern);
if (results.size() > 0) {
//### Should handle multiple results sensibly.
return (ReferenceType)results.get(0);
return results.get(0);
}
return null;
}
......@@ -235,11 +233,11 @@ public class CommandInterpreter {
private int printThreadGroup(OutputSink out, ThreadGroupReference tg, int iThread) {
out.println("Group " + tg.name() + ":");
List tlist = tg.threads();
List<ThreadReference> tlist = tg.threads();
int maxId = 0;
int maxName = 0;
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();
if (len > maxId)
maxId = len;
......@@ -254,7 +252,7 @@ public class CommandInterpreter {
String maxNumString = String.valueOf(iThread + tlist.size());
int maxNumDigits = maxNumString.length();
for (int i = 0 ; i < tlist.size() ; i++) {
ThreadReference thr = (ThreadReference)tlist.get(i);
ThreadReference thr = tlist.get(i);
char buf[] = new char[80];
for (int j = 0; j < 79; j++) {
buf[j] = ' ';
......@@ -283,9 +281,7 @@ public class CommandInterpreter {
sbOut.setLength(79);
out.println(sbOut.toString());
}
List tglist = tg.threadGroups();
for (int ig = 0; ig < tglist.size(); ig++) {
ThreadGroupReference tg0 = (ThreadGroupReference)tglist.get(ig);
for (ThreadGroupReference tg0 : tg.threadGroups()) {
if (!tg.equals(tg0)) { // TODO ref mgt
iThread += printThreadGroup(out, tg0, iThread + tlist.size());
}
......@@ -733,7 +729,7 @@ public class CommandInterpreter {
if (token.toLowerCase().equals("all")) {
ThreadIterator it = allThreads();
while (it.hasNext()) {
ThreadReference thread = (ThreadReference)it.next();
ThreadReference thread = it.next();
out.println(thread.name() + ": ");
dumpStack(thread, showPC);
}
......@@ -755,7 +751,7 @@ public class CommandInterpreter {
//env.failure("Target VM must be in interrupted state.");
//env.failure("Current thread isn't suspended.");
//### Should handle extremely long stack traces sensibly for user.
List stack = null;
List<StackFrame> stack = null;
try {
stack = thread.frames();
} catch (IncompatibleThreadStateException e) {
......@@ -772,7 +768,7 @@ public class CommandInterpreter {
OutputSink out = env.getOutputSink();
int nFrames = stack.size();
for (int i = frameIndex; i < nFrames; i++) {
StackFrame frame = (StackFrame)stack.get(i);
StackFrame frame = stack.get(i);
Location loc = frame.location();
Method meth = loc.method();
out.print(" [" + (i + 1) + "] ");
......@@ -780,7 +776,7 @@ public class CommandInterpreter {
out.print('.');
out.print(meth.name());
out.print(" (");
if (meth instanceof Method && ((Method)meth).isNative()) {
if (meth.isNative()) {
out.print("native method");
} else if (loc.lineNumber() != -1) {
try {
......@@ -806,14 +802,13 @@ public class CommandInterpreter {
private void listEventRequests() throws NoSessionException {
// Print set breakpoints
Iterator iter = runtime.eventRequestSpecs().iterator();
if (!iter.hasNext()) {
List<EventRequestSpec> specs = runtime.eventRequestSpecs();
if (specs.isEmpty()) {
env.notice("No breakpoints/watchpoints/exceptions set.");
} else {
OutputSink out = env.getOutputSink();
out.println("Current breakpoints/watchpoints/exceptions set:");
while (iter.hasNext()) {
EventRequestSpec bp = (EventRequestSpec)iter.next();
for (EventRequestSpec bp : specs) {
out.println("\t" + bp);
}
out.show();
......@@ -926,13 +921,13 @@ public class CommandInterpreter {
//### need 'clear all'
BreakpointSpec bpSpec = parseBreakpointSpec(t.nextToken());
if (bpSpec != null) {
Iterator iter = runtime.eventRequestSpecs().iterator();
if (!iter.hasNext()) {
List<EventRequestSpec> specs = runtime.eventRequestSpecs();
if (specs.isEmpty()) {
env.notice("No breakpoints set.");
} else {
List<BreakpointSpec> toDelete = new ArrayList<BreakpointSpec>();
while (iter.hasNext()) {
BreakpointSpec spec = (BreakpointSpec)iter.next();
List<EventRequestSpec> toDelete = new ArrayList<EventRequestSpec>();
for (EventRequestSpec spec : specs) {
if (spec.equals(bpSpec)) {
toDelete.add(spec);
}
......@@ -941,7 +936,7 @@ public class CommandInterpreter {
if (toDelete.size() <= 1) {
env.notice("No matching breakpoint set.");
}
for (BreakpointSpec spec : toDelete) {
for (EventRequestSpec spec : toDelete) {
runtime.delete(spec);
}
}
......@@ -988,7 +983,7 @@ public class CommandInterpreter {
lineno = Integer.valueOf(id).intValue();
} catch (NumberFormatException nfe) {
// 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) {
env.failure(id +
" is not a valid line number or " +
......@@ -1001,7 +996,7 @@ public class CommandInterpreter {
refType.name());
return;
}
loc = ((Method)meths.get(0)).location();
loc = meths.get(0).location();
lineno = loc.lineNumber();
}
}
......@@ -1121,7 +1116,7 @@ public class CommandInterpreter {
return;
}
List vars;
List<LocalVariable> vars;
try {
vars = frame.visibleVariables();
if (vars == null || vars.size() == 0) {
......@@ -1136,15 +1131,13 @@ public class CommandInterpreter {
OutputSink out = env.getOutputSink();
out.println("Method arguments:");
for (Iterator it = vars.iterator(); it.hasNext(); ) {
LocalVariable var = (LocalVariable)it.next();
for (LocalVariable var : vars) {
if (var.isArgument()) {
printVar(out, var, frame);
}
}
out.println("Local variables:");
for (Iterator it = vars.iterator(); it.hasNext(); ) {
LocalVariable var = (LocalVariable)it.next();
for (LocalVariable var : vars) {
if (!var.isArgument()) {
printVar(out, var, frame);
}
......@@ -1245,8 +1238,7 @@ public class CommandInterpreter {
private void dump(OutputSink out,
ObjectReference obj, ReferenceType refType,
ReferenceType refTypeBase) {
for (Iterator it = refType.fields().iterator(); it.hasNext(); ) {
Field field = (Field)it.next();
for (Field field : refType.fields()) {
out.print(" ");
if (!refType.equals(refTypeBase)) {
out.print(refType.name() + ".");
......@@ -1261,9 +1253,8 @@ public class CommandInterpreter {
dump(out, obj, sup, refTypeBase);
}
} else if (refType instanceof InterfaceType) {
List sups = ((InterfaceType)refType).superinterfaces();
for (Iterator it = sups.iterator(); it.hasNext(); ) {
dump(out, obj, (ReferenceType)it.next(), refTypeBase);
for (InterfaceType sup : ((InterfaceType)refType).superinterfaces()) {
dump(out, obj, sup, refTypeBase);
}
}
}
......
......@@ -201,11 +201,11 @@ public class JDBFileFilter extends FileFilter {
if(description == null || isExtensionListInDescription()) {
fullDescription = description==null ? "(" : description + " (";
// build the description from the extension list
Enumeration extensions = filters.keys();
Enumeration<String> extensions = filters.keys();
if(extensions != null) {
fullDescription += "." + (String) extensions.nextElement();
fullDescription += "." + extensions.nextElement();
while (extensions.hasMoreElements()) {
fullDescription += ", " + (String) extensions.nextElement();
fullDescription += ", " + extensions.nextElement();
}
}
fullDescription += ")";
......
......@@ -131,14 +131,13 @@ class LaunchTool {
final JPanel radioPanel = new JPanel();
final ButtonGroup radioGroup = new ButtonGroup();
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);
dialog.setModal(true);
dialog.setTitle("Select Connector Type");
radioPanel.setLayout(new BoxLayout(radioPanel, BoxLayout.Y_AXIS));
for (Iterator it = all.iterator(); it.hasNext(); ) {
Connector connector = (Connector)it.next();
for (Connector connector : all) {
JRadioButton radio = new JRadioButton(connector.description());
modelToConnector.put(radio.getModel(), connector);
radioPanel.add(radio);
......@@ -166,7 +165,7 @@ class LaunchTool {
dialog.show();
return oked[0] ?
(Connector)(modelToConnector.get(radioGroup.getSelection())) :
modelToConnector.get(radioGroup.getSelection()) :
null;
}
......@@ -188,13 +187,12 @@ class LaunchTool {
// guts.add(new JLabel(connector.description()));
final List<ArgRep> argReps = new ArrayList<ArgRep>(args.size());
for (Iterator it = args.values().iterator(); it.hasNext(); ) {
Object arg = it.next();
for (Connector.Argument arg : args.values()) {
ArgRep ar;
if (arg instanceof Connector.BooleanArgument) {
ar = new BooleanArgRep((Connector.BooleanArgument)arg, guts);
} else {
ar = new StringArgRep((Connector.Argument)arg, guts);
ar = new StringArgRep(arg, guts);
}
argReps.add(ar);
}
......@@ -202,8 +200,7 @@ class LaunchTool {
JPanel buttonPanel = okCancel( dialog, new ActionListener() {
public void actionPerformed(ActionEvent event) {
for (Iterator it = argReps.iterator(); it.hasNext(); ) {
ArgRep ar = (ArgRep)it.next();
for (ArgRep ar : argReps) {
if (!ar.isSpecified()) {
JOptionPane.showMessageDialog(dialog,
ar.arg.label() +
......
......@@ -42,7 +42,7 @@ public class SearchPath {
dlist.add(st.nextToken());
}
pathString = searchPath;
pathArray = (String[])dlist.toArray(new String[dlist.size()]);
pathArray = dlist.toArray(new String[dlist.size()]);
}
public boolean isEmpty() {
......@@ -54,7 +54,7 @@ public class SearchPath {
}
public String[] asArray() {
return (String[])pathArray.clone();
return pathArray.clone();
}
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()]);
}
}
......@@ -113,7 +113,7 @@ public class SourceManager {
* Returns null if not available.
*/
public SourceModel sourceForClass(ReferenceType refType) {
SourceModel sm = (SourceModel)classToSource.get(refType);
SourceModel sm = classToSource.get(refType);
if (sm != null) {
return sm;
}
......@@ -140,10 +140,10 @@ public class SourceManager {
*/
//### Use hash table for this?
public SourceModel sourceForFile(File path) {
Iterator iter = sourceList.iterator();
Iterator<SourceModel> iter = sourceList.iterator();
SourceModel sm = null;
while (iter.hasNext()) {
SourceModel candidate = (SourceModel)iter.next();
SourceModel candidate = iter.next();
if (candidate.fileName().equals(path)) {
sm = candidate;
iter.remove(); // Will move to start of list.
......
......@@ -187,22 +187,17 @@ public class SourceModel extends AbstractListModel {
* when sourceLines is set.
*/
private void markClassLines(ReferenceType refType) {
List methods = refType.methods();
for (Iterator mit = methods.iterator(); mit.hasNext();) {
Method meth = (Method)mit.next();
for (Method meth : refType.methods()) {
try {
List lines = meth.allLineLocations();
for (Iterator lit = lines.iterator(); lit.hasNext();) {
Location loc = (Location)lit.next();
for (Location loc : meth.allLineLocations()) {
showExecutable(loc.lineNumber(), refType);
}
} catch (AbsentInformationException exc) {
// do nothing
}
}
List bps = env.getExecutionManager().eventRequestManager().breakpointRequests();
for (Iterator it = bps.iterator(); it.hasNext();) {
BreakpointRequest bp = (BreakpointRequest)it.next();
for (BreakpointRequest bp :
env.getExecutionManager().eventRequestManager().breakpointRequests()) {
if (bp.location() != null) {
Location loc = bp.location();
if (loc.declaringType().equals(refType)) {
......@@ -224,8 +219,8 @@ public class SourceModel extends AbstractListModel {
} finally {
reader.close();
}
for (Iterator it = classes.iterator(); it.hasNext();) {
markClassLines((ClassType)it.next());
for (ReferenceType refType : classes) {
markClassLines(refType);
}
}
......
......@@ -139,7 +139,7 @@ public class StackTraceTool extends JPanel {
String methName =
meth.declaringType().name() + '.' + meth.name();
String position = "";
if (meth instanceof Method && ((Method)meth).isNative()) {
if (meth.isNative()) {
position = " (native method)";
} else if (loc.lineNumber() != -1) {
position = ":" + loc.lineNumber();
......
......@@ -133,9 +133,7 @@ public class ThreadTreeTool extends JPanel {
public void sessionStart(EventObject e) {
try {
Iterator iter = runtime.allThreads().iterator();
while (iter.hasNext()) {
ThreadReference thread = ((ThreadReference)iter.next());
for (ThreadReference thread : runtime.allThreads()) {
root.addThread(thread);
}
} 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();
if (size == 0) {
return;
} else if (size == 1) {
String name = (String)threadPath.get(0);
String name = threadPath.get(0);
insertNode(name, thread);
} else {
String head = (String)threadPath.get(0);
List tail = threadPath.subList(1, size);
String head = threadPath.get(0);
List<String> tail = threadPath.subList(1, size);
ThreadTreeNode child = insertNode(head, null);
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();
if (size == 0) {
return;
} else if (size == 1) {
String name = (String)threadPath.get(0);
String name = threadPath.get(0);
ThreadTreeNode child = findLeafNode(thread, name);
treeModel.removeNodeFromParent(child);
} else {
String head = (String)threadPath.get(0);
List tail = threadPath.subList(1, size);
String head = threadPath.get(0);
List<String> tail = threadPath.subList(1, size);
ThreadTreeNode child = findInternalNode(head);
child.removeThread(tail, thread);
if (child.isThreadGroup() && child.getChildCount() < 1) {
......
......@@ -34,7 +34,7 @@ import java.util.Iterator;
class BreakpointSpec extends EventRequestSpec {
String methodId;
List methodArgs;
List<String> methodArgs;
int lineNumber;
BreakpointSpec(ReferenceTypeSpec refSpec, int lineNumber) {
......@@ -45,7 +45,7 @@ class BreakpointSpec extends EventRequestSpec {
}
BreakpointSpec(ReferenceTypeSpec refSpec, String methodId,
List methodArgs) throws MalformedMemberNameException {
List<String> methodArgs) throws MalformedMemberNameException {
super(refSpec);
this.methodId = methodId;
this.methodArgs = methodArgs;
......@@ -83,7 +83,7 @@ class BreakpointSpec extends EventRequestSpec {
return lineNumber;
}
List methodArgs() {
List<String> methodArgs() {
return methodArgs;
}
......@@ -146,14 +146,13 @@ class BreakpointSpec extends EventRequestSpec {
buffer.append('.');
buffer.append(methodId);
if (methodArgs != null) {
Iterator iter = methodArgs.iterator();
boolean first = true;
buffer.append('(');
while (iter.hasNext()) {
for (String arg : methodArgs) {
if (!first) {
buffer.append(',');
}
buffer.append((String)iter.next());
buffer.append(arg);
first = false;
}
buffer.append(")");
......@@ -176,12 +175,12 @@ class BreakpointSpec extends EventRequestSpec {
location = method.location();
} else {
// let AbsentInformationException be thrown
List locs = refType.locationsOfLine(lineNumber());
List<Location> locs = refType.locationsOfLine(lineNumber());
if (locs.size() == 0) {
throw new LineNotFoundException();
}
// TO DO: handle multiple locations
location = (Location)locs.get(0);
location = locs.get(0);
if (location.method() == null) {
throw new LineNotFoundException();
}
......@@ -202,8 +201,8 @@ class BreakpointSpec extends EventRequestSpec {
* and if the number of arguments in the method matches the
* number of names passed
*/
private boolean compareArgTypes(Method method, List nameList) {
List argTypeNames = method.argumentTypeNames();
private boolean compareArgTypes(Method method, List<String> nameList) {
List<String> argTypeNames = method.argumentTypeNames();
// If argument counts differ, we can stop here
if (argTypeNames.size() != nameList.size()) {
......@@ -213,8 +212,8 @@ class BreakpointSpec extends EventRequestSpec {
// Compare each argument type's name
int nTypes = argTypeNames.size();
for (int i = 0; i < nTypes; ++i) {
String comp1 = (String)argTypeNames.get(i);
String comp2 = (String)nameList.get(i);
String comp1 = argTypeNames.get(i);
String comp2 = nameList.get(i);
if (! comp1.equals(comp2)) {
/*
* We have to handle varargs. EG, the
......@@ -331,22 +330,17 @@ class BreakpointSpec extends EventRequestSpec {
List<String> argTypeNames = null;
if (methodArgs() != null) {
argTypeNames = new ArrayList<String>(methodArgs().size());
Iterator iter = methodArgs().iterator();
while (iter.hasNext()) {
String name = (String)iter.next();
for (String name : methodArgs()) {
name = normalizeArgTypeName(name);
argTypeNames.add(name);
}
}
// Check each method in the class for matches
Iterator iter = refType.methods().iterator();
Method firstMatch = null; // first method with matching name
Method exactMatch = null; // (only) method with same name & sig
int matchCount = 0; // > 1 implies overload
while (iter.hasNext()) {
Method candidate = (Method)iter.next();
for (Method candidate : refType.methods()) {
if (candidate.name().equals(methodName())) {
matchCount++;
......
......@@ -89,7 +89,7 @@ class Env {
sourceCache.clear();
}
static void setSourcePath(List srcList) {
static void setSourcePath(List<String> srcList) {
sourceMapper = new SourceMapper(srcList);
sourceCache.clear();
}
......@@ -106,10 +106,8 @@ class Env {
}
static String excludesString() {
Iterator iter = excludes().iterator();
StringBuffer buffer = new StringBuffer();
while (iter.hasNext()) {
String pattern = (String)iter.next();
for (String pattern : excludes()) {
buffer.append(pattern);
buffer.append(",");
}
......@@ -117,25 +115,19 @@ class Env {
}
static void addExcludes(StepRequest request) {
Iterator iter = excludes().iterator();
while (iter.hasNext()) {
String pattern = (String)iter.next();
for (String pattern : excludes()) {
request.addClassExclusionFilter(pattern);
}
}
static void addExcludes(MethodEntryRequest request) {
Iterator iter = excludes().iterator();
while (iter.hasNext()) {
String pattern = (String)iter.next();
for (String pattern : excludes()) {
request.addClassExclusionFilter(pattern);
}
}
static void addExcludes(MethodExitRequest request) {
Iterator iter = excludes().iterator();
while (iter.hasNext()) {
String pattern = (String)iter.next();
for (String pattern : excludes()) {
request.addClassExclusionFilter(pattern);
}
}
......@@ -175,10 +167,10 @@ class Env {
try {
String fileName = location.sourceName();
Iterator iter = sourceCache.iterator();
Iterator<SourceCode> iter = sourceCache.iterator();
SourceCode code = null;
while (iter.hasNext()) {
SourceCode candidate = (SourceCode)iter.next();
SourceCode candidate = iter.next();
if (candidate.fileName().equals(fileName)) {
code = candidate;
iter.remove();
......@@ -269,10 +261,7 @@ class Env {
// loaded class whose name matches this limited regular
// expression is selected.
idToken = idToken.substring(1);
List classes = Env.vm().allClasses();
Iterator iter = classes.iterator();
while (iter.hasNext()) {
ReferenceType type = ((ReferenceType)iter.next());
for (ReferenceType type : Env.vm().allClasses()) {
if (type.name().endsWith(idToken)) {
cls = type;
break;
......@@ -280,21 +269,21 @@ class Env {
}
} else {
// It's a class name
List classes = Env.vm().classesByName(idToken);
List<ReferenceType> classes = Env.vm().classesByName(idToken);
if (classes.size() > 0) {
// TO DO: handle multiples
cls = (ReferenceType)classes.get(0);
cls = classes.get(0);
}
}
return cls;
}
static Set getSaveKeys() {
static Set<String> getSaveKeys() {
return savedValues.keySet();
}
static Value getSavedValue(String key) {
return (Value)savedValues.get(key);
return savedValues.get(key);
}
static void setSavedValue(String key, Value value) {
......@@ -327,7 +316,7 @@ class Env {
if (index >= sourceLines.size()) {
return null;
} else {
return (String)sourceLines.get(index);
return sourceLines.get(index);
}
}
}
......
......@@ -150,7 +150,7 @@ public class EventHandler implements Runnable {
EventSet eventSet = queue.remove();
EventIterator iter = eventSet.eventIterator();
while (iter.hasNext()) {
handleExitEvent((Event)iter.next());
handleExitEvent(iter.next());
}
} catch (InterruptedException exc) {
// ignore
......@@ -183,7 +183,7 @@ public class EventHandler implements Runnable {
* If any event in the set has a thread associated with it,
* 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);
} else {
thread = null;
......
......@@ -101,10 +101,8 @@ abstract class EventRequestSpec {
* so that is all we need to examine.
*/
ArrayList<ExceptionRequest> deleteList = new ArrayList<ExceptionRequest>();
Iterator iter =
Env.vm().eventRequestManager().exceptionRequests().iterator();
while (iter.hasNext()) {
ExceptionRequest er = (ExceptionRequest)iter.next();
for (ExceptionRequest er :
Env.vm().eventRequestManager().exceptionRequests()) {
if (prs.matches(er.exception())) {
deleteList.add (er);
}
......@@ -115,9 +113,7 @@ abstract class EventRequestSpec {
}
private EventRequest resolveAgainstPreparedClasses() throws Exception {
Iterator iter = Env.vm().allClasses().iterator();
while (iter.hasNext()) {
ReferenceType refType = (ReferenceType)iter.next();
for (ReferenceType refType : Env.vm().allClasses()) {
if (refType.isPrepared() && refSpec.matches(refType)) {
resolved = resolveEventRequest(refType);
}
......
......@@ -55,9 +55,7 @@ class EventRequestSpecList {
boolean resolve(ClassPrepareEvent event) {
boolean failure = false;
synchronized(eventRequestSpecs) {
Iterator iter = eventRequestSpecs.iterator();
while (iter.hasNext()) {
EventRequestSpec spec = (EventRequestSpec)iter.next();
for (EventRequestSpec spec : eventRequestSpecs) {
if (!spec.isResolved()) {
try {
EventRequest eventRequest = spec.resolve(event);
......@@ -77,9 +75,7 @@ class EventRequestSpecList {
}
void resolveAll() {
Iterator iter = eventRequestSpecs.iterator();
while (iter.hasNext()) {
EventRequestSpec spec = (EventRequestSpec)iter.next();
for (EventRequestSpec spec : eventRequestSpecs) {
try {
EventRequest eventRequest = spec.resolveEagerly();
if (eventRequest != null) {
......@@ -106,16 +102,16 @@ class EventRequestSpecList {
}
}
EventRequestSpec createBreakpoint(String classPattern,
int line) throws ClassNotFoundException {
BreakpointSpec createBreakpoint(String classPattern, int line)
throws ClassNotFoundException {
ReferenceTypeSpec refSpec =
new PatternReferenceTypeSpec(classPattern);
return new BreakpointSpec(refSpec, line);
}
EventRequestSpec createBreakpoint(String classPattern,
BreakpointSpec createBreakpoint(String classPattern,
String methodId,
List methodArgs)
List<String> methodArgs)
throws MalformedMemberNameException,
ClassNotFoundException {
ReferenceTypeSpec refSpec =
......@@ -132,7 +128,7 @@ class EventRequestSpecList {
return new ExceptionSpec(refSpec, notifyCaught, notifyUncaught);
}
EventRequestSpec createAccessWatchpoint(String classPattern,
WatchpointSpec createAccessWatchpoint(String classPattern,
String fieldId)
throws MalformedMemberNameException,
ClassNotFoundException {
......@@ -141,7 +137,7 @@ class EventRequestSpecList {
return new AccessWatchpointSpec(refSpec, fieldId);
}
EventRequestSpec createModificationWatchpoint(String classPattern,
WatchpointSpec createModificationWatchpoint(String classPattern,
String fieldId)
throws MalformedMemberNameException,
ClassNotFoundException {
......@@ -154,7 +150,7 @@ class EventRequestSpecList {
synchronized (eventRequestSpecs) {
int inx = eventRequestSpecs.indexOf(proto);
if (inx != -1) {
EventRequestSpec spec = (EventRequestSpec)eventRequestSpecs.get(inx);
EventRequestSpec spec = eventRequestSpecs.get(inx);
spec.remove();
eventRequestSpecs.remove(inx);
return true;
......
......@@ -39,15 +39,13 @@ class SourceMapper {
private final String[] dirs;
SourceMapper(List sourcepath) {
SourceMapper(List<String> sourcepath) {
/*
* sourcepath can arrive from the debugee as a List.
* (via PathSearchingVirtualMachine.classPath())
*/
List<String> dirList = new ArrayList<String>();
Iterator iter = sourcepath.iterator();
while (iter.hasNext()) {
String element = (String)iter.next();
for (String element : sourcepath) {
//XXX remove .jar and .zip files; we want only directories on
//the source path. (Bug ID 4186582)
if ( ! (element.endsWith(".jar") ||
......@@ -55,7 +53,7 @@ class SourceMapper {
dirList.add(element);
}
}
dirs = (String[])dirList.toArray(new String[0]);
dirs = dirList.toArray(new String[0]);
}
SourceMapper(String sourcepath) {
......@@ -79,7 +77,7 @@ class SourceMapper {
dirList.add(s);
}
}
dirs = (String[])dirList.toArray(new String[0]);
dirs = dirList.toArray(new String[0]);
}
/*
......
......@@ -160,9 +160,7 @@ public class TTY implements EventNotifier {
// here the next time.
Env.setAtExitMethod(null);
EventRequestManager erm = Env.vm().eventRequestManager();
Iterator it = erm.methodExitRequests().iterator();
while (it.hasNext()) {
EventRequest eReq = (EventRequest)it.next();
for (EventRequest eReq : erm.methodExitRequests()) {
if (eReq.equals(me.request())) {
eReq.disable();
}
......@@ -178,9 +176,8 @@ public class TTY implements EventNotifier {
public void vmInterrupted() {
Thread.yield(); // fetch output
printCurrentLocation();
Iterator it = monitorCommands.iterator();
while (it.hasNext()) {
StringTokenizer t = new StringTokenizer((String)it.next());
for (String cmd : monitorCommands) {
StringTokenizer t = new StringTokenizer(cmd);
t.nextToken(); // get rid of monitor number
executeCommand(t);
}
......@@ -563,9 +560,8 @@ public class TTY implements EventNotifier {
++monitorCount;
monitorCommands.add(monitorCount + ": " + t.nextToken(""));
} else {
Iterator it = monitorCommands.iterator();
while (it.hasNext()) {
MessageOutput.printDirectln((String)it.next());// Special case: use printDirectln()
for (String cmd : monitorCommands) {
MessageOutput.printDirectln(cmd);// Special case: use printDirectln()
}
}
}
......@@ -581,9 +577,7 @@ public class TTY implements EventNotifier {
return;
}
String monStr = monTok + ":";
Iterator it = monitorCommands.iterator();
while (it.hasNext()) {
String cmd = (String)it.next();
for (String cmd : monitorCommands) {
StringTokenizer ct = new StringTokenizer(cmd);
if (ct.nextToken().equals(monStr)) {
monitorCommands.remove(cmd);
......@@ -768,10 +762,8 @@ public class TTY implements EventNotifier {
}
private static boolean supportsSharedMemory() {
List connectors = Bootstrap.virtualMachineManager().allConnectors();
Iterator iter = connectors.iterator();
while (iter.hasNext()) {
Connector connector = (Connector)iter.next();
for (Connector connector :
Bootstrap.virtualMachineManager().allConnectors()) {
if (connector.transport() == null) {
continue;
}
......
......@@ -36,7 +36,7 @@ import java.util.Iterator;
* Descend the tree of thread groups.
* @author Robert G. Field
*/
class ThreadGroupIterator implements Iterator {
class ThreadGroupIterator implements Iterator<ThreadGroupReference> {
private final Stack<Iterator<ThreadGroupReference>> stack = new Stack<Iterator<ThreadGroupReference>>();
ThreadGroupIterator(List<ThreadGroupReference> tgl) {
......@@ -53,8 +53,8 @@ class ThreadGroupIterator implements Iterator {
this(Env.vm().topLevelThreadGroups());
}
private Iterator top() {
return (Iterator)stack.peek();
private Iterator<ThreadGroupReference> top() {
return stack.peek();
}
/**
......@@ -74,12 +74,12 @@ class ThreadGroupIterator implements Iterator {
return !stack.isEmpty();
}
public Object next() {
public ThreadGroupReference next() {
return nextThreadGroup();
}
public ThreadGroupReference nextThreadGroup() {
ThreadGroupReference tg = (ThreadGroupReference)top().next();
ThreadGroupReference tg = top().next();
push(tg.threadGroups());
return tg;
}
......
......@@ -56,9 +56,7 @@ class ThreadInfo {
private static void initThreads() {
if (!gotInitialThreads) {
Iterator iter = Env.vm().allThreads().iterator();
while (iter.hasNext()) {
ThreadReference thread = (ThreadReference)iter.next();
for (ThreadReference thread : Env.vm().allThreads()) {
threads.add(new ThreadInfo(thread));
}
gotInitialThreads = true;
......@@ -113,9 +111,7 @@ class ThreadInfo {
current = null;
group = null;
synchronized (threads) {
Iterator iter = threads().iterator();
while (iter.hasNext()) {
ThreadInfo ti = (ThreadInfo)iter.next();
for (ThreadInfo ti : threads()) {
ti.invalidate();
}
}
......@@ -163,8 +159,7 @@ class ThreadInfo {
if (group == null) {
// Current thread group defaults to the first top level
// thread group.
setThreadGroup((ThreadGroupReference)
Env.vm().topLevelThreadGroups().get(0));
setThreadGroup(Env.vm().topLevelThreadGroups().get(0));
}
return group;
}
......@@ -173,9 +168,7 @@ class ThreadInfo {
ThreadInfo retInfo = null;
synchronized (threads) {
Iterator iter = threads().iterator();
while (iter.hasNext()) {
ThreadInfo ti = (ThreadInfo)iter.next();
for (ThreadInfo ti : threads()) {
if (ti.thread.uniqueID() == id) {
retInfo = ti;
break;
......@@ -208,7 +201,7 @@ class ThreadInfo {
*
* @return a <code>List</code> of the stack frames.
*/
List getStack() throws IncompatibleThreadStateException {
List<StackFrame> getStack() throws IncompatibleThreadStateException {
return thread.frames();
}
......
......@@ -30,8 +30,8 @@ import com.sun.jdi.ThreadReference;
import java.util.List;
import java.util.Iterator;
class ThreadIterator implements Iterator {
Iterator it = null;
class ThreadIterator implements Iterator<ThreadReference> {
Iterator<ThreadReference> it = null;
ThreadGroupIterator tgi;
ThreadIterator(ThreadGroupReference tg) {
......@@ -56,12 +56,12 @@ class ThreadIterator implements Iterator {
return true;
}
public Object next() {
public ThreadReference next() {
return it.next();
}
public ThreadReference nextThread() {
return (ThreadReference)next();
return next();
}
public void remove() {
......
......@@ -61,10 +61,8 @@ class VMConnection {
}
private Connector findConnector(String name) {
List connectors = Bootstrap.virtualMachineManager().allConnectors();
Iterator iter = connectors.iterator();
while (iter.hasNext()) {
Connector connector = (Connector)iter.next();
for (Connector connector :
Bootstrap.virtualMachineManager().allConnectors()) {
if (connector.name().equals(name)) {
return connector;
}
......@@ -108,7 +106,7 @@ class VMConnection {
String value = token.substring(index + 1,
token.length() - 1); // Remove comma delimiter
Connector.Argument argument = (Connector.Argument)arguments.get(name);
Connector.Argument argument = arguments.get(name);
if (argument == null) {
throw new IllegalArgumentException
(MessageOutput.format("Argument is not defined for connector:",
......@@ -195,7 +193,7 @@ class VMConnection {
return false;
}
Connector.Argument argument = (Connector.Argument)connectorArgs.get(name);
Connector.Argument argument = connectorArgs.get(name);
if (argument == null) {
return false;
}
......@@ -204,7 +202,7 @@ class VMConnection {
}
String connectorArg(String name) {
Connector.Argument argument = (Connector.Argument)connectorArgs.get(name);
Connector.Argument argument = connectorArgs.get(name);
if (argument == null) {
return "";
}
......
......@@ -99,8 +99,7 @@ class ClassQuery extends QueryHandler {
}
out.println("<h2>Instance Data Members:</h2>");
JavaField[] ff = clazz.getFields();
ff = (JavaField[]) ff.clone();
JavaField[] ff = clazz.getFields().clone();
ArraySorter.sort(ff, new Comparer() {
public int compare(Object lhs, Object rhs) {
JavaField left = (JavaField) lhs;
......
......@@ -90,9 +90,7 @@ public class PlatformClasses {
// is the right thing to do anyway.
}
}
int num = list.size();
names = new String[num];
names = (String[]) list.toArray(names);
names = list.toArray(new String[list.size()]);
}
return names;
}
......
......@@ -119,7 +119,7 @@ abstract class AbstractLauncher extends ConnectorImpl implements LaunchingConnec
String[] tokenArray = new String[tokenList.size()];
for (int i = 0; i < tokenList.size(); i++) {
tokenArray[i] = (String)tokenList.get(i);
tokenArray[i] = tokenList.get(i);
}
return tokenArray;
}
......
......@@ -95,11 +95,8 @@ public class ClassTypeImpl extends ReferenceTypeImpl
}
public List<ClassType> subclasses() {
List<ReferenceType> all = vm.allClasses();
List<ClassType> subs = new ArrayList<ClassType>();
Iterator iter = all.iterator();
while (iter.hasNext()) {
ReferenceType refType = (ReferenceType)iter.next();
for (ReferenceType refType : vm.allClasses()) {
if (refType instanceof ClassType) {
ClassType clazz = (ClassType)refType;
ClassType superclass = clazz.superclass();
......@@ -223,7 +220,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
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;
try {
PacketStream stream =
......@@ -271,7 +268,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
List<Value> arguments = method.validateAndPrepareArgumentsForInvoke(
origArguments);
ValueImpl[] args = (ValueImpl[])arguments.toArray(new ValueImpl[0]);
ValueImpl[] args = arguments.toArray(new ValueImpl[0]);
JDWP.ClassType.NewInstance ret = null;
try {
PacketStream stream =
......@@ -301,11 +298,8 @@ public class ClassTypeImpl extends ReferenceTypeImpl
}
public Method concreteMethodByName(String name, String signature) {
List methods = visibleMethods();
Method method = null;
Iterator iter = methods.iterator();
while (iter.hasNext()) {
Method candidate = (Method)iter.next();
for (Method candidate : visibleMethods()) {
if (candidate.name().equals(name) &&
candidate.signature().equals(signature) &&
!candidate.isAbstract()) {
......@@ -330,9 +324,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
* Avoid duplicate checking on each method by iterating through
* duplicate-free allInterfaces() rather than recursing
*/
Iterator iter = allInterfaces().iterator();
while (iter.hasNext()) {
InterfaceType interfaze = (InterfaceType)iter.next();
for (InterfaceType interfaze : allInterfaces()) {
list.addAll(interfaze.methods());
}
......
......@@ -247,7 +247,7 @@ public class ConcreteMethodImpl extends MethodImpl {
public byte[] bytecodes() {
byte[] bytecodes = (bytecodesRef == null) ? null :
(byte[])bytecodesRef.get();
bytecodesRef.get();
if (bytecodes == null) {
try {
bytecodes = JDWP.Method.Bytecodes.
......@@ -262,7 +262,7 @@ public class ConcreteMethodImpl extends MethodImpl {
* to return the cached bytecodes directly; instead, we
* make a clone at the cost of using more memory.
*/
return (byte[])bytecodes.clone();
return bytecodes.clone();
}
int argSlotCount() throws AbsentInformationException {
......@@ -279,7 +279,7 @@ public class ConcreteMethodImpl extends MethodImpl {
String stratumID = stratum.id();
SoftLocationXRefs info =
(softOtherLocationXRefsRef == null) ? null :
(SoftLocationXRefs)softOtherLocationXRefsRef.get();
softOtherLocationXRefsRef.get();
if (info != null && info.stratumID.equals(stratumID)) {
return info;
}
......@@ -348,7 +348,7 @@ public class ConcreteMethodImpl extends MethodImpl {
private SoftLocationXRefs getBaseLocations() {
SoftLocationXRefs info = (softBaseLocationXRefsRef == null) ? null :
(SoftLocationXRefs)softBaseLocationXRefsRef.get();
softBaseLocationXRefsRef.get();
if (info != null) {
return info;
}
......
......@@ -56,10 +56,8 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet {
public String toString() {
String string = "event set, policy:" + suspendPolicy +
", count:" + this.size() + " = {";
Iterator iter = this.iterator();
boolean first = true;
while (iter.hasNext()) {
Event event = (Event)iter.next();
for (Event event : this) {
if (!first) {
string += ", ";
}
......@@ -787,9 +785,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet {
}
private ThreadReference eventThread() {
Iterator iter = this.iterator();
while (iter.hasNext()) {
Event event = (Event)iter.next();
for (Event event : this) {
if (event instanceof ThreadedEventImpl) {
return ((ThreadedEventImpl)event).thread();
}
......@@ -846,7 +842,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet {
}
public Event nextEvent() {
return (Event)next();
return next();
}
public void remove() {
......
......@@ -82,7 +82,7 @@ public class JNITypeParser {
}
String typeName() {
return (String)typeNameList().get(typeNameList().size()-1);
return typeNameList().get(typeNameList().size()-1);
}
List<String> argumentTypeNames() {
......@@ -90,7 +90,7 @@ public class JNITypeParser {
}
String signature() {
return (String)signatureList().get(signatureList().size()-1);
return signatureList().get(signatureList().size()-1);
}
List<String> argumentSignatures() {
......
......@@ -158,7 +158,7 @@ public abstract class MethodImpl extends TypeComponentImpl
Type argumentType(int index) throws ClassNotLoadedException {
ReferenceTypeImpl enclosing = (ReferenceTypeImpl)declaringType();
String signature = (String)argumentSignatures().get(index);
String signature = argumentSignatures().get(index);
return enclosing.findType(signature);
}
......@@ -263,10 +263,10 @@ public abstract class MethodImpl extends TypeComponentImpl
return argumentType(index);
}
public String typeName(){
return (String)argumentTypeNames().get(index);
return argumentTypeNames().get(index);
}
public String signature() {
return (String)argumentSignatures().get(index);
return argumentSignatures().get(index);
}
public Type findType(String signature) throws ClassNotLoadedException {
return MethodImpl.this.findType(signature);
......@@ -307,7 +307,7 @@ public abstract class MethodImpl extends TypeComponentImpl
arguments.add(argArray);
return;
}
Value nthArgValue = (Value)arguments.get(paramCount - 1);
Value nthArgValue = arguments.get(paramCount - 1);
if (nthArgValue == null) {
return;
}
......@@ -371,7 +371,7 @@ public abstract class MethodImpl extends TypeComponentImpl
}
for (int i = 0; i < argSize; i++) {
Value value = (Value)arguments.get(i);
Value value = arguments.get(i);
value = ValueImpl.prepareForAssignment(value,
new ArgumentContainer(i));
arguments.set(i, value);
......@@ -386,11 +386,11 @@ public abstract class MethodImpl extends TypeComponentImpl
sb.append(name());
sb.append("(");
boolean first = true;
for (Iterator it = argumentTypeNames().iterator(); it.hasNext();) {
for (String name : argumentTypeNames()) {
if (!first) {
sb.append(", ");
}
sb.append((String)it.next());
sb.append(name);
first = false;
}
sb.append(")");
......
......@@ -383,7 +383,7 @@ public class ObjectReferenceImpl extends ValueImpl
List<Value> arguments = method.validateAndPrepareArgumentsForInvoke(
origArguments);
ValueImpl[] args = (ValueImpl[])arguments.toArray(new ValueImpl[0]);
ValueImpl[] args = arguments.toArray(new ValueImpl[0]);
JDWP.ObjectReference.InvokeMethod ret;
try {
PacketStream stream =
......@@ -583,7 +583,7 @@ public class ObjectReferenceImpl extends ValueImpl
// Validate assignment
ReferenceType destType = (ReferenceTypeImpl)destination.type();
ReferenceTypeImpl myType = (ReferenceTypeImpl)referenceType();
if (!myType.isAssignableTo((ReferenceType)destType)) {
if (!myType.isAssignableTo(destType)) {
JNITypeParser parser = new JNITypeParser(destType.signature());
String destTypeName = parser.typeName();
throw new InvalidTypeException("Can't assign " +
......
......@@ -485,7 +485,7 @@ class PacketStream {
* Read field represented as vm specific byte sequence.
*/
Field readField() {
ReferenceTypeImpl refType = (ReferenceTypeImpl)readReferenceType();
ReferenceTypeImpl refType = readReferenceType();
long fieldRef = readFieldRef();
return refType.getFieldMirror(fieldRef);
}
......
......@@ -59,7 +59,7 @@ implements ReferenceType {
private boolean constantPoolInfoGotten = false;
private int constanPoolCount;
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 */
private static final String ABSENT_BASE_SOURCE_NAME = "**ABSENT_BASE_SOURCE_NAME**";
......@@ -352,13 +352,10 @@ implements ReferenceType {
abstract List<? extends ReferenceType> inheritedTypes();
void addVisibleFields(List<Field> visibleList, Map<String, Field> visibleTable, List<String> ambiguousNames) {
List<Field> list = visibleFields();
Iterator iter = list.iterator();
while (iter.hasNext()) {
Field field = (Field)iter.next();
for (Field field : visibleFields()) {
String name = field.name();
if (!ambiguousNames.contains(name)) {
Field duplicate = (Field)visibleTable.get(name);
Field duplicate = visibleTable.get(name);
if (duplicate == null) {
visibleList.add(field);
visibleTable.put(name, field);
......@@ -402,10 +399,8 @@ implements ReferenceType {
* hide.
*/
List<Field> retList = new ArrayList<Field>(fields());
iter = retList.iterator();
while (iter.hasNext()) {
Field field = (Field)iter.next();
Field hidden = (Field)visibleTable.get(field.name());
for (Field field : retList) {
Field hidden = visibleTable.get(field.name());
if (hidden != null) {
visibleList.remove(hidden);
}
......@@ -515,12 +510,9 @@ implements ReferenceType {
* methods.
*/
void addToMethodMap(Map<String, Method> methodMap, List<Method> methodList) {
Iterator iter = methodList.iterator();
while (iter.hasNext()) {
Method method = (Method)iter.next();
for (Method method : methodList)
methodMap.put(method.name().concat(method.signature()), method);
}
}
abstract void addVisibleMethods(Map<String, Method> methodMap);
......@@ -549,9 +541,7 @@ implements ReferenceType {
public List<Method> methodsByName(String name) {
List<Method> methods = visibleMethods();
ArrayList<Method> retList = new ArrayList<Method>(methods.size());
Iterator iter = methods.iterator();
while (iter.hasNext()) {
Method candidate = (Method)iter.next();
for (Method candidate : methods) {
if (candidate.name().equals(name)) {
retList.add(candidate);
}
......@@ -563,9 +553,7 @@ implements ReferenceType {
public List<Method> methodsByName(String name, String signature) {
List<Method> methods = visibleMethods();
ArrayList<Method> retList = new ArrayList<Method>(methods.size());
Iterator iter = methods.iterator();
while (iter.hasNext()) {
Method candidate = (Method)iter.next();
for (Method candidate : methods) {
if (candidate.name().equals(name) &&
candidate.signature().equals(signature)) {
retList.add(candidate);
......@@ -706,7 +694,7 @@ implements ReferenceType {
}
public String sourceName() throws AbsentInformationException {
return (String)(sourceNames(vm.getDefaultStratum()).get(0));
return sourceNames(vm.getDefaultStratum()).get(0);
}
public List<String> sourceNames(String stratumID)
......@@ -796,7 +784,7 @@ implements ReferenceType {
if (!vm.canGetSourceDebugExtension()) {
return NO_SDE_INFO_MARK;
}
SDE sde = (sdeRef == null) ? null : (SDE)sdeRef.get();
SDE sde = (sdeRef == null) ? null : sdeRef.get();
if (sde == null) {
String extension = null;
try {
......@@ -1034,13 +1022,13 @@ implements ReferenceType {
throw exc;
}
if (constantPoolBytesRef != null) {
byte[] cpbytes = (byte[])constantPoolBytesRef.get();
byte[] cpbytes = constantPoolBytesRef.get();
/*
* Arrays are always modifiable, so it is a little unsafe
* to return the cached bytecodes directly; instead, we
* make a clone at the cost of using more memory.
*/
return (byte[])cpbytes.clone();
return cpbytes.clone();
} else {
return null;
}
......
......@@ -327,7 +327,7 @@ class SDE {
ignoreWhite();
while (((ch = sdeRead()) != '\n') && (ch != '\r')) {
sb.append((char)ch);
sb.append(ch);
}
// check for CR LF
if ((ch == '\r') && (sdePeek() == '\n')) {
......
......@@ -148,7 +148,7 @@ public class TargetVM implements Runnable {
idString = String.valueOf(p.id);
synchronized(waitingQueue) {
p2 = (Packet)waitingQueue.get(idString);
p2 = waitingQueue.get(idString);
if (p2 != null)
waitingQueue.remove(idString);
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册