aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Frankenberger <simon@fraho.eu>2020-12-04 23:18:11 +0100
committerTBK <tbk@jjtc.eu>2020-12-18 21:08:15 +0000
commit9f53b66fa859ff41bad864ce5ea0ba921a31511d (patch)
tree0806986b64b02acfe105b470722bb5b8fc3c9b79
parenta43a0bc1d0469df3b74827408326735dc9005e48 (diff)
downloadaports-9f53b66fa859ff41bad864ce5ea0ba921a31511d.tar.gz
aports-9f53b66fa859ff41bad864ce5ea0ba921a31511d.tar.bz2
aports-9f53b66fa859ff41bad864ce5ea0ba921a31511d.tar.xz
community/openjdk7: security upgrade to 2.6.24 (7u281)
-rw-r--r--community/openjdk7/APKBUILD72
-rw-r--r--community/openjdk7/icedtea-hotspot-musl.patch13
-rw-r--r--community/openjdk7/icedtea-jdk-fix-compile-optional.patch21
-rw-r--r--community/openjdk7/icedtea-jdk-fix-gcc10.patch154
-rw-r--r--community/openjdk7/icedtea-jdk-revert-7fdd0d6ef2d3.patch1450
-rw-r--r--community/openjdk7/icedtea-jdk-revert-a32dc7400435.patch1377
6 files changed, 219 insertions, 2868 deletions
diff --git a/community/openjdk7/APKBUILD b/community/openjdk7/APKBUILD
index 4f0cedd5f6..77a0ac4882 100644
--- a/community/openjdk7/APKBUILD
+++ b/community/openjdk7/APKBUILD
@@ -2,11 +2,11 @@
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Timo Teras <timo.teras@iki.fi>
pkgname=openjdk7
-_icedteaver=2.6.22
+_icedteaver=2.6.24
_icedteaversrc=$_icedteaver
# pkgver is <JDK version>.<JDK update>
# check icedtea JDK when updating
-pkgver=7.261.$_icedteaver
+pkgver=7.281.$_icedteaver
pkgrel=0
pkgdesc="OpenJDK 7 via IcedTea"
url="https://icedtea.classpath.org/"
@@ -18,14 +18,14 @@ options="sover-namecheck"
makedepends="bash findutils tar zip file gawk util-linux libxslt
autoconf automake linux-headers coreutils ca-certificates
nss-dev cups-dev jpeg-dev giflib-dev libpng-dev libxt-dev
- lcms2-dev libxp-dev libxtst-dev libxinerama-dev zlib-dev
+ lcms2-dev libexecinfo-dev libxp-dev libxtst-dev libxinerama-dev zlib-dev
libxrender-dev alsa-lib-dev freetype-dev fontconfig-dev
gtk+2.0-dev krb5-dev pcsc-lite-dev lksctp-tools-dev
libxcomposite-dev nss-static xz"
# upstream binary versions
-RHINO_VER=1.7.7.2
-ANT_VER=1.9.11
+_rhino_ver=1.7.7.2 # rhino 1.7.8 is java 8+ only
+_ant_ver=1.9.14
case $CARCH in
x86) _jarch=i386;;
@@ -69,20 +69,19 @@ source="https://icedtea.classpath.org/download/source/icedtea-$_icedteaversrc.ta
jdk-$_dropsver.tar.bz2::$_dropsurl/jdk.tar.bz2
langtools-$_dropsver.tar.bz2::$_dropsurl/langtools.tar.bz2
hotspot-$_dropsver.tar.bz2::$_dropsurl/hotspot.tar.bz2
- https://archive.apache.org/dist/ant/binaries/apache-ant-$ANT_VER-bin.tar.gz
- https://github.com/mozilla/rhino/releases/download/Rhino${RHINO_VER//./_}_Release/rhino-$RHINO_VER.zip
+ https://archive.apache.org/dist/ant/binaries/apache-ant-$_ant_ver-bin.tar.gz
+ https://github.com/mozilla/rhino/releases/download/Rhino${_rhino_ver//./_}_Release/rhino-$_rhino_ver.zip
icedtea-hotspot-musl.patch
icedtea-hotspot-musl-ppc.patch
icedtea-hotspot-noagent-musl.patch
icedtea-hotspot-uclibc-fixes.patch
icedtea-jdk-fix-build.patch
- icedtea-jdk-execinfo.patch
+ icedtea-jdk-fix-compile-optional.patch
+ icedtea-jdk-fix-gcc10.patch
icedtea-jdk-fix-ipv6-init.patch
icedtea-jdk-musl.patch
icedtea-jdk-no-soname.patch
- icedtea-jdk-revert-7fdd0d6ef2d3.patch
- icedtea-jdk-revert-a32dc7400435.patch
icedtea-jdk-xattr.patch
icedtea-cpio.patch
@@ -90,6 +89,23 @@ source="https://icedtea.classpath.org/download/source/icedtea-$_icedteaversrc.ta
"
# secfixes:
+# 7.281.2.6.24-r0:
+# - CVE-2019-2745
+# - CVE-2020-14577
+# - CVE-2020-14578
+# - CVE-2020-14579
+# - CVE-2020-14581
+# - CVE-2020-14583
+# - CVE-2020-14593
+# - CVE-2020-14621
+# - CVE-2020-14779
+# - CVE-2020-14781
+# - CVE-2020-14782
+# - CVE-2020-14792
+# - CVE-2020-14796
+# - CVE-2020-14797
+# - CVE-2020-14798
+# - CVE-2020-14803
# 7.261.2.6.22-r0:
# - CVE-2020-2756
# - CVE-2020-2757
@@ -156,9 +172,9 @@ unpack() {
fi
mkdir -p "$srcdir"
msg "Unpacking sources..."
- tar -C "$srcdir" -xf icedtea-$_icedteaversrc.tar.xz
- tar -C "$srcdir" -xf apache-ant-$ANT_VER-bin.tar.gz
- unzip -o -q "rhino-$RHINO_VER.zip" -d "$srcdir"
+ unxz -c icedtea-$_icedteaversrc.tar.xz | tar -C "$srcdir" -x
+ tar -C "$srcdir" -xf apache-ant-$_ant_ver-bin.tar.gz
+ unzip -o -q "rhino-$_rhino_ver.zip" -d "$srcdir"
}
prepare() {
@@ -188,7 +204,7 @@ build() {
export HOTSPOT_BUILD_JOBS="${JOBS:-2}"
export JAVA_HOME=$BOOTSTRAP_JAVA_HOME
- export PATH=$JAVA_HOME/bin:$srcdir/apache-ant-$ANT_VER/bin:$PATH
+ export PATH=$JAVA_HOME/bin:$srcdir/apache-ant-$_ant_ver/bin:$PATH
export DISTRIBUTION_PATCHES=""
# Explicitly set the C++ standard as the default has changed on GCC 6+
@@ -223,7 +239,8 @@ build() {
--disable-dependency-tracking \
--disable-downloading \
--disable-arm32-jit \
- --with-rhino=$srcdir/rhino$RHINO_VER/lib/rhino-$RHINO_VER.jar \
+ --disable-docs \
+ --with-rhino=$srcdir/rhino$_rhino_ver/lib/rhino-$_rhino_ver.jar \
--with-openjdk-src-zip=$srcdir/openjdk-$_dropsver.tar.bz2 \
--with-hotspot-src-zip=$srcdir/hotspot-$_dropsver.tar.bz2 \
--with-corba-src-zip=$srcdir/corba-$_dropsver.tar.bz2 \
@@ -304,27 +321,26 @@ doc() {
mv "$pkgdir"/$INSTALL_BASE/man "$subpkgdir"/$INSTALL_BASE/
}
-sha512sums="28c96cd2971ce381f0bd1c2a7fe6443602ad89dc0dd5a48d533e3c1a473421bdb98abf5e38117409f305bab7c6c8fecf95e854e8da8acf022966014539916b5c icedtea-2.6.22.tar.xz
-7e2027e0b32b34f63eb771aad0273313d963d455f11f635e6b268b49a7f390d9ef2ff2913f2b9f09b6959abbdc060788a1ad8da9ae221b0889054ec4120f9867 openjdk-2.6.22.tar.bz2
-105b9a40d2a65d106e2d59524b0ed24edc72f46f2383d5645d7dd1f09ea9359e76b07ce1712433c7ce1062c5c49f45937acbfe293cfb27379d9a412f03589324 corba-2.6.22.tar.bz2
-696f17f0ef263668fa775bfb65630dcbe5c673fd7b153eff598fc7a7ba60c99b3f6b5f8e82949f3ebf16f506a9158797227c7263292a04b63a8653189dd9bfbb jaxp-2.6.22.tar.bz2
-406d9066e66d38a6cfd697f594e6955a625b685fd7dd83eb774243a9c3bbeeef13a9f6fc5c9fa9b3e2de561264831779edc7af312f1df08c29315d97f5b71e9e jaxws-2.6.22.tar.bz2
-f2d6370b1bc5ee011670229b0d001f08e49aa688dfdaa196b5eb5db1484ce06046c6cf8415bb09ecca6810472f3211988a5a1cd42cdca805b3b56be8b6cd5bcd jdk-2.6.22.tar.bz2
-df11b0d172c1493870ce3aabca076c16f73c2e2f50ac6beac921c72c6bf925a8b879cf8754b19d2d6dd0407f9baadeb597719c6f5972c97f5a5f7567bf98fcb1 langtools-2.6.22.tar.bz2
-f7652d0e6c1fe33ed7fe0d6f0c36daffc6509bb92818d5eaaf183fd9e8afc1a2fca9d547a2c087aa41134d5da0da4c647b5cdad11b9a520cf9a94cc1a548e219 hotspot-2.6.22.tar.bz2
-0da12cb0f761b8cb76e042449e7d93f43236e7bc948e337215470a70031f0a2dda6d1b508f9397b283808d84c4ebddb31558fe1cd8e6e6469c1dd390d69ec6e7 apache-ant-1.9.11-bin.tar.gz
+sha512sums="db97bd4106f732cab64528b5d087ea56333d9b0916f238a58b84d44bc8602ca64419f827afca483c0ba9538986bbf0bf5b92683b6f96d8df047b334328d76d11 icedtea-2.6.24.tar.xz
+fb5bd58480194b556ecfdb3225e4d70ac710cf0cc75ada483ed81786ff2b5eb961508291261742eab2ba91bdab9ea38188b02caaa1eb5abbdee43db4daad0416 openjdk-2.6.24.tar.bz2
+ed6244abf6a7ddfced08c8dd1d6f0ccee2344e0e85a9499c76a97f64708cbc9676bfb475c0ae907820ea1e8b5c1c4e73f57662bdcee6e41edf25a99d46d972fc corba-2.6.24.tar.bz2
+7a867293ef178f0af8bd37bdf94dcbf56a646974742aaec1f009d328eb18f4083c0120eb16d50e4510dff344074558151736e22f767ba9aa311b9f4a0c53013d jaxp-2.6.24.tar.bz2
+3257d4058e056f5664d185ea3357972e412033bc8f69f7e0778c31f47b354741a2c2e2c2a389939a06cc4c9eb6c024bf47f5b936a09b3606d2cdcc7d7236517a jaxws-2.6.24.tar.bz2
+24ff2ca12aa2f2c1b84803586f90e77527fc2c3df726650e828ab7f8430ac5a2805eee46ee830a6e1141d6f8c5a476a3ed7edece5b0534e2d33037155779f0d4 jdk-2.6.24.tar.bz2
+1d5def1076785a2a3097a18bdec0070fd69adff79e54fa24988da09b4457e9d363f05396016854301a1123b446d38e2c23c86cada43ae09e4fa8edf3b5d669b2 langtools-2.6.24.tar.bz2
+21fe6c47b7d116662bd772ecb526b993b11033e13286bdf0257aab60ec374cce6194dfea87b78ea5a1a62d5fbe83b01e9539ce8b81c73333a9dfb6dc0bf8fec5 hotspot-2.6.24.tar.bz2
+487dbd1d7f678a92924ba884a57e910ccb4fe565c554278795a8fdfc80c4e88d81ebc2ccecb5a8f353f0b2076572bb921499a2cadb064e0f44fc406a3c31da20 apache-ant-1.9.14-bin.tar.gz
1b9e8721749e81c5420a00af1e00ee0e4f48624ccb4e9aa969032114116ad50f59b254d4d16d74feff74de64157cc8b0a2ead9b555907c84b7055b796fba9a75 rhino-1.7.7.2.zip
-f62b942f0bacda8e37d0f1876d8ba14ddb4fc55a7d5fd1019463744927f40f422a85e9ee051948d566242f5a785aa28f275eb58768611283cba89af91235f43c icedtea-hotspot-musl.patch
+74e38e41db0dcca6ec91d3a83330f06904342ba8e950d896c4544db72b76a3ae6665793b83d7bbeb5a0cd3896b48707c8beda92ef0eb0e7f821c15e591e2fd49 icedtea-hotspot-musl.patch
e5cf4d70f96fc1e72ae8b97a887adb96092ff36584711cbb8de9d9fa9e859cb8731d638838de0d9591239fc44ffe5c74422d1842bd9f10a0c00dff1627bdeeef icedtea-hotspot-musl-ppc.patch
e7a2c1771bb582d427041f8d22e48c0daf8f20d7c0926cbce3549d49c4e949359ee25a35682b486e82f3e390535c950c5beee3bd8d06fb5a717b50f2d9b2a6bc icedtea-hotspot-noagent-musl.patch
822eee0dc4d3ba677a289dfeb3668b536d2d626708390a9d9702fb4144a481fd443a215a0d2041c6026113837aafa4ba0b5e9ead8589d2da6717a238bbc95a5a icedtea-hotspot-uclibc-fixes.patch
8fadeee6ea9886c7ee3118a1abaee2fbd04931a3ba880062bc97397ad30aab114a83542c888461a5a8a1d131c4e73920872317c96620e2a8c4689620adf9e9c3 icedtea-jdk-fix-build.patch
-0391970e6a32946aa3cccf38fdef9c0fe2af26cd0df824b98aa2fcfa1bf661d4a68e339bffcfd16f386c565fc68bb28a29208a67d4bad8a0e847ad02bd8becbb icedtea-jdk-execinfo.patch
+38114b1de864539dd5ba35add8bfe0de8b85d6ebcb4d05e82cebc318ca27883737739315471855cfe0fd0cbc0a26d916aeb2304a23a75abb6a351aa51957e8a9 icedtea-jdk-fix-compile-optional.patch
+9b4ad4a593672edd617c514d3d9158324762d7d91049eca0b3c7f307c668cf20c1db94ecd935ab35d149488524d23db5dd77d7d45572f2fa1a7643c26ae4a32c icedtea-jdk-fix-gcc10.patch
48533f87fc2cf29d26b259be0df51087d2fe5b252e72d00c6ea2f4add7b0fb113141718c116279c5905e03f64a1118082e719393786811367cf4d472b5d36774 icedtea-jdk-fix-ipv6-init.patch
44a35941c80f408d0607e32763b3b6ccee21e1d39886309327d3d74d2900117e4346ef59e77c663fd022fec10ee8f365eeb46c1260014d5765d226ce175ce3c5 icedtea-jdk-musl.patch
bf4b184e170f7b0ff64ab30d2162784fe2bd5460d1fa31973259f7065fd4c511c46f97724fe2bd72bb94e9006cb568d0e0c87d1a9c90819e65880f8f44830bb1 icedtea-jdk-no-soname.patch
-9a14c023662c25fc3338c60ba9e6ece625bf2db774776e0c633e5cc866d5c6daf160e90b164832b12eb304fcf65bf30b5d38f20cb7f97f01f6736bfa572ef4fc icedtea-jdk-revert-7fdd0d6ef2d3.patch
-f4ee0ede2b62e81971e79bd7d382c09847488656bfa27a7346cd5a92f478bcf67cd10aa632989836a49e87ee435c3de831ad4c71f824113f55c61361895a7af8 icedtea-jdk-revert-a32dc7400435.patch
e703e5f68e63f130e758b3fa813872363090c08eee6a6366f4784cf6a191a90a3642ec71e016bd05e48a66ad0ae56db8b0e318b101aca5d0885af8705423b770 icedtea-jdk-xattr.patch
a54c79c82afa1bc95265397b274260584c8b8c6be1651ddfb907d9523a809ea4581409e0d3fb0bbb63ef5a204e8ce29b7940e78cd640af1f490ae938c59129b6 icedtea-cpio.patch
4c874f0e9f3f54f688a1faf64fa3734e31f139f465ce77d12aac87558764ef66055de6cfac5b60efef2833c64256136c70f3cf5dc2712de62fc5dbebe3a8fbcd fix-xattr-include.patch"
diff --git a/community/openjdk7/icedtea-hotspot-musl.patch b/community/openjdk7/icedtea-hotspot-musl.patch
index 1da9031486..eb08c05468 100644
--- a/community/openjdk7/icedtea-hotspot-musl.patch
+++ b/community/openjdk7/icedtea-hotspot-musl.patch
@@ -64,16 +64,3 @@
#ifdef BUILTIN_SIM
#define REG_SP REG_RSP
---- openjdk/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp.orig
-+++ openjdk/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp
-@@ -194,10 +194,6 @@
- return (r->reg2stack() + SharedRuntime::out_preserve_stack_slots()) * VMRegImpl::stack_slot_size;
- }
-
--template <class T> static const T& min (const T& a, const T& b) {
-- return (a > b) ? b : a;
--}
--
- // ---------------------------------------------------------------------------
- // Read the array of BasicTypes from a signature, and compute where the
- // arguments should go. Values in the VMRegPair regs array refer to 4-byte
diff --git a/community/openjdk7/icedtea-jdk-fix-compile-optional.patch b/community/openjdk7/icedtea-jdk-fix-compile-optional.patch
new file mode 100644
index 0000000000..3eb7565d91
--- /dev/null
+++ b/community/openjdk7/icedtea-jdk-fix-compile-optional.patch
@@ -0,0 +1,21 @@
+Subject: The gnu java compiler cannot compile this class
+Author: Simon Frankenberger <simon-alpine@fraho.eu>
+Upstream: No
+
+1. ERROR in /builds/bratkartoffel/aports/community/openjdk7/src/icedtea-2.6.23/openjdk-boot/jdk/src/share/classes/sun/security/util/Optional.java (at line 196)
+ return Optional.ofNullable(mapper.apply(value));
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Type mismatch: cannot convert from Optional<capture#5-of ? extends U> to Optional<U>
+
+
+--- openjdk.orig/jdk/src/share/classes/sun/security/util/Optional.java
++++ openjdk/jdk/src/share/classes/sun/security/util/Optional.java
+@@ -193,7 +193,7 @@
+ if (!isPresent())
+ return empty();
+ else {
+- return Optional.ofNullable(mapper.apply(value));
++ return (Optional) Optional.ofNullable(mapper.apply(value));
+ }
+ }
+
diff --git a/community/openjdk7/icedtea-jdk-fix-gcc10.patch b/community/openjdk7/icedtea-jdk-fix-gcc10.patch
new file mode 100644
index 0000000000..71af3f9ce2
--- /dev/null
+++ b/community/openjdk7/icedtea-jdk-fix-gcc10.patch
@@ -0,0 +1,154 @@
+Subject: Fix build error with gcc >= 10.0
+Upstream: Yes
+Upstream-Url: https://bugs.openjdk.java.net/browse/JDK-8235903
+Author: Simon Frankenberger <simon-alpine@fraho.eu>
+
+This is a backport of the fixes to make it compile with gcc10 again.
+
+--- openjdk.orig/jdk/src/solaris/native/java/lang/childproc.c
++++ openjdk/jdk/src/solaris/native/java/lang/childproc.c
+@@ -33,6 +33,7 @@
+
+ #include "childproc.h"
+
++const char * const *parentPathv;
+
+ ssize_t
+ restartableWrite(int fd, const void *buf, size_t count)
+--- openjdk.orig/jdk/src/solaris/native/java/lang/childproc.h
++++ openjdk/jdk/src/solaris/native/java/lang/childproc.h
+@@ -118,7 +118,7 @@
+ * The cached and split version of the JDK's effective PATH.
+ * (We don't support putenv("PATH=...") in native code)
+ */
+-const char * const *parentPathv;
++extern const char * const *parentPathv;
+
+ ssize_t restartableWrite(int fd, const void *buf, size_t count);
+ int restartableDup2(int fd_from, int fd_to);
+--- openjdk.orig/jdk/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c
++++ openjdk/jdk/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c
+@@ -28,6 +28,9 @@
+ #include <dlfcn.h>
+ #include "NativeFunc.h"
+
++/* global GSS function table */
++GSS_FUNCTION_TABLE_PTR ftab;
++
+ /* standard GSS method names (ordering is from mapfile) */
+ static const char RELEASE_NAME[] = "gss_release_name";
+ static const char IMPORT_NAME[] = "gss_import_name";
+--- openjdk.orig/jdk/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.h
++++ openjdk/jdk/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.h
+@@ -265,6 +265,6 @@
+ typedef GSS_FUNCTION_TABLE *GSS_FUNCTION_TABLE_PTR;
+
+ /* global GSS function table */
+-GSS_FUNCTION_TABLE_PTR ftab;
++extern GSS_FUNCTION_TABLE_PTR ftab;
+
+ #endif
+--- /dev/null
++++ openjdk/jdk/src/solaris/native/sun/nio/ch/Sctp.c
+@@ -0,0 +1,34 @@
++/*
++ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This code is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 only, as
++ * published by the Free Software Foundation. Oracle designates this
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * This code is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
++ * version 2 for more details (a copy is included in the LICENSE file that
++ * accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License version
++ * 2 along with this work; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++ *
++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
++ * or visit www.oracle.com if you need additional information or have any
++ * questions.
++ */
++
++#include "Sctp.h"
++
++sctp_getladdrs_func* nio_sctp_getladdrs;
++sctp_freeladdrs_func* nio_sctp_freeladdrs;
++sctp_getpaddrs_func* nio_sctp_getpaddrs;
++sctp_freepaddrs_func* nio_sctp_freepaddrs;
++sctp_bindx_func* nio_sctp_bindx;
++sctp_peeloff_func* nio_sctp_peeloff;
++
+--- openjdk.orig/jdk/src/solaris/native/sun/nio/ch/Sctp.h
++++ openjdk/jdk/src/solaris/native/sun/nio/ch/Sctp.h
+@@ -332,12 +332,12 @@
+ #define nio_sctp_bindx sctp_bindx
+ #define nio_sctp_peeloff sctp_peeloff
+ #else
+-sctp_getladdrs_func* nio_sctp_getladdrs;
+-sctp_freeladdrs_func* nio_sctp_freeladdrs;
+-sctp_getpaddrs_func* nio_sctp_getpaddrs;
+-sctp_freepaddrs_func* nio_sctp_freepaddrs;
+-sctp_bindx_func* nio_sctp_bindx;
+-sctp_peeloff_func* nio_sctp_peeloff;
++extern sctp_getladdrs_func* nio_sctp_getladdrs;
++extern sctp_freeladdrs_func* nio_sctp_freeladdrs;
++extern sctp_getpaddrs_func* nio_sctp_getpaddrs;
++extern sctp_freepaddrs_func* nio_sctp_freepaddrs;
++extern sctp_bindx_func* nio_sctp_bindx;
++extern sctp_peeloff_func* nio_sctp_peeloff;
+ #endif
+
+ jboolean loadSocketExtensionFuncs(JNIEnv* env);
+--- openjdk.orig/jdk/src/solaris/native/common/deps/cups_fp.c
++++ openjdk/jdk/src/solaris/native/common/deps/cups_fp.c
+@@ -32,6 +32,16 @@
+
+ #include <cups_fp.h>
+
++fn_cupsServer j2d_cupsServer;
++fn_ippPort j2d_ippPort;
++fn_httpConnect j2d_httpConnect;
++fn_httpClose j2d_httpClose;
++fn_cupsGetPPD j2d_cupsGetPPD;
++fn_ppdOpenFile j2d_ppdOpenFile;
++fn_ppdClose j2d_ppdClose;
++fn_ppdFindOption j2d_ppdFindOption;
++fn_ppdPageSize j2d_ppdPageSize;
++
+ jboolean cups_init()
+ {
+ void *handle = dlopen(VERSIONED_JNI_LIB_NAME("cups", "2"),
+--- openjdk.orig/jdk/src/solaris/native/common/deps/cups_fp.h
++++ openjdk/jdk/src/solaris/native/common/deps/cups_fp.h
+@@ -36,15 +36,15 @@
+ typedef ppd_option_t* (*fn_ppdFindOption)(ppd_file_t *, const char *);
+ typedef ppd_size_t* (*fn_ppdPageSize)(ppd_file_t *, char *);
+
+-fn_cupsServer j2d_cupsServer;
+-fn_ippPort j2d_ippPort;
+-fn_httpConnect j2d_httpConnect;
+-fn_httpClose j2d_httpClose;
+-fn_cupsGetPPD j2d_cupsGetPPD;
+-fn_ppdOpenFile j2d_ppdOpenFile;
+-fn_ppdClose j2d_ppdClose;
+-fn_ppdFindOption j2d_ppdFindOption;
+-fn_ppdPageSize j2d_ppdPageSize;
++extern fn_cupsServer j2d_cupsServer;
++extern fn_ippPort j2d_ippPort;
++extern fn_httpConnect j2d_httpConnect;
++extern fn_httpClose j2d_httpClose;
++extern fn_cupsGetPPD j2d_cupsGetPPD;
++extern fn_ppdOpenFile j2d_ppdOpenFile;
++extern fn_ppdClose j2d_ppdClose;
++extern fn_ppdFindOption j2d_ppdFindOption;
++extern fn_ppdPageSize j2d_ppdPageSize;
+
+ #define cupsServer (*j2d_cupsServer)
+ #define ippPort (*j2d_ippPort)
diff --git a/community/openjdk7/icedtea-jdk-revert-7fdd0d6ef2d3.patch b/community/openjdk7/icedtea-jdk-revert-7fdd0d6ef2d3.patch
deleted file mode 100644
index 071a13c2ef..0000000000
--- a/community/openjdk7/icedtea-jdk-revert-7fdd0d6ef2d3.patch
+++ /dev/null
@@ -1,1450 +0,0 @@
-Revert 7fdd0d6ef2d3 due build error
-This laos reverts a fix for CVE-2019-2745
---- openjdk.orig/jdk/src/share/classes/sun/security/ec/ECDSAOperations.java 2019-07-14 02:30:40.000000000 +0200
-+++ openjdk/jdk/src/share/classes/sun/security/ec/ECDSAOperations.java 1970-01-01 01:00:00.000000000 +0100
-@@ -1,206 +0,0 @@
--/*
-- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This code is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License version 2 only, as
-- * published by the Free Software Foundation. Oracle designates this
-- * particular file as subject to the "Classpath" exception as provided
-- * by Oracle in the LICENSE file that accompanied this code.
-- *
-- * This code is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- * version 2 for more details (a copy is included in the LICENSE file that
-- * accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License version
-- * 2 along with this work; if not, write to the Free Software Foundation,
-- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-- *
-- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-- * or visit www.oracle.com if you need additional information or have any
-- * questions.
-- */
--
--package sun.security.ec;
--
--import sun.security.ec.point.*;
--import sun.security.util.ArrayUtil;
--import sun.security.util.Function;
--import sun.security.util.Optional;
--import sun.security.util.math.*;
--import static sun.security.ec.ECOperations.IntermediateValueException;
--
--import java.security.ProviderException;
--import java.security.spec.*;
--
--public class ECDSAOperations {
--
-- public static class Seed {
-- private final byte[] seedValue;
--
-- public Seed(byte[] seedValue) {
-- this.seedValue = seedValue;
-- }
--
-- public byte[] getSeedValue() {
-- return seedValue;
-- }
-- }
--
-- public static class Nonce {
-- private final byte[] nonceValue;
--
-- public Nonce(byte[] nonceValue) {
-- this.nonceValue = nonceValue;
-- }
--
-- public byte[] getNonceValue() {
-- return nonceValue;
-- }
-- }
--
-- private final ECOperations ecOps;
-- private final AffinePoint basePoint;
--
-- public ECDSAOperations(ECOperations ecOps, ECPoint basePoint) {
-- this.ecOps = ecOps;
-- this.basePoint = toAffinePoint(basePoint, ecOps.getField());
-- }
--
-- public ECOperations getEcOperations() {
-- return ecOps;
-- }
--
-- public AffinePoint basePointMultiply(byte[] scalar) {
-- return ecOps.multiply(basePoint, scalar).asAffine();
-- }
--
-- public static AffinePoint toAffinePoint(ECPoint point,
-- IntegerFieldModuloP field) {
--
-- ImmutableIntegerModuloP affineX = field.getElement(point.getAffineX());
-- ImmutableIntegerModuloP affineY = field.getElement(point.getAffineY());
-- return new AffinePoint(affineX, affineY);
-- }
--
-- public static
-- Optional<ECDSAOperations> forParameters(final ECParameterSpec ecParams) {
-- Optional<ECOperations> curveOps =
-- ECOperations.forParameters(ecParams);
-- return curveOps.map(new Function<ECOperations, ECDSAOperations>() {
-- @Override
-- public ECDSAOperations apply(ECOperations ops) {
-- return new ECDSAOperations(ops, ecParams.getGenerator());
-- }
-- });
-- }
--
-- /**
-- *
-- * Sign a digest using the provided private key and seed.
-- * IMPORTANT: The private key is a scalar represented using a
-- * little-endian byte array. This is backwards from the conventional
-- * representation in ECDSA. The routines that produce and consume this
-- * value uses little-endian, so this deviation from convention removes
-- * the requirement to swap the byte order. The returned signature is in
-- * the conventional byte order.
-- *
-- * @param privateKey the private key scalar as a little-endian byte array
-- * @param digest the digest to be signed
-- * @param seed the seed that will be used to produce the nonce. This object
-- * should contain an array that is at least 64 bits longer than
-- * the number of bits required to represent the group order.
-- * @return the ECDSA signature value
-- * @throws IntermediateValueException if the signature cannot be produced
-- * due to an unacceptable intermediate or final value. If this
-- * exception is thrown, then the caller should discard the nonnce and
-- * try again with an entirely new nonce value.
-- */
-- public byte[] signDigest(byte[] privateKey, byte[] digest, Seed seed)
-- throws IntermediateValueException {
--
-- byte[] nonceArr = ecOps.seedToScalar(seed.getSeedValue());
--
-- Nonce nonce = new Nonce(nonceArr);
-- return signDigest(privateKey, digest, nonce);
-- }
--
-- /**
-- *
-- * Sign a digest using the provided private key and nonce.
-- * IMPORTANT: The private key and nonce are scalars represented by a
-- * little-endian byte array. This is backwards from the conventional
-- * representation in ECDSA. The routines that produce and consume these
-- * values use little-endian, so this deviation from convention removes
-- * the requirement to swap the byte order. The returned signature is in
-- * the conventional byte order.
-- *
-- * @param privateKey the private key scalar as a little-endian byte array
-- * @param digest the digest to be signed
-- * @param nonce the nonce object containing a little-endian scalar value.
-- * @return the ECDSA signature value
-- * @throws IntermediateValueException if the signature cannot be produced
-- * due to an unacceptable intermediate or final value. If this
-- * exception is thrown, then the caller should discard the nonnce and
-- * try again with an entirely new nonce value.
-- */
-- public byte[] signDigest(byte[] privateKey, byte[] digest, Nonce nonce)
-- throws IntermediateValueException {
--
-- IntegerFieldModuloP orderField = ecOps.getOrderField();
-- int orderBits = orderField.getSize().bitLength();
-- if (orderBits % 8 != 0 && orderBits < digest.length * 8) {
-- // This implementation does not support truncating digests to
-- // a length that is not a multiple of 8.
-- throw new ProviderException("Invalid digest length");
-- }
--
-- byte[] k = nonce.getNonceValue();
-- // check nonce length
-- int length = (orderField.getSize().bitLength() + 7) / 8;
-- if (k.length != length) {
-- throw new ProviderException("Incorrect nonce length");
-- }
--
-- MutablePoint R = ecOps.multiply(basePoint, k);
-- IntegerModuloP r = R.asAffine().getX();
-- // put r into the correct field by fully reducing to an array
-- byte[] temp = new byte[length];
-- r.asByteArray(temp);
-- r = orderField.getElement(temp);
-- // store r in result
-- r.asByteArray(temp);
-- byte[] result = new byte[2 * length];
-- ArrayUtil.reverse(temp);
-- System.arraycopy(temp, 0, result, 0, length);
-- // compare r to 0
-- if (ECOperations.allZero(temp)) {
-- throw new IntermediateValueException();
-- }
--
-- IntegerModuloP dU = orderField.getElement(privateKey);
-- int lengthE = Math.min(length, digest.length);
-- byte[] E = new byte[lengthE];
-- System.arraycopy(digest, 0, E, 0, lengthE);
-- ArrayUtil.reverse(E);
-- IntegerModuloP e = orderField.getElement(E);
-- IntegerModuloP kElem = orderField.getElement(k);
-- IntegerModuloP kInv = kElem.multiplicativeInverse();
-- MutableIntegerModuloP s = r.mutable();
-- s.setProduct(dU).setSum(e).setProduct(kInv);
-- // store s in result
-- s.asByteArray(temp);
-- ArrayUtil.reverse(temp);
-- System.arraycopy(temp, 0, result, length, length);
-- // compare s to 0
-- if (ECOperations.allZero(temp)) {
-- throw new IntermediateValueException();
-- }
--
-- return result;
--
-- }
--
--}
---- openjdk.orig/jdk/src/share/classes/sun/security/ec/ECOperations.java 2019-07-14 02:30:40.000000000 +0200
-+++ openjdk/jdk/src/share/classes/sun/security/ec/ECOperations.java 1970-01-01 01:00:00.000000000 +0100
-@@ -1,499 +0,0 @@
--/*
-- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This code is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License version 2 only, as
-- * published by the Free Software Foundation. Oracle designates this
-- * particular file as subject to the "Classpath" exception as provided
-- * by Oracle in the LICENSE file that accompanied this code.
-- *
-- * This code is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- * version 2 for more details (a copy is included in the LICENSE file that
-- * accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License version
-- * 2 along with this work; if not, write to the Free Software Foundation,
-- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-- *
-- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-- * or visit www.oracle.com if you need additional information or have any
-- * questions.
-- */
--
--package sun.security.ec;
--
--import sun.security.ec.point.*;
--import sun.security.util.Optional;
--import sun.security.util.math.*;
--import sun.security.util.math.intpoly.*;
--
--import java.math.BigInteger;
--import java.security.ProviderException;
--import java.security.spec.ECFieldFp;
--import java.security.spec.ECParameterSpec;
--import java.security.spec.EllipticCurve;
--import java.util.Collections;
--import java.util.HashMap;
--import java.util.Map;
--
--/*
-- * Elliptic curve point arithmetic for prime-order curves where a=-3.
-- * Formulas are derived from "Complete addition formulas for prime order
-- * elliptic curves" by Renes, Costello, and Batina.
-- */
--
--public class ECOperations {
--
-- /*
-- * An exception indicating a problem with an intermediate value produced
-- * by some part of the computation. For example, the signing operation
-- * will throw this exception to indicate that the r or s value is 0, and
-- * that the signing operation should be tried again with a different nonce.
-- */
-- static class IntermediateValueException extends Exception {
-- private static final long serialVersionUID = 1;
-- }
--
-- static final Map<BigInteger, IntegerFieldModuloP> fields;
--
-- static final Map<BigInteger, IntegerFieldModuloP> orderFields;
--
-- static {
-- Map<BigInteger, IntegerFieldModuloP> map = new HashMap<>();
-- map.put(IntegerPolynomialP256.MODULUS, new IntegerPolynomialP256());
-- map.put(IntegerPolynomialP384.MODULUS, new IntegerPolynomialP384());
-- map.put(IntegerPolynomialP521.MODULUS, new IntegerPolynomialP521());
-- fields = Collections.unmodifiableMap(map);
-- map = new HashMap<>();
-- map.put(P256OrderField.MODULUS, new P256OrderField());
-- map.put(P384OrderField.MODULUS, new P384OrderField());
-- map.put(P521OrderField.MODULUS, new P521OrderField());
-- orderFields = Collections.unmodifiableMap(map);
-- }
--
-- public static Optional<ECOperations> forParameters(ECParameterSpec params) {
--
-- EllipticCurve curve = params.getCurve();
-- if (!(curve.getField() instanceof ECFieldFp)) {
-- return Optional.empty();
-- }
-- ECFieldFp primeField = (ECFieldFp) curve.getField();
--
-- BigInteger three = BigInteger.valueOf(3);
-- if (!primeField.getP().subtract(curve.getA()).equals(three)) {
-- return Optional.empty();
-- }
-- IntegerFieldModuloP field = fields.get(primeField.getP());
-- if (field == null) {
-- return Optional.empty();
-- }
--
-- IntegerFieldModuloP orderField = orderFields.get(params.getOrder());
-- if (orderField == null) {
-- return Optional.empty();
-- }
--
-- ImmutableIntegerModuloP b = field.getElement(curve.getB());
-- ECOperations ecOps = new ECOperations(b, orderField);
-- return Optional.of(ecOps);
-- }
--
-- final ImmutableIntegerModuloP b;
-- final SmallValue one;
-- final SmallValue two;
-- final SmallValue three;
-- final SmallValue four;
-- final ProjectivePoint.Immutable neutral;
-- private final IntegerFieldModuloP orderField;
--
-- public ECOperations(IntegerModuloP b, IntegerFieldModuloP orderField) {
-- this.b = b.fixed();
-- this.orderField = orderField;
--
-- this.one = b.getField().getSmallValue(1);
-- this.two = b.getField().getSmallValue(2);
-- this.three = b.getField().getSmallValue(3);
-- this.four = b.getField().getSmallValue(4);
--
-- IntegerFieldModuloP field = b.getField();
-- this.neutral = new ProjectivePoint.Immutable(field.get0(),
-- field.get1(), field.get0());
-- }
--
-- public IntegerFieldModuloP getField() {
-- return b.getField();
-- }
-- public IntegerFieldModuloP getOrderField() {
-- return orderField;
-- }
--
-- protected ProjectivePoint.Immutable getNeutral() {
-- return neutral;
-- }
--
-- public boolean isNeutral(Point p) {
-- ProjectivePoint<?> pp = (ProjectivePoint<?>) p;
--
-- IntegerModuloP z = pp.getZ();
--
-- IntegerFieldModuloP field = z.getField();
-- int byteLength = (field.getSize().bitLength() + 7) / 8;
-- byte[] zBytes = z.asByteArray(byteLength);
-- return allZero(zBytes);
-- }
--
-- byte[] seedToScalar(byte[] seedBytes)
-- throws IntermediateValueException {
--
-- // Produce a nonce from the seed using FIPS 186-4,section B.5.1:
-- // Per-Message Secret Number Generation Using Extra Random Bits
-- // or
-- // Produce a scalar from the seed using FIPS 186-4, section B.4.1:
-- // Key Pair Generation Using Extra Random Bits
--
-- // To keep the implementation simple, sample in the range [0,n)
-- // and throw IntermediateValueException in the (unlikely) event
-- // that the result is 0.
--
-- // Get 64 extra bits and reduce in to the nonce
-- int seedBits = orderField.getSize().bitLength() + 64;
-- if (seedBytes.length * 8 < seedBits) {
-- throw new ProviderException("Incorrect seed length: " +
-- seedBytes.length * 8 + " < " + seedBits);
-- }
--
-- // input conversion only works on byte boundaries
-- // clear high-order bits of last byte so they don't influence nonce
-- int lastByteBits = seedBits % 8;
-- if (lastByteBits != 0) {
-- int lastByteIndex = seedBits / 8;
-- byte mask = (byte) (0xFF >>> (8 - lastByteBits));
-- seedBytes[lastByteIndex] &= mask;
-- }
--
-- int seedLength = (seedBits + 7) / 8;
-- IntegerModuloP scalarElem =
-- orderField.getElement(seedBytes, 0, seedLength, (byte) 0);
-- int scalarLength = (orderField.getSize().bitLength() + 7) / 8;
-- byte[] scalarArr = new byte[scalarLength];
-- scalarElem.asByteArray(scalarArr);
-- if (ECOperations.allZero(scalarArr)) {
-- throw new IntermediateValueException();
-- }
-- return scalarArr;
-- }
--
-- /*
-- * Compare all values in the array to 0 without branching on any value
-- *
-- */
-- public static boolean allZero(byte[] arr) {
-- byte acc = 0;
-- for (int i = 0; i < arr.length; i++) {
-- acc |= arr[i];
-- }
-- return acc == 0;
-- }
--
-- /*
-- * 4-bit branchless array lookup for projective points.
-- */
-- private void lookup4(ProjectivePoint.Immutable[] arr, int index,
-- ProjectivePoint.Mutable result, IntegerModuloP zero) {
--
-- for (int i = 0; i < 16; i++) {
-- int xor = index ^ i;
-- int bit3 = (xor & 0x8) >>> 3;
-- int bit2 = (xor & 0x4) >>> 2;
-- int bit1 = (xor & 0x2) >>> 1;
-- int bit0 = (xor & 0x1);
-- int inverse = bit0 | bit1 | bit2 | bit3;
-- int set = 1 - inverse;
--
-- ProjectivePoint.Immutable pi = arr[i];
-- result.conditionalSet(pi, set);
-- }
-- }
--
-- private void double4(ProjectivePoint.Mutable p, MutableIntegerModuloP t0,
-- MutableIntegerModuloP t1, MutableIntegerModuloP t2,
-- MutableIntegerModuloP t3, MutableIntegerModuloP t4) {
--
-- for (int i = 0; i < 4; i++) {
-- setDouble(p, t0, t1, t2, t3, t4);
-- }
-- }
--
-- /**
-- * Multiply an affine point by a scalar and return the result as a mutable
-- * point.
-- *
-- * @param affineP the point
-- * @param s the scalar as a little-endian array
-- * @return the product
-- */
-- public MutablePoint multiply(AffinePoint affineP, byte[] s) {
--
-- // 4-bit windowed multiply with branchless lookup.
-- // The mixed addition is faster, so it is used to construct the array
-- // at the beginning of the operation.
--
-- IntegerFieldModuloP field = affineP.getX().getField();
-- ImmutableIntegerModuloP zero = field.get0();
-- // temporaries
-- MutableIntegerModuloP t0 = zero.mutable();
-- MutableIntegerModuloP t1 = zero.mutable();
-- MutableIntegerModuloP t2 = zero.mutable();
-- MutableIntegerModuloP t3 = zero.mutable();
-- MutableIntegerModuloP t4 = zero.mutable();
--
-- ProjectivePoint.Mutable result = new ProjectivePoint.Mutable(field);
-- result.getY().setValue(field.get1().mutable());
--
-- ProjectivePoint.Immutable[] pointMultiples =
-- new ProjectivePoint.Immutable[16];
-- // 0P is neutral---same as initial result value
-- pointMultiples[0] = result.fixed();
--
-- ProjectivePoint.Mutable ps = new ProjectivePoint.Mutable(field);
-- ps.setValue(affineP);
-- // 1P = P
-- pointMultiples[1] = ps.fixed();
--
-- // the rest are calculated using mixed point addition
-- for (int i = 2; i < 16; i++) {
-- setSum(ps, affineP, t0, t1, t2, t3, t4);
-- pointMultiples[i] = ps.fixed();
-- }
--
-- ProjectivePoint.Mutable lookupResult = ps.mutable();
--
-- for (int i = s.length - 1; i >= 0; i--) {
--
-- double4(result, t0, t1, t2, t3, t4);
--
-- int high = (0xFF & s[i]) >>> 4;
-- lookup4(pointMultiples, high, lookupResult, zero);
-- setSum(result, lookupResult, t0, t1, t2, t3, t4);
--
-- double4(result, t0, t1, t2, t3, t4);
--
-- int low = 0xF & s[i];
-- lookup4(pointMultiples, low, lookupResult, zero);
-- setSum(result, lookupResult, t0, t1, t2, t3, t4);
-- }
--
-- return result;
--
-- }
--
-- /*
-- * Point double
-- */
-- private void setDouble(ProjectivePoint.Mutable p, MutableIntegerModuloP t0,
-- MutableIntegerModuloP t1, MutableIntegerModuloP t2,
-- MutableIntegerModuloP t3, MutableIntegerModuloP t4) {
--
-- t0.setValue(p.getX()).setSquare();
-- t1.setValue(p.getY()).setSquare();
-- t2.setValue(p.getZ()).setSquare();
-- t3.setValue(p.getX()).setProduct(p.getY());
-- t4.setValue(p.getY()).setProduct(p.getZ());
--
-- t3.setSum(t3);
-- p.getZ().setProduct(p.getX());
--
-- p.getZ().setProduct(two);
--
-- p.getY().setValue(t2).setProduct(b);
-- p.getY().setDifference(p.getZ());
--
-- p.getX().setValue(p.getY()).setProduct(two);
-- p.getY().setSum(p.getX());
-- p.getY().setReduced();
-- p.getX().setValue(t1).setDifference(p.getY());
--
-- p.getY().setSum(t1);
-- p.getY().setProduct(p.getX());
-- p.getX().setProduct(t3);
--
-- t3.setValue(t2).setProduct(two);
-- t2.setSum(t3);
-- p.getZ().setProduct(b);
--
-- t2.setReduced();
-- p.getZ().setDifference(t2);
-- p.getZ().setDifference(t0);
-- t3.setValue(p.getZ()).setProduct(two);
-- p.getZ().setReduced();
-- p.getZ().setSum(t3);
-- t0.setProduct(three);
--
-- t0.setDifference(t2);
-- t0.setProduct(p.getZ());
-- p.getY().setSum(t0);
--
-- t4.setSum(t4);
-- p.getZ().setProduct(t4);
--
-- p.getX().setDifference(p.getZ());
-- p.getZ().setValue(t4).setProduct(t1);
--
-- p.getZ().setProduct(four);
--
-- }
--
-- /*
-- * Mixed point addition. This method constructs new temporaries each time
-- * it is called. For better efficiency, the method that reuses temporaries
-- * should be used if more than one sum will be computed.
-- */
-- public void setSum(MutablePoint p, AffinePoint p2) {
--
-- IntegerModuloP zero = p.getField().get0();
-- MutableIntegerModuloP t0 = zero.mutable();
-- MutableIntegerModuloP t1 = zero.mutable();
-- MutableIntegerModuloP t2 = zero.mutable();
-- MutableIntegerModuloP t3 = zero.mutable();
-- MutableIntegerModuloP t4 = zero.mutable();
-- setSum((ProjectivePoint.Mutable) p, p2, t0, t1, t2, t3, t4);
--
-- }
--
-- /*
-- * Mixed point addition
-- */
-- private void setSum(ProjectivePoint.Mutable p, AffinePoint p2,
-- MutableIntegerModuloP t0, MutableIntegerModuloP t1,
-- MutableIntegerModuloP t2, MutableIntegerModuloP t3,
-- MutableIntegerModuloP t4) {
--
-- t0.setValue(p.getX()).setProduct(p2.getX());
-- t1.setValue(p.getY()).setProduct(p2.getY());
-- t3.setValue(p2.getX()).setSum(p2.getY());
-- t4.setValue(p.getX()).setSum(p.getY());
-- p.getX().setReduced();
-- t3.setProduct(t4);
-- t4.setValue(t0).setSum(t1);
--
-- t3.setDifference(t4);
-- t4.setValue(p2.getY()).setProduct(p.getZ());
-- t4.setSum(p.getY());
--
-- p.getY().setValue(p2.getX()).setProduct(p.getZ());
-- p.getY().setSum(p.getX());
-- t2.setValue(p.getZ());
-- p.getZ().setProduct(b);
--
-- p.getX().setValue(p.getY()).setDifference(p.getZ());
-- p.getX().setReduced();
-- p.getZ().setValue(p.getX()).setProduct(two);
-- p.getX().setSum(p.getZ());
--
-- p.getZ().setValue(t1).setDifference(p.getX());
-- p.getX().setSum(t1);
-- p.getY().setProduct(b);
--
-- t1.setValue(t2).setProduct(two);
-- t2.setSum(t1);
-- t2.setReduced();
-- p.getY().setDifference(t2);
--
-- p.getY().setDifference(t0);
-- p.getY().setReduced();
-- t1.setValue(p.getY()).setProduct(two);
-- p.getY().setSum(t1);
--
-- t1.setValue(t0).setProduct(two);
-- t0.setSum(t1);
-- t0.setDifference(t2);
--
-- t1.setValue(t4).setProduct(p.getY());
-- t2.setValue(t0).setProduct(p.getY());
-- p.getY().setValue(p.getX()).setProduct(p.getZ());
--
-- p.getY().setSum(t2);
-- p.getX().setProduct(t3);
-- p.getX().setDifference(t1);
--
-- p.getZ().setProduct(t4);
-- t1.setValue(t3).setProduct(t0);
-- p.getZ().setSum(t1);
--
-- }
--
-- /*
-- * Projective point addition
-- */
-- private void setSum(ProjectivePoint.Mutable p, ProjectivePoint.Mutable p2,
-- MutableIntegerModuloP t0, MutableIntegerModuloP t1,
-- MutableIntegerModuloP t2, MutableIntegerModuloP t3,
-- MutableIntegerModuloP t4) {
--
-- t0.setValue(p.getX()).setProduct(p2.getX());
-- t1.setValue(p.getY()).setProduct(p2.getY());
-- t2.setValue(p.getZ()).setProduct(p2.getZ());
--
-- t3.setValue(p.getX()).setSum(p.getY());
-- t4.setValue(p2.getX()).setSum(p2.getY());
-- t3.setProduct(t4);
--
-- t4.setValue(t0).setSum(t1);
-- t3.setDifference(t4);
-- t4.setValue(p.getY()).setSum(p.getZ());
--
-- p.getY().setValue(p2.getY()).setSum(p2.getZ());
-- t4.setProduct(p.getY());
-- p.getY().setValue(t1).setSum(t2);
--
-- t4.setDifference(p.getY());
-- p.getX().setSum(p.getZ());
-- p.getY().setValue(p2.getX()).setSum(p2.getZ());
--
-- p.getX().setProduct(p.getY());
-- p.getY().setValue(t0).setSum(t2);
-- p.getY().setAdditiveInverse().setSum(p.getX());
-- p.getY().setReduced();
--
-- p.getZ().setValue(t2).setProduct(b);
-- p.getX().setValue(p.getY()).setDifference(p.getZ());
-- p.getZ().setValue(p.getX()).setProduct(two);
--
-- p.getX().setSum(p.getZ());
-- p.getX().setReduced();
-- p.getZ().setValue(t1).setDifference(p.getX());
-- p.getX().setSum(t1);
--
-- p.getY().setProduct(b);
-- t1.setValue(t2).setSum(t2);
-- t2.setSum(t1);
-- t2.setReduced();
--
-- p.getY().setDifference(t2);
-- p.getY().setDifference(t0);
-- p.getY().setReduced();
-- t1.setValue(p.getY()).setSum(p.getY());
--
-- p.getY().setSum(t1);
-- t1.setValue(t0).setProduct(two);
-- t0.setSum(t1);
--
-- t0.setDifference(t2);
-- t1.setValue(t4).setProduct(p.getY());
-- t2.setValue(t0).setProduct(p.getY());
--
-- p.getY().setValue(p.getX()).setProduct(p.getZ());
-- p.getY().setSum(t2);
-- p.getX().setProduct(t3);
--
-- p.getX().setDifference(t1);
-- p.getZ().setProduct(t4);
-- t1.setValue(t3).setProduct(t0);
--
-- p.getZ().setSum(t1);
--
-- }
--}
---- openjdk.orig/jdk/src/share/classes/sun/security/ec/point/AffinePoint.java 2019-07-14 02:30:40.000000000 +0200
-+++ openjdk/jdk/src/share/classes/sun/security/ec/point/AffinePoint.java 1970-01-01 01:00:00.000000000 +0100
-@@ -1,76 +0,0 @@
--/*
-- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This code is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License version 2 only, as
-- * published by the Free Software Foundation. Oracle designates this
-- * particular file as subject to the "Classpath" exception as provided
-- * by Oracle in the LICENSE file that accompanied this code.
-- *
-- * This code is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- * version 2 for more details (a copy is included in the LICENSE file that
-- * accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License version
-- * 2 along with this work; if not, write to the Free Software Foundation,
-- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-- *
-- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-- * or visit www.oracle.com if you need additional information or have any
-- * questions.
-- */
--package sun.security.ec.point;
--
--import sun.security.util.math.ImmutableIntegerModuloP;
--
--import java.util.Objects;
--
--/**
-- * Elliptic curve point represented using affine coordinates (x, y). This class
-- * is not part of the sun.security.ec.point.Point hierarchy because it is not
-- * used to hold intermediate values during point arithmetic, and so it does not
-- * have a mutable form.
-- */
--public class AffinePoint {
--
-- private final ImmutableIntegerModuloP x;
-- private final ImmutableIntegerModuloP y;
--
-- public AffinePoint(ImmutableIntegerModuloP x, ImmutableIntegerModuloP y) {
-- this.x = x;
-- this.y = y;
-- }
--
-- public ImmutableIntegerModuloP getX() {
-- return x;
-- }
--
-- public ImmutableIntegerModuloP getY() {
-- return y;
-- }
--
-- @Override
-- public boolean equals(Object obj) {
-- if (!(obj instanceof AffinePoint)) {
-- return false;
-- }
-- AffinePoint p = (AffinePoint) obj;
-- boolean xEquals = x.asBigInteger().equals(p.x.asBigInteger());
-- boolean yEquals = y.asBigInteger().equals(p.y.asBigInteger());
-- return xEquals && yEquals;
-- }
--
-- @Override
-- public int hashCode() {
-- return Objects.hash(x, y);
-- }
--
-- @Override
-- public String toString() {
-- return "(" + x.asBigInteger().toString() + "," +
-- y.asBigInteger().toString() + ")";
-- }
--}
---- openjdk.orig/jdk/src/share/classes/sun/security/ec/point/ImmutablePoint.java 2019-07-14 02:30:40.000000000 +0200
-+++ openjdk/jdk/src/share/classes/sun/security/ec/point/ImmutablePoint.java 1970-01-01 01:00:00.000000000 +0100
-@@ -1,32 +0,0 @@
--/*
-- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This code is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License version 2 only, as
-- * published by the Free Software Foundation. Oracle designates this
-- * particular file as subject to the "Classpath" exception as provided
-- * by Oracle in the LICENSE file that accompanied this code.
-- *
-- * This code is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- * version 2 for more details (a copy is included in the LICENSE file that
-- * accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License version
-- * 2 along with this work; if not, write to the Free Software Foundation,
-- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-- *
-- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-- * or visit www.oracle.com if you need additional information or have any
-- * questions.
-- */
--
--package sun.security.ec.point;
--
--/**
-- * An interface for immutable points on an elliptic curve over a finite field.
-- */
--public interface ImmutablePoint extends Point {
--}
---- openjdk.orig/jdk/src/share/classes/sun/security/ec/point/MutablePoint.java 2019-07-14 02:30:40.000000000 +0200
-+++ openjdk/jdk/src/share/classes/sun/security/ec/point/MutablePoint.java 1970-01-01 01:00:00.000000000 +0100
-@@ -1,37 +0,0 @@
--/*
-- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This code is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License version 2 only, as
-- * published by the Free Software Foundation. Oracle designates this
-- * particular file as subject to the "Classpath" exception as provided
-- * by Oracle in the LICENSE file that accompanied this code.
-- *
-- * This code is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- * version 2 for more details (a copy is included in the LICENSE file that
-- * accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License version
-- * 2 along with this work; if not, write to the Free Software Foundation,
-- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-- *
-- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-- * or visit www.oracle.com if you need additional information or have any
-- * questions.
-- */
--
--package sun.security.ec.point;
--
--/**
-- * An interface for mutable points on an elliptic curve over a finite field.
-- */
--public interface MutablePoint extends Point {
--
-- MutablePoint setValue(AffinePoint p);
-- MutablePoint setValue(Point p);
-- MutablePoint conditionalSet(Point p, int set);
--
--}
---- openjdk.orig/jdk/src/share/classes/sun/security/ec/point/Point.java 2019-07-14 02:30:40.000000000 +0200
-+++ openjdk/jdk/src/share/classes/sun/security/ec/point/Point.java 1970-01-01 01:00:00.000000000 +0100
-@@ -1,45 +0,0 @@
--/*
-- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This code is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License version 2 only, as
-- * published by the Free Software Foundation. Oracle designates this
-- * particular file as subject to the "Classpath" exception as provided
-- * by Oracle in the LICENSE file that accompanied this code.
-- *
-- * This code is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- * version 2 for more details (a copy is included in the LICENSE file that
-- * accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License version
-- * 2 along with this work; if not, write to the Free Software Foundation,
-- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-- *
-- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-- * or visit www.oracle.com if you need additional information or have any
-- * questions.
-- */
--
--package sun.security.ec.point;
--
--import sun.security.util.math.IntegerFieldModuloP;
--
--/**
-- * A base interface for points on an elliptic curve over a finite field.
-- * Implementations may use different representations for points, and this
-- * interface creates a common API for manipulating points. This API has no
-- * methods for point arithmetic, which depends on group structure and curve
-- * parameters in addition to point representation.
-- */
--public interface Point {
--
-- IntegerFieldModuloP getField();
-- AffinePoint asAffine();
--
-- ImmutablePoint fixed();
-- MutablePoint mutable();
--
--}
---- openjdk.orig/jdk/src/share/classes/sun/security/ec/point/ProjectivePoint.java 2019-07-14 02:30:40.000000000 +0200
-+++ openjdk/jdk/src/share/classes/sun/security/ec/point/ProjectivePoint.java 1970-01-01 01:00:00.000000000 +0100
-@@ -1,160 +0,0 @@
--/*
-- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This code is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License version 2 only, as
-- * published by the Free Software Foundation. Oracle designates this
-- * particular file as subject to the "Classpath" exception as provided
-- * by Oracle in the LICENSE file that accompanied this code.
-- *
-- * This code is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- * version 2 for more details (a copy is included in the LICENSE file that
-- * accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License version
-- * 2 along with this work; if not, write to the Free Software Foundation,
-- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-- *
-- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-- * or visit www.oracle.com if you need additional information or have any
-- * questions.
-- */
--package sun.security.ec.point;
--
--import sun.security.util.math.*;
--
--/**
-- * Elliptic curve point in projective coordinates (X, Y, Z) where
-- * an affine point (x, y) is represented using any (X, Y, Z) s.t.
-- * x = X/Z and y = Y/Z.
-- */
--public abstract class ProjectivePoint
-- <T extends IntegerModuloP> implements Point {
--
-- protected final T x;
-- protected final T y;
-- protected final T z;
--
-- protected ProjectivePoint(T x, T y, T z) {
--
-- this.x = x;
-- this.y = y;
-- this.z = z;
-- }
--
-- @Override
-- public IntegerFieldModuloP getField() {
-- return this.x.getField();
-- }
--
-- @Override
-- public Immutable fixed() {
-- return new Immutable(x.fixed(), y.fixed(), z.fixed());
-- }
--
-- @Override
-- public Mutable mutable() {
-- return new Mutable(x.mutable(), y.mutable(), z.mutable());
-- }
--
-- public T getX() {
-- return x;
-- }
--
-- public T getY() {
-- return y;
-- }
--
-- public T getZ() {
-- return z;
-- }
--
-- public AffinePoint asAffine() {
-- IntegerModuloP zInv = z.multiplicativeInverse();
-- return new AffinePoint(x.multiply(zInv), y.multiply(zInv));
-- }
--
-- public static class Immutable
-- extends ProjectivePoint<ImmutableIntegerModuloP>
-- implements ImmutablePoint {
--
-- public Immutable(ImmutableIntegerModuloP x,
-- ImmutableIntegerModuloP y,
-- ImmutableIntegerModuloP z) {
-- super(x, y, z);
-- }
-- }
--
-- public static class Mutable
-- extends ProjectivePoint<MutableIntegerModuloP>
-- implements MutablePoint {
--
-- public Mutable(MutableIntegerModuloP x,
-- MutableIntegerModuloP y,
-- MutableIntegerModuloP z) {
-- super(x, y, z);
-- }
--
-- public Mutable(IntegerFieldModuloP field) {
-- super(field.get0().mutable(),
-- field.get0().mutable(),
-- field.get0().mutable());
-- }
--
-- @Override
-- public Mutable conditionalSet(Point p, int set) {
-- if (!(p instanceof ProjectivePoint)) {
-- throw new RuntimeException("Incompatible point");
-- }
-- @SuppressWarnings("unchecked")
-- ProjectivePoint<IntegerModuloP> pp =
-- (ProjectivePoint<IntegerModuloP>) p;
-- return conditionalSet(pp, set);
-- }
--
-- private <T extends IntegerModuloP>
-- Mutable conditionalSet(ProjectivePoint<T> pp, int set) {
--
-- x.conditionalSet(pp.x, set);
-- y.conditionalSet(pp.y, set);
-- z.conditionalSet(pp.z, set);
--
-- return this;
-- }
--
-- @Override
-- public Mutable setValue(AffinePoint p) {
-- x.setValue(p.getX());
-- y.setValue(p.getY());
-- z.setValue(p.getX().getField().get1());
--
-- return this;
-- }
--
-- @Override
-- public Mutable setValue(Point p) {
-- if (!(p instanceof ProjectivePoint)) {
-- throw new RuntimeException("Incompatible point");
-- }
-- @SuppressWarnings("unchecked")
-- ProjectivePoint<IntegerModuloP> pp =
-- (ProjectivePoint<IntegerModuloP>) p;
-- return setValue(pp);
-- }
--
-- private <T extends IntegerModuloP>
-- Mutable setValue(ProjectivePoint<T> pp) {
--
-- x.setValue(pp.x);
-- y.setValue(pp.y);
-- z.setValue(pp.z);
--
-- return this;
-- }
--
-- }
--
--}
---- openjdk.orig/jdk/src/share/classes/sun/security/util/Function.java 2019-07-14 02:30:40.000000000 +0200
-+++ openjdk/jdk/src/share/classes/sun/security/util/Function.java 1970-01-01 01:00:00.000000000 +0100
-@@ -1,44 +0,0 @@
--/*
-- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This code is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License version 2 only, as
-- * published by the Free Software Foundation. Oracle designates this
-- * particular file as subject to the "Classpath" exception as provided
-- * by Oracle in the LICENSE file that accompanied this code.
-- *
-- * This code is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- * version 2 for more details (a copy is included in the LICENSE file that
-- * accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License version
-- * 2 along with this work; if not, write to the Free Software Foundation,
-- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-- *
-- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-- * or visit www.oracle.com if you need additional information or have any
-- * questions.
-- */
--package sun.security.util;
--
--/**
-- * Represents a function that accepts one argument and produces a result.
-- *
-- * @param <T> the type of the input to the function
-- * @param <R> the type of the result of the function
-- *
-- * @since 1.8
-- */
--public interface Function<T, R> {
--
-- /**
-- * Applies this function to the given argument.
-- *
-- * @param t the function argument
-- * @return the function result
-- */
-- R apply(T t);
--}
---- openjdk.orig/jdk/src/share/classes/sun/security/util/Optional.java 2019-07-14 02:30:40.000000000 +0200
-+++ openjdk/jdk/src/share/classes/sun/security/util/Optional.java 1970-01-01 01:00:00.000000000 +0100
-@@ -1,271 +0,0 @@
--/*
-- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This code is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License version 2 only, as
-- * published by the Free Software Foundation. Oracle designates this
-- * particular file as subject to the "Classpath" exception as provided
-- * by Oracle in the LICENSE file that accompanied this code.
-- *
-- * This code is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- * version 2 for more details (a copy is included in the LICENSE file that
-- * accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License version
-- * 2 along with this work; if not, write to the Free Software Foundation,
-- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-- *
-- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-- * or visit www.oracle.com if you need additional information or have any
-- * questions.
-- */
--package sun.security.util;
--
--import java.util.Objects;
--import java.util.NoSuchElementException;
--
--/**
-- * A container object which may or may not contain a non-null value.
-- * If a value is present, {@code isPresent()} will return {@code true} and
-- * {@code get()} will return the value.
-- *
-- * <p>Additional methods that depend on the presence or absence of a contained
-- * value are provided, such as {@link #orElse(java.lang.Object) orElse()}
-- * (return a default value if value not present) and
-- * {@link #ifPresent(java.util.function.Consumer) ifPresent()} (execute a block
-- * of code if the value is present).
-- *
-- * <p>This is a <a href="../lang/doc-files/ValueBased.html">value-based</a>
-- * class; use of identity-sensitive operations (including reference equality
-- * ({@code ==}), identity hash code, or synchronization) on instances of
-- * {@code Optional} may have unpredictable results and should be avoided.
-- *
-- * @since 1.8
-- */
--public final class Optional<T> {
-- /**
-- * Common instance for {@code empty()}.
-- */
-- private static final Optional<?> EMPTY = new Optional<>();
--
-- /**
-- * If non-null, the value; if null, indicates no value is present
-- */
-- private final T value;
--
-- /**
-- * Constructs an empty instance.
-- *
-- * @implNote Generally only one empty instance, {@link Optional#EMPTY},
-- * should exist per VM.
-- */
-- private Optional() {
-- this.value = null;
-- }
--
-- /**
-- * Returns an empty {@code Optional} instance. No value is present for this
-- * {@code Optional}.
-- *
-- * @apiNote
-- * Though it may be tempting to do so, avoid testing if an object is empty
-- * by comparing with {@code ==} against instances returned by
-- * {@code Optional.empty()}. There is no guarantee that it is a singleton.
-- * Instead, use {@link #isPresent()}.
-- *
-- * @param <T> The type of the non-existent value
-- * @return an empty {@code Optional}
-- */
-- public static<T> Optional<T> empty() {
-- @SuppressWarnings("unchecked")
-- Optional<T> t = (Optional<T>) EMPTY;
-- return t;
-- }
--
--
-- /**
-- * Constructs an instance with the described value.
-- *
-- * @param value the non-{@code null} value to describe
-- * @throws NullPointerException if value is {@code null}
-- */
-- private Optional(T value) {
-- this.value = Objects.requireNonNull(value);
-- }
--
-- /**
-- * Returns an {@code Optional} describing the given non-{@code null}
-- * value.
-- *
-- * @param value the value to describe, which must be non-{@code null}
-- * @param <T> the type of the value
-- * @return an {@code Optional} with the value present
-- * @throws NullPointerException if value is {@code null}
-- */
-- public static <T> Optional<T> of(T value) {
-- return new Optional<>(value);
-- }
--
-- /**
-- * Returns an {@code Optional} describing the specified value, if non-null,
-- * otherwise returns an empty {@code Optional}.
-- *
-- * @param <T> the class of the value
-- * @param value the possibly-null value to describe
-- * @return an {@code Optional} with a present value if the specified value
-- * is non-null, otherwise an empty {@code Optional}
-- */
-- public static <T> Optional<T> ofNullable(T value) {
-- return value == null ? new Optional<T>() : of(value);
-- }
--
-- /**
-- * If a value is present, returns the value, otherwise throws
-- * {@code NoSuchElementException}.
-- *
-- * @apiNote
-- * The preferred alternative to this method is {@link #orElseThrow()}.
-- *
-- * @return the non-{@code null} value described by this {@code Optional}
-- * @throws NoSuchElementException if no value is present
-- */
-- public T get() {
-- if (value == null) {
-- throw new NoSuchElementException("No value present");
-- }
-- return value;
-- }
--
-- /**
-- * If a value is present, returns {@code true}, otherwise {@code false}.
-- *
-- * @return {@code true} if a value is present, otherwise {@code false}
-- */
-- public boolean isPresent() {
-- return value != null;
-- }
--
-- /**
-- * If a value is not present, returns {@code true}, otherwise
-- * {@code false}.
-- *
-- * @return {@code true} if a value is not present, otherwise {@code false}
-- * @since 11
-- */
-- public boolean isEmpty() {
-- return value == null;
-- }
--
-- /**
-- * If a value is present, apply the provided mapping function to it,
-- * and if the result is non-null, return an {@code Optional} describing the
-- * result. Otherwise return an empty {@code Optional}.
-- *
-- * @apiNote This method supports post-processing on optional values, without
-- * the need to explicitly check for a return status. For example, the
-- * following code traverses a stream of file names, selects one that has
-- * not yet been processed, and then opens that file, returning an
-- * {@code Optional<FileInputStream>}:
-- *
-- * <pre>{@code
-- * Optional<FileInputStream> fis =
-- * names.stream().filter(name -> !isProcessedYet(name))
-- * .findFirst()
-- * .map(name -> new FileInputStream(name));
-- * }</pre>
-- *
-- * Here, {@code findFirst} returns an {@code Optional<String>}, and then
-- * {@code map} returns an {@code Optional<FileInputStream>} for the desired
-- * file if one exists.
-- *
-- * @param <U> The type of the result of the mapping function
-- * @param mapper a mapping function to apply to the value, if present
-- * @return an {@code Optional} describing the result of applying a mapping
-- * function to the value of this {@code Optional}, if a value is present,
-- * otherwise an empty {@code Optional}
-- * @throws NullPointerException if the mapping function is null
-- */
-- public<U> Optional<U> map(Function<? super T, ? extends U> mapper) {
-- Objects.requireNonNull(mapper);
-- if (!isPresent())
-- return empty();
-- else {
-- return Optional.ofNullable(mapper.apply(value));
-- }
-- }
--
-- /**
-- * Return the value if present, otherwise invoke {@code other} and return
-- * the result of that invocation.
-- *
-- * @param other a {@code Supplier} whose result is returned if no value
-- * is present
-- * @return the value if present otherwise the result of {@code other.get()}
-- * @throws NullPointerException if value is not present and {@code other} is
-- * null
-- */
-- public T orElseGet(Supplier<? extends T> other) {
-- return value != null ? value : other.get();
-- }
--
-- /**
-- * Indicates whether some other object is "equal to" this {@code Optional}.
-- * The other object is considered equal if:
-- * <ul>
-- * <li>it is also an {@code Optional} and;
-- * <li>both instances have no value present or;
-- * <li>the present values are "equal to" each other via {@code equals()}.
-- * </ul>
-- *
-- * @param obj an object to be tested for equality
-- * @return {@code true} if the other object is "equal to" this object
-- * otherwise {@code false}
-- */
-- @Override
-- public boolean equals(Object obj) {
-- if (this == obj) {
-- return true;
-- }
--
-- if (!(obj instanceof Optional)) {
-- return false;
-- }
--
-- Optional<?> other = (Optional<?>) obj;
-- return Objects.equals(value, other.value);
-- }
--
-- /**
-- * Returns the hash code of the value, if present, otherwise {@code 0}
-- * (zero) if no value is present.
-- *
-- * @return hash code value of the present value or {@code 0} if no value is
-- * present
-- */
-- @Override
-- public int hashCode() {
-- return Objects.hashCode(value);
-- }
--
-- /**
-- * Returns a non-empty string representation of this {@code Optional}
-- * suitable for debugging. The exact presentation format is unspecified and
-- * may vary between implementations and versions.
-- *
-- * @implSpec
-- * If a value is present the result must include its string representation
-- * in the result. Empty and present {@code Optional}s must be unambiguously
-- * differentiable.
-- *
-- * @return the string representation of this instance
-- */
-- @Override
-- public String toString() {
-- return value != null
-- ? String.format("Optional[%s]", value)
-- : "Optional.empty";
-- }
--}
---- openjdk.orig/jdk/src/share/classes/sun/security/util/Supplier.java 2019-07-14 02:30:40.000000000 +0200
-+++ openjdk/jdk/src/share/classes/sun/security/util/Supplier.java 1970-01-01 01:00:00.000000000 +0100
-@@ -1,48 +0,0 @@
--/*
-- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This code is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License version 2 only, as
-- * published by the Free Software Foundation. Oracle designates this
-- * particular file as subject to the "Classpath" exception as provided
-- * by Oracle in the LICENSE file that accompanied this code.
-- *
-- * This code is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- * version 2 for more details (a copy is included in the LICENSE file that
-- * accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License version
-- * 2 along with this work; if not, write to the Free Software Foundation,
-- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-- *
-- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-- * or visit www.oracle.com if you need additional information or have any
-- * questions.
-- */
--package sun.security.util;
--
--/**
-- * Represents a supplier of results.
-- *
-- * <p>There is no requirement that a new or distinct result be returned each
-- * time the supplier is invoked.
-- *
-- * <p>This is a <a href="package-summary.html">functional interface</a>
-- * whose functional method is {@link #get()}.
-- *
-- * @param <T> the type of results supplied by this supplier
-- *
-- * @since 1.8
-- */
--public interface Supplier<T> {
--
-- /**
-- * Gets a result.
-- *
-- * @return a result
-- */
-- T get();
--}
diff --git a/community/openjdk7/icedtea-jdk-revert-a32dc7400435.patch b/community/openjdk7/icedtea-jdk-revert-a32dc7400435.patch
deleted file mode 100644
index dc2eac6225..0000000000
--- a/community/openjdk7/icedtea-jdk-revert-a32dc7400435.patch
+++ /dev/null
@@ -1,1377 +0,0 @@
-Revert a32dc7400435 due build error
---- openjdk.orig/jdk/src/share/classes/com/sun/crypto/provider/AESCrypt.java 2019-07-15 08:52:23.000000000 +0200
-+++ openjdk/jdk/src/share/classes/com/sun/crypto/provider/AESCrypt.java 2019-07-04 19:20:08.000000000 +0200
-@@ -1,5 +1,5 @@
- /*
-- * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
-+ * Copyright (c) 2002, 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,6 +38,7 @@
-
- import java.security.InvalidKeyException;
- import java.security.MessageDigest;
-+import java.util.Objects;
-
- /**
- * Rijndael --pronounced Reindaal-- is a symmetric cipher with a 128-bit
-@@ -347,8 +348,8 @@
- */
- void encryptBlock(byte[] in, int inOffset,
- byte[] out, int outOffset) {
-- // Array bound checks are done in caller code, i.e.
-- // FeedbackCipher.encrypt/decrypt(...) to improve performance.
-+ cryptBlockCheck(in, inOffset);
-+ cryptBlockCheck(out, outOffset);
- implEncryptBlock(in, inOffset, out, outOffset);
- }
-
-@@ -425,8 +426,8 @@
- */
- void decryptBlock(byte[] in, int inOffset,
- byte[] out, int outOffset) {
-- // Array bound checks are done in caller code, i.e.
-- // FeedbackCipher.encrypt/decrypt(...) to improve performance.
-+ cryptBlockCheck(in, inOffset);
-+ cryptBlockCheck(out, outOffset);
- implDecryptBlock(in, inOffset, out, outOffset);
- }
-
-@@ -587,6 +588,26 @@
- out[outOffset ] = (byte)(Si[(a0 ) & 0xFF] ^ (t1 ));
- }
-
-+ // Used to perform all checks required by the Java semantics
-+ // (i.e., null checks and bounds checks) on the input parameters
-+ // to encryptBlock and to decryptBlock.
-+ // Normally, the Java Runtime performs these checks, however, as
-+ // encryptBlock and decryptBlock are possibly replaced with
-+ // compiler intrinsics, the JDK performs the required checks instead.
-+ // Does not check accesses to class-internal (private) arrays.
-+ private static void cryptBlockCheck(byte[] array, int offset) {
-+ Objects.requireNonNull(array);
-+
-+ if (offset < 0 || offset >= array.length) {
-+ throw new ArrayIndexOutOfBoundsException(offset);
-+ }
-+
-+ int largestIndex = offset + AES_BLOCK_SIZE - 1;
-+ if (largestIndex < 0 || largestIndex >= array.length) {
-+ throw new ArrayIndexOutOfBoundsException(largestIndex);
-+ }
-+ }
-+
- /**
- * Expand a user-supplied key material into a session key.
- *
---- openjdk.orig/jdk/src/share/classes/com/sun/crypto/provider/CipherBlockChaining.java 2019-07-15 08:52:23.000000000 +0200
-+++ openjdk/jdk/src/share/classes/com/sun/crypto/provider/CipherBlockChaining.java 2019-07-04 19:20:08.000000000 +0200
-@@ -1,5 +1,5 @@
- /*
-- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
-+ * Copyright (c) 1997, 2017, 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,7 +29,6 @@
- import java.security.ProviderException;
- import java.util.Objects;
-
--import sun.security.util.ArrayUtil;
-
- /**
- * This class represents ciphers in cipher block chaining (CBC) mode.
-@@ -144,9 +143,9 @@
- if (plainLen <= 0) {
- return plainLen;
- }
-- ArrayUtil.blockSizeCheck(plainLen, blockSize);
-- ArrayUtil.nullAndBoundsCheck(plain, plainOffset, plainLen);
-- ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen);
-+ cryptBlockSizeCheck(plainLen);
-+ cryptNullAndBoundsCheck(plain, plainOffset, plainLen);
-+ cryptNullAndBoundsCheck(cipher, cipherOffset, plainLen);
- return implEncrypt(plain, plainOffset, plainLen,
- cipher, cipherOffset);
- }
-@@ -194,9 +193,9 @@
- if (cipherLen <= 0) {
- return cipherLen;
- }
-- ArrayUtil.blockSizeCheck(cipherLen, blockSize);
-- ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, cipherLen);
-- ArrayUtil.nullAndBoundsCheck(plain, plainOffset, cipherLen);
-+ cryptBlockSizeCheck(cipherLen);
-+ cryptNullAndBoundsCheck(cipher, cipherOffset, cipherLen);
-+ cryptNullAndBoundsCheck(plain, plainOffset, cipherLen);
- return implDecrypt(cipher, cipherOffset, cipherLen, plain, plainOffset);
- }
-
-@@ -215,4 +214,23 @@
- }
- return cipherLen;
- }
-+
-+ private void cryptBlockSizeCheck(int len) {
-+ if ((len % blockSize) != 0) {
-+ throw new ProviderException("Internal error in input buffering");
-+ }
-+ }
-+
-+ private static void cryptNullAndBoundsCheck(byte[] array, int offset, int len) {
-+ Objects.requireNonNull(array);
-+
-+ if (offset < 0 || offset >= array.length) {
-+ throw new ArrayIndexOutOfBoundsException(offset);
-+ }
-+
-+ int endIndex = offset + len - 1;
-+ if (endIndex < 0 || endIndex >= array.length) {
-+ throw new ArrayIndexOutOfBoundsException(endIndex);
-+ }
-+ }
- }
---- openjdk.orig/jdk/src/share/classes/com/sun/crypto/provider/CipherFeedback.java 2019-07-15 08:52:23.000000000 +0200
-+++ openjdk/jdk/src/share/classes/com/sun/crypto/provider/CipherFeedback.java 2019-07-04 19:20:08.000000000 +0200
-@@ -1,5 +1,5 @@
- /*
-- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
-+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
-@@ -27,7 +27,6 @@
-
- import java.security.InvalidKeyException;
- import java.security.ProviderException;
--import sun.security.util.ArrayUtil;
-
- /**
- * This class represents ciphers in cipher-feedback (CFB) mode.
-@@ -150,9 +149,9 @@
- */
- int encrypt(byte[] plain, int plainOffset, int plainLen,
- byte[] cipher, int cipherOffset) {
-- ArrayUtil.blockSizeCheck(plainLen, numBytes);
-- ArrayUtil.nullAndBoundsCheck(plain, plainOffset, plainLen);
-- ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen);
-+ if ((plainLen % numBytes) != 0) {
-+ throw new ProviderException("Internal error in input buffering");
-+ }
-
- int nShift = blockSize - numBytes;
- int loopCount = plainLen / numBytes;
-@@ -226,10 +225,9 @@
- */
- int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
- byte[] plain, int plainOffset) {
--
-- ArrayUtil.blockSizeCheck(cipherLen, numBytes);
-- ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, cipherLen);
-- ArrayUtil.nullAndBoundsCheck(plain, plainOffset, cipherLen);
-+ if ((cipherLen % numBytes) != 0) {
-+ throw new ProviderException("Internal error in input buffering");
-+ }
-
- int nShift = blockSize - numBytes;
- int loopCount = cipherLen / numBytes;
---- openjdk.orig/jdk/src/share/classes/com/sun/crypto/provider/CounterMode.java 2019-07-15 08:52:23.000000000 +0200
-+++ openjdk/jdk/src/share/classes/com/sun/crypto/provider/CounterMode.java 2019-07-04 19:20:08.000000000 +0200
-@@ -1,5 +1,5 @@
- /*
-- * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
-+ * Copyright (c) 2002, 2017, 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
-@@ -27,7 +27,6 @@
-
- import java.security.InvalidKeyException;
-
--import sun.security.util.ArrayUtil;
-
- /**
- * This class represents ciphers in counter (CTR) mode.
-@@ -174,10 +173,6 @@
- if (len == 0) {
- return 0;
- }
--
-- ArrayUtil.nullAndBoundsCheck(in, inOff, len);
-- ArrayUtil.nullAndBoundsCheck(out, outOff, len);
--
- int result = len;
- while (len-- > 0) {
- if (used >= blockSize) {
---- openjdk.orig/jdk/src/share/classes/com/sun/crypto/provider/ElectronicCodeBook.java 2019-07-15 08:52:23.000000000 +0200
-+++ openjdk/jdk/src/share/classes/com/sun/crypto/provider/ElectronicCodeBook.java 2019-07-04 19:20:08.000000000 +0200
-@@ -1,5 +1,5 @@
- /*
-- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
-+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
-@@ -27,7 +27,6 @@
-
- import java.security.InvalidKeyException;
- import java.security.ProviderException;
--import sun.security.util.ArrayUtil;
-
- /**
- * This class represents ciphers in electronic codebook (ECB) mode.
-@@ -113,10 +112,9 @@
- * @return the length of the encrypted data
- */
- int encrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
-- ArrayUtil.blockSizeCheck(len, blockSize);
-- ArrayUtil.nullAndBoundsCheck(in, inOff, len);
-- ArrayUtil.nullAndBoundsCheck(out, outOff, len);
--
-+ if ((len % blockSize) != 0) {
-+ throw new ProviderException("Internal error in input buffering");
-+ }
- for (int i = len; i >= blockSize; i -= blockSize) {
- embeddedCipher.encryptBlock(in, inOff, out, outOff);
- inOff += blockSize;
-@@ -143,10 +141,9 @@
- * @return the length of the decrypted data
- */
- int decrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
-- ArrayUtil.blockSizeCheck(len, blockSize);
-- ArrayUtil.nullAndBoundsCheck(in, inOff, len);
-- ArrayUtil.nullAndBoundsCheck(out, outOff, len);
--
-+ if ((len % blockSize) != 0) {
-+ throw new ProviderException("Internal error in input buffering");
-+ }
- for (int i = len; i >= blockSize; i -= blockSize) {
- embeddedCipher.decryptBlock(in, inOff, out, outOff);
- inOff += blockSize;
---- openjdk.orig/jdk/src/share/classes/com/sun/crypto/provider/OutputFeedback.java 2019-07-15 08:52:23.000000000 +0200
-+++ openjdk/jdk/src/share/classes/com/sun/crypto/provider/OutputFeedback.java 2019-07-04 19:20:08.000000000 +0200
-@@ -1,5 +1,5 @@
- /*
-- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
-+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
-@@ -27,7 +27,6 @@
-
- import java.security.InvalidKeyException;
- import java.security.ProviderException;
--import sun.security.util.ArrayUtil;
-
- /**
- * This class represents ciphers in output-feedback (OFB) mode.
-@@ -149,10 +148,10 @@
- */
- int encrypt(byte[] plain, int plainOffset, int plainLen,
- byte[] cipher, int cipherOffset) {
-- ArrayUtil.blockSizeCheck(plainLen, numBytes);
-- ArrayUtil.nullAndBoundsCheck(plain, plainOffset, plainLen);
-- ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen);
-
-+ if ((plainLen % numBytes) != 0) {
-+ throw new ProviderException("Internal error in input buffering");
-+ }
- int nShift = blockSize - numBytes;
- int loopCount = plainLen / numBytes;
-
-@@ -190,9 +189,6 @@
- */
- int encryptFinal(byte[] plain, int plainOffset, int plainLen,
- byte[] cipher, int cipherOffset) {
-- ArrayUtil.nullAndBoundsCheck(plain, plainOffset, plainLen);
-- ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen);
--
- int oddBytes = plainLen % numBytes;
- int len = encrypt(plain, plainOffset, (plainLen - oddBytes),
- cipher, cipherOffset);
---- openjdk.orig/jdk/src/share/classes/com/sun/crypto/provider/PCBC.java 2019-07-15 08:52:23.000000000 +0200
-+++ openjdk/jdk/src/share/classes/com/sun/crypto/provider/PCBC.java 2019-07-04 19:20:08.000000000 +0200
-@@ -1,5 +1,5 @@
- /*
-- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
-+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
-@@ -27,7 +27,6 @@
-
- import java.security.InvalidKeyException;
- import java.security.ProviderException;
--import sun.security.util.ArrayUtil;
-
-
- /**
-@@ -137,10 +136,9 @@
- int encrypt(byte[] plain, int plainOffset, int plainLen,
- byte[] cipher, int cipherOffset)
- {
-- ArrayUtil.blockSizeCheck(plainLen, blockSize);
-- ArrayUtil.nullAndBoundsCheck(plain, plainOffset, plainLen);
-- ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, plainLen);
--
-+ if ((plainLen % blockSize) != 0) {
-+ throw new ProviderException("Internal error in input buffering");
-+ }
- int i;
- int endIndex = plainOffset + plainLen;
-
-@@ -178,10 +176,9 @@
- int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
- byte[] plain, int plainOffset)
- {
-- ArrayUtil.blockSizeCheck(cipherLen, blockSize);
-- ArrayUtil.nullAndBoundsCheck(cipher, cipherOffset, cipherLen);
-- ArrayUtil.nullAndBoundsCheck(plain, plainOffset, cipherLen);
--
-+ if ((cipherLen % blockSize) != 0) {
-+ throw new ProviderException("Internal error in input buffering");
-+ }
- int i;
- int endIndex = cipherOffset + cipherLen;
-
---- openjdk.orig/jdk/src/share/classes/sun/security/util/ArrayUtil.java 2019-07-15 08:52:23.000000000 +0200
-+++ openjdk/jdk/src/share/classes/sun/security/util/ArrayUtil.java 2019-07-04 19:20:08.000000000 +0200
-@@ -25,38 +25,12 @@
-
- package sun.security.util;
-
--import java.util.List;
--import java.security.*;
--
- /**
- * This class holds the various utility methods for array range checks.
- */
-
- public final class ArrayUtil {
-
-- private static final Function<String, ArrayIndexOutOfBoundsException> aioobeGenerator =
-- new Function<String, ArrayIndexOutOfBoundsException>() {
-- @Override
-- public ArrayIndexOutOfBoundsException apply(String x) {
-- return new ArrayIndexOutOfBoundsException(x);
-- }
-- };
--
-- private static final BiFunction<String, List<Integer>,
-- ArrayIndexOutOfBoundsException> AIOOBE_SUPPLIER =
-- Preconditions.outOfBoundsExceptionFormatter(aioobeGenerator);
--
-- public static void blockSizeCheck(int len, int blockSize) {
-- if ((len % blockSize) != 0) {
-- throw new ProviderException("Internal error in input buffering");
-- }
-- }
--
-- public static void nullAndBoundsCheck(byte[] array, int offset, int len) {
-- // NPE is thrown when array is null
-- Preconditions.checkFromIndexSize(offset, len, array.length, AIOOBE_SUPPLIER);
-- }
--
- private static void swap(byte[] arr, int i, int j) {
- byte tmp = arr[i];
- arr[i] = arr[j];
-@@ -74,3 +48,4 @@
- }
- }
- }
-+
---- openjdk.orig/jdk/src/share/classes/sun/security/util/BiConsumer.java 2019-07-15 08:52:23.000000000 +0200
-+++ openjdk/jdk/src/share/classes/sun/security/util/BiConsumer.java 1970-01-01 01:00:00.000000000 +0100
-@@ -1,48 +0,0 @@
--/*
-- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This code is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License version 2 only, as
-- * published by the Free Software Foundation. Oracle designates this
-- * particular file as subject to the "Classpath" exception as provided
-- * by Oracle in the LICENSE file that accompanied this code.
-- *
-- * This code is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- * version 2 for more details (a copy is included in the LICENSE file that
-- * accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License version
-- * 2 along with this work; if not, write to the Free Software Foundation,
-- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-- *
-- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-- * or visit www.oracle.com if you need additional information or have any
-- * questions.
-- */
--package sun.security.util;
--
--/**
-- * Represents an operation that accepts two input arguments and returns no
-- * result. This is the two-arity specialization of {@link Consumer}.
-- * Unlike most other functional interfaces, {@code BiConsumer} is expected
-- * to operate via side-effects.
-- *
-- * @param <T> the type of the first argument to the operation
-- * @param <U> the type of the second argument to the operation
-- *
-- * @see Consumer
-- * @since 1.8
-- */
--public interface BiConsumer<T, U> {
--
-- /**
-- * Performs this operation on the given arguments.
-- *
-- * @param t the first input argument
-- * @param u the second input argument
-- */
-- void accept(T t, U u);
--}
---- openjdk.orig/jdk/src/share/classes/sun/security/util/BiFunction.java 2019-07-15 08:52:23.000000000 +0200
-+++ openjdk/jdk/src/share/classes/sun/security/util/BiFunction.java 1970-01-01 01:00:00.000000000 +0100
-@@ -1,48 +0,0 @@
--/*
-- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This code is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License version 2 only, as
-- * published by the Free Software Foundation. Oracle designates this
-- * particular file as subject to the "Classpath" exception as provided
-- * by Oracle in the LICENSE file that accompanied this code.
-- *
-- * This code is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- * version 2 for more details (a copy is included in the LICENSE file that
-- * accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License version
-- * 2 along with this work; if not, write to the Free Software Foundation,
-- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-- *
-- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-- * or visit www.oracle.com if you need additional information or have any
-- * questions.
-- */
--package sun.security.util;
--
--/**
-- * Represents a function that accepts two arguments and produces a result.
-- * This is the two-arity specialization of {@link Function}.
-- *
-- * @param <T> the type of the first argument to the function
-- * @param <U> the type of the second argument to the function
-- * @param <R> the type of the result of the function
-- *
-- * @see Function
-- * @since 1.8
-- */
--public interface BiFunction<T, U, R> {
--
-- /**
-- * Applies this function to the given arguments.
-- *
-- * @param t the first function argument
-- * @param u the second function argument
-- * @return the function result
-- */
-- R apply(T t, U u);
--}
---- openjdk.orig/jdk/src/share/classes/sun/security/util/IntSupplier.java 2019-07-15 08:52:23.000000000 +0200
-+++ openjdk/jdk/src/share/classes/sun/security/util/IntSupplier.java 1970-01-01 01:00:00.000000000 +0100
-@@ -1,45 +0,0 @@
--/*
-- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This code is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License version 2 only, as
-- * published by the Free Software Foundation. Oracle designates this
-- * particular file as subject to the "Classpath" exception as provided
-- * by Oracle in the LICENSE file that accompanied this code.
-- *
-- * This code is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- * version 2 for more details (a copy is included in the LICENSE file that
-- * accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License version
-- * 2 along with this work; if not, write to the Free Software Foundation,
-- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-- *
-- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-- * or visit www.oracle.com if you need additional information or have any
-- * questions.
-- */
--package sun.security.util;
--
--/**
-- * Represents a supplier of {@code int}-valued results. This is the
-- * {@code int}-producing primitive specialization of {@link Supplier}.
-- *
-- * <p>There is no requirement that a distinct result be returned each
-- * time the supplier is invoked.
-- *
-- * @see Supplier
-- * @since 1.8
-- */
--public interface IntSupplier {
--
-- /**
-- * Gets a result.
-- *
-- * @return a result
-- */
-- int getAsInt();
--}
---- openjdk.orig/jdk/src/share/classes/sun/security/util/Preconditions.java 2019-07-15 08:52:23.000000000 +0200
-+++ openjdk/jdk/src/share/classes/sun/security/util/Preconditions.java 1970-01-01 01:00:00.000000000 +0100
-@@ -1,343 +0,0 @@
--/*
-- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This code is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License version 2 only, as
-- * published by the Free Software Foundation. Oracle designates this
-- * particular file as subject to the "Classpath" exception as provided
-- * by Oracle in the LICENSE file that accompanied this code.
-- *
-- * This code is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- * version 2 for more details (a copy is included in the LICENSE file that
-- * accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License version
-- * 2 along with this work; if not, write to the Free Software Foundation,
-- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-- *
-- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-- * or visit www.oracle.com if you need additional information or have any
-- * questions.
-- */
--package sun.security.util;
--
--import java.util.Arrays;
--import java.util.Collections;
--import java.util.List;
--
--/**
-- * Utility methods to check if state or arguments are correct.
-- *
-- */
--public class Preconditions {
--
-- /**
-- * Maps out-of-bounds values to a runtime exception.
-- *
-- * @param checkKind the kind of bounds check, whose name may correspond
-- * to the name of one of the range check methods, checkIndex,
-- * checkFromToIndex, checkFromIndexSize
-- * @param args the out-of-bounds arguments that failed the range check.
-- * If the checkKind corresponds a the name of a range check method
-- * then the bounds arguments are those that can be passed in order
-- * to the method.
-- * @param oobef the exception formatter that when applied with a checkKind
-- * and a list out-of-bounds arguments returns a runtime exception.
-- * If {@code null} then, it is as if an exception formatter was
-- * supplied that returns {@link IndexOutOfBoundsException} for any
-- * given arguments.
-- * @return the runtime exception
-- */
-- private static RuntimeException outOfBounds(
-- BiFunction<String, List<Integer>, ? extends RuntimeException> oobef,
-- String checkKind,
-- Integer... args) {
-- List<Integer> largs = Collections.unmodifiableList(Arrays.asList(args));
-- RuntimeException e = oobef == null
-- ? null : oobef.apply(checkKind, largs);
-- return e == null
-- ? new IndexOutOfBoundsException(outOfBoundsMessage(checkKind, largs)) : e;
-- }
--
-- private static RuntimeException outOfBoundsCheckIndex(
-- BiFunction<String, List<Integer>, ? extends RuntimeException> oobe,
-- int index, int length) {
-- return outOfBounds(oobe, "checkIndex", index, length);
-- }
--
-- private static RuntimeException outOfBoundsCheckFromToIndex(
-- BiFunction<String, List<Integer>, ? extends RuntimeException> oobe,
-- int fromIndex, int toIndex, int length) {
-- return outOfBounds(oobe, "checkFromToIndex", fromIndex, toIndex, length);
-- }
--
-- private static RuntimeException outOfBoundsCheckFromIndexSize(
-- BiFunction<String, List<Integer>, ? extends RuntimeException> oobe,
-- int fromIndex, int size, int length) {
-- return outOfBounds(oobe, "checkFromIndexSize", fromIndex, size, length);
-- }
--
-- /**
-- * Returns an out-of-bounds exception formatter from an given exception
-- * factory. The exception formatter is a function that formats an
-- * out-of-bounds message from its arguments and applies that message to the
-- * given exception factory to produce and relay an exception.
-- *
-- * <p>The exception formatter accepts two arguments: a {@code String}
-- * describing the out-of-bounds range check that failed, referred to as the
-- * <em>check kind</em>; and a {@code List<Integer>} containing the
-- * out-of-bound integer values that failed the check. The list of
-- * out-of-bound values is not modified.
-- *
-- * <p>Three check kinds are supported {@code checkIndex},
-- * {@code checkFromToIndex} and {@code checkFromIndexSize} corresponding
-- * respectively to the specified application of an exception formatter as an
-- * argument to the out-of-bounds range check methods
-- * {@link #checkIndex(int, int, BiFunction) checkIndex},
-- * {@link #checkFromToIndex(int, int, int, BiFunction) checkFromToIndex}, and
-- * {@link #checkFromIndexSize(int, int, int, BiFunction) checkFromIndexSize}.
-- * Thus a supported check kind corresponds to a method name and the
-- * out-of-bound integer values correspond to method argument values, in
-- * order, preceding the exception formatter argument (similar in many
-- * respects to the form of arguments required for a reflective invocation of
-- * such a range check method).
-- *
-- * <p>Formatter arguments conforming to such supported check kinds will
-- * produce specific exception messages describing failed out-of-bounds
-- * checks. Otherwise, more generic exception messages will be produced in
-- * any of the following cases: the check kind is supported but fewer
-- * or more out-of-bounds values are supplied, the check kind is not
-- * supported, the check kind is {@code null}, or the list of out-of-bound
-- * values is {@code null}.
-- *
-- * @apiNote
-- * This method produces an out-of-bounds exception formatter that can be
-- * passed as an argument to any of the supported out-of-bounds range check
-- * methods declared by {@code Objects}. For example, a formatter producing
-- * an {@code ArrayIndexOutOfBoundsException} may be produced and stored on a
-- * {@code static final} field as follows:
-- * <pre>{@code
-- * static final
-- * BiFunction<String, List<Integer>, ArrayIndexOutOfBoundsException> AIOOBEF =
-- * outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new);
-- * }</pre>
-- * The formatter instance {@code AIOOBEF} may be passed as an argument to an
-- * out-of-bounds range check method, such as checking if an {@code index}
-- * is within the bounds of a {@code limit}:
-- * <pre>{@code
-- * checkIndex(index, limit, AIOOBEF);
-- * }</pre>
-- * If the bounds check fails then the range check method will throw an
-- * {@code ArrayIndexOutOfBoundsException} with an appropriate exception
-- * message that is a produced from {@code AIOOBEF} as follows:
-- * <pre>{@code
-- * AIOOBEF.apply("checkIndex", List.of(index, limit));
-- * }</pre>
-- *
-- * @param f the exception factory, that produces an exception from a message
-- * where the message is produced and formatted by the returned
-- * exception formatter. If this factory is stateless and side-effect
-- * free then so is the returned formatter.
-- * Exceptions thrown by the factory are relayed to the caller
-- * of the returned formatter.
-- * @param <X> the type of runtime exception to be returned by the given
-- * exception factory and relayed by the exception formatter
-- * @return the out-of-bounds exception formatter
-- */
-- public static <X extends RuntimeException>
-- BiFunction<String, List<Integer>, X> outOfBoundsExceptionFormatter(final Function<String, X> f) {
-- // Use anonymous class to avoid bootstrap issues if this method is
-- // used early in startup
-- return new BiFunction<String, List<Integer>, X>() {
-- @Override
-- public X apply(String checkKind, List<Integer> args) {
-- return f.apply(outOfBoundsMessage(checkKind, args));
-- }
-- };
-- }
--
-- private static String outOfBoundsMessage(String checkKind, List<Integer> args) {
-- if (checkKind == null && args == null) {
-- return String.format("Range check failed");
-- } else if (checkKind == null) {
-- return String.format("Range check failed: %s", args);
-- } else if (args == null) {
-- return String.format("Range check failed: %s", checkKind);
-- }
--
-- int argSize = 0;
-- switch (checkKind) {
-- case "checkIndex":
-- argSize = 2;
-- break;
-- case "checkFromToIndex":
-- case "checkFromIndexSize":
-- argSize = 3;
-- break;
-- default:
-- }
--
-- // Switch to default if fewer or more arguments than required are supplied
-- switch ((args.size() != argSize) ? "" : checkKind) {
-- case "checkIndex":
-- return String.format("Index %d out-of-bounds for length %d",
-- args.get(0), args.get(1));
-- case "checkFromToIndex":
-- return String.format("Range [%d, %d) out-of-bounds for length %d",
-- args.get(0), args.get(1), args.get(2));
-- case "checkFromIndexSize":
-- return String.format("Range [%d, %<d + %d) out-of-bounds for length %d",
-- args.get(0), args.get(1), args.get(2));
-- default:
-- return String.format("Range check failed: %s %s", checkKind, args);
-- }
-- }
--
-- /**
-- * Checks if the {@code index} is within the bounds of the range from
-- * {@code 0} (inclusive) to {@code length} (exclusive).
-- *
-- * <p>The {@code index} is defined to be out-of-bounds if any of the
-- * following inequalities is true:
-- * <ul>
-- * <li>{@code index < 0}</li>
-- * <li>{@code index >= length}</li>
-- * <li>{@code length < 0}, which is implied from the former inequalities</li>
-- * </ul>
-- *
-- * <p>If the {@code index} is out-of-bounds, then a runtime exception is
-- * thrown that is the result of applying the following arguments to the
-- * exception formatter: the name of this method, {@code checkIndex};
-- * and an unmodifiable list integers whose values are, in order, the
-- * out-of-bounds arguments {@code index} and {@code length}.
-- *
-- * @param <X> the type of runtime exception to throw if the arguments are
-- * out-of-bounds
-- * @param index the index
-- * @param length the upper-bound (exclusive) of the range
-- * @param oobef the exception formatter that when applied with this
-- * method name and out-of-bounds arguments returns a runtime
-- * exception. If {@code null} or returns {@code null} then, it is as
-- * if an exception formatter produced from an invocation of
-- * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used
-- * instead (though it may be more efficient).
-- * Exceptions thrown by the formatter are relayed to the caller.
-- * @return {@code index} if it is within bounds of the range
-- * @throws X if the {@code index} is out-of-bounds and the exception
-- * formatter is non-{@code null}
-- * @throws IndexOutOfBoundsException if the {@code index} is out-of-bounds
-- * and the exception formatter is {@code null}
-- * @since 9
-- *
-- * @implNote
-- * This method is made intrinsic in optimizing compilers to guide them to
-- * perform unsigned comparisons of the index and length when it is known the
-- * length is a non-negative value (such as that of an array length or from
-- * the upper bound of a loop)
-- */
-- public static <X extends RuntimeException>
-- int checkIndex(int index, int length,
-- BiFunction<String, List<Integer>, X> oobef) {
-- if (index < 0 || index >= length)
-- throw outOfBoundsCheckIndex(oobef, index, length);
-- return index;
-- }
--
-- /**
-- * Checks if the sub-range from {@code fromIndex} (inclusive) to
-- * {@code toIndex} (exclusive) is within the bounds of range from {@code 0}
-- * (inclusive) to {@code length} (exclusive).
-- *
-- * <p>The sub-range is defined to be out-of-bounds if any of the following
-- * inequalities is true:
-- * <ul>
-- * <li>{@code fromIndex < 0}</li>
-- * <li>{@code fromIndex > toIndex}</li>
-- * <li>{@code toIndex > length}</li>
-- * <li>{@code length < 0}, which is implied from the former inequalities</li>
-- * </ul>
-- *
-- * <p>If the sub-range is out-of-bounds, then a runtime exception is
-- * thrown that is the result of applying the following arguments to the
-- * exception formatter: the name of this method, {@code checkFromToIndex};
-- * and an unmodifiable list integers whose values are, in order, the
-- * out-of-bounds arguments {@code fromIndex}, {@code toIndex}, and {@code length}.
-- *
-- * @param <X> the type of runtime exception to throw if the arguments are
-- * out-of-bounds
-- * @param fromIndex the lower-bound (inclusive) of the sub-range
-- * @param toIndex the upper-bound (exclusive) of the sub-range
-- * @param length the upper-bound (exclusive) the range
-- * @param oobef the exception formatter that when applied with this
-- * method name and out-of-bounds arguments returns a runtime
-- * exception. If {@code null} or returns {@code null} then, it is as
-- * if an exception formatter produced from an invocation of
-- * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used
-- * instead (though it may be more efficient).
-- * Exceptions thrown by the formatter are relayed to the caller.
-- * @return {@code fromIndex} if the sub-range within bounds of the range
-- * @throws X if the sub-range is out-of-bounds and the exception factory
-- * function is non-{@code null}
-- * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds and
-- * the exception factory function is {@code null}
-- * @since 9
-- */
-- public static <X extends RuntimeException>
-- int checkFromToIndex(int fromIndex, int toIndex, int length,
-- BiFunction<String, List<Integer>, X> oobef) {
-- if (fromIndex < 0 || fromIndex > toIndex || toIndex > length)
-- throw outOfBoundsCheckFromToIndex(oobef, fromIndex, toIndex, length);
-- return fromIndex;
-- }
--
-- /**
-- * Checks if the sub-range from {@code fromIndex} (inclusive) to
-- * {@code fromIndex + size} (exclusive) is within the bounds of range from
-- * {@code 0} (inclusive) to {@code length} (exclusive).
-- *
-- * <p>The sub-range is defined to be out-of-bounds if any of the following
-- * inequalities is true:
-- * <ul>
-- * <li>{@code fromIndex < 0}</li>
-- * <li>{@code size < 0}</li>
-- * <li>{@code fromIndex + size > length}, taking into account integer overflow</li>
-- * <li>{@code length < 0}, which is implied from the former inequalities</li>
-- * </ul>
-- *
-- * <p>If the sub-range is out-of-bounds, then a runtime exception is
-- * thrown that is the result of applying the following arguments to the
-- * exception formatter: the name of this method, {@code checkFromIndexSize};
-- * and an unmodifiable list integers whose values are, in order, the
-- * out-of-bounds arguments {@code fromIndex}, {@code size}, and
-- * {@code length}.
-- *
-- * @param <X> the type of runtime exception to throw if the arguments are
-- * out-of-bounds
-- * @param fromIndex the lower-bound (inclusive) of the sub-interval
-- * @param size the size of the sub-range
-- * @param length the upper-bound (exclusive) of the range
-- * @param oobef the exception formatter that when applied with this
-- * method name and out-of-bounds arguments returns a runtime
-- * exception. If {@code null} or returns {@code null} then, it is as
-- * if an exception formatter produced from an invocation of
-- * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used
-- * instead (though it may be more efficient).
-- * Exceptions thrown by the formatter are relayed to the caller.
-- * @return {@code fromIndex} if the sub-range within bounds of the range
-- * @throws X if the sub-range is out-of-bounds and the exception factory
-- * function is non-{@code null}
-- * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds and
-- * the exception factory function is {@code null}
-- * @since 9
-- */
-- public static <X extends RuntimeException>
-- int checkFromIndexSize(int fromIndex, int size, int length,
-- BiFunction<String, List<Integer>, X> oobef) {
-- if ((length | fromIndex | size) < 0 || size > length - fromIndex)
-- throw outOfBoundsCheckFromIndexSize(oobef, fromIndex, size, length);
-- return fromIndex;
-- }
--}
---- openjdk.orig/test/src/java/util/Objects/CheckIndex.java 2019-07-15 08:52:23.000000000 +0200
-+++ openjdk/jdk/test/java/util/Objects/CheckIndex.java 1970-01-01 01:00:00.000000000 +0100
-@@ -1,408 +0,0 @@
--/*
-- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * This code is free software; you can redistribute it and/or modify it
-- * under the terms of the GNU General Public License version 2 only, as
-- * published by the Free Software Foundation.
-- *
-- * This code is distributed in the hope that it will be useful, but WITHOUT
-- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- * version 2 for more details (a copy is included in the LICENSE file that
-- * accompanied this code).
-- *
-- * You should have received a copy of the GNU General Public License version
-- * 2 along with this work; if not, write to the Free Software Foundation,
-- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-- *
-- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-- * or visit www.oracle.com if you need additional information or have any
-- * questions.
-- */
--
--/**
-- * @test
-- * @summary Objects.checkIndex/jdk.internal.util.Preconditions.checkIndex tests
-- * @run testng CheckIndex
-- * @bug 8135248 8142493 8155794
-- */
--
--import org.testng.annotations.DataProvider;
--import org.testng.annotations.Test;
--
--import java.util.ArrayList;
--import java.util.Arrays;
--import java.util.Collections;
--import java.util.HashSet;
--import java.util.List;
--import java.util.Objects;
--import java.util.Set;
--
--import sun.security.util.BiConsumer;
--import sun.security.util.BiFunction;
--import sun.security.util.Function;
--import sun.security.util.IntSupplier;
--import sun.security.util.Preconditions;
--
--import static org.testng.Assert.*;
--
--public class CheckIndex {
--
-- private static final Function<String, IndexOutOfBoundsException> ioobeGenerator =
-- new Function<String, IndexOutOfBoundsException>() {
-- @Override
-- public IndexOutOfBoundsException apply(String x) {
-- return new IndexOutOfBoundsException(x);
-- }
-- };
--
-- private static final Function<String, StringIndexOutOfBoundsException> sioobeGenerator =
-- new Function<String, StringIndexOutOfBoundsException>() {
-- @Override
-- public StringIndexOutOfBoundsException apply(String x) {
-- return new StringIndexOutOfBoundsException(x);
-- }
-- };
--
-- private static final Function<String, ArrayIndexOutOfBoundsException> aioobeGenerator =
-- new Function<String, ArrayIndexOutOfBoundsException>() {
-- @Override
-- public ArrayIndexOutOfBoundsException apply(String x) {
-- return new ArrayIndexOutOfBoundsException(x);
-- }
-- };
--
-- static class AssertingOutOfBoundsException extends RuntimeException {
-- public AssertingOutOfBoundsException(String message) {
-- super(message);
-- }
-- }
--
-- static BiFunction<String, List<Integer>, AssertingOutOfBoundsException> assertingOutOfBounds(
-- final String message, final String expCheckKind, final Integer... expArgs) {
-- return new BiFunction<String, List<Integer>, AssertingOutOfBoundsException>() {
-- @Override
-- public AssertingOutOfBoundsException apply(String checkKind, List<Integer> args) {
-- assertEquals(checkKind, expCheckKind);
-- assertEquals(args, Collections.unmodifiableList(Arrays.asList(expArgs)));
-- try {
-- args.clear();
-- fail("Out of bounds List<Integer> argument should be unmodifiable");
-- } catch (Exception e) {
-- }
-- return new AssertingOutOfBoundsException(message);
-- }
-- };
-- }
--
-- static BiFunction<String, List<Integer>, AssertingOutOfBoundsException> assertingOutOfBoundsReturnNull(
-- final String expCheckKind, final Integer... expArgs) {
-- return new BiFunction<String, List<Integer>, AssertingOutOfBoundsException>() {
-- @Override
-- public AssertingOutOfBoundsException apply(String checkKind, List<Integer> args) {
-- assertEquals(checkKind, expCheckKind);
-- assertEquals(args, Collections.unmodifiableList(Arrays.asList(expArgs)));
-- return null;
-- }
-- };
-- }
--
-- static final int[] VALUES = {0, 1, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, -1, Integer.MIN_VALUE + 1, Integer.MIN_VALUE};
--
-- @DataProvider
-- static Object[][] checkIndexProvider() {
-- List<Object[]> l = new ArrayList<>();
-- for (int index : VALUES) {
-- for (int length : VALUES) {
-- boolean withinBounds = index >= 0 &&
-- length >= 0 &&
-- index < length;
-- l.add(new Object[]{index, length, withinBounds});
-- }
-- }
-- return l.toArray(new Object[0][0]);
-- }
--
-- interface X {
-- int apply(int a, int b, int c);
-- }
--
-- @Test(dataProvider = "checkIndexProvider")
-- public void testCheckIndex(final int index, final int length, final boolean withinBounds) {
-- List<Integer> list = Collections.unmodifiableList(Arrays.asList(new Integer[] { index, length }));
-- final String expectedMessage = withinBounds
-- ? null
-- : Preconditions.outOfBoundsExceptionFormatter(ioobeGenerator).
-- apply("checkIndex", list).getMessage();
--
-- BiConsumer<Class<? extends RuntimeException>, IntSupplier> checker =
-- new BiConsumer<Class<? extends RuntimeException>, IntSupplier>() {
-- @Override
-- public void accept(Class<? extends RuntimeException> ec, IntSupplier s) {
-- try {
-- int rIndex = s.getAsInt();
-- if (!withinBounds)
-- fail(String.format(
-- "Index %d is out of bounds of [0, %d), but was reported to be within bounds", index, length));
-- assertEquals(rIndex, index);
-- }
-- catch (RuntimeException e) {
-- assertTrue(ec.isInstance(e));
-- if (withinBounds)
-- fail(String.format(
-- "Index %d is within bounds of [0, %d), but was reported to be out of bounds", index, length));
-- else
-- assertEquals(e.getMessage(), expectedMessage);
-- }
-- }
-- };
--
-- checker.accept(AssertingOutOfBoundsException.class, new IntSupplier() {
-- @Override
-- public int getAsInt() {
-- return Preconditions.checkIndex(index, length,
-- assertingOutOfBounds(expectedMessage, "checkIndex", index, length));
-- }
-- });
-- checker.accept(IndexOutOfBoundsException.class, new IntSupplier() {
-- @Override
-- public int getAsInt() {
-- return Preconditions.checkIndex(index, length,
-- assertingOutOfBoundsReturnNull("checkIndex", index, length));
-- }
-- });
-- checker.accept(IndexOutOfBoundsException.class, new IntSupplier() {
-- @Override
-- public int getAsInt() {
-- return Preconditions.checkIndex(index, length, null);
-- }
-- });
-- checker.accept(ArrayIndexOutOfBoundsException.class, new IntSupplier() {
-- @Override
-- public int getAsInt() {
-- return Preconditions.checkIndex(index, length,
-- Preconditions.outOfBoundsExceptionFormatter(aioobeGenerator));
-- }
-- });
-- checker.accept(StringIndexOutOfBoundsException.class, new IntSupplier() {
-- @Override
-- public int getAsInt() {
-- return Preconditions.checkIndex(index, length,
-- Preconditions.outOfBoundsExceptionFormatter(sioobeGenerator));
-- }
-- });
-- }
--
--
-- @DataProvider
-- static Object[][] checkFromToIndexProvider() {
-- List<Object[]> l = new ArrayList<>();
-- for (int fromIndex : VALUES) {
-- for (int toIndex : VALUES) {
-- for (int length : VALUES) {
-- boolean withinBounds = fromIndex >= 0 &&
-- toIndex >= 0 &&
-- length >= 0 &&
-- fromIndex <= toIndex &&
-- toIndex <= length;
-- l.add(new Object[]{fromIndex, toIndex, length, withinBounds});
-- }
-- }
-- }
-- return l.toArray(new Object[0][0]);
-- }
--
-- @Test(dataProvider = "checkFromToIndexProvider")
-- public void testCheckFromToIndex(final int fromIndex, final int toIndex,
-- final int length, final boolean withinBounds) {
-- List<Integer> list = Collections.unmodifiableList(Arrays.asList(new Integer[] { fromIndex, toIndex, length }));
-- final String expectedMessage = withinBounds
-- ? null
-- : Preconditions.outOfBoundsExceptionFormatter(ioobeGenerator).
-- apply("checkFromToIndex", list).getMessage();
--
-- BiConsumer<Class<? extends RuntimeException>, IntSupplier> check =
-- new BiConsumer<Class<? extends RuntimeException>, IntSupplier>() {
-- @Override
-- public void accept(Class<? extends RuntimeException> ec, IntSupplier s) {
-- try {
-- int rIndex = s.getAsInt();
-- if (!withinBounds)
-- fail(String.format(
-- "Range [%d, %d) is out of bounds of [0, %d), but was reported to be withing bounds", fromIndex, toIndex, length));
-- assertEquals(rIndex, fromIndex);
-- }
-- catch (RuntimeException e) {
-- assertTrue(ec.isInstance(e));
-- if (withinBounds)
-- fail(String.format(
-- "Range [%d, %d) is within bounds of [0, %d), but was reported to be out of bounds", fromIndex, toIndex, length));
-- else
-- assertEquals(e.getMessage(), expectedMessage);
-- }
-- }
-- };
--
-- check.accept(AssertingOutOfBoundsException.class, new IntSupplier() {
-- @Override
-- public int getAsInt() {
-- return Preconditions.checkFromToIndex(fromIndex, toIndex, length,
-- assertingOutOfBounds(expectedMessage, "checkFromToIndex", fromIndex, toIndex, length));
-- }
-- });
-- check.accept(IndexOutOfBoundsException.class, new IntSupplier() {
-- @Override
-- public int getAsInt() {
-- return Preconditions.checkFromToIndex(fromIndex, toIndex, length,
-- assertingOutOfBoundsReturnNull("checkFromToIndex", fromIndex, toIndex, length));
-- }
-- });
-- check.accept(IndexOutOfBoundsException.class, new IntSupplier() {
-- @Override
-- public int getAsInt() {
-- return Preconditions.checkFromToIndex(fromIndex, toIndex, length, null);
-- }
-- });
-- check.accept(ArrayIndexOutOfBoundsException.class, new IntSupplier() {
-- @Override
-- public int getAsInt() {
-- return Preconditions.checkFromToIndex(fromIndex, toIndex, length,
-- Preconditions.outOfBoundsExceptionFormatter(aioobeGenerator));
-- }
-- });
-- check.accept(StringIndexOutOfBoundsException.class, new IntSupplier() {
-- @Override
-- public int getAsInt() {
-- return Preconditions.checkFromToIndex(fromIndex, toIndex, length,
-- Preconditions.outOfBoundsExceptionFormatter(sioobeGenerator));
-- }
-- });
-- }
--
--
-- @DataProvider
-- static Object[][] checkFromIndexSizeProvider() {
-- List<Object[]> l = new ArrayList<>();
-- for (int fromIndex : VALUES) {
-- for (int size : VALUES) {
-- for (int length : VALUES) {
-- // Explicitly convert to long
-- long lFromIndex = fromIndex;
-- long lSize = size;
-- long lLength = length;
-- // Avoid overflow
-- long lToIndex = lFromIndex + lSize;
--
-- boolean withinBounds = lFromIndex >= 0L &&
-- lSize >= 0L &&
-- lLength >= 0L &&
-- lFromIndex <= lToIndex &&
-- lToIndex <= lLength;
-- l.add(new Object[]{fromIndex, size, length, withinBounds});
-- }
-- }
-- }
-- return l.toArray(new Object[0][0]);
-- }
--
-- @Test(dataProvider = "checkFromIndexSizeProvider")
-- public void testCheckFromIndexSize(final int fromIndex, final int size,
-- final int length, final boolean withinBounds) {
-- List<Integer> list = Collections.unmodifiableList(Arrays.asList(new Integer[] { fromIndex, size, length }));
-- final String expectedMessage = withinBounds
-- ? null
-- : Preconditions.outOfBoundsExceptionFormatter(ioobeGenerator).
-- apply("checkFromIndexSize", list).getMessage();
--
-- BiConsumer<Class<? extends RuntimeException>, IntSupplier> check =
-- new BiConsumer<Class<? extends RuntimeException>, IntSupplier>() {
-- @Override
-- public void accept(Class<? extends RuntimeException> ec, IntSupplier s) {
-- try {
-- int rIndex = s.getAsInt();
-- if (!withinBounds)
-- fail(String.format(
-- "Range [%d, %d + %d) is out of bounds of [0, %d), but was reported to be withing bounds", fromIndex, fromIndex, size, length));
-- assertEquals(rIndex, fromIndex);
-- }
-- catch (RuntimeException e) {
-- assertTrue(ec.isInstance(e));
-- if (withinBounds)
-- fail(String.format(
-- "Range [%d, %d + %d) is within bounds of [0, %d), but was reported to be out of bounds", fromIndex, fromIndex, size, length));
-- else
-- assertEquals(e.getMessage(), expectedMessage);
-- }
-- }
-- };
--
-- check.accept(AssertingOutOfBoundsException.class, new IntSupplier() {
-- @Override
-- public int getAsInt() {
-- return Preconditions.checkFromIndexSize(fromIndex, size, length,
-- assertingOutOfBounds(expectedMessage, "checkFromIndexSize", fromIndex, size, length));
-- }
-- });
-- check.accept(IndexOutOfBoundsException.class, new IntSupplier() {
-- @Override
-- public int getAsInt() {
-- return Preconditions.checkFromIndexSize(fromIndex, size, length,
-- assertingOutOfBoundsReturnNull("checkFromIndexSize", fromIndex, size, length));
-- }
-- });
-- check.accept(IndexOutOfBoundsException.class, new IntSupplier() {
-- @Override
-- public int getAsInt() {
-- return Preconditions.checkFromIndexSize(fromIndex, size, length, null);
-- }
-- });
-- check.accept(ArrayIndexOutOfBoundsException.class, new IntSupplier() {
-- @Override
-- public int getAsInt() {
-- return Preconditions.checkFromIndexSize(fromIndex, size, length,
-- Preconditions.outOfBoundsExceptionFormatter(aioobeGenerator));
-- }
-- });
-- check.accept(StringIndexOutOfBoundsException.class, new IntSupplier () {
-- @Override
-- public int getAsInt() {
-- return Preconditions.checkFromIndexSize(fromIndex, size, length,
-- Preconditions.outOfBoundsExceptionFormatter(sioobeGenerator));
-- }
-- });
-- }
--
-- @Test
-- public void uniqueMessagesForCheckKinds() {
-- BiFunction<String, List<Integer>, IndexOutOfBoundsException> f =
-- Preconditions.outOfBoundsExceptionFormatter(ioobeGenerator);
--
-- List<String> messages = new ArrayList<>();
-- List<Integer> arg1 = Collections.unmodifiableList(Arrays.asList(new Integer[] { -1 }));
-- List<Integer> arg2 = Collections.unmodifiableList(Arrays.asList(new Integer[] { -1, 0 }));
-- List<Integer> arg3 = Collections.unmodifiableList(Arrays.asList(new Integer[] { -1, 0, 0 }));
-- List<Integer> arg4 = Collections.unmodifiableList(Arrays.asList(new Integer[] { -1, 0, 0, 0 }));
-- // Exact arguments
-- messages.add(f.apply("checkIndex", arg2).getMessage());
-- messages.add(f.apply("checkFromToIndex", arg3).getMessage());
-- messages.add(f.apply("checkFromIndexSize", arg3).getMessage());
-- // Unknown check kind
-- messages.add(f.apply("checkUnknown", arg3).getMessage());
-- // Known check kind with more arguments
-- messages.add(f.apply("checkIndex", arg3).getMessage());
-- messages.add(f.apply("checkFromToIndex", arg4).getMessage());
-- messages.add(f.apply("checkFromIndexSize", arg4).getMessage());
-- // Known check kind with fewer arguments
-- messages.add(f.apply("checkIndex", arg1).getMessage());
-- messages.add(f.apply("checkFromToIndex", arg2).getMessage());
-- messages.add(f.apply("checkFromIndexSize", arg2).getMessage());
-- // Null arguments
-- messages.add(f.apply(null, null).getMessage());
-- messages.add(f.apply("checkNullArguments", null).getMessage());
-- messages.add(f.apply(null, arg1).getMessage());
--
-- Set<String> distinct = new HashSet<>(messages);
-- assertEquals(messages.size(), distinct.size());
-- }
--}
---- openjdk.orig/test/src/sun/security/util/math/TestIntegerModuloP.java 2019-07-15 08:52:23.000000000 +0200
-+++ openjdk/jdk/test/sun/security/util/math/TestIntegerModuloP.java 2019-07-04 19:20:08.000000000 +0200
-@@ -37,7 +37,6 @@
- * @run main TestIntegerModuloP sun.security.util.math.intpoly.P521OrderField 66 10
- */
-
--import sun.security.util.BiFunction;
- import sun.security.util.math.*;
- import sun.security.util.math.intpoly.*;
-
-@@ -52,6 +51,9 @@
- // The test has a list of functions, and it selects randomly from that list
-
- // The function types
-+ interface BiFunction <T, U, V> {
-+ V apply(T t, U u);
-+ }
- interface ElemFunction extends BiFunction
- <MutableIntegerModuloP, IntegerModuloP, IntegerModuloP> { }
- interface ElemArrayFunction extends BiFunction
---- patches.orig/boot/ecj-stringswitch.patch
-+++ patches/boot/ecj-stringswitch.patch
-@@ -1800,64 +1800,6 @@
- "No MAC implementation for " + algo);
- }
- return kdf;
--diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/util/Preconditions.java openjdk-boot/jdk/src/share/classes/sun/security/util/Preconditions.java
----- openjdk-boot.orig/jdk/src/share/classes/sun/security/util/Preconditions.java 2019-07-17 04:20:04.496029417 +0100
--+++ openjdk-boot/jdk/src/share/classes/sun/security/util/Preconditions.java 2019-07-17 04:54:34.212283390 +0100
--@@ -169,31 +169,30 @@
-- }
--
-- int argSize = 0;
--- switch (checkKind) {
--- case "checkIndex":
--- argSize = 2;
--- break;
--- case "checkFromToIndex":
--- case "checkFromIndexSize":
--- argSize = 3;
--- break;
--- default:
--- }
---
--+ if ("checkIndex".equals(checkKind)) {
--+ argSize = 2;
--+ } else if ("checkFromToIndex".equals(checkKind) ||
--+ "checkFromIndexSize".equals(checkKind)) {
--+ argSize = 3;
--+ }
--+
-- // Switch to default if fewer or more arguments than required are supplied
--- switch ((args.size() != argSize) ? "" : checkKind) {
--- case "checkIndex":
--- return String.format("Index %d out-of-bounds for length %d",
--- args.get(0), args.get(1));
--- case "checkFromToIndex":
--- return String.format("Range [%d, %d) out-of-bounds for length %d",
--- args.get(0), args.get(1), args.get(2));
--- case "checkFromIndexSize":
--- return String.format("Range [%d, %<d + %d) out-of-bounds for length %d",
--- args.get(0), args.get(1), args.get(2));
--- default:
--- return String.format("Range check failed: %s %s", checkKind, args);
--- }
--+ if (args.size() != argSize) {
--+ return String.format("Range check failed: %s %s", checkKind, args);
--+ }
--+
--+ if ("checkIndex".equals(checkKind)) {
--+ return String.format("Index %d out-of-bounds for length %d",
--+ args.get(0), args.get(1));
--+ } else if ("checkFromToIndex".equals(checkKind)) {
--+ return String.format("Range [%d, %d) out-of-bounds for length %d",
--+ args.get(0), args.get(1), args.get(2));
--+ } else if ("checkFromIndexSize".equals(checkKind)) {
--+ return String.format("Range [%d, %<d + %d) out-of-bounds for length %d",
--+ args.get(0), args.get(1), args.get(2));
--+ } else {
--+ return String.format("Range check failed: %s %s", checkKind, args);
--+ }
-- }
--
-- /**
- diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/util/ResourceBundle.java openjdk-boot/jdk/src/share/classes/java/util/ResourceBundle.java
- --- openjdk-boot.orig/jdk/src/share/classes/java/util/ResourceBundle.java 2019-11-13 21:46:22.926858210 +0000
- +++ openjdk-boot/jdk/src/share/classes/java/util/ResourceBundle.java 2019-11-13 21:48:58.096470164 +0000