提交 11e6fdfd 编写于 作者: L lana

Merge

......@@ -235,3 +235,5 @@ eea685b9ccaa1980e0a7e07d6a3a84bcc7e9ab82 jdk8-b107
719befd87c7b96ae103c05730ca555227bfc0116 jdk8-b111
f002f5f3a16cca62e139cb8eed05ffaeb373587d jdk8-b112
5b4261b4b72af53e8e178933ef6bc6c7f8cdbc60 jdk8-b113
f26a0c8071bde1e3b923713c75156e4a58955623 jdk8-b114
f82b730c798b6bf38946baaba8a7d80fd5efaa70 jdk8-b115
......@@ -618,6 +618,11 @@ public final class TzdbZoneRulesCompiler {
// remove ROC, which is not supported in j.u.tz
builtZones.remove("ROC");
links.remove("ROC");
// remove EST, HST and MST. They are supported via
// the short-id mapping
builtZones.remove("EST");
builtZones.remove("HST");
builtZones.remove("MST");
}
/**
......
......@@ -80,7 +80,11 @@ genclasses-only:
# to execute launchers.
+$(MAKE) -f GenerateClasses.gmk
jdk: genclasses
securityjars: genclasses securityjars-only
securityjars-only:
+$(MAKE) -f CreateSecurityJars.gmk
jdk: securityjars
# Now we have a complete jdk, which you can run.
# It is not yet wrapped up as an installed image.
......
......@@ -96,11 +96,7 @@ ifneq ($(OPENJDK_TARGET_OS), solaris)
EXCLUDES += com/oracle/security
endif
# In the old build, this isn't excluded on macosx, even though it probably
# should be.
ifneq ($(OPENJDK_TARGET_OS), macosx)
EXFILES += WrapperGenerator.java
endif
EXFILES += WrapperGenerator.java
ifneq ($(OPENJDK_TARGET_OS), windows)
# Exclude Window security related files in src/share/classes
......@@ -169,7 +165,11 @@ ifeq (, $(filter $(OPENJDK_TARGET_OS), windows macosx))
EXFILES += sun/awt/AWTCharset.java
endif
ifneq ($(OPENJDK_TARGET_OS), macosx)
ifeq ($(OPENJDK_TARGET_OS), macosx)
# exclude all X11 on Mac, we can't exclude some like below or we'll have compilation errors
EXCLUDES += sun/awt/X11
else
# TBD: figure out how to eliminate this long list
EXFILES += sun/awt/X11/ScreenFormat.java \
sun/awt/X11/XArc.java \
sun/awt/X11/XChar2b.java \
......@@ -281,6 +281,19 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
EXCLUDES += com/apple/jobjc
endif
# The security classes should not end up in the classes directory as that will prevent them
# from working when running the exploded jdk image. Compile them separately to a different
# directory from where the jars can be created.
SECURITY_PKGS := \
com/oracle/security/ucrypto \
com/sun/crypto/provider \
javax/crypto \
sun/security/ec \
sun/security/internal \
sun/security/mscapi \
sun/security/pkcs11 \
#
# The exception handling of swing beaninfo
# These resources violates the convention of having code and resources together under
# $(JDK_TOPDIR)/src/.../classes directories
......@@ -293,22 +306,46 @@ $(JDK_OUTPUTDIR)/classes/javax/swing/beaninfo/images/%.gif: $(JDK_TOPDIR)/make/t
# space separated list.
JDK_USER_DEFINED_FILTER := $(strip $(subst $(COMMA),$(SPACE), $(JDK_FILTER)))
$(eval $(call SetupJavaCompilation,BUILD_JDK, \
ifeq ($(ENABLE_SJAVAC),yes)
# With sjavac enabled, excluded sources are not even considered for linking.
# Explicitly add the security sources to sourcepath for linking.
BUILD_JDK_SOURCEPATH:=$(patsubst %,-i$(SPACE)%.*,$(subst /,.,$(SECURITY_PKGS))) \
-sourcepath $(JDK_TOPDIR)/src/share/classes
endif
$(eval $(call SetupJavaCompilation,BUILD_JDK,\
SETUP:=GENERATE_JDKBYTECODE,\
SRC:=$(JDK_TOPDIR)/src/share/classes \
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
$(MACOSX_SRC_DIRS) \
$(JDK_OUTPUTDIR)/gensrc \
$(JDK_OUTPUTDIR)/gensrc_no_srczip \
$(CLOSED_SRC_DIRS),\
INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
EXCLUDES:=$(EXCLUDES) $(SECURITY_PKGS),\
EXCLUDE_FILES:=$(EXFILES),\
BIN:=$(JDK_OUTPUTDIR)/classes,\
COPY:=$(COPY_PATTERNS),\
COPY_FILES:=$(COPY_FILES),\
HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers,\
ADD_JAVAC_FLAGS:=$(BUILD_JDK_SOURCEPATH)))
##########################################################################################
$(eval $(call SetupJavaCompilation,BUILD_SECURITY, \
SETUP := GENERATE_JDKBYTECODE, \
SRC := $(JDK_TOPDIR)/src/share/classes \
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
$(MACOSX_SRC_DIRS) \
$(JDK_OUTPUTDIR)/gensrc \
$(JDK_OUTPUTDIR)/gensrc_no_srczip \
$(CLOSED_SRC_DIRS), \
INCLUDES := $(JDK_USER_DEFINED_FILTER), \
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes \
$(MACOSX_SRC_DIRS) \
$(CLOSED_SRC_DIRS), \
INCLUDES := $(SECURITY_PKGS), \
EXCLUDES := $(EXCLUDES), \
EXCLUDE_FILES := $(EXFILES), \
BIN := $(JDK_OUTPUTDIR)/classes, \
COPY := $(COPY_PATTERNS), \
COPY_FILES := $(COPY_FILES), \
BIN := $(JDK_OUTPUTDIR)/classes_security, \
HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
$(BUILD_SECURITY): $(BUILD_JDK)
##########################################################################################
$(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin:
......@@ -393,7 +430,7 @@ endif
##########################################################################################
all: $(BUILD_JDK) $(BUILD_JOBJC) $(BUILD_JOBJC_HEADERS) $(COPY_EXTRA) \
all: $(BUILD_JDK) $(BUILD_SECURITY) $(BUILD_JOBJC) $(BUILD_JOBJC_HEADERS) $(COPY_EXTRA) \
$(JDK_OUTPUTDIR)/classes/META-INF/services/com.sun.tools.xjc.Plugin \
$(BUILD_ACCESSBRIDGE_32) $(BUILD_ACCESSBRIDGE_64) \
$(BUILD_ACCESSBRIDGE_LEGACY)
......
......@@ -48,7 +48,7 @@ H_TARGET_FILES = $(INCLUDEDIR)/jdwpTransport.h \
$(INCLUDEDIR)/%.h: $(JDK_TOPDIR)/src/share/javavm/export/%.h
$(call install-file)
$(OPENJDK_TARGET_OS_INCLUDE)/%.h: $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export/%.h
$(OPENJDK_TARGET_OS_INCLUDE)/%.h: $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_EXPORT_DIR)/javavm/export/%.h
$(call install-file)
COPY_FILES = $(H_TARGET_FILES)
......
......@@ -102,7 +102,6 @@ $(eval $(call SetupArchive,BUILD_LOCALEDATA_JAR, , \
# This value should exclude types destined for jars other than rt.jar and resources.jar.
# When building a Profile this value augments the profile specific exclusions
RT_JAR_EXCLUDES += \
com/oracle/security \
com/sun/codemodel \
com/sun/crypto/provider \
com/sun/istack/internal/tools \
......@@ -414,86 +413,6 @@ $(eval $(call SetupArchive,BUILD_JSSE_JAR, , \
MANIFEST := $(MAINMANIFEST), \
CHECK_COMPRESS_JAR := true))
##########################################################################################
# Create manifest for security jars
#
# Include these extra attributes for now, should probably take out.
#
JCE_MANIFEST := $(IMAGES_OUTPUTDIR)/lib/_the.security.manifest.mf
$(JCE_MANIFEST): $(MAINMANIFEST)
$(MKDIR) -p $(@D)
$(RM) $@ $@.tmp
$(SED) -e "s#@@RELEASE@@#$(JDK_VERSION)#" \
-e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
$(MAINMANIFEST) >> $@.tmp
$(ECHO) "Extension-Name: javax.crypto" >> $@.tmp
$(ECHO) "Implementation-Vendor-Id: com.sun" >> $@.tmp
$(MV) $@.tmp $@
##########################################################################################
# For security and crypto jars, always build the jar, but for closed, install the prebuilt
# signed version instead of the newly built jar. Unsigned jars are treated as intermediate
# targets and explicitly added to the JARS list. For open, signing is not needed. See
# SignJars.gmk for more information.
#
# The source for the crypto jars is not available for all licensees. The BUILD_CRYPTO
# variable is set to no if these jars can't be built to skip that step of the build.
# Note that for OPENJDK, the build will fail if BUILD_CRYPTO=no since then there is no
# other way to get the jars than to build them.
SUNPKCS11_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunpkcs11.jar
SUNPKCS11_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/sunpkcs11.jar
$(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes, \
SUFFIXES := .class, \
INCLUDES := sun/security/pkcs11, \
JAR := $(SUNPKCS11_JAR_UNSIGNED), \
MANIFEST := $(JCE_MANIFEST), \
SKIP_METAINF := true))
$(SUNPKCS11_JAR_UNSIGNED): $(JCE_MANIFEST)
ifndef OPENJDK
SUNPKCS11_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/pkcs11/sunpkcs11.jar
$(SUNPKCS11_JAR_DST): $(SUNPKCS11_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunPKCS11 provider..."
$(install-file)
else
$(SUNPKCS11_JAR_DST): $(SUNPKCS11_JAR_UNSIGNED)
$(install-file)
endif
JARS += $(SUNPKCS11_JAR_UNSIGNED)
##########################################################################################
SUNEC_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunec.jar
SUNEC_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/sunec.jar
$(eval $(call SetupArchive,BUILD_SUNEC_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes, \
SUFFIXES := .class, \
INCLUDES := sun/security/ec, \
JAR := $(SUNEC_JAR_UNSIGNED), \
MANIFEST := $(JCE_MANIFEST), \
SKIP_METAINF := true))
$(SUNEC_JAR_UNSIGNED): $(JCE_MANIFEST)
ifndef OPENJDK
SUNEC_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ec/sunec.jar
$(SUNEC_JAR_DST): $(SUNEC_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunEC provider..."
$(install-file)
else
$(SUNEC_JAR_DST): $(SUNEC_JAR_UNSIGNED)
$(install-file)
endif
JARS += $(SUNEC_JAR_UNSIGNED)
##########################################################################################
$(eval $(call SetupArchive,BUILD_SWINGBEANS_JAR, , \
......@@ -507,208 +426,6 @@ $(eval $(call SetupArchive,BUILD_SWINGBEANS_JAR, , \
##########################################################################################
SUNJCE_PROVIDER_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunjce_provider.jar
SUNJCE_PROVIDER_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/sunjce_provider.jar
ifneq ($(BUILD_CRYPTO), no)
$(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes, \
SUFFIXES := .class, \
INCLUDES := com/sun/crypto/provider, \
JAR := $(SUNJCE_PROVIDER_JAR_UNSIGNED), \
MANIFEST := $(JCE_MANIFEST), \
SKIP_METAINF := true))
$(SUNJCE_PROVIDER_JAR_UNSIGNED): $(JCE_MANIFEST)
JARS += $(SUNJCE_PROVIDER_JAR_UNSIGNED)
endif
ifndef OPENJDK
SUNJCE_PROVIDER_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/sunjce_provider.jar
$(SUNJCE_PROVIDER_JAR_DST): $(SUNJCE_PROVIDER_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunJCE provider..."
$(install-file)
else
$(SUNJCE_PROVIDER_JAR_DST): $(SUNJCE_PROVIDER_JAR_UNSIGNED)
$(install-file)
endif
##########################################################################################
JCE_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/jce.jar
JCE_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/jce.jar
ifneq ($(BUILD_CRYPTO), no)
$(eval $(call SetupArchive,BUILD_JCE_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes, \
SUFFIXES := .class, \
INCLUDES := javax/crypto sun/security/internal, \
JAR := $(JCE_JAR_UNSIGNED), \
MANIFEST := $(JCE_MANIFEST), \
SKIP_METAINF := true))
$(JCE_JAR_UNSIGNED): $(JCE_MANIFEST)
JARS += $(JCE_JAR_UNSIGNED)
endif
ifndef OPENJDK
JCE_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/jce.jar
$(JCE_JAR_DST): $(JCE_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt jce.jar..."
$(install-file)
else
$(JCE_JAR_DST): $(JCE_JAR_UNSIGNED)
$(install-file)
endif
##########################################################################################
US_EXPORT_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/US_export_policy.jar
US_EXPORT_POLICY_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/US_export_policy.jar
ifneq ($(BUILD_CRYPTO), no)
#
# TODO fix so that SetupArchive does not write files into SRCS
# then we don't need this extra copying
# NOTE: We currently do not place restrictions on our limited export
# policy. This was not a typo.
#
US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
US_EXPORT_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/US_export_policy_jar.tmp
$(US_EXPORT_POLICY_JAR_TMP)/%: $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
$(install-file)
US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR, $(US_EXPORT_POLICY_JAR_DEPS), \
SRCS := $(US_EXPORT_POLICY_JAR_TMP), \
SUFFIXES := .policy, \
JAR := $(US_EXPORT_POLICY_JAR_UNSIGNED), \
EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
SKIP_METAINF := true))
JARS += $(US_EXPORT_POLICY_JAR_UNSIGNED)
endif
ifndef OPENJDK
$(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
$(ECHO) $(LOG_INFO) Copying $(@F)
$(install-file)
else
$(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNSIGNED)
$(install-file)
endif
##########################################################################################
LOCAL_POLICY_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/security/local_policy.jar
LOCAL_POLICY_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/local_policy.jar
ifneq ($(BUILD_CRYPTO), no)
#
# TODO fix so that SetupArchive does not write files into SRCS
# then we don't need this extra copying
#
LOCAL_POLICY_JAR_TMP := $(IMAGES_OUTPUTDIR)/local_policy_jar.tmp
ifeq ($(UNLIMITED_CRYPTO), true)
LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy
LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited
else
LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited
LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \
$(LOCAL_POLICY_JAR_TMP)/default_local.policy
LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited
endif
$(LOCAL_POLICY_JAR_TMP)/%: $(LOCAL_POLICY_JAR_SRC_DIR)/%
$(install-file)
$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR, $(LOCAL_POLICY_JAR_DEPS), \
SRCS := $(LOCAL_POLICY_JAR_TMP), \
SUFFIXES := .policy, \
JAR := $(LOCAL_POLICY_JAR_UNSIGNED), \
EXTRA_MANIFEST_ATTR := $(LOCAL_POLICY_JAR_ATTR), \
SKIP_METAINF := true))
JARS += $(LOCAL_POLICY_JAR_UNSIGNED)
endif
ifndef OPENJDK
$(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
$(ECHO) $(LOG_INFO) Copying $(@F)
$(install-file)
else
$(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNSIGNED)
$(install-file)
endif
##########################################################################################
ifeq ($(OPENJDK_TARGET_OS), windows)
SUNMSCAPI_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunmscapi.jar
SUNMSCAPI_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/sunmscapi.jar
$(eval $(call SetupArchive,BUILD_SUNMSCAPI_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes, \
SUFFIXES := .class, \
INCLUDES := sun/security/mscapi, \
JAR := $(SUNMSCAPI_JAR_UNSIGNED), \
MANIFEST := $(JCE_MANIFEST), \
SKIP_METAINF := true))
$(SUNMSCAPI_JAR_UNSIGNED): $(JCE_MANIFEST)
ifndef OPENJDK
SUNMSCAPI_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/mscapi/sunmscapi.jar
$(SUNMSCAPI_JAR_DST): $(SUNMSCAPI_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunMSCAPI provider..."
$(install-file)
else
$(SUNMSCAPI_JAR_DST): $(SUNMSCAPI_JAR_UNSIGNED)
$(install-file)
endif
JARS += $(SUNMSCAPI_JAR_UNSIGNED)
endif
##########################################################################################
ifeq ($(OPENJDK_TARGET_OS), solaris)
ifndef OPENJDK
UCRYPTO_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/ucrypto.jar
UCRYPTO_JAR_UNSIGNED := $(IMAGES_OUTPUTDIR)/unsigned/ucrypto.jar
UCRYPTO_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ucrypto/ucrypto.jar
$(eval $(call SetupArchive,BUILD_UCRYPTO_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes, \
SUFFIXES := .class, \
INCLUDES := com/oracle/security/ucrypto, \
JAR := $(UCRYPTO_JAR_UNSIGNED), \
MANIFEST := $(JCE_MANIFEST), \
SKIP_METAINF := true))
$(UCRYPTO_JAR_UNSIGNED): $(JCE_MANIFEST)
$(UCRYPTO_JAR_DST): $(UCRYPTO_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..."
$(install-file)
JARS += $(UCRYPTO_JAR_UNSIGNED)
endif
endif
##########################################################################################
# Get the CLDRVERSION
include gensrc/GensrcCLDR.gmk
......@@ -1047,6 +764,13 @@ endif
##########################################################################################
# This rule copies all jars from jdk/lib/... to images/lib/... to avoid having to track
# which jars are where
$(IMAGES_OUTPUTDIR)/lib/%: $(JDK_OUTPUTDIR)/lib/%
$(install-file)
##########################################################################################
# Import nashorn.jar from nashorn dist dir.
$(IMAGES_OUTPUTDIR)/lib/ext/nashorn.jar: $(NASHORN_DIST)/nashorn.jar
$(install-file)
......
#
# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
default: all
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include Setup.gmk
# The jars created in this file are required for the exploded jdk image to function and
# cannot wait to be built in the images target.
##########################################################################################
# Create manifest for security jars
#
# Include these extra attributes for now, should probably take out.
#
MAINMANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf
JCE_MANIFEST := $(JDK_OUTPUTDIR)/lib/_the.security.manifest.mf
$(JCE_MANIFEST): $(MAINMANIFEST)
$(MKDIR) -p $(@D)
$(RM) $@ $@.tmp
$(SED) -e "s#@@RELEASE@@#$(JDK_VERSION)#" \
-e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
$(MAINMANIFEST) >> $@.tmp
$(ECHO) "Extension-Name: javax.crypto" >> $@.tmp
$(ECHO) "Implementation-Vendor-Id: com.sun" >> $@.tmp
$(MV) $@.tmp $@
##########################################################################################
# For security and crypto jars, always build the jar, but for closed, install the prebuilt
# signed version instead of the newly built jar. Unsigned jars are treated as intermediate
# targets and explicitly added to the JARS list. For open, signing is not needed. See
# SignJars.gmk for more information.
#
# The source for the crypto jars is not available for all licensees. The BUILD_CRYPTO
# variable is set to no if these jars can't be built to skip that step of the build.
# Note that for OPENJDK, the build will fail if BUILD_CRYPTO=no since then there is no
# other way to get the jars than to build them.
SUNPKCS11_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunpkcs11.jar
SUNPKCS11_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunpkcs11.jar
$(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes_security, \
SUFFIXES := .class, \
INCLUDES := sun/security/pkcs11, \
JAR := $(SUNPKCS11_JAR_UNSIGNED), \
MANIFEST := $(JCE_MANIFEST), \
SKIP_METAINF := true))
$(SUNPKCS11_JAR_UNSIGNED): $(JCE_MANIFEST)
ifndef OPENJDK
SUNPKCS11_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/pkcs11/sunpkcs11.jar
$(SUNPKCS11_JAR_DST): $(SUNPKCS11_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunPKCS11 provider..."
$(install-file)
else
$(SUNPKCS11_JAR_DST): $(SUNPKCS11_JAR_UNSIGNED)
$(install-file)
endif
JARS += $(SUNPKCS11_JAR_UNSIGNED) $(SUNPKCS11_JAR_DST)
##########################################################################################
SUNEC_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunec.jar
SUNEC_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunec.jar
$(eval $(call SetupArchive,BUILD_SUNEC_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes_security, \
SUFFIXES := .class, \
INCLUDES := sun/security/ec, \
JAR := $(SUNEC_JAR_UNSIGNED), \
MANIFEST := $(JCE_MANIFEST), \
SKIP_METAINF := true))
$(SUNEC_JAR_UNSIGNED): $(JCE_MANIFEST)
ifndef OPENJDK
SUNEC_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ec/sunec.jar
$(SUNEC_JAR_DST): $(SUNEC_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunEC provider..."
$(install-file)
else
$(SUNEC_JAR_DST): $(SUNEC_JAR_UNSIGNED)
$(install-file)
endif
JARS += $(SUNEC_JAR_UNSIGNED) $(SUNEC_JAR_DST)
##########################################################################################
SUNJCE_PROVIDER_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunjce_provider.jar
SUNJCE_PROVIDER_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunjce_provider.jar
ifneq ($(BUILD_CRYPTO), no)
$(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes_security, \
SUFFIXES := .class, \
INCLUDES := com/sun/crypto/provider, \
JAR := $(SUNJCE_PROVIDER_JAR_UNSIGNED), \
MANIFEST := $(JCE_MANIFEST), \
SKIP_METAINF := true))
$(SUNJCE_PROVIDER_JAR_UNSIGNED): $(JCE_MANIFEST)
JARS += $(SUNJCE_PROVIDER_JAR_UNSIGNED)
endif
ifndef OPENJDK
SUNJCE_PROVIDER_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/sunjce_provider.jar
$(SUNJCE_PROVIDER_JAR_DST): $(SUNJCE_PROVIDER_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunJCE provider..."
$(install-file)
else
$(SUNJCE_PROVIDER_JAR_DST): $(SUNJCE_PROVIDER_JAR_UNSIGNED)
$(install-file)
endif
JARS += $(SUNJCE_PROVIDER_JAR_DST)
##########################################################################################
JCE_JAR_DST := $(JDK_OUTPUTDIR)/lib/jce.jar
JCE_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/jce.jar
ifneq ($(BUILD_CRYPTO), no)
$(eval $(call SetupArchive,BUILD_JCE_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes_security, \
SUFFIXES := .class, \
INCLUDES := javax/crypto sun/security/internal, \
JAR := $(JCE_JAR_UNSIGNED), \
MANIFEST := $(JCE_MANIFEST), \
SKIP_METAINF := true))
$(JCE_JAR_UNSIGNED): $(JCE_MANIFEST)
JARS += $(JCE_JAR_UNSIGNED)
endif
ifndef OPENJDK
JCE_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/jce/jce.jar
$(JCE_JAR_DST): $(JCE_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt jce.jar..."
$(install-file)
else
$(JCE_JAR_DST): $(JCE_JAR_UNSIGNED)
$(install-file)
endif
JARS += $(JCE_JAR_DST)
##########################################################################################
US_EXPORT_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar
US_EXPORT_POLICY_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/US_export_policy.jar
ifneq ($(BUILD_CRYPTO), no)
#
# TODO fix so that SetupArchive does not write files into SRCS
# then we don't need this extra copying
#
# NOTE: We currently do not place restrictions on our limited export
# policy. This was not a typo.
#
US_EXPORT_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
US_EXPORT_POLICY_JAR_TMP := $(JDK_OUTPUTDIR)/US_export_policy_jar.tmp
$(US_EXPORT_POLICY_JAR_TMP)/%: $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
$(install-file)
US_EXPORT_POLICY_JAR_DEPS := $(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR, $(US_EXPORT_POLICY_JAR_DEPS), \
SRCS := $(US_EXPORT_POLICY_JAR_TMP), \
SUFFIXES := .policy, \
JAR := $(US_EXPORT_POLICY_JAR_UNSIGNED), \
EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
SKIP_METAINF := true))
JARS += $(US_EXPORT_POLICY_JAR_UNSIGNED)
endif
ifndef OPENJDK
$(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
$(ECHO) $(LOG_INFO) Copying $(@F)
$(install-file)
else
$(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNSIGNED)
$(install-file)
endif
JARS += $(US_EXPORT_POLICY_JAR_DST)
##########################################################################################
LOCAL_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/local_policy.jar
LOCAL_POLICY_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/local_policy.jar
ifneq ($(BUILD_CRYPTO), no)
#
# TODO fix so that SetupArchive does not write files into SRCS
# then we don't need this extra copying
#
LOCAL_POLICY_JAR_TMP := $(JDK_OUTPUTDIR)/local_policy_jar.tmp
ifeq ($(UNLIMITED_CRYPTO), true)
LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/unlimited
LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/default_local.policy
LOCAL_POLICY_JAR_ATTR := Crypto-Strength: unlimited
else
LOCAL_POLICY_JAR_SRC_DIR := $(JDK_TOPDIR)/make/javax/crypto/policy/limited
LOCAL_POLICY_JAR_DEPS := $(LOCAL_POLICY_JAR_TMP)/exempt_local.policy \
$(LOCAL_POLICY_JAR_TMP)/default_local.policy
LOCAL_POLICY_JAR_ATTR := Crypto-Strength: limited
endif
$(LOCAL_POLICY_JAR_TMP)/%: $(LOCAL_POLICY_JAR_SRC_DIR)/%
$(install-file)
$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR, $(LOCAL_POLICY_JAR_DEPS), \
SRCS := $(LOCAL_POLICY_JAR_TMP), \
SUFFIXES := .policy, \
JAR := $(LOCAL_POLICY_JAR_UNSIGNED), \
EXTRA_MANIFEST_ATTR := $(LOCAL_POLICY_JAR_ATTR), \
SKIP_METAINF := true))
JARS += $(LOCAL_POLICY_JAR_UNSIGNED)
endif
ifndef OPENJDK
$(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
$(ECHO) $(LOG_INFO) Copying $(@F)
$(install-file)
else
$(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNSIGNED)
$(install-file)
endif
JARS += $(LOCAL_POLICY_JAR_DST)
##########################################################################################
ifeq ($(OPENJDK_TARGET_OS), windows)
SUNMSCAPI_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunmscapi.jar
SUNMSCAPI_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/sunmscapi.jar
$(eval $(call SetupArchive,BUILD_SUNMSCAPI_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes_security, \
SUFFIXES := .class, \
INCLUDES := sun/security/mscapi, \
JAR := $(SUNMSCAPI_JAR_UNSIGNED), \
MANIFEST := $(JCE_MANIFEST), \
SKIP_METAINF := true))
$(SUNMSCAPI_JAR_UNSIGNED): $(JCE_MANIFEST)
ifndef OPENJDK
SUNMSCAPI_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/mscapi/sunmscapi.jar
$(SUNMSCAPI_JAR_DST): $(SUNMSCAPI_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt SunMSCAPI provider..."
$(install-file)
else
$(SUNMSCAPI_JAR_DST): $(SUNMSCAPI_JAR_UNSIGNED)
$(install-file)
endif
JARS += $(SUNMSCAPI_JAR_UNSIGNED) $(SUNMSCAPI_JAR_DST)
endif
##########################################################################################
ifeq ($(OPENJDK_TARGET_OS), solaris)
ifndef OPENJDK
UCRYPTO_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/ucrypto.jar
UCRYPTO_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/unsigned/ucrypto.jar
UCRYPTO_JAR_SRC := $(JDK_TOPDIR)/make/closed/tools/crypto/ucrypto/ucrypto.jar
$(eval $(call SetupArchive,BUILD_UCRYPTO_JAR, , \
SRCS := $(JDK_OUTPUTDIR)/classes_security, \
SUFFIXES := .class, \
INCLUDES := com/oracle/security/ucrypto, \
JAR := $(UCRYPTO_JAR_UNSIGNED), \
MANIFEST := $(JCE_MANIFEST), \
SKIP_METAINF := true))
$(UCRYPTO_JAR_UNSIGNED): $(JCE_MANIFEST)
$(UCRYPTO_JAR_DST): $(UCRYPTO_JAR_SRC)
@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..."
$(install-file)
JARS += $(UCRYPTO_JAR_UNSIGNED) $(UCRYPTO_JAR_DST)
endif
endif
all: $(JARS)
.PHONY: default all
......@@ -66,15 +66,17 @@ include gensrc/GensrcExceptions.gmk
GENSRC += $(GENSRC_EXCEPTIONS)
ifneq ($(OPENJDK_TARGET_OS), windows)
include gensrc/GensrcIcons.gmk
GENSRC += $(GENSRC_AWT_ICONS)
include gensrc/GensrcIcons.gmk
GENSRC += $(GENSRC_AWT_ICONS)
ifeq ($(OPENJDK_TARGET_OS), macosx)
GENSRC += $(GENSRC_OSX_ICONS)
endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
GENSRC += $(GENSRC_OSX_ICONS)
endif
include gensrc/GensrcX11Wrappers.gmk
GENSRC += $(GENSRC_X11WRAPPERS)
ifneq ($(OPENJDK_TARGET_OS), macosx)
include gensrc/GensrcX11Wrappers.gmk
GENSRC += $(GENSRC_X11WRAPPERS)
endif
endif
include gensrc/GensrcCLDR.gmk
......
......@@ -120,11 +120,11 @@ $(eval $(call CopyDir,HOTSPOT0, $(HOTSPOT_LIB_DIR), $(INSTALL_LIBRARIES_HERE), $
$(eval $(call CopyDir,HOTSPOT1, $(HOTSPOT_DIST)/lib, $(JDK_OUTPUTDIR)/lib, $(HOTSPOT_IMPORT_FILES)))
ifeq ($(OPENJDK_TARGET_OS), macosx)
JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.dSYM) \
$(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig$(SHARED_LIBRARY_SUFFIX).dSYM) \
$(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
else
JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
$(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
$(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
endif
ifneq ($(OPENJDK_TARGET_OS), windows)
......@@ -140,14 +140,14 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
endif
endif
ifneq ($(OPENJDK_TARGET_OS), macosx)
ifeq ($(JVM_VARIANT_MINIMAL1), true)
IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
ifneq (,$(JSIG_DEBUGINFO))
IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
endif
endif
ifneq ($(OPENJDK_TARGET_OS), macosx)
ifeq ($(JVM_VARIANT_MINIMAL1), true)
IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
ifneq (,$(JSIG_DEBUGINFO))
IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
endif
endif
endif
endif
$(INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX): $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
......@@ -156,26 +156,26 @@ $(INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX): $(INSTALL_LIBRARIES_
$(LN) -s ../$(@F) $@
ifeq ($(OPENJDK_TARGET_OS), macosx)
$(INSTALL_LIBRARIES_HERE)/server/%.dSYM : $(INSTALL_LIBRARIES_HERE)/%.dSYM
$(INSTALL_LIBRARIES_HERE)/server/%.dSYM : $(INSTALL_LIBRARIES_HERE)/%.dSYM
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
$(INSTALL_LIBRARIES_HERE)/server/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
$(INSTALL_LIBRARIES_HERE)/server/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
$(MKDIR) -p $(@D)
$(RM) $@
$(RM) $@.tmp $(basename $@).dSYM
$(LN) -s ../$(basename $(@F)).dSYM $(basename $@).dSYM
$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).dSYM
$(RM) $(basename $@).dSYM
$(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
$(LN) -s ../$(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM
$(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
$(MV) $@.tmp $@
else
$(INSTALL_LIBRARIES_HERE)/server/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
$(INSTALL_LIBRARIES_HERE)/server/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
$(INSTALL_LIBRARIES_HERE)/server/%.diz: $(INSTALL_LIBRARIES_HERE)/%.diz
$(INSTALL_LIBRARIES_HERE)/server/%.diz: $(INSTALL_LIBRARIES_HERE)/%.diz
$(MKDIR) -p $(@D)
$(RM) $@
$(RM) $@.tmp $(basename $@).debuginfo
......@@ -191,26 +191,26 @@ $(INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX): $(INSTALL_LIBRARIES_
$(LN) -s ../$(@F) $@
ifeq ($(OPENJDK_TARGET_OS), macosx)
$(INSTALL_LIBRARIES_HERE)/client/%.dSYM : $(INSTALL_LIBRARIES_HERE)/%.dSYM
$(INSTALL_LIBRARIES_HERE)/client/%.dSYM : $(INSTALL_LIBRARIES_HERE)/%.dSYM
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
$(INSTALL_LIBRARIES_HERE)/client/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
$(INSTALL_LIBRARIES_HERE)/client/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
$(MKDIR) -p $(@D)
$(RM) $@
$(RM) $@.tmp $(basename $@).dSYM
$(LN) -s ../$(basename $(@F)).dSYM $(basename $@).dSYM
$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).dSYM
$(RM) $(basename $@).dSYM
$(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
$(LN) -s ../$(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM
$(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
$(MV) $@.tmp $@
else
$(INSTALL_LIBRARIES_HERE)/client/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
$(INSTALL_LIBRARIES_HERE)/client/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
$(INSTALL_LIBRARIES_HERE)/client/%.diz: $(INSTALL_LIBRARIES_HERE)/%.diz
$(INSTALL_LIBRARIES_HERE)/client/%.diz: $(INSTALL_LIBRARIES_HERE)/%.diz
$(MKDIR) -p $(@D)
$(RM) $@
$(RM) $@.tmp $(basename $@).debuginfo
......@@ -226,12 +226,12 @@ $(INSTALL_LIBRARIES_HERE)/minimal/%$(SHARED_LIBRARY_SUFFIX): $(INSTALL_LIBRARIES
$(LN) -s ../$(@F) $@
ifneq ($(OPENJDK_TARGET_OS), macosx)
$(INSTALL_LIBRARIES_HERE)/minimal/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
$(INSTALL_LIBRARIES_HERE)/minimal/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
$(INSTALL_LIBRARIES_HERE)/minimal/%.diz: $(INSTALL_LIBRARIES_HERE)/%.diz
$(INSTALL_LIBRARIES_HERE)/minimal/%.diz: $(INSTALL_LIBRARIES_HERE)/%.diz
$(MKDIR) -p $(@D)
$(RM) $@
$(RM) $@.tmp $(basename $@).debuginfo
......
......@@ -27,7 +27,7 @@ DISABLE_WARNINGS := -Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,-
# To build with all warnings enabled, do the following:
# make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000"
JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,classfile,dep-ann,divzero,varargs -Werror
JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,auxiliaryclass,classfile,dep-ann,divzero,empty,try,varargs -Werror
# Any java code executed during a JDK build to build other parts of the JDK must be
# executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this
......
......@@ -78,7 +78,7 @@ check-keystore:
exit 2; \
fi
$(JCE_OUTPUTDIR)/%: $(IMAGES_OUTPUTDIR)/unsigned/%
$(JCE_OUTPUTDIR)/%: $(JDK_OUTPUTDIR)/unsigned/%
$(call install-file)
$(JARSIGNER) -keystore $(SIGNING_KEYSTORE) \
$@ $(SIGNING_ALIAS) < $(SIGNING_PASSPHRASE)
......
......@@ -32,7 +32,7 @@ TOOLS_SRC := $(JDK_TOPDIR)/make/tools/src \
$(JDK_TOPDIR)/makefiles/sun/osxapp \
$(JDK_TOPDIR)/make/tools/swing-beans
ifneq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
TOOLS_SRC += $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator
endif
......
......@@ -99,7 +99,7 @@ ifneq ($(COMPILE_TYPE), cross)
$(X_LIBS) \
-I$(JDK_OUTPUTDIR)/include \
-I$(JDK_TOPDIR)/src/share/javavm/export \
-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export \
-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_EXPORT_DIR)/javavm/export \
-I$(JDK_TOPDIR)/src/share/native/common \
-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/common \
-I$(JDK_TOPDIR)/src/solaris/native/sun/awt \
......
......@@ -226,7 +226,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/windows \
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/d3d
else
else ifneq ($(OPENJDK_TARGET_OS), macosx)
LIBAWT_DIRS += \
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/x11
endif
......@@ -509,15 +509,7 @@ BUILD_LIBRARIES += $(BUILD_LIBAWT)
##########################################################################################
# TODO!!
# Even though this variable as a general name, it is
# only used on macos, in fontpath.c, as prefix for where to find fonts.
#
# It's used for libawt_headless _and_ libawt_xawt
#
X11_PATH := /usr/X11R6
ifneq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
ifndef BUILD_HEADLESS_ONLY
LIBAWT_XAWT_DIRS := \
......@@ -532,7 +524,7 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/xawt \
LIBAWT_XAWT_CFLAGS := -DXAWT -DXAWT_HACK \
-DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
-DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
$(CUPS_CFLAGS) \
$(foreach dir, $(LIBAWT_XAWT_DIRS), -I$(dir)) \
-I$(JDK_TOPDIR)/src/share/native/sun/java2d \
......@@ -627,11 +619,6 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
LIBAWT_XAWT_LDFLAGS += -lpthread
endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBAWT_XAWT_LDFLAGS_SUFFIX += -lpthread
endif
# On macosx, the shared library origin is set twice for this lib.
$(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT, \
LIBRARY := awt_xawt, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
......@@ -653,10 +640,6 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
-R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) \
$(call SET_SHARED_LIBRARY_ORIGIN) \
$(call SET_SHARED_LIBRARY_ORIGIN,/..), \
LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN) \
$(call SET_SHARED_LIBRARY_ORIGIN). \
$(call SET_SHARED_LIBRARY_ORIGIN) \
$(call SET_SHARED_LIBRARY_ORIGIN)., \
LDFLAGS_SUFFIX := $(LIBAWT_XAWT_LDFLAGS_SUFFIX), \
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
RC_FLAGS := $(RC_FLAGS) \
......@@ -788,6 +771,11 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
X11TextRenderer.c
LIBFONTMANAGER_OPTIMIZATION := HIGHEST
else ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
X11TextRenderer.c \
fontpath.c \
lcdglyph.c
else
LIBFONTMANAGER_EXCLUDE_FILES += fontpath.c \
lcdglyph.c
......@@ -845,7 +833,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
ifneq (, $(findstring $(OPENJDK_TARGET_OS), solaris macosx))
ifeq ($(OPENJDK_TARGET_OS), solaris)
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_XAWT)
endif
......@@ -947,22 +935,21 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
else # OPENJDK_TARGET_OS not windows
JAWT_LIBS :=
ifneq ($(OPENJDK_TARGET_OS), solaris)
JAWT_LIBS += -lawt
endif
ifndef BUILD_HEADLESS_ONLY
JAWT_LIBS += -lawt_xawt
else
JAWT_LIBS += -lawt_headless
HEADLESS_CFLAG += -DHEADLESS
endif
JAWT_FILES := jawt.c
ifeq ($(OPENJDK_TARGET_OS), macosx)
JAWT_FILES := jawt.m
JAWT_LIBS := -lawt_lwawt
else
JAWT_FILES := jawt.c
JAWT_LIBS :=
ifneq ($(OPENJDK_TARGET_OS), solaris)
JAWT_LIBS += -lawt
endif
ifndef BUILD_HEADLESS_ONLY
JAWT_LIBS += -lawt_xawt
else
JAWT_LIBS += -lawt_headless
HEADLESS_CFLAG += -DHEADLESS
endif
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBJAWT, \
......@@ -1094,7 +1081,8 @@ endif
##########################################################################################
ifeq ($(BUILD_HEADLESS), true)
ifneq ($(OPENJDK_TARGET_OS), windows)
# Mac and Windows only use the native AWT lib, do not build libawt_headless
ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/share/native/sun/font \
$(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
......@@ -1108,7 +1096,7 @@ ifeq ($(BUILD_HEADLESS), true)
endif
LIBAWT_HEADLESS_CFLAGS := -DHEADLESS=true \
-DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
-DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
$(CUPS_CFLAGS) \
$(X_CFLAGS) \
-I$(JDK_TOPDIR)/src/share/native/sun/java2d \
......@@ -1155,16 +1143,6 @@ ifeq ($(BUILD_HEADLESS), true)
AccelGlyphCache.c \
CUPSfuncs.c
ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBAWT_HEADLESS_FILES += \
AWTFont.m \
AWTStrike.m \
CCharToGlyphMapper.m \
CGGlyphImages.m \
CGGlyphOutlines.m \
CoreTextSupport.m
endif
LIBAWT_HEADLESS_REORDER :=
ifeq ($(OPENJDK_TARGET_OS), solaris)
ifneq ($(OPENJDK_TARGET_CPU), x86_64)
......@@ -1191,13 +1169,6 @@ ifeq ($(BUILD_HEADLESS), true)
REORDER := $(LIBAWT_HEADLESS_REORDER), \
LDFLAGS_SUFFIX_linux := -ljvm -lawt -lm $(LIBDL) -ljava, \
LDFLAGS_SUFFIX_solaris := $(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc, \
LDFLAGS_SUFFIX_macosx := -ljvm $(LIBCXX) -lawt $(LIBDL) -ljava \
-framework Accelerate \
-framework ApplicationServices \
-framework Cocoa \
-F/System/Library/Frameworks/JavaVM.framework/Frameworks \
-framework JavaNativeFoundation \
-framework JavaRuntimeSupport, \
OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_headless, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
......
......@@ -267,7 +267,8 @@ SUNWprivate_1.1 {
Java_sun_misc_GC_maxObjectInspectionAge;
Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0;
Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
Java_sun_reflect_Reflection_getCallerClass;
Java_sun_reflect_Reflection_getCallerClass__;
Java_sun_reflect_Reflection_getCallerClass__I;
Java_sun_reflect_Reflection_getClassAccessFlags;
Java_sun_misc_Version_getJdkVersionInfo;
Java_sun_misc_Version_getJdkSpecialVersion;
......
......@@ -27,7 +27,8 @@ text: .text%Java_java_io_FileInputStream_initIDs;
text: .text%Java_java_io_FileDescriptor_initIDs;
text: .text%Java_java_io_FileOutputStream_initIDs;
text: .text%Java_java_lang_System_setIn0;
text: .text%Java_sun_reflect_Reflection_getCallerClass;
text: .text%Java_sun_reflect_Reflection_getCallerClass__;
text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_Object_getClass;
text: .text%Java_sun_reflect_Reflection_getClassAccessFlags;
......
......@@ -26,7 +26,8 @@ text: .text%Java_java_io_FileInputStream_initIDs;
text: .text%Java_java_io_FileDescriptor_initIDs;
text: .text%Java_java_io_FileOutputStream_initIDs;
text: .text%Java_java_lang_System_setIn0;
text: .text%Java_sun_reflect_Reflection_getCallerClass;
text: .text%Java_sun_reflect_Reflection_getCallerClass__;
text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_String_intern;
text: .text%Java_java_lang_Float_floatToIntBits;
......
......@@ -28,7 +28,8 @@ text: .text%Java_java_io_FileInputStream_initIDs;
text: .text%Java_java_io_FileDescriptor_initIDs;
text: .text%Java_java_io_FileOutputStream_initIDs;
text: .text%Java_java_lang_System_setIn0;
text: .text%Java_sun_reflect_Reflection_getCallerClass;
text: .text%Java_sun_reflect_Reflection_getCallerClass__;
text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_String_intern;
text: .text%Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0;
......
......@@ -233,6 +233,10 @@ public class CPrinterJob extends RasterPrinterJob {
setAttributes(attributes);
// throw exception for invalid destination
if (destinationAttr != null) {
validateDestination(destinationAttr);
}
/* Get the range of pages we are to print. If the
* last page to print is unknown, then we print to
......
/*
* Copyright (c) 1999, 2013 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifndef _JAVASOFT_JAWT_MD_H_
#define _JAVASOFT_JAWT_MD_H_
#include "jawt.h"
#ifdef __OBJC__
#import <QuartzCore/CALayer.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Mac OS X specific declarations for AWT native interface.
* See notes in jawt.h for an example of use.
*/
/*
* When calling JAWT_GetAWT with a JAWT version less than 1.7, you must pass this
* flag or you will not be able to get a valid drawing surface and JAWT_GetAWT will
* return false. This is to maintain compatibility with applications that used the
* interface with Java 6 which had multiple rendering models. This flag is not necessary
* when JAWT version 1.7 or greater is used as this is the only supported rendering mode.
*
* Example:
* JAWT awt;
* awt.version = JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER;
* jboolean success = JAWT_GetAWT(env, &awt);
*/
#define JAWT_MACOSX_USE_CALAYER 0x80000000
/*
* When the native Cocoa toolkit is in use, the pointer stored in
* JAWT_DrawingSurfaceInfo->platformInfo points to a NSObject that conforms to the
* JAWT_SurfaceLayers protocol. Setting the layer property of this object will cause the
* specified layer to be overlaid on the Components rectangle. If the window the
* Component belongs to has a CALayer attached to it, this layer will be accessible via
* the windowLayer property.
*/
#ifdef __OBJC__
@protocol JAWT_SurfaceLayers
@property (readwrite, retain) CALayer *layer;
@property (readonly) CALayer *windowLayer;
@end
#endif
#ifdef __cplusplus
}
#endif
#endif /* !_JAVASOFT_JAWT_MD_H_ */
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. 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
......@@ -22,18 +22,21 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.lang.invoke;
/** <P> MagicLambdaImpl (named for similarity to MagicAccessorImpl and
others, not because it actually implements an interface) is a
marker class in the hierarchy. All subclasses of this class are
"magically" granted access by the VM to otherwise inaccessible
fields and methods of other classes. It is distinct from MagicAccessorImpl
because, while we want to bypass accessibility checks, we do not want to
bypass verification.</P>
#ifndef _JAVASOFT_JNI_MD_H_
#define _JAVASOFT_JNI_MD_H_
<P> Do not change the name of this class without also changing the
VM's code. </P> */
#define JNIEXPORT __attribute__((visibility("default")))
#define JNIIMPORT __attribute__((visibility("default")))
#define JNICALL
class MagicLambdaImpl {
}
typedef int jint;
#ifdef _LP64 /* 64-bit */
typedef long jlong;
#else
typedef long long jlong;
#endif
typedef signed char jbyte;
#endif /* !_JAVASOFT_JNI_MD_H_ */
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifndef _JAVASOFT_JVM_MD_H_
#define _JAVASOFT_JVM_MD_H_
/*
* This file is currently collecting system-specific dregs for the
* JNI conversion, which should be sorted out later.
*/
#include <dirent.h> /* For DIR */
#include <sys/param.h> /* For MAXPATHLEN */
#include <unistd.h> /* For F_OK, R_OK, W_OK */
#include <stddef.h> /* For ptrdiff_t */
#include <stdint.h> /* For uintptr_t */
#define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"}
#define JNI_ONUNLOAD_SYMBOLS {"JNI_OnUnload"}
#define JNI_LIB_PREFIX "lib"
#define JNI_LIB_SUFFIX ".dylib"
#define VERSIONED_JNI_LIB_NAME(NAME, VERSION) JNI_LIB_PREFIX NAME "." VERSION JNI_LIB_SUFFIX
#define JNI_LIB_NAME(NAME) JNI_LIB_PREFIX NAME JNI_LIB_SUFFIX
#define JVM_MAXPATHLEN MAXPATHLEN
#define JVM_R_OK R_OK
#define JVM_W_OK W_OK
#define JVM_X_OK X_OK
#define JVM_F_OK F_OK
/*
* File I/O
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/signal.h>
/* O Flags */
#define JVM_O_RDONLY O_RDONLY
#define JVM_O_WRONLY O_WRONLY
#define JVM_O_RDWR O_RDWR
#define JVM_O_O_APPEND O_APPEND
#define JVM_O_EXCL O_EXCL
#define JVM_O_CREAT O_CREAT
#define JVM_O_DELETE 0x10000
/* Signals */
#define JVM_SIGINT SIGINT
#define JVM_SIGTERM SIGTERM
#endif /* !_JAVASOFT_JVM_MD_H_ */
......@@ -23,8 +23,7 @@
* questions.
*/
// REMIND: import <jawt_md.h>
#import <JavaVM/jawt_md.h>
#import <jawt_md.h>
/*
* The CALayer-based rendering model returns an object conforming
......
......@@ -24,7 +24,7 @@
*/
#import <AppKit/AppKit.h>
#import <JavaVM/jni.h>
#import <jni.h>
@interface CMenuComponent : NSObject {
......
......@@ -359,7 +359,11 @@ static void javaPrinterJobToNSPrintInfo(JNIEnv* env, jobject srcPrinterJob, jobj
static JNF_CLASS_CACHE(jc_Pageable, "java/awt/print/Pageable");
static JNF_MEMBER_CACHE(jm_getCopies, sjc_CPrinterJob, "getCopiesInt", "()I");
static JNF_MEMBER_CACHE(jm_isCollated, sjc_CPrinterJob, "isCollated", "()Z");
static JNF_MEMBER_CACHE(jm_getFromPage, sjc_CPrinterJob, "getFromPageAttrib", "()I");
static JNF_MEMBER_CACHE(jm_getToPage, sjc_CPrinterJob, "getToPageAttrib", "()I");
static JNF_MEMBER_CACHE(jm_getSelectAttrib, sjc_CPrinterJob, "getSelectAttrib", "()I");
static JNF_MEMBER_CACHE(jm_getNumberOfPages, jc_Pageable, "getNumberOfPages", "()I");
static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormatFromAttributes", "()Ljava/awt/print/PageFormat;");
NSMutableDictionary* printingDictionary = [dst dictionary];
......@@ -368,19 +372,35 @@ static void javaPrinterJobToNSPrintInfo(JNIEnv* env, jobject srcPrinterJob, jobj
jboolean collated = JNFCallBooleanMethod(env, srcPrinterJob, jm_isCollated); // AWT_THREADING Safe (known object)
[printingDictionary setObject:[NSNumber numberWithBool:collated ? YES : NO] forKey:NSPrintMustCollate];
jint jNumPages = JNFCallIntMethod(env, srcPageable, jm_getNumberOfPages); // AWT_THREADING Safe (!appKit)
if (jNumPages != java_awt_print_Pageable_UNKNOWN_NUMBER_OF_PAGES)
{
[printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
jint selectID = JNFCallIntMethod(env, srcPrinterJob, jm_getSelectAttrib);
if (selectID ==0) {
[printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
} else if (selectID == 2) {
// In Mac 10.7, Print ALL is deselected if PrintSelection is YES whether
// NSPrintAllPages is YES or NO
[printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
[printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintSelectionOnly];
} else {
[printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
}
[printingDictionary setObject:[NSNumber numberWithInteger:1] forKey:NSPrintFirstPage];
[printingDictionary setObject:[NSNumber numberWithInteger:jNumPages] forKey:NSPrintLastPage];
jint fromPage = JNFCallIntMethod(env, srcPrinterJob, jm_getFromPage);
jint toPage = JNFCallIntMethod(env, srcPrinterJob, jm_getToPage);
// setting fromPage and toPage will not be shown in the dialog if printing All pages
[printingDictionary setObject:[NSNumber numberWithInteger:fromPage] forKey:NSPrintFirstPage];
[printingDictionary setObject:[NSNumber numberWithInteger:toPage] forKey:NSPrintLastPage];
}
else
{
[printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
}
jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat);
if (page != NULL) {
javaPageFormatToNSPrintInfo(env, NULL, page, dst);
}
}
/*
......
......@@ -25,8 +25,7 @@
#import <jawt.h>
// REMIND: import <jawt_md.h>
#import <JavaVM/jawt_md.h>
#import <jawt_md.h>
#import "awt_DrawingSurface.h"
......
......@@ -24,7 +24,7 @@
*/
#import <Cocoa/Cocoa.h>
#import <JavaVM/jni.h>
#import <jni.h>
#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
#include "AWTFont.h"
......
......@@ -47,7 +47,7 @@ name(PacketInputStream *in, PacketOutputStream *out)
(void)memset(&info, 0, sizeof(info));
threadGroupInfo(group, &info);
(void)outStream_writeString(out, info.name);
(void)outStream_writeString(out, info.name == NULL ? "" : info.name);
if ( info.name != NULL )
jvmtiDeallocate(info.name);
......
......@@ -298,17 +298,15 @@ jdwpError
outStream_writeString(PacketOutputStream *stream, char *string)
{
jdwpError error;
jint length;
jint length = string != NULL ? (int)strlen(string) : 0;
/* Options utf8=y/n controls if we want Standard UTF-8 or Modified */
if ( gdata->modifiedUtf8 ) {
length = (int)strlen(string);
(void)outStream_writeInt(stream, length);
error = writeBytes(stream, (jbyte *)string, length);
} else {
jint new_length;
length = (int)strlen(string);
new_length = (gdata->npt->utf8mToUtf8sLength)
(gdata->npt->utf, (jbyte*)string, length);
if ( new_length == length ) {
......
......@@ -187,15 +187,24 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
return 1;
}
@Override
public int getWidth(int imageIndex) throws IOException {
checkIndex(imageIndex);
readHeader();
try {
readHeader();
} catch (IllegalArgumentException e) {
throw new IIOException(I18N.getString("BMPImageReader6"), e);
}
return width;
}
public int getHeight(int imageIndex) throws IOException {
checkIndex(imageIndex);
readHeader();
try {
readHeader();
} catch (IllegalArgumentException e) {
throw new IIOException(I18N.getString("BMPImageReader6"), e);
}
return height;
}
......@@ -205,7 +214,18 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
}
}
public void readHeader() throws IOException {
/**
* Process the image header.
*
* @exception IllegalStateException if source stream is not set.
*
* @exception IOException if image stream is corrupted.
*
* @exception IllegalArgumentException if the image stream does not contain
* a BMP image, or if a sample model instance to describe the
* image can not be created.
*/
protected void readHeader() throws IOException, IllegalArgumentException {
if (gotHeader)
return;
......@@ -307,6 +327,9 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
case BI_RLE4: // 4-bit RLE compression
// Read in the palette
if (bitmapOffset < (size + 14)) {
throw new IIOException(I18N.getString("BMPImageReader7"));
}
int numberOfEntries = (int)((bitmapOffset-14-size) / 4);
int sizeOfPalette = numberOfEntries * 4;
palette = new byte[sizeOfPalette];
......@@ -375,7 +398,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
break;
default:
throw new
RuntimeException(I18N.getString("BMPImageReader2"));
IIOException(I18N.getString("BMPImageReader2"));
}
} else if (size == 108 || size == 124) {
// Windows 4.x BMP
......@@ -478,7 +501,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
}
} else {
throw new
RuntimeException(I18N.getString("BMPImageReader3"));
IIOException(I18N.getString("BMPImageReader3"));
}
}
......@@ -660,7 +683,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
public Iterator getImageTypes(int imageIndex)
throws IOException {
checkIndex(imageIndex);
readHeader();
try {
readHeader();
} catch (IllegalArgumentException e) {
throw new IIOException(I18N.getString("BMPImageReader6"), e);
}
ArrayList list = new ArrayList(1);
list.add(new ImageTypeSpecifier(originalColorModel,
originalSampleModel));
......@@ -675,7 +702,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
throws IOException {
checkIndex(imageIndex);
if (metadata == null) {
readHeader();
try {
readHeader();
} catch (IllegalArgumentException e) {
throw new IIOException(I18N.getString("BMPImageReader6"), e);
}
}
return metadata;
}
......@@ -686,7 +717,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
public boolean isRandomAccessEasy(int imageIndex) throws IOException {
checkIndex(imageIndex);
readHeader();
try {
readHeader();
} catch (IllegalArgumentException e) {
throw new IIOException(I18N.getString("BMPImageReader6"), e);
}
return metadata.compression == BI_RGB;
}
......@@ -705,7 +740,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
param = getDefaultReadParam();
//read header
readHeader();
try {
readHeader();
} catch (IllegalArgumentException e) {
throw new IIOException(I18N.getString("BMPImageReader6"), e);
}
sourceRegion = new Rectangle(0, 0, 0, 0);
destinationRegion = new Rectangle(0, 0, 0, 0);
......@@ -817,7 +856,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
default:
throw new
RuntimeException(I18N.getString("BMPImageReader1"));
IIOException(I18N.getString("BMPImageReader1"));
}
break;
......@@ -833,7 +872,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
default:
throw new
RuntimeException(I18N.getString("BMPImageReader1"));
IIOException(I18N.getString("BMPImageReader1"));
}
break;
......@@ -874,7 +913,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
default:
throw new
RuntimeException(I18N.getString("BMPImageReader1"));
IIOException(I18N.getString("BMPImageReader1"));
}
case VERSION_4_8_BIT:
......@@ -890,7 +929,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
default:
throw new
RuntimeException(I18N.getString("BMPImageReader1"));
IIOException(I18N.getString("BMPImageReader1"));
}
break;
......
......@@ -21,6 +21,8 @@ BMPImageReader2=Invalid compression specified in BMP stream.
BMPImageReader3=New BMP version not implemented yet.
BMPImageReader4=No ImageIO-style reader is found for
BMPImageReader5=Input has not been set.
BMPImageReader6=Unable to read the image header.
BMPImageReader7=Invalid bitmap offset.
BMPImageWriter0=Output is not an ImageOutputStream.
BMPImageWriter1=The image region to be encoded is empty.
BMPImageWriter2=Only 1 or 3 band image is encoded.
......@@ -34,7 +36,7 @@ BMPMetadata0=The provided metadata format isn't recognized.
BMPMetadata1=Metadata is read-only.
# WBMP plugin properties
# WBMP plugin properties
WBMPImageReader0=Only one image exists in the stream.
WBMPImageReader1=Input has not been set.
WBMPImageReader2=Bad WBMP header.
......
......@@ -115,6 +115,8 @@ public class GIFImageReader extends ImageReader {
// The current interlace pass, starting with 0.
int interlacePass = 0;
private byte[] fallbackColorTable = null;
// End per-stream settings
// Constants used to control interlacing.
......@@ -239,10 +241,22 @@ public class GIFImageReader extends ImageReader {
byte[] colorTable;
if (imageMetadata.localColorTable != null) {
colorTable = imageMetadata.localColorTable;
fallbackColorTable = imageMetadata.localColorTable;
} else {
colorTable = streamMetadata.globalColorTable;
}
if (colorTable == null) {
if (fallbackColorTable == null) {
this.processWarningOccurred("Use default color table.");
// no color table, the spec allows to use any palette.
fallbackColorTable = getDefaultPalette();
}
colorTable = fallbackColorTable;
}
// Normalize color table length to 2^1, 2^2, 2^4, or 2^8
int length = colorTable.length/3;
int bits;
......@@ -1036,5 +1050,34 @@ public class GIFImageReader extends ImageReader {
streamY = -1;
rowsDone = 0;
interlacePass = 0;
fallbackColorTable = null;
}
private static byte[] defaultPalette = null;
private static synchronized byte[] getDefaultPalette() {
if (defaultPalette == null) {
BufferedImage img = new BufferedImage(1, 1,
BufferedImage.TYPE_BYTE_INDEXED);
IndexColorModel icm = (IndexColorModel) img.getColorModel();
final int size = icm.getMapSize();
byte[] r = new byte[size];
byte[] g = new byte[size];
byte[] b = new byte[size];
icm.getReds(r);
icm.getGreens(g);
icm.getBlues(b);
defaultPalette = new byte[size * 3];
for (int i = 0; i < size; i++) {
defaultPalette[3 * i + 0] = r[i];
defaultPalette[3 * i + 1] = g[i];
defaultPalette[3 * i + 2] = b[i];
}
}
return defaultPalette;
}
}
......@@ -28,6 +28,7 @@ package com.sun.imageio.plugins.jpeg;
import javax.imageio.metadata.IIOInvalidTreeException;
import javax.imageio.metadata.IIOMetadataNode;
import javax.imageio.stream.ImageOutputStream;
import javax.imageio.IIOException;
import java.io.IOException;
......@@ -60,6 +61,10 @@ class MarkerSegment implements Cloneable {
length = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
length |= buffer.buf[buffer.bufPtr++] & 0xff;
length -= 2; // JPEG length includes itself, we don't
if (length < 0) {
throw new IIOException("Invalid segment length: " + length);
}
buffer.bufAvail -= 3;
// Now that we know the true length, ensure that we've got it,
// or at least a bufferful if length is too big.
......
......@@ -78,7 +78,7 @@ class SOFMarkerSegment extends MarkerSegment {
numLines |= buffer.buf[buffer.bufPtr++] & 0xff;
samplesPerLine = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
samplesPerLine |= buffer.buf[buffer.bufPtr++] & 0xff;
int numComponents = buffer.buf[buffer.bufPtr++];
int numComponents = buffer.buf[buffer.bufPtr++] & 0xff;
componentSpecs = new ComponentSpec [numComponents];
for (int i = 0; i < numComponents; i++) {
componentSpecs[i] = new ComponentSpec(buffer);
......
......@@ -688,6 +688,21 @@ public class PNGImageReader extends ImageReader {
loop: while (true) {
int chunkLength = stream.readInt();
int chunkType = stream.readInt();
int chunkCRC;
// verify the chunk length
if (chunkLength < 0) {
throw new IIOException("Invalid chunk lenght " + chunkLength);
};
try {
stream.mark();
stream.seek(stream.getStreamPosition() + chunkLength);
chunkCRC = stream.readInt();
stream.reset();
} catch (IOException e) {
throw new IIOException("Invalid chunk length " + chunkLength);
}
switch (chunkType) {
case IDAT_TYPE:
......@@ -762,7 +777,11 @@ public class PNGImageReader extends ImageReader {
break;
}
int chunkCRC = stream.readInt();
// double check whether all chunk data were consumed
if (chunkCRC != stream.readInt()) {
throw new IIOException("Failed to read a chunk of type " +
chunkType);
}
stream.flushBefore(stream.getStreamPosition());
}
} catch (IOException e) {
......@@ -1277,6 +1296,16 @@ public class PNGImageReader extends ImageReader {
is = new BufferedInputStream(is);
this.pixelStream = new DataInputStream(is);
/*
* NB: the PNG spec declares that valid range for width
* and height is [1, 2^31-1], so here we may fail to allocate
* a buffer for destination image due to memory limitation.
*
* However, the recovery strategy for this case should be
* defined on the level of application, so we will not
* try to estimate the required amount of the memory and/or
* handle OOM in any way.
*/
theImage = getDestination(param,
getImageTypes(0),
width,
......
......@@ -41,7 +41,7 @@ FileChooser.saveDialogTitle.textAndMnemonic=Speichern
FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
FileChooser.pathLabel.textAndMnemonic=Aus&wahl:
FileChooser.filterLabel.textAndMnemonic=Filter:
FileChooser.foldersLabel.textAndMnemonic=Or&dner
FileChooser.foldersLabel.textAndMnemonic=O&rdner
FileChooser.filesLabel.textAndMnemonic=&Dateien
FileChooser.cancelButtonToolTip.textAndMnemonic=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen.
......
......@@ -130,7 +130,7 @@ public class SnmpString extends SnmpValue {
* @return The value.
*/
public byte[] byteValue() {
return value ;
return value.clone() ;
}
/**
......
......@@ -476,8 +476,7 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
rootOid[i++]= val.longValue();
}
}
return rootOid;
return rootOid.clone();
}
// --------------------------------------------------------------------
......
......@@ -1248,7 +1248,7 @@ public abstract class CommunicatorServer
"of this CommunicatorServer instance has changed.");
}
return notifInfos;
return notifInfos.clone();
}
/**
......
......@@ -167,6 +167,7 @@ public class ComponentSampleModel extends SampleModel
for (int i=0; i<numBands; i++) {
bankIndices[i] = 0;
}
verify();
}
......@@ -244,24 +245,53 @@ public class ComponentSampleModel extends SampleModel
throw new IllegalArgumentException("Length of bandOffsets must "+
"equal length of bankIndices.");
}
verify();
}
private void verify() {
int requiredSize = getBufferSize();
}
/**
* Returns the size of the data buffer (in data elements) needed
* for a data buffer that matches this ComponentSampleModel.
*/
private long getBufferSize() {
private int getBufferSize() {
int maxBandOff=bandOffsets[0];
for (int i=1; i<bandOffsets.length; i++)
for (int i=1; i<bandOffsets.length; i++) {
maxBandOff = Math.max(maxBandOff,bandOffsets[i]);
}
if (maxBandOff < 0 || maxBandOff > (Integer.MAX_VALUE - 1)) {
throw new IllegalArgumentException("Invalid band offset");
}
if (pixelStride < 0 || pixelStride > (Integer.MAX_VALUE / width)) {
throw new IllegalArgumentException("Invalid pixel stride");
}
if (scanlineStride < 0 || scanlineStride > (Integer.MAX_VALUE / height)) {
throw new IllegalArgumentException("Invalid scanline stride");
}
int size = maxBandOff + 1;
int val = pixelStride * (width - 1);
if (val > (Integer.MAX_VALUE - size)) {
throw new IllegalArgumentException("Invalid pixel stride");
}
size += val;
val = scanlineStride * (height - 1);
if (val > (Integer.MAX_VALUE - size)) {
throw new IllegalArgumentException("Invalid scan stride");
}
size += val;
long size = 0;
if (maxBandOff >= 0)
size += maxBandOff+1;
if (pixelStride > 0)
size += pixelStride * (width-1);
if (scanlineStride > 0)
size += scanlineStride*(height-1);
return size;
}
......@@ -409,7 +439,7 @@ public class ComponentSampleModel extends SampleModel
public DataBuffer createDataBuffer() {
DataBuffer dataBuffer = null;
int size = (int)getBufferSize();
int size = getBufferSize();
switch (dataType) {
case DataBuffer.TYPE_BYTE:
dataBuffer = new DataBufferByte(size, numBanks);
......
......@@ -275,7 +275,6 @@ class ByteArrayInputStream extends InputStream {
* Closing a <tt>ByteArrayInputStream</tt> has no effect. The methods in
* this class can be called after the stream has been closed without
* generating an <tt>IOException</tt>.
* <p>
*/
public void close() throws IOException {
}
......
......@@ -263,8 +263,6 @@ public class ByteArrayOutputStream extends OutputStream {
* Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in
* this class can be called after the stream has been closed without
* generating an <tt>IOException</tt>.
* <p>
*
*/
public void close() throws IOException {
}
......
......@@ -34,7 +34,6 @@ import java.io.IOException;
*
* @since 1.5
*/
@FunctionalInterface
public interface Closeable extends AutoCloseable {
/**
......
......@@ -155,7 +155,7 @@ interface DataInput {
* to the length of {@code b}.
* <p>
* This method blocks until one of the
* following conditions occurs:<p>
* following conditions occurs:
* <ul>
* <li>{@code b.length}
* bytes of input data are available, in which
......@@ -197,7 +197,7 @@ interface DataInput {
* <p>
* This method
* blocks until one of the following conditions
* occurs:<p>
* occurs:
* <ul>
* <li>{@code len} bytes
* of input data are available, in which case
......@@ -316,8 +316,8 @@ interface DataInput {
* be the second byte. The value
* returned
* is:
* <p><pre><code>(short)((a &lt;&lt; 8) | (b &amp; 0xff))
* </code></pre>
* <pre>{@code (short)((a << 8) | (b & 0xff))
* }</pre>
* This method
* is suitable for reading the bytes written
* by the {@code writeShort} method of
......@@ -337,8 +337,8 @@ interface DataInput {
* be the first byte read and
* {@code b}
* be the second byte. The value returned is:
* <p><pre><code>(((a &amp; 0xff) &lt;&lt; 8) | (b &amp; 0xff))
* </code></pre>
* <pre>{@code (((a & 0xff) << 8) | (b & 0xff))
* }</pre>
* This method is suitable for reading the bytes
* written by the {@code writeShort} method
* of interface {@code DataOutput} if
......@@ -359,8 +359,8 @@ interface DataInput {
* be the first byte read and {@code b}
* be the second byte. The value
* returned is:
* <p><pre><code>(char)((a &lt;&lt; 8) | (b &amp; 0xff))
* </code></pre>
* <pre>{@code (char)((a << 8) | (b & 0xff))
* }</pre>
* This method
* is suitable for reading bytes written by
* the {@code writeChar} method of interface
......@@ -377,10 +377,10 @@ interface DataInput {
* Reads four input bytes and returns an
* {@code int} value. Let {@code a-d}
* be the first through fourth bytes read. The value returned is:
* <p><pre><code>
* (((a &amp; 0xff) &lt;&lt; 24) | ((b &amp; 0xff) &lt;&lt; 16) |
* &#32;((c &amp; 0xff) &lt;&lt; 8) | (d &amp; 0xff))
* </code></pre>
* <pre>{@code
* (((a & 0xff) << 24) | ((b & 0xff) << 16) |
* ((c & 0xff) << 8) | (d & 0xff))
* }</pre>
* This method is suitable
* for reading bytes written by the {@code writeInt}
* method of interface {@code DataOutput}.
......@@ -397,16 +397,16 @@ interface DataInput {
* a {@code long} value. Let {@code a-h}
* be the first through eighth bytes read.
* The value returned is:
* <p><pre><code>
* (((long)(a &amp; 0xff) &lt;&lt; 56) |
* ((long)(b &amp; 0xff) &lt;&lt; 48) |
* ((long)(c &amp; 0xff) &lt;&lt; 40) |
* ((long)(d &amp; 0xff) &lt;&lt; 32) |
* ((long)(e &amp; 0xff) &lt;&lt; 24) |
* ((long)(f &amp; 0xff) &lt;&lt; 16) |
* ((long)(g &amp; 0xff) &lt;&lt; 8) |
* ((long)(h &amp; 0xff)))
* </code></pre>
* <pre>{@code
* (((long)(a & 0xff) << 56) |
* ((long)(b & 0xff) << 48) |
* ((long)(c & 0xff) << 40) |
* ((long)(d & 0xff) << 32) |
* ((long)(e & 0xff) << 24) |
* ((long)(f & 0xff) << 16) |
* ((long)(g & 0xff) << 8) |
* ((long)(h & 0xff)))
* }</pre>
* <p>
* This method is suitable
* for reading bytes written by the {@code writeLong}
......@@ -540,9 +540,9 @@ interface DataInput {
* not match the bit pattern {@code 10xxxxxx},
* then a {@code UTFDataFormatException}
* is thrown. Otherwise, the group is converted
* to the character:<p>
* <pre><code>(char)(((a&amp; 0x1F) &lt;&lt; 6) | (b &amp; 0x3F))
* </code></pre>
* to the character:
* <pre>{@code (char)(((a & 0x1F) << 6) | (b & 0x3F))
* }</pre>
* If the first byte of a group
* matches the bit pattern {@code 1110xxxx},
* then the group consists of that byte {@code a}
......@@ -554,10 +554,10 @@ interface DataInput {
* does not match the bit pattern {@code 10xxxxxx},
* then a {@code UTFDataFormatException}
* is thrown. Otherwise, the group is converted
* to the character:<p>
* <pre><code>
* (char)(((a &amp; 0x0F) &lt;&lt; 12) | ((b &amp; 0x3F) &lt;&lt; 6) | (c &amp; 0x3F))
* </code></pre>
* to the character:
* <pre>{@code
* (char)(((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F))
* }</pre>
* If the first byte of a group matches the
* pattern {@code 1111xxxx} or the pattern
* {@code 10xxxxxx}, then a {@code UTFDataFormatException}
......
......@@ -134,11 +134,11 @@ interface DataOutput {
* Writes two bytes to the output
* stream to represent the value of the argument.
* The byte values to be written, in the order
* shown, are: <p>
* <pre><code>
* (byte)(0xff &amp; (v &gt;&gt; 8))
* (byte)(0xff &amp; v)
* </code> </pre> <p>
* shown, are:
* <pre>{@code
* (byte)(0xff & (v >> 8))
* (byte)(0xff & v)
* }</pre> <p>
* The bytes written by this method may be
* read by the <code>readShort</code> method
* of interface <code>DataInput</code> , which
......@@ -156,10 +156,10 @@ interface DataOutput {
* output stream.
* The byte values to be written, in the order
* shown, are:
* <p><pre><code>
* (byte)(0xff &amp; (v &gt;&gt; 8))
* (byte)(0xff &amp; v)
* </code></pre><p>
* <pre>{@code
* (byte)(0xff & (v >> 8))
* (byte)(0xff & v)
* }</pre><p>
* The bytes written by this method may be
* read by the <code>readChar</code> method
* of interface <code>DataInput</code> , which
......@@ -176,12 +176,12 @@ interface DataOutput {
* comprised of four bytes, to the output stream.
* The byte values to be written, in the order
* shown, are:
* <p><pre><code>
* (byte)(0xff &amp; (v &gt;&gt; 24))
* (byte)(0xff &amp; (v &gt;&gt; 16))
* (byte)(0xff &amp; (v &gt;&gt; &#32; &#32;8))
* (byte)(0xff &amp; v)
* </code></pre><p>
* <pre>{@code
* (byte)(0xff & (v >> 24))
* (byte)(0xff & (v >> 16))
* (byte)(0xff & (v >> 8))
* (byte)(0xff & v)
* }</pre><p>
* The bytes written by this method may be read
* by the <code>readInt</code> method of interface
* <code>DataInput</code> , which will then
......@@ -197,16 +197,16 @@ interface DataOutput {
* comprised of eight bytes, to the output stream.
* The byte values to be written, in the order
* shown, are:
* <p><pre><code>
* (byte)(0xff &amp; (v &gt;&gt; 56))
* (byte)(0xff &amp; (v &gt;&gt; 48))
* (byte)(0xff &amp; (v &gt;&gt; 40))
* (byte)(0xff &amp; (v &gt;&gt; 32))
* (byte)(0xff &amp; (v &gt;&gt; 24))
* (byte)(0xff &amp; (v &gt;&gt; 16))
* (byte)(0xff &amp; (v &gt;&gt; 8))
* (byte)(0xff &amp; v)
* </code></pre><p>
* <pre>{@code
* (byte)(0xff & (v >> 56))
* (byte)(0xff & (v >> 48))
* (byte)(0xff & (v >> 40))
* (byte)(0xff & (v >> 32))
* (byte)(0xff & (v >> 24))
* (byte)(0xff & (v >> 16))
* (byte)(0xff & (v >> 8))
* (byte)(0xff & v)
* }</pre><p>
* The bytes written by this method may be
* read by the <code>readLong</code> method
* of interface <code>DataInput</code> , which
......@@ -314,24 +314,24 @@ interface DataOutput {
* If a character <code>c</code>
* is in the range <code>&#92;u0001</code> through
* <code>&#92;u007f</code>, it is represented
* by one byte:<p>
* by one byte:
* <pre>(byte)c </pre> <p>
* If a character <code>c</code> is <code>&#92;u0000</code>
* or is in the range <code>&#92;u0080</code>
* through <code>&#92;u07ff</code>, then it is
* represented by two bytes, to be written
* in the order shown:<p> <pre><code>
* (byte)(0xc0 | (0x1f &amp; (c &gt;&gt; 6)))
* (byte)(0x80 | (0x3f &amp; c))
* </code></pre> <p> If a character
* in the order shown: <pre>{@code
* (byte)(0xc0 | (0x1f & (c >> 6)))
* (byte)(0x80 | (0x3f & c))
* }</pre> <p> If a character
* <code>c</code> is in the range <code>&#92;u0800</code>
* through <code>uffff</code>, then it is
* represented by three bytes, to be written
* in the order shown:<p> <pre><code>
* (byte)(0xe0 | (0x0f &amp; (c &gt;&gt; 12)))
* (byte)(0x80 | (0x3f &amp; (c &gt;&gt; 6)))
* (byte)(0x80 | (0x3f &amp; c))
* </code></pre> <p> First,
* in the order shown: <pre>{@code
* (byte)(0xe0 | (0x0f & (c >> 12)))
* (byte)(0x80 | (0x3f & (c >> 6)))
* (byte)(0x80 | (0x3f & c))
* }</pre> <p> First,
* the total number of bytes needed to represent
* all the characters of <code>s</code> is
* calculated. If this number is larger than
......
......@@ -55,7 +55,7 @@ import sun.security.util.SecurityConstants;
* a list of one or more comma-separated keywords. The possible keywords are
* "read", "write", "execute", "delete", and "readlink". Their meaning is
* defined as follows:
* <P>
*
* <DL>
* <DT> read <DD> read permission
* <DT> write <DD> write permission
......@@ -297,11 +297,11 @@ public final class FilePermission extends Permission implements Serializable {
/**
* Checks if this FilePermission object "implies" the specified permission.
* <P>
* More specifically, this method returns true if:<p>
* More specifically, this method returns true if:
* <ul>
* <li> <i>p</i> is an instanceof FilePermission,<p>
* <li> <i>p</i> is an instanceof FilePermission,
* <li> <i>p</i>'s actions are a proper subset of this
* object's actions, and <p>
* object's actions, and
* <li> <i>p</i>'s pathname is implied by this object's
* pathname. For example, "/tmp/*" implies "/tmp/foo", since
* "/tmp/*" encompasses all files in the "/tmp" directory,
......
......@@ -34,7 +34,6 @@ import java.io.IOException;
*
* @since 1.5
*/
@FunctionalInterface
public interface Flushable {
/**
......
......@@ -306,8 +306,7 @@ public abstract class InputStream implements Closeable {
*
* <p> The general contract of <code>reset</code> is:
*
* <p><ul>
*
* <ul>
* <li> If the method <code>markSupported</code> returns
* <code>true</code>, then:
*
......
......@@ -109,7 +109,7 @@ import sun.reflect.misc.ReflectUtil;
*
* <p>Serializable classes that require special handling during the
* serialization and deserialization process should implement the following
* methods:<p>
* methods:
*
* <pre>
* private void writeObject(java.io.ObjectOutputStream stream)
......
......@@ -172,15 +172,14 @@ public class PipedInputStream extends InputStream {
* unconnected piped output stream and <code>snk</code>
* is an unconnected piped input stream, they
* may be connected by either the call:
* <p>
*
* <pre><code>snk.connect(src)</code> </pre>
* <p>
* or the call:
* <p>
*
* <pre><code>src.connect(snk)</code> </pre>
* <p>
* The two
* calls have the same effect.
* The two calls have the same effect.
*
* @param src The piped output stream to connect to.
* @exception IOException if an I/O error occurs.
......
......@@ -145,15 +145,14 @@ public class PipedReader extends Reader {
* unconnected piped writer and <code>snk</code>
* is an unconnected piped reader, they
* may be connected by either the call:
* <p>
*
* <pre><code>snk.connect(src)</code> </pre>
* <p>
* or the call:
* <p>
*
* <pre><code>src.connect(snk)</code> </pre>
* <p>
* The two
* calls have the same effect.
* The two calls have the same effect.
*
* @param src The piped writer to connect to.
* @exception IOException if an I/O error occurs.
......
......@@ -784,7 +784,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* </pre></blockquote>
* <p>
* then the result is equal to:
* <p><blockquote><pre>
* <blockquote><pre>
* ((long)b1 &lt;&lt; 56) + ((long)b2 &lt;&lt; 48)
* + ((long)b3 &lt;&lt; 40) + ((long)b4 &lt;&lt; 32)
* + ((long)b5 &lt;&lt; 24) + ((long)b6 &lt;&lt; 16)
......
......@@ -55,7 +55,7 @@ package java.io;
*
* Classes that require special handling during the serialization and
* deserialization process must implement special methods with these exact
* signatures: <p>
* signatures:
*
* <PRE>
* private void writeObject(java.io.ObjectOutputStream out)
......@@ -101,7 +101,7 @@ package java.io;
*
* <p>Serializable classes that need to designate an alternative object to be
* used when writing an object to the stream should implement this
* special method with the exact signature: <p>
* special method with the exact signature:
*
* <PRE>
* ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException;
......@@ -115,7 +115,7 @@ package java.io;
*
* Classes that need to designate a replacement when an instance of it
* is read from the stream should implement this special method with the
* exact signature.<p>
* exact signature.
*
* <PRE>
* ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException;
......@@ -133,7 +133,7 @@ package java.io;
* deserialization will result in an {@link InvalidClassException}. A
* serializable class can declare its own serialVersionUID explicitly by
* declaring a field named <code>"serialVersionUID"</code> that must be static,
* final, and of type <code>long</code>:<p>
* final, and of type <code>long</code>:
*
* <PRE>
* ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L;
......
......@@ -43,7 +43,6 @@ import java.util.StringTokenizer;
* The following table lists all the possible SerializablePermission target names,
* and for each provides a description of what the permission allows
* and a discussion of the risks of granting code the permission.
* <P>
*
* <table border=1 cellpadding=5 summary="Permission target name, what the permission allows, and associated risks">
* <tr>
......
......@@ -330,9 +330,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* characters to be copied is {@code srcEnd-srcBegin}. The
* characters are copied into the subarray of {@code dst} starting
* at index {@code dstBegin} and ending at index:
* <p><blockquote><pre>
* <pre>{@code
* dstbegin + (srcEnd-srcBegin) - 1
* </pre></blockquote>
* }</pre>
*
* @param srcBegin start copying at this offset.
* @param srcEnd stop copying at this offset.
......@@ -859,16 +859,16 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
*
* <p> An invocation of this method of the form
*
* <blockquote><pre>
* sb.subSequence(begin,&nbsp;end)</pre></blockquote>
* <pre>{@code
* sb.subSequence(begin,&nbsp;end)}</pre>
*
* behaves in exactly the same way as the invocation
*
* <blockquote><pre>
* sb.substring(begin,&nbsp;end)</pre></blockquote>
* <pre>{@code
* sb.substring(begin,&nbsp;end)}</pre>
*
* This method is provided so that this class can
* implement the {@link CharSequence} interface. </p>
* implement the {@link CharSequence} interface.
*
* @param start the start index, inclusive.
* @param end the end index, exclusive.
......@@ -1287,9 +1287,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* Returns the index within this string of the first occurrence of the
* specified substring. The integer returned is the smallest value
* <i>k</i> such that:
* <blockquote><pre>
* <pre>{@code
* this.toString().startsWith(str, <i>k</i>)
* </pre></blockquote>
* }</pre>
* is {@code true}.
*
* @param str any string.
......@@ -1306,10 +1306,10 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* Returns the index within this string of the first occurrence of the
* specified substring, starting at the specified index. The integer
* returned is the smallest value {@code k} for which:
* <blockquote><pre>
* <pre>{@code
* k >= Math.min(fromIndex, this.length()) &&
* this.toString().startsWith(str, k)
* </pre></blockquote>
* }</pre>
* If no such value of <i>k</i> exists, then -1 is returned.
*
* @param str the substring for which to search.
......@@ -1326,9 +1326,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* of the specified substring. The rightmost empty string "" is
* considered to occur at the index value {@code this.length()}.
* The returned index is the largest value <i>k</i> such that
* <blockquote><pre>
* <pre>{@code
* this.toString().startsWith(str, k)
* </pre></blockquote>
* }</pre>
* is true.
*
* @param str the substring to search for.
......@@ -1345,10 +1345,10 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* Returns the index within this string of the last occurrence of the
* specified substring. The integer returned is the largest value <i>k</i>
* such that:
* <blockquote><pre>
* <pre>{@code
* k <= Math.min(fromIndex, this.length()) &&
* this.toString().startsWith(str, k)
* </pre></blockquote>
* }</pre>
* If no such value of <i>k</i> exists, then -1 is returned.
*
* @param str the substring to search for.
......
......@@ -29,7 +29,7 @@ package java.lang;
* Thrown to indicate that an attempt has been made to store the
* wrong type of object into an array of objects. For example, the
* following code generates an <code>ArrayStoreException</code>:
* <p><blockquote><pre>
* <blockquote><pre>
* Object x[] = new String[3];
* x[0] = new Integer(0);
* </pre></blockquote>
......
......@@ -48,7 +48,6 @@ package java.lang;
* @author Josh Bloch
* @since 1.7
*/
@FunctionalInterface
public interface AutoCloseable {
/**
* Closes this resource, relinquishing any underlying resources.
......
......@@ -244,7 +244,7 @@ public final class Byte extends Number implements Comparable<Byte> {
* <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i>
* <p>
*
* <dt><i>Sign:</i>
* <dd>{@code -}
* <dd>{@code +}
......
......@@ -5394,7 +5394,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* Other_Lowercase as defined by the Unicode Standard.
* <p>
* The following are examples of lowercase characters:
* <p><blockquote><pre>
* <blockquote><pre>
* a b c d e f g h i j k l m n o p q r s t u v w x y z
* '&#92;u00DF' '&#92;u00E0' '&#92;u00E1' '&#92;u00E2' '&#92;u00E3' '&#92;u00E4' '&#92;u00E5' '&#92;u00E6'
* '&#92;u00E7' '&#92;u00E8' '&#92;u00E9' '&#92;u00EA' '&#92;u00EB' '&#92;u00EC' '&#92;u00ED' '&#92;u00EE'
......@@ -5430,7 +5430,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* Other_Lowercase as defined by the Unicode Standard.
* <p>
* The following are examples of lowercase characters:
* <p><blockquote><pre>
* <blockquote><pre>
* a b c d e f g h i j k l m n o p q r s t u v w x y z
* '&#92;u00DF' '&#92;u00E0' '&#92;u00E1' '&#92;u00E2' '&#92;u00E3' '&#92;u00E4' '&#92;u00E5' '&#92;u00E6'
* '&#92;u00E7' '&#92;u00E8' '&#92;u00E9' '&#92;u00EA' '&#92;u00EB' '&#92;u00EC' '&#92;u00ED' '&#92;u00EE'
......@@ -5461,14 +5461,14 @@ class Character implements java.io.Serializable, Comparable<Character> {
* or it has contributory property Other_Uppercase as defined by the Unicode Standard.
* <p>
* The following are examples of uppercase characters:
* <p><blockquote><pre>
* <blockquote><pre>
* A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
* '&#92;u00C0' '&#92;u00C1' '&#92;u00C2' '&#92;u00C3' '&#92;u00C4' '&#92;u00C5' '&#92;u00C6' '&#92;u00C7'
* '&#92;u00C8' '&#92;u00C9' '&#92;u00CA' '&#92;u00CB' '&#92;u00CC' '&#92;u00CD' '&#92;u00CE' '&#92;u00CF'
* '&#92;u00D0' '&#92;u00D1' '&#92;u00D2' '&#92;u00D3' '&#92;u00D4' '&#92;u00D5' '&#92;u00D6' '&#92;u00D8'
* '&#92;u00D9' '&#92;u00DA' '&#92;u00DB' '&#92;u00DC' '&#92;u00DD' '&#92;u00DE'
* </pre></blockquote>
* <p> Many other Unicode characters are uppercase too.<p>
* <p> Many other Unicode characters are uppercase too.
*
* <p><b>Note:</b> This method cannot handle <a
* href="#supplementary"> supplementary characters</a>. To support
......@@ -5496,7 +5496,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* or it has contributory property Other_Uppercase as defined by the Unicode Standard.
* <p>
* The following are examples of uppercase characters:
* <p><blockquote><pre>
* <blockquote><pre>
* A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
* '&#92;u00C0' '&#92;u00C1' '&#92;u00C2' '&#92;u00C3' '&#92;u00C4' '&#92;u00C5' '&#92;u00C6' '&#92;u00C7'
* '&#92;u00C8' '&#92;u00C9' '&#92;u00CA' '&#92;u00CB' '&#92;u00CC' '&#92;u00CD' '&#92;u00CE' '&#92;u00CF'
......@@ -5540,7 +5540,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* <li>{@code LATIN CAPITAL LETTER N WITH SMALL LETTER J}
* <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z}
* </ul>
* <p> Many other Unicode characters are titlecase too.<p>
* <p> Many other Unicode characters are titlecase too.
*
* <p><b>Note:</b> This method cannot handle <a
* href="#supplementary"> supplementary characters</a>. To support
......
......@@ -91,7 +91,7 @@ import sun.reflect.misc.ReflectUtil;
* <p> The following example uses a {@code Class} object to print the
* class name of an object:
*
* <p> <blockquote><pre>
* <blockquote><pre>
* void printClassName(Object obj) {
* System.out.println("The class of " + obj +
* " is " + obj.getClass().getName());
......@@ -103,7 +103,7 @@ import sun.reflect.misc.ReflectUtil;
* <cite>The Java&trade; Language Specification</cite>.
* For example:
*
* <p> <blockquote>
* <blockquote>
* {@code System.out.println("The name of class Foo is: "+Foo.class.getName());}
* </blockquote>
*
......@@ -1571,6 +1571,10 @@ public final class Class<T> implements java.io.Serializable,
* <p> If this {@code Class} object represents a primitive type or void,
* then the returned array has length 0.
*
* <p> Static methods declared in superinterfaces of the class or interface
* represented by this {@code Class} object are not considered members of
* the class or interface.
*
* <p> The elements in the returned array are not sorted and are not in any
* particular order.
*
......@@ -1729,6 +1733,10 @@ public final class Class<T> implements java.io.Serializable,
* <p> If this {@code Class} object represents an array type, then this
* method does not find the {@code clone()} method.
*
* <p> Static methods declared in superinterfaces of the class or interface
* represented by this {@code Class} object are not considered members of
* the class or interface.
*
* @param name the name of the method
* @param parameterTypes the list of parameters
* @return the {@code Method} object that matches the specified
......@@ -1752,7 +1760,7 @@ public final class Class<T> implements java.io.Serializable,
public Method getMethod(String name, Class<?>... parameterTypes)
throws NoSuchMethodException, SecurityException {
checkMemberAccess(Member.PUBLIC, Reflection.getCallerClass(), true);
Method method = getMethod0(name, parameterTypes);
Method method = getMethod0(name, parameterTypes, true);
if (method == null) {
throw new NoSuchMethodException(getName() + "." + name + argumentTypesToString(parameterTypes));
}
......@@ -2727,6 +2735,14 @@ public final class Class<T> implements java.io.Serializable,
}
}
void addAllNonStatic(Method[] methods) {
for (Method candidate : methods) {
if (!Modifier.isStatic(candidate.getModifiers())) {
add(candidate);
}
}
}
int length() {
return length;
}
......@@ -2797,7 +2813,7 @@ public final class Class<T> implements java.io.Serializable,
MethodArray inheritedMethods = new MethodArray();
Class<?>[] interfaces = getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
inheritedMethods.addAll(interfaces[i].privateGetPublicMethods());
inheritedMethods.addAllNonStatic(interfaces[i].privateGetPublicMethods());
}
if (!isInterface()) {
Class<?> c = getSuperclass();
......@@ -2900,7 +2916,7 @@ public final class Class<T> implements java.io.Serializable,
}
private Method getMethod0(String name, Class<?>[] parameterTypes) {
private Method getMethod0(String name, Class<?>[] parameterTypes, boolean includeStaticMethods) {
// Note: the intent is that the search algorithm this routine
// uses be equivalent to the ordering imposed by
// privateGetPublicMethods(). It fetches only the declared
......@@ -2913,25 +2929,23 @@ public final class Class<T> implements java.io.Serializable,
if ((res = searchMethods(privateGetDeclaredMethods(true),
name,
parameterTypes)) != null) {
return res;
if (includeStaticMethods || !Modifier.isStatic(res.getModifiers()))
return res;
}
// Search superclass's methods
if (!isInterface()) {
Class<? super T> c = getSuperclass();
if (c != null) {
if ((res = c.getMethod0(name, parameterTypes)) != null) {
if ((res = c.getMethod0(name, parameterTypes, true)) != null) {
return res;
}
}
}
// Search superinterfaces' methods
Class<?>[] interfaces = getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
Class<?> c = interfaces[i];
if ((res = c.getMethod0(name, parameterTypes)) != null) {
for (Class<?> c : interfaces)
if ((res = c.getMethod0(name, parameterTypes, false)) != null)
return res;
}
}
// Not found
return null;
}
......@@ -3300,7 +3314,10 @@ public final class Class<T> implements java.io.Serializable,
public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationClass) {
Objects.requireNonNull(annotationClass);
return AnnotationSupport.getMultipleAnnotations(annotationData().annotations, annotationClass);
AnnotationData annotationData = annotationData();
return AnnotationSupport.getAssociatedAnnotations(annotationData.declaredAnnotations,
this,
annotationClass);
}
/**
......@@ -3330,7 +3347,8 @@ public final class Class<T> implements java.io.Serializable,
public <A extends Annotation> A[] getDeclaredAnnotationsByType(Class<A> annotationClass) {
Objects.requireNonNull(annotationClass);
return AnnotationSupport.getMultipleAnnotations(annotationData().declaredAnnotations, annotationClass);
return AnnotationSupport.getDirectlyAndIndirectlyPresent(annotationData().declaredAnnotations,
annotationClass);
}
/**
......@@ -3424,6 +3442,10 @@ public final class Class<T> implements java.io.Serializable,
return annotationType;
}
Map<Class<? extends Annotation>, Annotation> getDeclaredAnnotationMap() {
return annotationData().declaredAnnotations;
}
/* Backing store of user-defined values pertaining to this class.
* Maintained by the ClassValue class.
*/
......
......@@ -29,7 +29,7 @@ package java.lang;
* Thrown to indicate that the code has attempted to cast an object
* to a subclass of which it is not an instance. For example, the
* following code generates a <code>ClassCastException</code>:
* <p><blockquote><pre>
* <blockquote><pre>
* Object x = new Integer(0);
* System.out.println((String)x);
* </pre></blockquote>
......
......@@ -362,7 +362,7 @@ public abstract class ClassLoader {
* default implementation of this method searches for classes in the
* following order:
*
* <p><ol>
* <ol>
*
* <li><p> Invoke {@link #findLoadedClass(String)} to check if the class
* has already been loaded. </p></li>
......@@ -488,7 +488,7 @@ public abstract class ClassLoader {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
if (ReflectUtil.isNonPublicProxyClass(cls)) {
for (Class intf: cls.getInterfaces()) {
for (Class<?> intf: cls.getInterfaces()) {
checkPackageAccess(intf, pd);
}
return;
......
......@@ -692,7 +692,7 @@ public abstract class ClassValue<T> {
/** Remove all stale entries, everywhere. */
private void removeStaleEntries() {
Entry[] cache = getCache();
Entry<?>[] cache = getCache();
removeStaleEntries(cache, 0, cache.length + PROBE_LIMIT - 1);
}
......
......@@ -93,7 +93,6 @@ import java.util.*;
* @see java.util.Comparator
* @since 1.2
*/
@FunctionalInterface
public interface Comparable<T> {
/**
* Compares this object with the specified object for order. Returns a
......
......@@ -74,7 +74,6 @@ final class ConditionalSpecialCasing {
new Entry(0x00CC, new char[]{0x0069, 0x0307, 0x0300}, new char[]{0x00CC}, "lt", 0), // # LATIN CAPITAL LETTER I WITH GRAVE
new Entry(0x00CD, new char[]{0x0069, 0x0307, 0x0301}, new char[]{0x00CD}, "lt", 0), // # LATIN CAPITAL LETTER I WITH ACUTE
new Entry(0x0128, new char[]{0x0069, 0x0307, 0x0303}, new char[]{0x0128}, "lt", 0), // # LATIN CAPITAL LETTER I WITH TILDE
new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, "lt", 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
//# ================================================================================
//# Turkish and Azeri
......@@ -85,10 +84,7 @@ final class ConditionalSpecialCasing {
new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "tr", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I
new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "az", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I
new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "tr", 0), // # LATIN SMALL LETTER I
new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "az", 0), // # LATIN SMALL LETTER I
//# ================================================================================
//# Other
new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, "en", 0), // # LATIN CAPITALLETTER I WITH DOT ABOVE
new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "az", 0) // # LATIN SMALL LETTER I
};
// A hash table that contains the above entries
......
......@@ -361,15 +361,11 @@ public final class Double extends Number implements Comparable<Double> {
* <dd><i>SignedInteger</i>
* </dl>
*
* <p>
*
* <dl>
* <dt><i>HexFloatingPointLiteral</i>:
* <dd> <i>HexSignificand BinaryExponent FloatTypeSuffix<sub>opt</sub></i>
* </dl>
*
* <p>
*
* <dl>
* <dt><i>HexSignificand:</i>
* <dd><i>HexNumeral</i>
......@@ -380,15 +376,11 @@ public final class Double extends Number implements Comparable<Double> {
* </i>{@code .} <i>HexDigits</i>
* </dl>
*
* <p>
*
* <dl>
* <dt><i>BinaryExponent:</i>
* <dd><i>BinaryExponentIndicator SignedInteger</i>
* </dl>
*
* <p>
*
* <dl>
* <dt><i>BinaryExponentIndicator:</i>
* <dd>{@code p}
......
......@@ -321,15 +321,11 @@ public final class Float extends Number implements Comparable<Float> {
* <dd><i>SignedInteger</i>
* </dl>
*
* <p>
*
* <dl>
* <dt><i>HexFloatingPointLiteral</i>:
* <dd> <i>HexSignificand BinaryExponent FloatTypeSuffix<sub>opt</sub></i>
* </dl>
*
* <p>
*
* <dl>
* <dt><i>HexSignificand:</i>
* <dd><i>HexNumeral</i>
......@@ -340,15 +336,11 @@ public final class Float extends Number implements Comparable<Float> {
* </i>{@code .} <i>HexDigits</i>
* </dl>
*
* <p>
*
* <dl>
* <dt><i>BinaryExponent:</i>
* <dd><i>BinaryExponentIndicator SignedInteger</i>
* </dl>
*
* <p>
*
* <dl>
* <dt><i>BinaryExponentIndicator:</i>
* <dd>{@code p}
......
......@@ -1123,7 +1123,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i>
* <p>
*
* <dt><i>Sign:</i>
* <dd>{@code -}
* <dd>{@code +}
......
......@@ -42,7 +42,6 @@ import java.util.function.Consumer;
* @since 1.5
* @jls 14.14.2 The enhanced for statement
*/
@FunctionalInterface
public interface Iterable<T> {
/**
* Returns an iterator over elements of type {@code T}.
......@@ -52,10 +51,12 @@ public interface Iterable<T> {
Iterator<T> iterator();
/**
* Performs the given action on the contents of the {@code Iterable}, in the
* order elements occur when iterating, until all elements have been
* processed or the action throws an exception. Errors or runtime
* exceptions thrown by the action are relayed to the caller.
* Performs the given action for each element of the {@code Iterable}
* until all elements have been processed or the action throws an
* exception. Unless otherwise specified by the implementing class,
* actions are performed in the order of iteration (if an iteration order
* is specified). Exceptions thrown by the action are relayed to the
* caller.
*
* @implSpec
* <p>The default implementation behaves as if:
......@@ -100,4 +101,3 @@ public interface Iterable<T> {
return Spliterators.spliteratorUnknownSize(iterator(), 0);
}
}
......@@ -853,7 +853,7 @@ public final class Long extends Number implements Comparable<Long> {
* <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i>
* <p>
*
* <dt><i>Sign:</i>
* <dd>{@code -}
* <dd>{@code +}
......
......@@ -34,7 +34,6 @@ import java.io.IOException;
*
* @since 1.5
*/
@FunctionalInterface
public interface Readable {
/**
......
......@@ -47,7 +47,6 @@ import java.util.StringTokenizer;
* The following table lists all the possible RuntimePermission target names,
* and for each provides a description of what the permission allows
* and a discussion of the risks of granting code the permission.
* <P>
*
* <table border=1 cellpadding=5 summary="permission target name,
* what the target allows,and associated risks">
......
......@@ -56,7 +56,7 @@ import sun.security.util.SecurityConstants;
* are called by various methods in the Java libraries before those
* methods perform certain potentially sensitive operations. The
* invocation of such a <code>check</code> method typically looks like this:
* <p><blockquote><pre>
* <blockquote><pre>
* SecurityManager security = System.getSecurityManager();
* if (security != null) {
* security.check<i>XXX</i>(argument, &nbsp;.&nbsp;.&nbsp;.&nbsp;);
......@@ -323,7 +323,7 @@ class SecurityManager {
* by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
* <p>
* This method will return
* <code>null</code> in the following three cases:<p>
* <code>null</code> in the following three cases:
* <ol>
* <li>All methods on the execution stack are from classes
* defined using the system class loader or one of its ancestors.
......@@ -370,7 +370,7 @@ class SecurityManager {
* by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
* <p>
* This method will return
* <code>null</code> in the following three cases:<p>
* <code>null</code> in the following three cases:
* <ol>
* <li>All methods on the execution stack are from classes
* defined using the system class loader or one of its ancestors.
......@@ -429,7 +429,7 @@ class SecurityManager {
* by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
* <p>
* This method will return
* -1 in the following three cases:<p>
* -1 in the following three cases:
* <ol>
* <li>All methods on the execution stack are from classes
* defined using the system class loader or one of its ancestors.
......@@ -1281,7 +1281,6 @@ class SecurityManager {
* This method calls <code>checkPermission</code> with the
* <code>PropertyPermission(key, "read")</code> permission.
* <p>
* <p>
* If you override this method, then you should make a call to
* <code>super.checkPropertyAccess</code>
* at the point the overridden method would normally throw an
......@@ -1714,7 +1713,7 @@ class SecurityManager {
throw new NullPointerException("class can't be null");
}
if (which != Member.PUBLIC) {
Class stack[] = getClassContext();
Class<?> stack[] = getClassContext();
/*
* stack depth of 4 should be the caller of one of the
* methods in java.lang.Class that invoke checkMember
......
......@@ -249,7 +249,7 @@ public final class Short extends Number implements Comparable<Short> {
* <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i>
* <p>
*
* <dt><i>Sign:</i>
* <dd>{@code -}
* <dd>{@code +}
......
......@@ -47,16 +47,16 @@ import java.util.regex.PatternSyntaxException;
* Strings are constant; their values cannot be changed after they
* are created. String buffers support mutable strings.
* Because String objects are immutable they can be shared. For example:
* <p><blockquote><pre>
* <blockquote><pre>
* String str = "abc";
* </pre></blockquote><p>
* is equivalent to:
* <p><blockquote><pre>
* <blockquote><pre>
* char data[] = {'a', 'b', 'c'};
* String str = new String(data);
* </pre></blockquote><p>
* Here are some more examples of how strings can be used:
* <p><blockquote><pre>
* <blockquote><pre>
* System.out.println("abc");
* String cde = "cde";
* System.out.println("abc" + cde);
......@@ -786,7 +786,7 @@ public final class String
* {@code srcEnd-srcBegin}). The characters are copied into the
* subarray of {@code dst} starting at index {@code dstBegin}
* and ending at index:
* <p><blockquote><pre>
* <blockquote><pre>
* dstbegin + (srcEnd-srcBegin) - 1
* </pre></blockquote>
*
......@@ -2598,21 +2598,14 @@ public final class String
}
if (localeDependent || srcChar == '\u03A3') { // GREEK CAPITAL LETTER SIGMA
lowerChar = ConditionalSpecialCasing.toLowerCaseEx(this, i, locale);
} else if (srcChar == '\u0130') { // LATIN CAPITAL LETTER I DOT
lowerChar = Character.ERROR;
} else {
lowerChar = Character.toLowerCase(srcChar);
}
if ((lowerChar == Character.ERROR)
|| (lowerChar >= Character.MIN_SUPPLEMENTARY_CODE_POINT)) {
if (lowerChar == Character.ERROR) {
if (!localeDependent && srcChar == '\u0130') {
lowerCharArray =
ConditionalSpecialCasing.toLowerCaseCharArray(this, i, Locale.ENGLISH);
} else {
lowerCharArray =
ConditionalSpecialCasing.toLowerCaseCharArray(this, i, locale);
}
lowerCharArray =
ConditionalSpecialCasing.toLowerCaseCharArray(this, i, locale);
} else if (srcCount == 2) {
resultOffset += Character.toChars(lowerChar, result, i + resultOffset) - srcCount;
continue;
......@@ -2669,7 +2662,7 @@ public final class String
* {@code String} may be a different length than the original {@code String}.
* <p>
* Examples of locale-sensitive and 1:M case mappings are in the following table.
* <p>
*
* <table border="1" summary="Examples of locale-sensitive and 1:M case mappings. Shows Language code of locale, lower case, upper case, and description.">
* <tr>
* <th>Language Code of Locale</th>
......
......@@ -26,10 +26,12 @@ package java.lang;
import java.io.*;
import java.lang.reflect.Executable;
import java.lang.annotation.Annotation;
import java.security.AccessControlContext;
import java.util.Properties;
import java.util.PropertyPermission;
import java.util.StringTokenizer;
import java.util.Map;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.AllPermission;
......@@ -1227,6 +1229,9 @@ public final class System {
public AnnotationType getAnnotationType(Class<?> klass) {
return klass.getAnnotationType();
}
public Map<Class<? extends Annotation>, Annotation> getDeclaredAnnotationMap(Class<?> klass) {
return klass.getDeclaredAnnotationMap();
}
public byte[] getRawClassAnnotations(Class<?> klass) {
return klass.getRawAnnotations();
}
......
......@@ -76,7 +76,7 @@ import sun.security.util.SecurityConstants;
* <code>Thread</code>. An instance of the subclass can then be
* allocated and started. For example, a thread that computes primes
* larger than a stated value could be written as follows:
* <p><hr><blockquote><pre>
* <hr><blockquote><pre>
* class PrimeThread extends Thread {
* long minPrime;
* PrimeThread(long minPrime) {
......@@ -91,7 +91,7 @@ import sun.security.util.SecurityConstants;
* </pre></blockquote><hr>
* <p>
* The following code would then create a thread and start it running:
* <p><blockquote><pre>
* <blockquote><pre>
* PrimeThread p = new PrimeThread(143);
* p.start();
* </pre></blockquote>
......@@ -102,7 +102,7 @@ import sun.security.util.SecurityConstants;
* then be allocated, passed as an argument when creating
* <code>Thread</code>, and started. The same example in this other
* style looks like the following:
* <p><hr><blockquote><pre>
* <hr><blockquote><pre>
* class PrimeRun implements Runnable {
* long minPrime;
* PrimeRun(long minPrime) {
......@@ -117,7 +117,7 @@ import sun.security.util.SecurityConstants;
* </pre></blockquote><hr>
* <p>
* The following code would then create a thread and start it running:
* <p><blockquote><pre>
* <blockquote><pre>
* PrimeRun p = new PrimeRun(143);
* new Thread(p).start();
* </pre></blockquote>
......
......@@ -101,7 +101,6 @@ import static sun.invoke.util.Wrapper.isWrapperType;
* should implement.
* @param additionalBridges Method types for additional signatures to be
* bridged to the implementation method
* @throws ReflectiveOperationException
* @throws LambdaConversionException If any of the meta-factory protocol
* invariants are violated
*/
......@@ -114,7 +113,7 @@ import static sun.invoke.util.Wrapper.isWrapperType;
boolean isSerializable,
Class<?>[] markerInterfaces,
MethodType[] additionalBridges)
throws ReflectiveOperationException, LambdaConversionException {
throws LambdaConversionException {
this.targetClass = caller.lookupClass();
this.invokedType = invokedType;
......@@ -160,7 +159,7 @@ import static sun.invoke.util.Wrapper.isWrapperType;
* @throws ReflectiveOperationException
*/
abstract CallSite buildCallSite()
throws ReflectiveOperationException, LambdaConversionException;
throws LambdaConversionException;
/**
* Check the meta-factory arguments for errors
......
......@@ -441,8 +441,13 @@ class MethodHandleNatives {
assert(refKindIsValid(refKind));
return lookup.linkMethodHandleConstant((byte) refKind, defc, name, type);
} catch (IllegalAccessException ex) {
Error err = new IllegalAccessError(ex.getMessage());
throw initCauseFrom(err, ex);
Throwable cause = ex.getCause();
if (cause instanceof AbstractMethodError) {
throw (AbstractMethodError) cause;
} else {
Error err = new IllegalAccessError(ex.getMessage());
throw initCauseFrom(err, ex);
}
} catch (NoSuchMethodException ex) {
Error err = new NoSuchMethodError(ex.getMessage());
throw initCauseFrom(err, ex);
......
......@@ -1716,6 +1716,13 @@ return mh1;
checkSymbolicClass(defc);
return mh;
}
// Treat MethodHandle.invoke and invokeExact specially.
if (defc == MethodHandle.class && refKind == REF_invokeVirtual) {
mh = findVirtualForMH(member.getName(), member.getMethodType());
if (mh != null) {
return mh;
}
}
MemberName resolved = resolveOrFail(refKind, member);
mh = getDirectMethodForConstant(refKind, defc, resolved);
if (mh instanceof DirectMethodHandle
......@@ -1768,12 +1775,6 @@ return mh1;
if (MethodHandleNatives.refKindIsField(refKind)) {
return getDirectFieldNoSecurityManager(refKind, defc, member);
} else if (MethodHandleNatives.refKindIsMethod(refKind)) {
if (defc == MethodHandle.class && refKind == REF_invokeVirtual) {
MethodHandle mh = findVirtualForMH(member.getName(), member.getMethodType());
if (mh != null) {
return mh;
}
}
return getDirectMethodNoSecurityManager(refKind, defc, member, lookupClass);
} else if (refKind == REF_newInvokeSpecial) {
return getDirectConstructorNoSecurityManager(defc, member);
......
......@@ -32,9 +32,26 @@ import java.security.PrivilegedExceptionAction;
import java.util.Objects;
/**
* Serialized form of a lambda expression. The properties of this class represent the information that is present
* at the lambda factory site, including the identity of the primary functional interface method, the identity of the
* implementation method, and any variables captured from the local environment at the time of lambda capture.
* Serialized form of a lambda expression. The properties of this class
* represent the information that is present at the lambda factory site, including
* static metafactory arguments such as the identity of the primary functional
* interface method and the identity of the implementation method, as well as
* dynamic metafactory arguments such as values captured from the lexical scope
* at the time of lambda capture.
*
* <p>Implementors of serializable lambdas, such as compilers or language
* runtime libraries, are expected to ensure that instances deserialize properly.
* One means to do so is to ensure that the {@code writeReplace} method returns
* an instance of {@code SerializedLambda}, rather than allowing default
* serialization to proceed.
*
* <p>{@code SerializedLambda} has a {@code readResolve} method that looks for
* a (possibly private) static method called
* {@code $deserializeLambda$(SerializedLambda)} in the capturing class, invokes
* that with itself as the first argument, and returns the result. Lambda classes
* implementing {@code $deserializeLambda$} are responsible for validating
* that the properties of the {@code SerializedLambda} are consistent with a
* lambda actually captured by that class.
*
* @see LambdaMetafactory
*/
......
......@@ -28,6 +28,7 @@ package java.lang.invoke;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.org.objectweb.asm.Type;
import sun.invoke.util.BytecodeDescriptor;
import sun.invoke.util.Wrapper;
import static sun.invoke.util.Wrapper.*;
......@@ -204,27 +205,27 @@ class TypeConvertingMethodAdapter extends MethodVisitor {
}
/**
* Convert an argument of type 'argType' to be passed to 'targetType' assuring that it is 'functionalType'.
* Convert an argument of type 'arg' to be passed to 'target' assuring that it is 'functional'.
* Insert the needed conversion instructions in the method code.
* @param argType
* @param targetType
* @param functionalType
* @param arg
* @param target
* @param functional
*/
void convertType(String dArg, String dTarget, String dFunctional) {
if (dArg.equals(dTarget)) {
void convertType(Class<?> arg, Class<?> target, Class<?> functional) {
if (arg.equals(target)) {
return;
}
Wrapper wArg = toWrapper(dArg);
Wrapper wTarget = toWrapper(dTarget);
if (wArg == VOID || wTarget == VOID) {
if (arg == Void.TYPE || target == Void.TYPE) {
return;
}
if (isPrimitive(wArg)) {
if (isPrimitive(wTarget)) {
if (arg.isPrimitive()) {
Wrapper wArg = Wrapper.forPrimitiveType(arg);
if (target.isPrimitive()) {
// Both primitives: widening
widen(wArg, wTarget);
widen(wArg, Wrapper.forPrimitiveType(target));
} else {
// Primitive argument to reference target
String dTarget = BytecodeDescriptor.unparse(target);
Wrapper wPrimTarget = wrapperOrNullFromDescriptor(dTarget);
if (wPrimTarget != null) {
// The target is a boxed primitive type, widen to get there before boxing
......@@ -237,16 +238,18 @@ class TypeConvertingMethodAdapter extends MethodVisitor {
}
}
} else {
String dArg = BytecodeDescriptor.unparse(arg);
String dSrc;
Wrapper wFunctional = toWrapper(dFunctional);
if (isPrimitive(wFunctional)) {
if (functional.isPrimitive()) {
dSrc = dArg;
} else {
// Cast to convert to possibly more specific type, and generate CCE for invalid arg
dSrc = dFunctional;
cast(dArg, dFunctional);
dSrc = BytecodeDescriptor.unparse(functional);
cast(dArg, dSrc);
}
if (isPrimitive(wTarget)) {
String dTarget = BytecodeDescriptor.unparse(target);
if (target.isPrimitive()) {
Wrapper wTarget = toWrapper(dTarget);
// Reference argument to primitive target
Wrapper wps = wrapperOrNullFromDescriptor(dSrc);
if (wps != null) {
......
......@@ -60,7 +60,7 @@ import sun.management.ManagementFactoryHelper;
* one or more <i>platform MXBeans</i> representing
* the management interface of a component of the Java virtual
* machine.
* <p>
*
* <h3><a name="MXBean">Platform MXBeans</a></h3>
* <p>
* A platform MXBean is a <i>managed bean</i> that
......
......@@ -33,10 +33,8 @@ package java.lang.management;
* The following table
* provides a summary description of what the permission allows,
* and discusses the risks of granting code the permission.
* <P>
*
* <table border=1 cellpadding=5 summary="Table shows permission target name, wh
at the permission allows, and associated risks">
* <table border=1 cellpadding=5 summary="Table shows permission target name, what the permission allows, and associated risks">
* <tr>
* <th>Permission Target Name</th>
* <th>What the Permission Allows</th>
......
......@@ -79,7 +79,7 @@ import sun.management.MemoryUsageCompositeData;
* </table>
*
* Below is a picture showing an example of a memory pool:
* <p>
*
* <pre>
* +----------------------------------------------+
* +//////////////// | +
......@@ -250,7 +250,7 @@ public class MemoryUsage {
* Returns a <tt>MemoryUsage</tt> object represented by the
* given <tt>CompositeData</tt>. The given <tt>CompositeData</tt>
* must contain the following attributes:
* <p>
*
* <blockquote>
* <table border summary="The attributes and the types the given CompositeData contains">
* <tr>
......
......@@ -82,7 +82,7 @@ Java virtual machine and the runtime in the following ways:
<b>1. Direct access to an MXBean interface</b>
<p>
<ul>
<li>Get an MXBean instance locally in the running Java virtual machine:<p>
<li>Get an MXBean instance locally in the running Java virtual machine:
<pre>
RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
......@@ -103,7 +103,7 @@ Java virtual machine and the runtime in the following ways:
<p>
</li>
<li>Construct an MXBean proxy instance that forwards the
method calls to a given MBeanServer:<p>
method calls to a given MBeanServer:
<pre>
MBeanServerConnection mbs;
......
......@@ -27,6 +27,15 @@ package java.lang.reflect;
import java.lang.annotation.Annotation;
import java.lang.annotation.AnnotationFormatError;
import java.lang.annotation.Repeatable;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
import sun.reflect.annotation.AnnotationSupport;
import sun.reflect.annotation.AnnotationType;
/**
* Represents an annotated element of the program currently running in this
......@@ -222,6 +231,18 @@ public interface AnnotatedElement {
* The caller of this method is free to modify the returned array; it will
* have no effect on the arrays returned to other callers.
*
* @implSpec The default implementation first calls {@link
* #getDeclaredAnnotationsByType(Class)} passing {@code
* annotationClass} as the argument. If the returned array has
* length greater than zero, the array is returned. If the returned
* array is zero-length and this {@code AnnotatedElement} is a
* class and the argument type is an inheritable annotation type,
* and the superclass of this {@code AnnotatedElement} is non-null,
* then the returned result is the result of calling {@link
* #getAnnotationsByType(Class)} on the superclass with {@code
* annotationClass} as the argument. Otherwise, a zero-length
* array is returned.
*
* @param <T> the type of the annotation to query for and return if present
* @param annotationClass the Class object corresponding to the
* annotation type
......@@ -230,7 +251,29 @@ public interface AnnotatedElement {
* @throws NullPointerException if the given annotation class is null
* @since 1.8
*/
<T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass);
default <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
/*
* Definition of associated: directly or indirectly present OR
* neither directly nor indirectly present AND the element is
* a Class, the annotation type is inheritable, and the
* annotation type is associated with the superclass of the
* element.
*/
T[] result = getDeclaredAnnotationsByType(annotationClass);
if (result.length == 0 && // Neither directly nor indirectly present
this instanceof Class && // the element is a class
AnnotationType.getInstance(annotationClass).isInherited()) { // Inheritable
Class<?> superClass = ((Class<?>) this).getSuperclass();
if (superClass != null) {
// Determine if the annotation is associated with the
// superclass
result = superClass.getAnnotationsByType(annotationClass);
}
}
return result;
}
/**
* Returns this element's annotation for the specified type if
......@@ -239,6 +282,11 @@ public interface AnnotatedElement {
* This method ignores inherited annotations. (Returns null if no
* annotations are directly present on this element.)
*
* @implSpec The default implementation first performs a null check
* and then loops over the results of {@link
* #getDeclaredAnnotations} returning the first annotation whose
* annotation type matches the argument type.
*
* @param <T> the type of the annotation to query for and return if directly present
* @param annotationClass the Class object corresponding to the
* annotation type
......@@ -247,7 +295,18 @@ public interface AnnotatedElement {
* @throws NullPointerException if the given annotation class is null
* @since 1.8
*/
<T extends Annotation> T getDeclaredAnnotation(Class<T> annotationClass);
default <T extends Annotation> T getDeclaredAnnotation(Class<T> annotationClass) {
Objects.requireNonNull(annotationClass);
// Loop over all directly-present annotations looking for a matching one
for (Annotation annotation : getDeclaredAnnotations()) {
if (annotationClass.equals(annotation.annotationType())) {
// More robust to do a dynamic cast at runtime instead
// of compile-time only.
return annotationClass.cast(annotation);
}
}
return null;
}
/**
* Returns this element's annotation(s) for the specified type if
......@@ -268,6 +327,22 @@ public interface AnnotatedElement {
* The caller of this method is free to modify the returned array; it will
* have no effect on the arrays returned to other callers.
*
* @implSpec The default implementation may call {@link
* #getDeclaredAnnotation(Class)} one or more times to find a
* directly present annotation and, if the annotation type is
* repeatable, to find a container annotation. If annotations of
* the annotation type {@code annotationClass} are found to be both
* directly and indirectly present, then {@link
* #getDeclaredAnnotations()} will get called to determine the
* order of the elements in the returned array.
*
* <p>Alternatively, the default implementation may call {@link
* #getDeclaredAnnotations()} a single time and the returned array
* examined for both directly and indirectly present
* annotations. The results of calling {@link
* #getDeclaredAnnotations()} are assumed to be consistent with the
* results of calling {@link #getDeclaredAnnotation(Class)}.
*
* @param <T> the type of the annotation to query for and return
* if directly or indirectly present
* @param annotationClass the Class object corresponding to the
......@@ -277,7 +352,16 @@ public interface AnnotatedElement {
* @throws NullPointerException if the given annotation class is null
* @since 1.8
*/
<T extends Annotation> T[] getDeclaredAnnotationsByType(Class<T> annotationClass);
default <T extends Annotation> T[] getDeclaredAnnotationsByType(Class<T> annotationClass) {
Objects.requireNonNull(annotationClass);
return AnnotationSupport.
getDirectlyAndIndirectlyPresent(Arrays.stream(getDeclaredAnnotations()).
collect(Collectors.toMap(Annotation::annotationType,
Function.identity(),
((first,second) -> first),
LinkedHashMap::new)),
annotationClass);
}
/**
* Returns annotations that are <em>directly present</em> on this element.
......
......@@ -28,6 +28,8 @@ package java.lang.reflect;
import sun.reflect.CallerSensitive;
import sun.reflect.ConstructorAccessor;
import sun.reflect.Reflection;
import sun.reflect.annotation.TypeAnnotation;
import sun.reflect.annotation.TypeAnnotationParser;
import sun.reflect.generics.repository.ConstructorRepository;
import sun.reflect.generics.factory.CoreReflectionFactory;
import sun.reflect.generics.factory.GenericsFactory;
......@@ -534,4 +536,22 @@ public final class Constructor<T> extends Executable {
public AnnotatedType getAnnotatedReturnType() {
return getAnnotatedReturnType0(getDeclaringClass());
}
/**
* {@inheritDoc}
* @since 1.8
*/
@Override
public AnnotatedType getAnnotatedReceiverType() {
if (getDeclaringClass().getEnclosingClass() == null)
return super.getAnnotatedReceiverType();
return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
sun.misc.SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
this,
getDeclaringClass(),
getDeclaringClass().getEnclosingClass(),
TypeAnnotation.TypeAnnotationTarget.METHOD_RECEIVER);
}
}
......@@ -383,7 +383,7 @@ public abstract class Executable extends AccessibleObject
private transient volatile Parameter[] parameters;
private native Parameter[] getParameters0();
private native byte[] getTypeAnnotationBytes0();
native byte[] getTypeAnnotationBytes0();
// Needed by reflectaccess
byte[] getTypeAnnotationBytes() {
......@@ -527,7 +527,7 @@ public abstract class Executable extends AccessibleObject
public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
Objects.requireNonNull(annotationClass);
return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass);
return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass);
}
/**
......
......@@ -1123,7 +1123,7 @@ class Field extends AccessibleObject implements Member {
public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
Objects.requireNonNull(annotationClass);
return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass);
return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass);
}
/**
......
......@@ -295,7 +295,7 @@ public final class Parameter implements AnnotatedElement {
public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
Objects.requireNonNull(annotationClass);
return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass);
return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass);
}
/**
......
......@@ -31,7 +31,6 @@ package java.lang.reflect;
* The following table
* provides a summary description of what the permission allows,
* and discusses the risks of granting code the permission.
* <P>
*
* <table border=1 cellpadding=5 summary="Table shows permission target name, what the permission allows, and associated risks">
* <tr>
......
......@@ -97,6 +97,21 @@ import sun.misc.FloatConsts;
* {@code NullPointerException} when passed
* a null object reference for any input parameter.
*
* BigInteger must support values in the range
* -2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive) to
* +2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive)
* and may support values outside of that range.
*
* The range of probable prime values is limited and may be less than
* the full supported positive range of {@code BigInteger}.
* The range must be at least 1 to 2<sup>500000000</sup>.
*
* @implNote
* BigInteger constructors and operations throw {@code ArithmeticException} when
* the result is out of the supported range of
* -2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive) to
* +2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive).
*
* @see BigDecimal
* @author Josh Bloch
* @author Michael McCloskey
......@@ -182,6 +197,18 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
*/
final static long LONG_MASK = 0xffffffffL;
/**
* This constant limits {@code mag.length} of BigIntegers to the supported
* range.
*/
private static final int MAX_MAG_LENGTH = Integer.MAX_VALUE / Integer.SIZE + 1; // (1 << 26)
/**
* Bit lengths larger than this constant can cause overflow in searchLen
* calculation and in BitSieve.singleSearch method.
*/
private static final int PRIME_SEARCH_BIT_LENGTH_LIMIT = 500000000;
/**
* The threshold value for using Karatsuba multiplication. If the number
* of ints in both mag arrays are greater than this number, then
......@@ -256,6 +283,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
mag = stripLeadingZeroBytes(val);
signum = (mag.length == 0 ? 0 : 1);
}
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
}
/**
......@@ -275,6 +305,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
mag = trustedStripLeadingZeroInts(val);
signum = (mag.length == 0 ? 0 : 1);
}
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
}
/**
......@@ -306,6 +339,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
throw(new NumberFormatException("signum-magnitude mismatch"));
this.signum = signum;
}
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
}
/**
......@@ -327,6 +363,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
throw(new NumberFormatException("signum-magnitude mismatch"));
this.signum = signum;
}
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
}
/**
......@@ -359,17 +398,20 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
int sign = 1;
int index1 = val.lastIndexOf('-');
int index2 = val.lastIndexOf('+');
if ((index1 + index2) <= -1) {
// No leading sign character or at most one leading sign character
if (index1 == 0 || index2 == 0) {
cursor = 1;
if (len == 1)
throw new NumberFormatException("Zero length BigInteger");
if (index1 >= 0) {
if (index1 != 0 || index2 >= 0) {
throw new NumberFormatException("Illegal embedded sign character");
}
sign = -1;
cursor = 1;
} else if (index2 >= 0) {
if (index2 != 0) {
throw new NumberFormatException("Illegal embedded sign character");
}
if (index1 == 0)
sign = -1;
} else
throw new NumberFormatException("Illegal embedded sign character");
cursor = 1;
}
if (cursor == len)
throw new NumberFormatException("Zero length BigInteger");
// Skip leading zeros and compute number of digits in magnitude
while (cursor < len &&
......@@ -388,8 +430,11 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
// Pre-allocate array of expected size. May be too large but can
// never be too small. Typically exact.
int numBits = (int)(((numDigits * bitsPerDigit[radix]) >>> 10) + 1);
int numWords = (numBits + 31) >>> 5;
long numBits = ((numDigits * bitsPerDigit[radix]) >>> 10) + 1;
if (numBits + 31 >= (1L << 32)) {
reportOverflow();
}
int numWords = (int) (numBits + 31) >>> 5;
int[] magnitude = new int[numWords];
// Process first (potentially short) digit group
......@@ -413,6 +458,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
}
// Required for cases where the array was overallocated.
mag = trustedStripLeadingZeroInts(magnitude);
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
}
/*
......@@ -439,8 +487,11 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
if (len < 10) {
numWords = 1;
} else {
int numBits = (int)(((numDigits * bitsPerDigit[10]) >>> 10) + 1);
numWords = (numBits + 31) >>> 5;
long numBits = ((numDigits * bitsPerDigit[10]) >>> 10) + 1;
if (numBits + 31 >= (1L << 32)) {
reportOverflow();
}
numWords = (int) (numBits + 31) >>> 5;
}
int[] magnitude = new int[numWords];
......@@ -456,6 +507,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
destructiveMulAdd(magnitude, intRadix[10], groupVal);
}
mag = trustedStripLeadingZeroInts(magnitude);
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
}
// Create an integer with the digits between the two indexes
......@@ -575,7 +629,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* this constructor is proportional to the value of this parameter.
* @param rnd source of random bits used to select candidates to be
* tested for primality.
* @throws ArithmeticException {@code bitLength < 2}.
* @throws ArithmeticException {@code bitLength < 2} or {@code bitLength} is too large.
* @see #bitLength()
*/
public BigInteger(int bitLength, int certainty, Random rnd) {
......@@ -607,7 +661,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* @param rnd source of random bits used to select candidates to be
* tested for primality.
* @return a BigInteger of {@code bitLength} bits that is probably prime
* @throws ArithmeticException {@code bitLength < 2}.
* @throws ArithmeticException {@code bitLength < 2} or {@code bitLength} is too large.
* @see #bitLength()
* @since 1.4
*/
......@@ -677,7 +731,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
p.mag[p.mag.length-1] &= 0xfffffffe;
// Use a sieve length likely to contain the next prime number
int searchLen = (bitLength / 20) * 64;
int searchLen = getPrimeSearchLen(bitLength);
BitSieve searchSieve = new BitSieve(p, searchLen);
BigInteger candidate = searchSieve.retrieve(p, certainty, rnd);
......@@ -701,7 +755,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
*
* @return the first integer greater than this {@code BigInteger} that
* is probably prime.
* @throws ArithmeticException {@code this < 0}.
* @throws ArithmeticException {@code this < 0} or {@code this} is too large.
* @since 1.5
*/
public BigInteger nextProbablePrime() {
......@@ -750,7 +804,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
result = result.subtract(ONE);
// Looking for the next large prime
int searchLen = (result.bitLength() / 20) * 64;
int searchLen = getPrimeSearchLen(result.bitLength());
while (true) {
BitSieve searchSieve = new BitSieve(result, searchLen);
......@@ -762,6 +816,13 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
}
}
private static int getPrimeSearchLen(int bitLength) {
if (bitLength > PRIME_SEARCH_BIT_LENGTH_LIMIT + 1) {
throw new ArithmeticException("Prime search implementation restriction on bitLength");
}
return bitLength / 20 * 64;
}
/**
* Returns {@code true} if this BigInteger is probably prime,
* {@code false} if it's definitely composite.
......@@ -965,6 +1026,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
BigInteger(int[] magnitude, int signum) {
this.signum = (magnitude.length == 0 ? 0 : signum);
this.mag = magnitude;
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
}
/**
......@@ -974,6 +1038,25 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
private BigInteger(byte[] magnitude, int signum) {
this.signum = (magnitude.length == 0 ? 0 : signum);
this.mag = stripLeadingZeroBytes(magnitude);
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
}
/**
* Throws an {@code ArithmeticException} if the {@code BigInteger} would be
* out of the supported range.
*
* @throws ArithmeticException if {@code this} exceeds the supported range.
*/
private void checkRange() {
if (mag.length > MAX_MAG_LENGTH || mag.length == MAX_MAG_LENGTH && mag[0] < 0) {
reportOverflow();
}
}
private static void reportOverflow() {
throw new ArithmeticException("BigInteger would overflow supported range");
}
//Static Factory Methods
......@@ -2073,6 +2156,10 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
// The remaining part can then be exponentiated faster. The
// powers of two will be multiplied back at the end.
int powersOfTwo = partToSquare.getLowestSetBit();
long bitsToShift = (long)powersOfTwo * exponent;
if (bitsToShift > Integer.MAX_VALUE) {
reportOverflow();
}
int remainingBits;
......@@ -2126,11 +2213,10 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
// Multiply back the powers of two (quickly, by shifting left)
if (powersOfTwo > 0) {
int bitsToShift = powersOfTwo*exponent;
if (bitsToShift + scaleFactor <= 62) { // Fits in long?
return valueOf((result << bitsToShift) * newSign);
} else {
return valueOf(result*newSign).shiftLeft(bitsToShift);
return valueOf(result*newSign).shiftLeft((int) bitsToShift);
}
}
else {
......@@ -2375,8 +2461,17 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
BigInteger y1 = m2.modInverse(m1);
BigInteger y2 = m1.modInverse(m2);
result = a1.multiply(m2).multiply(y1).add
(a2.multiply(m1).multiply(y2)).mod(m);
if (m.mag.length < MAX_MAG_LENGTH / 2) {
result = a1.multiply(m2).multiply(y1).add(a2.multiply(m1).multiply(y2)).mod(m);
} else {
MutableBigInteger t1 = new MutableBigInteger();
new MutableBigInteger(a1.multiply(m2)).multiply(new MutableBigInteger(y1), t1);
MutableBigInteger t2 = new MutableBigInteger();
new MutableBigInteger(a2.multiply(m1)).multiply(new MutableBigInteger(y2), t2);
t1.add(t2);
MutableBigInteger q = new MutableBigInteger();
result = t1.divide(new MutableBigInteger(m), q).toBigInteger();
}
}
return (invertResult ? result.modInverse(m) : result);
......@@ -2797,27 +2892,31 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
*
* @param n shift distance, in bits.
* @return {@code this << n}
* @throws ArithmeticException if the shift distance is {@code
* Integer.MIN_VALUE}.
* @see #shiftRight
*/
public BigInteger shiftLeft(int n) {
if (signum == 0)
return ZERO;
if (n == 0)
if (n > 0) {
return new BigInteger(shiftLeft(mag, n), signum);
} else if (n == 0) {
return this;
if (n < 0) {
if (n == Integer.MIN_VALUE) {
throw new ArithmeticException("Shift distance of Integer.MIN_VALUE not supported.");
} else {
return shiftRight(-n);
}
} else {
// Possible int overflow in (-n) is not a trouble,
// because shiftRightImpl considers its argument unsigned
return shiftRightImpl(-n);
}
int[] newMag = shiftLeft(mag, n);
return new BigInteger(newMag, signum);
}
/**
* Returns a magnitude array whose value is {@code (mag << n)}.
* The shift distance, {@code n}, is considered unnsigned.
* (Computes <tt>this * 2<sup>n</sup></tt>.)
*
* @param mag magnitude, the most-significant int ({@code mag[0]}) must be non-zero.
* @param n unsigned shift distance, in bits.
* @return {@code mag << n}
*/
private static int[] shiftLeft(int[] mag, int n) {
int nInts = n >>> 5;
int nBits = n & 0x1f;
......@@ -2853,21 +2952,31 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
*
* @param n shift distance, in bits.
* @return {@code this >> n}
* @throws ArithmeticException if the shift distance is {@code
* Integer.MIN_VALUE}.
* @see #shiftLeft
*/
public BigInteger shiftRight(int n) {
if (n == 0)
if (signum == 0)
return ZERO;
if (n > 0) {
return shiftRightImpl(n);
} else if (n == 0) {
return this;
if (n < 0) {
if (n == Integer.MIN_VALUE) {
throw new ArithmeticException("Shift distance of Integer.MIN_VALUE not supported.");
} else {
return shiftLeft(-n);
}
} else {
// Possible int overflow in {@code -n} is not a trouble,
// because shiftLeft considers its argument unsigned
return new BigInteger(shiftLeft(mag, -n), signum);
}
}
/**
* Returns a BigInteger whose value is {@code (this >> n)}. The shift
* distance, {@code n}, is considered unsigned.
* (Computes <tt>floor(this * 2<sup>-n</sup>)</tt>.)
*
* @param n unsigned shift distance, in bits.
* @return {@code this >> n}
*/
private BigInteger shiftRightImpl(int n) {
int nInts = n >>> 5;
int nBits = n & 0x1f;
int magLen = mag.length;
......@@ -3899,7 +4008,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
;
int extraByte = (k == byteLength) ? 1 : 0;
int intLength = ((byteLength - keep + extraByte) + 3)/4;
int intLength = ((byteLength - keep + extraByte) + 3) >>> 2;
int result[] = new int[intLength];
/* Copy one's complement of input into output, leaving extra
......@@ -4135,7 +4244,8 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
message = "BigInteger: Signum not present in stream";
throw new java.io.StreamCorruptedException(message);
}
if ((magnitude.length == 0) != (sign == 0)) {
int[] mag = stripLeadingZeroBytes(magnitude);
if ((mag.length == 0) != (sign == 0)) {
String message = "BigInteger: signum-magnitude mismatch";
if (fields.defaulted("magnitude"))
message = "BigInteger: Magnitude not present in stream";
......@@ -4146,7 +4256,14 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
UnsafeHolder.putSign(this, sign);
// Calculate mag field from magnitude and discard magnitude
UnsafeHolder.putMag(this, stripLeadingZeroBytes(magnitude));
UnsafeHolder.putMag(this, mag);
if (mag.length >= MAX_MAG_LENGTH) {
try {
checkRange();
} catch (ArithmeticException e) {
throw new java.io.StreamCorruptedException("BigInteger: Out of the supported range");
}
}
}
// Support for resetting final fields while deserializing
......
......@@ -1257,14 +1257,14 @@ class MutableBigInteger {
int j = (s+m-1) / m; // step 2a: j = ceil(s/m)
int n = j * m; // step 2b: block length in 32-bit units
int n32 = 32 * n; // block length in bits
int sigma = Math.max(0, n32 - b.bitLength()); // step 3: sigma = max{T | (2^T)*B < beta^n}
long n32 = 32L * n; // block length in bits
int sigma = (int) Math.max(0, n32 - b.bitLength()); // step 3: sigma = max{T | (2^T)*B < beta^n}
MutableBigInteger bShifted = new MutableBigInteger(b);
bShifted.safeLeftShift(sigma); // step 4a: shift b so its length is a multiple of n
safeLeftShift(sigma); // step 4b: shift this by the same amount
// step 5: t is the number of blocks needed to accommodate this plus one additional bit
int t = (bitLength()+n32) / n32;
int t = (int) ((bitLength()+n32) / n32);
if (t < 2) {
t = 2;
}
......@@ -1421,10 +1421,10 @@ class MutableBigInteger {
}
/** @see BigInteger#bitLength() */
int bitLength() {
long bitLength() {
if (intLen == 0)
return 0;
return intLen*32 - Integer.numberOfLeadingZeros(value[offset]);
return intLen*32L - Integer.numberOfLeadingZeros(value[offset]);
}
/**
......
......@@ -196,7 +196,7 @@ class DatagramSocket implements java.io.Closeable {
* socket address.
* <p>
* If, if the address is {@code null}, creates an unbound socket.
* <p>
*
* <p>If there is a security manager,
* its {@code checkListen} method is first called
* with the port from the socket address
......@@ -1109,7 +1109,7 @@ class DatagramSocket implements java.io.Closeable {
* represent the value of the TOS octet in IP packets sent by
* the socket.
* RFC 1349 defines the TOS values as follows:
* <p>
*
* <UL>
* <LI><CODE>IPTOS_LOWCOST (0x02)</CODE></LI>
* <LI><CODE>IPTOS_RELIABILITY (0x04)</CODE></LI>
......
......@@ -761,7 +761,7 @@ public final class HttpCookie implements Cloneable {
// from RFC 2068, token special case characters
//
// private static final String tspecials = "()<>@,;:\\\"/[]?={} \t";
private static final String tspecials = ",;";
private static final String tspecials = ",; "; // deliberately includes space
/*
* Tests a string and returns true if the string counts as a token.
......
......@@ -133,7 +133,7 @@ import java.util.Arrays;
* representation. However, it will be converted into an IPv4
* address.</td></tr>
* </table></blockquote>
* <p>
*
* <h4><A NAME="scoped">Textual representation of IPv6 scoped addresses</a></h4>
*
* <p> The textual representation of IPv6 addresses as described above can be
......@@ -150,11 +150,11 @@ import java.util.Arrays;
*
* <p> The general format for specifying the <i>scope_id</i> is the following:
*
* <p><blockquote><i>IPv6-address</i>%<i>scope_id</i></blockquote>
* <blockquote><i>IPv6-address</i>%<i>scope_id</i></blockquote>
* <p> The IPv6-address is a literal IPv6 address as described above.
* The <i>scope_id</i> refers to an interface on the local system, and it can be
* specified in two ways.
* <p><ol><li><i>As a numeric identifier.</i> This must be a positive integer
* <ol><li><i>As a numeric identifier.</i> This must be a positive integer
* that identifies the particular interface and scope as understood by the
* system. Usually, the numeric values can be determined through administration
* tools on the system. Each interface may have multiple values, one for each
......
......@@ -140,7 +140,7 @@ class MulticastSocket extends DatagramSocket {
* Create a MulticastSocket bound to the specified socket address.
* <p>
* Or, if the address is {@code null}, create an unbound socket.
* <p>
*
* <p>If there is a security manager,
* its {@code checkListen} method is first called
* with the SocketAddress port as its argument to ensure the operation is allowed.
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册