Merge
This commit is contained in:
commit
68191a9002
@ -334,3 +334,4 @@ e8a66c0b05d786a282a7ff1d7eb4989afa30c891 jdk9-b86
|
||||
0d0a63b325592607974612f9cfb48590975aa2d6 jdk9-b89
|
||||
b433e4dfb830fea60e5187e4580791b62cc362d2 jdk9-b90
|
||||
97624df5026a2fb191793697dbd2c604c4d5c66e jdk9-b91
|
||||
6a5c99506f44538b879d8635a3979849ed587130 jdk9-b92
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 2015, 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
|
||||
@ -38,15 +38,15 @@ include GensrcExceptions.gmk
|
||||
|
||||
include GensrcProperties.gmk
|
||||
|
||||
$(eval $(call SetupCompileProperties,LIST_RESOURCE_BUNDLE, \
|
||||
$(filter %.properties, \
|
||||
$(call CacheFind, $(JDK_TOPDIR)/src/java.base/share/classes/sun/launcher/resources)), \
|
||||
ListResourceBundle))
|
||||
$(eval $(call SetupCompileProperties, LIST_RESOURCE_BUNDLE, \
|
||||
SRC_DIRS := $(JDK_TOPDIR)/src/java.base/share/classes/sun/launcher/resources, \
|
||||
CLASS := ListResourceBundle, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupCompileProperties,SUN_UTIL, \
|
||||
$(filter %.properties, \
|
||||
$(call CacheFind, $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/resources)), \
|
||||
sun.util.resources.LocaleNamesBundle))
|
||||
$(eval $(call SetupCompileProperties, SUN_UTIL, \
|
||||
SRC_DIRS := $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/resources, \
|
||||
CLASS := sun.util.resources.LocaleNamesBundle, \
|
||||
))
|
||||
|
||||
GENSRC_JAVA_BASE += $(LIST_RESOURCE_BUNDLE) $(SUN_UTIL)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 2015, 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
|
||||
@ -66,11 +66,11 @@ else
|
||||
PROP_SRC_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources
|
||||
endif
|
||||
|
||||
PROP_SRC_FILES := $(filter-out %cursors.properties, \
|
||||
$(filter %.properties, $(call CacheFind, $(PROP_SRC_DIRS))))
|
||||
|
||||
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
|
||||
$(PROP_SRC_FILES), ListResourceBundle))
|
||||
$(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
|
||||
SRC_DIRS := $(PROP_SRC_DIRS), \
|
||||
EXCLUDE := %cursors.properties, \
|
||||
CLASS := ListResourceBundle, \
|
||||
))
|
||||
|
||||
GENSRC_JAVA_DESKTOP += $(COMPILE_PROPERTIES)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2014, 2015, 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
|
||||
@ -29,10 +29,10 @@ include GensrcCommon.gmk
|
||||
|
||||
include GensrcProperties.gmk
|
||||
|
||||
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
|
||||
$(filter %.properties, \
|
||||
$(call CacheFind, $(JDK_TOPDIR)/src/java.logging/share/classes/sun/util/logging/resources)), \
|
||||
ListResourceBundle))
|
||||
$(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
|
||||
SRC_DIRS := $(JDK_TOPDIR)/src/java.logging/share/classes/sun/util/logging/resources, \
|
||||
CLASS := ListResourceBundle, \
|
||||
))
|
||||
|
||||
TARGETS += $(COMPILE_PROPERTIES)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 2015, 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
|
||||
@ -32,10 +32,10 @@ $(eval $(call IncludeCustomExtension, jdk, gensrc/Gensrc-java.management.gmk))
|
||||
|
||||
include GensrcProperties.gmk
|
||||
|
||||
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
|
||||
$(filter %.properties, \
|
||||
$(call CacheFind, $(JDK_TOPDIR)/src/java.management/share/classes/sun/management/resources)), \
|
||||
ListResourceBundle))
|
||||
$(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
|
||||
SRC_DIRS := $(JDK_TOPDIR)/src/java.management/share/classes/sun/management/resources, \
|
||||
CLASS := ListResourceBundle, \
|
||||
))
|
||||
|
||||
TARGETS += $(COMPILE_PROPERTIES)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2014, 2015, 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
|
||||
@ -29,11 +29,10 @@ include GensrcCommon.gmk
|
||||
|
||||
include GensrcProperties.gmk
|
||||
|
||||
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
|
||||
$(filter %.properties, \
|
||||
$(call CacheFind, \
|
||||
$(JDK_TOPDIR)/src/jdk.dev/share/classes/jdk/tools/jimage/resources)), \
|
||||
ListResourceBundle))
|
||||
$(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
|
||||
SRC_DIRS := $(JDK_TOPDIR)/src/jdk.dev/share/classes/jdk/tools/jimage/resources, \
|
||||
CLASS := ListResourceBundle, \
|
||||
))
|
||||
|
||||
TARGETS += $(COMPILE_PROPERTIES)
|
||||
|
||||
|
@ -29,11 +29,10 @@ include GensrcCommon.gmk
|
||||
|
||||
include GensrcProperties.gmk
|
||||
|
||||
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
|
||||
$(filter %.properties, \
|
||||
$(call CacheFind, \
|
||||
$(JDK_TOPDIR)/src/jdk.jartool/share/classes/sun/tools/jar/resources)), \
|
||||
ListResourceBundle))
|
||||
$(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
|
||||
SRC_DIRS := $(JDK_TOPDIR)/src/jdk.jartool/share/classes/sun/tools/jar/resources, \
|
||||
CLASS := ListResourceBundle, \
|
||||
))
|
||||
|
||||
TARGETS += $(COMPILE_PROPERTIES)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 2015, 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
|
||||
@ -34,7 +34,7 @@ HEADER_FILE := $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
|
||||
JAVA_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java
|
||||
|
||||
# Both the header and java file are created using the same recipe. By declaring
|
||||
# this rule and adding header file to dependencies for java file, both are
|
||||
# this rule and adding header file to dependencies for java file, both are
|
||||
# rebuilt if either is missing
|
||||
$(HEADER_FILE): $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK)
|
||||
|
||||
@ -90,10 +90,10 @@ endif
|
||||
|
||||
include GensrcProperties.gmk
|
||||
|
||||
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
|
||||
$(filter %.properties, \
|
||||
$(call CacheFind, $(JDK_TOPDIR)/src/jdk.jdi/share/classes/com/sun/tools/jdi/resources)), \
|
||||
ListResourceBundle))
|
||||
$(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
|
||||
SRC_DIRS := $(JDK_TOPDIR)/src/jdk.jdi/share/classes/com/sun/tools/jdi/resources, \
|
||||
CLASS := ListResourceBundle, \
|
||||
))
|
||||
|
||||
GENSRC_JDK_JDI += $(COMPILE_PROPERTIES)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2014, 2015, 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
|
||||
@ -35,10 +35,10 @@ include GensrcCLDR.gmk
|
||||
|
||||
include GensrcProperties.gmk
|
||||
|
||||
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
|
||||
$(filter %.properties, \
|
||||
$(call CacheFind, $(JDK_TOPDIR)/src/jdk.localedata/share/classes/sun/util/resources)), \
|
||||
sun.util.resources.LocaleNamesBundle))
|
||||
$(eval $(call SetupCompileProperties, COMPILE_PROPERTIES, \
|
||||
SRC_DIRS := $(JDK_TOPDIR)/src/jdk.localedata/share/classes/sun/util/resources, \
|
||||
CLASS := sun.util.resources.LocaleNamesBundle, \
|
||||
))
|
||||
|
||||
# Skip generating zh_HK from zh_TW for this module.
|
||||
GENSRC_JDK_LOCALEDATA += $(filter-out %_zh_HK.java, $(COMPILE_PROPERTIES))
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 2015, 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
|
||||
@ -49,30 +49,40 @@ define SetupCopy-zh_HK
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
# Creates a rule that runs CompileProperties on a set of properties files.
|
||||
# Param 1 - Variable to add targets to, must not contain space
|
||||
# Param 2 - Properties files to process
|
||||
# Param 3 - The super class for the generated classes
|
||||
# Param 4 - Module path root, defaults to $(JDK_TOPDIR)/src
|
||||
define SetupCompileProperties
|
||||
$1_SRCS := $2
|
||||
$1_CLASS := $3
|
||||
$1_MODULE_PATH_ROOT := $4
|
||||
|
||||
# Setup make rules that runs CompileProperties on a set of properties files.
|
||||
#
|
||||
# Parameter 1 is the name of the rule. This name is used as variable prefix,
|
||||
# and the targets generated are listed in a variable by that name.
|
||||
#
|
||||
# Remaining parameters are named arguments. These include:
|
||||
# SRC_DIRS Directories containing properties files to process.
|
||||
# EXCLUDE Exclude files matching this pattern.
|
||||
# CLASS The super class for the generated classes.
|
||||
# MODULE_PATH_ROOT Module path root, defaults to $(JDK_TOPDIR)/src.
|
||||
SetupCompileProperties = $(NamedParamsMacroTemplate)
|
||||
define SetupCompilePropertiesBody
|
||||
# Set default value unless overridden
|
||||
ifeq ($$($1_MODULE_PATH_ROOT), )
|
||||
$1_MODULE_PATH_ROOT := $(JDK_TOPDIR)/src
|
||||
endif
|
||||
|
||||
# Locate all properties files in the given source dirs.
|
||||
$1_SRC_FILES := $$(filter %.properties, $$(call CacheFind, $$($1_SRC_DIRS)))
|
||||
|
||||
ifneq ($$($1_EXCLUDE), )
|
||||
$1_SRC_FILES := $$(filter-out $$($1_EXCLUDE), $$($1_SRC_FILES))
|
||||
endif
|
||||
|
||||
# Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
|
||||
# to .../support/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
|
||||
# Strip away prefix and suffix, leaving for example only:
|
||||
# Strip away prefix and suffix, leaving for example only:
|
||||
# "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
|
||||
$1_JAVAS := $$(patsubst $$($1_MODULE_PATH_ROOT)/%, \
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc/%, \
|
||||
$$(patsubst %.properties, %.java, \
|
||||
$$(subst /$(OPENJDK_TARGET_OS)/classes,, \
|
||||
$$(subst /$(OPENJDK_TARGET_OS_TYPE)/classes,, \
|
||||
$$(subst /share/classes,, $$($1_SRCS))))))
|
||||
$$(subst /share/classes,, $$($1_SRC_FILES))))))
|
||||
|
||||
# Generate the package dirs for the to be generated java files. Sort to remove
|
||||
# duplicates.
|
||||
@ -82,22 +92,22 @@ define SetupCompileProperties
|
||||
# "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle"
|
||||
# suitable to be fed into the CompileProperties command.
|
||||
$1_CMDLINE := $$(subst _SPACE_, $(SPACE), \
|
||||
$$(join $$(addprefix -compile_SPACE_, $$($1_SRCS)), \
|
||||
$$(join $$(addprefix -compile_SPACE_, $$($1_SRC_FILES)), \
|
||||
$$(addsuffix _SPACE_$$($1_CLASS), \
|
||||
$$(addprefix _SPACE_, $$($1_JAVAS)))))
|
||||
|
||||
$1_TARGET := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.done
|
||||
$1_TARGET := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.marker
|
||||
$1_CMDLINE_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline
|
||||
|
||||
# Now setup the rule for the generation of the resource bundles.
|
||||
$$($1_TARGET): $$($1_SRCS) $$($1_JAVAS) $(BUILD_TOOLS_JDK)
|
||||
$$($1_TARGET): $$($1_SRC_FILES) $$($1_JAVAS) $(BUILD_TOOLS_JDK)
|
||||
$(MKDIR) -p $$(@D) $$($1_DIRS)
|
||||
$(ECHO) Compiling $$(words $$($1_SRCS)) properties into resource bundles for $(MODULE)
|
||||
$(ECHO) Compiling $$(words $$($1_SRC_FILES)) properties into resource bundles for $(MODULE)
|
||||
$$(eval $$(call ListPathsSafely, $1_CMDLINE, $$($1_CMDLINE_FILE)))
|
||||
$(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE)
|
||||
$(TOUCH) $$@
|
||||
|
||||
$$($1_JAVAS): $$($1_SRCS)
|
||||
$$($1_JAVAS): $$($1_SRC_FILES)
|
||||
|
||||
# Create zh_HK versions of all zh_TW files created above
|
||||
$$(eval $$(call SetupCopy-zh_HK,$1_HK,$$(filter %_zh_TW.java, $$($1_JAVAS))))
|
||||
|
@ -476,7 +476,7 @@ endif
|
||||
ifeq ($(USE_EXTERNAL_LIBJPEG), true)
|
||||
LIBJPEG_LIBS := -ljpeg
|
||||
BUILD_LIBJAVAJPEG_INCLUDE_FILES := \
|
||||
imageIOJPEG.c \
|
||||
imageioJPEG.c \
|
||||
jpegdecoder.c
|
||||
BUILD_LIBJAVAJPEG_HEADERS :=
|
||||
else
|
||||
|
@ -841,7 +841,7 @@ public class WrapperGenerator {
|
||||
pw.println("// This file is an automatically generated file, please do not edit this file, modify the WrapperGenerator.java file instead !\n" );
|
||||
|
||||
pw.println("package "+package_name+";\n");
|
||||
pw.println("import sun.misc.*;\n");
|
||||
pw.println("import jdk.internal.misc.Unsafe;\n");
|
||||
pw.println("import sun.util.logging.PlatformLogger;");
|
||||
String baseClass = stp.getBaseClass();
|
||||
if (baseClass == null) {
|
||||
@ -941,7 +941,7 @@ public class WrapperGenerator {
|
||||
pw.println("// This file is an automatically generated file, please do not edit this file, modify the WrapperGenerator.java file instead !\n" );
|
||||
|
||||
pw.println("package "+package_name+";\n");
|
||||
pw.println("import sun.misc.Unsafe;\n");
|
||||
pw.println("import jdk.internal.misc.Unsafe;\n");
|
||||
pw.println("class " + ft.getName() + " {");
|
||||
pw.println("\tprivate static Unsafe unsafe = XlibWrapper.unsafe;");
|
||||
pw.println("\tprivate boolean __executed = false;");
|
||||
|
@ -34,7 +34,7 @@ import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
/**
|
||||
* AsynchronousChannelGroup implementation based on the AIX pollset framework.
|
||||
|
@ -26,7 +26,7 @@
|
||||
package sun.nio.ch;
|
||||
|
||||
import java.io.IOException;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
/**
|
||||
* Provides access to the Linux epoll facility.
|
||||
|
@ -29,7 +29,7 @@ import java.nio.file.attribute.*;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.io.IOException;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
import static sun.nio.fs.UnixNativeDispatcher.*;
|
||||
import static sun.nio.fs.UnixConstants.*;
|
||||
|
@ -29,7 +29,7 @@ import java.nio.file.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
import static sun.nio.fs.UnixConstants.*;
|
||||
import static sun.nio.fs.LinuxNativeDispatcher.*;
|
||||
|
@ -30,7 +30,7 @@ import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
import static sun.nio.fs.UnixNativeDispatcher.*;
|
||||
import static sun.nio.fs.UnixConstants.*;
|
||||
|
@ -26,7 +26,7 @@
|
||||
package sun.nio.ch;
|
||||
|
||||
import java.io.IOException;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
/**
|
||||
* Provides access to the BSD kqueue facility.
|
||||
|
@ -2184,10 +2184,10 @@ public class File
|
||||
|
||||
private static final long PATH_OFFSET;
|
||||
private static final long PREFIX_LENGTH_OFFSET;
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final jdk.internal.misc.Unsafe UNSAFE;
|
||||
static {
|
||||
try {
|
||||
sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
|
||||
jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
PATH_OFFSET = unsafe.objectFieldOffset(
|
||||
File.class.getDeclaredField("path"));
|
||||
PREFIX_LENGTH_OFFSET = unsafe.objectFieldOffset(
|
||||
|
@ -40,7 +40,7 @@ import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import static java.io.ObjectStreamClass.processQueue;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import sun.reflect.misc.ReflectUtil;
|
||||
|
||||
/**
|
||||
|
@ -48,7 +48,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import sun.reflect.CallerSensitive;
|
||||
import sun.reflect.Reflection;
|
||||
import sun.reflect.ReflectionFactory;
|
||||
|
@ -55,7 +55,7 @@ import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.StringJoiner;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import jdk.internal.HotSpotIntrinsicCandidate;
|
||||
import sun.reflect.CallerSensitive;
|
||||
import sun.reflect.ConstantPool;
|
||||
|
@ -83,7 +83,7 @@ import java.util.stream.Stream;
|
||||
* {@link #getPid() process id},
|
||||
* {@link #info() information about the process},
|
||||
* {@link #children() direct children}, and
|
||||
* {@link #allChildren() direct and indirect children} of the process.
|
||||
* {@link #descendants() direct children plus descendants of those children} of the process.
|
||||
* Delegating to the underlying Process or ProcessHandle is typically
|
||||
* easiest and most efficient.
|
||||
*
|
||||
@ -351,7 +351,7 @@ public abstract class Process {
|
||||
* The {@link java.util.concurrent.CompletableFuture} provides the ability
|
||||
* to trigger dependent functions or actions that may be run synchronously
|
||||
* or asynchronously upon process termination.
|
||||
* When the process terminates the CompletableFuture is
|
||||
* When the process has terminated the CompletableFuture is
|
||||
* {@link java.util.concurrent.CompletableFuture#complete completed} regardless
|
||||
* of the exit status of the process.
|
||||
* <p>
|
||||
@ -362,9 +362,6 @@ public abstract class Process {
|
||||
* {@link java.util.concurrent.CompletableFuture#cancel(boolean) Cancelling}
|
||||
* the CompletableFuture does not affect the Process.
|
||||
* <p>
|
||||
* If the process is {@link #isAlive not alive} the {@link CompletableFuture}
|
||||
* returned has been {@link java.util.concurrent.CompletableFuture#complete completed}.
|
||||
* <p>
|
||||
* Processes returned from {@link ProcessBuilder#start} override the
|
||||
* default implementation to provide an efficient mechanism to wait
|
||||
* for process exit.
|
||||
@ -406,6 +403,9 @@ public abstract class Process {
|
||||
* return delegate.onExit().thenApply(p -> this);
|
||||
* }
|
||||
* }</pre>
|
||||
* @apiNote
|
||||
* The process may be observed to have terminated with {@link #isAlive}
|
||||
* before the ComputableFuture is completed and dependent actions are invoked.
|
||||
*
|
||||
* @return a new {@code CompletableFuture<Process>} for the Process
|
||||
*
|
||||
@ -464,7 +464,7 @@ public abstract class Process {
|
||||
* {@link java.lang.UnsupportedOperationException} and performs no other action.
|
||||
* Subclasses should override this method to provide a ProcessHandle for the
|
||||
* process. The methods {@link #getPid}, {@link #info}, {@link #children},
|
||||
* and {@link #allChildren}, unless overridden, operate on the ProcessHandle.
|
||||
* and {@link #descendants}, unless overridden, operate on the ProcessHandle.
|
||||
*
|
||||
* @return Returns a ProcessHandle for the Process
|
||||
* @throws UnsupportedOperationException if the Process implementation
|
||||
@ -481,9 +481,8 @@ public abstract class Process {
|
||||
/**
|
||||
* Returns a snapshot of information about the process.
|
||||
*
|
||||
* <p> An {@link ProcessHandle.Info} instance has various accessor methods
|
||||
* that return information about the process, if the process is alive and
|
||||
* the information is available, otherwise {@code null} is returned.
|
||||
* <p> A {@link ProcessHandle.Info} instance has accessor methods
|
||||
* that return information about the process if it is available.
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation returns information about the process as:
|
||||
@ -524,9 +523,9 @@ public abstract class Process {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a snapshot of the direct and indirect children of the process.
|
||||
* An indirect child is one whose parent is either a direct child or
|
||||
* another indirect child.
|
||||
* Returns a snapshot of the descendants of the process.
|
||||
* The descendants of a process are the children of the process
|
||||
* plus the descendants of those children, recursively.
|
||||
* Typically, a process that is {@link #isAlive not alive} has no children.
|
||||
* <p>
|
||||
* <em>Note that processes are created and terminate asynchronously.
|
||||
@ -535,18 +534,18 @@ public abstract class Process {
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation returns all children as:
|
||||
* {@link #toHandle toHandle().allChildren()}.
|
||||
* {@link #toHandle toHandle().descendants()}.
|
||||
*
|
||||
* @return a sequential Stream of ProcessHandles for processes that are
|
||||
* direct and indirect children of the process
|
||||
* @return a sequential Stream of ProcessHandles for processes that
|
||||
* are descendants of the process
|
||||
* @throws UnsupportedOperationException if the Process implementation
|
||||
* does not support this operation
|
||||
* @throws SecurityException if a security manager has been installed and
|
||||
* it denies RuntimePermission("manageProcess")
|
||||
* @since 1.9
|
||||
*/
|
||||
public Stream<ProcessHandle> allChildren() {
|
||||
return toHandle().allChildren();
|
||||
public Stream<ProcessHandle> descendants() {
|
||||
return toHandle().descendants();
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ import java.util.stream.Stream;
|
||||
* Each ProcessHandle identifies and allows control of a process in the native
|
||||
* system. ProcessHandles are returned from the factory methods {@link #current()},
|
||||
* {@link #of(long)},
|
||||
* {@link #children}, {@link #allChildren}, {@link #parent()} and
|
||||
* {@link #children}, {@link #descendants}, {@link #parent()} and
|
||||
* {@link #allProcesses()}.
|
||||
* <p>
|
||||
* The {@link Process} instances created by {@link ProcessBuilder} can be queried
|
||||
@ -164,21 +164,21 @@ public interface ProcessHandle extends Comparable<ProcessHandle> {
|
||||
Stream<ProcessHandle> children();
|
||||
|
||||
/**
|
||||
* Returns a snapshot of the current direct and indirect children of the process.
|
||||
* An indirect child is one whose parent is either a direct child or
|
||||
* another indirect child.
|
||||
* Returns a snapshot of the descendants of the process.
|
||||
* The descendants of a process are the children of the process
|
||||
* plus the descendants of those children, recursively.
|
||||
* Typically, a process that is {@link #isAlive not alive} has no children.
|
||||
* <p>
|
||||
* <em>Note that processes are created and terminate asynchronously.
|
||||
* There is no guarantee that a process is {@link #isAlive alive}.
|
||||
* </em>
|
||||
*
|
||||
* @return a sequential Stream of ProcessHandles for processes that are
|
||||
* direct and indirect children of the process
|
||||
* @return a sequential Stream of ProcessHandles for processes that
|
||||
* are descendants of the process
|
||||
* @throws SecurityException if a security manager has been installed and
|
||||
* it denies RuntimePermission("manageProcess")
|
||||
*/
|
||||
Stream<ProcessHandle> allChildren();
|
||||
Stream<ProcessHandle> descendants();
|
||||
|
||||
/**
|
||||
* Returns a snapshot of all processes visible to the current process.
|
||||
@ -201,9 +201,8 @@ public interface ProcessHandle extends Comparable<ProcessHandle> {
|
||||
/**
|
||||
* Returns a snapshot of information about the process.
|
||||
*
|
||||
* <p> An {@code Info} instance has various accessor methods that return
|
||||
* information about the process, if the process is alive and the
|
||||
* information is available.
|
||||
* <p> A {@link ProcessHandle.Info} instance has accessor methods that return
|
||||
* information about the process if it is available.
|
||||
*
|
||||
* @return a snapshot of information about the process, always non-null
|
||||
*/
|
||||
@ -288,7 +287,7 @@ public interface ProcessHandle extends Comparable<ProcessHandle> {
|
||||
* The {@link java.util.concurrent.CompletableFuture} provides the ability
|
||||
* to trigger dependent functions or actions that may be run synchronously
|
||||
* or asynchronously upon process termination.
|
||||
* When the process terminates the CompletableFuture is
|
||||
* When the process has terminated the CompletableFuture is
|
||||
* {@link java.util.concurrent.CompletableFuture#complete completed} regardless
|
||||
* of the exit status of the process.
|
||||
* The {@code onExit} method can be called multiple times to invoke
|
||||
@ -300,9 +299,9 @@ public interface ProcessHandle extends Comparable<ProcessHandle> {
|
||||
* {@link java.util.concurrent.Future#get() wait} for it to terminate.
|
||||
* {@link java.util.concurrent.Future#cancel(boolean) Cancelling}
|
||||
* the CompleteableFuture does not affect the Process.
|
||||
* <p>
|
||||
* If the process is {@link #isAlive not alive} the {@link CompletableFuture}
|
||||
* returned has been {@link java.util.concurrent.CompletableFuture#complete completed}.
|
||||
* @apiNote
|
||||
* The process may be observed to have terminated with {@link #isAlive}
|
||||
* before the ComputableFuture is completed and dependent actions are invoked.
|
||||
*
|
||||
* @return a new {@code CompletableFuture<ProcessHandle>} for the ProcessHandle
|
||||
*
|
||||
|
@ -389,7 +389,7 @@ final class ProcessHandleImpl implements ProcessHandle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<ProcessHandle> allChildren() {
|
||||
public Stream<ProcessHandle> descendants() {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new RuntimePermission("manageProcess"));
|
||||
|
@ -34,14 +34,16 @@ import java.lang.invoke.LambdaForm.NamedFunction;
|
||||
import java.lang.invoke.MethodHandles.Lookup;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import jdk.internal.org.objectweb.asm.FieldVisitor;
|
||||
import sun.invoke.util.ValueConversions;
|
||||
import sun.invoke.util.Wrapper;
|
||||
|
||||
import jdk.internal.org.objectweb.asm.ClassWriter;
|
||||
import jdk.internal.org.objectweb.asm.MethodVisitor;
|
||||
import jdk.internal.org.objectweb.asm.Type;
|
||||
|
||||
/**
|
||||
* The flavor of method handle which emulates an invoke instruction
|
||||
@ -217,7 +219,7 @@ import jdk.internal.org.objectweb.asm.Type;
|
||||
/*non-public*/ int fieldCount() {
|
||||
return 1;
|
||||
}
|
||||
/*non-public*/ static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("L", Species_L.class);
|
||||
/*non-public*/ static final SpeciesData SPECIES_DATA = new SpeciesData("L", Species_L.class);
|
||||
/*non-public*/ static BoundMethodHandle make(MethodType mt, LambdaForm lf, Object argL0) {
|
||||
return new Species_L(mt, lf, argL0);
|
||||
}
|
||||
@ -335,7 +337,7 @@ import jdk.internal.org.objectweb.asm.Type;
|
||||
|
||||
static final SpeciesData EMPTY = new SpeciesData("", BoundMethodHandle.class);
|
||||
|
||||
private SpeciesData(String types, Class<? extends BoundMethodHandle> clazz) {
|
||||
SpeciesData(String types, Class<? extends BoundMethodHandle> clazz) {
|
||||
this.typeChars = types;
|
||||
this.typeCodes = basicTypes(types);
|
||||
this.clazz = clazz;
|
||||
@ -355,26 +357,14 @@ import jdk.internal.org.objectweb.asm.Type;
|
||||
assert(!INIT_DONE);
|
||||
if (constructor() == null) {
|
||||
String types = typeChars;
|
||||
CACHE.put(types, this);
|
||||
Factory.makeCtors(clazz, types, this.constructor);
|
||||
Factory.makeGetters(clazz, types, this.getters);
|
||||
Factory.makeNominalGetters(types, this.nominalGetters, this.getters);
|
||||
}
|
||||
}
|
||||
|
||||
private SpeciesData(String typeChars) {
|
||||
// Placeholder only.
|
||||
this.typeChars = typeChars;
|
||||
this.typeCodes = basicTypes(typeChars);
|
||||
this.clazz = null;
|
||||
this.constructor = null;
|
||||
this.getters = null;
|
||||
this.nominalGetters = null;
|
||||
this.extensions = null;
|
||||
}
|
||||
private boolean isPlaceholder() { return clazz == null; }
|
||||
|
||||
private static final HashMap<String, SpeciesData> CACHE = new HashMap<>();
|
||||
static { CACHE.put("", EMPTY); } // make bootstrap predictable
|
||||
private static final ConcurrentMap<String, SpeciesData> CACHE = new ConcurrentHashMap<>();
|
||||
private static final boolean INIT_DONE; // set after <clinit> finishes...
|
||||
|
||||
SpeciesData extendWith(byte type) {
|
||||
@ -390,62 +380,52 @@ import jdk.internal.org.objectweb.asm.Type;
|
||||
}
|
||||
|
||||
private static SpeciesData get(String types) {
|
||||
// Acquire cache lock for query.
|
||||
SpeciesData d = lookupCache(types);
|
||||
if (!d.isPlaceholder())
|
||||
return d;
|
||||
synchronized (d) {
|
||||
// Use synch. on the placeholder to prevent multiple instantiation of one species.
|
||||
// Creating this class forces a recursive call to getForClass.
|
||||
if (lookupCache(types).isPlaceholder())
|
||||
Factory.generateConcreteBMHClass(types);
|
||||
}
|
||||
// Reacquire cache lock.
|
||||
d = lookupCache(types);
|
||||
// Class loading must have upgraded the cache.
|
||||
assert(d != null && !d.isPlaceholder());
|
||||
return d;
|
||||
}
|
||||
static SpeciesData getForClass(String types, Class<? extends BoundMethodHandle> clazz) {
|
||||
// clazz is a new class which is initializing its SPECIES_DATA field
|
||||
return updateCache(types, new SpeciesData(types, clazz));
|
||||
}
|
||||
private static synchronized SpeciesData lookupCache(String types) {
|
||||
SpeciesData d = CACHE.get(types);
|
||||
if (d != null) return d;
|
||||
d = new SpeciesData(types);
|
||||
assert(d.isPlaceholder());
|
||||
CACHE.put(types, d);
|
||||
return d;
|
||||
}
|
||||
private static synchronized SpeciesData updateCache(String types, SpeciesData d) {
|
||||
SpeciesData d2;
|
||||
assert((d2 = CACHE.get(types)) == null || d2.isPlaceholder());
|
||||
assert(!d.isPlaceholder());
|
||||
CACHE.put(types, d);
|
||||
return d;
|
||||
return CACHE.computeIfAbsent(types, new Function<String, SpeciesData>() {
|
||||
@Override
|
||||
public SpeciesData apply(String types) {
|
||||
Class<? extends BoundMethodHandle> bmhcl = Factory.getConcreteBMHClass(types);
|
||||
// SpeciesData instantiation may throw VirtualMachineError because of
|
||||
// code cache overflow...
|
||||
SpeciesData speciesData = new SpeciesData(types, bmhcl);
|
||||
// CHM.computeIfAbsent ensures only one SpeciesData will be set
|
||||
// successfully on the concrete BMH class if ever
|
||||
Factory.setSpeciesDataToConcreteBMHClass(bmhcl, speciesData);
|
||||
// the concrete BMH class is published via SpeciesData instance
|
||||
// returned here only after it's SPECIES_DATA field is set
|
||||
return speciesData;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static {
|
||||
// pre-fill the BMH speciesdata cache with BMH's inner classes
|
||||
final Class<BoundMethodHandle> rootCls = BoundMethodHandle.class;
|
||||
/**
|
||||
* This is to be called when assertions are enabled. It checks whether SpeciesData for all of the statically
|
||||
* defined species subclasses of BoundMethodHandle has been added to the SpeciesData cache. See below in the
|
||||
* static initializer for
|
||||
*/
|
||||
static boolean speciesDataCachePopulated() {
|
||||
Class<BoundMethodHandle> rootCls = BoundMethodHandle.class;
|
||||
try {
|
||||
for (Class<?> c : rootCls.getDeclaredClasses()) {
|
||||
if (rootCls.isAssignableFrom(c)) {
|
||||
final Class<? extends BoundMethodHandle> cbmh = c.asSubclass(BoundMethodHandle.class);
|
||||
SpeciesData d = Factory.speciesDataFromConcreteBMHClass(cbmh);
|
||||
SpeciesData d = Factory.getSpeciesDataFromConcreteBMHClass(cbmh);
|
||||
assert(d != null) : cbmh.getName();
|
||||
assert(d.clazz == cbmh);
|
||||
assert(d == lookupCache(d.typeChars));
|
||||
assert(CACHE.get(d.typeChars) == d);
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
throw newInternalError(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
for (SpeciesData d : CACHE.values()) {
|
||||
d.initForBootstrap();
|
||||
}
|
||||
static {
|
||||
// Pre-fill the BMH species-data cache with EMPTY and all BMH's inner subclasses.
|
||||
EMPTY.initForBootstrap();
|
||||
Species_L.SPECIES_DATA.initForBootstrap();
|
||||
// check that all static SpeciesData instances have been initialized
|
||||
assert speciesDataCachePopulated();
|
||||
// Note: Do not simplify this, because INIT_DONE must not be
|
||||
// a compile-time constant during bootstrapping.
|
||||
INIT_DONE = Boolean.TRUE;
|
||||
@ -479,6 +459,7 @@ import jdk.internal.org.objectweb.asm.Type;
|
||||
static final String BMH_SIG = "L"+BMH+";";
|
||||
static final String SPECIES_DATA = "java/lang/invoke/BoundMethodHandle$SpeciesData";
|
||||
static final String SPECIES_DATA_SIG = "L"+SPECIES_DATA+";";
|
||||
static final String STABLE_SIG = "Ljava/lang/invoke/Stable;";
|
||||
|
||||
static final String SPECIES_PREFIX_NAME = "Species_";
|
||||
static final String SPECIES_PREFIX_PATH = BMH + "$" + SPECIES_PREFIX_NAME;
|
||||
@ -493,6 +474,26 @@ import jdk.internal.org.objectweb.asm.Type;
|
||||
|
||||
static final String[] E_THROWABLE = new String[] { "java/lang/Throwable" };
|
||||
|
||||
static final ConcurrentMap<String, Class<? extends BoundMethodHandle>> CLASS_CACHE = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* Get a concrete subclass of BMH for a given combination of bound types.
|
||||
*
|
||||
* @param types the type signature, wherein reference types are erased to 'L'
|
||||
* @return the concrete BMH class
|
||||
*/
|
||||
static Class<? extends BoundMethodHandle> getConcreteBMHClass(String types) {
|
||||
// CHM.computeIfAbsent ensures generateConcreteBMHClass is called
|
||||
// only once per key.
|
||||
return CLASS_CACHE.computeIfAbsent(
|
||||
types, new Function<String, Class<? extends BoundMethodHandle>>() {
|
||||
@Override
|
||||
public Class<? extends BoundMethodHandle> apply(String types) {
|
||||
return generateConcreteBMHClass(types);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a concrete subclass of BMH for a given combination of bound types.
|
||||
*
|
||||
@ -529,7 +530,7 @@ import jdk.internal.org.objectweb.asm.Type;
|
||||
* }
|
||||
* final SpeciesData speciesData() { return SPECIES_DATA; }
|
||||
* final int fieldCount() { return 3; }
|
||||
* static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("LLI", Species_LLI.class);
|
||||
* @Stable static SpeciesData SPECIES_DATA; // injected afterwards
|
||||
* static BoundMethodHandle make(MethodType mt, LambdaForm lf, Object argL0, Object argL1, int argI2) {
|
||||
* return new Species_LLI(mt, lf, argL0, argL1, argI2);
|
||||
* }
|
||||
@ -568,7 +569,9 @@ import jdk.internal.org.objectweb.asm.Type;
|
||||
cw.visitSource(sourceFile, null);
|
||||
|
||||
// emit static types and SPECIES_DATA fields
|
||||
cw.visitField(NOT_ACC_PUBLIC + ACC_STATIC, "SPECIES_DATA", SPECIES_DATA_SIG, null, null).visitEnd();
|
||||
FieldVisitor fw = cw.visitField(NOT_ACC_PUBLIC + ACC_STATIC, "SPECIES_DATA", SPECIES_DATA_SIG, null, null);
|
||||
fw.visitAnnotation(STABLE_SIG, true);
|
||||
fw.visitEnd();
|
||||
|
||||
// emit bound argument fields
|
||||
for (int i = 0; i < types.length(); ++i) {
|
||||
@ -694,17 +697,6 @@ import jdk.internal.org.objectweb.asm.Type;
|
||||
mv.visitEnd();
|
||||
}
|
||||
|
||||
// emit class initializer
|
||||
mv = cw.visitMethod(NOT_ACC_PUBLIC | ACC_STATIC, "<clinit>", VOID_SIG, null, null);
|
||||
mv.visitCode();
|
||||
mv.visitLdcInsn(types);
|
||||
mv.visitLdcInsn(Type.getObjectType(className));
|
||||
mv.visitMethodInsn(INVOKESTATIC, SPECIES_DATA, "getForClass", BMHSPECIES_DATA_GFC_SIG, false);
|
||||
mv.visitFieldInsn(PUTSTATIC, className, "SPECIES_DATA", SPECIES_DATA_SIG);
|
||||
mv.visitInsn(RETURN);
|
||||
mv.visitMaxs(0, 0);
|
||||
mv.visitEnd();
|
||||
|
||||
cw.visitEnd();
|
||||
|
||||
// load class
|
||||
@ -715,7 +707,6 @@ import jdk.internal.org.objectweb.asm.Type;
|
||||
UNSAFE.defineClass(className, classFile, 0, classFile.length,
|
||||
BoundMethodHandle.class.getClassLoader(), null)
|
||||
.asSubclass(BoundMethodHandle.class);
|
||||
UNSAFE.ensureClassInitialized(bmhClass);
|
||||
|
||||
return bmhClass;
|
||||
}
|
||||
@ -785,7 +776,7 @@ import jdk.internal.org.objectweb.asm.Type;
|
||||
// Auxiliary methods.
|
||||
//
|
||||
|
||||
static SpeciesData speciesDataFromConcreteBMHClass(Class<? extends BoundMethodHandle> cbmh) {
|
||||
static SpeciesData getSpeciesDataFromConcreteBMHClass(Class<? extends BoundMethodHandle> cbmh) {
|
||||
try {
|
||||
Field F_SPECIES_DATA = cbmh.getDeclaredField("SPECIES_DATA");
|
||||
return (SpeciesData) F_SPECIES_DATA.get(null);
|
||||
@ -794,6 +785,16 @@ import jdk.internal.org.objectweb.asm.Type;
|
||||
}
|
||||
}
|
||||
|
||||
static void setSpeciesDataToConcreteBMHClass(Class<? extends BoundMethodHandle> cbmh, SpeciesData speciesData) {
|
||||
try {
|
||||
Field F_SPECIES_DATA = cbmh.getDeclaredField("SPECIES_DATA");
|
||||
assert F_SPECIES_DATA.getDeclaredAnnotation(Stable.class) != null;
|
||||
F_SPECIES_DATA.set(null, speciesData);
|
||||
} catch (ReflectiveOperationException ex) {
|
||||
throw newInternalError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Field names in concrete BMHs adhere to this pattern:
|
||||
* arg + type + index
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package java.lang.invoke;
|
||||
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import sun.invoke.util.VerifyAccess;
|
||||
|
@ -27,7 +27,7 @@ package java.lang.invoke;
|
||||
|
||||
import jdk.internal.org.objectweb.asm.*;
|
||||
import sun.invoke.util.BytecodeDescriptor;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
import java.io.FilePermission;
|
||||
|
@ -775,7 +775,7 @@ class InvokerBytecodeGenerator {
|
||||
// Sample classes from each package we are willing to bind to statically:
|
||||
java.lang.Object.class,
|
||||
java.util.Arrays.class,
|
||||
sun.misc.Unsafe.class
|
||||
jdk.internal.misc.Unsafe.class
|
||||
//MethodHandle.class already covered
|
||||
};
|
||||
|
||||
|
@ -694,8 +694,11 @@ import java.util.Objects;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(clazz, getReferenceKind(), name, getType());
|
||||
// Avoid autoboxing getReferenceKind(), since this is used early and will force
|
||||
// early initialization of Byte$ByteCache
|
||||
return Objects.hash(clazz, new Byte(getReferenceKind()), name, getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
return (that instanceof MemberName && this.equals((MemberName)that));
|
||||
|
@ -50,7 +50,7 @@ class MethodHandleNatives {
|
||||
static native int getMembers(Class<?> defc, String matchName, String matchSig,
|
||||
int matchFlags, Class<?> caller, int skip, MemberName[] results);
|
||||
|
||||
/// Field layout queries parallel to sun.misc.Unsafe:
|
||||
/// Field layout queries parallel to jdk.internal.misc.Unsafe:
|
||||
static native long objectFieldOffset(MemberName self); // e.g., returns vmindex
|
||||
static native long staticFieldOffset(MemberName self); // e.g., returns vmindex
|
||||
static native Object staticFieldBase(MemberName self); // e.g., returns clazz
|
||||
|
@ -27,7 +27,7 @@ package java.lang.invoke;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
/**
|
||||
* This class consists exclusively of static names internal to the
|
||||
|
@ -3726,12 +3726,12 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
||||
}
|
||||
|
||||
private static class UnsafeHolder {
|
||||
private static final sun.misc.Unsafe unsafe;
|
||||
private static final jdk.internal.misc.Unsafe unsafe;
|
||||
private static final long intCompactOffset;
|
||||
private static final long intValOffset;
|
||||
static {
|
||||
try {
|
||||
unsafe = sun.misc.Unsafe.getUnsafe();
|
||||
unsafe = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
intCompactOffset = unsafe.objectFieldOffset
|
||||
(BigDecimal.class.getDeclaredField("intCompact"));
|
||||
intValOffset = unsafe.objectFieldOffset
|
||||
|
@ -4526,12 +4526,12 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
||||
|
||||
// Support for resetting final fields while deserializing
|
||||
private static class UnsafeHolder {
|
||||
private static final sun.misc.Unsafe unsafe;
|
||||
private static final jdk.internal.misc.Unsafe unsafe;
|
||||
private static final long signumOffset;
|
||||
private static final long magOffset;
|
||||
static {
|
||||
try {
|
||||
unsafe = sun.misc.Unsafe.getUnsafe();
|
||||
unsafe = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
signumOffset = unsafe.objectFieldOffset
|
||||
(BigInteger.class.getDeclaredField("signum"));
|
||||
magOffset = unsafe.objectFieldOffset
|
||||
|
@ -576,11 +576,11 @@ class Inet6Address extends InetAddress {
|
||||
};
|
||||
|
||||
private static final long FIELDS_OFFSET;
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final jdk.internal.misc.Unsafe UNSAFE;
|
||||
|
||||
static {
|
||||
try {
|
||||
sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
|
||||
jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
FIELDS_OFFSET = unsafe.objectFieldOffset(
|
||||
Inet6Address.class.getDeclaredField("holder6"));
|
||||
UNSAFE = unsafe;
|
||||
|
@ -29,6 +29,7 @@ import java.util.NavigableSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
import java.util.ServiceLoader;
|
||||
import java.security.AccessController;
|
||||
import java.io.ObjectStreamException;
|
||||
@ -733,7 +734,7 @@ class InetAddress implements java.io.Serializable {
|
||||
*/
|
||||
public String toString() {
|
||||
String hostName = holder().getHostName();
|
||||
return ((hostName != null) ? hostName : "")
|
||||
return Objects.toString(hostName, "")
|
||||
+ "/" + getHostAddress();
|
||||
}
|
||||
|
||||
@ -1493,11 +1494,11 @@ class InetAddress implements java.io.Serializable {
|
||||
}
|
||||
|
||||
private static final long FIELDS_OFFSET;
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final jdk.internal.misc.Unsafe UNSAFE;
|
||||
|
||||
static {
|
||||
try {
|
||||
sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
|
||||
jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
FIELDS_OFFSET = unsafe.objectFieldOffset(
|
||||
InetAddress.class.getDeclaredField("holder")
|
||||
);
|
||||
|
@ -303,10 +303,10 @@ public class InetSocketAddress
|
||||
}
|
||||
|
||||
private static final long FIELDS_OFFSET;
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final jdk.internal.misc.Unsafe UNSAFE;
|
||||
static {
|
||||
try {
|
||||
sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
|
||||
jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
FIELDS_OFFSET = unsafe.objectFieldOffset(
|
||||
InetSocketAddress.class.getDeclaredField("holder"));
|
||||
UNSAFE = unsafe;
|
||||
|
@ -61,21 +61,21 @@ public interface SocketOptions {
|
||||
* If the requested option is binary, it can be set using this method by
|
||||
* a java.lang.Boolean:
|
||||
* <BR><PRE>
|
||||
* s.setOption(TCP_NODELAY, new Boolean(true));
|
||||
* s.setOption(TCP_NODELAY, Boolean.TRUE);
|
||||
* // OK - enables TCP_NODELAY, a binary option
|
||||
* </PRE>
|
||||
* <BR>
|
||||
* Any option can be disabled using this method with a Boolean(false):
|
||||
* Any option can be disabled using this method with a Boolean.FALSE:
|
||||
* <BR><PRE>
|
||||
* s.setOption(TCP_NODELAY, new Boolean(false));
|
||||
* s.setOption(TCP_NODELAY, Boolean.FALSE);
|
||||
* // OK - disables TCP_NODELAY
|
||||
* s.setOption(SO_LINGER, new Boolean(false));
|
||||
* s.setOption(SO_LINGER, Boolean.FALSE);
|
||||
* // OK - disables SO_LINGER
|
||||
* </PRE>
|
||||
* <BR>
|
||||
* For an option that has a notion of on and off, and requires
|
||||
* a non-boolean parameter, setting its value to anything other than
|
||||
* <I>Boolean(false)</I> implicitly enables it.
|
||||
* <I>Boolean.FALSE</I> implicitly enables it.
|
||||
* <BR>
|
||||
* Throws SocketException if the option is unrecognized,
|
||||
* the socket is closed, or some low-level error occurred
|
||||
@ -91,8 +91,8 @@ public interface SocketOptions {
|
||||
|
||||
/**
|
||||
* Fetch the value of an option.
|
||||
* Binary options will return java.lang.Boolean(true)
|
||||
* if enabled, java.lang.Boolean(false) if disabled, e.g.:
|
||||
* Binary options will return java.lang.Boolean.TRUE
|
||||
* if enabled, java.lang.Boolean.FALSE if disabled, e.g.:
|
||||
* <BR><PRE>
|
||||
* SocketImpl s;
|
||||
* ...
|
||||
@ -105,13 +105,13 @@ public interface SocketOptions {
|
||||
* <P>
|
||||
* For options that take a particular type as a parameter,
|
||||
* getOption(int) will return the parameter's value, else
|
||||
* it will return java.lang.Boolean(false):
|
||||
* it will return java.lang.Boolean.FALSE:
|
||||
* <PRE>
|
||||
* Object o = s.getOption(SO_LINGER);
|
||||
* if (o instanceof Integer) {
|
||||
* System.out.print("Linger time is " + ((Integer)o).intValue());
|
||||
* } else {
|
||||
* // the true type of o is java.lang.Boolean(false);
|
||||
* // the true type of o is java.lang.Boolean.FALSE;
|
||||
* }
|
||||
* </PRE>
|
||||
*
|
||||
|
@ -32,6 +32,7 @@ import java.security.PrivilegedAction;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
import java.util.ServiceConfigurationError;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.StringTokenizer;
|
||||
@ -1250,7 +1251,7 @@ public abstract class URLConnection {
|
||||
|
||||
if (handler != null) {
|
||||
ContentHandler h = handlers.putIfAbsent(contentType, handler);
|
||||
return h != null ? h : handler;
|
||||
return Objects.requireNonNullElse(h, handler);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -1263,7 +1264,7 @@ public abstract class URLConnection {
|
||||
assert handler != null;
|
||||
|
||||
ContentHandler h = handlers.putIfAbsent(contentType, handler);
|
||||
return h != null ? h : handler;
|
||||
return Objects.requireNonNullElse(h, handler);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -26,7 +26,7 @@
|
||||
package java.nio;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -37,6 +37,7 @@ import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.ServiceConfigurationError;
|
||||
@ -625,6 +626,7 @@ public abstract class Charset
|
||||
|
||||
private final String name; // tickles a bug in oldjavac
|
||||
private final String[] aliases; // tickles a bug in oldjavac
|
||||
private final String[] zeroAliases = new String[0];
|
||||
private Set<String> aliasSet = null;
|
||||
|
||||
/**
|
||||
@ -642,7 +644,7 @@ public abstract class Charset
|
||||
*/
|
||||
protected Charset(String canonicalName, String[] aliases) {
|
||||
checkName(canonicalName);
|
||||
String[] as = (aliases == null) ? new String[0] : aliases;
|
||||
String[] as = Objects.requireNonNullElse(aliases, zeroAliases);
|
||||
for (int i = 0; i < as.length; i++)
|
||||
checkName(as[i]);
|
||||
this.name = canonicalName;
|
||||
|
@ -419,7 +419,7 @@ public class SecureRandom extends java.util.Random {
|
||||
* @since 1.5
|
||||
*/
|
||||
public String getAlgorithm() {
|
||||
return (algorithm != null) ? algorithm : "unknown";
|
||||
return Objects.toString(algorithm, "unknown");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2015, 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
|
||||
@ -359,8 +359,8 @@ public final class Duration
|
||||
* there must be at least one section after the "T".
|
||||
* The number part of each section must consist of one or more ASCII digits.
|
||||
* The number may be prefixed by the ASCII negative or positive symbol.
|
||||
* The number of days, hours and minutes must parse to an {@code long}.
|
||||
* The number of seconds must parse to an {@code long} with optional fraction.
|
||||
* The number of days, hours and minutes must parse to a {@code long}.
|
||||
* The number of seconds must parse to a {@code long} with optional fraction.
|
||||
* The decimal point may be either a dot or a comma.
|
||||
* The fractional part may have from zero to 9 digits.
|
||||
* <p>
|
||||
@ -374,9 +374,9 @@ public final class Duration
|
||||
* "PT10H" -- parses as "10 hours" (where an hour is 3600 seconds)
|
||||
* "P2D" -- parses as "2 days" (where a day is 24 hours or 86400 seconds)
|
||||
* "P2DT3H4M" -- parses as "2 days, 3 hours and 4 minutes"
|
||||
* "P-6H3M" -- parses as "-6 hours and +3 minutes"
|
||||
* "-P6H3M" -- parses as "-6 hours and -3 minutes"
|
||||
* "-P-6H+3M" -- parses as "+6 hours and -3 minutes"
|
||||
* "PT-6H3M" -- parses as "-6 hours and +3 minutes"
|
||||
* "-PT6H3M" -- parses as "-6 hours and -3 minutes"
|
||||
* "-PT-6H+3M" -- parses as "+6 hours and -3 minutes"
|
||||
* </pre>
|
||||
*
|
||||
* @param text the text to parse, not null
|
||||
@ -402,7 +402,8 @@ public final class Duration
|
||||
long hoursAsSecs = parseNumber(text, hourStart, hourEnd, SECONDS_PER_HOUR, "hours");
|
||||
long minsAsSecs = parseNumber(text, minuteStart, minuteEnd, SECONDS_PER_MINUTE, "minutes");
|
||||
long seconds = parseNumber(text, secondStart, secondEnd, 1, "seconds");
|
||||
int nanos = parseFraction(text, fractionStart, fractionEnd, seconds < 0 ? -1 : 1);
|
||||
boolean negativeSecs = secondStart >= 0 && text.charAt(secondStart) == '-';
|
||||
int nanos = parseFraction(text, fractionStart, fractionEnd, negativeSecs ? -1 : 1);
|
||||
try {
|
||||
return create(negate, daysAsSecs, hoursAsSecs, minsAsSecs, seconds, nanos);
|
||||
} catch (ArithmeticException ex) {
|
||||
|
@ -310,8 +310,7 @@ public abstract class ZoneId implements Serializable {
|
||||
public static ZoneId of(String zoneId, Map<String, String> aliasMap) {
|
||||
Objects.requireNonNull(zoneId, "zoneId");
|
||||
Objects.requireNonNull(aliasMap, "aliasMap");
|
||||
String id = aliasMap.get(zoneId);
|
||||
id = (id != null ? id : zoneId);
|
||||
String id = Objects.requireNonNullElse(aliasMap.get(zoneId), zoneId);
|
||||
return of(id);
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ public interface Chronology extends Comparable<Chronology> {
|
||||
static Chronology from(TemporalAccessor temporal) {
|
||||
Objects.requireNonNull(temporal, "temporal");
|
||||
Chronology obj = temporal.query(TemporalQueries.chronology());
|
||||
return (obj != null ? obj : IsoChronology.INSTANCE);
|
||||
return Objects.requireNonNullElse(obj, IsoChronology.INSTANCE);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -2892,7 +2892,8 @@ public final class DateTimeFormatterBuilder {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ReducedValue(" + field + "," + minWidth + "," + maxWidth + "," + (baseDate != null ? baseDate : baseValue) + ")";
|
||||
return "ReducedValue(" + field + "," + minWidth + "," + maxWidth +
|
||||
"," + Objects.requireNonNullElse(baseDate, baseValue) + ")";
|
||||
}
|
||||
}
|
||||
|
||||
@ -3851,6 +3852,10 @@ public final class DateTimeFormatterBuilder {
|
||||
return parseOffsetBased(context, text, position, position + 2, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
|
||||
} else if (context.charEquals(nextChar, 'G') && length >= position + 3 &&
|
||||
context.charEquals(nextNextChar, 'M') && context.charEquals(text.charAt(position + 2), 'T')) {
|
||||
if (length >= position + 4 && context.charEquals(text.charAt(position + 3), '0')) {
|
||||
context.setParsed(ZoneId.of("GMT0"));
|
||||
return position + 4;
|
||||
}
|
||||
return parseOffsetBased(context, text, position, position + 3, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
|
||||
}
|
||||
}
|
||||
@ -4328,7 +4333,7 @@ public final class DateTimeFormatterBuilder {
|
||||
private String getChronologyName(Chronology chrono, Locale locale) {
|
||||
String key = "calendarname." + chrono.getCalendarType();
|
||||
String name = DateTimeTextProvider.getLocalizedResource(key, locale);
|
||||
return name != null ? name : chrono.getId();
|
||||
return Objects.requireNonNullElseGet(name, () -> chrono.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ final class DateTimePrintContext {
|
||||
if (overrideZone != null) {
|
||||
// if have zone and instant, calculation is simple, defaulting chrono if necessary
|
||||
if (temporal.isSupported(INSTANT_SECONDS)) {
|
||||
Chronology chrono = (effectiveChrono != null ? effectiveChrono : IsoChronology.INSTANCE);
|
||||
Chronology chrono = Objects.requireNonNullElse(effectiveChrono, IsoChronology.INSTANCE);
|
||||
return chrono.zonedDateTime(Instant.from(temporal), overrideZone);
|
||||
}
|
||||
// block changing zone on OffsetTime, and similar problem cases
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2015, 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
|
||||
@ -102,7 +102,7 @@ import sun.util.locale.provider.LocaleResources;
|
||||
* The complete date is expressed using three fields:
|
||||
* <ul>
|
||||
* <li>{@link #DAY_OF_QUARTER DAY_OF_QUARTER} - the day within the quarter, from 1 to 90, 91 or 92
|
||||
* <li>{@link #QUARTER_OF_YEAR QUARTER_OF_YEAR} - the week within the week-based-year
|
||||
* <li>{@link #QUARTER_OF_YEAR QUARTER_OF_YEAR} - the quarter within the year, from 1 to 4
|
||||
* <li>{@link ChronoField#YEAR YEAR} - the standard ISO year
|
||||
* </ul>
|
||||
*
|
||||
@ -571,9 +571,6 @@ public final class IsoFields {
|
||||
//-------------------------------------------------------------------------
|
||||
private static final int[] QUARTER_DAYS = {0, 90, 181, 273, 0, 91, 182, 274};
|
||||
|
||||
private static boolean isIso(TemporalAccessor temporal) {
|
||||
return Chronology.from(temporal).equals(IsoChronology.INSTANCE);
|
||||
}
|
||||
|
||||
private static void ensureIso(TemporalAccessor temporal) {
|
||||
if (isIso(temporal) == false) {
|
||||
@ -681,7 +678,7 @@ public final class IsoFields {
|
||||
|
||||
@Override
|
||||
public boolean isSupportedBy(Temporal temporal) {
|
||||
return temporal.isSupported(EPOCH_DAY);
|
||||
return temporal.isSupported(EPOCH_DAY) && isIso(temporal);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -721,4 +718,8 @@ public final class IsoFields {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isIso(TemporalAccessor temporal) {
|
||||
return Chronology.from(temporal).equals(IsoChronology.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
@ -2090,7 +2090,8 @@ public class Collections {
|
||||
* through the returned set.<p>
|
||||
*
|
||||
* It is imperative that the user manually synchronize on the returned
|
||||
* set when iterating over it:
|
||||
* collection when traversing it via {@link Iterator}, {@link Spliterator}
|
||||
* or {@link Stream}:
|
||||
* <pre>
|
||||
* Set s = Collections.synchronizedSet(new HashSet());
|
||||
* ...
|
||||
@ -2149,8 +2150,9 @@ public class Collections {
|
||||
* through the returned sorted set (or its views).<p>
|
||||
*
|
||||
* It is imperative that the user manually synchronize on the returned
|
||||
* sorted set when iterating over it or any of its {@code subSet},
|
||||
* {@code headSet}, or {@code tailSet} views.
|
||||
* sorted set when traversing it or any of its {@code subSet},
|
||||
* {@code headSet}, or {@code tailSet} views via {@link Iterator},
|
||||
* {@link Spliterator} or {@link Stream}:
|
||||
* <pre>
|
||||
* SortedSet s = Collections.synchronizedSortedSet(new TreeSet());
|
||||
* ...
|
||||
@ -2240,8 +2242,9 @@ public class Collections {
|
||||
* accomplished through the returned navigable set (or its views).<p>
|
||||
*
|
||||
* It is imperative that the user manually synchronize on the returned
|
||||
* navigable set when iterating over it or any of its {@code subSet},
|
||||
* {@code headSet}, or {@code tailSet} views.
|
||||
* navigable set when traversing it, or any of its {@code subSet},
|
||||
* {@code headSet}, or {@code tailSet} views, via {@link Iterator},
|
||||
* {@link Spliterator} or {@link Stream}:
|
||||
* <pre>
|
||||
* NavigableSet s = Collections.synchronizedNavigableSet(new TreeSet());
|
||||
* ...
|
||||
@ -2355,7 +2358,8 @@ public class Collections {
|
||||
* through the returned list.<p>
|
||||
*
|
||||
* It is imperative that the user manually synchronize on the returned
|
||||
* list when iterating over it:
|
||||
* list when traversing it via {@link Iterator}, {@link Spliterator}
|
||||
* or {@link Stream}:
|
||||
* <pre>
|
||||
* List list = Collections.synchronizedList(new ArrayList());
|
||||
* ...
|
||||
@ -2523,7 +2527,8 @@ public class Collections {
|
||||
* through the returned map.<p>
|
||||
*
|
||||
* It is imperative that the user manually synchronize on the returned
|
||||
* map when iterating over any of its collection views:
|
||||
* map when traversing any of its collection views via {@link Iterator},
|
||||
* {@link Spliterator} or {@link Stream}:
|
||||
* <pre>
|
||||
* Map m = Collections.synchronizedMap(new HashMap());
|
||||
* ...
|
||||
@ -2700,9 +2705,10 @@ public class Collections {
|
||||
* through the returned sorted map (or its views).<p>
|
||||
*
|
||||
* It is imperative that the user manually synchronize on the returned
|
||||
* sorted map when iterating over any of its collection views, or the
|
||||
* sorted map when traversing any of its collection views, or the
|
||||
* collections views of any of its {@code subMap}, {@code headMap} or
|
||||
* {@code tailMap} views.
|
||||
* {@code tailMap} views, via {@link Iterator}, {@link Spliterator} or
|
||||
* {@link Stream}:
|
||||
* <pre>
|
||||
* SortedMap m = Collections.synchronizedSortedMap(new TreeMap());
|
||||
* ...
|
||||
@ -2797,9 +2803,10 @@ public class Collections {
|
||||
* accomplished through the returned navigable map (or its views).<p>
|
||||
*
|
||||
* It is imperative that the user manually synchronize on the returned
|
||||
* navigable map when iterating over any of its collection views, or the
|
||||
* navigable map when traversing any of its collection views, or the
|
||||
* collections views of any of its {@code subMap}, {@code headMap} or
|
||||
* {@code tailMap} views.
|
||||
* {@code tailMap} views, via {@link Iterator}, {@link Spliterator} or
|
||||
* {@link Stream}:
|
||||
* <pre>
|
||||
* NavigableMap m = Collections.synchronizedNavigableMap(new TreeMap());
|
||||
* ...
|
||||
|
@ -49,6 +49,7 @@ import java.text.DecimalFormatSymbols;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.Objects;
|
||||
|
||||
import java.time.DateTimeException;
|
||||
import java.time.Instant;
|
||||
@ -3860,7 +3861,7 @@ public final class Formatter implements Closeable, Flushable {
|
||||
ampm = dfs.getAmPmStrings();
|
||||
}
|
||||
String s = ampm[t.get(Calendar.AM_PM)];
|
||||
sb.append(s.toLowerCase(l != null ? l : Locale.US));
|
||||
sb.append(s.toLowerCase(Objects.requireNonNullElse(l, Locale.US)));
|
||||
break;
|
||||
}
|
||||
case DateTime.SECONDS_SINCE_EPOCH: { // 's' (0 - 99...?)
|
||||
@ -3893,7 +3894,7 @@ public final class Formatter implements Closeable, Flushable {
|
||||
TimeZone tz = t.getTimeZone();
|
||||
sb.append(tz.getDisplayName((t.get(Calendar.DST_OFFSET) != 0),
|
||||
TimeZone.SHORT,
|
||||
(l == null) ? Locale.US : l));
|
||||
Objects.requireNonNullElse(l, Locale.US)));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3901,7 +3902,7 @@ public final class Formatter implements Closeable, Flushable {
|
||||
case DateTime.NAME_OF_DAY_ABBREV: // 'a'
|
||||
case DateTime.NAME_OF_DAY: { // 'A'
|
||||
int i = t.get(Calendar.DAY_OF_WEEK);
|
||||
Locale lt = ((l == null) ? Locale.US : l);
|
||||
Locale lt = Objects.requireNonNullElse(l, Locale.US);
|
||||
DateFormatSymbols dfs = DateFormatSymbols.getInstance(lt);
|
||||
if (c == DateTime.NAME_OF_DAY)
|
||||
sb.append(dfs.getWeekdays()[i]);
|
||||
@ -3913,7 +3914,7 @@ public final class Formatter implements Closeable, Flushable {
|
||||
case DateTime.NAME_OF_MONTH_ABBREV_X: // 'h' -- same b
|
||||
case DateTime.NAME_OF_MONTH: { // 'B'
|
||||
int i = t.get(Calendar.MONTH);
|
||||
Locale lt = ((l == null) ? Locale.US : l);
|
||||
Locale lt = Objects.requireNonNullElse(l, Locale.US);
|
||||
DateFormatSymbols dfs = DateFormatSymbols.getInstance(lt);
|
||||
if (c == DateTime.NAME_OF_MONTH)
|
||||
sb.append(dfs.getMonths()[i]);
|
||||
@ -3984,7 +3985,7 @@ public final class Formatter implements Closeable, Flushable {
|
||||
StringBuilder tsb = new StringBuilder();
|
||||
print(tsb, t, DateTime.AM_PM, l);
|
||||
|
||||
sb.append(tsb.toString().toUpperCase(l != null ? l : Locale.US));
|
||||
sb.append(tsb.toString().toUpperCase(Objects.requireNonNullElse(l, Locale.US)));
|
||||
break;
|
||||
}
|
||||
case DateTime.DATE_TIME: { // 'c' (Sat Nov 04 12:02:33 EST 1999)
|
||||
@ -4092,7 +4093,7 @@ public final class Formatter implements Closeable, Flushable {
|
||||
ampm = dfs.getAmPmStrings();
|
||||
}
|
||||
String s = ampm[t.get(ChronoField.AMPM_OF_DAY)];
|
||||
sb.append(s.toLowerCase(l != null ? l : Locale.US));
|
||||
sb.append(s.toLowerCase(Objects.requireNonNullElse(l, Locale.US)));
|
||||
break;
|
||||
}
|
||||
case DateTime.SECONDS_SINCE_EPOCH: { // 's' (0 - 99...?)
|
||||
@ -4131,7 +4132,7 @@ public final class Formatter implements Closeable, Flushable {
|
||||
sb.append(TimeZone.getTimeZone(zid.getId())
|
||||
.getDisplayName(zid.getRules().isDaylightSavings(instant),
|
||||
TimeZone.SHORT,
|
||||
(l == null) ? Locale.US : l));
|
||||
Objects.requireNonNullElse(l, Locale.US)));
|
||||
break;
|
||||
}
|
||||
sb.append(zid.getId());
|
||||
@ -4141,7 +4142,7 @@ public final class Formatter implements Closeable, Flushable {
|
||||
case DateTime.NAME_OF_DAY_ABBREV: // 'a'
|
||||
case DateTime.NAME_OF_DAY: { // 'A'
|
||||
int i = t.get(ChronoField.DAY_OF_WEEK) % 7 + 1;
|
||||
Locale lt = ((l == null) ? Locale.US : l);
|
||||
Locale lt = Objects.requireNonNullElse(l, Locale.US);
|
||||
DateFormatSymbols dfs = DateFormatSymbols.getInstance(lt);
|
||||
if (c == DateTime.NAME_OF_DAY)
|
||||
sb.append(dfs.getWeekdays()[i]);
|
||||
@ -4153,7 +4154,7 @@ public final class Formatter implements Closeable, Flushable {
|
||||
case DateTime.NAME_OF_MONTH_ABBREV_X: // 'h' -- same b
|
||||
case DateTime.NAME_OF_MONTH: { // 'B'
|
||||
int i = t.get(ChronoField.MONTH_OF_YEAR) - 1;
|
||||
Locale lt = ((l == null) ? Locale.US : l);
|
||||
Locale lt = Objects.requireNonNullElse(l, Locale.US);
|
||||
DateFormatSymbols dfs = DateFormatSymbols.getInstance(lt);
|
||||
if (c == DateTime.NAME_OF_MONTH)
|
||||
sb.append(dfs.getMonths()[i]);
|
||||
@ -4223,7 +4224,7 @@ public final class Formatter implements Closeable, Flushable {
|
||||
// this may be in wrong place for some locales
|
||||
StringBuilder tsb = new StringBuilder();
|
||||
print(tsb, t, DateTime.AM_PM, l);
|
||||
sb.append(tsb.toString().toUpperCase(l != null ? l : Locale.US));
|
||||
sb.append(tsb.toString().toUpperCase(Objects.requireNonNullElse(l, Locale.US)));
|
||||
break;
|
||||
}
|
||||
case DateTime.DATE_TIME: { // 'c' (Sat Nov 04 12:02:33 EST 1999)
|
||||
|
@ -295,7 +295,7 @@ public final class Objects {
|
||||
* {@code defaultObj} is {@code null}
|
||||
* @since 9
|
||||
*/
|
||||
public static <T> T nonNullElse(T obj, T defaultObj) {
|
||||
public static <T> T requireNonNullElse(T obj, T defaultObj) {
|
||||
return (obj != null) ? obj : requireNonNull(defaultObj, "defaultObj");
|
||||
}
|
||||
|
||||
@ -314,8 +314,9 @@ public final class Objects {
|
||||
* the {@code supplier.get()} value is {@code null}
|
||||
* @since 9
|
||||
*/
|
||||
public static <T> T nonNullElseGet(T obj, Supplier<? extends T> supplier) {
|
||||
return (obj != null) ? obj : requireNonNull(requireNonNull(supplier, "supplier").get(), "supplier.get()");
|
||||
public static <T> T requireNonNullElseGet(T obj, Supplier<? extends T> supplier) {
|
||||
return (obj != null) ? obj
|
||||
: requireNonNull(requireNonNull(supplier, "supplier").get(), "supplier.get()");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ import java.util.stream.IntStream;
|
||||
import java.util.stream.LongStream;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
/**
|
||||
* An instance of this class is used to generate a stream of
|
||||
|
@ -2775,7 +2775,7 @@ public class CompletableFuture<T> implements Future<T>, CompletionStage<T> {
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long RESULT;
|
||||
private static final long STACK;
|
||||
private static final long NEXT;
|
||||
|
@ -297,7 +297,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
|
||||
* Table accesses require volatile/atomic reads, writes, and
|
||||
* CASes. Because there is no other way to arrange this without
|
||||
* adding further indirections, we use intrinsics
|
||||
* (sun.misc.Unsafe) operations.
|
||||
* (jdk.internal.misc.Unsafe) operations.
|
||||
*
|
||||
* We use the top (sign) bit of Node hash fields for control
|
||||
* purposes -- it is available anyway because of addressing
|
||||
@ -3287,7 +3287,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
|
||||
return true;
|
||||
}
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long LOCKSTATE;
|
||||
static {
|
||||
try {
|
||||
@ -6330,7 +6330,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long SIZECTL;
|
||||
private static final long TRANSFERINDEX;
|
||||
private static final long BASECOUNT;
|
||||
|
@ -326,7 +326,7 @@ public class ConcurrentLinkedDeque<E>
|
||||
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long PREV;
|
||||
private static final long ITEM;
|
||||
private static final long NEXT;
|
||||
@ -1608,7 +1608,7 @@ public class ConcurrentLinkedDeque<E>
|
||||
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long HEAD;
|
||||
private static final long TAIL;
|
||||
static {
|
||||
|
@ -929,7 +929,7 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
|
||||
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long HEAD;
|
||||
private static final long TAIL;
|
||||
private static final long ITEM;
|
||||
|
@ -534,7 +534,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long VALUE;
|
||||
private static final long NEXT;
|
||||
|
||||
@ -614,7 +614,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long RIGHT;
|
||||
static {
|
||||
try {
|
||||
@ -3596,7 +3596,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long HEAD;
|
||||
static {
|
||||
try {
|
||||
|
@ -510,7 +510,7 @@ public class ConcurrentSkipListSet<E>
|
||||
U.putObjectVolatile(this, MAP, map);
|
||||
}
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long MAP;
|
||||
static {
|
||||
try {
|
||||
|
@ -1545,7 +1545,7 @@ public class CopyOnWriteArrayList<E>
|
||||
private void resetLock() {
|
||||
U.putObjectVolatile(this, LOCK, new Object());
|
||||
}
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long LOCK;
|
||||
static {
|
||||
try {
|
||||
|
@ -754,7 +754,7 @@ public abstract class CountedCompleter<T> extends ForkJoinTask<T> {
|
||||
protected void setRawResult(T t) { }
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long PENDING;
|
||||
static {
|
||||
try {
|
||||
|
@ -625,7 +625,7 @@ public class Exchanger<V> {
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long BOUND;
|
||||
private static final long SLOT;
|
||||
private static final long MATCH;
|
||||
|
@ -1337,7 +1337,7 @@ public class ForkJoinPool extends AbstractExecutorService {
|
||||
}
|
||||
|
||||
// Unsafe mechanics. Note that some are (and must be) the same as in FJP
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long QLOCK;
|
||||
private static final int ABASE;
|
||||
private static final int ASHIFT;
|
||||
@ -3452,7 +3452,7 @@ public class ForkJoinPool extends AbstractExecutorService {
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long CTL;
|
||||
private static final long RUNSTATE;
|
||||
private static final int ABASE;
|
||||
|
@ -1517,7 +1517,7 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long STATUS;
|
||||
|
||||
static {
|
||||
|
@ -185,7 +185,7 @@ public class ForkJoinWorkerThread extends Thread {
|
||||
}
|
||||
|
||||
// Set up to allow setting thread fields in constructor
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long THREADLOCALS;
|
||||
private static final long INHERITABLETHREADLOCALS;
|
||||
private static final long INHERITEDACCESSCONTROLCONTEXT;
|
||||
@ -248,7 +248,7 @@ public class ForkJoinWorkerThread extends Thread {
|
||||
*/
|
||||
private static ThreadGroup createThreadGroup() {
|
||||
try {
|
||||
sun.misc.Unsafe u = sun.misc.Unsafe.getUnsafe();
|
||||
jdk.internal.misc.Unsafe u = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
long tg = u.objectFieldOffset
|
||||
(Thread.class.getDeclaredField("group"));
|
||||
long gp = u.objectFieldOffset
|
||||
|
@ -484,7 +484,7 @@ public class FutureTask<V> implements RunnableFuture<V> {
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long STATE;
|
||||
private static final long RUNNER;
|
||||
private static final long WAITERS;
|
||||
|
@ -538,7 +538,7 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
|
||||
private static final long serialVersionUID = -3375979862319811754L;
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long ITEM;
|
||||
private static final long NEXT;
|
||||
private static final long WAITER;
|
||||
@ -1564,7 +1564,7 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
|
||||
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long HEAD;
|
||||
private static final long TAIL;
|
||||
private static final long SWEEPVOTES;
|
||||
|
@ -1137,7 +1137,7 @@ public class Phaser {
|
||||
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long STATE;
|
||||
static {
|
||||
try {
|
||||
|
@ -1010,7 +1010,7 @@ public class PriorityBlockingQueue<E> extends AbstractQueue<E>
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long ALLOCATIONSPINLOCK;
|
||||
static {
|
||||
try {
|
||||
|
@ -1596,7 +1596,7 @@ public class SubmissionPublisher<T> implements Flow.Publisher<T>,
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long CTL;
|
||||
private static final long TAIL;
|
||||
private static final long HEAD;
|
||||
|
@ -283,7 +283,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long MATCH;
|
||||
private static final long NEXT;
|
||||
|
||||
@ -509,7 +509,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long HEAD;
|
||||
static {
|
||||
try {
|
||||
@ -575,7 +575,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long ITEM;
|
||||
private static final long NEXT;
|
||||
|
||||
@ -817,7 +817,7 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
|
||||
}
|
||||
}
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long HEAD;
|
||||
private static final long TAIL;
|
||||
private static final long CLEANME;
|
||||
|
@ -1050,7 +1050,7 @@ public class ThreadLocalRandom extends Random {
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long SEED;
|
||||
private static final long PROBE;
|
||||
private static final long SECONDARY;
|
||||
|
@ -49,7 +49,7 @@ package java.util.concurrent.atomic;
|
||||
public class AtomicBoolean implements java.io.Serializable {
|
||||
private static final long serialVersionUID = 4654671469794556979L;
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long VALUE;
|
||||
|
||||
static {
|
||||
|
@ -54,7 +54,7 @@ import java.util.function.IntUnaryOperator;
|
||||
public class AtomicInteger extends Number implements java.io.Serializable {
|
||||
private static final long serialVersionUID = 6214790243416807050L;
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long VALUE;
|
||||
|
||||
static {
|
||||
|
@ -49,7 +49,7 @@ import java.util.function.IntUnaryOperator;
|
||||
public class AtomicIntegerArray implements java.io.Serializable {
|
||||
private static final long serialVersionUID = 2862133569453604235L;
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final int ABASE;
|
||||
private static final int ASHIFT;
|
||||
private final int[] array;
|
||||
|
@ -367,7 +367,7 @@ public abstract class AtomicIntegerFieldUpdater<T> {
|
||||
*/
|
||||
private static class AtomicIntegerFieldUpdaterImpl<T>
|
||||
extends AtomicIntegerFieldUpdater<T> {
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private final long offset;
|
||||
private final Class<T> tclass;
|
||||
private final Class<?> cclass;
|
||||
|
@ -54,7 +54,7 @@ import java.util.function.LongUnaryOperator;
|
||||
public class AtomicLong extends Number implements java.io.Serializable {
|
||||
private static final long serialVersionUID = 1927816293512124184L;
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long VALUE;
|
||||
|
||||
/**
|
||||
|
@ -48,7 +48,7 @@ import java.util.function.LongUnaryOperator;
|
||||
public class AtomicLongArray implements java.io.Serializable {
|
||||
private static final long serialVersionUID = -2308431214976778248L;
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final int ABASE;
|
||||
private static final int ASHIFT;
|
||||
private final long[] array;
|
||||
|
@ -366,7 +366,7 @@ public abstract class AtomicLongFieldUpdater<T> {
|
||||
}
|
||||
|
||||
private static class CASUpdater<T> extends AtomicLongFieldUpdater<T> {
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private final long offset;
|
||||
private final Class<T> tclass;
|
||||
private final Class<?> cclass;
|
||||
@ -490,7 +490,7 @@ public abstract class AtomicLongFieldUpdater<T> {
|
||||
|
||||
|
||||
private static class LockedUpdater<T> extends AtomicLongFieldUpdater<T> {
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private final long offset;
|
||||
private final Class<T> tclass;
|
||||
private final Class<?> cclass;
|
||||
|
@ -190,7 +190,7 @@ public class AtomicMarkableReference<V> {
|
||||
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long PAIR;
|
||||
static {
|
||||
try {
|
||||
|
@ -49,7 +49,7 @@ import java.util.function.UnaryOperator;
|
||||
public class AtomicReference<V> implements java.io.Serializable {
|
||||
private static final long serialVersionUID = -1848883965231344442L;
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long VALUE;
|
||||
|
||||
static {
|
||||
|
@ -52,7 +52,7 @@ import java.util.function.UnaryOperator;
|
||||
public class AtomicReferenceArray<E> implements java.io.Serializable {
|
||||
private static final long serialVersionUID = -6209656149925076980L;
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long ARRAY;
|
||||
private static final int ABASE;
|
||||
private static final int ASHIFT;
|
||||
|
@ -284,7 +284,7 @@ public abstract class AtomicReferenceFieldUpdater<T,V> {
|
||||
|
||||
private static final class AtomicReferenceFieldUpdaterImpl<T,V>
|
||||
extends AtomicReferenceFieldUpdater<T,V> {
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private final long offset;
|
||||
private final Class<T> tclass;
|
||||
private final Class<V> vclass;
|
||||
|
@ -190,7 +190,7 @@ public class AtomicStampedReference<V> {
|
||||
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long PAIR;
|
||||
static {
|
||||
try {
|
||||
|
@ -133,7 +133,7 @@ abstract class Striped64 extends Number {
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long VALUE;
|
||||
static {
|
||||
try {
|
||||
@ -372,7 +372,7 @@ abstract class Striped64 extends Number {
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long BASE;
|
||||
private static final long CELLSBUSY;
|
||||
private static final long PROBE;
|
||||
|
@ -1821,7 +1821,7 @@ public abstract class AbstractQueuedLongSynchronizer
|
||||
* are at it, we do the same for other CASable fields (which could
|
||||
* otherwise be done with atomic field updaters).
|
||||
*/
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long STATE;
|
||||
private static final long HEAD;
|
||||
private static final long TAIL;
|
||||
|
@ -524,7 +524,7 @@ public abstract class AbstractQueuedSynchronizer
|
||||
return U.compareAndSwapObject(this, NEXT, expect, update);
|
||||
}
|
||||
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long NEXT;
|
||||
static final long PREV;
|
||||
private static final long THREAD;
|
||||
@ -2285,7 +2285,7 @@ public abstract class AbstractQueuedSynchronizer
|
||||
* are at it, we do the same for other CASable fields (which could
|
||||
* otherwise be done with atomic field updaters).
|
||||
*/
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long STATE;
|
||||
private static final long HEAD;
|
||||
private static final long TAIL;
|
||||
|
@ -394,7 +394,7 @@ public class LockSupport {
|
||||
}
|
||||
|
||||
// Hotspot implementation via intrinsics API
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long PARKBLOCKER;
|
||||
private static final long SECONDARY;
|
||||
static {
|
||||
|
@ -1501,7 +1501,7 @@ public class ReentrantReadWriteLock
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long TID;
|
||||
static {
|
||||
try {
|
||||
|
@ -1398,7 +1398,7 @@ public class StampedLock implements java.io.Serializable {
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe U = sun.misc.Unsafe.getUnsafe();
|
||||
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
private static final long STATE;
|
||||
private static final long WHEAD;
|
||||
private static final long WTAIL;
|
||||
|
@ -28,7 +28,7 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import jdk.internal.HotSpotIntrinsicCandidate;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import sun.nio.ch.DirectBuffer;
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,7 @@ import java.io.Console;
|
||||
import java.io.FileDescriptor;
|
||||
import java.security.ProtectionDomain;
|
||||
import java.security.AccessController;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
/** A repository of "shared secrets", which are a mechanism for
|
||||
calling implementation-private methods in another package without
|
||||
|
@ -78,7 +78,7 @@ public class AnonymousClassLoader {
|
||||
this.hostClass = hostClass;
|
||||
}
|
||||
|
||||
public static AnonymousClassLoader make(sun.misc.Unsafe unsafe, Class<?> hostClass) {
|
||||
public static AnonymousClassLoader make(jdk.internal.misc.Unsafe unsafe, Class<?> hostClass) {
|
||||
if (unsafe == null) throw new NullPointerException();
|
||||
return new AnonymousClassLoader(hostClass);
|
||||
}
|
||||
@ -189,13 +189,13 @@ public class AnonymousClassLoader {
|
||||
private static int fakeNameCounter = 99999;
|
||||
|
||||
// ignore two warnings on this line:
|
||||
private static sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
|
||||
private static jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
// preceding line requires that this class be on the boot class path
|
||||
|
||||
private static final Method defineAnonymousClass;
|
||||
static {
|
||||
Method dac = null;
|
||||
Class<? extends sun.misc.Unsafe> unsafeClass = unsafe.getClass();
|
||||
Class<? extends jdk.internal.misc.Unsafe> unsafeClass = unsafe.getClass();
|
||||
try {
|
||||
dac = unsafeClass.getMethod("defineAnonymousClass",
|
||||
Class.class,
|
||||
|
@ -27,18 +27,19 @@ package sun.invoke.util;
|
||||
|
||||
public enum Wrapper {
|
||||
// wrapperType primitiveType char zero emptyArray format
|
||||
BOOLEAN( Boolean.class, boolean.class, 'Z', (Boolean)false, new boolean[0], Format.unsigned( 1)),
|
||||
BOOLEAN( Boolean.class, boolean.class, 'Z', Boolean.FALSE, new boolean[0], Format.unsigned( 1)),
|
||||
// These must be in the order defined for widening primitive conversions in JLS 5.1.2
|
||||
BYTE ( Byte.class, byte.class, 'B', (Byte)(byte)0, new byte[0], Format.signed( 8)),
|
||||
SHORT ( Short.class, short.class, 'S', (Short)(short)0, new short[0], Format.signed( 16)),
|
||||
CHAR (Character.class, char.class, 'C', (Character)(char)0, new char[0], Format.unsigned(16)),
|
||||
INT ( Integer.class, int.class, 'I', (Integer)/*(int)*/0, new int[0], Format.signed( 32)),
|
||||
LONG ( Long.class, long.class, 'J', (Long)(long)0, new long[0], Format.signed( 64)),
|
||||
FLOAT ( Float.class, float.class, 'F', (Float)(float)0, new float[0], Format.floating(32)),
|
||||
DOUBLE ( Double.class, double.class, 'D', (Double)(double)0, new double[0], Format.floating(64)),
|
||||
OBJECT ( Object.class, Object.class, 'L', null, new Object[0], Format.other( 1)),
|
||||
// Avoid boxing integral types here to defer initialization of internal caches
|
||||
BYTE ( Byte.class, byte.class, 'B', new Byte((byte)0), new byte[0], Format.signed( 8)),
|
||||
SHORT ( Short.class, short.class, 'S', new Short((short)0), new short[0], Format.signed( 16)),
|
||||
CHAR (Character.class, char.class, 'C', new Character((char)0), new char[0], Format.unsigned(16)),
|
||||
INT ( Integer.class, int.class, 'I', new Integer(0), new int[0], Format.signed( 32)),
|
||||
LONG ( Long.class, long.class, 'J', new Long(0), new long[0], Format.signed( 64)),
|
||||
FLOAT ( Float.class, float.class, 'F', (Float)(float)0, new float[0], Format.floating(32)),
|
||||
DOUBLE ( Double.class, double.class, 'D', (Double)(double)0, new double[0], Format.floating(64)),
|
||||
OBJECT ( Object.class, Object.class, 'L', null, new Object[0], Format.other( 1)),
|
||||
// VOID must be the last type, since it is "assignable" from any other type:
|
||||
VOID ( Void.class, void.class, 'V', null, null, Format.other( 0)),
|
||||
VOID ( Void.class, void.class, 'V', null, null, Format.other( 0)),
|
||||
;
|
||||
|
||||
private final Class<?> wrapperType;
|
||||
|
@ -36,7 +36,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* ThreadGroup and supports the ability to erase ThreadLocals.
|
||||
*/
|
||||
public final class InnocuousThread extends ManagedLocalsThread {
|
||||
private static final Unsafe UNSAFE;
|
||||
private static final jdk.internal.misc.Unsafe UNSAFE;
|
||||
private static final ThreadGroup INNOCUOUSTHREADGROUP;
|
||||
private static final AccessControlContext ACC;
|
||||
private static final long INHERITEDACCESSCONTROLCONTEXT;
|
||||
@ -92,7 +92,7 @@ public final class InnocuousThread extends ManagedLocalsThread {
|
||||
});
|
||||
|
||||
// Find and use topmost ThreadGroup as parent of new group
|
||||
UNSAFE = Unsafe.getUnsafe();
|
||||
UNSAFE = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
Class<?> tk = Thread.class;
|
||||
Class<?> gk = ThreadGroup.class;
|
||||
|
||||
|
@ -30,7 +30,7 @@ package sun.misc;
|
||||
* locals erased on construction.
|
||||
*/
|
||||
public class ManagedLocalsThread extends Thread {
|
||||
private static final Unsafe UNSAFE;
|
||||
private static final jdk.internal.misc.Unsafe UNSAFE;
|
||||
private static final long THREAD_LOCALS;
|
||||
private static final long INHERITABLE_THREAD_LOCALS;
|
||||
|
||||
@ -77,7 +77,7 @@ public class ManagedLocalsThread extends Thread {
|
||||
}
|
||||
|
||||
static {
|
||||
UNSAFE = Unsafe.getUnsafe();
|
||||
UNSAFE = jdk.internal.misc.Unsafe.getUnsafe();
|
||||
Class<?> t = Thread.class;
|
||||
try {
|
||||
THREAD_LOCALS = UNSAFE.objectFieldOffset
|
||||
|
@ -29,7 +29,7 @@
|
||||
package sun.nio.ch; // Formerly in sun.misc
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
|
||||
// ## In the fullness of time, this class will be eliminated
|
||||
|
@ -35,7 +35,7 @@ import java.nio.channels.*;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.*;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import sun.misc.Cleaner;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
package sun.nio.fs;
|
||||
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package sun.nio.fs;
|
||||
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import sun.misc.Cleaner;
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package sun.nio.fs;
|
||||
|
||||
import sun.misc.Unsafe;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
/**
|
||||
* Factory for native buffers.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user