Merge
This commit is contained in:
commit
ca89ba44f7
@ -254,3 +254,4 @@ db045d8faa0924b7378102d24a1a0d850c1e3834 jdk9-b08
|
||||
4a21dc7d57d1069a01f68e7182c074cb37349dfb jdk9-b09
|
||||
fa13f2b926f8426876ec03e7903f3ee0ee150f2e jdk9-b10
|
||||
ab55a18a95e1990a588929d5d29db3eb9985fea0 jdk9-b11
|
||||
59f6350295f9681fe5956d8bc889bf341914c6cb jdk9-b12
|
||||
|
@ -144,8 +144,10 @@ if [ "${command}" = "clone" -o "${command}" = "fclone" -o "${command}" = "tclone
|
||||
repos="${repos} ${i}"
|
||||
fi
|
||||
done
|
||||
|
||||
pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'`
|
||||
|
||||
if [ "${command_args}" != "" ] ; then
|
||||
pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'`
|
||||
if [ "x${pull_default}" = "x${pull_default_tail}" ] ; then
|
||||
echo "ERROR: Need initial clone from non-local source" > ${status_output}
|
||||
exit 1
|
||||
@ -156,6 +158,16 @@ if [ "${command}" = "clone" -o "${command}" = "fclone" -o "${command}" = "tclone
|
||||
repos_extra="${repos_extra} ${i}"
|
||||
fi
|
||||
done
|
||||
else
|
||||
if [ "x${pull_default}" = "x${pull_default_tail}" ] ; then
|
||||
# local source repo. Copy the extras ones that exist there.
|
||||
for i in ${subrepos_extra} ; do
|
||||
if [ -f ${pull_default}/${i}/.hg/hgrc -a ! -f ${i}/.hg/hgrc ] ; then
|
||||
# sub-repo there in source but not here
|
||||
repos_extra="${repos_extra} ${i}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
at_a_time=2
|
||||
# Any repos to deal with?
|
||||
|
@ -254,3 +254,4 @@ a4bf701ac316946c2e5e83138ad8e687da6a4b30 jdk9-b06
|
||||
1a3a4f48515dbf1cff37279691b2fb74f228298d jdk9-b09
|
||||
3bd4039dfc632fd7fc8418a25a3dcc34d1cd4019 jdk9-b10
|
||||
77ea0a2503582a28e4e66be7239a49a0d1dd313f jdk9-b11
|
||||
e212cdcc8c11f0ba5acf6f5ddb596c4c545a93f9 jdk9-b12
|
||||
|
@ -414,3 +414,4 @@ bdc5311e1db7598589b77015119b821bf8c828bd jdk9-b05
|
||||
05e8f5242c26ba45d4fa947e4f4f54c058c9b522 jdk9-b09
|
||||
ebc44d040cd149d2120d69fe183a3dae7840f4b4 jdk9-b10
|
||||
783309c3a1a629a452673399dcfa83ef7eca94d8 jdk9-b11
|
||||
1c383bb39e2849ca62cb763f4e182a29b421d60a jdk9-b12
|
||||
|
@ -37,7 +37,7 @@
|
||||
# GAMMADIR - top of workspace
|
||||
# OS_FAMILY - operating system
|
||||
# VARIANT - core, compiler1, compiler2, or tiered
|
||||
# HOTSPOT_RELEASE_VERSION - <major>.<minor>-b<nn> (11.0-b07)
|
||||
# HOTSPOT_RELEASE_VERSION - <major_ver>.<minor_ver>.<micro_ver>[-<identifier>][-<debug_target>][-b<nn>]
|
||||
# HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty
|
||||
# JRE_RELEASE_VERSION - <major>.<minor>.<micro> (1.7.0)
|
||||
#
|
||||
|
@ -122,7 +122,7 @@ SUNWprivate_1.1 {
|
||||
JVM_GetClassModifiers;
|
||||
JVM_GetClassName;
|
||||
JVM_GetClassNameUTF;
|
||||
JVM_GetClassSignature;
|
||||
JVM_GetClassSignature;
|
||||
JVM_GetClassSigners;
|
||||
JVM_GetClassTypeAnnotations;
|
||||
JVM_GetComponentType;
|
||||
@ -163,6 +163,7 @@ SUNWprivate_1.1 {
|
||||
JVM_GetStackTraceElement;
|
||||
JVM_GetSystemPackage;
|
||||
JVM_GetSystemPackages;
|
||||
JVM_GetTemporaryDirectory;
|
||||
JVM_GetThreadStateNames;
|
||||
JVM_GetThreadStateValues;
|
||||
JVM_GetVersionInfo;
|
||||
|
@ -161,6 +161,7 @@ SUNWprivate_1.1 {
|
||||
JVM_GetStackTraceElement;
|
||||
JVM_GetSystemPackage;
|
||||
JVM_GetSystemPackages;
|
||||
JVM_GetTemporaryDirectory;
|
||||
JVM_GetThreadStateNames;
|
||||
JVM_GetThreadStateValues;
|
||||
JVM_GetVersionInfo;
|
||||
|
@ -73,17 +73,14 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined
|
||||
# in $(GAMMADIR)/make/defs.make
|
||||
ifeq ($(HOTSPOT_BUILD_VERSION),)
|
||||
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)\""
|
||||
else
|
||||
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)\""
|
||||
endif
|
||||
|
||||
# The following variables are defined in the generated flags.make file.
|
||||
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""
|
||||
JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""
|
||||
JDK_VER_DEFS = -DJDK_MAJOR_VERSION="\"$(JDK_MAJOR_VERSION)\"" \
|
||||
-DJDK_MINOR_VERSION="\"$(JDK_MINOR_VERSION)\"" \
|
||||
-DJDK_MICRO_VERSION="\"$(JDK_MICRO_VERSION)\"" \
|
||||
-DJDK_BUILD_NUMBER="\"$(JDK_BUILD_NUMBER)\""
|
||||
VM_VER_DEFS = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" \
|
||||
-DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" \
|
||||
$(JDK_VER_DEFS)
|
||||
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
|
||||
BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
|
||||
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
|
||||
@ -92,7 +89,6 @@ VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
|
||||
CXXFLAGS = \
|
||||
${SYSDEFS} \
|
||||
${INCLUDES} \
|
||||
${BUILD_VERSION} \
|
||||
${BUILD_TARGET} \
|
||||
${BUILD_USER} \
|
||||
${HS_LIB_ARCH} \
|
||||
@ -101,7 +97,7 @@ CXXFLAGS = \
|
||||
# This is VERY important! The version define must only be supplied to vm_version.o
|
||||
# If not, ccache will not re-use the cache at all, since the version string might contain
|
||||
# a time and date.
|
||||
CXXFLAGS/vm_version.o += ${JRE_VERSION}
|
||||
CXXFLAGS/vm_version.o += ${VM_VER_DEFS}
|
||||
|
||||
CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
# GAMMADIR - top of workspace
|
||||
# OS_FAMILY - operating system
|
||||
# VARIANT - core, compiler1, compiler2, or tiered
|
||||
# HOTSPOT_RELEASE_VERSION - <major>.<minor>-b<nn> (11.0-b07)
|
||||
# HOTSPOT_RELEASE_VERSION - <major_ver>.<minor_ver>.<micro_ver>[-<identifier>][-<debug_target>][-b<nn>]
|
||||
# HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty
|
||||
# JRE_RELEASE_VERSION - <major>.<minor>.<micro> (1.7.0)
|
||||
#
|
||||
|
@ -161,6 +161,7 @@
|
||||
_JVM_GetStackTraceElement
|
||||
_JVM_GetSystemPackage
|
||||
_JVM_GetSystemPackages
|
||||
_JVM_GetTemporaryDirectory
|
||||
_JVM_GetThreadStateNames
|
||||
_JVM_GetThreadStateValues
|
||||
_JVM_GetVersionInfo
|
||||
|
@ -161,6 +161,7 @@
|
||||
_JVM_GetStackTraceElement
|
||||
_JVM_GetSystemPackage
|
||||
_JVM_GetSystemPackages
|
||||
_JVM_GetTemporaryDirectory
|
||||
_JVM_GetThreadStateNames
|
||||
_JVM_GetThreadStateValues
|
||||
_JVM_GetVersionInfo
|
||||
|
@ -122,7 +122,7 @@ SUNWprivate_1.1 {
|
||||
JVM_GetClassModifiers;
|
||||
JVM_GetClassName;
|
||||
JVM_GetClassNameUTF;
|
||||
JVM_GetClassSignature;
|
||||
JVM_GetClassSignature;
|
||||
JVM_GetClassSigners;
|
||||
JVM_GetClassTypeAnnotations;
|
||||
JVM_GetComponentType;
|
||||
@ -163,6 +163,7 @@ SUNWprivate_1.1 {
|
||||
JVM_GetStackTraceElement;
|
||||
JVM_GetSystemPackage;
|
||||
JVM_GetSystemPackages;
|
||||
JVM_GetTemporaryDirectory;
|
||||
JVM_GetThreadStateNames;
|
||||
JVM_GetThreadStateValues;
|
||||
JVM_GetVersionInfo;
|
||||
|
@ -163,6 +163,7 @@ SUNWprivate_1.1 {
|
||||
JVM_GetStackTraceElement;
|
||||
JVM_GetSystemPackage;
|
||||
JVM_GetSystemPackages;
|
||||
JVM_GetTemporaryDirectory;
|
||||
JVM_GetThreadStateNames;
|
||||
JVM_GetThreadStateValues;
|
||||
JVM_GetVersionInfo;
|
||||
|
@ -72,17 +72,14 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined
|
||||
# in $(GAMMADIR)/make/defs.make
|
||||
ifeq ($(HOTSPOT_BUILD_VERSION),)
|
||||
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)\""
|
||||
else
|
||||
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)\""
|
||||
endif
|
||||
|
||||
# The following variables are defined in the generated flags.make file.
|
||||
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""
|
||||
JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""
|
||||
JDK_VER_DEFS = -DJDK_MAJOR_VERSION="\"$(JDK_MAJOR_VERSION)\"" \
|
||||
-DJDK_MINOR_VERSION="\"$(JDK_MINOR_VERSION)\"" \
|
||||
-DJDK_MICRO_VERSION="\"$(JDK_MICRO_VERSION)\"" \
|
||||
-DJDK_BUILD_NUMBER="\"$(JDK_BUILD_NUMBER)\""
|
||||
VM_VER_DEFS = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" \
|
||||
-DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" \
|
||||
$(JDK_VER_DEFS)
|
||||
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
|
||||
BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
|
||||
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
|
||||
@ -91,7 +88,6 @@ VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
|
||||
CXXFLAGS = \
|
||||
${SYSDEFS} \
|
||||
${INCLUDES} \
|
||||
${BUILD_VERSION} \
|
||||
${BUILD_TARGET} \
|
||||
${BUILD_USER} \
|
||||
${HS_LIB_ARCH} \
|
||||
@ -100,7 +96,7 @@ CXXFLAGS = \
|
||||
# This is VERY important! The version define must only be supplied to vm_version.o
|
||||
# If not, ccache will not re-use the cache at all, since the version string might contain
|
||||
# a time and date.
|
||||
CXXFLAGS/vm_version.o += ${JRE_VERSION}
|
||||
CXXFLAGS/vm_version.o += ${VM_VER_DEFS}
|
||||
|
||||
CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
|
||||
|
||||
|
@ -114,7 +114,7 @@ ifeq ($(JVM_VARIANTS),)
|
||||
endif
|
||||
|
||||
# hotspot version definitions
|
||||
include $(GAMMADIR)/make/hotspot_version
|
||||
include $(GAMMADIR)/make/jdk_version
|
||||
|
||||
# Java versions needed
|
||||
ifeq ($(PREVIOUS_JDK_VERSION),)
|
||||
@ -129,6 +129,9 @@ endif
|
||||
ifeq ($(JDK_MICRO_VERSION),)
|
||||
JDK_MICRO_VERSION=$(JDK_MICRO_VER)
|
||||
endif
|
||||
ifeq ($(JDK_BUILD_NUMBER),)
|
||||
JDK_BUILD_NUMBER=0
|
||||
endif
|
||||
ifeq ($(JDK_MKTG_VERSION),)
|
||||
JDK_MKTG_VERSION=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
|
||||
endif
|
||||
@ -146,7 +149,7 @@ ifndef JRE_RELEASE_VERSION
|
||||
endif
|
||||
|
||||
ifndef HOTSPOT_RELEASE_VERSION
|
||||
HOTSPOT_RELEASE_VERSION=$(HS_MAJOR_VER).$(HS_MINOR_VER)-b$(HS_BUILD_NUMBER)
|
||||
HOTSPOT_RELEASE_VERSION=$(FULL_VERSION)
|
||||
endif
|
||||
|
||||
ifdef HOTSPOT_BUILD_VERSION
|
||||
@ -325,7 +328,6 @@ MAKE_ARGS += BOOTDIR=$(ABS_BOOTDIR)
|
||||
MAKE_ARGS += OUTPUTDIR=$(ABS_OUTPUTDIR)
|
||||
MAKE_ARGS += GAMMADIR=$(ABS_GAMMADIR)
|
||||
MAKE_ARGS += MAKE_VERBOSE=$(MAKE_VERBOSE)
|
||||
MAKE_ARGS += HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION)
|
||||
MAKE_ARGS += JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
|
||||
|
||||
# Pass HOTSPOT_BUILD_VERSION as argument to OS specific Makefile
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2006, 2014, 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
|
||||
@ -19,27 +19,18 @@
|
||||
# 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.
|
||||
#
|
||||
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# Master Hotspot version file. These values may be overridden by a control
|
||||
# Master JDK version file. These values may be overridden by a control
|
||||
# workspace build. This file format must remain compatible with both
|
||||
# GNU Makefile and Microsoft nmake formats.
|
||||
#
|
||||
|
||||
# Don't put quotes (fail windows build).
|
||||
HOTSPOT_VM_COPYRIGHT=Copyright 2013
|
||||
|
||||
HS_MAJOR_VER=25
|
||||
HS_MINOR_VER=0
|
||||
HS_BUILD_NUMBER=62
|
||||
HOTSPOT_VM_COPYRIGHT=Copyright 2014
|
||||
|
||||
JDK_MAJOR_VER=1
|
||||
JDK_MINOR_VER=8
|
||||
JDK_MINOR_VER=9
|
||||
JDK_MICRO_VER=0
|
||||
|
||||
# Previous (bootdir) JDK version
|
||||
JDK_PREVIOUS_VERSION=1.7.0
|
||||
JDK_PREVIOUS_VERSION=1.8.0
|
@ -36,7 +36,7 @@
|
||||
# GAMMADIR - top of workspace
|
||||
# OS_FAMILY - operating system
|
||||
# VARIANT - core, compiler1, compiler2, or tiered
|
||||
# HOTSPOT_RELEASE_VERSION - <major>.<minor>-b<nn> (11.0-b07)
|
||||
# HOTSPOT_RELEASE_VERSION - <major_ver>.<minor_ver>.<micro_ver>[-<identifier>][-<debug_target>][-b<nn>]
|
||||
# HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty
|
||||
# JRE_RELEASE_VERSION - <major>.<minor>.<micro> (1.7.0)
|
||||
#
|
||||
|
@ -122,7 +122,7 @@ SUNWprivate_1.1 {
|
||||
JVM_GetClassModifiers;
|
||||
JVM_GetClassName;
|
||||
JVM_GetClassNameUTF;
|
||||
JVM_GetClassSignature;
|
||||
JVM_GetClassSignature;
|
||||
JVM_GetClassSigners;
|
||||
JVM_GetClassTypeAnnotations;
|
||||
JVM_GetComponentType;
|
||||
@ -163,6 +163,7 @@ SUNWprivate_1.1 {
|
||||
JVM_GetStackTraceElement;
|
||||
JVM_GetSystemPackage;
|
||||
JVM_GetSystemPackages;
|
||||
JVM_GetTemporaryDirectory;
|
||||
JVM_GetThreadStateNames;
|
||||
JVM_GetThreadStateValues;
|
||||
JVM_GetVersionInfo;
|
||||
|
@ -163,6 +163,7 @@ SUNWprivate_1.1 {
|
||||
JVM_GetStackTraceElement;
|
||||
JVM_GetSystemPackage;
|
||||
JVM_GetSystemPackages;
|
||||
JVM_GetTemporaryDirectory;
|
||||
JVM_GetThreadStateNames;
|
||||
JVM_GetThreadStateValues;
|
||||
JVM_GetVersionInfo;
|
||||
|
@ -73,17 +73,14 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined
|
||||
# in $(GAMMADIR)/make/defs.make
|
||||
ifeq ($(HOTSPOT_BUILD_VERSION),)
|
||||
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)\""
|
||||
else
|
||||
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)\""
|
||||
endif
|
||||
|
||||
# The following variables are defined in the generated flags.make file.
|
||||
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""
|
||||
JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""
|
||||
JDK_VER_DEFS = -DJDK_MAJOR_VERSION="\"$(JDK_MAJOR_VERSION)\"" \
|
||||
-DJDK_MINOR_VERSION="\"$(JDK_MINOR_VERSION)\"" \
|
||||
-DJDK_MICRO_VERSION="\"$(JDK_MICRO_VERSION)\"" \
|
||||
-DJDK_BUILD_NUMBER="\"$(JDK_BUILD_NUMBER)\""
|
||||
VM_VER_DEFS = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" \
|
||||
-DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" \
|
||||
$(JDK_VER_DEFS)
|
||||
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
|
||||
BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
|
||||
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
|
||||
@ -92,7 +89,6 @@ VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
|
||||
CXXFLAGS = \
|
||||
${SYSDEFS} \
|
||||
${INCLUDES} \
|
||||
${BUILD_VERSION} \
|
||||
${BUILD_TARGET} \
|
||||
${BUILD_USER} \
|
||||
${HS_LIB_ARCH} \
|
||||
@ -101,7 +97,7 @@ CXXFLAGS = \
|
||||
# This is VERY important! The version define must only be supplied to vm_version.o
|
||||
# If not, ccache will not re-use the cache at all, since the version string might contain
|
||||
# a time and date.
|
||||
CXXFLAGS/vm_version.o += ${JRE_VERSION}
|
||||
CXXFLAGS/vm_version.o += ${VM_VER_DEFS}
|
||||
|
||||
CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
# GAMMADIR - top of workspace
|
||||
# OS_FAMILY - operating system
|
||||
# VARIANT - core, compiler1, compiler2, or tiered
|
||||
# HOTSPOT_RELEASE_VERSION - <major>.<minor>-b<nn> (11.0-b07)
|
||||
# HOTSPOT_RELEASE_VERSION - <major_ver>.<minor_ver>.<micro_ver>[-<identifier>][-<debug_target>][-b<nn>]
|
||||
# HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty
|
||||
# JRE_RELEASE_VERSION - <major>.<minor>.<micro> (1.7.0)
|
||||
#
|
||||
|
@ -163,6 +163,7 @@ SUNWprivate_1.1 {
|
||||
JVM_GetStackTraceElement;
|
||||
JVM_GetSystemPackage;
|
||||
JVM_GetSystemPackages;
|
||||
JVM_GetTemporaryDirectory;
|
||||
JVM_GetThreadStateNames;
|
||||
JVM_GetThreadStateValues;
|
||||
JVM_GetVersionInfo;
|
||||
|
@ -69,8 +69,13 @@ else
|
||||
endif
|
||||
|
||||
# The following variables are defined in the generated flags.make file.
|
||||
BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""
|
||||
JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""
|
||||
JDK_VER_DEFS = -DJDK_MAJOR_VERSION="\"$(JDK_MAJOR_VERSION)\"" \
|
||||
-DJDK_MINOR_VERSION="\"$(JDK_MINOR_VERSION)\"" \
|
||||
-DJDK_MICRO_VERSION="\"$(JDK_MICRO_VERSION)\"" \
|
||||
-DJDK_BUILD_NUMBER="\"$(JDK_BUILD_NUMBER)\""
|
||||
VM_VER_DEFS = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" \
|
||||
-DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" \
|
||||
$(JDK_VER_DEFS)
|
||||
HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
|
||||
BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
|
||||
BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
|
||||
@ -79,7 +84,6 @@ VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
|
||||
CXXFLAGS = \
|
||||
${SYSDEFS} \
|
||||
${INCLUDES} \
|
||||
${BUILD_VERSION} \
|
||||
${BUILD_TARGET} \
|
||||
${BUILD_USER} \
|
||||
${HS_LIB_ARCH} \
|
||||
@ -88,7 +92,7 @@ CXXFLAGS = \
|
||||
# This is VERY important! The version define must only be supplied to vm_version.o
|
||||
# If not, ccache will not re-use the cache at all, since the version string might contain
|
||||
# a time and date.
|
||||
CXXFLAGS/vm_version.o += ${JRE_VERSION}
|
||||
CXXFLAGS/vm_version.o += ${VM_VER_DEFS}
|
||||
|
||||
CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
|
||||
|
||||
|
@ -117,7 +117,7 @@ VARIANT_TEXT=Tiered
|
||||
# These can be overridden via the nmake.exe command line.
|
||||
# They are overridden by RE during the control builds.
|
||||
#
|
||||
!include "$(WorkSpace)/make/hotspot_version"
|
||||
!include "$(WorkSpace)/make/jdk_version"
|
||||
|
||||
# Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro
|
||||
# or make/hotspot_distro.
|
||||
@ -163,7 +163,7 @@ HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(ARCH_TEXT) $(VARIANT_TEXT) VM
|
||||
# 1.6.0-b01 will be 6.0.0.1
|
||||
# 1.6.0_01a-b02 will be 6.0.11.2
|
||||
#
|
||||
# JDK_* variables are defined in make/hotspot_version or on command line
|
||||
# JDK_* variables are defined in make/jdk_version or on command line
|
||||
#
|
||||
JDK_VER=$(JDK_MINOR_VER),$(JDK_MICRO_VER),$(JDK_UPDATE_VER),$(JDK_BUILD_NUMBER)
|
||||
JDK_DOTVER=$(JDK_MINOR_VER).$(JDK_MICRO_VER).$(JDK_UPDATE_VER).$(JDK_BUILD_NUMBER)
|
||||
@ -179,13 +179,12 @@ JDK_MKTG_VERSION=$(JDK_MINOR_VER).$(JDK_MICRO_VER)
|
||||
# Hotspot Express VM FileVersion:
|
||||
# 10.0-b<yz> will have DLL version 10.0.0.yz (need 4 numbers).
|
||||
#
|
||||
# HS_* variables are defined in make/hotspot_version
|
||||
#
|
||||
HS_VER=$(HS_MAJOR_VER),$(HS_MINOR_VER),0,$(HS_BUILD_NUMBER)
|
||||
HS_DOTVER=$(HS_MAJOR_VER).$(HS_MINOR_VER).0.$(HS_BUILD_NUMBER)
|
||||
HS_VER=$(JDK_VER)
|
||||
HS_DOTVER=$(JDK_DOTVER)
|
||||
|
||||
!if "$(HOTSPOT_RELEASE_VERSION)" == ""
|
||||
HOTSPOT_RELEASE_VERSION=$(HS_MAJOR_VER).$(HS_MINOR_VER)-b$(HS_BUILD_NUMBER)
|
||||
HOTSPOT_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
|
||||
!endif
|
||||
|
||||
!if "$(HOTSPOT_BUILD_VERSION)" == ""
|
||||
|
@ -179,9 +179,9 @@ LIBRARY_SUFFIX=dll
|
||||
|
||||
# next parameters are defined in $(GAMMADIR)/make/defs.make.
|
||||
MAKE_ARGS += JDK_MKTG_VERSION=$(JDK_MKTG_VERSION)
|
||||
MAKE_ARGS += JDK_MAJOR_VER=$(JDK_MAJOR_VERSION)
|
||||
MAKE_ARGS += JDK_MINOR_VER=$(JDK_MINOR_VERSION)
|
||||
MAKE_ARGS += JDK_MICRO_VER=$(JDK_MICRO_VERSION)
|
||||
MAKE_ARGS += JDK_MAJOR_VERSION=$(JDK_MAJOR_VERSION)
|
||||
MAKE_ARGS += JDK_MINOR_VERSION=$(JDK_MINOR_VERSION)
|
||||
MAKE_ARGS += JDK_MICRO_VERSION=$(JDK_MICRO_VERSION)
|
||||
|
||||
ifdef COOKED_JDK_UPDATE_VERSION
|
||||
MAKE_ARGS += JDK_UPDATE_VER=$(COOKED_JDK_UPDATE_VERSION)
|
||||
|
@ -56,6 +56,10 @@ HOTSPOT_LIB_ARCH=$(BUILDARCH)
|
||||
|
||||
# The following variables are defined in the generated local.make file.
|
||||
CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_RELEASE_VERSION=\"$(HS_BUILD_VER)\""
|
||||
CXX_FLAGS=$(CXX_FLAGS) /D "JDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\""
|
||||
CXX_FLAGS=$(CXX_FLAGS) /D "JDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\""
|
||||
CXX_FLAGS=$(CXX_FLAGS) /D "JDK_MICRO_VERSION=\"$(JDK_MICRO_VERSION)\""
|
||||
CXX_FLAGS=$(CXX_FLAGS) /D "JDK_BUILD_NUMBER=\"$(JDK_BUILD_NUMBER)\""
|
||||
CXX_FLAGS=$(CXX_FLAGS) /D "JRE_RELEASE_VERSION=\"$(JRE_RELEASE_VER)\""
|
||||
CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_LIB_ARCH=\"$(HOTSPOT_LIB_ARCH)\""
|
||||
CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_BUILD_TARGET=\"$(BUILD_FLAVOR)\""
|
||||
|
@ -78,24 +78,23 @@ HS_INTERNAL_NAME=jvm
|
||||
|
||||
default:: $(AdditionalTargets) $(JvmtiGeneratedFiles) $(TraceGeneratedFiles)
|
||||
|
||||
!include $(HOTSPOTWORKSPACE)/make/hotspot_version
|
||||
!include $(HOTSPOTWORKSPACE)/make/jdk_version
|
||||
|
||||
!if "$(USER_RELEASE_SUFFIX)" != ""
|
||||
HOTSPOT_BUILD_VERSION = internal-$(USER_RELEASE_SUFFIX)
|
||||
!else
|
||||
HOTSPOT_BUILD_VERSION = internal
|
||||
!endif
|
||||
!if "$(HOTSPOT_RELEASE_VERSION)" != ""
|
||||
HOTSPOT_RELEASE_VERSION="\\\"$(HOTSPOT_RELEASE_VERSION)\\\""
|
||||
!else
|
||||
HOTSPOT_RELEASE_VERSION="\\\"$(HS_MAJOR_VER).$(HS_MINOR_VER)-b$(HS_BUILD_NUMBER)-$(HOTSPOT_BUILD_VERSION)\\\""
|
||||
!endif
|
||||
!if "$(JRE_RELEASE_VERSION)" != ""
|
||||
JRE_RELEASE_VERSION="\\\"$(JRE_RELEASE_VERSION)\\\""
|
||||
!else
|
||||
JRE_RELEASE_VERSION="\\\"$(JDK_MAJOR_VER).$(JDK_MINOR_VER).$(JDK_MICRO_VER)\\\""
|
||||
!endif
|
||||
|
||||
!if "$(HOTSPOT_RELEASE_VERSION)" != ""
|
||||
HOTSPOT_RELEASE_VERSION="\\\"$(HOTSPOT_RELEASE_VERSION)\\\""
|
||||
!else
|
||||
HOTSPOT_RELEASE_VERSION="\\\"$(JRE_RELEASE_VERSION)\\\""
|
||||
!endif
|
||||
# Define HOTSPOT_VM_DISTRO if HOTSPOT_VM_DISTRO is set,
|
||||
# and if it is not see if we have the src/closed directory
|
||||
!if "$(HOTSPOT_VM_DISTRO)" != ""
|
||||
|
@ -127,8 +127,12 @@
|
||||
// global variables
|
||||
julong os::Bsd::_physical_memory = 0;
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
mach_timebase_info_data_t os::Bsd::_timebase_info = {0, 0};
|
||||
volatile uint64_t os::Bsd::_max_abstime = 0;
|
||||
#else
|
||||
int (*os::Bsd::_clock_gettime)(clockid_t, struct timespec *) = NULL;
|
||||
#endif
|
||||
pthread_t os::Bsd::_main_thread;
|
||||
int os::Bsd::_page_size = -1;
|
||||
|
||||
@ -986,13 +990,15 @@ jlong os::javaTimeMillis() {
|
||||
return jlong(time.tv_sec) * 1000 + jlong(time.tv_usec / 1000);
|
||||
}
|
||||
|
||||
#ifndef __APPLE__
|
||||
#ifndef CLOCK_MONOTONIC
|
||||
#define CLOCK_MONOTONIC (1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
void os::Bsd::clock_init() {
|
||||
// XXXDARWIN: Investigate replacement monotonic clock
|
||||
mach_timebase_info(&_timebase_info);
|
||||
}
|
||||
#else
|
||||
void os::Bsd::clock_init() {
|
||||
@ -1007,10 +1013,39 @@ void os::Bsd::clock_init() {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
jlong os::javaTimeNanos() {
|
||||
const uint64_t tm = mach_absolute_time();
|
||||
const uint64_t now = (tm * Bsd::_timebase_info.numer) / Bsd::_timebase_info.denom;
|
||||
const uint64_t prev = Bsd::_max_abstime;
|
||||
if (now <= prev) {
|
||||
return prev; // same or retrograde time;
|
||||
}
|
||||
const uint64_t obsv = Atomic::cmpxchg(now, (volatile jlong*)&Bsd::_max_abstime, prev);
|
||||
assert(obsv >= prev, "invariant"); // Monotonicity
|
||||
// If the CAS succeeded then we're done and return "now".
|
||||
// If the CAS failed and the observed value "obsv" is >= now then
|
||||
// we should return "obsv". If the CAS failed and now > obsv > prv then
|
||||
// some other thread raced this thread and installed a new value, in which case
|
||||
// we could either (a) retry the entire operation, (b) retry trying to install now
|
||||
// or (c) just return obsv. We use (c). No loop is required although in some cases
|
||||
// we might discard a higher "now" value in deference to a slightly lower but freshly
|
||||
// installed obsv value. That's entirely benign -- it admits no new orderings compared
|
||||
// to (a) or (b) -- and greatly reduces coherence traffic.
|
||||
// We might also condition (c) on the magnitude of the delta between obsv and now.
|
||||
// Avoiding excessive CAS operations to hot RW locations is critical.
|
||||
// See https://blogs.oracle.com/dave/entry/cas_and_cache_trivia_invalidate
|
||||
return (prev == obsv) ? now : obsv;
|
||||
}
|
||||
|
||||
#else // __APPLE__
|
||||
|
||||
jlong os::javaTimeNanos() {
|
||||
if (os::supports_monotonic_clock()) {
|
||||
struct timespec tp;
|
||||
int status = Bsd::clock_gettime(CLOCK_MONOTONIC, &tp);
|
||||
int status = Bsd::_clock_gettime(CLOCK_MONOTONIC, &tp);
|
||||
assert(status == 0, "gettime error");
|
||||
jlong result = jlong(tp.tv_sec) * (1000 * 1000 * 1000) + jlong(tp.tv_nsec);
|
||||
return result;
|
||||
@ -1023,6 +1058,8 @@ jlong os::javaTimeNanos() {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
void os::javaTimeNanos_info(jvmtiTimerInfo *info_ptr) {
|
||||
if (os::supports_monotonic_clock()) {
|
||||
info_ptr->max_value = ALL_64_BITS;
|
||||
|
@ -58,7 +58,13 @@ class Bsd {
|
||||
// For signal flags diagnostics
|
||||
static int sigflags[MAXSIGNUM];
|
||||
|
||||
#ifdef __APPLE__
|
||||
// mach_absolute_time
|
||||
static mach_timebase_info_data_t _timebase_info;
|
||||
static volatile uint64_t _max_abstime;
|
||||
#else
|
||||
static int (*_clock_gettime)(clockid_t, struct timespec *);
|
||||
#endif
|
||||
|
||||
static GrowableArray<int>* _cpu_to_node;
|
||||
|
||||
@ -134,10 +140,6 @@ class Bsd {
|
||||
// Real-time clock functions
|
||||
static void clock_init(void);
|
||||
|
||||
static int clock_gettime(clockid_t clock_id, struct timespec *tp) {
|
||||
return _clock_gettime ? _clock_gettime(clock_id, tp) : -1;
|
||||
}
|
||||
|
||||
// Stack repair handling
|
||||
|
||||
// none present
|
||||
|
@ -287,7 +287,11 @@ inline int os::set_sock_opt(int fd, int level, int optname,
|
||||
}
|
||||
|
||||
inline bool os::supports_monotonic_clock() {
|
||||
#ifdef __APPLE__
|
||||
return true;
|
||||
#else
|
||||
return Bsd::_clock_gettime != NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // OS_BSD_VM_OS_BSD_INLINE_HPP
|
||||
|
@ -347,11 +347,7 @@ julong os::physical_memory() {
|
||||
|
||||
static hrtime_t first_hrtime = 0;
|
||||
static const hrtime_t hrtime_hz = 1000*1000*1000;
|
||||
const int LOCK_BUSY = 1;
|
||||
const int LOCK_FREE = 0;
|
||||
const int LOCK_INVALID = -1;
|
||||
static volatile hrtime_t max_hrtime = 0;
|
||||
static volatile int max_hrtime_lock = LOCK_FREE; // Update counter with LSB as lock-in-progress
|
||||
|
||||
|
||||
void os::Solaris::initialize_system_info() {
|
||||
@ -1364,58 +1360,31 @@ void* os::thread_local_storage_at(int index) {
|
||||
}
|
||||
|
||||
|
||||
// gethrtime can move backwards if read from one cpu and then a different cpu
|
||||
// getTimeNanos is guaranteed to not move backward on Solaris
|
||||
// local spinloop created as faster for a CAS on an int than
|
||||
// a CAS on a 64bit jlong. Also Atomic::cmpxchg for jlong is not
|
||||
// supported on sparc v8 or pre supports_cx8 intel boxes.
|
||||
// oldgetTimeNanos for systems which do not support CAS on 64bit jlong
|
||||
// i.e. sparc v8 and pre supports_cx8 (i486) intel boxes
|
||||
inline hrtime_t oldgetTimeNanos() {
|
||||
int gotlock = LOCK_INVALID;
|
||||
hrtime_t newtime = gethrtime();
|
||||
|
||||
for (;;) {
|
||||
// grab lock for max_hrtime
|
||||
int curlock = max_hrtime_lock;
|
||||
if (curlock & LOCK_BUSY) continue;
|
||||
if (gotlock = Atomic::cmpxchg(LOCK_BUSY, &max_hrtime_lock, LOCK_FREE) != LOCK_FREE) continue;
|
||||
if (newtime > max_hrtime) {
|
||||
max_hrtime = newtime;
|
||||
} else {
|
||||
newtime = max_hrtime;
|
||||
}
|
||||
// release lock
|
||||
max_hrtime_lock = LOCK_FREE;
|
||||
return newtime;
|
||||
}
|
||||
}
|
||||
// gethrtime can move backwards if read from one cpu and then a different cpu
|
||||
// getTimeNanos is guaranteed to not move backward on Solaris
|
||||
// gethrtime() should be monotonic according to the documentation,
|
||||
// but some virtualized platforms are known to break this guarantee.
|
||||
// getTimeNanos() must be guaranteed not to move backwards, so we
|
||||
// are forced to add a check here.
|
||||
inline hrtime_t getTimeNanos() {
|
||||
if (VM_Version::supports_cx8()) {
|
||||
const hrtime_t now = gethrtime();
|
||||
// Use atomic long load since 32-bit x86 uses 2 registers to keep long.
|
||||
const hrtime_t prev = Atomic::load((volatile jlong*)&max_hrtime);
|
||||
if (now <= prev) return prev; // same or retrograde time;
|
||||
const hrtime_t obsv = Atomic::cmpxchg(now, (volatile jlong*)&max_hrtime, prev);
|
||||
assert(obsv >= prev, "invariant"); // Monotonicity
|
||||
// If the CAS succeeded then we're done and return "now".
|
||||
// If the CAS failed and the observed value "obs" is >= now then
|
||||
// we should return "obs". If the CAS failed and now > obs > prv then
|
||||
// some other thread raced this thread and installed a new value, in which case
|
||||
// we could either (a) retry the entire operation, (b) retry trying to install now
|
||||
// or (c) just return obs. We use (c). No loop is required although in some cases
|
||||
// we might discard a higher "now" value in deference to a slightly lower but freshly
|
||||
// installed obs value. That's entirely benign -- it admits no new orderings compared
|
||||
// to (a) or (b) -- and greatly reduces coherence traffic.
|
||||
// We might also condition (c) on the magnitude of the delta between obs and now.
|
||||
// Avoiding excessive CAS operations to hot RW locations is critical.
|
||||
// See http://blogs.sun.com/dave/entry/cas_and_cache_trivia_invalidate
|
||||
return (prev == obsv) ? now : obsv ;
|
||||
} else {
|
||||
return oldgetTimeNanos();
|
||||
const hrtime_t now = gethrtime();
|
||||
const hrtime_t prev = max_hrtime;
|
||||
if (now <= prev) {
|
||||
return prev; // same or retrograde time;
|
||||
}
|
||||
const hrtime_t obsv = Atomic::cmpxchg(now, (volatile jlong*)&max_hrtime, prev);
|
||||
assert(obsv >= prev, "invariant"); // Monotonicity
|
||||
// If the CAS succeeded then we're done and return "now".
|
||||
// If the CAS failed and the observed value "obsv" is >= now then
|
||||
// we should return "obsv". If the CAS failed and now > obsv > prv then
|
||||
// some other thread raced this thread and installed a new value, in which case
|
||||
// we could either (a) retry the entire operation, (b) retry trying to install now
|
||||
// or (c) just return obsv. We use (c). No loop is required although in some cases
|
||||
// we might discard a higher "now" value in deference to a slightly lower but freshly
|
||||
// installed obsv value. That's entirely benign -- it admits no new orderings compared
|
||||
// to (a) or (b) -- and greatly reduces coherence traffic.
|
||||
// We might also condition (c) on the magnitude of the delta between obsv and now.
|
||||
// Avoiding excessive CAS operations to hot RW locations is critical.
|
||||
// See https://blogs.oracle.com/dave/entry/cas_and_cache_trivia_invalidate
|
||||
return (prev == obsv) ? now : obsv;
|
||||
}
|
||||
|
||||
// Time since start-up in seconds to a fine granularity.
|
||||
|
@ -130,6 +130,13 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
|
||||
case DLL_PROCESS_DETACH:
|
||||
if(ForceTimeHighResolution)
|
||||
timeEndPeriod(1L);
|
||||
|
||||
// Workaround for issue when a custom launcher doesn't call
|
||||
// DestroyJavaVM and NMT is trying to track memory when free is
|
||||
// called from a static destructor
|
||||
if (MemTracker::is_on()) {
|
||||
MemTracker::shutdown(MemTracker::NMT_normal);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -421,6 +421,15 @@ char* java_lang_String::as_utf8_string(oop java_string, int start, int len) {
|
||||
return UNICODE::as_utf8(position, len);
|
||||
}
|
||||
|
||||
char* java_lang_String::as_utf8_string(oop java_string, int start, int len, char* buf, int buflen) {
|
||||
typeArrayOop value = java_lang_String::value(java_string);
|
||||
int offset = java_lang_String::offset(java_string);
|
||||
int length = java_lang_String::length(java_string);
|
||||
assert(start + len <= length, "just checking");
|
||||
jchar* position = value->char_at_addr(offset + start);
|
||||
return UNICODE::as_utf8(position, len, buf, buflen);
|
||||
}
|
||||
|
||||
bool java_lang_String::equals(oop java_string, jchar* chars, int len) {
|
||||
assert(java_string->klass() == SystemDictionary::String_klass(),
|
||||
"must be java_string");
|
||||
|
@ -162,6 +162,7 @@ class java_lang_String : AllStatic {
|
||||
static char* as_utf8_string(oop java_string);
|
||||
static char* as_utf8_string(oop java_string, char* buf, int buflen);
|
||||
static char* as_utf8_string(oop java_string, int start, int len);
|
||||
static char* as_utf8_string(oop java_string, int start, int len, char* buf, int buflen);
|
||||
static char* as_platform_dependent_str(Handle java_string, TRAPS);
|
||||
static jchar* as_unicode_string(oop java_string, int& length, TRAPS);
|
||||
// produce an ascii string with all other values quoted using \u####
|
||||
|
@ -1282,6 +1282,7 @@ void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) {
|
||||
Universe::verify(VerifyOption_G1UsePrevMarking,
|
||||
" VerifyDuringGC:(before)");
|
||||
}
|
||||
g1h->check_bitmaps("Remark Start");
|
||||
|
||||
G1CollectorPolicy* g1p = g1h->g1_policy();
|
||||
g1p->record_concurrent_mark_remark_start();
|
||||
@ -1330,6 +1331,7 @@ void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) {
|
||||
Universe::verify(VerifyOption_G1UseNextMarking,
|
||||
" VerifyDuringGC:(after)");
|
||||
}
|
||||
g1h->check_bitmaps("Remark End");
|
||||
assert(!restart_for_overflow(), "sanity");
|
||||
// Completely reset the marking state since marking completed
|
||||
set_non_marking_state();
|
||||
@ -1979,6 +1981,7 @@ void ConcurrentMark::cleanup() {
|
||||
Universe::verify(VerifyOption_G1UsePrevMarking,
|
||||
" VerifyDuringGC:(before)");
|
||||
}
|
||||
g1h->check_bitmaps("Cleanup Start");
|
||||
|
||||
G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy();
|
||||
g1p->record_concurrent_mark_cleanup_start();
|
||||
@ -2133,6 +2136,7 @@ void ConcurrentMark::cleanup() {
|
||||
Universe::verify(VerifyOption_G1UsePrevMarking,
|
||||
" VerifyDuringGC:(after)");
|
||||
}
|
||||
g1h->check_bitmaps("Cleanup End");
|
||||
|
||||
g1h->verify_region_sets_optional();
|
||||
g1h->trace_heap_after_concurrent_cycle();
|
||||
@ -3224,6 +3228,11 @@ void ConcurrentMark::print_stats() {
|
||||
void ConcurrentMark::abort() {
|
||||
// Clear all marks to force marking thread to do nothing
|
||||
_nextMarkBitMap->clearAll();
|
||||
|
||||
// Note we cannot clear the previous marking bitmap here
|
||||
// since VerifyDuringGC verifies the objects marked during
|
||||
// a full GC against the previous bitmap.
|
||||
|
||||
// Clear the liveness counting data
|
||||
clear_all_count_data();
|
||||
// Empty mark stack
|
||||
|
@ -768,6 +768,7 @@ G1CollectedHeap::humongous_obj_allocate_initialize_regions(uint first,
|
||||
// match new_top.
|
||||
assert(hr == NULL ||
|
||||
(hr->end() == new_end && hr->top() == new_top), "sanity");
|
||||
check_bitmaps("Humongous Region Allocation", first_hr);
|
||||
|
||||
assert(first_hr->used() == word_size * HeapWordSize, "invariant");
|
||||
_summary_bytes_used += first_hr->used();
|
||||
@ -1326,6 +1327,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
|
||||
|
||||
verify_before_gc();
|
||||
|
||||
check_bitmaps("Full GC Start");
|
||||
pre_full_gc_dump(gc_timer);
|
||||
|
||||
COMPILER2_PRESENT(DerivedPointerTable::clear());
|
||||
@ -1499,6 +1501,18 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
|
||||
|
||||
verify_after_gc();
|
||||
|
||||
// Clear the previous marking bitmap, if needed for bitmap verification.
|
||||
// Note we cannot do this when we clear the next marking bitmap in
|
||||
// ConcurrentMark::abort() above since VerifyDuringGC verifies the
|
||||
// objects marked during a full GC against the previous bitmap.
|
||||
// But we need to clear it before calling check_bitmaps below since
|
||||
// the full GC has compacted objects and updated TAMS but not updated
|
||||
// the prev bitmap.
|
||||
if (G1VerifyBitmaps) {
|
||||
((CMBitMap*) concurrent_mark()->prevMarkBitMap())->clearAll();
|
||||
}
|
||||
check_bitmaps("Full GC End");
|
||||
|
||||
// Start a new incremental collection set for the next pause
|
||||
assert(g1_policy()->collection_set() == NULL, "must be");
|
||||
g1_policy()->start_incremental_cset_building();
|
||||
@ -3978,6 +3992,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
|
||||
increment_gc_time_stamp();
|
||||
|
||||
verify_before_gc();
|
||||
check_bitmaps("GC Start");
|
||||
|
||||
COMPILER2_PRESENT(DerivedPointerTable::clear());
|
||||
|
||||
@ -4223,6 +4238,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
|
||||
increment_gc_time_stamp();
|
||||
|
||||
verify_after_gc();
|
||||
check_bitmaps("GC End");
|
||||
|
||||
assert(!ref_processor_stw()->discovery_enabled(), "Postcondition");
|
||||
ref_processor_stw()->verify_no_references_recorded();
|
||||
@ -5945,6 +5961,11 @@ void G1CollectedHeap::free_region(HeapRegion* hr,
|
||||
assert(!hr->is_empty(), "the region should not be empty");
|
||||
assert(free_list != NULL, "pre-condition");
|
||||
|
||||
if (G1VerifyBitmaps) {
|
||||
MemRegion mr(hr->bottom(), hr->end());
|
||||
concurrent_mark()->clearRangePrevBitmap(mr);
|
||||
}
|
||||
|
||||
// Clear the card counts for this region.
|
||||
// Note: we only need to do this if the region is not young
|
||||
// (since we don't refine cards in young regions).
|
||||
@ -6079,7 +6100,87 @@ void G1CollectedHeap::verify_dirty_young_list(HeapRegion* head) {
|
||||
void G1CollectedHeap::verify_dirty_young_regions() {
|
||||
verify_dirty_young_list(_young_list->first_region());
|
||||
}
|
||||
#endif
|
||||
|
||||
bool G1CollectedHeap::verify_no_bits_over_tams(const char* bitmap_name, CMBitMapRO* bitmap,
|
||||
HeapWord* tams, HeapWord* end) {
|
||||
guarantee(tams <= end,
|
||||
err_msg("tams: "PTR_FORMAT" end: "PTR_FORMAT, tams, end));
|
||||
HeapWord* result = bitmap->getNextMarkedWordAddress(tams, end);
|
||||
if (result < end) {
|
||||
gclog_or_tty->cr();
|
||||
gclog_or_tty->print_cr("## wrong marked address on %s bitmap: "PTR_FORMAT,
|
||||
bitmap_name, result);
|
||||
gclog_or_tty->print_cr("## %s tams: "PTR_FORMAT" end: "PTR_FORMAT,
|
||||
bitmap_name, tams, end);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool G1CollectedHeap::verify_bitmaps(const char* caller, HeapRegion* hr) {
|
||||
CMBitMapRO* prev_bitmap = concurrent_mark()->prevMarkBitMap();
|
||||
CMBitMapRO* next_bitmap = (CMBitMapRO*) concurrent_mark()->nextMarkBitMap();
|
||||
|
||||
HeapWord* bottom = hr->bottom();
|
||||
HeapWord* ptams = hr->prev_top_at_mark_start();
|
||||
HeapWord* ntams = hr->next_top_at_mark_start();
|
||||
HeapWord* end = hr->end();
|
||||
|
||||
bool res_p = verify_no_bits_over_tams("prev", prev_bitmap, ptams, end);
|
||||
|
||||
bool res_n = true;
|
||||
// We reset mark_in_progress() before we reset _cmThread->in_progress() and in this window
|
||||
// we do the clearing of the next bitmap concurrently. Thus, we can not verify the bitmap
|
||||
// if we happen to be in that state.
|
||||
if (mark_in_progress() || !_cmThread->in_progress()) {
|
||||
res_n = verify_no_bits_over_tams("next", next_bitmap, ntams, end);
|
||||
}
|
||||
if (!res_p || !res_n) {
|
||||
gclog_or_tty->print_cr("#### Bitmap verification failed for "HR_FORMAT,
|
||||
HR_FORMAT_PARAMS(hr));
|
||||
gclog_or_tty->print_cr("#### Caller: %s", caller);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void G1CollectedHeap::check_bitmaps(const char* caller, HeapRegion* hr) {
|
||||
if (!G1VerifyBitmaps) return;
|
||||
|
||||
guarantee(verify_bitmaps(caller, hr), "bitmap verification");
|
||||
}
|
||||
|
||||
class G1VerifyBitmapClosure : public HeapRegionClosure {
|
||||
private:
|
||||
const char* _caller;
|
||||
G1CollectedHeap* _g1h;
|
||||
bool _failures;
|
||||
|
||||
public:
|
||||
G1VerifyBitmapClosure(const char* caller, G1CollectedHeap* g1h) :
|
||||
_caller(caller), _g1h(g1h), _failures(false) { }
|
||||
|
||||
bool failures() { return _failures; }
|
||||
|
||||
virtual bool doHeapRegion(HeapRegion* hr) {
|
||||
if (hr->continuesHumongous()) return false;
|
||||
|
||||
bool result = _g1h->verify_bitmaps(_caller, hr);
|
||||
if (!result) {
|
||||
_failures = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
void G1CollectedHeap::check_bitmaps(const char* caller) {
|
||||
if (!G1VerifyBitmaps) return;
|
||||
|
||||
G1VerifyBitmapClosure cl(caller, this);
|
||||
heap_region_iterate(&cl);
|
||||
guarantee(!cl.failures(), "bitmap verification");
|
||||
}
|
||||
#endif // PRODUCT
|
||||
|
||||
void G1CollectedHeap::cleanUpCardTable() {
|
||||
G1SATBCardTableModRefBS* ct_bs = g1_barrier_set();
|
||||
@ -6464,6 +6565,7 @@ HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size,
|
||||
if (new_alloc_region != NULL) {
|
||||
set_region_short_lived_locked(new_alloc_region);
|
||||
_hr_printer.alloc(new_alloc_region, G1HRPrinter::Eden, young_list_full);
|
||||
check_bitmaps("Mutator Region Allocation", new_alloc_region);
|
||||
return new_alloc_region;
|
||||
}
|
||||
}
|
||||
@ -6530,8 +6632,10 @@ HeapRegion* G1CollectedHeap::new_gc_alloc_region(size_t word_size,
|
||||
if (survivor) {
|
||||
new_alloc_region->set_survivor();
|
||||
_hr_printer.alloc(new_alloc_region, G1HRPrinter::Survivor);
|
||||
check_bitmaps("Survivor Region Allocation", new_alloc_region);
|
||||
} else {
|
||||
_hr_printer.alloc(new_alloc_region, G1HRPrinter::Old);
|
||||
check_bitmaps("Old Region Allocation", new_alloc_region);
|
||||
}
|
||||
bool during_im = g1_policy()->during_initial_mark_pause();
|
||||
new_alloc_region->note_start_of_copying(during_im);
|
||||
|
@ -1186,6 +1186,30 @@ public:
|
||||
void verify_dirty_young_list(HeapRegion* head) PRODUCT_RETURN;
|
||||
void verify_dirty_young_regions() PRODUCT_RETURN;
|
||||
|
||||
#ifndef PRODUCT
|
||||
// Make sure that the given bitmap has no marked objects in the
|
||||
// range [from,limit). If it does, print an error message and return
|
||||
// false. Otherwise, just return true. bitmap_name should be "prev"
|
||||
// or "next".
|
||||
bool verify_no_bits_over_tams(const char* bitmap_name, CMBitMapRO* bitmap,
|
||||
HeapWord* from, HeapWord* limit);
|
||||
|
||||
// Verify that the prev / next bitmap range [tams,end) for the given
|
||||
// region has no marks. Return true if all is well, false if errors
|
||||
// are detected.
|
||||
bool verify_bitmaps(const char* caller, HeapRegion* hr);
|
||||
#endif // PRODUCT
|
||||
|
||||
// If G1VerifyBitmaps is set, verify that the marking bitmaps for
|
||||
// the given region do not have any spurious marks. If errors are
|
||||
// detected, print appropriate error messages and crash.
|
||||
void check_bitmaps(const char* caller, HeapRegion* hr) PRODUCT_RETURN;
|
||||
|
||||
// If G1VerifyBitmaps is set, verify that the marking bitmaps do not
|
||||
// have any spurious marks. If errors are detected, print
|
||||
// appropriate error messages and crash.
|
||||
void check_bitmaps(const char* caller) PRODUCT_RETURN;
|
||||
|
||||
// verify_region_sets() performs verification over the region
|
||||
// lists. It will be compiled in the product code to be used when
|
||||
// necessary (i.e., during heap verification).
|
||||
|
@ -191,6 +191,7 @@ public:
|
||||
|
||||
hr->note_self_forwarding_removal_start(during_initial_mark,
|
||||
during_conc_mark);
|
||||
_g1h->check_bitmaps("Self-Forwarding Ptr Removal", hr);
|
||||
|
||||
// In the common case (i.e. when there is no evacuation
|
||||
// failure) we make sure that the following is done when
|
||||
|
@ -325,11 +325,14 @@
|
||||
"evacuation pauses") \
|
||||
\
|
||||
diagnostic(bool, G1VerifyRSetsDuringFullGC, false, \
|
||||
"If true, perform verification of each heap region's " \
|
||||
"remembered set when verifying the heap during a full GC.") \
|
||||
"If true, perform verification of each heap region's " \
|
||||
"remembered set when verifying the heap during a full GC.") \
|
||||
\
|
||||
diagnostic(bool, G1VerifyHeapRegionCodeRoots, false, \
|
||||
"Verify the code root lists attached to each heap region.")
|
||||
"Verify the code root lists attached to each heap region.") \
|
||||
\
|
||||
develop(bool, G1VerifyBitmaps, false, \
|
||||
"Verifies the consistency of the marking bitmaps")
|
||||
|
||||
G1_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_EXPERIMENTAL_FLAG, DECLARE_NOTPRODUCT_FLAG, DECLARE_MANAGEABLE_FLAG, DECLARE_PRODUCT_RW_FLAG)
|
||||
|
||||
|
@ -488,6 +488,7 @@ void Klass::remove_unshareable_info() {
|
||||
}
|
||||
|
||||
void Klass::restore_unshareable_info(TRAPS) {
|
||||
TRACE_INIT_ID(this);
|
||||
// If an exception happened during CDS restore, some of these fields may already be
|
||||
// set. We leave the class on the CLD list, even if incomplete so that we don't
|
||||
// modify the CLD list outside a safepoint.
|
||||
|
@ -3150,11 +3150,9 @@ JNI_ENTRY(void, jni_GetStringUTFRegion(JNIEnv *env, jstring string, jsize start,
|
||||
} else {
|
||||
//%note jni_7
|
||||
if (len > 0) {
|
||||
ResourceMark rm(THREAD);
|
||||
char *utf_region = java_lang_String::as_utf8_string(s, start, len);
|
||||
int utf_len = (int)strlen(utf_region);
|
||||
memcpy(buf, utf_region, utf_len);
|
||||
buf[utf_len] = 0;
|
||||
// Assume the buffer is large enough as the JNI spec. does not require user error checking
|
||||
java_lang_String::as_utf8_string(s, start, len, buf, INT_MAX);
|
||||
// as_utf8_string null-terminates the result string
|
||||
} else {
|
||||
// JDK null-terminates the buffer even in len is zero
|
||||
if (buf != NULL) {
|
||||
@ -3880,6 +3878,7 @@ void TestNewSize_test();
|
||||
void TestOldSize_test();
|
||||
void TestKlass_test();
|
||||
void TestBitMap_test();
|
||||
void TestAsUtf8();
|
||||
#if INCLUDE_ALL_GCS
|
||||
void TestOldFreeSpaceCalculation_test();
|
||||
void TestG1BiasedArray_test();
|
||||
@ -3907,6 +3906,7 @@ void execute_internal_vm_tests() {
|
||||
run_unit_test(TestOldSize_test());
|
||||
run_unit_test(TestKlass_test());
|
||||
run_unit_test(TestBitMap_test());
|
||||
run_unit_test(TestAsUtf8());
|
||||
#if INCLUDE_VM_STRUCTS
|
||||
run_unit_test(VMStructs::test());
|
||||
#endif
|
||||
|
@ -386,6 +386,23 @@ JVM_ENTRY(jobject, JVM_InitProperties(JNIEnv *env, jobject properties))
|
||||
JVM_END
|
||||
|
||||
|
||||
/*
|
||||
* Return the temporary directory that the VM uses for the attach
|
||||
* and perf data files.
|
||||
*
|
||||
* It is important that this directory is well-known and the
|
||||
* same for all VM instances. It cannot be affected by configuration
|
||||
* variables such as java.io.tmpdir.
|
||||
*/
|
||||
JVM_ENTRY(jstring, JVM_GetTemporaryDirectory(JNIEnv *env))
|
||||
JVMWrapper("JVM_GetTemporaryDirectory");
|
||||
HandleMark hm(THREAD);
|
||||
const char* temp_dir = os::get_temp_directory();
|
||||
Handle h = java_lang_String::create_from_platform_dependent_str(temp_dir, CHECK_NULL);
|
||||
return (jstring) JNIHandles::make_local(env, h());
|
||||
JVM_END
|
||||
|
||||
|
||||
// java.lang.Runtime /////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern volatile jint vm_created;
|
||||
|
@ -1485,6 +1485,9 @@ JVM_GetManagement(jint version);
|
||||
JNIEXPORT jobject JNICALL
|
||||
JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
JVM_GetTemporaryDirectory(JNIEnv *env);
|
||||
|
||||
/* Generics reflection support.
|
||||
*
|
||||
* Returns information about the given class's EnclosingMethod
|
||||
@ -1553,12 +1556,10 @@ JVM_GetThreadStateNames(JNIEnv* env, jint javaThreadState, jintArray values);
|
||||
* ==========================================================================
|
||||
*/
|
||||
typedef struct {
|
||||
/* HotSpot Express VM version string:
|
||||
* <major>.<minor>-bxx[-<identifier>][-<debug_flavor>]
|
||||
*/
|
||||
unsigned int jvm_version; /* Consists of major.minor.0.build */
|
||||
unsigned int update_version : 8; /* 0 in HotSpot Express VM */
|
||||
unsigned int special_update_version : 8; /* 0 in HotSpot Express VM */
|
||||
/* VM version string: follows the JDK release version naming convention */
|
||||
unsigned int jvm_version; /* <major_ver>.<minor_ver>.<micro_ver>[-<identifier>][-<debug_target>][-b<nn>] */
|
||||
unsigned int update_version : 8;
|
||||
unsigned int special_update_version : 8;
|
||||
unsigned int reserved1 : 16;
|
||||
unsigned int reserved2;
|
||||
|
||||
@ -1577,11 +1578,7 @@ typedef struct {
|
||||
|
||||
#define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
|
||||
#define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
|
||||
// Micro version is 0 in HotSpot Express VM (set in jvm.cpp).
|
||||
#define JVM_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8)
|
||||
/* Build number is available in all HotSpot Express VM builds.
|
||||
* It is defined in make/hotspot_version file.
|
||||
*/
|
||||
#define JVM_VERSION_BUILD(version) ((version & 0x000000FF))
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
|
@ -48,6 +48,9 @@
|
||||
#ifdef TARGET_OS_FAMILY_bsd
|
||||
# include "jvm_bsd.h"
|
||||
# include <setjmp.h>
|
||||
# ifdef __APPLE__
|
||||
# include <mach/mach_time.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
class AgentLibrary;
|
||||
|
@ -1218,6 +1218,7 @@ typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable;
|
||||
static_field(Abstract_VM_Version, _s_internal_vm_info_string, const char*) \
|
||||
static_field(Abstract_VM_Version, _vm_major_version, int) \
|
||||
static_field(Abstract_VM_Version, _vm_minor_version, int) \
|
||||
static_field(Abstract_VM_Version, _vm_micro_version, int) \
|
||||
static_field(Abstract_VM_Version, _vm_build_number, int) \
|
||||
static_field(Abstract_VM_Version, _reserve_for_allocation_prefetch, int) \
|
||||
\
|
||||
|
@ -55,6 +55,20 @@ int Abstract_VM_Version::_reserve_for_allocation_prefetch = 0;
|
||||
#ifndef HOTSPOT_RELEASE_VERSION
|
||||
#error HOTSPOT_RELEASE_VERSION must be defined
|
||||
#endif
|
||||
|
||||
#ifndef JDK_MAJOR_VERSION
|
||||
#error JDK_MAJOR_VERSION must be defined
|
||||
#endif
|
||||
#ifndef JDK_MINOR_VERSION
|
||||
#error JDK_MINOR_VERSION must be defined
|
||||
#endif
|
||||
#ifndef JDK_MICRO_VERSION
|
||||
#error JDK_MICRO_VERSION must be defined
|
||||
#endif
|
||||
#ifndef JDK_BUILD_NUMBER
|
||||
#error JDK_BUILD_NUMBER must be defined
|
||||
#endif
|
||||
|
||||
#ifndef JRE_RELEASE_VERSION
|
||||
#error JRE_RELEASE_VERSION must be defined
|
||||
#endif
|
||||
@ -68,39 +82,44 @@ int Abstract_VM_Version::_reserve_for_allocation_prefetch = 0;
|
||||
#define VM_RELEASE HOTSPOT_RELEASE_VERSION "-" HOTSPOT_BUILD_TARGET
|
||||
#endif
|
||||
|
||||
// HOTSPOT_RELEASE_VERSION must follow the release version naming convention
|
||||
// <major_ver>.<minor_ver>-b<nn>[-<identifier>][-<debug_target>]
|
||||
// HOTSPOT_RELEASE_VERSION follows the JDK release version naming convention
|
||||
// <major_ver>.<minor_ver>.<micro_ver>[-<identifier>][-<debug_target>][-b<nn>]
|
||||
int Abstract_VM_Version::_vm_major_version = 0;
|
||||
int Abstract_VM_Version::_vm_minor_version = 0;
|
||||
int Abstract_VM_Version::_vm_micro_version = 0;
|
||||
int Abstract_VM_Version::_vm_build_number = 0;
|
||||
bool Abstract_VM_Version::_initialized = false;
|
||||
int Abstract_VM_Version::_parallel_worker_threads = 0;
|
||||
bool Abstract_VM_Version::_parallel_worker_threads_initialized = false;
|
||||
|
||||
#ifdef ASSERT
|
||||
static void assert_digits(const char * s, const char * message) {
|
||||
for (int i = 0; s[i] != '\0'; i++) {
|
||||
assert(isdigit(s[i]), message);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void set_version_field(int * version_field, const char * version_str,
|
||||
const char * const assert_msg) {
|
||||
if (version_str != NULL && *version_str != '\0') {
|
||||
DEBUG_ONLY(assert_digits(version_str, assert_msg));
|
||||
*version_field = atoi(version_str);
|
||||
}
|
||||
}
|
||||
|
||||
void Abstract_VM_Version::initialize() {
|
||||
if (_initialized) {
|
||||
return;
|
||||
}
|
||||
char* vm_version = os::strdup(HOTSPOT_RELEASE_VERSION);
|
||||
|
||||
// Expecting the next vm_version format:
|
||||
// <major_ver>.<minor_ver>-b<nn>[-<identifier>]
|
||||
char* vm_major_ver = vm_version;
|
||||
assert(isdigit(vm_major_ver[0]),"wrong vm major version number");
|
||||
char* vm_minor_ver = strchr(vm_major_ver, '.');
|
||||
assert(vm_minor_ver != NULL && isdigit(vm_minor_ver[1]),"wrong vm minor version number");
|
||||
vm_minor_ver[0] = '\0'; // terminate vm_major_ver
|
||||
vm_minor_ver += 1;
|
||||
char* vm_build_num = strchr(vm_minor_ver, '-');
|
||||
assert(vm_build_num != NULL && vm_build_num[1] == 'b' && isdigit(vm_build_num[2]),"wrong vm build number");
|
||||
vm_build_num[0] = '\0'; // terminate vm_minor_ver
|
||||
vm_build_num += 2;
|
||||
set_version_field(&_vm_major_version, JDK_MAJOR_VERSION, "bad major version");
|
||||
set_version_field(&_vm_minor_version, JDK_MINOR_VERSION, "bad minor version");
|
||||
set_version_field(&_vm_micro_version, JDK_MICRO_VERSION, "bad micro version");
|
||||
int offset = (JDK_BUILD_NUMBER != NULL && JDK_BUILD_NUMBER[0] == 'b') ? 1 : 0;
|
||||
set_version_field(&_vm_build_number, JDK_BUILD_NUMBER + offset,
|
||||
"bad build number");
|
||||
|
||||
_vm_major_version = atoi(vm_major_ver);
|
||||
_vm_minor_version = atoi(vm_minor_ver);
|
||||
_vm_build_number = atoi(vm_build_num);
|
||||
|
||||
os::free(vm_version);
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
@ -276,6 +295,7 @@ const char *Abstract_VM_Version::vm_build_user() {
|
||||
unsigned int Abstract_VM_Version::jvm_version() {
|
||||
return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
|
||||
((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
|
||||
((Abstract_VM_Version::vm_micro_version() & 0xFF) << 8) |
|
||||
(Abstract_VM_Version::vm_build_number() & 0xFF);
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ class Abstract_VM_Version: AllStatic {
|
||||
static unsigned int _logical_processors_per_package;
|
||||
static int _vm_major_version;
|
||||
static int _vm_minor_version;
|
||||
static int _vm_micro_version;
|
||||
static int _vm_build_number;
|
||||
static bool _initialized;
|
||||
static int _parallel_worker_threads;
|
||||
@ -68,6 +69,7 @@ class Abstract_VM_Version: AllStatic {
|
||||
|
||||
static int vm_major_version() { assert(_initialized, "not initialized"); return _vm_major_version; }
|
||||
static int vm_minor_version() { assert(_initialized, "not initialized"); return _vm_minor_version; }
|
||||
static int vm_micro_version() { assert(_initialized, "not initialized"); return _vm_micro_version; }
|
||||
static int vm_build_number() { assert(_initialized, "not initialized"); return _vm_build_number; }
|
||||
|
||||
// Gets the jvm_version_info.jvm_version defined in jvm.h
|
||||
|
@ -785,7 +785,7 @@ void MemTracker::Tracker::record(address old_addr, address new_addr, size_t size
|
||||
MEMFLAGS flags, address pc) {
|
||||
assert(old_addr != NULL && new_addr != NULL, "Sanity check");
|
||||
assert(_op == Realloc || _op == NoOp, "Wrong call");
|
||||
if (MemTracker::is_on() && NMT_CAN_TRACK(flags) && _op != NoOp) {
|
||||
if (MemTracker::is_on() && NMT_CAN_TRACK(flags) && _op != NoOp && !MemTracker::shutdown_in_progress()) {
|
||||
assert(_seq > 0, "Need pre-reserve sequence number");
|
||||
if (_need_thread_critical_lock) {
|
||||
ThreadCritical tc;
|
||||
@ -811,7 +811,7 @@ void MemTracker::Tracker::record(address addr, size_t size, MEMFLAGS flags, addr
|
||||
// OOM already?
|
||||
if (addr == NULL) return;
|
||||
|
||||
if (MemTracker::is_on() && NMT_CAN_TRACK(flags) && _op != NoOp) {
|
||||
if (MemTracker::is_on() && NMT_CAN_TRACK(flags) && _op != NoOp && !MemTracker::shutdown_in_progress()) {
|
||||
bool pre_reserved_seq = (_seq != 0);
|
||||
address pc = CALLER_CALLER_PC;
|
||||
MEMFLAGS orig_flags = flags;
|
||||
|
@ -329,23 +329,19 @@ int UNICODE::utf8_length(jchar* base, int length) {
|
||||
|
||||
char* UNICODE::as_utf8(jchar* base, int length) {
|
||||
int utf8_len = utf8_length(base, length);
|
||||
u_char* result = NEW_RESOURCE_ARRAY(u_char, utf8_len + 1);
|
||||
u_char* p = result;
|
||||
for (int index = 0; index < length; index++) {
|
||||
p = utf8_write(p, base[index]);
|
||||
}
|
||||
*p = '\0';
|
||||
assert(p == &result[utf8_len], "length prediction must be correct");
|
||||
return (char*) result;
|
||||
u_char* buf = NEW_RESOURCE_ARRAY(u_char, utf8_len + 1);
|
||||
char* result = as_utf8(base, length, (char*) buf, utf8_len + 1);
|
||||
assert((int) strlen(result) == utf8_len, "length prediction must be correct");
|
||||
return result;
|
||||
}
|
||||
|
||||
char* UNICODE::as_utf8(jchar* base, int length, char* buf, int buflen) {
|
||||
u_char* p = (u_char*)buf;
|
||||
u_char* end = (u_char*)buf + buflen;
|
||||
for (int index = 0; index < length; index++) {
|
||||
jchar c = base[index];
|
||||
if (p + utf8_size(c) >= end) break; // string is truncated
|
||||
p = utf8_write(p, base[index]);
|
||||
buflen -= utf8_size(c);
|
||||
if (buflen <= 0) break; // string is truncated
|
||||
p = utf8_write(p, c);
|
||||
}
|
||||
*p = '\0';
|
||||
return buf;
|
||||
@ -389,3 +385,29 @@ void UNICODE::as_quoted_ascii(const jchar* base, int length, char* buf, int bufl
|
||||
}
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void TestAsUtf8() {
|
||||
char res[60];
|
||||
jchar str[20];
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
str[i] = 0x0800; // char that is 2B in UTF-16 but 3B in UTF-8
|
||||
}
|
||||
str[19] = (jchar)'\0';
|
||||
|
||||
// The resulting string in UTF-8 is 3*19 bytes long, but should be truncated
|
||||
UNICODE::as_utf8(str, 19, res, 10);
|
||||
assert(strlen(res) == 9, "string should be truncated here");
|
||||
|
||||
UNICODE::as_utf8(str, 19, res, 18);
|
||||
assert(strlen(res) == 15, "string should be truncated here");
|
||||
|
||||
UNICODE::as_utf8(str, 19, res, 20);
|
||||
assert(strlen(res) == 18, "string should be truncated here");
|
||||
|
||||
// Test with an "unbounded" buffer
|
||||
UNICODE::as_utf8(str, 19, res, INT_MAX);
|
||||
assert(strlen(res) == 3*19, "string should end here");
|
||||
}
|
||||
#endif
|
||||
|
@ -254,3 +254,4 @@ f4e624447514f12dd7c51f1e5b0cb97efcd15be2 jdk9-b07
|
||||
2cef452ba711b17950da275fd15931925799f07c jdk9-b09
|
||||
ab06ba2894313a47e4969ca37792ff119c49e711 jdk9-b10
|
||||
47feccd164b7187a0147693a922ee47c6629643c jdk9-b11
|
||||
83d9bc20973de232cae45b139fdff8a4549c130f jdk9-b12
|
||||
|
@ -84,8 +84,6 @@ ifneq ($(OPENJDK_TARGET_OS), solaris)
|
||||
SolarisUserDefinedFileAttributeView.java \
|
||||
SolarisWatchService.java \
|
||||
SolarisAclFileAttributeView.java \
|
||||
SolarisLoginModule.java \
|
||||
SolarisSystem.java \
|
||||
sun/nio/ch/DevPollArrayWrapper.java \
|
||||
sun/nio/ch/DevPollSelectorImpl.java \
|
||||
sun/nio/ch/DevPollSelectorProvider.java \
|
||||
@ -100,15 +98,6 @@ ifneq ($(OPENJDK_TARGET_OS), solaris)
|
||||
EXCLUDES += com/oracle/security
|
||||
endif
|
||||
|
||||
ifneq ($(OPENJDK_TARGET_OS), windows)
|
||||
# Exclude Window security related files in src/share/classes
|
||||
EXFILES += NTLoginModule.java \
|
||||
NTSystem.java
|
||||
else
|
||||
EXFILES += UnixLoginModule.java \
|
||||
UnixSystem.java
|
||||
endif
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
# Don't build GTK L&F on Windows
|
||||
EXCLUDES += com/sun/java/swing/plaf/gtk
|
||||
|
@ -273,7 +273,8 @@ SUNWprivate_1.1 {
|
||||
Java_sun_misc_VM_isSetUID;
|
||||
Java_sun_misc_VM_initialize;
|
||||
Java_sun_misc_VMSupport_initAgentProperties;
|
||||
|
||||
Java_sun_misc_VMSupport_getVMTemporaryDirectory;
|
||||
|
||||
# ZipFile.c needs this one
|
||||
throwFileNotFoundException;
|
||||
|
||||
|
@ -86,6 +86,10 @@ public class JCEMapper {
|
||||
XMLSignature.ALGO_ID_SIGNATURE_DSA,
|
||||
new Algorithm("", "SHA1withDSA", "Signature")
|
||||
);
|
||||
algorithmsMap.put(
|
||||
XMLSignature.ALGO_ID_SIGNATURE_DSA_SHA256,
|
||||
new Algorithm("", "SHA256withDSA", "Signature")
|
||||
);
|
||||
algorithmsMap.put(
|
||||
XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5,
|
||||
new Algorithm("", "MD5withRSA", "Signature")
|
||||
|
@ -380,7 +380,12 @@ public class SignatureAlgorithm extends Algorithm {
|
||||
* This method registers the default algorithms.
|
||||
*/
|
||||
public static void registerDefaultAlgorithms() {
|
||||
algorithmHash.put(SignatureDSA.URI, SignatureDSA.class);
|
||||
algorithmHash.put(
|
||||
XMLSignature.ALGO_ID_SIGNATURE_DSA, SignatureDSA.class
|
||||
);
|
||||
algorithmHash.put(
|
||||
XMLSignature.ALGO_ID_SIGNATURE_DSA_SHA256, SignatureDSA.SHA256.class
|
||||
);
|
||||
algorithmHash.put(
|
||||
XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1, SignatureBaseRSA.SignatureRSASHA1.class
|
||||
);
|
||||
|
@ -31,13 +31,15 @@ import java.security.PublicKey;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.Signature;
|
||||
import java.security.SignatureException;
|
||||
import java.security.interfaces.DSAKey;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
|
||||
import com.sun.org.apache.xml.internal.security.algorithms.JCEMapper;
|
||||
import com.sun.org.apache.xml.internal.security.algorithms.SignatureAlgorithmSpi;
|
||||
import com.sun.org.apache.xml.internal.security.signature.XMLSignature;
|
||||
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException;
|
||||
import com.sun.org.apache.xml.internal.security.utils.Base64;
|
||||
import com.sun.org.apache.xml.internal.security.utils.Constants;
|
||||
import com.sun.org.apache.xml.internal.security.utils.JavaUtils;
|
||||
|
||||
public class SignatureDSA extends SignatureAlgorithmSpi {
|
||||
|
||||
@ -45,19 +47,19 @@ public class SignatureDSA extends SignatureAlgorithmSpi {
|
||||
private static java.util.logging.Logger log =
|
||||
java.util.logging.Logger.getLogger(SignatureDSA.class.getName());
|
||||
|
||||
/** Field URI */
|
||||
public static final String URI = Constants.SignatureSpecNS + "dsa-sha1";
|
||||
|
||||
/** Field algorithm */
|
||||
private java.security.Signature signatureAlgorithm = null;
|
||||
|
||||
/** size of Q */
|
||||
private int size;
|
||||
|
||||
/**
|
||||
* Method engineGetURI
|
||||
*
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected String engineGetURI() {
|
||||
return SignatureDSA.URI;
|
||||
return XMLSignature.ALGO_ID_SIGNATURE_DSA;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -66,7 +68,7 @@ public class SignatureDSA extends SignatureAlgorithmSpi {
|
||||
* @throws XMLSignatureException
|
||||
*/
|
||||
public SignatureDSA() throws XMLSignatureException {
|
||||
String algorithmID = JCEMapper.translateURItoJCEID(SignatureDSA.URI);
|
||||
String algorithmID = JCEMapper.translateURItoJCEID(engineGetURI());
|
||||
if (log.isLoggable(java.util.logging.Level.FINE)) {
|
||||
log.log(java.util.logging.Level.FINE, "Created SignatureDSA using " + algorithmID);
|
||||
}
|
||||
@ -110,7 +112,8 @@ public class SignatureDSA extends SignatureAlgorithmSpi {
|
||||
log.log(java.util.logging.Level.FINE, "Called DSA.verify() on " + Base64.encode(signature));
|
||||
}
|
||||
|
||||
byte[] jcebytes = SignatureDSA.convertXMLDSIGtoASN1(signature);
|
||||
byte[] jcebytes = JavaUtils.convertDsaXMLDSIGtoASN1(signature,
|
||||
size/8);
|
||||
|
||||
return this.signatureAlgorithm.verify(jcebytes);
|
||||
} catch (SignatureException ex) {
|
||||
@ -150,6 +153,7 @@ public class SignatureDSA extends SignatureAlgorithmSpi {
|
||||
}
|
||||
throw new XMLSignatureException("empty", ex);
|
||||
}
|
||||
size = ((DSAKey)publicKey).getParams().getQ().bitLength();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,7 +163,7 @@ public class SignatureDSA extends SignatureAlgorithmSpi {
|
||||
try {
|
||||
byte jcebytes[] = this.signatureAlgorithm.sign();
|
||||
|
||||
return SignatureDSA.convertASN1toXMLDSIG(jcebytes);
|
||||
return JavaUtils.convertDsaASN1toXMLDSIG(jcebytes, size/8);
|
||||
} catch (IOException ex) {
|
||||
throw new XMLSignatureException("empty", ex);
|
||||
} catch (SignatureException ex) {
|
||||
@ -185,6 +189,7 @@ public class SignatureDSA extends SignatureAlgorithmSpi {
|
||||
} catch (InvalidKeyException ex) {
|
||||
throw new XMLSignatureException("empty", ex);
|
||||
}
|
||||
size = ((DSAKey)privateKey).getParams().getQ().bitLength();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -204,6 +209,7 @@ public class SignatureDSA extends SignatureAlgorithmSpi {
|
||||
} catch (InvalidKeyException ex) {
|
||||
throw new XMLSignatureException("empty", ex);
|
||||
}
|
||||
size = ((DSAKey)privateKey).getParams().getQ().bitLength();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -257,100 +263,6 @@ public class SignatureDSA extends SignatureAlgorithmSpi {
|
||||
return this.signatureAlgorithm.getProvider().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an ASN.1 DSA value to a XML Signature DSA Value.
|
||||
*
|
||||
* The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
|
||||
* pairs; the XML Signature requires the core BigInteger values.
|
||||
*
|
||||
* @param asn1Bytes
|
||||
* @return the decode bytes
|
||||
*
|
||||
* @throws IOException
|
||||
* @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
|
||||
*/
|
||||
private static byte[] convertASN1toXMLDSIG(byte asn1Bytes[]) throws IOException {
|
||||
|
||||
byte rLength = asn1Bytes[3];
|
||||
int i;
|
||||
|
||||
for (i = rLength; (i > 0) && (asn1Bytes[(4 + rLength) - i] == 0); i--);
|
||||
|
||||
byte sLength = asn1Bytes[5 + rLength];
|
||||
int j;
|
||||
|
||||
for (j = sLength;
|
||||
(j > 0) && (asn1Bytes[(6 + rLength + sLength) - j] == 0); j--);
|
||||
|
||||
if ((asn1Bytes[0] != 48) || (asn1Bytes[1] != asn1Bytes.length - 2)
|
||||
|| (asn1Bytes[2] != 2) || (i > 20)
|
||||
|| (asn1Bytes[4 + rLength] != 2) || (j > 20)) {
|
||||
throw new IOException("Invalid ASN.1 format of DSA signature");
|
||||
}
|
||||
byte xmldsigBytes[] = new byte[40];
|
||||
|
||||
System.arraycopy(asn1Bytes, (4 + rLength) - i, xmldsigBytes, 20 - i, i);
|
||||
System.arraycopy(asn1Bytes, (6 + rLength + sLength) - j, xmldsigBytes,
|
||||
40 - j, j);
|
||||
|
||||
return xmldsigBytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a XML Signature DSA Value to an ASN.1 DSA value.
|
||||
*
|
||||
* The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
|
||||
* pairs; the XML Signature requires the core BigInteger values.
|
||||
*
|
||||
* @param xmldsigBytes
|
||||
* @return the encoded ASN.1 bytes
|
||||
*
|
||||
* @throws IOException
|
||||
* @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
|
||||
*/
|
||||
private static byte[] convertXMLDSIGtoASN1(byte xmldsigBytes[]) throws IOException {
|
||||
|
||||
if (xmldsigBytes.length != 40) {
|
||||
throw new IOException("Invalid XMLDSIG format of DSA signature");
|
||||
}
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 20; (i > 0) && (xmldsigBytes[20 - i] == 0); i--);
|
||||
|
||||
int j = i;
|
||||
|
||||
if (xmldsigBytes[20 - i] < 0) {
|
||||
j += 1;
|
||||
}
|
||||
|
||||
int k;
|
||||
|
||||
for (k = 20; (k > 0) && (xmldsigBytes[40 - k] == 0); k--);
|
||||
|
||||
int l = k;
|
||||
|
||||
if (xmldsigBytes[40 - k] < 0) {
|
||||
l += 1;
|
||||
}
|
||||
|
||||
byte asn1Bytes[] = new byte[6 + j + l];
|
||||
|
||||
asn1Bytes[0] = 48;
|
||||
asn1Bytes[1] = (byte) (4 + j + l);
|
||||
asn1Bytes[2] = 2;
|
||||
asn1Bytes[3] = (byte) j;
|
||||
|
||||
System.arraycopy(xmldsigBytes, 20 - i, asn1Bytes, (4 + j) - i, i);
|
||||
|
||||
asn1Bytes[4 + j] = 2;
|
||||
asn1Bytes[5 + j] = (byte) l;
|
||||
|
||||
System.arraycopy(xmldsigBytes, 40 - k, asn1Bytes, (6 + j + l) - k, k);
|
||||
|
||||
return asn1Bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method engineSetHMACOutputLength
|
||||
*
|
||||
@ -373,4 +285,15 @@ public class SignatureDSA extends SignatureAlgorithmSpi {
|
||||
) throws XMLSignatureException {
|
||||
throw new XMLSignatureException("algorithms.CannotUseAlgorithmParameterSpecOnDSA");
|
||||
}
|
||||
|
||||
public static class SHA256 extends SignatureDSA {
|
||||
|
||||
public SHA256() throws XMLSignatureException {
|
||||
super();
|
||||
}
|
||||
|
||||
public String engineGetURI() {
|
||||
return XMLSignature.ALGO_ID_SIGNATURE_DSA_SHA256;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,6 +85,10 @@ public final class XMLSignature extends SignatureElementProxy {
|
||||
public static final String ALGO_ID_SIGNATURE_DSA =
|
||||
Constants.SignatureSpecNS + "dsa-sha1";
|
||||
|
||||
/** Signature - Optional DSAwithSHA256 */
|
||||
public static final String ALGO_ID_SIGNATURE_DSA_SHA256 =
|
||||
Constants.SignatureSpec11NS + "dsa-sha256";
|
||||
|
||||
/** Signature - Recommended RSAwithSHA1 */
|
||||
public static final String ALGO_ID_SIGNATURE_RSA =
|
||||
Constants.SignatureSpecNS + "rsa-sha1";
|
||||
|
@ -145,4 +145,98 @@ public class JavaUtils {
|
||||
|
||||
return retBytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an ASN.1 DSA value to a XML Signature DSA Value.
|
||||
*
|
||||
* The JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
|
||||
* pairs (see section 2.2.2 of RFC 3279); the XML Signature requires the
|
||||
* core BigInteger values.
|
||||
*
|
||||
* @param asn1Bytes the ASN.1 encoded bytes
|
||||
* @param size size of r and s in bytes
|
||||
* @return the XML Signature encoded bytes
|
||||
* @throws IOException if the bytes are not encoded correctly
|
||||
* @see <A HREF="http://www.w3.org/TR/xmldsig-core1/#sec-DSA">6.4.1 DSA</A>
|
||||
*/
|
||||
public static byte[] convertDsaASN1toXMLDSIG(byte[] asn1Bytes, int size)
|
||||
throws IOException
|
||||
{
|
||||
if (asn1Bytes[0] != 48 || asn1Bytes[1] != asn1Bytes.length - 2
|
||||
|| asn1Bytes[2] != 2) {
|
||||
throw new IOException("Invalid ASN.1 format of DSA signature");
|
||||
}
|
||||
|
||||
byte rLength = asn1Bytes[3];
|
||||
int i;
|
||||
for (i = rLength; i > 0 && asn1Bytes[4 + rLength - i] == 0; i--);
|
||||
|
||||
byte sLength = asn1Bytes[5 + rLength];
|
||||
int j;
|
||||
for (j = sLength;
|
||||
j > 0 && asn1Bytes[6 + rLength + sLength - j] == 0; j--);
|
||||
|
||||
if (i > size || asn1Bytes[4 + rLength] != 2 || j > size) {
|
||||
throw new IOException("Invalid ASN.1 format of DSA signature");
|
||||
} else {
|
||||
byte[] xmldsigBytes = new byte[size * 2];
|
||||
System.arraycopy(asn1Bytes, 4 + rLength - i, xmldsigBytes,
|
||||
size - i, i);
|
||||
System.arraycopy(asn1Bytes, 6 + rLength + sLength - j,
|
||||
xmldsigBytes, size * 2 - j, j);
|
||||
return xmldsigBytes;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an XML Signature DSA Value to a ASN.1 DSA value.
|
||||
*
|
||||
* The JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
|
||||
* pairs (see section 2.2.2 of RFC 3279); the XML Signature requires the
|
||||
* core BigInteger values.
|
||||
*
|
||||
* @param xmldsigBytes the XML Signature encoded bytes
|
||||
* @param size size of r and s in bytes
|
||||
* @return the ASN.1 encoded bytes
|
||||
* @throws IOException if the bytes are not encoded correctly
|
||||
* @see <A HREF="http://www.w3.org/TR/xmldsig-core1/#sec-DSA">6.4.1 DSA</A>
|
||||
*/
|
||||
public static byte[] convertDsaXMLDSIGtoASN1(byte[] xmldsigBytes, int size)
|
||||
throws IOException
|
||||
{
|
||||
int totalSize = size * 2;
|
||||
if (xmldsigBytes.length != totalSize) {
|
||||
throw new IOException("Invalid XMLDSIG format of DSA signature");
|
||||
}
|
||||
|
||||
int i;
|
||||
for (i = size; i > 0 && xmldsigBytes[size - i] == 0; i--);
|
||||
|
||||
int j = i;
|
||||
if (xmldsigBytes[size - i] < 0) {
|
||||
j++;
|
||||
}
|
||||
|
||||
int k;
|
||||
for (k = size; k > 0 && xmldsigBytes[totalSize - k] == 0; k--);
|
||||
|
||||
int l = k;
|
||||
if (xmldsigBytes[totalSize - k] < 0) {
|
||||
l++;
|
||||
}
|
||||
|
||||
byte[] asn1Bytes = new byte[6 + j + l];
|
||||
asn1Bytes[0] = 48;
|
||||
asn1Bytes[1] = (byte)(4 + j + l);
|
||||
asn1Bytes[2] = 2;
|
||||
asn1Bytes[3] = (byte)j;
|
||||
System.arraycopy(xmldsigBytes, size - i, asn1Bytes, 4 + j - i, i);
|
||||
|
||||
asn1Bytes[4 + j] = 2;
|
||||
asn1Bytes[5 + j] = (byte) l;
|
||||
System.arraycopy(xmldsigBytes, totalSize - k, asn1Bytes,
|
||||
6 + j + l - k, k);
|
||||
|
||||
return asn1Bytes;
|
||||
}
|
||||
}
|
||||
|
@ -139,15 +139,17 @@ public class NTLoginModule implements LoginModule {
|
||||
|
||||
succeeded = false; // Indicate not yet successful
|
||||
|
||||
ntSystem = new NTSystem(debugNative);
|
||||
if (ntSystem == null) {
|
||||
try {
|
||||
ntSystem = new NTSystem(debugNative);
|
||||
} catch (UnsatisfiedLinkError ule) {
|
||||
if (debug) {
|
||||
System.out.println("\t\t[NTLoginModule] " +
|
||||
"Failed in NT login");
|
||||
}
|
||||
throw new FailedLoginException
|
||||
("Failed in attempt to import the " +
|
||||
"underlying NT system identity information");
|
||||
"underlying NT system identity information" +
|
||||
" on " + System.getProperty("os.name"));
|
||||
}
|
||||
|
||||
if (ntSystem.getName() == null) {
|
||||
|
@ -129,39 +129,39 @@ public class SolarisLoginModule implements LoginModule {
|
||||
|
||||
long[] solarisGroups = null;
|
||||
|
||||
ss = new SolarisSystem();
|
||||
|
||||
if (ss == null) {
|
||||
try {
|
||||
ss = new SolarisSystem();
|
||||
} catch (UnsatisfiedLinkError ule) {
|
||||
succeeded = false;
|
||||
throw new FailedLoginException
|
||||
("Failed in attempt to import " +
|
||||
"the underlying system identity information");
|
||||
} else {
|
||||
userPrincipal = new SolarisPrincipal(ss.getUsername());
|
||||
UIDPrincipal = new SolarisNumericUserPrincipal(ss.getUid());
|
||||
GIDPrincipal = new SolarisNumericGroupPrincipal(ss.getGid(), true);
|
||||
if (ss.getGroups() != null && ss.getGroups().length > 0)
|
||||
solarisGroups = ss.getGroups();
|
||||
for (int i = 0; i < solarisGroups.length; i++) {
|
||||
SolarisNumericGroupPrincipal ngp =
|
||||
new SolarisNumericGroupPrincipal
|
||||
(solarisGroups[i], false);
|
||||
if (!ngp.getName().equals(GIDPrincipal.getName()))
|
||||
supplementaryGroups.add(ngp);
|
||||
}
|
||||
if (debug) {
|
||||
System.out.println("\t\t[SolarisLoginModule]: " +
|
||||
"succeeded importing info: ");
|
||||
System.out.println("\t\t\tuid = " + ss.getUid());
|
||||
System.out.println("\t\t\tgid = " + ss.getGid());
|
||||
solarisGroups = ss.getGroups();
|
||||
for (int i = 0; i < solarisGroups.length; i++) {
|
||||
System.out.println("\t\t\tsupp gid = " + solarisGroups[i]);
|
||||
}
|
||||
}
|
||||
succeeded = true;
|
||||
return true;
|
||||
"the underlying system identity information" +
|
||||
" on " + System.getProperty("os.name"));
|
||||
}
|
||||
userPrincipal = new SolarisPrincipal(ss.getUsername());
|
||||
UIDPrincipal = new SolarisNumericUserPrincipal(ss.getUid());
|
||||
GIDPrincipal = new SolarisNumericGroupPrincipal(ss.getGid(), true);
|
||||
if (ss.getGroups() != null && ss.getGroups().length > 0)
|
||||
solarisGroups = ss.getGroups();
|
||||
for (int i = 0; i < solarisGroups.length; i++) {
|
||||
SolarisNumericGroupPrincipal ngp =
|
||||
new SolarisNumericGroupPrincipal
|
||||
(solarisGroups[i], false);
|
||||
if (!ngp.getName().equals(GIDPrincipal.getName()))
|
||||
supplementaryGroups.add(ngp);
|
||||
}
|
||||
if (debug) {
|
||||
System.out.println("\t\t[SolarisLoginModule]: " +
|
||||
"succeeded importing info: ");
|
||||
System.out.println("\t\t\tuid = " + ss.getUid());
|
||||
System.out.println("\t\t\tgid = " + ss.getGid());
|
||||
solarisGroups = ss.getGroups();
|
||||
for (int i = 0; i < solarisGroups.length; i++) {
|
||||
System.out.println("\t\t\tsupp gid = " + solarisGroups[i]);
|
||||
}
|
||||
}
|
||||
succeeded = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,8 +29,10 @@ package com.sun.security.auth.module;
|
||||
* <p> This class implementation retrieves and makes available Solaris
|
||||
* UID/GID/groups information for the current user.
|
||||
*
|
||||
* @deprecated replaced by {@link UnixSystem}.
|
||||
*/
|
||||
@jdk.Exported
|
||||
@jdk.Exported(false)
|
||||
@Deprecated
|
||||
public class SolarisSystem {
|
||||
|
||||
private native void getSolarisInfo();
|
||||
|
@ -122,40 +122,40 @@ public class UnixLoginModule implements LoginModule {
|
||||
|
||||
long[] unixGroups = null;
|
||||
|
||||
ss = new UnixSystem();
|
||||
|
||||
if (ss == null) {
|
||||
try {
|
||||
ss = new UnixSystem();
|
||||
} catch (UnsatisfiedLinkError ule) {
|
||||
succeeded = false;
|
||||
throw new FailedLoginException
|
||||
("Failed in attempt to import " +
|
||||
"the underlying system identity information");
|
||||
} else {
|
||||
userPrincipal = new UnixPrincipal(ss.getUsername());
|
||||
UIDPrincipal = new UnixNumericUserPrincipal(ss.getUid());
|
||||
GIDPrincipal = new UnixNumericGroupPrincipal(ss.getGid(), true);
|
||||
if (ss.getGroups() != null && ss.getGroups().length > 0) {
|
||||
unixGroups = ss.getGroups();
|
||||
for (int i = 0; i < unixGroups.length; i++) {
|
||||
UnixNumericGroupPrincipal ngp =
|
||||
new UnixNumericGroupPrincipal
|
||||
(unixGroups[i], false);
|
||||
if (!ngp.getName().equals(GIDPrincipal.getName()))
|
||||
supplementaryGroups.add(ngp);
|
||||
}
|
||||
}
|
||||
if (debug) {
|
||||
System.out.println("\t\t[UnixLoginModule]: " +
|
||||
"succeeded importing info: ");
|
||||
System.out.println("\t\t\tuid = " + ss.getUid());
|
||||
System.out.println("\t\t\tgid = " + ss.getGid());
|
||||
unixGroups = ss.getGroups();
|
||||
for (int i = 0; i < unixGroups.length; i++) {
|
||||
System.out.println("\t\t\tsupp gid = " + unixGroups[i]);
|
||||
}
|
||||
}
|
||||
succeeded = true;
|
||||
return true;
|
||||
"the underlying system identity information" +
|
||||
" on " + System.getProperty("os.name"));
|
||||
}
|
||||
userPrincipal = new UnixPrincipal(ss.getUsername());
|
||||
UIDPrincipal = new UnixNumericUserPrincipal(ss.getUid());
|
||||
GIDPrincipal = new UnixNumericGroupPrincipal(ss.getGid(), true);
|
||||
if (ss.getGroups() != null && ss.getGroups().length > 0) {
|
||||
unixGroups = ss.getGroups();
|
||||
for (int i = 0; i < unixGroups.length; i++) {
|
||||
UnixNumericGroupPrincipal ngp =
|
||||
new UnixNumericGroupPrincipal
|
||||
(unixGroups[i], false);
|
||||
if (!ngp.getName().equals(GIDPrincipal.getName()))
|
||||
supplementaryGroups.add(ngp);
|
||||
}
|
||||
}
|
||||
if (debug) {
|
||||
System.out.println("\t\t[UnixLoginModule]: " +
|
||||
"succeeded importing info: ");
|
||||
System.out.println("\t\t\tuid = " + ss.getUid());
|
||||
System.out.println("\t\t\tgid = " + ss.getGid());
|
||||
unixGroups = ss.getGroups();
|
||||
for (int i = 0; i < unixGroups.length; i++) {
|
||||
System.out.println("\t\t\tsupp gid = " + unixGroups[i]);
|
||||
}
|
||||
}
|
||||
succeeded = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1904,51 +1904,36 @@ public final class Math {
|
||||
* are naturally handled without any additional testing
|
||||
*/
|
||||
|
||||
// First check for NaN values
|
||||
if (Double.isNaN(start) || Double.isNaN(direction)) {
|
||||
// return a NaN derived from the input NaN(s)
|
||||
return start + direction;
|
||||
} else if (start == direction) {
|
||||
return direction;
|
||||
} else { // start > direction or start < direction
|
||||
/*
|
||||
* IEEE 754 floating-point numbers are lexicographically
|
||||
* ordered if treated as signed-magnitude integers.
|
||||
* Since Java's integers are two's complement,
|
||||
* incrementing the two's complement representation of a
|
||||
* logically negative floating-point value *decrements*
|
||||
* the signed-magnitude representation. Therefore, when
|
||||
* the integer representation of a floating-point value
|
||||
* is negative, the adjustment to the representation is in
|
||||
* the opposite direction from what would initially be expected.
|
||||
*/
|
||||
|
||||
// Branch to descending case first as it is more costly than ascending
|
||||
// case due to start != 0.0d conditional.
|
||||
if (start > direction) { // descending
|
||||
if (start != 0.0d) {
|
||||
final long transducer = Double.doubleToRawLongBits(start);
|
||||
return Double.longBitsToDouble(transducer + ((transducer > 0L) ? -1L : 1L));
|
||||
} else { // start == 0.0d && direction < 0.0d
|
||||
return -Double.MIN_VALUE;
|
||||
}
|
||||
} else if (start < direction) { // ascending
|
||||
// Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0)
|
||||
// then bitwise convert start to integer.
|
||||
long transducer = Double.doubleToRawLongBits(start + 0.0d);
|
||||
|
||||
/*
|
||||
* IEEE 754 floating-point numbers are lexicographically
|
||||
* ordered if treated as signed- magnitude integers .
|
||||
* Since Java's integers are two's complement,
|
||||
* incrementing" the two's complement representation of a
|
||||
* logically negative floating-point value *decrements*
|
||||
* the signed-magnitude representation. Therefore, when
|
||||
* the integer representation of a floating-point values
|
||||
* is less than zero, the adjustment to the representation
|
||||
* is in the opposite direction than would be expected at
|
||||
* first .
|
||||
*/
|
||||
if (direction > start) { // Calculate next greater value
|
||||
transducer = transducer + (transducer >= 0L ? 1L:-1L);
|
||||
} else { // Calculate next lesser value
|
||||
assert direction < start;
|
||||
if (transducer > 0L)
|
||||
--transducer;
|
||||
else
|
||||
if (transducer < 0L )
|
||||
++transducer;
|
||||
/*
|
||||
* transducer==0, the result is -MIN_VALUE
|
||||
*
|
||||
* The transition from zero (implicitly
|
||||
* positive) to the smallest negative
|
||||
* signed magnitude value must be done
|
||||
* explicitly.
|
||||
*/
|
||||
else
|
||||
transducer = DoubleConsts.SIGN_BIT_MASK | 1L;
|
||||
}
|
||||
|
||||
return Double.longBitsToDouble(transducer);
|
||||
final long transducer = Double.doubleToRawLongBits(start + 0.0d);
|
||||
return Double.longBitsToDouble(transducer + ((transducer >= 0L) ? 1L : -1L));
|
||||
} else if (start == direction) {
|
||||
return direction;
|
||||
} else { // isNaN(start) || isNaN(direction)
|
||||
return start + direction;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2003,51 +1988,36 @@ public final class Math {
|
||||
* are naturally handled without any additional testing
|
||||
*/
|
||||
|
||||
// First check for NaN values
|
||||
if (Float.isNaN(start) || Double.isNaN(direction)) {
|
||||
// return a NaN derived from the input NaN(s)
|
||||
return start + (float)direction;
|
||||
} else if (start == direction) {
|
||||
return (float)direction;
|
||||
} else { // start > direction or start < direction
|
||||
/*
|
||||
* IEEE 754 floating-point numbers are lexicographically
|
||||
* ordered if treated as signed-magnitude integers.
|
||||
* Since Java's integers are two's complement,
|
||||
* incrementing the two's complement representation of a
|
||||
* logically negative floating-point value *decrements*
|
||||
* the signed-magnitude representation. Therefore, when
|
||||
* the integer representation of a floating-point value
|
||||
* is negative, the adjustment to the representation is in
|
||||
* the opposite direction from what would initially be expected.
|
||||
*/
|
||||
|
||||
// Branch to descending case first as it is more costly than ascending
|
||||
// case due to start != 0.0f conditional.
|
||||
if (start > direction) { // descending
|
||||
if (start != 0.0f) {
|
||||
final int transducer = Float.floatToRawIntBits(start);
|
||||
return Float.intBitsToFloat(transducer + ((transducer > 0) ? -1 : 1));
|
||||
} else { // start == 0.0f && direction < 0.0f
|
||||
return -Float.MIN_VALUE;
|
||||
}
|
||||
} else if (start < direction) { // ascending
|
||||
// Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0)
|
||||
// then bitwise convert start to integer.
|
||||
int transducer = Float.floatToRawIntBits(start + 0.0f);
|
||||
|
||||
/*
|
||||
* IEEE 754 floating-point numbers are lexicographically
|
||||
* ordered if treated as signed- magnitude integers .
|
||||
* Since Java's integers are two's complement,
|
||||
* incrementing" the two's complement representation of a
|
||||
* logically negative floating-point value *decrements*
|
||||
* the signed-magnitude representation. Therefore, when
|
||||
* the integer representation of a floating-point values
|
||||
* is less than zero, the adjustment to the representation
|
||||
* is in the opposite direction than would be expected at
|
||||
* first.
|
||||
*/
|
||||
if (direction > start) {// Calculate next greater value
|
||||
transducer = transducer + (transducer >= 0 ? 1:-1);
|
||||
} else { // Calculate next lesser value
|
||||
assert direction < start;
|
||||
if (transducer > 0)
|
||||
--transducer;
|
||||
else
|
||||
if (transducer < 0 )
|
||||
++transducer;
|
||||
/*
|
||||
* transducer==0, the result is -MIN_VALUE
|
||||
*
|
||||
* The transition from zero (implicitly
|
||||
* positive) to the smallest negative
|
||||
* signed magnitude value must be done
|
||||
* explicitly.
|
||||
*/
|
||||
else
|
||||
transducer = FloatConsts.SIGN_BIT_MASK | 1;
|
||||
}
|
||||
|
||||
return Float.intBitsToFloat(transducer);
|
||||
final int transducer = Float.floatToRawIntBits(start + 0.0f);
|
||||
return Float.intBitsToFloat(transducer + ((transducer >= 0) ? 1 : -1));
|
||||
} else if (start == direction) {
|
||||
return (float)direction;
|
||||
} else { // isNaN(start) || isNaN(direction)
|
||||
return start + (float)direction;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2077,12 +2047,13 @@ public final class Math {
|
||||
* @since 1.6
|
||||
*/
|
||||
public static double nextUp(double d) {
|
||||
if( Double.isNaN(d) || d == Double.POSITIVE_INFINITY)
|
||||
// Use a single conditional and handle the likely cases first.
|
||||
if (d < Double.POSITIVE_INFINITY) {
|
||||
// Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0).
|
||||
final long transducer = Double.doubleToRawLongBits(d + 0.0D);
|
||||
return Double.longBitsToDouble(transducer + ((transducer >= 0L) ? 1L : -1L));
|
||||
} else { // d is NaN or +Infinity
|
||||
return d;
|
||||
else {
|
||||
d += 0.0d;
|
||||
return Double.longBitsToDouble(Double.doubleToRawLongBits(d) +
|
||||
((d >= 0.0d)?+1L:-1L));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2112,12 +2083,13 @@ public final class Math {
|
||||
* @since 1.6
|
||||
*/
|
||||
public static float nextUp(float f) {
|
||||
if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
|
||||
// Use a single conditional and handle the likely cases first.
|
||||
if (f < Float.POSITIVE_INFINITY) {
|
||||
// Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0).
|
||||
final int transducer = Float.floatToRawIntBits(f + 0.0F);
|
||||
return Float.intBitsToFloat(transducer + ((transducer >= 0) ? 1 : -1));
|
||||
} else { // f is NaN or +Infinity
|
||||
return f;
|
||||
else {
|
||||
f += 0.0f;
|
||||
return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
|
||||
((f >= 0.0f)?+1:-1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,15 +46,28 @@ import java.io.IOException;
|
||||
* <p>
|
||||
* If no content handler could be found, URLConnection will
|
||||
* look for a content handler in a user-defineable set of places.
|
||||
* By default it looks in sun.net.www.content, but users can define a
|
||||
* vertical-bar delimited set of class prefixes to search through in
|
||||
* addition by defining the java.content.handler.pkgs property.
|
||||
* The class name must be of the form:
|
||||
* <pre>
|
||||
* {package-prefix}.{major}.{minor}
|
||||
* e.g.
|
||||
* Users can define a vertical-bar delimited set of class prefixes
|
||||
* to search through by defining the <i>java.content.handler.pkgs</i>
|
||||
* property. The class name must be of the form:
|
||||
* <blockquote>
|
||||
* <i>{package-prefix}.{major}.{minor}</i>
|
||||
* <P>
|
||||
* where <i>{major}.{minor}</i> is formed by taking the
|
||||
* content-type string, replacing all slash characters with a
|
||||
* {@code period} ('.'), and all other non-alphanumeric characters
|
||||
* with the underscore character '{@code _}'. The alphanumeric
|
||||
* characters are specifically the 26 uppercase ASCII letters
|
||||
* '{@code A}' through '{@code Z}', the 26 lowercase ASCII
|
||||
* letters '{@code a}' through '{@code z}', and the 10 ASCII
|
||||
* digits '{@code 0}' through '{@code 9}'.
|
||||
* <p>
|
||||
* e.g.
|
||||
* YoyoDyne.experimental.text.plain
|
||||
* </pre>
|
||||
* </blockquote>
|
||||
* If no user-defined content handler is found, then the system
|
||||
* tries to load a specific <i>content-type</i> handler from one
|
||||
* of the built-in handlers, if one exists.
|
||||
* <p>
|
||||
* If the loading of the content handler class would be performed by
|
||||
* a classloader that is outside of the delegation chain of the caller,
|
||||
* the JVM will need the RuntimePermission "getClassLoader".
|
||||
|
@ -266,10 +266,7 @@ public final class URL implements java.io.Serializable {
|
||||
* a subclass of {@code URLStreamHandler}, then the next package
|
||||
* in the list is tried.
|
||||
* <li>If the previous step fails to find a protocol handler, then the
|
||||
* constructor tries to load from a system default package.
|
||||
* <blockquote><pre>
|
||||
* <<i>system default package</i>>.<<i>protocol</i>>.Handler
|
||||
* </pre></blockquote>
|
||||
* constructor tries to load a built-in protocol handler.
|
||||
* If this class does not exist, or if the class exists but it is not a
|
||||
* subclass of {@code URLStreamHandler}, then a
|
||||
* {@code MalformedURLException} is thrown.
|
||||
|
@ -704,21 +704,10 @@ public abstract class URLConnection {
|
||||
* handler for that content type.
|
||||
* <li>If no content handler factory has yet been set up, or if the
|
||||
* factory's {@code createContentHandler} method returns
|
||||
* {@code null}, then the application loads the class named:
|
||||
* <blockquote><pre>
|
||||
* sun.net.www.content.<<i>contentType</i>>
|
||||
* </pre></blockquote>
|
||||
* where <<i>contentType</i>> is formed by taking the
|
||||
* content-type string, replacing all slash characters with a
|
||||
* {@code period} ('.'), and all other non-alphanumeric characters
|
||||
* with the underscore character '{@code _}'. The alphanumeric
|
||||
* characters are specifically the 26 uppercase ASCII letters
|
||||
* '{@code A}' through '{@code Z}', the 26 lowercase ASCII
|
||||
* letters '{@code a}' through '{@code z}', and the 10 ASCII
|
||||
* digits '{@code 0}' through '{@code 9}'. If the specified
|
||||
* class does not exist, or is not a subclass of
|
||||
* {@code ContentHandler}, then an
|
||||
* {@code UnknownServiceException} is thrown.
|
||||
* {@code null}, then this method tries to load a content handler
|
||||
* class as defined by {@link java.net.ContentHandler ContentHandler}.
|
||||
* If the class does not exist, or is not a subclass of {@code
|
||||
* ContentHandler}, then an {@code UnknownServiceException} is thrown.
|
||||
* </ol>
|
||||
*
|
||||
* @return the object fetched. The {@code instanceof} operator
|
||||
|
@ -201,7 +201,7 @@ public enum DayOfWeek implements TemporalAccessor, TemporalAdjuster {
|
||||
* Gets the day-of-week {@code int} value.
|
||||
* <p>
|
||||
* The values are numbered following the ISO-8601 standard, from 1 (Monday) to 7 (Sunday).
|
||||
* See {@link WeekFields#dayOfWeek} for localized week-numbering.
|
||||
* See {@link java.time.temporal.WeekFields#dayOfWeek()} for localized week-numbering.
|
||||
*
|
||||
* @return the day-of-week, from 1 (Monday) to 7 (Sunday)
|
||||
*/
|
||||
@ -288,7 +288,7 @@ public enum DayOfWeek implements TemporalAccessor, TemporalAdjuster {
|
||||
/**
|
||||
* Gets the value of the specified field from this day-of-week as an {@code int}.
|
||||
* <p>
|
||||
* This queries this day-of-week for the value for the specified field.
|
||||
* This queries this day-of-week for the value of the specified field.
|
||||
* The returned value will always be within the valid range of values for the field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
@ -321,7 +321,7 @@ public enum DayOfWeek implements TemporalAccessor, TemporalAdjuster {
|
||||
/**
|
||||
* Gets the value of the specified field from this day-of-week as a {@code long}.
|
||||
* <p>
|
||||
* This queries this day-of-week for the value for the specified field.
|
||||
* This queries this day-of-week for the value of the specified field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
* <p>
|
||||
@ -419,7 +419,7 @@ public enum DayOfWeek implements TemporalAccessor, TemporalAdjuster {
|
||||
* The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)}
|
||||
* passing {@link ChronoField#DAY_OF_WEEK} as the field.
|
||||
* Note that this adjusts forwards or backwards within a Monday to Sunday week.
|
||||
* See {@link WeekFields#dayOfWeek} for localized week start days.
|
||||
* See {@link java.time.temporal.WeekFields#dayOfWeek()} for localized week start days.
|
||||
* See {@code TemporalAdjuster} for other adjusters with more control,
|
||||
* such as {@code next(MONDAY)}.
|
||||
* <p>
|
||||
|
@ -546,7 +546,7 @@ public final class Duration
|
||||
* They are returned in the order seconds, nanos.
|
||||
* <p>
|
||||
* This set can be used in conjunction with {@link #get(TemporalUnit)}
|
||||
* to access the entire state of the period.
|
||||
* to access the entire state of the duration.
|
||||
*
|
||||
* @return a list containing the seconds and nanos units, not null
|
||||
*/
|
||||
@ -686,8 +686,8 @@ public final class Duration
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
* @param amountToAdd the amount of the period, measured in terms of the unit, positive or negative
|
||||
* @param unit the unit that the period is measured in, must have an exact duration, not null
|
||||
* @param amountToAdd the amount to add, measured in terms of the unit, positive or negative
|
||||
* @param unit the unit that the amount is measured in, must have an exact duration, not null
|
||||
* @return a {@code Duration} based on this duration with the specified duration added, not null
|
||||
* @throws UnsupportedTemporalTypeException if the unit is not supported
|
||||
* @throws ArithmeticException if numeric overflow occurs
|
||||
@ -848,8 +848,8 @@ public final class Duration
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
* @param amountToSubtract the amount of the period, measured in terms of the unit, positive or negative
|
||||
* @param unit the unit that the period is measured in, must have an exact duration, not null
|
||||
* @param amountToSubtract the amount to subtract, measured in terms of the unit, positive or negative
|
||||
* @param unit the unit that the amount is measured in, must have an exact duration, not null
|
||||
* @return a {@code Duration} based on this duration with the specified duration subtracted, not null
|
||||
* @throws ArithmeticException if numeric overflow occurs
|
||||
*/
|
||||
|
@ -530,7 +530,7 @@ public final class Instant
|
||||
/**
|
||||
* Gets the value of the specified field from this instant as an {@code int}.
|
||||
* <p>
|
||||
* This queries this instant for the value for the specified field.
|
||||
* This queries this instant for the value of the specified field.
|
||||
* The returned value will always be within the valid range of values for the field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
@ -571,7 +571,7 @@ public final class Instant
|
||||
/**
|
||||
* Gets the value of the specified field from this instant as a {@code long}.
|
||||
* <p>
|
||||
* This queries this instant for the value for the specified field.
|
||||
* This queries this instant for the value of the specified field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
* <p>
|
||||
|
@ -280,7 +280,7 @@ public final class LocalDate
|
||||
* @param dayOfYear the day-of-year to represent, from 1 to 366
|
||||
* @return the local date, not null
|
||||
* @throws DateTimeException if the value of any field is out of range,
|
||||
* or if the day-of-year is invalid for the month-year
|
||||
* or if the day-of-year is invalid for the year
|
||||
*/
|
||||
public static LocalDate ofYearDay(int year, int dayOfYear) {
|
||||
YEAR.checkValidValue(year);
|
||||
@ -308,7 +308,7 @@ public final class LocalDate
|
||||
*
|
||||
* @param epochDay the Epoch Day to convert, based on the epoch 1970-01-01
|
||||
* @return the local date, not null
|
||||
* @throws DateTimeException if the epoch days exceeds the supported date range
|
||||
* @throws DateTimeException if the epoch day exceeds the supported date range
|
||||
*/
|
||||
public static LocalDate ofEpochDay(long epochDay) {
|
||||
long zeroDay = epochDay + DAYS_0000_TO_1970;
|
||||
@ -515,7 +515,7 @@ public final class LocalDate
|
||||
/**
|
||||
* Checks if the specified unit is supported.
|
||||
* <p>
|
||||
* This checks if the specified unit can be added to, or subtracted from, this date-time.
|
||||
* This checks if the specified unit can be added to, or subtracted from, this date.
|
||||
* If false, then calling the {@link #plus(long, TemporalUnit)} and
|
||||
* {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
|
||||
* <p>
|
||||
@ -592,7 +592,7 @@ public final class LocalDate
|
||||
/**
|
||||
* Gets the value of the specified field from this date as an {@code int}.
|
||||
* <p>
|
||||
* This queries this date for the value for the specified field.
|
||||
* This queries this date for the value of the specified field.
|
||||
* The returned value will always be within the valid range of values for the field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
@ -600,7 +600,7 @@ public final class LocalDate
|
||||
* If the field is a {@link ChronoField} then the query is implemented here.
|
||||
* The {@link #isSupported(TemporalField) supported fields} will return valid
|
||||
* values based on this date, except {@code EPOCH_DAY} and {@code PROLEPTIC_MONTH}
|
||||
* which are too large to fit in an {@code int} and throw a {@code DateTimeException}.
|
||||
* which are too large to fit in an {@code int} and throw an {@code UnsupportedTemporalTypeException}.
|
||||
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
|
||||
* <p>
|
||||
* If the field is not a {@code ChronoField}, then the result of this method
|
||||
@ -627,7 +627,7 @@ public final class LocalDate
|
||||
/**
|
||||
* Gets the value of the specified field from this date as a {@code long}.
|
||||
* <p>
|
||||
* This queries this date for the value for the specified field.
|
||||
* This queries this date for the value of the specified field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
* <p>
|
||||
@ -875,7 +875,9 @@ public final class LocalDate
|
||||
* <p>
|
||||
* A simple adjuster might simply set the one of the fields, such as the year field.
|
||||
* A more complex adjuster might set the date to the last day of the month.
|
||||
* A selection of common adjustments is provided in {@link TemporalAdjuster}.
|
||||
* <p>
|
||||
* A selection of common adjustments is provided in
|
||||
* {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
|
||||
* These include finding the "last day of the month" and "next Wednesday".
|
||||
* Key date-time classes also implement the {@code TemporalAdjuster} interface,
|
||||
* such as {@link Month} and {@link java.time.MonthDay MonthDay}.
|
||||
@ -885,7 +887,7 @@ public final class LocalDate
|
||||
* For example this code returns a date on the last day of July:
|
||||
* <pre>
|
||||
* import static java.time.Month.*;
|
||||
* import static java.time.temporal.Adjusters.*;
|
||||
* import static java.time.temporal.TemporalAdjusters.*;
|
||||
*
|
||||
* result = localDate.with(JULY).with(lastDayOfMonth());
|
||||
* </pre>
|
||||
@ -1041,7 +1043,8 @@ public final class LocalDate
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this date with the year altered.
|
||||
* Returns a copy of this {@code LocalDate} with the year altered.
|
||||
* <p>
|
||||
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
@ -1059,7 +1062,8 @@ public final class LocalDate
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this date with the month-of-year altered.
|
||||
* Returns a copy of this {@code LocalDate} with the month-of-year altered.
|
||||
* <p>
|
||||
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
@ -1077,7 +1081,8 @@ public final class LocalDate
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this date with the day-of-month altered.
|
||||
* Returns a copy of this {@code LocalDate} with the day-of-month altered.
|
||||
* <p>
|
||||
* If the resulting date is invalid, an exception is thrown.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
@ -1095,7 +1100,8 @@ public final class LocalDate
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this date with the day-of-year altered.
|
||||
* Returns a copy of this {@code LocalDate} with the day-of-year altered.
|
||||
* <p>
|
||||
* If the resulting date is invalid, an exception is thrown.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
@ -1245,7 +1251,7 @@ public final class LocalDate
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDate} with the specified period in years added.
|
||||
* Returns a copy of this {@code LocalDate} with the specified number of years added.
|
||||
* <p>
|
||||
* This method adds the specified amount to the years field in three steps:
|
||||
* <ol>
|
||||
@ -1273,7 +1279,7 @@ public final class LocalDate
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDate} with the specified period in months added.
|
||||
* Returns a copy of this {@code LocalDate} with the specified number of months added.
|
||||
* <p>
|
||||
* This method adds the specified amount to the months field in three steps:
|
||||
* <ol>
|
||||
@ -1304,7 +1310,7 @@ public final class LocalDate
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDate} with the specified period in weeks added.
|
||||
* Returns a copy of this {@code LocalDate} with the specified number of weeks added.
|
||||
* <p>
|
||||
* This method adds the specified amount in weeks to the days field incrementing
|
||||
* the month and year fields as necessary to ensure the result remains valid.
|
||||
@ -1402,11 +1408,11 @@ public final class LocalDate
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDate} with the specified period in years subtracted.
|
||||
* Returns a copy of this {@code LocalDate} with the specified number of years subtracted.
|
||||
* <p>
|
||||
* This method subtracts the specified amount from the years field in three steps:
|
||||
* <ol>
|
||||
* <li>Subtract the input years to the year field</li>
|
||||
* <li>Subtract the input years from the year field</li>
|
||||
* <li>Check if the resulting date would be invalid</li>
|
||||
* <li>Adjust the day-of-month to the last valid day if necessary</li>
|
||||
* </ol>
|
||||
@ -1426,11 +1432,11 @@ public final class LocalDate
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDate} with the specified period in months subtracted.
|
||||
* Returns a copy of this {@code LocalDate} with the specified number of months subtracted.
|
||||
* <p>
|
||||
* This method subtracts the specified amount from the months field in three steps:
|
||||
* <ol>
|
||||
* <li>Subtract the input months to the month-of-year field</li>
|
||||
* <li>Subtract the input months from the month-of-year field</li>
|
||||
* <li>Check if the resulting date would be invalid</li>
|
||||
* <li>Adjust the day-of-month to the last valid day if necessary</li>
|
||||
* </ol>
|
||||
@ -1450,7 +1456,7 @@ public final class LocalDate
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDate} with the specified period in weeks subtracted.
|
||||
* Returns a copy of this {@code LocalDate} with the specified number of weeks subtracted.
|
||||
* <p>
|
||||
* This method subtracts the specified amount in weeks from the days field decrementing
|
||||
* the month and year fields as necessary to ensure the result remains valid.
|
||||
|
@ -428,7 +428,7 @@ public final class LocalDateTime
|
||||
/**
|
||||
* Obtains an instance of {@code LocalDateTime} from a temporal object.
|
||||
* <p>
|
||||
* This obtains an offset time based on the specified temporal.
|
||||
* This obtains a local date-time based on the specified temporal.
|
||||
* A {@code TemporalAccessor} represents an arbitrary set of date and time information,
|
||||
* which this factory converts to an instance of {@code LocalDateTime}.
|
||||
* <p>
|
||||
@ -656,7 +656,7 @@ public final class LocalDateTime
|
||||
/**
|
||||
* Gets the value of the specified field from this date-time as an {@code int}.
|
||||
* <p>
|
||||
* This queries this date-time for the value for the specified field.
|
||||
* This queries this date-time for the value of the specified field.
|
||||
* The returned value will always be within the valid range of values for the field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
@ -665,7 +665,7 @@ public final class LocalDateTime
|
||||
* The {@link #isSupported(TemporalField) supported fields} will return valid
|
||||
* values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY},
|
||||
* {@code EPOCH_DAY} and {@code PROLEPTIC_MONTH} which are too large to fit in
|
||||
* an {@code int} and throw a {@code DateTimeException}.
|
||||
* an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
|
||||
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
|
||||
* <p>
|
||||
* If the field is not a {@code ChronoField}, then the result of this method
|
||||
@ -693,7 +693,7 @@ public final class LocalDateTime
|
||||
/**
|
||||
* Gets the value of the specified field from this date-time as a {@code long}.
|
||||
* <p>
|
||||
* This queries this date-time for the value for the specified field.
|
||||
* This queries this date-time for the value of the specified field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
* <p>
|
||||
@ -878,7 +878,9 @@ public final class LocalDateTime
|
||||
* <p>
|
||||
* A simple adjuster might simply set the one of the fields, such as the year field.
|
||||
* A more complex adjuster might set the date to the last day of the month.
|
||||
* A selection of common adjustments is provided in {@link TemporalAdjuster}.
|
||||
* <p>
|
||||
* A selection of common adjustments is provided in
|
||||
* {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
|
||||
* These include finding the "last day of the month" and "next Wednesday".
|
||||
* Key date-time classes also implement the {@code TemporalAdjuster} interface,
|
||||
* such as {@link Month} and {@link java.time.MonthDay MonthDay}.
|
||||
@ -888,7 +890,7 @@ public final class LocalDateTime
|
||||
* For example this code returns a date on the last day of July:
|
||||
* <pre>
|
||||
* import static java.time.Month.*;
|
||||
* import static java.time.temporal.Adjusters.*;
|
||||
* import static java.time.temporal.TemporalAdjusters.*;
|
||||
*
|
||||
* result = localDateTime.with(JULY).with(lastDayOfMonth());
|
||||
* </pre>
|
||||
@ -974,6 +976,7 @@ public final class LocalDateTime
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the year altered.
|
||||
* <p>
|
||||
* The time does not affect the calculation and will be the same in the result.
|
||||
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
|
||||
* <p>
|
||||
@ -989,6 +992,7 @@ public final class LocalDateTime
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the month-of-year altered.
|
||||
* <p>
|
||||
* The time does not affect the calculation and will be the same in the result.
|
||||
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
|
||||
* <p>
|
||||
@ -1004,7 +1008,8 @@ public final class LocalDateTime
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the day-of-month altered.
|
||||
* If the resulting {@code LocalDateTime} is invalid, an exception is thrown.
|
||||
* <p>
|
||||
* If the resulting date-time is invalid, an exception is thrown.
|
||||
* The time does not affect the calculation and will be the same in the result.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
@ -1020,7 +1025,8 @@ public final class LocalDateTime
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the day-of-year altered.
|
||||
* If the resulting {@code LocalDateTime} is invalid, an exception is thrown.
|
||||
* <p>
|
||||
* If the resulting date-time is invalid, an exception is thrown.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1035,7 +1041,7 @@ public final class LocalDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the hour-of-day value altered.
|
||||
* Returns a copy of this {@code LocalDateTime} with the hour-of-day altered.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1049,7 +1055,7 @@ public final class LocalDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the minute-of-hour value altered.
|
||||
* Returns a copy of this {@code LocalDateTime} with the minute-of-hour altered.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1063,7 +1069,7 @@ public final class LocalDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the second-of-minute value altered.
|
||||
* Returns a copy of this {@code LocalDateTime} with the second-of-minute altered.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1077,7 +1083,7 @@ public final class LocalDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the nano-of-second value altered.
|
||||
* Returns a copy of this {@code LocalDateTime} with the nano-of-second altered.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1109,7 +1115,7 @@ public final class LocalDateTime
|
||||
* @param unit the unit to truncate to, not null
|
||||
* @return a {@code LocalDateTime} based on this date-time with the time truncated, not null
|
||||
* @throws DateTimeException if unable to truncate
|
||||
* @throws UnsupportedTemporalTypeException if the field is not supported
|
||||
* @throws UnsupportedTemporalTypeException if the unit is not supported
|
||||
*/
|
||||
public LocalDateTime truncatedTo(TemporalUnit unit) {
|
||||
return with(date, time.truncatedTo(unit));
|
||||
@ -1192,7 +1198,7 @@ public final class LocalDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in years added.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of years added.
|
||||
* <p>
|
||||
* This method adds the specified amount to the years field in three steps:
|
||||
* <ol>
|
||||
@ -1217,7 +1223,7 @@ public final class LocalDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in months added.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of months added.
|
||||
* <p>
|
||||
* This method adds the specified amount to the months field in three steps:
|
||||
* <ol>
|
||||
@ -1242,7 +1248,7 @@ public final class LocalDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in weeks added.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of weeks added.
|
||||
* <p>
|
||||
* This method adds the specified amount in weeks to the days field incrementing
|
||||
* the month and year fields as necessary to ensure the result remains valid.
|
||||
@ -1262,7 +1268,7 @@ public final class LocalDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in days added.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of days added.
|
||||
* <p>
|
||||
* This method adds the specified amount to the days field incrementing the
|
||||
* month and year fields as necessary to ensure the result remains valid.
|
||||
@ -1283,7 +1289,7 @@ public final class LocalDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in hours added.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of hours added.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1296,7 +1302,7 @@ public final class LocalDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in minutes added.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of minutes added.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1309,7 +1315,7 @@ public final class LocalDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in seconds added.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of seconds added.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1322,7 +1328,7 @@ public final class LocalDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in nanoseconds added.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of nanoseconds added.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1391,7 +1397,7 @@ public final class LocalDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in years subtracted.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of years subtracted.
|
||||
* <p>
|
||||
* This method subtracts the specified amount from the years field in three steps:
|
||||
* <ol>
|
||||
@ -1415,7 +1421,7 @@ public final class LocalDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in months subtracted.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of months subtracted.
|
||||
* <p>
|
||||
* This method subtracts the specified amount from the months field in three steps:
|
||||
* <ol>
|
||||
@ -1439,7 +1445,7 @@ public final class LocalDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in weeks subtracted.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of weeks subtracted.
|
||||
* <p>
|
||||
* This method subtracts the specified amount in weeks from the days field decrementing
|
||||
* the month and year fields as necessary to ensure the result remains valid.
|
||||
@ -1458,9 +1464,9 @@ public final class LocalDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in days subtracted.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of days subtracted.
|
||||
* <p>
|
||||
* This method subtracts the specified amount from the days field incrementing the
|
||||
* This method subtracts the specified amount from the days field decrementing the
|
||||
* month and year fields as necessary to ensure the result remains valid.
|
||||
* The result is only invalid if the maximum/minimum year is exceeded.
|
||||
* <p>
|
||||
@ -1478,7 +1484,7 @@ public final class LocalDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in hours subtracted.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of hours subtracted.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1491,7 +1497,7 @@ public final class LocalDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in minutes subtracted.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of minutes subtracted.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1504,7 +1510,7 @@ public final class LocalDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in seconds subtracted.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of seconds subtracted.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1517,7 +1523,7 @@ public final class LocalDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified period in nanoseconds subtracted.
|
||||
* Returns a copy of this {@code LocalDateTime} with the specified number of nanoseconds subtracted.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1575,7 +1581,7 @@ public final class LocalDateTime
|
||||
* what the result of this method will be.
|
||||
* <p>
|
||||
* The result of this method is obtained by invoking the
|
||||
* {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
|
||||
* {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
|
||||
* specified query passing {@code this} as the argument.
|
||||
*
|
||||
* @param <R> the type of the result
|
||||
|
@ -93,7 +93,7 @@ import java.time.temporal.ValueRange;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A time without time-zone in the ISO-8601 calendar system,
|
||||
* A time without a time-zone in the ISO-8601 calendar system,
|
||||
* such as {@code 10:15:30}.
|
||||
* <p>
|
||||
* {@code LocalTime} is an immutable date-time object that represents a time,
|
||||
@ -101,7 +101,7 @@ import java.util.Objects;
|
||||
* Time is represented to nanosecond precision.
|
||||
* For example, the value "13:45.30.123456789" can be stored in a {@code LocalTime}.
|
||||
* <p>
|
||||
* It does not store or represent a date or time-zone.
|
||||
* This class does not store or represent a date or time-zone.
|
||||
* Instead, it is a description of the local time as seen on a wall clock.
|
||||
* It cannot represent an instant on the time-line without additional information
|
||||
* such as an offset or time-zone.
|
||||
@ -280,7 +280,7 @@ public final class LocalTime
|
||||
return ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + now.getNano());
|
||||
}
|
||||
|
||||
//------------------------get-----------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Obtains an instance of {@code LocalTime} from an hour and minute.
|
||||
* <p>
|
||||
@ -395,7 +395,7 @@ public final class LocalTime
|
||||
* on extracting the {@link ChronoField#NANO_OF_DAY NANO_OF_DAY} field.
|
||||
* <p>
|
||||
* This method matches the signature of the functional interface {@link TemporalQuery}
|
||||
* allowing it to be used in queries via method reference, {@code LocalTime::from}.
|
||||
* allowing it to be used as a query via method reference, {@code LocalTime::from}.
|
||||
*
|
||||
* @param temporal the temporal object to convert, not null
|
||||
* @return the local time, not null
|
||||
@ -418,7 +418,7 @@ public final class LocalTime
|
||||
* The string must represent a valid time and is parsed using
|
||||
* {@link java.time.format.DateTimeFormatter#ISO_LOCAL_TIME}.
|
||||
*
|
||||
* @param text the text to parse such as "10:15:30", not null
|
||||
* @param text the text to parse such as "10:15:30", not null
|
||||
* @return the parsed local time, not null
|
||||
* @throws DateTimeParseException if the text cannot be parsed
|
||||
*/
|
||||
@ -524,7 +524,7 @@ public final class LocalTime
|
||||
/**
|
||||
* Checks if the specified unit is supported.
|
||||
* <p>
|
||||
* This checks if the specified unit can be added to, or subtracted from, this date-time.
|
||||
* This checks if the specified unit can be added to, or subtracted from, this time.
|
||||
* If false, then calling the {@link #plus(long, TemporalUnit)} and
|
||||
* {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
|
||||
* <p>
|
||||
@ -589,7 +589,7 @@ public final class LocalTime
|
||||
/**
|
||||
* Gets the value of the specified field from this time as an {@code int}.
|
||||
* <p>
|
||||
* This queries this time for the value for the specified field.
|
||||
* This queries this time for the value of the specified field.
|
||||
* The returned value will always be within the valid range of values for the field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
@ -597,7 +597,7 @@ public final class LocalTime
|
||||
* If the field is a {@link ChronoField} then the query is implemented here.
|
||||
* The {@link #isSupported(TemporalField) supported fields} will return valid
|
||||
* values based on this time, except {@code NANO_OF_DAY} and {@code MICRO_OF_DAY}
|
||||
* which are too large to fit in an {@code int} and throw a {@code DateTimeException}.
|
||||
* which are too large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
|
||||
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
|
||||
* <p>
|
||||
* If the field is not a {@code ChronoField}, then the result of this method
|
||||
@ -624,7 +624,7 @@ public final class LocalTime
|
||||
/**
|
||||
* Gets the value of the specified field from this time as a {@code long}.
|
||||
* <p>
|
||||
* This queries this time for the value for the specified field.
|
||||
* This queries this time for the value of the specified field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
* <p>
|
||||
@ -858,7 +858,7 @@ public final class LocalTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code LocalTime} with the hour-of-day value altered.
|
||||
* Returns a copy of this {@code LocalTime} with the hour-of-day altered.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -875,7 +875,7 @@ public final class LocalTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalTime} with the minute-of-hour value altered.
|
||||
* Returns a copy of this {@code LocalTime} with the minute-of-hour altered.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -892,7 +892,7 @@ public final class LocalTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalTime} with the second-of-minute value altered.
|
||||
* Returns a copy of this {@code LocalTime} with the second-of-minute altered.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -909,7 +909,7 @@ public final class LocalTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalTime} with the nano-of-second value altered.
|
||||
* Returns a copy of this {@code LocalTime} with the nano-of-second altered.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -929,7 +929,7 @@ public final class LocalTime
|
||||
/**
|
||||
* Returns a copy of this {@code LocalTime} with the time truncated.
|
||||
* <p>
|
||||
* Truncating the time returns a copy of the original time with fields
|
||||
* Truncation returns a copy of the original time with fields
|
||||
* smaller than the specified unit set to zero.
|
||||
* For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit
|
||||
* will set the second-of-minute and nano-of-second field to zero.
|
||||
@ -1059,7 +1059,7 @@ public final class LocalTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code LocalTime} with the specified period in hours added.
|
||||
* Returns a copy of this {@code LocalTime} with the specified number of hours added.
|
||||
* <p>
|
||||
* This adds the specified number of hours to this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -1078,7 +1078,7 @@ public final class LocalTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalTime} with the specified period in minutes added.
|
||||
* Returns a copy of this {@code LocalTime} with the specified number of minutes added.
|
||||
* <p>
|
||||
* This adds the specified number of minutes to this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -1103,7 +1103,7 @@ public final class LocalTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalTime} with the specified period in seconds added.
|
||||
* Returns a copy of this {@code LocalTime} with the specified number of seconds added.
|
||||
* <p>
|
||||
* This adds the specified number of seconds to this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -1130,7 +1130,7 @@ public final class LocalTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalTime} with the specified period in nanoseconds added.
|
||||
* Returns a copy of this {@code LocalTime} with the specified number of nanoseconds added.
|
||||
* <p>
|
||||
* This adds the specified number of nanoseconds to this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -1208,7 +1208,7 @@ public final class LocalTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code LocalTime} with the specified period in hours subtracted.
|
||||
* Returns a copy of this {@code LocalTime} with the specified number of hours subtracted.
|
||||
* <p>
|
||||
* This subtracts the specified number of hours from this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -1223,7 +1223,7 @@ public final class LocalTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalTime} with the specified period in minutes subtracted.
|
||||
* Returns a copy of this {@code LocalTime} with the specified number of minutes subtracted.
|
||||
* <p>
|
||||
* This subtracts the specified number of minutes from this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -1238,7 +1238,7 @@ public final class LocalTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalTime} with the specified period in seconds subtracted.
|
||||
* Returns a copy of this {@code LocalTime} with the specified number of seconds subtracted.
|
||||
* <p>
|
||||
* This subtracts the specified number of seconds from this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -1253,7 +1253,7 @@ public final class LocalTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code LocalTime} with the specified period in nanoseconds subtracted.
|
||||
* Returns a copy of this {@code LocalTime} with the specified number of nanoseconds subtracted.
|
||||
* <p>
|
||||
* This subtracts the specified number of nanoseconds from this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -1470,14 +1470,13 @@ public final class LocalTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Compares this {@code LocalTime} to another time.
|
||||
* Compares this time to another time.
|
||||
* <p>
|
||||
* The comparison is based on the time-line position of the local times within a day.
|
||||
* It is "consistent with equals", as defined by {@link Comparable}.
|
||||
*
|
||||
* @param other the other time to compare to, not null
|
||||
* @return the comparator value, negative if less, positive if greater
|
||||
* @throws NullPointerException if {@code other} is null
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(LocalTime other) {
|
||||
@ -1495,26 +1494,24 @@ public final class LocalTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this {@code LocalTime} is after the specified time.
|
||||
* Checks if this time is after the specified time.
|
||||
* <p>
|
||||
* The comparison is based on the time-line position of the time within a day.
|
||||
*
|
||||
* @param other the other time to compare to, not null
|
||||
* @return true if this is after the specified time
|
||||
* @throws NullPointerException if {@code other} is null
|
||||
*/
|
||||
public boolean isAfter(LocalTime other) {
|
||||
return compareTo(other) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this {@code LocalTime} is before the specified time.
|
||||
* Checks if this time is before the specified time.
|
||||
* <p>
|
||||
* The comparison is based on the time-line position of the time within a day.
|
||||
*
|
||||
* @param other the other time to compare to, not null
|
||||
* @return true if this point is before the specified time
|
||||
* @throws NullPointerException if {@code other} is null
|
||||
*/
|
||||
public boolean isBefore(LocalTime other) {
|
||||
return compareTo(other) < 0;
|
||||
|
@ -202,7 +202,7 @@ public enum Month implements TemporalAccessor, TemporalAdjuster {
|
||||
* chronology, or can be converted to a {@code LocalDate}.
|
||||
* <p>
|
||||
* This method matches the signature of the functional interface {@link TemporalQuery}
|
||||
* allowing it to be used in queries via method reference, {@code Month::from}.
|
||||
* allowing it to be used as a query via method reference, {@code Month::from}.
|
||||
*
|
||||
* @param temporal the temporal object to convert, not null
|
||||
* @return the month-of-year, not null
|
||||
@ -315,7 +315,7 @@ public enum Month implements TemporalAccessor, TemporalAdjuster {
|
||||
/**
|
||||
* Gets the value of the specified field from this month-of-year as an {@code int}.
|
||||
* <p>
|
||||
* This queries this month for the value for the specified field.
|
||||
* This queries this month for the value of the specified field.
|
||||
* The returned value will always be within the valid range of values for the field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
@ -348,7 +348,7 @@ public enum Month implements TemporalAccessor, TemporalAdjuster {
|
||||
/**
|
||||
* Gets the value of the specified field from this month-of-year as a {@code long}.
|
||||
* <p>
|
||||
* This queries this month for the value for the specified field.
|
||||
* This queries this month for the value of the specified field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
* <p>
|
||||
|
@ -90,8 +90,8 @@ import java.util.Objects;
|
||||
* A month-day in the ISO-8601 calendar system, such as {@code --12-03}.
|
||||
* <p>
|
||||
* {@code MonthDay} is an immutable date-time object that represents the combination
|
||||
* of a year and month. Any field that can be derived from a month and day, such as
|
||||
* quarter-of-year, can be obtained.
|
||||
* of a month and day-of-month. Any field that can be derived from a month and day,
|
||||
* such as quarter-of-year, can be obtained.
|
||||
* <p>
|
||||
* This class does not store or represent a year, time or time-zone.
|
||||
* For example, the value "December 3rd" can be stored in a {@code MonthDay}.
|
||||
@ -154,7 +154,7 @@ public final class MonthDay
|
||||
/**
|
||||
* Obtains the current month-day from the system clock in the default time-zone.
|
||||
* <p>
|
||||
* This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
|
||||
* This will query the {@link Clock#systemDefaultZone() system clock} in the default
|
||||
* time-zone to obtain the current month-day.
|
||||
* <p>
|
||||
* Using this method will prevent the ability to use an alternate clock for testing
|
||||
@ -169,7 +169,7 @@ public final class MonthDay
|
||||
/**
|
||||
* Obtains the current month-day from the system clock in the specified time-zone.
|
||||
* <p>
|
||||
* This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current month-day.
|
||||
* This will query the {@link Clock#system(ZoneId) system clock} to obtain the current month-day.
|
||||
* Specifying the time-zone avoids dependence on the default time-zone.
|
||||
* <p>
|
||||
* Using this method will prevent the ability to use an alternate clock for testing
|
||||
@ -258,7 +258,7 @@ public final class MonthDay
|
||||
* chronology, or can be converted to a {@code LocalDate}.
|
||||
* <p>
|
||||
* This method matches the signature of the functional interface {@link TemporalQuery}
|
||||
* allowing it to be used in queries via method reference, {@code MonthDay::from}.
|
||||
* allowing it to be used as a query via method reference, {@code MonthDay::from}.
|
||||
*
|
||||
* @param temporal the temporal object to convert, not null
|
||||
* @return the month-day, not null
|
||||
@ -389,7 +389,7 @@ public final class MonthDay
|
||||
/**
|
||||
* Gets the value of the specified field from this month-day as an {@code int}.
|
||||
* <p>
|
||||
* This queries this month-day for the value for the specified field.
|
||||
* This queries this month-day for the value of the specified field.
|
||||
* The returned value will always be within the valid range of values for the field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
@ -420,7 +420,7 @@ public final class MonthDay
|
||||
/**
|
||||
* Gets the value of the specified field from this month-day as a {@code long}.
|
||||
* <p>
|
||||
* This queries this month-day for the value for the specified field.
|
||||
* This queries this month-day for the value of the specified field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
* <p>
|
||||
@ -501,7 +501,7 @@ public final class MonthDay
|
||||
* This method checks whether this month and day and the input year form
|
||||
* a valid date. This can only return false for February 29th.
|
||||
*
|
||||
* @param year the year to validate, an out of range value returns false
|
||||
* @param year the year to validate
|
||||
* @return true if the year is valid for this month-day
|
||||
* @see Year#isValidMonthDay(MonthDay)
|
||||
*/
|
||||
@ -685,7 +685,7 @@ public final class MonthDay
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this month-day after the specified month-day.
|
||||
* Checks if this month-day is after the specified month-day.
|
||||
*
|
||||
* @param other the other month-day to compare to, not null
|
||||
* @return true if this is after the specified month-day
|
||||
@ -695,7 +695,7 @@ public final class MonthDay
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this month-day before the specified month-day.
|
||||
* Checks if this month-day is before the specified month-day.
|
||||
*
|
||||
* @param other the other month-day to compare to, not null
|
||||
* @return true if this point is before the specified month-day
|
||||
|
@ -199,7 +199,7 @@ public final class OffsetDateTime
|
||||
/**
|
||||
* Obtains the current date-time from the system clock in the default time-zone.
|
||||
* <p>
|
||||
* This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
|
||||
* This will query the {@link Clock#systemDefaultZone() system clock} in the default
|
||||
* time-zone to obtain the current date-time.
|
||||
* The offset will be calculated from the time-zone in the clock.
|
||||
* <p>
|
||||
@ -215,7 +215,7 @@ public final class OffsetDateTime
|
||||
/**
|
||||
* Obtains the current date-time from the system clock in the specified time-zone.
|
||||
* <p>
|
||||
* This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current date-time.
|
||||
* This will query the {@link Clock#system(ZoneId) system clock} to obtain the current date-time.
|
||||
* Specifying the time-zone avoids dependence on the default time-zone.
|
||||
* The offset will be calculated from the specified time-zone.
|
||||
* <p>
|
||||
@ -345,7 +345,7 @@ public final class OffsetDateTime
|
||||
* those fields that are equivalent to the relevant objects.
|
||||
* <p>
|
||||
* This method matches the signature of the functional interface {@link TemporalQuery}
|
||||
* allowing it to be used in queries via method reference, {@code OffsetDateTime::from}.
|
||||
* allowing it to be used as a query via method reference, {@code OffsetDateTime::from}.
|
||||
*
|
||||
* @param temporal the temporal object to convert, not null
|
||||
* @return the offset date-time, not null
|
||||
@ -566,7 +566,7 @@ public final class OffsetDateTime
|
||||
/**
|
||||
* Gets the value of the specified field from this date-time as an {@code int}.
|
||||
* <p>
|
||||
* This queries this date-time for the value for the specified field.
|
||||
* This queries this date-time for the value of the specified field.
|
||||
* The returned value will always be within the valid range of values for the field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
@ -575,7 +575,7 @@ public final class OffsetDateTime
|
||||
* The {@link #isSupported(TemporalField) supported fields} will return valid
|
||||
* values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY},
|
||||
* {@code EPOCH_DAY}, {@code PROLEPTIC_MONTH} and {@code INSTANT_SECONDS} which are too
|
||||
* large to fit in an {@code int} and throw a {@code DateTimeException}.
|
||||
* large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
|
||||
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
|
||||
* <p>
|
||||
* If the field is not a {@code ChronoField}, then the result of this method
|
||||
@ -608,7 +608,7 @@ public final class OffsetDateTime
|
||||
/**
|
||||
* Gets the value of the specified field from this date-time as a {@code long}.
|
||||
* <p>
|
||||
* This queries this date-time for the value for the specified field.
|
||||
* This queries this date-time for the value of the specified field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
* <p>
|
||||
@ -703,7 +703,7 @@ public final class OffsetDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Gets the {@code LocalDateTime} part of this offset date-time.
|
||||
* Gets the {@code LocalDateTime} part of this date-time.
|
||||
* <p>
|
||||
* This returns a {@code LocalDateTime} with the same year, month, day and time
|
||||
* as this date-time.
|
||||
@ -795,10 +795,10 @@ public final class OffsetDateTime
|
||||
/**
|
||||
* Gets the day-of-week field, which is an enum {@code DayOfWeek}.
|
||||
* <p>
|
||||
* This method returns the enum {@link java.time.DayOfWeek} for the day-of-week.
|
||||
* This method returns the enum {@link DayOfWeek} for the day-of-week.
|
||||
* This avoids confusion as to what {@code int} values mean.
|
||||
* If you need access to the primitive {@code int} value then the enum
|
||||
* provides the {@link java.time.DayOfWeek#getValue() int value}.
|
||||
* provides the {@link DayOfWeek#getValue() int value}.
|
||||
* <p>
|
||||
* Additional information can be obtained from the {@code DayOfWeek}.
|
||||
* This includes textual names of the values.
|
||||
@ -868,7 +868,8 @@ public final class OffsetDateTime
|
||||
* <p>
|
||||
* A simple adjuster might simply set the one of the fields, such as the year field.
|
||||
* A more complex adjuster might set the date to the last day of the month.
|
||||
* A selection of common adjustments is provided in {@link TemporalAdjuster}.
|
||||
* A selection of common adjustments is provided in
|
||||
* {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
|
||||
* These include finding the "last day of the month" and "next Wednesday".
|
||||
* Key date-time classes also implement the {@code TemporalAdjuster} interface,
|
||||
* such as {@link Month} and {@link java.time.MonthDay MonthDay}.
|
||||
@ -878,7 +879,7 @@ public final class OffsetDateTime
|
||||
* For example this code returns a date on the last day of July:
|
||||
* <pre>
|
||||
* import static java.time.Month.*;
|
||||
* import static java.time.temporal.Adjusters.*;
|
||||
* import static java.time.temporal.TemporalAdjusters.*;
|
||||
*
|
||||
* result = offsetDateTime.with(JULY).with(lastDayOfMonth());
|
||||
* </pre>
|
||||
@ -920,7 +921,7 @@ public final class OffsetDateTime
|
||||
/**
|
||||
* Returns a copy of this date-time with the specified field set to a new value.
|
||||
* <p>
|
||||
* TThis returns an {@code OffsetDateTime}, based on this one, with the value
|
||||
* This returns an {@code OffsetDateTime}, based on this one, with the value
|
||||
* for the specified field changed.
|
||||
* This can be used to change any supported field, such as the year, month or day-of-month.
|
||||
* If it is not possible to set the value, because the field is not supported or for
|
||||
@ -979,7 +980,8 @@ public final class OffsetDateTime
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the year altered.
|
||||
* The offset does not affect the calculation and will be the same in the result.
|
||||
* <p>
|
||||
* The time and offset do not affect the calculation and will be the same in the result.
|
||||
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
@ -994,7 +996,8 @@ public final class OffsetDateTime
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the month-of-year altered.
|
||||
* The offset does not affect the calculation and will be the same in the result.
|
||||
* <p>
|
||||
* The time and offset do not affect the calculation and will be the same in the result.
|
||||
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
@ -1009,8 +1012,9 @@ public final class OffsetDateTime
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the day-of-month altered.
|
||||
* <p>
|
||||
* If the resulting {@code OffsetDateTime} is invalid, an exception is thrown.
|
||||
* The offset does not affect the calculation and will be the same in the result.
|
||||
* The time and offset do not affect the calculation and will be the same in the result.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1025,6 +1029,8 @@ public final class OffsetDateTime
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the day-of-year altered.
|
||||
* <p>
|
||||
* The time and offset do not affect the calculation and will be the same in the result.
|
||||
* If the resulting {@code OffsetDateTime} is invalid, an exception is thrown.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
@ -1040,9 +1046,9 @@ public final class OffsetDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the hour-of-day value altered.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the hour-of-day altered.
|
||||
* <p>
|
||||
* The offset does not affect the calculation and will be the same in the result.
|
||||
* The date and offset do not affect the calculation and will be the same in the result.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1055,9 +1061,9 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the minute-of-hour value altered.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the minute-of-hour altered.
|
||||
* <p>
|
||||
* The offset does not affect the calculation and will be the same in the result.
|
||||
* The date and offset do not affect the calculation and will be the same in the result.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1070,9 +1076,9 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the second-of-minute value altered.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the second-of-minute altered.
|
||||
* <p>
|
||||
* The offset does not affect the calculation and will be the same in the result.
|
||||
* The date and offset do not affect the calculation and will be the same in the result.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1085,15 +1091,15 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the nano-of-second value altered.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the nano-of-second altered.
|
||||
* <p>
|
||||
* The offset does not affect the calculation and will be the same in the result.
|
||||
* The date and offset do not affect the calculation and will be the same in the result.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
* @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999
|
||||
* @return an {@code OffsetDateTime} based on this date-time with the requested nanosecond, not null
|
||||
* @throws DateTimeException if the nanos value is invalid
|
||||
* @throws DateTimeException if the nano value is invalid
|
||||
*/
|
||||
public OffsetDateTime withNano(int nanoOfSecond) {
|
||||
return with(dateTime.withNano(nanoOfSecond), offset);
|
||||
@ -1187,7 +1193,7 @@ public final class OffsetDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified period in years added.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified number of years added.
|
||||
* <p>
|
||||
* This method adds the specified amount to the years field in three steps:
|
||||
* <ol>
|
||||
@ -1211,7 +1217,7 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified period in months added.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified number of months added.
|
||||
* <p>
|
||||
* This method adds the specified amount to the months field in three steps:
|
||||
* <ol>
|
||||
@ -1235,13 +1241,13 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this OffsetDateTime with the specified period in weeks added.
|
||||
* Returns a copy of this OffsetDateTime with the specified number of weeks added.
|
||||
* <p>
|
||||
* This method adds the specified amount in weeks to the days field incrementing
|
||||
* the month and year fields as necessary to ensure the result remains valid.
|
||||
* The result is only invalid if the maximum/minimum year is exceeded.
|
||||
* <p>
|
||||
* For example, 2008-12-31 plus one week would result in the 2009-01-07.
|
||||
* For example, 2008-12-31 plus one week would result in 2009-01-07.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1254,13 +1260,13 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this OffsetDateTime with the specified period in days added.
|
||||
* Returns a copy of this OffsetDateTime with the specified number of days added.
|
||||
* <p>
|
||||
* This method adds the specified amount to the days field incrementing the
|
||||
* month and year fields as necessary to ensure the result remains valid.
|
||||
* The result is only invalid if the maximum/minimum year is exceeded.
|
||||
* <p>
|
||||
* For example, 2008-12-31 plus one day would result in the 2009-01-01.
|
||||
* For example, 2008-12-31 plus one day would result in 2009-01-01.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1273,7 +1279,7 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified period in hours added.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified number of hours added.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1286,7 +1292,7 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified period in minutes added.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified number of minutes added.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1299,7 +1305,7 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified period in seconds added.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified number of seconds added.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1312,7 +1318,7 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified period in nanoseconds added.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified number of nanoseconds added.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1376,11 +1382,11 @@ public final class OffsetDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified period in years subtracted.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified number of years subtracted.
|
||||
* <p>
|
||||
* This method subtracts the specified amount from the years field in three steps:
|
||||
* <ol>
|
||||
* <li>Subtract the input years to the year field</li>
|
||||
* <li>Subtract the input years from the year field</li>
|
||||
* <li>Check if the resulting date would be invalid</li>
|
||||
* <li>Adjust the day-of-month to the last valid day if necessary</li>
|
||||
* </ol>
|
||||
@ -1400,11 +1406,11 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified period in months subtracted.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified number of months subtracted.
|
||||
* <p>
|
||||
* This method subtracts the specified amount from the months field in three steps:
|
||||
* <ol>
|
||||
* <li>Subtract the input months to the month-of-year field</li>
|
||||
* <li>Subtract the input months from the month-of-year field</li>
|
||||
* <li>Check if the resulting date would be invalid</li>
|
||||
* <li>Adjust the day-of-month to the last valid day if necessary</li>
|
||||
* </ol>
|
||||
@ -1424,13 +1430,13 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified period in weeks subtracted.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified number of weeks subtracted.
|
||||
* <p>
|
||||
* This method subtracts the specified amount in weeks from the days field decrementing
|
||||
* the month and year fields as necessary to ensure the result remains valid.
|
||||
* The result is only invalid if the maximum/minimum year is exceeded.
|
||||
* <p>
|
||||
* For example, 2008-12-31 minus one week would result in the 2009-01-07.
|
||||
* For example, 2008-12-31 minus one week would result in 2009-01-07.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1443,13 +1449,13 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified period in days subtracted.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified number of days subtracted.
|
||||
* <p>
|
||||
* This method subtracts the specified amount from the days field incrementing the
|
||||
* This method subtracts the specified amount from the days field decrementing the
|
||||
* month and year fields as necessary to ensure the result remains valid.
|
||||
* The result is only invalid if the maximum/minimum year is exceeded.
|
||||
* <p>
|
||||
* For example, 2008-12-31 minus one day would result in the 2009-01-01.
|
||||
* For example, 2008-12-31 minus one day would result in 2009-01-01.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1462,7 +1468,7 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified period in hours subtracted.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified number of hours subtracted.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1475,7 +1481,7 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified period in minutes subtracted.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified number of minutes subtracted.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1488,7 +1494,7 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified period in seconds subtracted.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified number of seconds subtracted.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1501,7 +1507,7 @@ public final class OffsetDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified period in nanoseconds subtracted.
|
||||
* Returns a copy of this {@code OffsetDateTime} with the specified number of nanoseconds subtracted.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1598,7 +1604,7 @@ public final class OffsetDateTime
|
||||
* objects in terms of a single {@code TemporalUnit}.
|
||||
* The start and end points are {@code this} and the specified date-time.
|
||||
* The result will be negative if the end is before the start.
|
||||
* For example, the period in days between two date-times can be calculated
|
||||
* For example, the amount in days between two date-times can be calculated
|
||||
* using {@code startDateTime.until(endDateTime, DAYS)}.
|
||||
* <p>
|
||||
* The {@code Temporal} passed to this method is converted to a
|
||||
@ -1608,7 +1614,7 @@ public final class OffsetDateTime
|
||||
* <p>
|
||||
* The calculation returns a whole number, representing the number of
|
||||
* complete units between the two date-times.
|
||||
* For example, the period in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
|
||||
* For example, the amount in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
|
||||
* will only be one month as it is one minute short of two months.
|
||||
* <p>
|
||||
* There are two equivalent ways of using this method.
|
||||
@ -1769,7 +1775,7 @@ public final class OffsetDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Compares this {@code OffsetDateTime} to another date-time.
|
||||
* Compares this date-time to another date-time.
|
||||
* <p>
|
||||
* The comparison is based on the instant then on the local date-time.
|
||||
* It is "consistent with equals", as defined by {@link Comparable}.
|
||||
|
@ -153,14 +153,14 @@ public final class OffsetTime
|
||||
/**
|
||||
* Obtains the current time from the system clock in the default time-zone.
|
||||
* <p>
|
||||
* This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
|
||||
* This will query the {@link Clock#systemDefaultZone() system clock} in the default
|
||||
* time-zone to obtain the current time.
|
||||
* The offset will be calculated from the time-zone in the clock.
|
||||
* <p>
|
||||
* Using this method will prevent the ability to use an alternate clock for testing
|
||||
* because the clock is hard-coded.
|
||||
*
|
||||
* @return the current time using the system clock, not null
|
||||
* @return the current time using the system clock and default time-zone, not null
|
||||
*/
|
||||
public static OffsetTime now() {
|
||||
return now(Clock.systemDefaultZone());
|
||||
@ -169,7 +169,7 @@ public final class OffsetTime
|
||||
/**
|
||||
* Obtains the current time from the system clock in the specified time-zone.
|
||||
* <p>
|
||||
* This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current time.
|
||||
* This will query the {@link Clock#system(ZoneId) system clock} to obtain the current time.
|
||||
* Specifying the time-zone avoids dependence on the default time-zone.
|
||||
* The offset will be calculated from the specified time-zone.
|
||||
* <p>
|
||||
@ -277,7 +277,7 @@ public final class OffsetTime
|
||||
* those fields that are equivalent to the relevant objects.
|
||||
* <p>
|
||||
* This method matches the signature of the functional interface {@link TemporalQuery}
|
||||
* allowing it to be used in queries via method reference, {@code OffsetTime::from}.
|
||||
* allowing it to be used as a query via method reference, {@code OffsetTime::from}.
|
||||
*
|
||||
* @param temporal the temporal object to convert, not null
|
||||
* @return the offset time, not null
|
||||
@ -402,7 +402,7 @@ public final class OffsetTime
|
||||
/**
|
||||
* Checks if the specified unit is supported.
|
||||
* <p>
|
||||
* This checks if the specified unit can be added to, or subtracted from, this date-time.
|
||||
* This checks if the specified unit can be added to, or subtracted from, this offset-time.
|
||||
* If false, then calling the {@link #plus(long, TemporalUnit)} and
|
||||
* {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
|
||||
* <p>
|
||||
@ -473,7 +473,7 @@ public final class OffsetTime
|
||||
/**
|
||||
* Gets the value of the specified field from this time as an {@code int}.
|
||||
* <p>
|
||||
* This queries this time for the value for the specified field.
|
||||
* This queries this time for the value of the specified field.
|
||||
* The returned value will always be within the valid range of values for the field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
@ -481,7 +481,7 @@ public final class OffsetTime
|
||||
* If the field is a {@link ChronoField} then the query is implemented here.
|
||||
* The {@link #isSupported(TemporalField) supported fields} will return valid
|
||||
* values based on this time, except {@code NANO_OF_DAY} and {@code MICRO_OF_DAY}
|
||||
* which are too large to fit in an {@code int} and throw a {@code DateTimeException}.
|
||||
* which are too large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
|
||||
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
|
||||
* <p>
|
||||
* If the field is not a {@code ChronoField}, then the result of this method
|
||||
@ -505,7 +505,7 @@ public final class OffsetTime
|
||||
/**
|
||||
* Gets the value of the specified field from this time as a {@code long}.
|
||||
* <p>
|
||||
* This queries this time for the value for the specified field.
|
||||
* This queries this time for the value of the specified field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
* <p>
|
||||
@ -575,7 +575,7 @@ public final class OffsetTime
|
||||
* <p>
|
||||
* This method returns an object with the specified {@code ZoneOffset} and a {@code LocalTime}
|
||||
* adjusted by the difference between the two offsets.
|
||||
* This will result in the old and new objects representing the same instant an an implied day.
|
||||
* This will result in the old and new objects representing the same instant on an implied day.
|
||||
* This is useful for finding the local time in a different offset.
|
||||
* For example, if this time represents {@code 10:30+02:00} and the offset specified is
|
||||
* {@code +03:00}, then this method will return {@code 11:30+03:00}.
|
||||
@ -737,7 +737,7 @@ public final class OffsetTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetTime} with the hour-of-day value altered.
|
||||
* Returns a copy of this {@code OffsetTime} with the hour-of-day altered.
|
||||
* <p>
|
||||
* The offset does not affect the calculation and will be the same in the result.
|
||||
* <p>
|
||||
@ -752,7 +752,7 @@ public final class OffsetTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetTime} with the minute-of-hour value altered.
|
||||
* Returns a copy of this {@code OffsetTime} with the minute-of-hour altered.
|
||||
* <p>
|
||||
* The offset does not affect the calculation and will be the same in the result.
|
||||
* <p>
|
||||
@ -767,7 +767,7 @@ public final class OffsetTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetTime} with the second-of-minute value altered.
|
||||
* Returns a copy of this {@code OffsetTime} with the second-of-minute altered.
|
||||
* <p>
|
||||
* The offset does not affect the calculation and will be the same in the result.
|
||||
* <p>
|
||||
@ -782,7 +782,7 @@ public final class OffsetTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetTime} with the nano-of-second value altered.
|
||||
* Returns a copy of this {@code OffsetTime} with the nano-of-second altered.
|
||||
* <p>
|
||||
* The offset does not affect the calculation and will be the same in the result.
|
||||
* <p>
|
||||
@ -884,7 +884,7 @@ public final class OffsetTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetTime} with the specified period in hours added.
|
||||
* Returns a copy of this {@code OffsetTime} with the specified number of hours added.
|
||||
* <p>
|
||||
* This adds the specified number of hours to this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -899,7 +899,7 @@ public final class OffsetTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetTime} with the specified period in minutes added.
|
||||
* Returns a copy of this {@code OffsetTime} with the specified number of minutes added.
|
||||
* <p>
|
||||
* This adds the specified number of minutes to this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -914,7 +914,7 @@ public final class OffsetTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetTime} with the specified period in seconds added.
|
||||
* Returns a copy of this {@code OffsetTime} with the specified number of seconds added.
|
||||
* <p>
|
||||
* This adds the specified number of seconds to this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -929,7 +929,7 @@ public final class OffsetTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetTime} with the specified period in nanoseconds added.
|
||||
* Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds added.
|
||||
* <p>
|
||||
* This adds the specified number of nanoseconds to this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -995,7 +995,7 @@ public final class OffsetTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetTime} with the specified period in hours subtracted.
|
||||
* Returns a copy of this {@code OffsetTime} with the specified number of hours subtracted.
|
||||
* <p>
|
||||
* This subtracts the specified number of hours from this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -1010,7 +1010,7 @@ public final class OffsetTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetTime} with the specified period in minutes subtracted.
|
||||
* Returns a copy of this {@code OffsetTime} with the specified number of minutes subtracted.
|
||||
* <p>
|
||||
* This subtracts the specified number of minutes from this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -1025,7 +1025,7 @@ public final class OffsetTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetTime} with the specified period in seconds subtracted.
|
||||
* Returns a copy of this {@code OffsetTime} with the specified number of seconds subtracted.
|
||||
* <p>
|
||||
* This subtracts the specified number of seconds from this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -1040,7 +1040,7 @@ public final class OffsetTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code OffsetTime} with the specified period in nanoseconds subtracted.
|
||||
* Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds subtracted.
|
||||
* <p>
|
||||
* This subtracts the specified number of nanoseconds from this time, returning a new time.
|
||||
* The calculation wraps around midnight.
|
||||
@ -1130,7 +1130,7 @@ public final class OffsetTime
|
||||
* objects in terms of a single {@code TemporalUnit}.
|
||||
* The start and end points are {@code this} and the specified time.
|
||||
* The result will be negative if the end is before the start.
|
||||
* For example, the period in hours between two times can be calculated
|
||||
* For example, the amount in hours between two times can be calculated
|
||||
* using {@code startTime.until(endTime, HOURS)}.
|
||||
* <p>
|
||||
* The {@code Temporal} passed to this method is converted to a
|
||||
@ -1140,7 +1140,7 @@ public final class OffsetTime
|
||||
* <p>
|
||||
* The calculation returns a whole number, representing the number of
|
||||
* complete units between the two times.
|
||||
* For example, the period in hours between 11:30Z and 13:29Z will only
|
||||
* For example, the amount in hours between 11:30Z and 13:29Z will only
|
||||
* be one hour as it is one minute short of two hours.
|
||||
* <p>
|
||||
* There are two equivalent ways of using this method.
|
||||
@ -1165,7 +1165,7 @@ public final class OffsetTime
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
* @param endExclusive the end date, exclusive, which is converted to an {@code OffsetTime}, not null
|
||||
* @param endExclusive the end time, exclusive, which is converted to an {@code OffsetTime}, not null
|
||||
* @param unit the unit to measure the amount in, not null
|
||||
* @return the amount of time between this time and the end time
|
||||
* @throws DateTimeException if the amount cannot be calculated, or the end
|
||||
@ -1258,7 +1258,6 @@ public final class OffsetTime
|
||||
*
|
||||
* @param other the other time to compare to, not null
|
||||
* @return the comparator value, negative if less, positive if greater
|
||||
* @throws NullPointerException if {@code other} is null
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(OffsetTime other) {
|
||||
|
@ -616,7 +616,7 @@ public final class Period
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
* @param amountToAdd the period to add, not null
|
||||
* @param amountToAdd the amount to add, not null
|
||||
* @return a {@code Period} based on this period with the requested period added, not null
|
||||
* @throws DateTimeException if the specified amount has a non-ISO chronology or
|
||||
* contains an invalid unit
|
||||
@ -705,7 +705,7 @@ public final class Period
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
* @param amountToSubtract the period to subtract, not null
|
||||
* @param amountToSubtract the amount to subtract, not null
|
||||
* @return a {@code Period} based on this period with the requested period subtracted, not null
|
||||
* @throws DateTimeException if the specified amount has a non-ISO chronology or
|
||||
* contains an invalid unit
|
||||
|
@ -164,7 +164,7 @@ public final class Year
|
||||
/**
|
||||
* Obtains the current year from the system clock in the default time-zone.
|
||||
* <p>
|
||||
* This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
|
||||
* This will query the {@link Clock#systemDefaultZone() system clock} in the default
|
||||
* time-zone to obtain the current year.
|
||||
* <p>
|
||||
* Using this method will prevent the ability to use an alternate clock for testing
|
||||
@ -179,7 +179,7 @@ public final class Year
|
||||
/**
|
||||
* Obtains the current year from the system clock in the specified time-zone.
|
||||
* <p>
|
||||
* This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current year.
|
||||
* This will query the {@link Clock#system(ZoneId) system clock} to obtain the current year.
|
||||
* Specifying the time-zone avoids dependence on the default time-zone.
|
||||
* <p>
|
||||
* Using this method will prevent the ability to use an alternate clock for testing
|
||||
@ -240,7 +240,7 @@ public final class Year
|
||||
* chronology, or can be converted to a {@code LocalDate}.
|
||||
* <p>
|
||||
* This method matches the signature of the functional interface {@link TemporalQuery}
|
||||
* allowing it to be used in queries via method reference, {@code Year::from}.
|
||||
* allowing it to be used as a query via method reference, {@code Year::from}.
|
||||
*
|
||||
* @param temporal the temporal object to convert, not null
|
||||
* @return the year, not null
|
||||
@ -375,7 +375,7 @@ public final class Year
|
||||
/**
|
||||
* Checks if the specified unit is supported.
|
||||
* <p>
|
||||
* This checks if the specified unit can be added to, or subtracted from, this date-time.
|
||||
* This checks if the specified unit can be added to, or subtracted from, this year.
|
||||
* If false, then calling the {@link #plus(long, TemporalUnit)} and
|
||||
* {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
|
||||
* <p>
|
||||
@ -441,7 +441,7 @@ public final class Year
|
||||
/**
|
||||
* Gets the value of the specified field from this year as an {@code int}.
|
||||
* <p>
|
||||
* This queries this year for the value for the specified field.
|
||||
* This queries this year for the value of the specified field.
|
||||
* The returned value will always be within the valid range of values for the field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
@ -472,7 +472,7 @@ public final class Year
|
||||
/**
|
||||
* Gets the value of the specified field from this year as a {@code long}.
|
||||
* <p>
|
||||
* This queries this year for the value for the specified field.
|
||||
* This queries this year for the value of the specified field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
* <p>
|
||||
@ -720,13 +720,13 @@ public final class Year
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this year with the specified number of years added.
|
||||
* Returns a copy of this {@code Year} with the specified number of years added.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
* @param yearsToAdd the years to add, may be negative
|
||||
* @return a {@code Year} based on this year with the period added, not null
|
||||
* @throws DateTimeException if the result exceeds the supported year range
|
||||
* @return a {@code Year} based on this year with the years added, not null
|
||||
* @throws DateTimeException if the result exceeds the supported range
|
||||
*/
|
||||
public Year plusYears(long yearsToAdd) {
|
||||
if (yearsToAdd == 0) {
|
||||
@ -786,13 +786,13 @@ public final class Year
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this year with the specified number of years subtracted.
|
||||
* Returns a copy of this {@code Year} with the specified number of years subtracted.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
* @param yearsToSubtract the years to subtract, may be negative
|
||||
* @return a {@code Year} based on this year with the period subtracted, not null
|
||||
* @throws DateTimeException if the result exceeds the supported year range
|
||||
* @return a {@code Year} based on this year with the year subtracted, not null
|
||||
* @throws DateTimeException if the result exceeds the supported range
|
||||
*/
|
||||
public Year minusYears(long yearsToSubtract) {
|
||||
return (yearsToSubtract == Long.MIN_VALUE ? plusYears(Long.MAX_VALUE).plusYears(1) : plusYears(-yearsToSubtract));
|
||||
@ -871,12 +871,12 @@ public final class Year
|
||||
* The result will be negative if the end is before the start.
|
||||
* The {@code Temporal} passed to this method is converted to a
|
||||
* {@code Year} using {@link #from(TemporalAccessor)}.
|
||||
* For example, the period in decades between two year can be calculated
|
||||
* For example, the amount in decades between two year can be calculated
|
||||
* using {@code startYear.until(endYear, DECADES)}.
|
||||
* <p>
|
||||
* The calculation returns a whole number, representing the number of
|
||||
* complete units between the two years.
|
||||
* For example, the period in decades between 2012 and 2031
|
||||
* For example, the amount in decades between 2012 and 2031
|
||||
* will only be one decade as it is one year short of two decades.
|
||||
* <p>
|
||||
* There are two equivalent ways of using this method.
|
||||
@ -948,7 +948,7 @@ public final class Year
|
||||
* <p>
|
||||
* The day-of-year value 366 is only valid in a leap year.
|
||||
*
|
||||
* @param dayOfYear the day-of-year to use, not null
|
||||
* @param dayOfYear the day-of-year to use, from 1 to 365-366
|
||||
* @return the local date formed from this year and the specified date of year, not null
|
||||
* @throws DateTimeException if the day of year is zero or less, 366 or greater or equal
|
||||
* to 366 and this is not a leap year
|
||||
@ -1025,7 +1025,7 @@ public final class Year
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this year after the specified year.
|
||||
* Checks if this year is after the specified year.
|
||||
*
|
||||
* @param other the other year to compare to, not null
|
||||
* @return true if this is after the specified year
|
||||
@ -1035,7 +1035,7 @@ public final class Year
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this year before the specified year.
|
||||
* Checks if this year is before the specified year.
|
||||
*
|
||||
* @param other the other year to compare to, not null
|
||||
* @return true if this point is before the specified year
|
||||
|
@ -157,9 +157,8 @@ public final class YearMonth
|
||||
/**
|
||||
* Obtains the current year-month from the system clock in the default time-zone.
|
||||
* <p>
|
||||
* This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
|
||||
* This will query the {@link Clock#systemDefaultZone() system clock} in the default
|
||||
* time-zone to obtain the current year-month.
|
||||
* The zone and offset will be set based on the time-zone in the clock.
|
||||
* <p>
|
||||
* Using this method will prevent the ability to use an alternate clock for testing
|
||||
* because the clock is hard-coded.
|
||||
@ -173,7 +172,7 @@ public final class YearMonth
|
||||
/**
|
||||
* Obtains the current year-month from the system clock in the specified time-zone.
|
||||
* <p>
|
||||
* This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current year-month.
|
||||
* This will query the {@link Clock#system(ZoneId) system clock} to obtain the current year-month.
|
||||
* Specifying the time-zone avoids dependence on the default time-zone.
|
||||
* <p>
|
||||
* Using this method will prevent the ability to use an alternate clock for testing
|
||||
@ -243,7 +242,7 @@ public final class YearMonth
|
||||
* chronology, or can be converted to a {@code LocalDate}.
|
||||
* <p>
|
||||
* This method matches the signature of the functional interface {@link TemporalQuery}
|
||||
* allowing it to be used in queries via method reference, {@code YearMonth::from}.
|
||||
* allowing it to be used as a query via method reference, {@code YearMonth::from}.
|
||||
*
|
||||
* @param temporal the temporal object to convert, not null
|
||||
* @return the year-month, not null
|
||||
@ -363,7 +362,7 @@ public final class YearMonth
|
||||
/**
|
||||
* Checks if the specified unit is supported.
|
||||
* <p>
|
||||
* This checks if the specified unit can be added to, or subtracted from, this date-time.
|
||||
* This checks if the specified unit can be added to, or subtracted from, this year-month.
|
||||
* If false, then calling the {@link #plus(long, TemporalUnit)} and
|
||||
* {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
|
||||
* <p>
|
||||
@ -430,7 +429,7 @@ public final class YearMonth
|
||||
/**
|
||||
* Gets the value of the specified field from this year-month as an {@code int}.
|
||||
* <p>
|
||||
* This queries this year-month for the value for the specified field.
|
||||
* This queries this year-month for the value of the specified field.
|
||||
* The returned value will always be within the valid range of values for the field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
@ -462,7 +461,7 @@ public final class YearMonth
|
||||
/**
|
||||
* Gets the value of the specified field from this year-month as a {@code long}.
|
||||
* <p>
|
||||
* This queries this year-month for the value for the specified field.
|
||||
* This queries this year-month for the value of the specified field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
* <p>
|
||||
@ -819,7 +818,7 @@ public final class YearMonth
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this year-month with the specified period in years added.
|
||||
* Returns a copy of this {@code YearMonth} with the specified number of years added.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -836,7 +835,7 @@ public final class YearMonth
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this year-month with the specified period in months added.
|
||||
* Returns a copy of this {@code YearMonth} with the specified number of months added.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -906,7 +905,7 @@ public final class YearMonth
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this year-month with the specified period in years subtracted.
|
||||
* Returns a copy of this {@code YearMonth} with the specified number of years subtracted.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -919,7 +918,7 @@ public final class YearMonth
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this year-month with the specified period in months subtracted.
|
||||
* Returns a copy of this {@code YearMonth} with the specified number of months subtracted.
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
@ -1004,12 +1003,12 @@ public final class YearMonth
|
||||
* The result will be negative if the end is before the start.
|
||||
* The {@code Temporal} passed to this method is converted to a
|
||||
* {@code YearMonth} using {@link #from(TemporalAccessor)}.
|
||||
* For example, the period in years between two year-months can be calculated
|
||||
* For example, the amount in years between two year-months can be calculated
|
||||
* using {@code startYearMonth.until(endYearMonth, YEARS)}.
|
||||
* <p>
|
||||
* The calculation returns a whole number, representing the number of
|
||||
* complete units between the two year-months.
|
||||
* For example, the period in decades between 2012-06 and 2032-05
|
||||
* For example, the amount in decades between 2012-06 and 2032-05
|
||||
* will only be one decade as it is one month short of two decades.
|
||||
* <p>
|
||||
* There are two equivalent ways of using this method.
|
||||
@ -1134,7 +1133,7 @@ public final class YearMonth
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this year-month after the specified year-month.
|
||||
* Checks if this year-month is after the specified year-month.
|
||||
*
|
||||
* @param other the other year-month to compare to, not null
|
||||
* @return true if this is after the specified year-month
|
||||
@ -1144,7 +1143,7 @@ public final class YearMonth
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this year-month before the specified year-month.
|
||||
* Checks if this year-month is before the specified year-month.
|
||||
*
|
||||
* @param other the other year-month to compare to, not null
|
||||
* @return true if this point is before the specified year-month
|
||||
|
@ -453,7 +453,7 @@ public abstract class ZoneId implements Serializable {
|
||||
* zones over offset-based zones using {@link TemporalQueries#zone()}.
|
||||
* <p>
|
||||
* This method matches the signature of the functional interface {@link TemporalQuery}
|
||||
* allowing it to be used in queries via method reference, {@code ZoneId::from}.
|
||||
* allowing it to be used as a query via method reference, {@code ZoneId::from}.
|
||||
*
|
||||
* @param temporal the temporal object to convert, not null
|
||||
* @return the zone ID, not null
|
||||
|
@ -89,7 +89,7 @@ import java.util.concurrent.ConcurrentMap;
|
||||
/**
|
||||
* A time-zone offset from Greenwich/UTC, such as {@code +02:00}.
|
||||
* <p>
|
||||
* A time-zone offset is the period of time that a time-zone differs from Greenwich/UTC.
|
||||
* A time-zone offset is the amount of time that a time-zone differs from Greenwich/UTC.
|
||||
* This is usually a fixed number of hours and minutes.
|
||||
* <p>
|
||||
* Different parts of the world have different time-zone offsets.
|
||||
@ -334,7 +334,7 @@ public final class ZoneOffset
|
||||
* on extracting the {@link ChronoField#OFFSET_SECONDS OFFSET_SECONDS} field.
|
||||
* <p>
|
||||
* This method matches the signature of the functional interface {@link TemporalQuery}
|
||||
* allowing it to be used in queries via method reference, {@code ZoneOffset::from}.
|
||||
* allowing it to be used as a query via method reference, {@code ZoneOffset::from}.
|
||||
*
|
||||
* @param temporal the temporal object to convert, not null
|
||||
* @return the zone-offset, not null
|
||||
@ -564,7 +564,7 @@ public final class ZoneOffset
|
||||
/**
|
||||
* Gets the value of the specified field from this offset as an {@code int}.
|
||||
* <p>
|
||||
* This queries this offset for the value for the specified field.
|
||||
* This queries this offset for the value of the specified field.
|
||||
* The returned value will always be within the valid range of values for the field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
@ -599,7 +599,7 @@ public final class ZoneOffset
|
||||
/**
|
||||
* Gets the value of the specified field from this offset as a {@code long}.
|
||||
* <p>
|
||||
* This queries this offset for the value for the specified field.
|
||||
* This queries this offset for the value of the specified field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
* <p>
|
||||
|
@ -418,7 +418,7 @@ public final class ZonedDateTime
|
||||
* <p>
|
||||
* Converting an instant to a zoned date-time is simple as there is only one valid
|
||||
* offset for each instant. If the valid offset is different to the offset specified,
|
||||
* the the date-time and offset of the zoned date-time will differ from those specified.
|
||||
* then the date-time and offset of the zoned date-time will differ from those specified.
|
||||
* <p>
|
||||
* If the {@code ZoneId} to be used is a {@code ZoneOffset}, this method is equivalent
|
||||
* to {@link #of(LocalDateTime, ZoneId)}.
|
||||
@ -469,6 +469,7 @@ public final class ZonedDateTime
|
||||
* @param offset the zone offset, not null
|
||||
* @param zone the time-zone, not null
|
||||
* @return the zoned date-time, not null
|
||||
* @throws DateTimeException if the combination of arguments is invalid
|
||||
*/
|
||||
public static ZonedDateTime ofStrict(LocalDateTime localDateTime, ZoneOffset offset, ZoneId zone) {
|
||||
Objects.requireNonNull(localDateTime, "localDateTime");
|
||||
@ -538,7 +539,7 @@ public final class ZonedDateTime
|
||||
* those fields that are equivalent to the relevant objects.
|
||||
* <p>
|
||||
* This method matches the signature of the functional interface {@link TemporalQuery}
|
||||
* allowing it to be used in queries via method reference, {@code ZonedDateTime::from}.
|
||||
* allowing it to be used as a query via method reference, {@code ZonedDateTime::from}.
|
||||
*
|
||||
* @param temporal the temporal object to convert, not null
|
||||
* @return the zoned date-time, not null
|
||||
@ -782,7 +783,7 @@ public final class ZonedDateTime
|
||||
/**
|
||||
* Gets the value of the specified field from this date-time as an {@code int}.
|
||||
* <p>
|
||||
* This queries this date-time for the value for the specified field.
|
||||
* This queries this date-time for the value of the specified field.
|
||||
* The returned value will always be within the valid range of values for the field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
@ -791,7 +792,7 @@ public final class ZonedDateTime
|
||||
* The {@link #isSupported(TemporalField) supported fields} will return valid
|
||||
* values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY},
|
||||
* {@code EPOCH_DAY}, {@code PROLEPTIC_MONTH} and {@code INSTANT_SECONDS} which are too
|
||||
* large to fit in an {@code int} and throw a {@code DateTimeException}.
|
||||
* large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
|
||||
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
|
||||
* <p>
|
||||
* If the field is not a {@code ChronoField}, then the result of this method
|
||||
@ -824,7 +825,7 @@ public final class ZonedDateTime
|
||||
/**
|
||||
* Gets the value of the specified field from this date-time as a {@code long}.
|
||||
* <p>
|
||||
* This queries this date-time for the value for the specified field.
|
||||
* This queries this date-time for the value of the specified field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
* <p>
|
||||
@ -1182,7 +1183,8 @@ public final class ZonedDateTime
|
||||
* <p>
|
||||
* A simple adjuster might simply set the one of the fields, such as the year field.
|
||||
* A more complex adjuster might set the date to the last day of the month.
|
||||
* A selection of common adjustments is provided in {@link TemporalAdjuster}.
|
||||
* A selection of common adjustments is provided in
|
||||
* {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
|
||||
* These include finding the "last day of the month" and "next Wednesday".
|
||||
* Key date-time classes also implement the {@code TemporalAdjuster} interface,
|
||||
* such as {@link Month} and {@link java.time.MonthDay MonthDay}.
|
||||
@ -1192,7 +1194,7 @@ public final class ZonedDateTime
|
||||
* For example this code returns a date on the last day of July:
|
||||
* <pre>
|
||||
* import static java.time.Month.*;
|
||||
* import static java.time.temporal.Adjusters.*;
|
||||
* import static java.time.temporal.TemporalAdjusters.*;
|
||||
*
|
||||
* result = zonedDateTime.with(JULY).with(lastDayOfMonth());
|
||||
* </pre>
|
||||
@ -1313,7 +1315,7 @@ public final class ZonedDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the year value altered.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the year altered.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@link LocalDateTime#withYear(int) changing the year} of the local date-time.
|
||||
@ -1335,7 +1337,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the month-of-year value altered.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the month-of-year altered.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@link LocalDateTime#withMonth(int) changing the month} of the local date-time.
|
||||
@ -1357,7 +1359,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the day-of-month value altered.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the day-of-month altered.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@link LocalDateTime#withDayOfMonth(int) changing the day-of-month} of the local date-time.
|
||||
@ -1404,7 +1406,7 @@ public final class ZonedDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the hour-of-day value altered.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the hour-of-day altered.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@linkplain LocalDateTime#withHour(int) changing the time} of the local date-time.
|
||||
@ -1426,7 +1428,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the minute-of-hour value altered.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the minute-of-hour altered.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@linkplain LocalDateTime#withMinute(int) changing the time} of the local date-time.
|
||||
@ -1448,7 +1450,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the second-of-minute value altered.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the second-of-minute altered.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@linkplain LocalDateTime#withSecond(int) changing the time} of the local date-time.
|
||||
@ -1470,7 +1472,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the nano-of-second value altered.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the nano-of-second altered.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@linkplain LocalDateTime#withNano(int) changing the time} of the local date-time.
|
||||
@ -1506,7 +1508,7 @@ public final class ZonedDateTime
|
||||
* {@link ChronoUnit#DAYS DAYS}. Other units throw an exception.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@link LocalDateTime#truncatedTo(java.time.temporal.TemporalUnit) truncating}
|
||||
* {@link LocalDateTime#truncatedTo(TemporalUnit) truncating}
|
||||
* the underlying local date-time. This is then converted back to a
|
||||
* {@code ZonedDateTime}, using the zone ID to obtain the offset.
|
||||
* <p>
|
||||
@ -1607,7 +1609,7 @@ public final class ZonedDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in years added.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of years added.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@link LocalDateTime#plusYears(long) adding years} to the local date-time.
|
||||
@ -1629,7 +1631,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in months added.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of months added.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@link LocalDateTime#plusMonths(long) adding months} to the local date-time.
|
||||
@ -1651,7 +1653,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in weeks added.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of weeks added.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@link LocalDateTime#plusWeeks(long) adding weeks} to the local date-time.
|
||||
@ -1673,7 +1675,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in days added.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of days added.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@link LocalDateTime#plusDays(long) adding days} to the local date-time.
|
||||
@ -1696,7 +1698,7 @@ public final class ZonedDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in hours added.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of hours added.
|
||||
* <p>
|
||||
* This operates on the instant time-line, such that adding one hour will
|
||||
* always be a duration of one hour later.
|
||||
@ -1724,7 +1726,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in minutes added.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of minutes added.
|
||||
* <p>
|
||||
* This operates on the instant time-line, such that adding one minute will
|
||||
* always be a duration of one minute later.
|
||||
@ -1742,7 +1744,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in seconds added.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of seconds added.
|
||||
* <p>
|
||||
* This operates on the instant time-line, such that adding one second will
|
||||
* always be a duration of one second later.
|
||||
@ -1760,7 +1762,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in nanoseconds added.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of nanoseconds added.
|
||||
* <p>
|
||||
* This operates on the instant time-line, such that adding one nano will
|
||||
* always be a duration of one nano later.
|
||||
@ -1848,7 +1850,7 @@ public final class ZonedDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in years subtracted.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of years subtracted.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@link LocalDateTime#minusYears(long) subtracting years} to the local date-time.
|
||||
@ -1870,7 +1872,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in months subtracted.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of months subtracted.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@link LocalDateTime#minusMonths(long) subtracting months} to the local date-time.
|
||||
@ -1892,7 +1894,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in weeks subtracted.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of weeks subtracted.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@link LocalDateTime#minusWeeks(long) subtracting weeks} to the local date-time.
|
||||
@ -1914,7 +1916,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in days subtracted.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of days subtracted.
|
||||
* <p>
|
||||
* This operates on the local time-line,
|
||||
* {@link LocalDateTime#minusDays(long) subtracting days} to the local date-time.
|
||||
@ -1937,7 +1939,7 @@ public final class ZonedDateTime
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in hours subtracted.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of hours subtracted.
|
||||
* <p>
|
||||
* This operates on the instant time-line, such that subtracting one hour will
|
||||
* always be a duration of one hour earlier.
|
||||
@ -1965,7 +1967,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in minutes subtracted.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of minutes subtracted.
|
||||
* <p>
|
||||
* This operates on the instant time-line, such that subtracting one minute will
|
||||
* always be a duration of one minute earlier.
|
||||
@ -1983,7 +1985,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in seconds subtracted.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of seconds subtracted.
|
||||
* <p>
|
||||
* This operates on the instant time-line, such that subtracting one second will
|
||||
* always be a duration of one second earlier.
|
||||
@ -2001,7 +2003,7 @@ public final class ZonedDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified period in nanoseconds subtracted.
|
||||
* Returns a copy of this {@code ZonedDateTime} with the specified number of nanoseconds subtracted.
|
||||
* <p>
|
||||
* This operates on the instant time-line, such that subtracting one nano will
|
||||
* always be a duration of one nano earlier.
|
||||
@ -2028,7 +2030,7 @@ public final class ZonedDateTime
|
||||
* what the result of this method will be.
|
||||
* <p>
|
||||
* The result of this method is obtained by invoking the
|
||||
* {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
|
||||
* {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
|
||||
* specified query passing {@code this} as the argument.
|
||||
*
|
||||
* @param <R> the type of the result
|
||||
@ -2049,7 +2051,7 @@ public final class ZonedDateTime
|
||||
* objects in terms of a single {@code TemporalUnit}.
|
||||
* The start and end points are {@code this} and the specified date-time.
|
||||
* The result will be negative if the end is before the start.
|
||||
* For example, the period in days between two date-times can be calculated
|
||||
* For example, the amount in days between two date-times can be calculated
|
||||
* using {@code startDateTime.until(endDateTime, DAYS)}.
|
||||
* <p>
|
||||
* The {@code Temporal} passed to this method is converted to a
|
||||
@ -2059,7 +2061,7 @@ public final class ZonedDateTime
|
||||
* <p>
|
||||
* The calculation returns a whole number, representing the number of
|
||||
* complete units between the two date-times.
|
||||
* For example, the period in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
|
||||
* For example, the amount in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
|
||||
* will only be one month as it is one minute short of two months.
|
||||
* <p>
|
||||
* There are two equivalent ways of using this method.
|
||||
|
@ -249,8 +249,8 @@ public interface ChronoLocalDate
|
||||
* This allows dates in different calendar systems to be compared based
|
||||
* on the position of the date on the local time-line.
|
||||
* The underlying comparison is equivalent to comparing the epoch-day.
|
||||
* @return a comparator that compares in time-line order ignoring the chronology
|
||||
*
|
||||
* @return a comparator that compares in time-line order ignoring the chronology
|
||||
* @see #isAfter
|
||||
* @see #isBefore
|
||||
* @see #isEqual
|
||||
|
@ -227,7 +227,7 @@ abstract class ChronoLocalDateImpl<D extends ChronoLocalDate>
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this date with the specified period in years added.
|
||||
* Returns a copy of this date with the specified number of years added.
|
||||
* <p>
|
||||
* This adds the specified period in years to the date.
|
||||
* In some cases, adding years can cause the resulting date to become invalid.
|
||||
@ -243,7 +243,7 @@ abstract class ChronoLocalDateImpl<D extends ChronoLocalDate>
|
||||
abstract D plusYears(long yearsToAdd);
|
||||
|
||||
/**
|
||||
* Returns a copy of this date with the specified period in months added.
|
||||
* Returns a copy of this date with the specified number of months added.
|
||||
* <p>
|
||||
* This adds the specified period in months to the date.
|
||||
* In some cases, adding months can cause the resulting date to become invalid.
|
||||
@ -259,7 +259,7 @@ abstract class ChronoLocalDateImpl<D extends ChronoLocalDate>
|
||||
abstract D plusMonths(long monthsToAdd);
|
||||
|
||||
/**
|
||||
* Returns a copy of this date with the specified period in weeks added.
|
||||
* Returns a copy of this date with the specified number of weeks added.
|
||||
* <p>
|
||||
* This adds the specified period in weeks to the date.
|
||||
* In some cases, adding weeks can cause the resulting date to become invalid.
|
||||
@ -292,7 +292,7 @@ abstract class ChronoLocalDateImpl<D extends ChronoLocalDate>
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a copy of this date with the specified period in years subtracted.
|
||||
* Returns a copy of this date with the specified number of years subtracted.
|
||||
* <p>
|
||||
* This subtracts the specified period in years to the date.
|
||||
* In some cases, subtracting years can cause the resulting date to become invalid.
|
||||
@ -313,7 +313,7 @@ abstract class ChronoLocalDateImpl<D extends ChronoLocalDate>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this date with the specified period in months subtracted.
|
||||
* Returns a copy of this date with the specified number of months subtracted.
|
||||
* <p>
|
||||
* This subtracts the specified period in months to the date.
|
||||
* In some cases, subtracting months can cause the resulting date to become invalid.
|
||||
@ -334,7 +334,7 @@ abstract class ChronoLocalDateImpl<D extends ChronoLocalDate>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy of this date with the specified period in weeks subtracted.
|
||||
* Returns a copy of this date with the specified number of weeks subtracted.
|
||||
* <p>
|
||||
* This subtracts the specified period in weeks to the date.
|
||||
* In some cases, subtracting weeks can cause the resulting date to become invalid.
|
||||
|
@ -131,7 +131,6 @@ public interface ChronoLocalDateTime<D extends ChronoLocalDate>
|
||||
* The underlying comparison is equivalent to comparing the epoch-day and nano-of-day.
|
||||
*
|
||||
* @return a comparator that compares in time-line order ignoring the chronology
|
||||
*
|
||||
* @see #isAfter
|
||||
* @see #isBefore
|
||||
* @see #isEqual
|
||||
@ -323,7 +322,7 @@ public interface ChronoLocalDateTime<D extends ChronoLocalDate>
|
||||
* what the result of this method will be.
|
||||
* <p>
|
||||
* The result of this method is obtained by invoking the
|
||||
* {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
|
||||
* {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
|
||||
* specified query passing {@code this} as the argument.
|
||||
*
|
||||
* @param <R> the type of the result
|
||||
|
@ -132,7 +132,6 @@ public interface ChronoZonedDateTime<D extends ChronoLocalDate>
|
||||
* The underlying comparison is equivalent to comparing the epoch-second and nano-of-second.
|
||||
*
|
||||
* @return a comparator that compares in time-line order ignoring the chronology
|
||||
*
|
||||
* @see #isAfter
|
||||
* @see #isBefore
|
||||
* @see #isEqual
|
||||
@ -292,7 +291,7 @@ public interface ChronoZonedDateTime<D extends ChronoLocalDate>
|
||||
* <p>
|
||||
* This instance is immutable and unaffected by this method call.
|
||||
*
|
||||
* @return a {@code ZoneChronoDateTime} based on this date-time with the earlier offset, not null
|
||||
* @return a {@code ChronoZonedDateTime} based on this date-time with the earlier offset, not null
|
||||
* @throws DateTimeException if no rules can be found for the zone
|
||||
* @throws DateTimeException if no rules are valid for this date-time
|
||||
*/
|
||||
@ -319,7 +318,7 @@ public interface ChronoZonedDateTime<D extends ChronoLocalDate>
|
||||
ChronoZonedDateTime<D> withLaterOffsetAtOverlap();
|
||||
|
||||
/**
|
||||
* Returns a copy of this ZonedDateTime with a different time-zone,
|
||||
* Returns a copy of this date-time with a different time-zone,
|
||||
* retaining the local date-time if possible.
|
||||
* <p>
|
||||
* This method changes the time-zone and retains the local date-time.
|
||||
@ -470,7 +469,7 @@ public interface ChronoZonedDateTime<D extends ChronoLocalDate>
|
||||
* what the result of this method will be.
|
||||
* <p>
|
||||
* The result of this method is obtained by invoking the
|
||||
* {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
|
||||
* {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
|
||||
* specified query passing {@code this} as the argument.
|
||||
*
|
||||
* @param <R> the type of the result
|
||||
|
@ -132,8 +132,9 @@ import java.util.Set;
|
||||
* The set of available chronologies can be extended by applications.
|
||||
* Adding a new calendar system requires the writing of an implementation of
|
||||
* {@code Chronology}, {@code ChronoLocalDate} and {@code Era}.
|
||||
* The majority of the logic specific to the calendar system will be in
|
||||
* {@code ChronoLocalDate}. The {@code Chronology} subclass acts as a factory.
|
||||
* The majority of the logic specific to the calendar system will be in the
|
||||
* {@code ChronoLocalDate} implementation.
|
||||
* The {@code Chronology} implementation acts as a factory.
|
||||
* <p>
|
||||
* To permit the discovery of additional chronologies, the {@link java.util.ServiceLoader ServiceLoader}
|
||||
* is used. A file must be added to the {@code META-INF/services} directory with the
|
||||
@ -167,7 +168,7 @@ public interface Chronology extends Comparable<Chronology> {
|
||||
* If the specified temporal object does not have a chronology, {@link IsoChronology} is returned.
|
||||
* <p>
|
||||
* This method matches the signature of the functional interface {@link TemporalQuery}
|
||||
* allowing it to be used in queries via method reference, {@code Chronology::from}.
|
||||
* allowing it to be used as a query via method reference, {@code Chronology::from}.
|
||||
*
|
||||
* @param temporal the temporal to convert, not null
|
||||
* @return the chronology, not null
|
||||
@ -413,7 +414,7 @@ public interface Chronology extends Comparable<Chronology> {
|
||||
* The alternate clock may be introduced using {@link Clock dependency injection}.
|
||||
*
|
||||
* @implSpec
|
||||
* The default implementation invokes {@link #date(TemporalAccessor)} )}.
|
||||
* The default implementation invokes {@link #date(TemporalAccessor)}.
|
||||
*
|
||||
* @param clock the clock to use, not null
|
||||
* @return the current local date, not null
|
||||
@ -622,7 +623,7 @@ public interface Chronology extends Comparable<Chronology> {
|
||||
* The parameters control the style of the returned text and the locale.
|
||||
*
|
||||
* @implSpec
|
||||
* The default implementation behaves as the the formatter was used to
|
||||
* The default implementation behaves as though the formatter was used to
|
||||
* format the chronology textual name.
|
||||
*
|
||||
* @param style the style of the text required, not null
|
||||
|
@ -182,7 +182,7 @@ public interface Era extends TemporalAccessor, TemporalAdjuster {
|
||||
/**
|
||||
* Gets the value of the specified field from this era as an {@code int}.
|
||||
* <p>
|
||||
* This queries this era for the value for the specified field.
|
||||
* This queries this era for the value of the specified field.
|
||||
* The returned value will always be within the valid range of values for the field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
@ -215,7 +215,7 @@ public interface Era extends TemporalAccessor, TemporalAdjuster {
|
||||
/**
|
||||
* Gets the value of the specified field from this era as a {@code long}.
|
||||
* <p>
|
||||
* This queries this era for the value for the specified field.
|
||||
* This queries this era for the value of the specified field.
|
||||
* If it is not possible to return the value, because the field is not supported
|
||||
* or for some other reason, an exception is thrown.
|
||||
* <p>
|
||||
|
@ -394,7 +394,7 @@ public final class HijrahChronology extends AbstractChronology implements Serial
|
||||
* Gets the ID of the chronology.
|
||||
* <p>
|
||||
* The ID uniquely identifies the {@code Chronology}. It can be used to
|
||||
* lookup the {@code Chronology} using {@link #of(String)}.
|
||||
* lookup the {@code Chronology} using {@link Chronology#of(String)}.
|
||||
*
|
||||
* @return the chronology ID, non-null
|
||||
* @see #getCalendarType()
|
||||
@ -409,7 +409,7 @@ public final class HijrahChronology extends AbstractChronology implements Serial
|
||||
* <p>
|
||||
* The calendar type is an identifier defined by the
|
||||
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
|
||||
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
|
||||
* It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
|
||||
*
|
||||
* @return the calendar system type; non-null if the calendar has
|
||||
* a standard type, otherwise null
|
||||
|
@ -143,7 +143,7 @@ public final class IsoChronology extends AbstractChronology implements Serializa
|
||||
* Gets the ID of the chronology - 'ISO'.
|
||||
* <p>
|
||||
* The ID uniquely identifies the {@code Chronology}.
|
||||
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
|
||||
* It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
|
||||
*
|
||||
* @return the chronology ID - 'ISO'
|
||||
* @see #getCalendarType()
|
||||
@ -158,7 +158,7 @@ public final class IsoChronology extends AbstractChronology implements Serializa
|
||||
* <p>
|
||||
* The calendar type is an identifier defined by the
|
||||
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
|
||||
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
|
||||
* It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
|
||||
* It can also be used as part of a locale, accessible via
|
||||
* {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
|
||||
*
|
||||
|
@ -150,7 +150,7 @@ public final class JapaneseChronology extends AbstractChronology implements Seri
|
||||
* Gets the ID of the chronology - 'Japanese'.
|
||||
* <p>
|
||||
* The ID uniquely identifies the {@code Chronology}.
|
||||
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
|
||||
* It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
|
||||
*
|
||||
* @return the chronology ID - 'Japanese'
|
||||
* @see #getCalendarType()
|
||||
@ -165,7 +165,7 @@ public final class JapaneseChronology extends AbstractChronology implements Seri
|
||||
* <p>
|
||||
* The calendar type is an identifier defined by the
|
||||
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
|
||||
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
|
||||
* It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
|
||||
* It can also be used as part of a locale, accessible via
|
||||
* {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
|
||||
*
|
||||
|
@ -132,7 +132,7 @@ public final class MinguoChronology extends AbstractChronology implements Serial
|
||||
* Gets the ID of the chronology - 'Minguo'.
|
||||
* <p>
|
||||
* The ID uniquely identifies the {@code Chronology}.
|
||||
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
|
||||
* It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
|
||||
*
|
||||
* @return the chronology ID - 'Minguo'
|
||||
* @see #getCalendarType()
|
||||
@ -147,7 +147,7 @@ public final class MinguoChronology extends AbstractChronology implements Serial
|
||||
* <p>
|
||||
* The calendar type is an identifier defined by the
|
||||
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
|
||||
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
|
||||
* It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
|
||||
* It can also be used as part of a locale, accessible via
|
||||
* {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
|
||||
*
|
||||
|
@ -168,7 +168,7 @@ public final class ThaiBuddhistChronology extends AbstractChronology implements
|
||||
* Gets the ID of the chronology - 'ThaiBuddhist'.
|
||||
* <p>
|
||||
* The ID uniquely identifies the {@code Chronology}.
|
||||
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
|
||||
* It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
|
||||
*
|
||||
* @return the chronology ID - 'ThaiBuddhist'
|
||||
* @see #getCalendarType()
|
||||
@ -183,7 +183,7 @@ public final class ThaiBuddhistChronology extends AbstractChronology implements
|
||||
* <p>
|
||||
* The calendar type is an identifier defined by the
|
||||
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
|
||||
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
|
||||
* It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
|
||||
* It can also be used as part of a locale, accessible via
|
||||
* {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
|
||||
*
|
||||
|
@ -117,7 +117,7 @@ import java.util.Set;
|
||||
* {@code parse(CharSequence text, DateTimeFormatter formatter)}.
|
||||
* <p>For example:
|
||||
* <blockquote><pre>
|
||||
* String text = date.toString(formatter);
|
||||
* String text = date.format(formatter);
|
||||
* LocalDate date = LocalDate.parse(text, formatter);
|
||||
* </pre></blockquote>
|
||||
* <p>
|
||||
@ -266,7 +266,7 @@ import java.util.Set;
|
||||
* For example:
|
||||
* <blockquote><pre>
|
||||
* DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy MM dd");
|
||||
* String text = date.toString(formatter);
|
||||
* String text = date.format(formatter);
|
||||
* LocalDate date = LocalDate.parse(text, formatter);
|
||||
* </pre></blockquote>
|
||||
* <p>
|
||||
@ -1976,7 +1976,7 @@ public final class DateTimeFormatter {
|
||||
* Errors are returned using the error index field of the {@code ParsePosition}
|
||||
* instead of {@code DateTimeParseException}.
|
||||
* The returned error index will be set to an index indicative of the error.
|
||||
* Callers must check for errors before using the context.
|
||||
* Callers must check for errors before using the result.
|
||||
* <p>
|
||||
* If the formatter parses the same field more than once with different values,
|
||||
* the result will be an error.
|
||||
|
@ -137,7 +137,6 @@ import sun.util.locale.provider.TimeZoneNameUtility;
|
||||
* <li>ChronologyText - the name of the chronology</li>
|
||||
* <li>Literal - a text literal</li>
|
||||
* <li>Nested and Optional - formats can be nested or made optional</li>
|
||||
* <li>Other - the printer and parser interfaces can be used to add user supplied formatting</li>
|
||||
* </ul>
|
||||
* In addition, any of the elements may be decorated by padding, either with spaces or any other character.
|
||||
* <p>
|
||||
@ -194,8 +193,8 @@ public final class DateTimeFormatterBuilder {
|
||||
* The locale and chronology are used to lookup the locale specific format
|
||||
* for the requested dateStyle and/or timeStyle.
|
||||
*
|
||||
* @param dateStyle the FormatStyle for the date
|
||||
* @param timeStyle the FormatStyle for the time
|
||||
* @param dateStyle the FormatStyle for the date, null for time-only pattern
|
||||
* @param timeStyle the FormatStyle for the time, null for date-only pattern
|
||||
* @param chrono the Chronology, non-null
|
||||
* @param locale the locale, non-null
|
||||
* @return the locale and Chronology specific formatting pattern
|
||||
@ -747,9 +746,9 @@ public final class DateTimeFormatterBuilder {
|
||||
* defines the connection between each value and the text:
|
||||
* <pre>
|
||||
* Map<Long, String> map = new HashMap<>();
|
||||
* map.put(1, "JNY");
|
||||
* map.put(2, "FBY");
|
||||
* map.put(3, "MCH");
|
||||
* map.put(1L, "JNY");
|
||||
* map.put(2L, "FBY");
|
||||
* map.put(3L, "MCH");
|
||||
* ...
|
||||
* builder.appendText(MONTH_OF_YEAR, map);
|
||||
* </pre>
|
||||
@ -841,7 +840,7 @@ public final class DateTimeFormatterBuilder {
|
||||
* <p>
|
||||
* The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
|
||||
* The end-of-day time of '24:00' is handled as midnight at the start of the following day.
|
||||
* The leap-second time of '23:59:59' is handled to some degree, see
|
||||
* The leap-second time of '23:59:60' is handled to some degree, see
|
||||
* {@link DateTimeFormatter#parsedLeapSecond()} for full details.
|
||||
* <p>
|
||||
* An alternative to this method is to format/parse the instant as a single
|
||||
@ -864,7 +863,7 @@ public final class DateTimeFormatterBuilder {
|
||||
* Appends the zone offset, such as '+01:00', to the formatter.
|
||||
* <p>
|
||||
* This appends an instruction to format/parse the offset ID to the builder.
|
||||
* This is equivalent to calling {@code appendOffset("HH:MM:ss", "Z")}.
|
||||
* This is equivalent to calling {@code appendOffset("+HH:MM:ss", "Z")}.
|
||||
*
|
||||
* @return this, for chaining, not null
|
||||
*/
|
||||
@ -1049,7 +1048,7 @@ public final class DateTimeFormatterBuilder {
|
||||
* "GMT+01:30" -- ZoneOffset.of("+01:30")
|
||||
* </pre>
|
||||
* <p>
|
||||
* Note that this method is is identical to {@code appendZoneId()} except
|
||||
* Note that this method is identical to {@code appendZoneId()} except
|
||||
* in the mechanism used to obtain the zone.
|
||||
* Note also that parsing accepts offsets, whereas formatting will never
|
||||
* produce one.
|
||||
@ -1107,7 +1106,7 @@ public final class DateTimeFormatterBuilder {
|
||||
* "GMT+01:30" -- ZoneOffset.of("GMT+01:30")
|
||||
* </pre>
|
||||
* <p>
|
||||
* Note that this method is is identical to {@code appendZoneId()} except
|
||||
* Note that this method is identical to {@code appendZoneId()} except
|
||||
* in the mechanism used to obtain the zone.
|
||||
*
|
||||
* @return this, for chaining, not null
|
||||
@ -1132,7 +1131,7 @@ public final class DateTimeFormatterBuilder {
|
||||
* for the locale set in the {@link DateTimeFormatter}.
|
||||
* If the temporal object being printed represents an instant, then the text
|
||||
* will be the summer or winter time text as appropriate.
|
||||
* If the lookup for text does not find any suitable reuslt, then the
|
||||
* If the lookup for text does not find any suitable result, then the
|
||||
* {@link ZoneId#getId() ID} will be printed instead.
|
||||
* If the zone cannot be obtained then an exception is thrown unless the
|
||||
* section of the formatter is optional.
|
||||
@ -1168,7 +1167,7 @@ public final class DateTimeFormatterBuilder {
|
||||
* for the locale set in the {@link DateTimeFormatter}.
|
||||
* If the temporal object being printed represents an instant, then the text
|
||||
* will be the summer or winter time text as appropriate.
|
||||
* If the lookup for text does not find any suitable reuslt, then the
|
||||
* If the lookup for text does not find any suitable result, then the
|
||||
* {@link ZoneId#getId() ID} will be printed instead.
|
||||
* If the zone cannot be obtained then an exception is thrown unless the
|
||||
* section of the formatter is optional.
|
||||
@ -1182,7 +1181,7 @@ public final class DateTimeFormatterBuilder {
|
||||
* zone. This method also allows a set of preferred {@link ZoneId} to be
|
||||
* specified for parsing. The matched preferred zone id will be used if the
|
||||
* textural zone name being parsed is not unique.
|
||||
*
|
||||
* <p>
|
||||
* If the zone cannot be parsed then an exception is thrown unless the
|
||||
* section of the formatter is optional.
|
||||
*
|
||||
@ -1227,7 +1226,6 @@ public final class DateTimeFormatterBuilder {
|
||||
* <p>
|
||||
* The calendar system name will be output during a format.
|
||||
* If the chronology cannot be obtained then an exception will be thrown.
|
||||
* The calendar system name is obtained from the Chronology.
|
||||
*
|
||||
* @param textStyle the text style to use, not null
|
||||
* @return this, for chaining, not null
|
||||
@ -1453,7 +1451,7 @@ public final class DateTimeFormatterBuilder {
|
||||
* LLLLL 5 appendText(ChronoField.MONTH_OF_YEAR, TextStyle.NARROW_STANDALONE)
|
||||
*
|
||||
* w 1 append special localized WeekFields element for numeric week-of-year
|
||||
* ww 1 append special localized WeekFields element for numeric week-of-year, zero-padded
|
||||
* ww 2 append special localized WeekFields element for numeric week-of-year, zero-padded
|
||||
* W 1 append special localized WeekFields element for numeric week-of-month
|
||||
* d 1 appendValue(ChronoField.DAY_OF_MONTH)
|
||||
* dd 2 appendValue(ChronoField.DAY_OF_MONTH, 2)
|
||||
@ -1880,7 +1878,6 @@ public final class DateTimeFormatterBuilder {
|
||||
* <p>
|
||||
* During parsing, the padding and decorated element are parsed.
|
||||
* If parsing is lenient, then the pad width is treated as a maximum.
|
||||
* If parsing is case insensitive, then the pad character is matched ignoring case.
|
||||
* The padding is parsed greedily. Thus, if the decorated element starts with
|
||||
* the pad character, it will not be parsed.
|
||||
*
|
||||
|
@ -62,7 +62,6 @@
|
||||
package java.time.format;
|
||||
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
@ -138,7 +137,7 @@ public final class DecimalStyle {
|
||||
* of(Locale.getDefault(Locale.Category.FORMAT))}.
|
||||
*
|
||||
* @see java.util.Locale.Category#FORMAT
|
||||
* @return the info, not null
|
||||
* @return the decimal style, not null
|
||||
*/
|
||||
public static DecimalStyle ofDefaultLocale() {
|
||||
return of(Locale.getDefault(Locale.Category.FORMAT));
|
||||
@ -150,7 +149,7 @@ public final class DecimalStyle {
|
||||
* This method provides access to locale sensitive decimal style symbols.
|
||||
*
|
||||
* @param locale the locale, not null
|
||||
* @return the info, not null
|
||||
* @return the decimal style, not null
|
||||
*/
|
||||
public static DecimalStyle of(Locale locale) {
|
||||
Objects.requireNonNull(locale, "locale");
|
||||
@ -340,7 +339,7 @@ public final class DecimalStyle {
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Checks if this DecimalStyle is equal another DecimalStyle.
|
||||
* Checks if this DecimalStyle is equal to another DecimalStyle.
|
||||
*
|
||||
* @param obj the object to check, null returns false
|
||||
* @return true if this is equal to the other date
|
||||
|
@ -638,7 +638,7 @@ public final class IsoFields {
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Implementation of the period unit.
|
||||
* Implementation of the unit.
|
||||
*/
|
||||
private static enum Unit implements TemporalUnit {
|
||||
|
||||
|
@ -157,7 +157,8 @@ public interface Temporal extends TemporalAccessor {
|
||||
* This adjusts this date-time according to the rules of the specified adjuster.
|
||||
* A simple adjuster might simply set the one of the fields, such as the year field.
|
||||
* A more complex adjuster might set the date to the last day of the month.
|
||||
* A selection of common adjustments is provided in {@link TemporalAdjuster}.
|
||||
* A selection of common adjustments is provided in
|
||||
* {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
|
||||
* These include finding the "last day of the month" and "next Wednesday".
|
||||
* The adjuster is responsible for handling special cases, such as the varying
|
||||
* lengths of month and leap years.
|
||||
@ -287,7 +288,7 @@ public interface Temporal extends TemporalAccessor {
|
||||
* This provides equivalent, safe behavior for immutable and mutable implementations.
|
||||
*
|
||||
* @param amountToAdd the amount of the specified unit to add, may be negative
|
||||
* @param unit the unit of the period to add, not null
|
||||
* @param unit the unit of the amount to add, not null
|
||||
* @return an object of the same type with the specified period added, not null
|
||||
* @throws DateTimeException if the unit cannot be added
|
||||
* @throws UnsupportedTemporalTypeException if the unit is not supported
|
||||
@ -359,7 +360,7 @@ public interface Temporal extends TemporalAccessor {
|
||||
* </pre>
|
||||
*
|
||||
* @param amountToSubtract the amount of the specified unit to subtract, may be negative
|
||||
* @param unit the unit of the period to subtract, not null
|
||||
* @param unit the unit of the amount to subtract, not null
|
||||
* @return an object of the same type with the specified period subtracted, not null
|
||||
* @throws DateTimeException if the unit cannot be subtracted
|
||||
* @throws UnsupportedTemporalTypeException if the unit is not supported
|
||||
@ -378,12 +379,12 @@ public interface Temporal extends TemporalAccessor {
|
||||
* The start and end points are {@code this} and the specified temporal.
|
||||
* The end point is converted to be of the same type as the start point if different.
|
||||
* The result will be negative if the end is before the start.
|
||||
* For example, the period in hours between two temporal objects can be
|
||||
* For example, the amount in hours between two temporal objects can be
|
||||
* calculated using {@code startTime.until(endTime, HOURS)}.
|
||||
* <p>
|
||||
* The calculation returns a whole number, representing the number of
|
||||
* complete units between the two temporals.
|
||||
* For example, the period in hours between the times 11:30 and 13:29
|
||||
* For example, the amount in hours between the times 11:30 and 13:29
|
||||
* will only be one hour as it is one minute short of two hours.
|
||||
* <p>
|
||||
* There are two equivalent ways of using this method.
|
||||
|
@ -180,7 +180,7 @@ public interface TemporalAccessor {
|
||||
/**
|
||||
* Gets the value of the specified field as an {@code int}.
|
||||
* <p>
|
||||
* This queries the date-time for the value for the specified field.
|
||||
* This queries the date-time for the value of the specified field.
|
||||
* The returned value will always be within the valid range of values for the field.
|
||||
* If the date-time cannot return the value, because the field is unsupported or for
|
||||
* some other reason, an exception will be thrown.
|
||||
@ -229,7 +229,7 @@ public interface TemporalAccessor {
|
||||
/**
|
||||
* Gets the value of the specified field as a {@code long}.
|
||||
* <p>
|
||||
* This queries the date-time for the value for the specified field.
|
||||
* This queries the date-time for the value of the specified field.
|
||||
* The returned value may be outside the valid range of values for the field.
|
||||
* If the date-time cannot return the value, because the field is unsupported or for
|
||||
* some other reason, an exception will be thrown.
|
||||
|
@ -116,7 +116,7 @@ public interface TemporalField {
|
||||
* For example, in the field 'MonthOfYear', the unit is 'Months'.
|
||||
* See also {@link #getRangeUnit()}.
|
||||
*
|
||||
* @return the period unit defining the base unit of the field, not null
|
||||
* @return the unit defining the base unit of the field, not null
|
||||
*/
|
||||
TemporalUnit getBaseUnit();
|
||||
|
||||
@ -130,7 +130,7 @@ public interface TemporalField {
|
||||
* The range is never null. For example, the 'Year' field is shorthand for
|
||||
* 'YearOfForever'. It therefore has a unit of 'Years' and a range of 'Forever'.
|
||||
*
|
||||
* @return the period unit defining the range of the field, not null
|
||||
* @return the unit defining the range of the field, not null
|
||||
*/
|
||||
TemporalUnit getRangeUnit();
|
||||
|
||||
@ -179,7 +179,7 @@ public interface TemporalField {
|
||||
* Checks if this field is supported by the temporal object.
|
||||
* <p>
|
||||
* This determines whether the temporal accessor supports this field.
|
||||
* If this returns false, the the temporal cannot be queried for this field.
|
||||
* If this returns false, then the temporal cannot be queried for this field.
|
||||
* <p>
|
||||
* There are two equivalent ways of using this method.
|
||||
* The first is to invoke this method directly.
|
||||
|
@ -221,7 +221,7 @@ public interface TemporalUnit {
|
||||
* @param temporal the temporal object to adjust, not null
|
||||
* @param amount the amount of this unit to add, positive or negative
|
||||
* @return the adjusted temporal object, not null
|
||||
* @throws DateTimeException if the period cannot be added
|
||||
* @throws DateTimeException if the amount cannot be added
|
||||
* @throws UnsupportedTemporalTypeException if the unit is not supported by the temporal
|
||||
*/
|
||||
<R extends Temporal> R addTo(R temporal, long amount);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user