mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-24 10:19:40 +01:00
Compare commits
81 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55ac9d53e3 | ||
|
|
66f71949b3 | ||
|
|
8e7e3f76a7 | ||
|
|
62f8abdea8 | ||
|
|
2fc6a7d38b | ||
|
|
004cba3473 | ||
|
|
a89da55450 | ||
|
|
04544a5f96 | ||
|
|
8dda13944a | ||
|
|
21865fd478 | ||
|
|
a4b4baeafb | ||
|
|
2f68e2a4b6 | ||
|
|
55a8176c6d | ||
|
|
7f66caa16e | ||
|
|
08aeb1b30f | ||
|
|
b4a19f1154 | ||
|
|
2b2b48c6af | ||
|
|
38cc9f2592 | ||
|
|
94d95ad55c | ||
|
|
5b49bd750a | ||
|
|
6dc194e089 | ||
|
|
1f9120c283 | ||
|
|
0301983b6a | ||
|
|
73d3da2f28 | ||
|
|
321a4a3f83 | ||
|
|
8490a25a0f | ||
|
|
9fbb44cae7 | ||
|
|
d10e161b72 | ||
|
|
c9670beb62 | ||
|
|
a0f8c27bdf | ||
|
|
c39e4a4fcd | ||
|
|
51993ea193 | ||
|
|
30885a997e | ||
|
|
929d5352c4 | ||
|
|
5332227582 | ||
|
|
4fb8ed7e15 | ||
|
|
b477e4bb20 | ||
|
|
91d6a17b71 | ||
|
|
99653a7246 | ||
|
|
2d4764e6a5 | ||
|
|
1a5d095ffc | ||
|
|
6e54137bec | ||
|
|
9ae2d19d82 | ||
|
|
5ed37e2ade | ||
|
|
7f2f3dd782 | ||
|
|
c0f008e54d | ||
|
|
83521a04b4 | ||
|
|
a1c716f556 | ||
|
|
e5085c2252 | ||
|
|
bf7b0d3d01 | ||
|
|
6dc33960aa | ||
|
|
afe1cbc136 | ||
|
|
17e5d307b3 | ||
|
|
a3f12a2a6f | ||
|
|
f42feb1eab | ||
|
|
4f4f3c9e41 | ||
|
|
d37946eef4 | ||
|
|
e3c584a7e3 | ||
|
|
cd2dbaa88e | ||
|
|
a076696bc6 | ||
|
|
8b2a1daac3 | ||
|
|
56420d17c1 | ||
|
|
4f69815a42 | ||
|
|
9de73a31e8 | ||
|
|
5509467613 | ||
|
|
6321222001 | ||
|
|
a74ccad7f8 | ||
|
|
6eb83f426c | ||
|
|
58f4edd277 | ||
|
|
9bbb5185f4 | ||
|
|
b4cc3ca9b9 | ||
|
|
fb428d58b1 | ||
|
|
5e3573d422 | ||
|
|
39969abfad | ||
|
|
39c4654438 | ||
|
|
10479dccd9 | ||
|
|
9a81ca792e | ||
|
|
626ab933a9 | ||
|
|
6fb9661f26 | ||
|
|
8b735d389b | ||
|
|
e4c34ade82 |
@@ -11,8 +11,7 @@ can be found on the [releases page](https://github.com/JetBrains/JetBrainsRuntim
|
||||
|
||||
| IDE Version | Latest JBR | Date Released |
|
||||
| --- | --- | --- |
|
||||
| 2022.1 | [17_0_2-b315.1](https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr17_0_2b315.1) | 09-Feb-2022 |
|
||||
| 2021.3 | [17_0_1-b164.8](https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr17_0_1b164.8) | 15-Nov-2021 |
|
||||
| 2022.2 | [17.0.3-b469.12](https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr17.0.3b469.12) | 14-Jun-2022 |
|
||||
|
||||
## Contents
|
||||
- [Welcome to JetBrains Runtime](#jetbrains-runtime)
|
||||
|
||||
@@ -1,7 +1,55 @@
|
||||
FROM i386/ubuntu:xenial
|
||||
# NOTE: This Dockerfile is meant to be used from the mkdocker_x86.sh script.
|
||||
|
||||
RUN linux32 apt-get update && apt-get install -y --no-install-recommends apt-utils
|
||||
COPY jbrsdk-11.0.5-b1 /jbrsdk-11.0.5-b1
|
||||
RUN linux32 apt-get -y install file build-essential zip unzip curl libx11-dev libxext-dev \
|
||||
libxrender-dev libxrandr-dev libxtst-dev libxt-dev libcups2-dev libasound2-data \
|
||||
libpng12-0 libasound2 libfreetype6 libfontconfig1-dev libasound2-dev autoconf
|
||||
# Pull a concrete version of Linux that does NOT receive updates after it's
|
||||
# been created. This is so that the image is as stable as possible to make
|
||||
# image creation reproducible.
|
||||
# NB: this also means there may be no security-related fixes there, need to
|
||||
# move the version to the next manually.
|
||||
#FROM i386/ubuntu:xenial
|
||||
#FROM i386/ubuntu:bionic
|
||||
FROM i386/ubuntu:focal
|
||||
|
||||
RUN linux32 \
|
||||
apt-get update && apt-get install -y --no-install-recommends apt-utils
|
||||
RUN export DEBIAN_FRONTEND=noninteractive \
|
||||
export DEBCONF_NONINTERACTIVE_SEEN=true && \
|
||||
echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections; \
|
||||
echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections; \
|
||||
linux32 \
|
||||
apt-get -y install \
|
||||
autoconf \
|
||||
build-essential \
|
||||
curl \
|
||||
file \
|
||||
git \
|
||||
libx11-dev \
|
||||
libxext-dev \
|
||||
libxrender-dev \
|
||||
libxrandr-dev \
|
||||
libxtst-dev \
|
||||
libxt-dev \
|
||||
libcups2-dev \
|
||||
libasound2-data \
|
||||
# libpng12-0 \
|
||||
libasound2 \
|
||||
libfreetype6 \
|
||||
libfontconfig1-dev \
|
||||
libasound2-dev \
|
||||
rsync \
|
||||
unzip \
|
||||
zip
|
||||
RUN linux32 \
|
||||
apt-get -y install \
|
||||
g++-10 \
|
||||
gcc-10 && \
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 && \
|
||||
apt-get clean -qy && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Set up boot JDK for building
|
||||
COPY boot_jdk_x86.tar.gz /jdk17/
|
||||
RUN cd /jdk17 && tar --strip-components=1 -xzf boot_jdk_x86.tar.gz && rm /jdk17/boot_jdk_x86.tar.gz
|
||||
ENV BOOT_JDK=/jdk17
|
||||
|
||||
RUN git config --global user.email "teamcity@jetbrains.com" && \
|
||||
git config --global user.name "builduser"
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# This script creates a Docker image suitable for building AArch64 variant
|
||||
# of the JetBrains Runtime version 17.
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# This script creates a Docker image suitable for building musl AArch64 variant
|
||||
# of the JetBrains Runtime version 17.
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# This script creates a Docker image suitable for building musl-x64 variant
|
||||
# of the JetBrains Runtime version 17.
|
||||
|
||||
26
jb/project/docker/mkdocker_x86.sh
Executable file
26
jb/project/docker/mkdocker_x86.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
# This script creates a Docker image suitable for building x86 variant
|
||||
# of the JetBrains Runtime version 17.
|
||||
|
||||
BOOT_JDK_REMOTE_FILE=zulu17.34.19-ca-jdk17.0.3-linux_i686.tar.gz
|
||||
BOOT_JDK_SHA=1c35c374ba0001e675d6e80819d5be900c4e141636d5e484992a8c550be14481
|
||||
BOOT_JDK_LOCAL_FILE=boot_jdk_x86.tar.gz
|
||||
|
||||
if [ ! -f $BOOT_JDK_LOCAL_FILE ]; then
|
||||
# Obtain "boot JDK" from outside of the container.
|
||||
wget -nc https://cdn.azul.com/zulu/bin/${BOOT_JDK_REMOTE_FILE} -O $BOOT_JDK_LOCAL_FILE
|
||||
else
|
||||
echo "boot JDK \"$BOOT_JDK_LOCAL_FILE\" present, skipping download"
|
||||
fi
|
||||
|
||||
# Verify that what we've downloaded can be trusted.
|
||||
sha256sum -c - <<EOF
|
||||
$BOOT_JDK_SHA *$BOOT_JDK_LOCAL_FILE
|
||||
EOF
|
||||
|
||||
docker build -t jetbrains/runtime:jbr17env_x86 -f Dockerfile.x86 .
|
||||
|
||||
# NB: the resulting container can (and should) be used without the network
|
||||
# connection (--network none) during build in order to reduce the chance
|
||||
# of build contamination.
|
||||
@@ -1,4 +1,6 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# $1 - Boot JDK
|
||||
# $2 - JBR part of API version
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
function do_maketest() {
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
function check_bundle_type_maketest() {
|
||||
# check whether last char is 't', if so remove it
|
||||
if [ "${bundle_type: -1}" == "t" ]; then
|
||||
echo ${bundle_type%?}
|
||||
return 1
|
||||
bundle_type="${bundle_type%?}"
|
||||
do_maketest=1
|
||||
else
|
||||
echo ${bundle_type}
|
||||
return 0
|
||||
do_maketest=0
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -16,20 +19,23 @@ function getVersionProp() {
|
||||
|
||||
while getopts ":i?" o; do
|
||||
case "${o}" in
|
||||
i)
|
||||
i="incremental build"
|
||||
INC_BUILD=1
|
||||
;;
|
||||
i) INC_BUILD=1 ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
if [[ $# -lt 2 ]]; then
|
||||
echo "Required at least two arguments: build_number bundle_type"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
build_number=$1
|
||||
bundle_type=$2
|
||||
architecture=$3 # aarch64 or x64
|
||||
# shellcheck disable=SC2034
|
||||
architecture=${3:-x64} # aarch64 or x64
|
||||
|
||||
check_bundle_type_maketest
|
||||
|
||||
bundle_type=$(do_maketest)
|
||||
do_maketest=$?
|
||||
tag_prefix="jbr-"
|
||||
OPENJDK_TAG=$(git log --simplify-by-decoration --decorate=short --pretty=short | grep "$tag_prefix" | cut -d "(" -f2 | cut -d ")" -f1 | awk '{print $2}' | sort -t "-" -k 2 -g | tail -n 1 | tr -d ",")
|
||||
VERSION_FEATURE=$(getVersionProp "DEFAULT_VERSION_FEATURE")
|
||||
@@ -49,6 +55,11 @@ do_reset_changes=0
|
||||
do_reset_dcevm=0
|
||||
HEAD_REVISION=0
|
||||
|
||||
STATIC_CONF_ARGS=""
|
||||
common_conf_props_file="jb/project/tools/common/static_conf_args.txt"
|
||||
if [[ -f "$common_conf_props_file" ]]; then
|
||||
STATIC_CONF_ARGS=$(<$common_conf_props_file)
|
||||
fi
|
||||
OS_NAME=$(uname -s)
|
||||
# Enable reproducible builds
|
||||
TZ=UTC
|
||||
@@ -126,7 +137,7 @@ function update_jsdk_mods() {
|
||||
# re-create java.base.jmod with updated hashes
|
||||
tmp=.java.base.$$.tmp
|
||||
mkdir "$tmp" || exit $?
|
||||
hash_modules=$("$JSDK"/bin/jmod describe "$__orig_jsdk_mods"/java.base.jmod | grep hashes | awk '{print $2}' | tr '\n' '|' | sed s/\|$//) || exit $?
|
||||
hash_modules=$("$__jsdk"/bin/jmod describe "$__orig_jsdk_mods"/java.base.jmod | grep hashes | awk '{print $2}' | tr '\n' '|' | sed s/\|$//) || exit $?
|
||||
"$__jsdk"/bin/jmod extract --dir "$tmp" "$__orig_jsdk_mods"/java.base.jmod || exit $?
|
||||
rm "$__updated_jsdk_mods"/java.base.jmod || exit $? # temp exclude from path
|
||||
"$__jsdk"/bin/jmod \
|
||||
|
||||
1
jb/project/tools/common/static_conf_args.txt
Normal file
1
jb/project/tools/common/static_conf_args.txt
Normal file
@@ -0,0 +1 @@
|
||||
--with-vendor-vm-bug-url=https://youtrack.jetbrains.com/issues/JBR
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
@@ -32,6 +35,7 @@ function do_configure {
|
||||
--with-version-opt=b"$build_number" \
|
||||
--with-boot-jdk="$BOOT_JDK" \
|
||||
--enable-cds=yes \
|
||||
$STATIC_CONF_ARGS \
|
||||
$REPRODUCIBLE_BUILD_OPTS \
|
||||
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|
||||
|| do_exit $?
|
||||
@@ -53,40 +57,44 @@ function create_image_bundle {
|
||||
__modules=$4
|
||||
|
||||
libc_type_suffix=''
|
||||
fastdebug_infix=''
|
||||
|
||||
if is_musl; then libc_type_suffix='musl-' ; fi
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-linux-${libc_type_suffix}aarch64-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-${libc_type_suffix}aarch64-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
|
||||
echo Running jlink....
|
||||
[ -d "$IMAGES_DIR"/"$__arch_name" ] && rm -rf "${IMAGES_DIR:?}"/"$__arch_name"
|
||||
[ -d "$IMAGES_DIR"/"$__root_dir" ] && rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
|
||||
$JSDK/bin/jlink \
|
||||
--module-path "$__modules_path" --no-man-pages --compress=2 \
|
||||
--add-modules "$__modules" --output "$IMAGES_DIR"/"$__arch_name"
|
||||
--add-modules "$__modules" --output "$IMAGES_DIR"/"$__root_dir"
|
||||
|
||||
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> "$IMAGES_DIR"/"$__arch_name"/release
|
||||
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> "$IMAGES_DIR"/"$__root_dir"/release
|
||||
if [ "$__arch_name" == "$JBRSDK_BUNDLE" ]; then
|
||||
sed 's/JBR/JBRSDK/g' "$IMAGES_DIR"/"$__arch_name"/release > release
|
||||
mv release "$IMAGES_DIR"/"$__arch_name"/release
|
||||
copy_jmods "$__modules" "$__modules_path" "$IMAGES_DIR"/"$__arch_name"/jmods
|
||||
sed 's/JBR/JBRSDK/g' "$IMAGES_DIR"/"$__root_dir"/release > release
|
||||
mv release "$IMAGES_DIR"/"$__root_dir"/release
|
||||
cp $IMAGES_DIR/jdk/lib/src.zip "$IMAGES_DIR"/"$__root_dir"/lib
|
||||
copy_jmods "$__modules" "$__modules_path" "$IMAGES_DIR"/"$__root_dir"/jmods
|
||||
zip_native_debug_symbols $IMAGES_DIR/jdk "${JBR}_diz"
|
||||
fi
|
||||
|
||||
# jmod does not preserve file permissions (JDK-8173610)
|
||||
[ -f "$IMAGES_DIR"/"$__arch_name"/lib/jcef_helper ] && chmod a+x "$IMAGES_DIR"/"$__arch_name"/lib/jcef_helper
|
||||
[ -f "$IMAGES_DIR"/"$__root_dir"/lib/jcef_helper ] && chmod a+x "$IMAGES_DIR"/"$__root_dir"/lib/jcef_helper
|
||||
|
||||
echo Creating "$JBR".tar.gz ...
|
||||
|
||||
(cd "$IMAGES_DIR" &&
|
||||
find "$__arch_name" -print0 | LC_ALL=C sort -z | \
|
||||
find "$__root_dir" -print0 | LC_ALL=C sort -z | \
|
||||
tar $REPRODUCIBLE_TAR_OPTS \
|
||||
--no-recursion --null -T - -cf "$JBR".tar) || do_exit $?
|
||||
mv "$IMAGES_DIR"/"$JBR".tar ./"$JBR".tar
|
||||
[ -f "$JBR".tar.gz ] && rm "$JBR.tar.gz"
|
||||
touch -c -d "@$SOURCE_DATE_EPOCH" "$JBR".tar
|
||||
gzip "$JBR".tar || do_exit $?
|
||||
rm -rf "${IMAGES_DIR:?}"/"$__arch_name"
|
||||
rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
|
||||
}
|
||||
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=release"
|
||||
@@ -107,7 +115,7 @@ case "$bundle_type" in
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$INC_BUILD" ]; then
|
||||
if [ -z "${INC_BUILD:-}" ]; then
|
||||
do_configure || do_exit $?
|
||||
make clean CONF=$RELEASE_NAME || do_exit $?
|
||||
fi
|
||||
@@ -127,6 +135,8 @@ if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
|
||||
cp $JCEF_PATH/jmods/* $JSDK_MODS_DIR # $JSDK/jmods is not changed
|
||||
|
||||
jbr_name_postfix="_${bundle_type}"
|
||||
else
|
||||
jbr_name_postfix=""
|
||||
fi
|
||||
|
||||
# create runtime image bundle
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
@@ -32,6 +35,7 @@ function do_configure {
|
||||
--with-version-opt=b"$build_number" \
|
||||
--with-boot-jdk="$BOOT_JDK" \
|
||||
--enable-cds=yes \
|
||||
$STATIC_CONF_ARGS \
|
||||
$REPRODUCIBLE_BUILD_OPTS \
|
||||
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|
||||
|| do_exit $?
|
||||
@@ -53,40 +57,43 @@ function create_image_bundle {
|
||||
__modules=$4
|
||||
|
||||
libc_type_suffix=''
|
||||
fastdebug_infix=''
|
||||
|
||||
if is_musl; then libc_type_suffix='musl-' ; fi
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-linux-${libc_type_suffix}x64-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-${libc_type_suffix}x64-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
echo Running jlink....
|
||||
[ -d "$IMAGES_DIR"/"$__arch_name" ] && rm -rf "${IMAGES_DIR:?}"/"$__arch_name"
|
||||
[ -d "$IMAGES_DIR"/"$__root_dir" ] && rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
|
||||
$JSDK/bin/jlink \
|
||||
--module-path "$__modules_path" --no-man-pages --compress=2 \
|
||||
--add-modules "$__modules" --output "$IMAGES_DIR"/"$__arch_name"
|
||||
--add-modules "$__modules" --output "$IMAGES_DIR"/"$__root_dir"
|
||||
|
||||
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> "$IMAGES_DIR"/"$__arch_name"/release
|
||||
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> "$IMAGES_DIR"/"$__root_dir"/release
|
||||
if [ "$__arch_name" == "$JBRSDK_BUNDLE" ]; then
|
||||
sed 's/JBR/JBRSDK/g' "$IMAGES_DIR"/"$__arch_name"/release > release
|
||||
mv release "$IMAGES_DIR"/"$__arch_name"/release
|
||||
copy_jmods "$__modules" "$__modules_path" "$IMAGES_DIR"/"$__arch_name"/jmods
|
||||
sed 's/JBR/JBRSDK/g' "$IMAGES_DIR"/"$__root_dir"/release > release
|
||||
mv release "$IMAGES_DIR"/"$__root_dir"/release
|
||||
cp $IMAGES_DIR/jdk/lib/src.zip "$IMAGES_DIR"/"$__root_dir"/lib
|
||||
copy_jmods "$__modules" "$__modules_path" "$IMAGES_DIR"/"$__root_dir"/jmods
|
||||
zip_native_debug_symbols $IMAGES_DIR/jdk "${JBR}_diz"
|
||||
fi
|
||||
|
||||
# jmod does not preserve file permissions (JDK-8173610)
|
||||
[ -f "$IMAGES_DIR"/"$__arch_name"/lib/jcef_helper ] && chmod a+x "$IMAGES_DIR"/"$__arch_name"/lib/jcef_helper
|
||||
[ -f "$IMAGES_DIR"/"$__root_dir"/lib/jcef_helper ] && chmod a+x "$IMAGES_DIR"/"$__root_dir"/lib/jcef_helper
|
||||
|
||||
echo Creating "$JBR".tar.gz ...
|
||||
|
||||
(cd "$IMAGES_DIR" &&
|
||||
find "$__arch_name" -print0 | LC_ALL=C sort -z | \
|
||||
find "$__root_dir" -print0 | LC_ALL=C sort -z | \
|
||||
tar $REPRODUCIBLE_TAR_OPTS \
|
||||
--no-recursion --null -T - -cf "$JBR".tar) || do_exit $?
|
||||
mv "$IMAGES_DIR"/"$JBR".tar ./"$JBR".tar
|
||||
[ -f "$JBR".tar.gz ] && rm "$JBR.tar.gz"
|
||||
touch -c -d "@$SOURCE_DATE_EPOCH" "$JBR".tar
|
||||
gzip "$JBR".tar || do_exit $?
|
||||
rm -rf "${IMAGES_DIR:?}"/"$__arch_name"
|
||||
rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
|
||||
}
|
||||
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=release"
|
||||
@@ -107,7 +114,7 @@ case "$bundle_type" in
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$INC_BUILD" ]; then
|
||||
if [ -z "${INC_BUILD:-}" ]; then
|
||||
do_configure || do_exit $?
|
||||
make clean CONF=$RELEASE_NAME || do_exit $?
|
||||
fi
|
||||
@@ -127,6 +134,8 @@ if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
|
||||
cp $JCEF_PATH/jmods/* $JSDK_MODS_DIR # $JSDK/jmods is not changed
|
||||
|
||||
jbr_name_postfix="_${bundle_type}"
|
||||
else
|
||||
jbr_name_postfix=""
|
||||
fi
|
||||
|
||||
# create runtime image bundle
|
||||
|
||||
@@ -1,80 +1,143 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# JBSDK_VERSION - specifies the current version of OpenJDK e.g. 11_0_6
|
||||
# JDK_BUILD_NUMBER - specifies the number of OpenJDK build or the value of --with-version-build argument to configure
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to be built;possible values:
|
||||
# <empty> or nomod - the release bundles without any additional modules (jcef)
|
||||
# jcef - the release bundles with jcef
|
||||
# fd - the fastdebug bundles which also include the jcef module
|
||||
#
|
||||
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
#
|
||||
# $ ./java --version
|
||||
# openjdk 11.0.6 2020-01-14
|
||||
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
|
||||
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
|
||||
#
|
||||
|
||||
JBSDK_VERSION=$1
|
||||
JDK_BUILD_NUMBER=$2
|
||||
build_number=$3
|
||||
|
||||
JBSDK_VERSION_WITH_DOTS=$(echo $JBSDK_VERSION | sed 's/_/\./g')
|
||||
|
||||
source jb/project/tools/common/scripts/common.sh
|
||||
|
||||
JBRSDK_BASE_NAME=jbrsdk-${JBSDK_VERSION}
|
||||
function do_configure {
|
||||
linux32 bash configure \
|
||||
$WITH_DEBUG_LEVEL \
|
||||
--with-vendor-name="$VENDOR_NAME" \
|
||||
--with-vendor-version-string="$VENDOR_VERSION_STRING" \
|
||||
--with-jvm-features=shenandoahgc \
|
||||
--with-version-pre= \
|
||||
--with-version-build="$JDK_BUILD_NUMBER" \
|
||||
--with-version-opt=b"$build_number" \
|
||||
--with-boot-jdk="$BOOT_JDK" \
|
||||
$STATIC_CONF_ARGS \
|
||||
--enable-cds=yes \
|
||||
$REPRODUCIBLE_BUILD_OPTS \
|
||||
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|
||||
|| do_exit $?
|
||||
}
|
||||
|
||||
[ -z "$bundle_type" ] && (git apply -p0 < jb/project/tools/patches/exclude_jcef_module.patch || exit $?)
|
||||
function is_musl {
|
||||
libc=$(ldd /bin/ls | grep 'musl' | head -1 | cut -d ' ' -f1)
|
||||
if [ -z $libc ]; then
|
||||
# This is not Musl, return 1 == false
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
linux32 bash configure \
|
||||
--with-debug-level=release \
|
||||
--with-vendor-name="${VENDOR_NAME}" \
|
||||
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
|
||||
--with-version-pre= \
|
||||
--with-version-build=$JDK_BUILD_NUMBER \
|
||||
--with-version-opt=b${build_number} \
|
||||
--with-boot-jdk=${BOOT_JDK} \
|
||||
--enable-cds=yes || exit $?
|
||||
make clean CONF=linux-x86-server-release || exit $?
|
||||
make images CONF=linux-x86-server-release test-image || exit $?
|
||||
function create_image_bundle {
|
||||
__bundle_name=$1
|
||||
__arch_name=$2
|
||||
__modules_path=$3
|
||||
__modules=$4
|
||||
|
||||
JBSDK=${JBRSDK_BASE_NAME}-linux-x86-b${build_number}
|
||||
BASE_DIR=build/linux-x86-server-release/images
|
||||
JSDK=${BASE_DIR}/jdk
|
||||
libc_type_suffix=''
|
||||
fastdebug_infix=''
|
||||
|
||||
if is_musl; then libc_type_suffix='musl-' ; fi
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-linux-${libc_type_suffix}x86-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-${libc_type_suffix}x86-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
echo Running jlink....
|
||||
[ -d "$IMAGES_DIR"/"$__root_dir" ] && rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
|
||||
$JSDK/bin/jlink \
|
||||
--module-path "$__modules_path" --no-man-pages --compress=2 \
|
||||
--add-modules "$__modules" --output "$IMAGES_DIR"/"$__root_dir"
|
||||
|
||||
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> "$IMAGES_DIR"/"$__root_dir"/release
|
||||
if [ "$__arch_name" == "$JBRSDK_BUNDLE" ]; then
|
||||
sed 's/JBR/JBRSDK/g' "$IMAGES_DIR"/"$__root_dir"/release > release
|
||||
mv release "$IMAGES_DIR"/"$__root_dir"/release
|
||||
cp $IMAGES_DIR/jdk/lib/src.zip "$IMAGES_DIR"/"$__root_dir"/lib
|
||||
copy_jmods "$__modules" "$__modules_path" "$IMAGES_DIR"/"$__root_dir"/jmods
|
||||
zip_native_debug_symbols $IMAGES_DIR/jdk "${JBR}_diz"
|
||||
fi
|
||||
|
||||
# jmod does not preserve file permissions (JDK-8173610)
|
||||
[ -f "$IMAGES_DIR"/"$__root_dir"/lib/jcef_helper ] && chmod a+x "$IMAGES_DIR"/"$__root_dir"/lib/jcef_helper
|
||||
|
||||
echo Creating "$JBR".tar.gz ...
|
||||
|
||||
(cd "$IMAGES_DIR" &&
|
||||
find "$__root_dir" -print0 | LC_ALL=C sort -z | \
|
||||
tar $REPRODUCIBLE_TAR_OPTS \
|
||||
--no-recursion --null -T - -cf "$JBR".tar) || do_exit $?
|
||||
mv "$IMAGES_DIR"/"$JBR".tar ./"$JBR".tar
|
||||
[ -f "$JBR".tar.gz ] && rm "$JBR.tar.gz"
|
||||
touch -c -d "@$SOURCE_DATE_EPOCH" "$JBR".tar
|
||||
gzip "$JBR".tar || do_exit $?
|
||||
rm -rf "${IMAGES_DIR:?}"/"$__root_dir"
|
||||
}
|
||||
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=release"
|
||||
RELEASE_NAME=linux-x86-server-release
|
||||
|
||||
case "$bundle_type" in
|
||||
"jcef")
|
||||
echo "not implemented" && do_exit 1
|
||||
;;
|
||||
"nomod" | "")
|
||||
bundle_type=""
|
||||
;;
|
||||
"fd")
|
||||
do_reset_changes=1
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=fastdebug"
|
||||
RELEASE_NAME=linux-x86-server-fastdebug
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "${INC_BUILD:-}" ]; then
|
||||
do_configure || do_exit $?
|
||||
make clean CONF=$RELEASE_NAME || do_exit $?
|
||||
fi
|
||||
make images CONF=$RELEASE_NAME || do_exit $?
|
||||
|
||||
IMAGES_DIR=build/$RELEASE_NAME/images
|
||||
JSDK=$IMAGES_DIR/jdk
|
||||
JSDK_MODS_DIR=$IMAGES_DIR/jmods
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
|
||||
echo Fixing permissions
|
||||
chmod -R a+r $JSDK
|
||||
|
||||
rm -rf $BASE_DIR/$JBRSDK_BUNDLE
|
||||
cp -r $JSDK $BASE_DIR/$JBRSDK_BUNDLE || exit $?
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
|
||||
jbr_name_postfix="_${bundle_type}"
|
||||
else
|
||||
jbr_name_postfix=""
|
||||
fi
|
||||
|
||||
echo Creating $JBSDK.tar.gz ...
|
||||
sed 's/JBR/JBRSDK/g' ${BASE_DIR}/${JBRSDK_BUNDLE}/release > release
|
||||
mv release ${BASE_DIR}/${JBRSDK_BUNDLE}/release
|
||||
# create runtime image bundle
|
||||
modules=$(grep -v "jdk.internal.vm" jb/project/tools/common/modules.list | xargs | sed s/" "//g) || do_exit $?
|
||||
create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" || do_exit $?
|
||||
|
||||
tar -pcf $JBSDK.tar --exclude=*.debuginfo --exclude=demo --exclude=sample --exclude=man -C $BASE_DIR ${JBRSDK_BUNDLE} || exit $?
|
||||
gzip $JBSDK.tar || exit $?
|
||||
# create sdk image bundle
|
||||
modules=$(cat $JSDK/release | grep MODULES | sed s/MODULES=//g | sed s/' '/','/g | sed s/\"//g | sed s/\\n//g) || do_exit $?
|
||||
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" $JBRSDK_BUNDLE $JSDK_MODS_DIR "$modules" || do_exit $?
|
||||
|
||||
JBR_BUNDLE=jbr
|
||||
JBR_BASE_NAME=jbr-$JBSDK_VERSION
|
||||
rm -rf $BASE_DIR/$JBR_BUNDLE
|
||||
if [ $do_maketest -eq 1 ]; then
|
||||
JBRSDK_TEST=${JBRSDK_BUNDLE}-${JBSDK_VERSION}-linux-${libc_type_suffix}test-x86-b${build_number}
|
||||
echo Creating "$JBRSDK_TEST" ...
|
||||
[ $do_reset_changes -eq 1 ] && git checkout HEAD jb/project/tools/common/modules.list src/java.desktop/share/classes/module-info.java
|
||||
make test-image CONF=$RELEASE_NAME || do_exit $?
|
||||
tar -pcf "$JBRSDK_TEST".tar -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?
|
||||
[ -f "$JBRSDK_TEST.tar.gz" ] && rm "$JBRSDK_TEST.tar.gz"
|
||||
gzip "$JBRSDK_TEST".tar || do_exit $?
|
||||
fi
|
||||
|
||||
JBR=$JBR_BASE_NAME-linux-x86-b$build_number
|
||||
grep -v javafx jb/project/tools/common/modules.list | grep -v "jdk.internal.vm\|jdk.aot\|jcef" > modules.list.x86
|
||||
echo Running jlink....
|
||||
${JSDK}/bin/jlink \
|
||||
--module-path ${JSDK}/jmods --no-man-pages --compress=2 \
|
||||
--add-modules $(xargs < modules.list.x86 | sed s/" "//g | sed s/,$//g) --output ${BASE_DIR}/${JBR_BUNDLE} || exit $?
|
||||
|
||||
echo Modifying release info ...
|
||||
grep -v \"^JAVA_VERSION\" ${JSDK}/release | grep -v \"^MODULES\" >> ${BASE_DIR}/${JBR_BUNDLE}/release
|
||||
|
||||
echo Creating $JBR.tar.gz ...
|
||||
tar -pcf $JBR.tar -C $BASE_DIR $JBR_BUNDLE || exit $?
|
||||
gzip $JBR.tar || exit $?
|
||||
|
||||
JBRSDK_TEST=$JBRSDK_BASE_NAME-linux-test-x86-b$build_number
|
||||
echo Creating $JBRSDK_TEST.tar.gz ...
|
||||
tar -pcf $JBRSDK_TEST.tar -C $BASE_DIR --exclude='test/jdk/demos' --exclude='test/hotspot/gtest' test || exit $?
|
||||
gzip $JBRSDK_TEST.tar || exit $?
|
||||
do_exit 0
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
@@ -22,7 +25,6 @@
|
||||
source jb/project/tools/common/scripts/common.sh
|
||||
|
||||
JCEF_PATH=${JCEF_PATH:=./jcef_mac}
|
||||
architecture=${architecture:=x64}
|
||||
BOOT_JDK=${BOOT_JDK:=$(/usr/libexec/java_home -v 16)}
|
||||
|
||||
function do_configure {
|
||||
@@ -44,6 +46,7 @@ function do_configure {
|
||||
--with-extra-cflags="-F$(pwd)/Frameworks" \
|
||||
--with-extra-cxxflags="-F$(pwd)/Frameworks" \
|
||||
--with-extra-ldflags="-F$(pwd)/Frameworks" \
|
||||
$STATIC_CONF_ARGS \
|
||||
$REPRODUCIBLE_BUILD_OPTS \
|
||||
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|
||||
|| do_exit $?
|
||||
@@ -61,6 +64,7 @@ function do_configure {
|
||||
--with-boot-jdk="$BOOT_JDK" \
|
||||
--with-macosx-version-max="${MACOSX_VERSION_MAX:="10.12.00"}" \
|
||||
--enable-cds=yes \
|
||||
$STATIC_CONF_ARGS \
|
||||
$REPRODUCIBLE_BUILD_OPTS \
|
||||
$WITH_ZIPPED_NATIVE_DEBUG_SYMBOLS \
|
||||
|| do_exit $?
|
||||
@@ -73,13 +77,16 @@ function create_image_bundle {
|
||||
__modules_path=$3
|
||||
__modules=$4
|
||||
|
||||
fastdebug_infix=''
|
||||
|
||||
tmp=.bundle.$$.tmp
|
||||
mkdir "$tmp" || do_exit $?
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-osx-${architecture}-${fastdebug_infix}b${build_number}
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-osx-${architecture}-${fastdebug_infix:-}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-${architecture}-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
JRE_CONTENTS=$tmp/$__arch_name/Contents
|
||||
JRE_CONTENTS=$tmp/$__root_dir/Contents
|
||||
mkdir -p "$JRE_CONTENTS" || do_exit $?
|
||||
|
||||
echo Running jlink...
|
||||
@@ -103,10 +110,10 @@ function create_image_bundle {
|
||||
|
||||
echo Creating "$JBR".tar.gz ...
|
||||
# Normalize timestamp
|
||||
find "$tmp"/"$__arch_name" -print0 | xargs -0 touch -c -h -t "$TOUCH_TIME"
|
||||
find "$tmp"/"$__root_dir" -print0 | xargs -0 touch -c -h -t "$TOUCH_TIME"
|
||||
|
||||
(cd "$tmp" &&
|
||||
find "$__arch_name" -print0 | LC_ALL=C sort -z | \
|
||||
find "$__root_dir" -print0 | LC_ALL=C sort -z | \
|
||||
COPYFILE_DISABLE=1 tar $REPRODUCIBLE_TAR_OPTS --no-recursion --null -T - \
|
||||
-czf "$JBR".tar.gz --exclude='*.dSYM' --exclude='man') || do_exit $?
|
||||
mv "$tmp"/"$JBR".tar.gz "$JBR".tar.gz
|
||||
@@ -136,7 +143,7 @@ case "$bundle_type" in
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$INC_BUILD" ]; then
|
||||
if [ -z "${INC_BUILD:-}" ]; then
|
||||
do_configure || do_exit $?
|
||||
make clean CONF=$RELEASE_NAME || do_exit $?
|
||||
fi
|
||||
@@ -154,6 +161,8 @@ if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
|
||||
cp $JCEF_PATH/jmods/* $JSDK_MODS_DIR # $JSDK/jmods is not changed
|
||||
|
||||
jbr_name_postfix="_${bundle_type}"
|
||||
else
|
||||
jbr_name_postfix=""
|
||||
fi
|
||||
|
||||
# create runtime image bundle
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
APP_DIRECTORY=$1
|
||||
APPL_USER=$2
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
APPLICATION_PATH=$1
|
||||
APP_NAME=$2
|
||||
@@ -97,8 +100,11 @@ BUILD_NAME=$(echo $APPLICATION_PATH | awk -F"/" '{ print $2 }')
|
||||
|
||||
log "Creating $APP_NAME.pkg..."
|
||||
rm -rf "$APP_NAME.pkg"
|
||||
pkgbuild --identifier $BUNDLE_ID --sign "$JB_INSTALLER_CERT" --root $APPLICATION_PATH \
|
||||
--install-location /Library/Java/JavaVirtualMachines/${BUILD_NAME} ${APP_NAME}.pkg
|
||||
|
||||
mkdir -p unsigned
|
||||
pkgbuild --identifier $BUNDLE_ID --root $APPLICATION_PATH \
|
||||
--install-location /Library/Java/JavaVirtualMachines/${BUILD_NAME} unsigned/${APP_NAME}.pkg
|
||||
productsign --timestamp --sign "$JB_INSTALLER_CERT" unsigned/${APP_NAME}.pkg ${APP_NAME}.pkg
|
||||
|
||||
#log "Signing whole app..."
|
||||
#codesign --timestamp \
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
#immediately exit script with an error if a command fails
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
export COPY_EXTENDED_ATTRIBUTES_DISABLE=true
|
||||
export COPYFILE_DISABLE=true
|
||||
@@ -44,8 +45,7 @@ fi
|
||||
log "$INPUT_FILE extracted and removed"
|
||||
|
||||
APP_NAME=$(echo ${INPUT_FILE} | awk -F".tar" '{ print $1 }')
|
||||
APPLICATION_PATH=$(sed "s/osx-//" <<< "$EXPLODED/$APP_NAME")
|
||||
mv $EXPLODED/$BUILD_NAME $APPLICATION_PATH
|
||||
APPLICATION_PATH=$EXPLODED/$(ls $EXPLODED)
|
||||
|
||||
find "$APPLICATION_PATH/Contents/Home/bin" \
|
||||
-maxdepth 1 -type f -name '*.jnilib' -print0 |
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
while getopts ":t" o; do
|
||||
case "${o}" in
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
usage ()
|
||||
{
|
||||
@@ -57,7 +60,13 @@ else
|
||||
testContent=`paste -d '\t' $refFile <(echo "$curValues") | tail -n +1`
|
||||
fi
|
||||
|
||||
testContent=`echo "$testContent" | awk -F'\t' '{ if ($3>$2+$2*0.1) {print "* "$1"\t"$2"\t"$3"\t"(($2==0)?"-":$3/$2)} else {print " "$1"\t"$2"\t"$3"\t"(($2==0)?"-":$3/$2)} }'`
|
||||
testContent=`echo "$testContent" | tr "," "." | awk -F'\t' '{
|
||||
if ($3>$2+$2*0.1) {
|
||||
print "* "$1"\t"$2"\t"$3"\t"(($2>0)?$3/$2:"-")
|
||||
} else {
|
||||
print " "$1"\t"$2"\t"$3"\t"(($2>0)?$3/$2:"-")
|
||||
}
|
||||
}'`
|
||||
if [ -z $noHeaders ]; then
|
||||
echo "$header" > $resFile
|
||||
fi
|
||||
@@ -68,11 +77,12 @@ if [ -z $tc ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
failed=0
|
||||
echo "$testContent" 2>&1 | (
|
||||
while read -r s; do
|
||||
testname=`echo "$s" | cut -f 1 | tr -d "[:space:]" | tr -d "*"`
|
||||
duration=`echo "$s" | cut -f 3`
|
||||
failed=`echo "$s" | cut -c1 | grep -c "*"`
|
||||
echo "$s" | cut -c1 | grep -c "*" && failed=1
|
||||
echo \#\#teamcity[testStarted name=\'$testNamePrefix$testname\']
|
||||
echo "===>$s"
|
||||
echo \#\#teamcity[buildStatisticValue key=\'$testNamePrefix$testname\' value=\'$duration\']
|
||||
|
||||
142
jb/project/tools/windows/scripts/mkimages_aarch64.sh
Normal file
142
jb/project/tools/windows/scripts/mkimages_aarch64.sh
Normal file
@@ -0,0 +1,142 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to be built;possible values:
|
||||
# <empty> or nomod - the release bundles without any additional modules (jcef)
|
||||
# jcef - the release bundles with jcef
|
||||
# fd - the fastdebug bundles which also include the jcef module
|
||||
#
|
||||
# This script makes test-image along with JDK images when bundle_type is set to "jcef".
|
||||
# If the character 't' is added at the end of bundle_type then it also makes test-image along with JDK images.
|
||||
#
|
||||
# Environment variables:
|
||||
# JDK_BUILD_NUMBER - specifies update release of OpenJDK build or the value of --with-version-build argument
|
||||
# to configure
|
||||
# By default JDK_BUILD_NUMBER is set zero
|
||||
# JCEF_PATH - specifies the path to the directory with JCEF binaries.
|
||||
# By default JCEF binaries should be located in ./jcef_win_aarch64
|
||||
|
||||
if [ -z "$BUILD_JDK" ]; then
|
||||
echo "BUILD_JDK environment variable must be specified and point to a JDK built from the current sources" \
|
||||
" and is able to run on the build system. See OpenJDK documentation for --with-build-jdk for more info."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source jb/project/tools/common/scripts/common.sh
|
||||
|
||||
WORK_DIR=$(pwd)
|
||||
JCEF_PATH=${JCEF_PATH:=$WORK_DIR/jcef_win_aarch64}
|
||||
|
||||
function do_configure {
|
||||
sh ./configure \
|
||||
--enable-option-checking=fatal \
|
||||
--openjdk-target=aarch64-unknown-cygwin \
|
||||
$WITH_DEBUG_LEVEL \
|
||||
--with-vendor-name="$VENDOR_NAME" \
|
||||
--with-vendor-version-string="$VENDOR_VERSION_STRING" \
|
||||
--with-jvm-features=shenandoahgc \
|
||||
--with-version-pre= \
|
||||
--with-version-build=$JDK_BUILD_NUMBER \
|
||||
--with-version-opt=b${build_number} \
|
||||
--with-toolchain-version=$TOOLCHAIN_VERSION \
|
||||
--with-boot-jdk=$BOOT_JDK \
|
||||
--with-build-jdk=$BUILD_JDK \
|
||||
--disable-ccache \
|
||||
--enable-cds=yes \
|
||||
$STATIC_CONF_ARGS \
|
||||
$REPRODUCIBLE_BUILD_OPTS \
|
||||
|| do_exit $?
|
||||
}
|
||||
|
||||
function create_image_bundle {
|
||||
__bundle_name=$1
|
||||
__arch_name=$2
|
||||
__modules_path=$3
|
||||
__modules=$4
|
||||
|
||||
fastdebug_infix=''
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-aarch64-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
echo Running jlink ...
|
||||
${BUILD_JDK}/bin/jlink \
|
||||
--module-path $__modules_path --no-man-pages --compress=2 \
|
||||
--add-modules $__modules --output $__root_dir || do_exit $?
|
||||
|
||||
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> $__root_dir/release
|
||||
if [ "$__arch_name" == "$JBRSDK_BUNDLE" ]; then
|
||||
sed 's/JBR/JBRSDK/g' $__root_dir/release > release
|
||||
mv release $__root_dir/release
|
||||
for dir in $(ls -d $IMAGES_DIR/jdk/*); do
|
||||
rsync -a --exclude demo --exclude sample $dir $__root_dir
|
||||
done
|
||||
copy_jmods "$__modules" "$__modules_path" "$__root_dir"/jmods
|
||||
fi
|
||||
}
|
||||
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=release"
|
||||
RELEASE_NAME=windows-aarch64-server-release
|
||||
|
||||
case "$bundle_type" in
|
||||
"jcef")
|
||||
do_reset_changes=0
|
||||
do_maketest=1
|
||||
;;
|
||||
"nomod" | "")
|
||||
bundle_type=""
|
||||
;;
|
||||
"fd")
|
||||
do_reset_changes=0
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=fastdebug"
|
||||
RELEASE_NAME=windows-aarch64-server-fastdebug
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "${INC_BUILD:-}" ]; then
|
||||
do_configure || do_exit $?
|
||||
if [ $do_maketest -eq 1 ]; then
|
||||
make LOG=info CONF=$RELEASE_NAME clean images test-image || do_exit $?
|
||||
else
|
||||
make LOG=info CONF=$RELEASE_NAME clean images || do_exit $?
|
||||
fi
|
||||
else
|
||||
if [ $do_maketest -eq 1 ]; then
|
||||
make LOG=info CONF=$RELEASE_NAME images test-image || do_exit $?
|
||||
else
|
||||
make LOG=info CONF=$RELEASE_NAME images || do_exit $?
|
||||
fi
|
||||
fi
|
||||
|
||||
IMAGES_DIR=build/$RELEASE_NAME/images
|
||||
JSDK=$IMAGES_DIR/jdk
|
||||
JSDK_MODS_DIR=$IMAGES_DIR/jmods
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
|
||||
git apply -p0 < jb/project/tools/patches/add_jcef_module_aarch64.patch || do_exit $?
|
||||
update_jsdk_mods "$BUILD_JDK" "$JCEF_PATH"/jmods "$JSDK"/jmods "$JSDK_MODS_DIR" || do_exit $?
|
||||
cp $JCEF_PATH/jmods/* ${JSDK_MODS_DIR} # $JSDK/jmods is not unchanged
|
||||
|
||||
jbr_name_postfix="_${bundle_type}"
|
||||
else
|
||||
jbr_name_postfix=""
|
||||
fi
|
||||
|
||||
# create runtime image bundle
|
||||
modules=$(xargs < jb/project/tools/common/modules.list | sed s/" "//g) || do_exit $?
|
||||
modules+=",jdk.crypto.mscapi"
|
||||
create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" || do_exit $?
|
||||
|
||||
# create sdk image bundle
|
||||
modules=$(cat ${JSDK}/release | grep MODULES | sed s/MODULES=//g | sed s/' '/','/g | sed s/\"//g | sed s/\\r//g | sed s/\\n//g) || do_exit $?
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
|
||||
modules=${modules},$(get_mods_list "$JCEF_PATH"/jmods)
|
||||
fi
|
||||
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" "$JBRSDK_BUNDLE" "$JSDK_MODS_DIR" "$modules" || do_exit $?
|
||||
|
||||
do_exit 0
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
@@ -35,6 +38,7 @@ function do_configure {
|
||||
--with-boot-jdk=$BOOT_JDK \
|
||||
--disable-ccache \
|
||||
--enable-cds=yes \
|
||||
$STATIC_CONF_ARGS \
|
||||
$REPRODUCIBLE_BUILD_OPTS \
|
||||
|| do_exit $?
|
||||
}
|
||||
@@ -45,18 +49,24 @@ function create_image_bundle {
|
||||
__modules_path=$3
|
||||
__modules=$4
|
||||
|
||||
fastdebug_infix=''
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-x64-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
echo Running jlink ...
|
||||
${JSDK}/bin/jlink \
|
||||
--module-path $__modules_path --no-man-pages --compress=2 \
|
||||
--add-modules $__modules --output $__arch_name || do_exit $?
|
||||
--add-modules $__modules --output $__root_dir || do_exit $?
|
||||
|
||||
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> $__arch_name/release
|
||||
if [ "$__arch_name" == "$JBRSDK_BUNDLE" ]; then
|
||||
sed 's/JBR/JBRSDK/g' $__arch_name/release > release
|
||||
mv release $__arch_name/release
|
||||
copy_jmods "$__modules" "$__modules_path" "$__arch_name"/jmods
|
||||
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> $__root_dir/release
|
||||
if [ "$__arch_name" == "$JBRSDK_BUNDLE" ]; then
|
||||
sed 's/JBR/JBRSDK/g' $__root_dir/release > release
|
||||
mv release $__root_dir/release
|
||||
for dir in $(ls -d $IMAGES_DIR/jdk/*); do
|
||||
rsync -a --exclude demo --exclude sample $dir $__root_dir
|
||||
done
|
||||
copy_jmods "$__modules" "$__modules_path" "$__root_dir"/jmods
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -78,7 +88,7 @@ case "$bundle_type" in
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$INC_BUILD" ]; then
|
||||
if [ -z "${INC_BUILD:-}" ]; then
|
||||
do_configure || do_exit $?
|
||||
if [ $do_maketest -eq 1 ]; then
|
||||
make LOG=info CONF=$RELEASE_NAME clean images test-image || do_exit $?
|
||||
@@ -104,9 +114,11 @@ if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
|
||||
cp $JCEF_PATH/jmods/* ${JSDK_MODS_DIR} # $JSDK/jmods is not unchanged
|
||||
|
||||
jbr_name_postfix="_${bundle_type}"
|
||||
else
|
||||
jbr_name_postfix=""
|
||||
fi
|
||||
|
||||
# create runtime image bundlef
|
||||
# create runtime image bundle
|
||||
modules=$(xargs < jb/project/tools/common/modules.list | sed s/" "//g) || do_exit $?
|
||||
modules+=",jdk.crypto.mscapi"
|
||||
create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" || do_exit $?
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# JBSDK_VERSION - specifies the current version of OpenJDK e.g. 11_0_6
|
||||
# JDK_BUILD_NUMBER - specifies the number of OpenJDK build or the value of --with-version-build argument to configure
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
#
|
||||
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to be built;possible values:
|
||||
# <empty> or nomod - the release bundles without any additional modules (jcef)
|
||||
# jcef - the release bundles with jcef
|
||||
# fd - the fastdebug bundles which also include the jcef module
|
||||
#
|
||||
# $ ./java --version
|
||||
# openjdk 11.0.6 2020-01-14
|
||||
@@ -14,50 +16,112 @@
|
||||
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
|
||||
#
|
||||
|
||||
JBSDK_VERSION=$1
|
||||
JDK_BUILD_NUMBER=$2
|
||||
build_number=$3
|
||||
|
||||
JBSDK_VERSION_WITH_DOTS=$(echo $JBSDK_VERSION | sed 's/_/\./g')
|
||||
|
||||
source jb/project/tools/common/scripts/common.sh
|
||||
|
||||
JBRSDK_BASE_NAME=jbrsdk-${JBSDK_VERSION}
|
||||
WORK_DIR=$(pwd)
|
||||
|
||||
[ -z "$bundle_type" ] && (git apply -p0 < jb/project/tools/patches/exclude_jcef_module.patch || exit $?)
|
||||
function do_configure {
|
||||
sh ./configure \
|
||||
$WITH_DEBUG_LEVEL \
|
||||
--with-vendor-name="$VENDOR_NAME" \
|
||||
--with-vendor-version-string="$VENDOR_VERSION_STRING" \
|
||||
--with-jvm-features=shenandoahgc \
|
||||
--with-version-pre= \
|
||||
--with-version-build=$JDK_BUILD_NUMBER \
|
||||
--with-version-opt=b${build_number} \
|
||||
--with-toolchain-version=$TOOLCHAIN_VERSION \
|
||||
--with-boot-jdk=$BOOT_JDK \
|
||||
--disable-ccache \
|
||||
--enable-cds=yes \
|
||||
$STATIC_CONF_ARGS \
|
||||
$REPRODUCIBLE_BUILD_OPTS \
|
||||
|| do_exit $?
|
||||
}
|
||||
|
||||
PATH="/usr/local/bin:/usr/bin:${PATH}"
|
||||
./configure \
|
||||
--with-target-bits=32 \
|
||||
--with-vendor-name="${VENDOR_NAME}" \
|
||||
--with-vendor-version-string="${VENDOR_VERSION_STRING}" \
|
||||
--with-version-pre= \
|
||||
--with-version-build=${JDK_BUILD_NUMBER} \
|
||||
--with-version-opt=b${build_number} \
|
||||
--with-toolchain-version=${TOOLCHAIN_VERSION} \
|
||||
--with-boot-jdk=${BOOT_JDK} \
|
||||
--disable-ccache \
|
||||
--enable-cds=yes || exit 1
|
||||
make clean CONF=windows-x86-server-release || exit 1
|
||||
make LOG=info images CONF=windows-x86-server-release test-image || exit 1
|
||||
function create_image_bundle {
|
||||
__bundle_name=$1
|
||||
__arch_name=$2
|
||||
__modules_path=$3
|
||||
__modules=$4
|
||||
|
||||
JBSDK=${JBRSDK_BASE_NAME}-windows-x86-b${build_number}
|
||||
BASE_DIR=build/windows-x86-server-release/images
|
||||
JSDK=${BASE_DIR}/jdk
|
||||
fastdebug_infix=''
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-x86-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
echo Running jlink ...
|
||||
${JSDK}/bin/jlink \
|
||||
--module-path $__modules_path --no-man-pages --compress=2 \
|
||||
--add-modules $__modules --output $__root_dir || do_exit $?
|
||||
|
||||
grep -v "^JAVA_VERSION" "$JSDK"/release | grep -v "^MODULES" >> $__root_dir/release
|
||||
if [ "$__arch_name" == "$JBRSDK_BUNDLE" ]; then
|
||||
sed 's/JBR/JBRSDK/g' $__root_dir/release > release
|
||||
mv release $__root_dir/release
|
||||
for dir in $(ls -d $IMAGES_DIR/jdk/*); do
|
||||
rsync -a --exclude demo --exclude sample $dir $__root_dir
|
||||
done
|
||||
copy_jmods "$__modules" "$__modules_path" "$__root_dir"/jmods
|
||||
fi
|
||||
}
|
||||
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=release"
|
||||
RELEASE_NAME=windows-x86_64-server-release
|
||||
|
||||
case "$bundle_type" in
|
||||
"jcef")
|
||||
echo "not implemented" && do_exit 1
|
||||
;;
|
||||
"nomod" | "")
|
||||
bundle_type=""
|
||||
;;
|
||||
"fd")
|
||||
do_reset_changes=0
|
||||
WITH_DEBUG_LEVEL="--with-debug-level=fastdebug"
|
||||
RELEASE_NAME=windows-x86_64-server-fastdebug
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "${INC_BUILD:-}" ]; then
|
||||
do_configure || do_exit $?
|
||||
if [ $do_maketest -eq 1 ]; then
|
||||
make LOG=info CONF=$RELEASE_NAME clean images test-image || do_exit $?
|
||||
else
|
||||
make LOG=info CONF=$RELEASE_NAME clean images || do_exit $?
|
||||
fi
|
||||
else
|
||||
if [ $do_maketest -eq 1 ]; then
|
||||
make LOG=info CONF=$RELEASE_NAME images test-image || do_exit $?
|
||||
else
|
||||
make LOG=info CONF=$RELEASE_NAME images || do_exit $?
|
||||
fi
|
||||
fi
|
||||
|
||||
IMAGES_DIR=build/$RELEASE_NAME/images
|
||||
JSDK=$IMAGES_DIR/jdk
|
||||
JSDK_MODS_DIR=$IMAGES_DIR/jmods
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
|
||||
rm -rf ${BASE_DIR}/${JBRSDK_BUNDLE} && rsync -a --exclude demo --exclude sample ${JSDK}/ ${JBRSDK_BUNDLE} || exit 1
|
||||
sed 's/JBR/JBRSDK/g' ${JSDK}/release > release
|
||||
mv release ${JBRSDK_BUNDLE}/release
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ]; then
|
||||
git apply -p0 < jb/project/tools/patches/add_jcef_module.patch || do_exit $?
|
||||
update_jsdk_mods "$JSDK" "$JCEF_PATH"/jmods "$JSDK"/jmods "$JSDK_MODS_DIR" || do_exit $?
|
||||
cp $JCEF_PATH/jmods/* ${JSDK_MODS_DIR} # $JSDK/jmods is not unchanged
|
||||
|
||||
JBR_BUNDLE=jbr
|
||||
rm -rf ${JBR_BUNDLE}
|
||||
grep -v javafx jb/project/tools/common/modules.list | grep -v "jdk.internal.vm\|jdk.aot\|jcef" > modules.list.x86
|
||||
echo ",jdk.crypto.mscapi" >> modules.list.x86
|
||||
${JSDK}/bin/jlink \
|
||||
--module-path ${JSDK}/jmods --no-man-pages --compress=2 \
|
||||
--add-modules $(xargs < modules.list.x86 | sed s/" "//g) --output ${JBR_BUNDLE} || exit $?
|
||||
jbr_name_postfix="_${bundle_type}"
|
||||
else
|
||||
jbr_name_postfix=""
|
||||
fi
|
||||
|
||||
echo Modifying release info ...
|
||||
#grep -v \"^JAVA_VERSION\" ${JSDK}/release | grep -v \"^MODULES\" >> ${JBR_BUNDLE}/release
|
||||
# create runtime image bundle
|
||||
modules=$(grep -v "jdk.internal.vm" jb/project/tools/common/modules.list | xargs | sed s/" "//g) || do_exit $?
|
||||
modules+=",jdk.crypto.mscapi"
|
||||
create_image_bundle "jbr${jbr_name_postfix}" "jbr" $JSDK_MODS_DIR "$modules" || do_exit $?
|
||||
|
||||
# create sdk image bundle
|
||||
modules=$(cat ${JSDK}/release | grep MODULES | sed s/MODULES=//g | sed s/' '/','/g | sed s/\"//g | sed s/\\r//g | sed s/\\n//g)
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "fd" ] || [ "$bundle_type" == "$JBRSDK_BUNDLE" ]; then
|
||||
modules=${modules},$(get_mods_list "$JCEF_PATH"/jmods)
|
||||
fi
|
||||
create_image_bundle "$JBRSDK_BUNDLE${jbr_name_postfix}" "$JBRSDK_BUNDLE" "$JSDK_MODS_DIR" "$modules" || do_exit $?
|
||||
|
||||
do_exit 0
|
||||
|
||||
56
jb/project/tools/windows/scripts/pack_aarch64.sh
Normal file
56
jb/project/tools/windows/scripts/pack_aarch64.sh
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to be built;possible values:
|
||||
# <empty> or nomod - the release bundles without any additional modules (jcef)
|
||||
# jcef - the release bundles with jcef
|
||||
# fd - the fastdebug bundles which also include the jcef module
|
||||
#
|
||||
# This script packs test-image along with JDK images when bundle_type is set to "jcef".
|
||||
# If the character 't' is added at the end of bundle_type then it also makes test-image along with JDK images.
|
||||
#
|
||||
|
||||
source jb/project/tools/common/scripts/common.sh
|
||||
|
||||
[ "$bundle_type" == "jcef" ] && do_maketest=1
|
||||
|
||||
function pack_jbr {
|
||||
__bundle_name=$1
|
||||
__arch_name=$2
|
||||
|
||||
fastdebug_infix=''
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-windows-aarch64-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-aarch64-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
echo Creating $JBR.tar.gz ...
|
||||
chmod -R ug+rwx,o+rx ${BASE_DIR}/$__root_dir
|
||||
/usr/bin/tar -czf $JBR.tar.gz -C $BASE_DIR $__root_dir || do_exit $?
|
||||
}
|
||||
|
||||
[ "$bundle_type" == "nomod" ] && bundle_type=""
|
||||
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
RELEASE_NAME=windows-aarch64-server-release
|
||||
IMAGES_DIR=build/$RELEASE_NAME/images
|
||||
BASE_DIR=.
|
||||
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "dcevm" ] || [ "$bundle_type" == "fd" ]; then
|
||||
jbr_name_postfix="_${bundle_type}"
|
||||
else
|
||||
jbr_name_postfix=""
|
||||
fi
|
||||
|
||||
pack_jbr jbr${jbr_name_postfix} jbr
|
||||
pack_jbr jbrsdk${jbr_name_postfix} jbrsdk
|
||||
|
||||
if [ $do_maketest -eq 1 ]; then
|
||||
JBRSDK_TEST=$JBRSDK_BUNDLE-$JBSDK_VERSION-windows-test-aarch64-b$build_number
|
||||
echo Creating $JBRSDK_TEST.tar.gz ...
|
||||
/usr/bin/tar -czf $JBRSDK_TEST.tar.gz -C $IMAGES_DIR --exclude='test/jdk/demos' test || do_exit $?
|
||||
fi
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
@@ -19,12 +22,15 @@ function pack_jbr {
|
||||
__bundle_name=$1
|
||||
__arch_name=$2
|
||||
|
||||
fastdebug_infix=''
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-windows-x64-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-x64-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
echo Creating $JBR.tar.gz ...
|
||||
|
||||
/usr/bin/tar -czf $JBR.tar.gz -C $BASE_DIR $__arch_name || do_exit $?
|
||||
chmod -R ug+rwx,o+rx ${BASE_DIR}/$__root_dir
|
||||
/usr/bin/tar -czf $JBR.tar.gz -C $BASE_DIR $__root_dir || do_exit $?
|
||||
}
|
||||
|
||||
[ "$bundle_type" == "nomod" ] && bundle_type=""
|
||||
@@ -36,6 +42,8 @@ BASE_DIR=.
|
||||
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "dcevm" ] || [ "$bundle_type" == "fd" ]; then
|
||||
jbr_name_postfix="_${bundle_type}"
|
||||
else
|
||||
jbr_name_postfix=""
|
||||
fi
|
||||
|
||||
pack_jbr jbr${jbr_name_postfix} jbr
|
||||
|
||||
@@ -1,42 +1,50 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
# The following parameters must be specified:
|
||||
# JBSDK_VERSION - specifies the current version of OpenJDK e.g. 11_0_6
|
||||
# JDK_BUILD_NUMBER - specifies the number of OpenJDK build or the value of --with-version-build argument to configure
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
#
|
||||
# jbrsdk-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
# jbr-${JBSDK_VERSION}-osx-x64-b${build_number}.tar.gz
|
||||
#
|
||||
# $ ./java --version
|
||||
# openjdk 11.0.6 2020-01-14
|
||||
# OpenJDK Runtime Environment (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number})
|
||||
# OpenJDK 64-Bit Server VM (build 11.0.6+${JDK_BUILD_NUMBER}-b${build_number}, mixed mode)
|
||||
# build_number - specifies the number of JetBrainsRuntime build
|
||||
# bundle_type - specifies bundle to be built;possible values:
|
||||
# <empty> or nomod - the release bundles without any additional modules (jcef)
|
||||
# fd - the fastdebug bundles which also include the jcef module
|
||||
#
|
||||
|
||||
JBSDK_VERSION=$1
|
||||
JDK_BUILD_NUMBER=$2
|
||||
build_number=$3
|
||||
source jb/project/tools/common/scripts/common.sh
|
||||
|
||||
JBRSDK_BASE_NAME=jbrsdk-$JBSDK_VERSION
|
||||
JBR_BASE_NAME=jbr-$JBSDK_VERSION
|
||||
[ "$bundle_type" == "jcef" ] && echo "not implemented" && do_exit 1
|
||||
|
||||
IMAGES_DIR=build/windows-x86-server-release/images
|
||||
JSDK=$IMAGES_DIR/jdk
|
||||
JBSDK=$JBRSDK_BASE_NAME-windows-x86-b$build_number
|
||||
BASE_DIR=.
|
||||
function pack_jbr {
|
||||
__bundle_name=$1
|
||||
__arch_name=$2
|
||||
|
||||
fastdebug_infix=''
|
||||
|
||||
[ "$bundle_type" == "fd" ] && [ "$__arch_name" == "$JBRSDK_BUNDLE" ] && __bundle_name=$__arch_name && fastdebug_infix="fastdebug-"
|
||||
JBR=${__bundle_name}-${JBSDK_VERSION}-windows-x86-${fastdebug_infix}b${build_number}
|
||||
__root_dir=${__bundle_name}-${JBSDK_VERSION}-x86-${fastdebug_infix:-}b${build_number%%.*}
|
||||
|
||||
echo Creating $JBR.tar.gz ...
|
||||
chmod -R ug+rwx,o+rx ${BASE_DIR}/$__root_dir
|
||||
/usr/bin/tar -czf $JBR.tar.gz -C $BASE_DIR $__root_dir || do_exit $?
|
||||
}
|
||||
|
||||
[ "$bundle_type" == "nomod" ] && bundle_type=""
|
||||
|
||||
JBRSDK_BUNDLE=jbrsdk
|
||||
echo Creating $JBSDK.tar.gz ...
|
||||
/usr/bin/tar -czf $JBSDK.tar.gz $JBRSDK_BUNDLE || exit 1
|
||||
BASE_DIR=.
|
||||
|
||||
JBR_BUNDLE=jbr
|
||||
JBR_BASE_NAME=jbr-${JBSDK_VERSION}
|
||||
if [ "$bundle_type" == "jcef" ] || [ "$bundle_type" == "dcevm" ] || [ "$bundle_type" == "fd" ]; then
|
||||
jbr_name_postfix="_${bundle_type}"
|
||||
else
|
||||
jbr_name_postfix=""
|
||||
fi
|
||||
|
||||
JBR=$JBR_BASE_NAME-windows-x86-b$build_number
|
||||
echo Creating $JBR.tar.gz ...
|
||||
/usr/bin/tar -czf $JBR.tar.gz -C $BASE_DIR ${JBR_BUNDLE} || exit 1
|
||||
pack_jbr jbr${jbr_name_postfix} jbr
|
||||
pack_jbr jbrsdk${jbr_name_postfix} jbrsdk
|
||||
|
||||
JBRSDK_TEST=$JBRSDK_BASE_NAME-windows-test-x86-b$build_number
|
||||
echo Creating $JBRSDK_TEST.tar.gz ...
|
||||
/usr/bin/tar -czf $JBRSDK_TEST.tar.gz -C $IMAGES_DIR --exclude='test/jdk/demos' test || exit 1
|
||||
if [ $do_maketest -eq 1 ]; then
|
||||
JBRSDK_TEST=$JBRSDK_BUNDLE-$JBSDK_VERSION-windows-test-x86-b$build_number
|
||||
echo Creating $JBRSDK_TEST.tar.gz ...
|
||||
/usr/bin/tar -czf $JBRSDK_TEST.tar.gz -C $BASE_DIR --exclude='test/jdk/demos' test || do_exit $?
|
||||
fi
|
||||
@@ -229,15 +229,19 @@ else
|
||||
endif
|
||||
|
||||
ifeq ($(ENABLE_REPRODUCIBLE_BUILD), true)
|
||||
ifeq ($(MODULE), java.base)
|
||||
JAR_FILE_TO_FIX := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jrt-fs.jar
|
||||
$(eval $(call SetupExecute, fixup_jrtfs_jar, \
|
||||
WARN := Fixing timestamps in modules_libs/java.base/jrt-fs.jar, \
|
||||
DEPS := $(JAR_FILE_TO_FIX) $(JDK_OUTPUTDIR)/bin/jar, \
|
||||
OUTPUT_DIR := $(JMODS_SUPPORT_DIR), \
|
||||
COMMAND := $(FIXPATH) $(JDK_OUTPUTDIR)/bin/jar --date $(SOURCE_DATE_ISO_8601) --update --file $(JAR_FILE_TO_FIX) @$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/_the.jrt-fs.jar_contents, \
|
||||
))
|
||||
DEPS += $(fixup_jrtfs_jar_TARGET)
|
||||
# If boot JDK's jar supported --date, jrt-fs.jar would've been built with
|
||||
# that option already.
|
||||
ifneq ($(BOOT_JDK_JAR_SUPPORTS_DATE), true)
|
||||
ifeq ($(MODULE), java.base)
|
||||
JAR_FILE_TO_FIX := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jrt-fs.jar
|
||||
$(eval $(call SetupExecute, fixup_jrtfs_jar, \
|
||||
WARN := Fixing timestamps in modules_libs/java.base/jrt-fs.jar, \
|
||||
DEPS := $(JAR_FILE_TO_FIX) $(JDK_OUTPUTDIR)/bin/jar, \
|
||||
OUTPUT_DIR := $(JMODS_SUPPORT_DIR), \
|
||||
COMMAND := $(BUILD_JAR) --date $(SOURCE_DATE_ISO_8601) --update --file $(JAR_FILE_TO_FIX) @$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/_the.jrt-fs.jar_contents, \
|
||||
))
|
||||
DEPS += $(fixup_jrtfs_jar_TARGET)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -129,8 +129,17 @@ static inline uint32_t uimm(uint32_t val, int hi, int lo)
|
||||
|
||||
uint64_t replicate(uint64_t bits, int nbits, int count)
|
||||
{
|
||||
assert(count > 0, "must be");
|
||||
assert(nbits > 0, "must be");
|
||||
assert(count * nbits <= 64, "must be");
|
||||
|
||||
// Special case nbits == 64 since the shift below with that nbits value
|
||||
// would result in undefined behavior.
|
||||
if (nbits == 64) {
|
||||
return bits;
|
||||
}
|
||||
|
||||
uint64_t result = 0;
|
||||
// nbits may be 64 in which case we want mask to be -1
|
||||
uint64_t mask = ones(nbits);
|
||||
for (int i = 0; i < count ; i++) {
|
||||
result <<= nbits;
|
||||
|
||||
@@ -567,6 +567,12 @@ int JVM_HANDLE_XXX_SIGNAL(int sig, siginfo_t* info,
|
||||
return true; // ignore it
|
||||
}
|
||||
|
||||
if (sig == SIGABRT) {
|
||||
// Re-set the handler so that we don't recurse if/when abort() is called
|
||||
// from here.
|
||||
os::signal(SIGABRT, (void*)SIG_DFL);
|
||||
}
|
||||
|
||||
// Note: it's not uncommon that JNI code uses signal/sigset to install,
|
||||
// then restore certain signal handler (e.g. to temporarily block SIGPIPE,
|
||||
// or have a SIGILL handler when detecting CPU type). When that happens,
|
||||
@@ -1290,6 +1296,9 @@ void install_signal_handlers() {
|
||||
// check because late initialization will overwrite it to UserHandler.
|
||||
set_signal_handler(BREAK_SIGNAL, false);
|
||||
}
|
||||
if (CatchSIGABRT) {
|
||||
set_signal_handler(SIGABRT);
|
||||
}
|
||||
#if defined(__APPLE__)
|
||||
// lldb (gdb) installs both standard BSD signal handlers, and mach exception
|
||||
// handlers. By replacing the existing task exception handler, we disable lldb's mach
|
||||
|
||||
@@ -457,7 +457,7 @@ void ConstantPoolCacheEntry::set_method_handle_common(const constantPoolHandle&
|
||||
resolved_references->obj_at_put(appendix_index, appendix());
|
||||
}
|
||||
|
||||
Atomic::release_store(&_flags, _flags & ~(1u << is_f1_null_dcevm_shift));
|
||||
Atomic::release_store( &_flags, _flags & static_cast<intx>(~(1u << is_f1_null_dcevm_shift)) );
|
||||
|
||||
release_set_f1(adapter); // This must be the last one to set (see NOTE above)!
|
||||
|
||||
|
||||
@@ -1337,7 +1337,6 @@ bool Arguments::add_property(const char* prop, PropertyWriteable writeable, Prop
|
||||
log_info(cds)("optimized module handling: disabled due to incompatible property: %s=%s", key, value);
|
||||
}
|
||||
if (strcmp(key, "jdk.module.showModuleResolution") == 0 ||
|
||||
strcmp(key, "jdk.module.illegalAccess") == 0 ||
|
||||
strcmp(key, "jdk.module.validation") == 0 ||
|
||||
strcmp(key, "java.system.class.loader") == 0) {
|
||||
MetaspaceShared::disable_full_module_graph();
|
||||
@@ -2132,8 +2131,7 @@ bool Arguments::parse_uintx(const char* value,
|
||||
}
|
||||
|
||||
bool Arguments::create_module_property(const char* prop_name, const char* prop_value, PropertyInternal internal) {
|
||||
assert(is_internal_module_property(prop_name) ||
|
||||
strcmp(prop_name, "jdk.module.illegalAccess") == 0, "unknown module property: '%s'", prop_name);
|
||||
assert(is_internal_module_property(prop_name), "unknown module property: '%s'", prop_name);
|
||||
size_t prop_len = strlen(prop_name) + strlen(prop_value) + 2;
|
||||
char* property = AllocateHeap(prop_len, mtArguments);
|
||||
int ret = jio_snprintf(property, prop_len, "%s=%s", prop_name, prop_value);
|
||||
@@ -2505,10 +2503,6 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
|
||||
char version[256];
|
||||
JDK_Version::jdk(17).to_string(version, sizeof(version));
|
||||
warning("Ignoring option %s; support was removed in %s", option->optionString, version);
|
||||
} else if (match_option(option, "--jbr-illegal-access", &tail)) {
|
||||
if (!create_module_property("jdk.module.illegalAccess", "permit", ExternalProperty)) {
|
||||
return JNI_ENOMEM;
|
||||
}
|
||||
// -agentlib and -agentpath
|
||||
} else if (match_option(option, "-agentlib:", &tail) ||
|
||||
(is_absolute_path = match_option(option, "-agentpath:", &tail))) {
|
||||
|
||||
@@ -2099,8 +2099,10 @@ const intx ObjectAlignmentInBytes = 8;
|
||||
"core: core HA. Use integrated hotswap-agent-core.jar" \
|
||||
"external: external HA. use external HA, open required JDK " \
|
||||
"modules.") \
|
||||
constraint(HotswapAgentConstraintFunc, AfterErgo)
|
||||
|
||||
constraint(HotswapAgentConstraintFunc, AfterErgo) \
|
||||
\
|
||||
product(bool, CatchSIGABRT, false, \
|
||||
"Handle SIGABRT and generate hs_err file (Unix only) ")
|
||||
|
||||
// end of RUNTIME_FLAGS
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ public class CgroupSubsystemFactory {
|
||||
Map<String, CgroupInfo> infos = result.getInfos();
|
||||
if (result.isCgroupV2()) {
|
||||
// For unified it doesn't matter which controller we pick.
|
||||
CgroupInfo anyController = infos.get(MEMORY_CTRL);
|
||||
CgroupInfo anyController = infos.values().iterator().next();
|
||||
CgroupSubsystem subsystem = CgroupV2Subsystem.getInstance(anyController);
|
||||
return subsystem != null ? new CgroupMetrics(subsystem) : null;
|
||||
} else {
|
||||
|
||||
@@ -80,7 +80,7 @@ class ProxyInfo {
|
||||
try {
|
||||
if (i != 0) clazz += "$";
|
||||
clazz += nestedClasses[i];
|
||||
lookup = MethodHandles.privateLookupIn(lookup.findClass(clazz), lookup);
|
||||
lookup = MethodHandles.privateLookupIn(Class.forName(clazz, true, lookup.lookupClass().getClassLoader()), lookup);
|
||||
} catch (ClassNotFoundException | IllegalAccessException ignore) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -68,14 +68,4 @@ class ExplodedSystemModules implements SystemModules {
|
||||
public Map<String, Set<String>> moduleReads() {
|
||||
throw new InternalError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Set<String>> concealedPackagesToOpen() {
|
||||
return Map.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Set<String>> exportedPackagesToOpen() {
|
||||
return Map.of();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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.
|
||||
*/
|
||||
package jdk.internal.module;
|
||||
|
||||
import sun.nio.cs.UTF_8;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.lang.module.ModuleDescriptor;
|
||||
import java.lang.module.ModuleFinder;
|
||||
import java.lang.module.ModuleReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Generates the maps of concealed and exported packages to open at run-time.
|
||||
*
|
||||
* This is used at run-time for exploded builds, and at link-time to generate
|
||||
* the maps for the system modules in the run-time image.
|
||||
*/
|
||||
|
||||
public class IllegalAccessMaps {
|
||||
private final Map<String, Set<String>> concealedPackagesToOpen;
|
||||
private final Map<String, Set<String>> exportedPackagesToOpen;
|
||||
|
||||
private IllegalAccessMaps(Map<String, Set<String>> map1,
|
||||
Map<String, Set<String>> map2) {
|
||||
this.concealedPackagesToOpen = map1;
|
||||
this.exportedPackagesToOpen = map2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the map of concealed packages to open. The map key is the
|
||||
* module name, the value is the set of concealed packages to open.
|
||||
*/
|
||||
public Map<String, Set<String>> concealedPackagesToOpen() {
|
||||
return concealedPackagesToOpen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the map of exported packages to open. The map key is the
|
||||
* module name, the value is the set of exported packages to open.
|
||||
*/
|
||||
public Map<String, Set<String>> exportedPackagesToOpen() {
|
||||
return exportedPackagesToOpen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the maps of module to concealed and exported packages for
|
||||
* the system modules that are observable with the given module finder.
|
||||
*/
|
||||
public static IllegalAccessMaps generate(ModuleFinder finder) {
|
||||
Map<String, ModuleDescriptor> map = new HashMap<>();
|
||||
finder.findAll().stream()
|
||||
.map(ModuleReference::descriptor)
|
||||
.forEach(md -> md.packages().forEach(pn -> map.putIfAbsent(pn, md)));
|
||||
|
||||
Map<String, Set<String>> concealedPackagesToOpen = new HashMap<>();
|
||||
Map<String, Set<String>> exportedPackagesToOpen = new HashMap<>();
|
||||
|
||||
String rn = "jdk8_packages.dat";
|
||||
InputStream in = IllegalAccessMaps.class.getResourceAsStream(rn);
|
||||
if (in == null) {
|
||||
throw new InternalError(rn + " not found");
|
||||
}
|
||||
try (BufferedReader br = new BufferedReader(
|
||||
new InputStreamReader(in, UTF_8.INSTANCE)))
|
||||
{
|
||||
br.lines()
|
||||
.filter(line -> !line.isEmpty() && !line.startsWith("#"))
|
||||
.forEach(pn -> {
|
||||
ModuleDescriptor descriptor = map.get(pn);
|
||||
if (descriptor != null && !isOpen(descriptor, pn)) {
|
||||
String name = descriptor.name();
|
||||
if (isExported(descriptor, pn)) {
|
||||
exportedPackagesToOpen.computeIfAbsent(name,
|
||||
k -> new HashSet<>()).add(pn);
|
||||
} else {
|
||||
concealedPackagesToOpen.computeIfAbsent(name,
|
||||
k -> new HashSet<>()).add(pn);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} catch (IOException ioe) {
|
||||
throw new UncheckedIOException(ioe);
|
||||
}
|
||||
|
||||
return new IllegalAccessMaps(concealedPackagesToOpen, exportedPackagesToOpen);
|
||||
}
|
||||
|
||||
private static boolean isExported(ModuleDescriptor descriptor, String pn) {
|
||||
return descriptor.exports()
|
||||
.stream()
|
||||
.anyMatch(e -> e.source().equals(pn) && !e.isQualified());
|
||||
}
|
||||
|
||||
private static boolean isOpen(ModuleDescriptor descriptor, String pn) {
|
||||
return descriptor.opens()
|
||||
.stream()
|
||||
.anyMatch(e -> e.source().equals(pn) && !e.isQualified());
|
||||
}
|
||||
}
|
||||
@@ -147,8 +147,7 @@ public final class ModuleBootstrap {
|
||||
getProperty("jdk.module.limitmods") == null && // --limit-modules
|
||||
getProperty("jdk.module.addreads.0") == null && // --add-reads
|
||||
getProperty("jdk.module.addexports.0") == null && // --add-exports
|
||||
getProperty("jdk.module.addopens.0") == null && // --add-opens
|
||||
getProperty("jdk.module.illegalAccess") == null; // --jbr-illegal-access
|
||||
getProperty("jdk.module.addopens.0") == null; // --add-opens
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,7 +188,6 @@ public final class ModuleBootstrap {
|
||||
String mainModule = System.getProperty("jdk.module.main");
|
||||
Set<String> addModules = addModules();
|
||||
Set<String> limitModules = limitModules();
|
||||
String illegalAccess = getAndRemoveProperty("jdk.module.illegalAccess");
|
||||
|
||||
PrintStream traceOutput = null;
|
||||
String trace = getAndRemoveProperty("jdk.module.showModuleResolution");
|
||||
@@ -221,8 +219,7 @@ public final class ModuleBootstrap {
|
||||
&& !haveModulePath
|
||||
&& addModules.isEmpty()
|
||||
&& limitModules.isEmpty()
|
||||
&& !isPatched
|
||||
&& illegalAccess == null) {
|
||||
&& !isPatched) {
|
||||
systemModuleFinder = archivedModuleGraph.finder();
|
||||
hasSplitPackages = archivedModuleGraph.hasSplitPackages();
|
||||
hasIncubatorModules = archivedModuleGraph.hasIncubatorModules();
|
||||
@@ -457,19 +454,10 @@ public final class ModuleBootstrap {
|
||||
checkIncubatingStatus(cf);
|
||||
}
|
||||
|
||||
// --add-reads, --add-exports/--add-opens, and --jbr-illegal-access
|
||||
// --add-reads, --add-exports/--add-opens
|
||||
addExtraReads(bootLayer);
|
||||
boolean extraExportsOrOpens = addExtraExportsAndOpens(bootLayer);
|
||||
|
||||
if (illegalAccess != null) {
|
||||
assert systemModules != null;
|
||||
addIllegalAccess(illegalAccess,
|
||||
systemModules,
|
||||
upgradeModulePath,
|
||||
bootLayer,
|
||||
extraExportsOrOpens);
|
||||
}
|
||||
|
||||
// add enable native access
|
||||
addEnableNativeAccess(bootLayer);
|
||||
|
||||
@@ -825,74 +813,6 @@ public final class ModuleBootstrap {
|
||||
return modules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the --jbr-illegal-access option to open packages of system modules
|
||||
* in the boot layer to code in unnamed modules.
|
||||
*/
|
||||
private static void addIllegalAccess(String illegalAccess,
|
||||
SystemModules systemModules,
|
||||
ModuleFinder upgradeModulePath,
|
||||
ModuleLayer bootLayer,
|
||||
boolean extraExportsOrOpens) {
|
||||
|
||||
Map<String, Set<String>> concealedPackagesToOpen = systemModules.concealedPackagesToOpen();
|
||||
Map<String, Set<String>> exportedPackagesToOpen = systemModules.exportedPackagesToOpen();
|
||||
if (concealedPackagesToOpen.isEmpty() && exportedPackagesToOpen.isEmpty()) {
|
||||
// need to generate (exploded build)
|
||||
IllegalAccessMaps maps = IllegalAccessMaps.generate(limitedFinder());
|
||||
concealedPackagesToOpen = maps.concealedPackagesToOpen();
|
||||
exportedPackagesToOpen = maps.exportedPackagesToOpen();
|
||||
}
|
||||
|
||||
// open specific packages in the system modules
|
||||
Set<String> emptySet = Set.of();
|
||||
for (Module m : bootLayer.modules()) {
|
||||
ModuleDescriptor descriptor = m.getDescriptor();
|
||||
String name = m.getName();
|
||||
|
||||
// skip open modules
|
||||
if (descriptor.isOpen()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip modules loaded from the upgrade module path
|
||||
if (upgradeModulePath != null
|
||||
&& upgradeModulePath.find(name).isPresent()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Set<String> concealedPackages = concealedPackagesToOpen.getOrDefault(name, emptySet);
|
||||
Set<String> exportedPackages = exportedPackagesToOpen.getOrDefault(name, emptySet);
|
||||
|
||||
// refresh the set of concealed and exported packages if needed
|
||||
if (extraExportsOrOpens) {
|
||||
concealedPackages = new HashSet<>(concealedPackages);
|
||||
exportedPackages = new HashSet<>(exportedPackages);
|
||||
Iterator<String> iterator = concealedPackages.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String pn = iterator.next();
|
||||
if (m.isExported(pn, BootLoader.getUnnamedModule())) {
|
||||
// concealed package is exported to ALL-UNNAMED
|
||||
iterator.remove();
|
||||
exportedPackages.add(pn);
|
||||
}
|
||||
}
|
||||
iterator = exportedPackages.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String pn = iterator.next();
|
||||
if (m.isOpen(pn, BootLoader.getUnnamedModule())) {
|
||||
// exported package is opened to ALL-UNNAMED
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// open the packages to unnamed modules
|
||||
JLA.addOpensToAllUnnamed(m, concealedPackages, exportedPackages);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes the values of --add-reads, -add-exports, --add-opens or
|
||||
* --patch-modules options that are encoded in system properties.
|
||||
|
||||
@@ -83,16 +83,4 @@ interface SystemModules {
|
||||
* by this SystemModules object.
|
||||
*/
|
||||
Map<String, Set<String>> moduleReads();
|
||||
|
||||
/**
|
||||
* Returns the map of module concealed packages to open. The map key is the
|
||||
* module name, the value is the set of concealed packages to open.
|
||||
*/
|
||||
Map<String, Set<String>> concealedPackagesToOpen();
|
||||
|
||||
/**
|
||||
* Returns the map of module exported packages to open. The map key is the
|
||||
* module name, the value is the set of exported packages to open.
|
||||
*/
|
||||
Map<String, Set<String>> exportedPackagesToOpen();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -188,10 +188,6 @@ java.launcher.X.usage=\n\
|
||||
\ --add-opens <module>/<package>=<target-module>(,<target-module>)*\n\
|
||||
\ updates <module> to open <package> to\n\
|
||||
\ <target-module>, regardless of module declaration.\n\
|
||||
\ --jbr-illegal-access\n\
|
||||
\ permit access to members of types in named modules\n\
|
||||
\ by code in unnamed modules.\n\
|
||||
\ This option will be removed in a future release.\n\
|
||||
\ --limit-modules <module name>[,<module name>...]\n\
|
||||
\ limit the universe of observable modules\n\
|
||||
\ --patch-module <module>=<file>({0}<file>)*\n\
|
||||
|
||||
@@ -930,7 +930,7 @@ getStringUTF8(JNIEnv *env, jstring jstr)
|
||||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT const char * JNICALL
|
||||
JNIEXPORT const char *
|
||||
GetStringUTF8Chars(JNIEnv *env, jstring jstr)
|
||||
{
|
||||
return getStringUTF8(env, jstr);
|
||||
|
||||
@@ -50,20 +50,28 @@ Java_sun_nio_ch_DatagramChannelImpl_disconnect0(JNIEnv *env, jclass clazz,
|
||||
jint fd = fdval(env, fdo);
|
||||
int rv;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
// On macOS systems we use disconnectx
|
||||
rv = disconnectx(fd, SAE_ASSOCID_ANY, SAE_CONNID_ANY);
|
||||
#else
|
||||
SOCKETADDRESS sa;
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
#if defined(_ALLBSD_SOURCE)
|
||||
sa.sa.sa_family = isIPv6 ? AF_INET6 : AF_INET;
|
||||
#else
|
||||
sa.sa.sa_family = AF_UNSPEC;
|
||||
#endif
|
||||
socklen_t len = isIPv6 ? sizeof(struct sockaddr_in6) :
|
||||
sizeof(struct sockaddr_in);
|
||||
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
#if defined(_ALLBSD_SOURCE)
|
||||
sa.sa.sa_family = isIPv6 ? AF_INET6 : AF_INET;
|
||||
#else
|
||||
sa.sa.sa_family = AF_UNSPEC;
|
||||
rv = connect(fd, &sa.sa, len);
|
||||
#endif
|
||||
|
||||
rv = connect(fd, &sa.sa, len);
|
||||
|
||||
#if defined(_ALLBSD_SOURCE)
|
||||
#if defined(_ALLBSD_SOURCE) && !defined(__APPLE__)
|
||||
// On _ALLBSD_SOURCE except __APPLE__ we consider EADDRNOTAVAIL
|
||||
// error to be OK and ignore it. __APPLE__ systems are excluded
|
||||
// in this check since for __APPLE__ systems, unlike other BSD systems,
|
||||
// we issue a "disconnectx" call (a few lines above),
|
||||
// which isn't expected to return this error code.
|
||||
if (rv < 0 && errno == EADDRNOTAVAIL)
|
||||
rv = errno = 0;
|
||||
#elif defined(_AIX)
|
||||
|
||||
3
src/java.base/windows/classes/sun/nio/fs/WindowsDirectoryStream.java
Normal file → Executable file
3
src/java.base/windows/classes/sun/nio/fs/WindowsDirectoryStream.java
Normal file → Executable file
@@ -179,6 +179,9 @@ class WindowsDirectoryStream
|
||||
int nextEntryOffset = WindowsFileAttributes.getNextOffsetFromFileDirInformation(
|
||||
queryDirectoryInformation, dirInformationAddress);
|
||||
nextOffset = nextEntryOffset == 0 ? -1 : nextOffset + nextEntryOffset;
|
||||
if (nextOffset > NATIVE_BUFFER_SIZE - WindowsFileAttributes.SIZEOF_FILE_DIRECTORY_INFORMATION) {
|
||||
throw new DirectoryIteratorException(new IOException("NextNtQueryDirectoryInformation() provided bad offset " + nextEntryOffset));
|
||||
}
|
||||
name = WindowsFileAttributes.getFileNameFromFileDirInformation(
|
||||
queryDirectoryInformation, dirInformationAddress);
|
||||
if (isSelfOrParent(name)) {
|
||||
|
||||
@@ -165,6 +165,9 @@ class WindowsFileAttributes
|
||||
private static final int OFFSETOF_DIR_INFO_FILENAME_LENGTH = 60;
|
||||
private static final int OFFSETOF_DIR_INFO_FILENAME = 64;
|
||||
|
||||
// Minimum sane size of either _FILE_DIRECTORY_INFORMATION or _FILE_ID_FULL_DIR_INFORMATION
|
||||
public static final int SIZEOF_FILE_DIRECTORY_INFORMATION = 65;
|
||||
|
||||
// used to adjust values between Windows and java epoch
|
||||
private static final long WINDOWS_EPOCH_IN_MICROSECONDS = -11644473600000000L;
|
||||
|
||||
|
||||
@@ -164,14 +164,9 @@ class WindowsPathParser {
|
||||
int len = path.length();
|
||||
off = nextNonSlash(path, off, len);
|
||||
int start = off;
|
||||
char lastC = 0;
|
||||
while (off < len) {
|
||||
char c = path.charAt(off);
|
||||
if (isSlash(c)) {
|
||||
if (lastC == ' ')
|
||||
throw new InvalidPathException(path,
|
||||
"Trailing char <" + lastC + ">",
|
||||
off - 1);
|
||||
sb.append(path, start, off);
|
||||
off = nextNonSlash(path, off, len);
|
||||
if (off != len) //no slash at the end of normalized path
|
||||
@@ -182,15 +177,10 @@ class WindowsPathParser {
|
||||
throw new InvalidPathException(path,
|
||||
"Illegal char <" + c + ">",
|
||||
off);
|
||||
lastC = c;
|
||||
off++;
|
||||
}
|
||||
}
|
||||
if (start != off) {
|
||||
if (lastC == ' ')
|
||||
throw new InvalidPathException(path,
|
||||
"Trailing char <" + lastC + ">",
|
||||
off - 1);
|
||||
sb.append(path, start, off);
|
||||
}
|
||||
return sb.toString();
|
||||
|
||||
@@ -63,19 +63,19 @@ static boolean SetupI18nProps(LCID lcid, char** language, char** script, char**
|
||||
static char *
|
||||
getEncodingInternal(LCID lcid)
|
||||
{
|
||||
int codepage;
|
||||
int codepage = 0;
|
||||
char * ret = malloc(16);
|
||||
if (ret == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (GetLocaleInfo(lcid,
|
||||
if (lcid == 0) { // for sun.jnu.encoding
|
||||
codepage = GetACP();
|
||||
_itoa_s(codepage, ret + 2, 14, 10);
|
||||
} else if (GetLocaleInfo(lcid,
|
||||
LOCALE_IDEFAULTANSICODEPAGE,
|
||||
ret+2, 14) == 0) {
|
||||
codepage = 1252;
|
||||
strcpy(ret+2, "1252");
|
||||
} else {
|
||||
codepage = atoi(ret+2);
|
||||
ret + 2, 14) != 0) {
|
||||
codepage = atoi(ret + 2);
|
||||
}
|
||||
|
||||
switch (codepage) {
|
||||
@@ -660,7 +660,6 @@ GetJavaProperties(JNIEnv* env)
|
||||
* (which is a Windows LCID value),
|
||||
*/
|
||||
LCID userDefaultLCID = GetUserDefaultLCID();
|
||||
LCID systemDefaultLCID = GetSystemDefaultLCID();
|
||||
LANGID userDefaultUILang = GetUserDefaultUILanguage();
|
||||
LCID userDefaultUILCID = MAKELCID(userDefaultUILang, SORTIDFROMLCID(userDefaultLCID));
|
||||
|
||||
@@ -693,7 +692,10 @@ GetJavaProperties(JNIEnv* env)
|
||||
&sprops.display_variant,
|
||||
&display_encoding);
|
||||
|
||||
sprops.sun_jnu_encoding = getEncodingInternal(systemDefaultLCID);
|
||||
sprops.sun_jnu_encoding = getEncodingInternal(0);
|
||||
if (sprops.sun_jnu_encoding == NULL) {
|
||||
sprops.sun_jnu_encoding = "UTF-8";
|
||||
}
|
||||
if (LANGIDFROMLCID(userDefaultLCID) == 0x0c04 && majorVersion == 6) {
|
||||
// MS claims "Vista has built-in support for HKSCS-2004.
|
||||
// All of the HKSCS-2004 characters have Unicode 4.1.
|
||||
|
||||
@@ -57,6 +57,7 @@ import java.util.List;
|
||||
import com.jetbrains.desktop.JBRFileDialog;
|
||||
import sun.awt.AWTAccessor;
|
||||
import sun.java2d.pipe.Region;
|
||||
import sun.lwawt.LWWindowPeer;
|
||||
import sun.security.action.GetBooleanAction;
|
||||
|
||||
import static com.jetbrains.desktop.JBRFileDialog.*;
|
||||
@@ -90,7 +91,16 @@ class CFileDialog implements FileDialogPeer {
|
||||
title = " ";
|
||||
}
|
||||
|
||||
String[] userFileNames = nativeRunFileDialog(title,
|
||||
Window owner = target.getOwner();
|
||||
|
||||
long ownerPtr = owner == null ?
|
||||
0L :
|
||||
((CPlatformWindow) ((LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner))
|
||||
.getPlatformWindow()).executeGet(ptr -> ptr);
|
||||
|
||||
String[] userFileNames = nativeRunFileDialog(
|
||||
ownerPtr,
|
||||
title,
|
||||
dialogMode,
|
||||
target.isMultipleMode(),
|
||||
navigateApps,
|
||||
@@ -105,7 +115,7 @@ class CFileDialog implements FileDialogPeer {
|
||||
String file = null;
|
||||
File[] files = null;
|
||||
|
||||
if (userFileNames != null) {
|
||||
if (userFileNames != null && userFileNames.length > 0) {
|
||||
// the dialog wasn't cancelled
|
||||
int filesNumber = userFileNames.length;
|
||||
files = new File[filesNumber];
|
||||
@@ -180,7 +190,7 @@ class CFileDialog implements FileDialogPeer {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private native String[] nativeRunFileDialog(String title, int mode,
|
||||
private native String[] nativeRunFileDialog(long ownerPtr, String title, int mode,
|
||||
boolean multipleMode, boolean shouldNavigateApps,
|
||||
boolean canChooseDirectories, boolean canChooseFiles,
|
||||
boolean canCreateDirectories, boolean hasFilenameFilter,
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.awt.Insets;
|
||||
|
||||
import sun.lwawt.PlatformComponent;
|
||||
import sun.lwawt.PlatformWindow;
|
||||
import sun.lwawt.LWWindowPeer;
|
||||
|
||||
/**
|
||||
* On OSX {@code CPlatformComponent} stores pointer to the native CAlayer which
|
||||
@@ -63,7 +64,8 @@ class CPlatformComponent extends CFRetainedResource
|
||||
public void setBounds(final int x, final int y, final int w, final int h) {
|
||||
// translates values from the coordinate system of the top-level window
|
||||
// to the coordinate system of the content view
|
||||
final Insets insets = platformWindow.getPeer().getInsets();
|
||||
final LWWindowPeer peer = platformWindow.getPeer();
|
||||
final Insets insets = (peer != null) ? peer.getInsets() : new Insets(0, 0, 0, 0);
|
||||
execute(ptr->nativeSetBounds(ptr, x - insets.left, y - insets.top, w, h));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
public class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
|
||||
private native long nativeCreateNSWindow(long nsViewPtr,long ownerPtr, long styleBits, double x, double y, double w, double h);
|
||||
private native long nativeCreateNSWindow(long nsViewPtr,long ownerPtr, long styleBits, double x, double y, double w, double h, double transparentTitleBarHeight);
|
||||
private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data);
|
||||
private static native void nativeSetNSWindowAppearance(long nsWindowPtr, String appearanceName);
|
||||
private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr);
|
||||
@@ -292,6 +292,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
new Property<CPlatformWindow>(WINDOW_TRANSPARENT_TITLE_BAR_HEIGHT) {
|
||||
public void applyProperty(final CPlatformWindow c, final Object value) {
|
||||
if (value != null && (value instanceof Float)) {
|
||||
boolean enabled = (float) value != 0f;
|
||||
c.setStyleBits(FULL_WINDOW_CONTENT, enabled);
|
||||
c.setStyleBits(TRANSPARENT_TITLE_BAR, enabled);
|
||||
c.setStyleBits(TITLE_VISIBLE, !enabled);
|
||||
c.execute(ptr -> AWTThreading.executeWaitToolkit(wait -> nativeSetTransparentTitleBarHeight(ptr, (float) value)));
|
||||
}
|
||||
}
|
||||
@@ -362,6 +366,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
responder = createPlatformResponder();
|
||||
contentView.initialize(peer, responder);
|
||||
|
||||
float transparentTitleBarHeight = getTransparentTitleBarHeight(_target);
|
||||
|
||||
Rectangle bounds;
|
||||
if (!IS(DECORATED, styleBits)) {
|
||||
// For undecorated frames the move/resize event does not come if the frame is centered on the screen
|
||||
@@ -382,7 +388,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
+ ", bounds=" + bounds);
|
||||
}
|
||||
long windowPtr = createNSWindow(viewPtr, ownerPtr, styleBits,
|
||||
bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
bounds.x, bounds.y, bounds.width, bounds.height, transparentTitleBarHeight);
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("window created: " + Long.toHexString(windowPtr));
|
||||
}
|
||||
@@ -397,7 +403,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
+ ", bounds=" + bounds);
|
||||
}
|
||||
long windowPtr = createNSWindow(viewPtr, 0, styleBits,
|
||||
bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
bounds.x, bounds.y, bounds.width, bounds.height, transparentTitleBarHeight);
|
||||
if (logger.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
logger.fine("window created: " + Long.toHexString(windowPtr));
|
||||
}
|
||||
@@ -559,6 +565,14 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
if (prop != null) {
|
||||
styleBits = SET(styleBits, TITLE_VISIBLE, Boolean.parseBoolean(prop.toString()));
|
||||
}
|
||||
|
||||
prop = rootpane.getClientProperty(WINDOW_TRANSPARENT_TITLE_BAR_HEIGHT);
|
||||
if (prop != null) {
|
||||
boolean enabled = Float.parseFloat(prop.toString()) != 0f;
|
||||
styleBits = SET(styleBits, FULL_WINDOW_CONTENT, enabled);
|
||||
styleBits = SET(styleBits, TRANSPARENT_TITLE_BAR, enabled);
|
||||
styleBits = SET(styleBits, TITLE_VISIBLE, !enabled);
|
||||
}
|
||||
}
|
||||
|
||||
if (isDialog) {
|
||||
@@ -978,6 +992,14 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
return ref.get();
|
||||
}
|
||||
|
||||
private boolean isTabbedWindow() {
|
||||
AtomicBoolean ref = new AtomicBoolean();
|
||||
execute(ptr -> {
|
||||
ref.set(CWrapper.NSWindow.isTabbedWindow(ptr));
|
||||
});
|
||||
return ref.get();
|
||||
}
|
||||
|
||||
// We want a window to be always shown at the same space as its owning window.
|
||||
// But macOS doesn't have an API to control the target space for a window -
|
||||
// it's always shown at the active space. So if the target space isn't active now,
|
||||
@@ -1345,7 +1367,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
// which is going to become 'main window', are placed above their siblings.
|
||||
CPlatformWindow rootOwner = getRootOwner();
|
||||
if (rootOwner.isVisible() && !rootOwner.isIconified() && !rootOwner.isActive()) {
|
||||
rootOwner.execute(CWrapper.NSWindow::orderFrontIfOnActiveSpace);
|
||||
if (rootOwner != this || !isTabbedWindow()) {
|
||||
rootOwner.execute(CWrapper.NSWindow::orderFrontIfOnActiveSpace);
|
||||
}
|
||||
}
|
||||
|
||||
// Do not order child windows of iconified owner.
|
||||
@@ -1427,8 +1451,16 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
return false;
|
||||
}
|
||||
|
||||
private long createNSWindow(long nsViewPtr,long ownerPtr, long styleBits, double x, double y, double w, double h) {
|
||||
return AWTThreading.executeWaitToolkit(() -> nativeCreateNSWindow(nsViewPtr, ownerPtr, styleBits, x, y, w, h));
|
||||
private long createNSWindow(long nsViewPtr,
|
||||
long ownerPtr,
|
||||
long styleBits,
|
||||
double x,
|
||||
double y,
|
||||
double w,
|
||||
double h,
|
||||
double transparentTitleBarHeight) {
|
||||
return AWTThreading.executeWaitToolkit(() ->
|
||||
nativeCreateNSWindow(nsViewPtr, ownerPtr, styleBits, x, y, w, h, transparentTitleBarHeight));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -1462,20 +1494,24 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
isFullScreenAnimationOn = false;
|
||||
}
|
||||
|
||||
// JBR API internals
|
||||
private static void setCustomDecorationTitleBarHeight(Window target, ComponentPeer peer, float height) {
|
||||
if (peer instanceof LWComponentPeer) {
|
||||
PlatformWindow platformWindow = ((LWComponentPeer<?, ?>) peer).getPlatformWindow();
|
||||
if (platformWindow instanceof CPlatformWindow) {
|
||||
((CPlatformWindow) platformWindow).execute(ptr -> {
|
||||
AWTThreading.executeWaitToolkit(wait -> nativeSetTransparentTitleBarHeight(ptr, height));
|
||||
});
|
||||
if (target instanceof javax.swing.RootPaneContainer) {
|
||||
final javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane();
|
||||
if (rootpane != null) rootpane.putClientProperty(WINDOW_TRANSPARENT_TITLE_BAR_HEIGHT, height);
|
||||
private float getTransparentTitleBarHeight(Window target) {
|
||||
if (target instanceof javax.swing.RootPaneContainer) {
|
||||
final javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane();
|
||||
if (rootpane != null) {
|
||||
Object transparentTitleBarHeightProperty = rootpane.getClientProperty(WINDOW_TRANSPARENT_TITLE_BAR_HEIGHT);
|
||||
if (transparentTitleBarHeightProperty != null) {
|
||||
return Float.parseFloat(transparentTitleBarHeightProperty.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0f;
|
||||
}
|
||||
|
||||
// JBR API internals
|
||||
private static void setCustomDecorationTitleBarHeight(Window target, ComponentPeer peer, float height) {
|
||||
if (target instanceof javax.swing.RootPaneContainer) {
|
||||
final javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane();
|
||||
if (rootpane != null) rootpane.putClientProperty(WINDOW_TRANSPARENT_TITLE_BAR_HEIGHT, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2022, 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
|
||||
@@ -175,9 +175,9 @@ final class CRobot implements RobotPeer {
|
||||
*/
|
||||
@Override
|
||||
public int getRGBPixel(int x, int y) {
|
||||
int[] c = new int[1];
|
||||
double scale = fDevice.getScaleFactor();
|
||||
getScreenPixels(new Rectangle(x, y, (int) scale, (int) scale), c);
|
||||
int scale = fDevice.getScaleFactor();
|
||||
int[] c = new int[scale * scale];
|
||||
getScreenPixels(new Rectangle(x, y, scale, scale), c);
|
||||
return c[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -105,6 +105,8 @@ final class CWrapper {
|
||||
static native void zoom(long window);
|
||||
|
||||
static native void makeFirstResponder(long window, long responder);
|
||||
|
||||
static native boolean isTabbedWindow(long window);
|
||||
}
|
||||
|
||||
static final class NSView {
|
||||
|
||||
@@ -50,9 +50,6 @@
|
||||
NSWindowTabbingMode javaWindowTabbingMode;
|
||||
BOOL isEnterFullScreen;
|
||||
CGFloat _transparentTitleBarHeight;
|
||||
id<NSObject> _windowWillEnterFullScreenNotification;
|
||||
id<NSObject> _windowWillExitFullScreenNotification;
|
||||
id<NSObject> _windowDidExitFullScreenNotification;
|
||||
NSMutableArray* _transparentTitleBarConstraints;
|
||||
NSLayoutConstraint *_transparentTitleBarHeightConstraint;
|
||||
NSMutableArray *_transparentTitleBarButtonCenterXConstraints;
|
||||
|
||||
@@ -416,7 +416,7 @@ AWT_NS_WINDOW_IMPLEMENTATION
|
||||
}
|
||||
|
||||
if (IS(mask, TITLE_VISIBLE) && [self.nsWindow respondsToSelector:@selector(setTitleVisibility:)]) {
|
||||
[self.nsWindow setTitleVisibility:(IS(bits, TITLE_VISIBLE)) ? NSWindowTitleVisible :NSWindowTitleHidden];
|
||||
[self.nsWindow setTitleVisibility:(IS(bits, TITLE_VISIBLE) ? NSWindowTitleVisible : NSWindowTitleHidden)];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -426,6 +426,7 @@ AWT_NS_WINDOW_IMPLEMENTATION
|
||||
styleBits:(jint)bits
|
||||
frameRect:(NSRect)rect
|
||||
contentView:(NSView *)view
|
||||
transparentTitleBarHeight:(CGFloat)transparentTitleBarHeight
|
||||
{
|
||||
AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
@@ -486,6 +487,11 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
self.nsWindow.collectionBehavior = NSWindowCollectionBehaviorManaged;
|
||||
self.isEnterFullScreen = NO;
|
||||
|
||||
_transparentTitleBarHeight = transparentTitleBarHeight;
|
||||
if (transparentTitleBarHeight != 0.0 && !self.isFullScreen) {
|
||||
[self setUpTransparentTitleBar];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -1115,12 +1121,21 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) isTransparentTitleBarEnabled
|
||||
{
|
||||
return _transparentTitleBarHeight != 0.0;
|
||||
}
|
||||
|
||||
- (void)windowWillEnterFullScreen:(NSNotification *)notification {
|
||||
[self fullScreenTransitionStarted];
|
||||
[self allowMovingChildrenBetweenSpaces:YES];
|
||||
|
||||
self.isEnterFullScreen = YES;
|
||||
|
||||
if ([self isTransparentTitleBarEnabled]) {
|
||||
[self resetTitleBar];
|
||||
}
|
||||
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
GET_CPLATFORM_WINDOW_CLASS();
|
||||
DECLARE_METHOD(jm_windowWillEnterFullScreen, jc_CPlatformWindow, "windowWillEnterFullScreen", "()V");
|
||||
@@ -1157,6 +1172,10 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
[self fullScreenTransitionStarted];
|
||||
|
||||
if ([self isTransparentTitleBarEnabled]) {
|
||||
[self setWindowControlsHidden:YES];
|
||||
}
|
||||
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
GET_CPLATFORM_WINDOW_CLASS();
|
||||
DECLARE_METHOD(jm_windowWillExitFullScreen, jc_CPlatformWindow, "windowWillExitFullScreen", "()V");
|
||||
@@ -1179,6 +1198,11 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
[self fullScreenTransitionFinished];
|
||||
|
||||
if ([self isTransparentTitleBarEnabled]) {
|
||||
[self setUpTransparentTitleBar];
|
||||
[self setWindowControlsHidden:NO];
|
||||
}
|
||||
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
jobject platformWindow = (*env)->NewLocalRef(env, self.javaPlatformWindow);
|
||||
if (platformWindow != NULL) {
|
||||
@@ -1318,7 +1342,8 @@ static const CGFloat DefaultHorizontalTitleBarButtonOffset = 20.0;
|
||||
AWTWindowDragView* windowDragView = [[AWTWindowDragView alloc] initWithPlatformWindow:self.javaPlatformWindow];
|
||||
[titlebar addSubview:windowDragView positioned:NSWindowBelow relativeTo:closeButtonView];
|
||||
|
||||
for (NSView* view in @[titlebar, windowDragView])
|
||||
NSArray* viewsToStretch = [titlebarContainer.subviews arrayByAddingObject:windowDragView];
|
||||
for (NSView* view in viewsToStretch)
|
||||
{
|
||||
view.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[_transparentTitleBarConstraints addObjectsFromArray:@[
|
||||
@@ -1329,12 +1354,16 @@ static const CGFloat DefaultHorizontalTitleBarButtonOffset = 20.0;
|
||||
]];
|
||||
}
|
||||
|
||||
for(NSView* view in titlebar.subviews)
|
||||
{
|
||||
view.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
}
|
||||
|
||||
CGFloat shrinkingFactor = [self getTransparentTitleBarButtonShrinkingFactor];
|
||||
CGFloat horizontalButtonOffset = shrinkingFactor * DefaultHorizontalTitleBarButtonOffset;
|
||||
_transparentTitleBarButtonCenterXConstraints = [[NSMutableArray alloc] initWithCapacity:3];
|
||||
[@[closeButtonView, miniaturizeButtonView, zoomButtonView] enumerateObjectsUsingBlock:^(NSView* button, NSUInteger index, BOOL* stop)
|
||||
{
|
||||
button.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
NSLayoutConstraint* buttonCenterXConstraint = [button.centerXAnchor constraintEqualToAnchor:titlebarContainer.leftAnchor constant:(_transparentTitleBarHeight/2.0 + (index * horizontalButtonOffset))];
|
||||
[_transparentTitleBarButtonCenterXConstraints addObject:buttonCenterXConstraint];
|
||||
[_transparentTitleBarConstraints addObjectsFromArray:@[
|
||||
@@ -1375,7 +1404,7 @@ static const CGFloat DefaultHorizontalTitleBarButtonOffset = 20.0;
|
||||
[NSLayoutConstraint deactivateConstraints:_transparentTitleBarConstraints];
|
||||
|
||||
AWTWindowDragView* windowDragView;
|
||||
for (NSView* view in titlebar.subviews) {
|
||||
for (NSView* view in [titlebar.subviews arrayByAddingObjectsFromArray:titlebarContainer.subviews]) {
|
||||
if ([view isMemberOfClass:[AWTWindowDragView class]]) {
|
||||
windowDragView = view;
|
||||
}
|
||||
@@ -1403,62 +1432,28 @@ static const CGFloat DefaultHorizontalTitleBarButtonOffset = 20.0;
|
||||
return (masks & NSWindowStyleMaskFullScreen) != 0;
|
||||
}
|
||||
|
||||
- (void) configureWindowAndListenersForTransparentTitleBar
|
||||
{
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
[self.nsWindow setTitlebarAppearsTransparent:YES];
|
||||
[self.nsWindow setTitleVisibility:NSWindowTitleHidden];
|
||||
[self.nsWindow setStyleMask:[self.nsWindow styleMask]|NSWindowStyleMaskFullSizeContentView];
|
||||
|
||||
if (!self.isFullScreen) {
|
||||
[self setUpTransparentTitleBar];
|
||||
}
|
||||
});
|
||||
NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter];
|
||||
NSOperationQueue* mainQueue = [NSOperationQueue mainQueue];
|
||||
_windowWillEnterFullScreenNotification = [defaultCenter addObserverForName:NSWindowWillEnterFullScreenNotification object:self.nsWindow queue:mainQueue usingBlock:^(NSNotification* notification) {
|
||||
[self resetTitleBar];
|
||||
}];
|
||||
_windowWillExitFullScreenNotification = [defaultCenter addObserverForName:NSWindowWillExitFullScreenNotification object:self.nsWindow queue:mainQueue usingBlock:^(NSNotification* notification) {
|
||||
[self setWindowControlsHidden:YES];
|
||||
}];
|
||||
_windowDidExitFullScreenNotification = [defaultCenter addObserverForName:NSWindowDidExitFullScreenNotification object:self.nsWindow queue:mainQueue usingBlock:^(NSNotification* notification) {
|
||||
[self setUpTransparentTitleBar];
|
||||
[self setWindowControlsHidden:NO];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void) configureWindowAndListenersForDefaultTitleBar
|
||||
{
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
[self.nsWindow setTitlebarAppearsTransparent:NO];
|
||||
[self.nsWindow setTitleVisibility:NSWindowTitleVisible];
|
||||
[self.nsWindow setStyleMask:[self.nsWindow styleMask]&(~NSWindowStyleMaskFullSizeContentView)];
|
||||
|
||||
if (!self.isFullScreen) {
|
||||
[self resetTitleBar];
|
||||
}
|
||||
});
|
||||
NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter];
|
||||
[defaultCenter removeObserver:_windowWillEnterFullScreenNotification];
|
||||
[defaultCenter removeObserver:_windowWillExitFullScreenNotification];
|
||||
[defaultCenter removeObserver:_windowDidExitFullScreenNotification];
|
||||
_windowWillEnterFullScreenNotification = _windowWillExitFullScreenNotification = _windowDidExitFullScreenNotification = nil;
|
||||
}
|
||||
|
||||
- (void) setTransparentTitleBarHeight: (CGFloat) transparentTitleBarHeight
|
||||
{
|
||||
if (_transparentTitleBarHeight == transparentTitleBarHeight) return;
|
||||
|
||||
if (_transparentTitleBarHeight != 0.0f) {
|
||||
_transparentTitleBarHeight = transparentTitleBarHeight;
|
||||
if (transparentTitleBarHeight == 0.0f) {
|
||||
[self configureWindowAndListenersForDefaultTitleBar];
|
||||
if (!self.isFullScreen) {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
[self resetTitleBar];
|
||||
});
|
||||
}
|
||||
} else if (_transparentTitleBarHeightConstraint != nil || _transparentTitleBarButtonCenterXConstraints != nil) {
|
||||
[self updateTransparentTitleBarConstraints];
|
||||
}
|
||||
} else {
|
||||
_transparentTitleBarHeight = transparentTitleBarHeight;
|
||||
[self configureWindowAndListenersForTransparentTitleBar];
|
||||
if (!self.isFullScreen) {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
[self setUpTransparentTitleBar];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1466,7 +1461,11 @@ static const CGFloat DefaultHorizontalTitleBarButtonOffset = 20.0;
|
||||
|
||||
@implementation AWTWindowDragView {
|
||||
CGFloat _accumulatedDragDelta;
|
||||
BOOL _draggingWindow;
|
||||
enum WindowDragState {
|
||||
NO_DRAG, // Mouse not dragging
|
||||
SKIP_DRAG, // Mouse dragging in non-draggable area
|
||||
DRAG, // Mouse is dragging window
|
||||
} _draggingWindow;
|
||||
}
|
||||
|
||||
- (id) initWithPlatformWindow:(jobject)javaPlatformWindow {
|
||||
@@ -1482,9 +1481,9 @@ static const CGFloat DefaultHorizontalTitleBarButtonOffset = 20.0;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)isInDraggableArea:(NSPoint)point
|
||||
- (jint)hitTestCustomDecoration:(NSPoint)point
|
||||
{
|
||||
BOOL returnValue = YES;
|
||||
jint returnValue = java_awt_Window_CustomWindowDecoration_NO_HIT_SPOT;
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
|
||||
jobject platformWindow = (*env)->NewLocalRef(env, self.javaPlatformWindow);
|
||||
if (platformWindow != NULL) {
|
||||
@@ -1496,8 +1495,7 @@ static const CGFloat DefaultHorizontalTitleBarButtonOffset = 20.0;
|
||||
if (awtWindow != NULL) {
|
||||
NSRect frame = [self.window frame];
|
||||
float windowHeight = frame.size.height;
|
||||
returnValue = (*env)->CallIntMethod(env, awtWindow, jm_hitTestCustomDecoration, (jint) point.x, (jint) (windowHeight - point.y)) ==
|
||||
(jint) java_awt_Window_CustomWindowDecoration_NO_HIT_SPOT ? YES : NO;
|
||||
returnValue = (*env)->CallIntMethod(env, awtWindow, jm_hitTestCustomDecoration, (jint) point.x, (jint) (windowHeight - point.y));
|
||||
CHECK_EXCEPTION();
|
||||
(*env)->DeleteLocalRef(env, awtWindow);
|
||||
}
|
||||
@@ -1508,6 +1506,7 @@ static const CGFloat DefaultHorizontalTitleBarButtonOffset = 20.0;
|
||||
|
||||
- (void)mouseDown:(NSEvent *)event
|
||||
{
|
||||
_draggingWindow = NO_DRAG;
|
||||
_accumulatedDragDelta = 0.0;
|
||||
// We don't follow the regular responder chain here since the native window swallows events in some cases
|
||||
[[self.window contentView] deliverJavaMouseEvent:event];
|
||||
@@ -1515,20 +1514,29 @@ static const CGFloat DefaultHorizontalTitleBarButtonOffset = 20.0;
|
||||
|
||||
- (void)mouseDragged:(NSEvent *)event
|
||||
{
|
||||
_accumulatedDragDelta += fabs(event.deltaX) + fabs(event.deltaY);
|
||||
BOOL shouldStartWindowDrag = !_draggingWindow && ( _accumulatedDragDelta > 4.0 || [self isInDraggableArea:event.locationInWindow]);
|
||||
if (shouldStartWindowDrag) {
|
||||
[self.window performWindowDragWithEvent:event];
|
||||
_draggingWindow = YES;
|
||||
if (_draggingWindow == NO_DRAG) {
|
||||
jint hitSpot = [self hitTestCustomDecoration:event.locationInWindow];
|
||||
switch (hitSpot) {
|
||||
case java_awt_Window_CustomWindowDecoration_DRAGGABLE_AREA:
|
||||
// Start drag only after 4px threshold inside DRAGGABLE_AREA
|
||||
if ((_accumulatedDragDelta += fabs(event.deltaX) + fabs(event.deltaY)) <= 4.0) break;
|
||||
case java_awt_Window_CustomWindowDecoration_NO_HIT_SPOT:
|
||||
[self.window performWindowDragWithEvent:event];
|
||||
_draggingWindow = DRAG;
|
||||
break;
|
||||
default:
|
||||
_draggingWindow = SKIP_DRAG;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)mouseUp:(NSEvent *)event
|
||||
{
|
||||
if (_draggingWindow) {
|
||||
_draggingWindow = NO;
|
||||
if (_draggingWindow == DRAG) {
|
||||
_draggingWindow = NO_DRAG;
|
||||
} else {
|
||||
if (event.clickCount == 2 && [self isInDraggableArea:event.locationInWindow]) {
|
||||
jint hitSpot = [self hitTestCustomDecoration:event.locationInWindow];
|
||||
if (event.clickCount == 2 && hitSpot == java_awt_Window_CustomWindowDecoration_NO_HIT_SPOT) {
|
||||
[self.window performZoom:nil];
|
||||
}
|
||||
|
||||
@@ -1561,10 +1569,10 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetAllowAutom
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_CPlatformWindow
|
||||
* Method: nativeCreateNSWindow
|
||||
* Signature: (JJIIII)J
|
||||
* Signature: (JJIDDDDD)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeCreateNSWindow
|
||||
(JNIEnv *env, jobject obj, jlong contentViewPtr, jlong ownerPtr, jlong styleBits, jdouble x, jdouble y, jdouble w, jdouble h)
|
||||
(JNIEnv *env, jobject obj, jlong contentViewPtr, jlong ownerPtr, jlong styleBits, jdouble x, jdouble y, jdouble w, jdouble h, jdouble transparentTitleBarHeight)
|
||||
{
|
||||
__block AWTWindow *window = nil;
|
||||
|
||||
@@ -1591,7 +1599,8 @@ JNI_COCOA_ENTER(env);
|
||||
ownerWindow:owner
|
||||
styleBits:styleBits
|
||||
frameRect:frameRect
|
||||
contentView:contentView];
|
||||
contentView:contentView
|
||||
transparentTitleBarHeight:(CGFloat)transparentTitleBarHeight];
|
||||
// the window is released is CPlatformWindow.nativeDispose()
|
||||
|
||||
if (window) {
|
||||
@@ -1683,8 +1692,8 @@ JNI_COCOA_EXIT(env);
|
||||
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_CPlatformWindow
|
||||
* Method: nativeSetNSWindowStyleBits
|
||||
* Signature: (JII)V
|
||||
* Method: nativeSetNSWindowAppearance
|
||||
* Signature: (JLjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowAppearance
|
||||
(JNIEnv *env, jclass clazz, jlong windowPtr, jstring appearanceName)
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface CFileDialog : NSObject <NSOpenSavePanelDelegate> {
|
||||
NSWindow* fOwner;
|
||||
|
||||
// Should we query back to Java for a file filter?
|
||||
jboolean fHasFileFilter;
|
||||
|
||||
@@ -65,7 +67,8 @@
|
||||
}
|
||||
|
||||
// Allocator
|
||||
- (id) initWithFilter:(jboolean)inHasFilter
|
||||
- (id) initWithOwner:(NSWindow*) owner
|
||||
filter:(jboolean)inHasFilter
|
||||
fileDialog:(jobject)inDialog
|
||||
title:(NSString *)inTitle
|
||||
directory:(NSString *)inPath
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#import "ThreadUtilities.h"
|
||||
#import "JNIUtilities.h"
|
||||
#import "CFileDialog.h"
|
||||
#import "AWTWindow.h"
|
||||
#import "CMenuBar.h"
|
||||
#import "ApplicationDelegate.h"
|
||||
|
||||
@@ -37,7 +38,8 @@
|
||||
|
||||
@implementation CFileDialog
|
||||
|
||||
- (id)initWithFilter:(jboolean)inHasFilter
|
||||
- (id)initWithOwner:(NSWindow*)owner
|
||||
filter:(jboolean)inHasFilter
|
||||
fileDialog:(jobject)inDialog
|
||||
title:(NSString *)inTitle
|
||||
directory:(NSString *)inPath
|
||||
@@ -50,7 +52,9 @@ canChooseDirectories:(BOOL)inChooseDirectories
|
||||
canCreateDirectories:(BOOL)inCreateDirectories
|
||||
withEnv:(JNIEnv*)env;
|
||||
{
|
||||
if (self = [super init]) {
|
||||
if (self = [super init]) {
|
||||
fOwner = owner;
|
||||
[fOwner retain];
|
||||
fHasFileFilter = inHasFilter;
|
||||
fFileDialog = (*env)->NewGlobalRef(env, inDialog);
|
||||
fDirectory = inPath;
|
||||
@@ -92,6 +96,9 @@ canCreateDirectories:(BOOL)inCreateDirectories
|
||||
[fURLs release];
|
||||
fURLs = nil;
|
||||
|
||||
[fOwner release];
|
||||
fOwner = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -149,10 +156,55 @@ canCreateDirectories:(BOOL)inCreateDirectories
|
||||
[editMenuItem release];
|
||||
}
|
||||
|
||||
fPanelResult = [thePanel runModalForDirectory:fDirectory file:fFile];
|
||||
[thePanel setDelegate:nil];
|
||||
CMenuBar *menuBar = [[ApplicationDelegate sharedDelegate] defaultMenuBar];
|
||||
[CMenuBar activate:menuBar modallyDisabled:NO];
|
||||
|
||||
if (fOwner != nil) {
|
||||
if (fDirectory != nil) {
|
||||
[thePanel setDirectoryURL:[NSURL fileURLWithPath:[fDirectory stringByExpandingTildeInPath]]];
|
||||
}
|
||||
|
||||
if (fFile != nil) {
|
||||
[thePanel setNameFieldStringValue:fFile];
|
||||
}
|
||||
|
||||
CMenuBar *menuBar = nil;
|
||||
if (fOwner != nil) {
|
||||
|
||||
// Finds appropriate menubar in our hierarchy,
|
||||
AWTWindow *awtWindow = (AWTWindow *)fOwner.delegate;
|
||||
while (awtWindow.ownerWindow != nil) {
|
||||
awtWindow = awtWindow.ownerWindow;
|
||||
}
|
||||
|
||||
BOOL isDisabled = NO;
|
||||
if ([awtWindow.nsWindow isVisible]){
|
||||
menuBar = awtWindow.javaMenuBar;
|
||||
isDisabled = !awtWindow.isEnabled;
|
||||
}
|
||||
|
||||
if (menuBar == nil) {
|
||||
menuBar = [[ApplicationDelegate sharedDelegate] defaultMenuBar];
|
||||
isDisabled = NO;
|
||||
}
|
||||
|
||||
[CMenuBar activate:menuBar modallyDisabled:isDisabled];
|
||||
}
|
||||
|
||||
if (@available(macOS 10.14, *)) {
|
||||
[thePanel setAppearance:fOwner.appearance];
|
||||
}
|
||||
|
||||
fPanelResult = [thePanel runModal];
|
||||
|
||||
if (menuBar != nil) {
|
||||
[CMenuBar activate:menuBar modallyDisabled:NO];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fPanelResult = [thePanel runModalForDirectory:fDirectory file:fFile];
|
||||
CMenuBar *menuBar = [[ApplicationDelegate sharedDelegate] defaultMenuBar];
|
||||
[CMenuBar activate:menuBar modallyDisabled:NO];
|
||||
}
|
||||
|
||||
if (editMenuItem != nil) {
|
||||
[menu removeItem:editMenuItem];
|
||||
@@ -167,6 +219,8 @@ canCreateDirectories:(BOOL)inCreateDirectories
|
||||
}
|
||||
[fURLs retain];
|
||||
}
|
||||
|
||||
[thePanel setDelegate:nil];
|
||||
}
|
||||
|
||||
[self disposer];
|
||||
@@ -234,7 +288,7 @@ canCreateDirectories:(BOOL)inCreateDirectories
|
||||
}
|
||||
|
||||
- (BOOL) userClickedOK {
|
||||
return fPanelResult == NSOKButton;
|
||||
return fPanelResult == NSFileHandlingPanelOKButton;
|
||||
}
|
||||
|
||||
- (NSArray *)URLs {
|
||||
@@ -248,7 +302,7 @@ canCreateDirectories:(BOOL)inCreateDirectories
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
Java_sun_lwawt_macosx_CFileDialog_nativeRunFileDialog
|
||||
(JNIEnv *env, jobject peer, jstring title, jint mode, jboolean multipleMode,
|
||||
(JNIEnv *env, jobject peer, jlong ownerPtr, jstring title, jint mode, jboolean multipleMode,
|
||||
jboolean navigateApps, jboolean chooseDirectories, jboolean chooseFiles, jboolean createDirectories,
|
||||
jboolean hasFilter, jstring directory, jstring file)
|
||||
{
|
||||
@@ -260,7 +314,8 @@ JNI_COCOA_ENTER(env);
|
||||
dialogTitle = @" ";
|
||||
}
|
||||
|
||||
CFileDialog *dialogDelegate = [[CFileDialog alloc] initWithFilter:hasFilter
|
||||
CFileDialog *dialogDelegate = [[CFileDialog alloc] initWithOwner:(NSWindow *)jlong_to_ptr(ownerPtr)
|
||||
filter:hasFilter
|
||||
fileDialog:peer
|
||||
title:dialogTitle
|
||||
directory:JavaStringToNSString(env, directory)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2022, 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
|
||||
@@ -360,6 +360,11 @@ Java_sun_lwawt_macosx_CRobot_nativeGetScreenPixels
|
||||
jint picY = y;
|
||||
jint picWidth = width;
|
||||
jint picHeight = height;
|
||||
jsize size = (*env)->GetArrayLength(env, pixels);
|
||||
if (size < (long) picWidth * picHeight || picWidth < 0 || picHeight < 0) {
|
||||
JNU_ThrowInternalError(env, "Invalid arguments to get screen pixels");
|
||||
return;
|
||||
}
|
||||
|
||||
CGRect screenRect = CGRectMake(picX / scale, picY / scale,
|
||||
picWidth / scale, picHeight / scale);
|
||||
|
||||
@@ -517,6 +517,31 @@ JNI_COCOA_ENTER(env);
|
||||
JNI_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_CWrapper$NSWindow
|
||||
* Method: isTabbedWindow
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_lwawt_macosx_CWrapper_00024NSWindow_isTabbedWindow
|
||||
(JNIEnv *env, jclass cls, jlong windowPtr)
|
||||
{
|
||||
__block jboolean isTabbedWindow = JNI_FALSE;
|
||||
|
||||
JNI_COCOA_ENTER(env);
|
||||
|
||||
if (@available(macOS 10.13, *)) {
|
||||
NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
|
||||
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
|
||||
isTabbedWindow = [[[window tabGroup] windows] count] > 1;
|
||||
}];
|
||||
}
|
||||
|
||||
JNI_COCOA_EXIT(env);
|
||||
|
||||
return isTabbedWindow;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_CWrapper$NSView
|
||||
* Method: addSubview
|
||||
|
||||
@@ -473,7 +473,7 @@ bool isSystemShortcut_NextWindowInApplication(NSUInteger modifiersMask, NSString
|
||||
&& [chars isEqualToString:shortcutCharacter];
|
||||
}
|
||||
|
||||
void Java_java_awt_desktop_SystemHotkeyReader_readSystemHotkeys(JNIEnv* env, jobject reader) {
|
||||
JNIEXPORT void JNICALL Java_java_awt_desktop_SystemHotkeyReader_readSystemHotkeys(JNIEnv* env, jobject reader) {
|
||||
jclass clsReader = (*env)->GetObjectClass(env, reader);
|
||||
jmethodID methodAdd = (*env)->GetMethodID(env, clsReader, "add", "(ILjava/lang/String;ILjava/lang/String;)V");
|
||||
|
||||
@@ -489,7 +489,7 @@ void Java_java_awt_desktop_SystemHotkeyReader_readSystemHotkeys(JNIEnv* env, job
|
||||
);
|
||||
}
|
||||
|
||||
jint Java_java_awt_desktop_SystemHotkeyReader_osx2java(JNIEnv* env, jclass clazz, jint osxKeyCode) {
|
||||
JNIEXPORT jint JNICALL Java_java_awt_desktop_SystemHotkeyReader_osx2java(JNIEnv* env, jclass clazz, jint osxKeyCode) {
|
||||
static NSDictionary * osx2javaMap = nil;
|
||||
if (osx2javaMap == nil) {
|
||||
osx2javaMap = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@@ -619,7 +619,7 @@ jint Java_java_awt_desktop_SystemHotkeyReader_osx2java(JNIEnv* env, jclass clazz
|
||||
return java_awt_event_KeyEvent_VK_UNDEFINED;
|
||||
}
|
||||
|
||||
jstring Java_java_awt_desktop_SystemHotkey_osxKeyCodeDescription(JNIEnv* env, jclass clazz, jint osxKeyCode) {
|
||||
JNIEXPORT jstring JNICALL Java_java_awt_desktop_SystemHotkey_osxKeyCodeDescription(JNIEnv* env, jclass clazz, jint osxKeyCode) {
|
||||
static NSDictionary * osxCode2DescMap = nil;
|
||||
if (osxCode2DescMap == nil) {
|
||||
osxCode2DescMap = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
|
||||
@@ -614,8 +614,11 @@ static jobject sAccessibilityClass = NULL;
|
||||
[fActions setObject:action forKey:NSAccessibilityPickAction];
|
||||
[fActionSelectors addObject:[sActionSelectors objectForKey:NSAccessibilityPickAction]];
|
||||
} else {
|
||||
[fActions setObject:action forKey:[sActions objectForKey:[action getDescription]]];
|
||||
[fActionSelectors addObject:[sActionSelectors objectForKey:[sActions objectForKey:[action getDescription]]]];
|
||||
NSString *nsActionName = [sActions objectForKey:[action getDescription]];
|
||||
if (nsActionName != nil) {
|
||||
[fActions setObject:action forKey:nsActionName];
|
||||
[fActionSelectors addObject:[sActionSelectors objectForKey:nsActionName]];
|
||||
}
|
||||
}
|
||||
[action release];
|
||||
}
|
||||
|
||||
@@ -3190,6 +3190,9 @@ JNI_COCOA_ENTER(env);
|
||||
CTFontRef ctfont = (CTFontRef)nsFont;
|
||||
CFArrayRef tagsArray =
|
||||
CTFontCopyAvailableTables(ctfont, kCTFontTableOptionNoOptions);
|
||||
if (tagsArray == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
CFIndex numTags = CFArrayGetCount(tagsArray);
|
||||
for (i=0; i<numTags; i++) {
|
||||
if (tag ==
|
||||
|
||||
@@ -80,7 +80,9 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
|
||||
if (mtlc != NULL) {
|
||||
[mtlc.encoderManager endEncoder];
|
||||
|
||||
if (op == MTL_OP_RESET_PAINT || op == MTL_OP_SYNC || op == MTL_OP_SHAPE_CLIP_SPANS) {
|
||||
if (op == MTL_OP_RESET_PAINT || op == MTL_OP_SYNC || op == MTL_OP_SHAPE_CLIP_SPANS ||
|
||||
mtlPreviousOp == MTL_OP_MASK_OP)
|
||||
{
|
||||
MTLCommandBufferWrapper *cbwrapper = [mtlc pullCommandBufferWrapper];
|
||||
id <MTLCommandBuffer> commandbuf = [cbwrapper getCommandBuffer];
|
||||
[commandbuf addCompletedHandler:^(id <MTLCommandBuffer> commandbuf) {
|
||||
|
||||
@@ -183,8 +183,9 @@
|
||||
* or maybe a way for the app to continue running depending on the exact
|
||||
* nature of the problem that has been detected and how survivable it is.
|
||||
*/
|
||||
#define CHECK_EXCEPTION_IN_ENV(env) \
|
||||
if ((*(env))->ExceptionOccurred(env) != NULL) { \
|
||||
#define CHECK_EXCEPTION_IN_ENV(env) { \
|
||||
jthrowable exc = (*(env))->ExceptionOccurred(env); \
|
||||
if (exc != NULL) { \
|
||||
if ([NSThread isMainThread] == YES) { \
|
||||
if (getenv("JNU_APPKIT_TRACE")) { \
|
||||
(*(env))->ExceptionDescribe(env); \
|
||||
@@ -193,12 +194,14 @@
|
||||
(*(env))->ExceptionClear(env); \
|
||||
} \
|
||||
} \
|
||||
if (getenv("JNU_NO_COCOA_EXCEPTION") == NULL) { \
|
||||
[NSException raise:NSGenericException format:@"Java Exception"]; \
|
||||
if (getenv("JNU_NO_COCOA_EXCEPTION") == NULL) {\
|
||||
[NSException raise:NSGenericException \
|
||||
format:@"%@", ThrowableToNSString(env, exc)]; \
|
||||
} else { \
|
||||
(*(env))->ExceptionClear(env); \
|
||||
} \
|
||||
};
|
||||
} \
|
||||
};
|
||||
|
||||
#define CHECK_EXCEPTION() CHECK_EXCEPTION_IN_ENV(env)
|
||||
|
||||
@@ -249,4 +252,6 @@ JNIEXPORT NSString* NormalizedPathNSStringFromJavaString(JNIEnv *env, jstring pa
|
||||
|
||||
JNIEXPORT jstring NormalizedPathJavaStringFromNSString(JNIEnv* env, NSString *str);
|
||||
|
||||
JNIEXPORT NSString *ThrowableToNSString(JNIEnv *env, jthrowable exc);
|
||||
|
||||
#endif /* __JNIUTILITIES_H */
|
||||
|
||||
@@ -113,3 +113,41 @@ jstring NormalizedPathJavaStringFromNSString(JNIEnv* env, NSString *str) {
|
||||
NSString *normStr = [str precomposedStringWithCanonicalMapping];
|
||||
return NSStringToJavaString(env, normStr);
|
||||
}
|
||||
|
||||
NSString *ThrowableToNSString(JNIEnv *env, jthrowable exc) {
|
||||
(*env)->ExceptionClear(env);
|
||||
|
||||
if (JNU_IsInstanceOfByName(env, exc, "java/lang/OutOfMemoryError")) {
|
||||
static NSString* const OOMEDescr = @"OutOfMemoryError";
|
||||
return OOMEDescr;
|
||||
}
|
||||
|
||||
DECLARE_CLASS_RETURN(sjc_Object, "java/lang/Object", nil);
|
||||
DECLARE_METHOD_RETURN(jm_toString, sjc_Object, "toString", "()Ljava/lang/String;", nil);
|
||||
DECLARE_CLASS_RETURN(sjc_Throwable, "java/lang/Throwable", nil);
|
||||
DECLARE_METHOD_RETURN(jm_getStackTrace, sjc_Throwable, "getStackTrace",
|
||||
"()[Ljava/lang/StackTraceElement;", nil);
|
||||
jobject jstr = (*env)->CallObjectMethod(env, exc, jm_toString);
|
||||
|
||||
NSString* result = JavaStringToNSString(env, jstr);
|
||||
|
||||
jobjectArray frames =
|
||||
(jobjectArray) (*env)->CallObjectMethod(env, exc, jm_getStackTrace);
|
||||
if (frames != NULL) {
|
||||
jsize framesLen = (*env)->GetArrayLength(env, frames);
|
||||
|
||||
for (int i = 0; i < framesLen; i++) {
|
||||
jobject stackElem = (*env)->GetObjectArrayElement(env, frames, i);
|
||||
jobject stackElemStr = (*env)->CallObjectMethod(env, stackElem, jm_toString);
|
||||
NSString *frameStr = JavaStringToNSString(env, stackElemStr);
|
||||
result = [result stringByAppendingFormat:@"\n%@", frameStr];
|
||||
(*env)->DeleteLocalRef(env, stackElem);
|
||||
(*env)->DeleteLocalRef(env, stackElemStr);
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, frames);
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, jstr);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -4033,11 +4033,14 @@ public class Window extends Container implements Accessible {
|
||||
MINIMIZE_BUTTON = 2,
|
||||
MAXIMIZE_BUTTON = 3,
|
||||
CLOSE_BUTTON = 4,
|
||||
MENU_BAR = 5;
|
||||
MENU_BAR = 5,
|
||||
DRAGGABLE_AREA = 6;
|
||||
|
||||
void setCustomDecorationEnabled(Window window, boolean enabled) {
|
||||
window.hasCustomDecoration = enabled;
|
||||
if (MacOS.INSTANCE != null && window.customDecorTitleBarHeight > 0f) {
|
||||
if (Win.INSTANCE != null) {
|
||||
Win.INSTANCE.updateCustomDecoration(window.peer);
|
||||
} else if (MacOS.INSTANCE != null && window.customDecorTitleBarHeight > 0f) {
|
||||
MacOS.INSTANCE.setTitleBarHeight(window, window.peer, enabled ? window.customDecorTitleBarHeight : 0);
|
||||
}
|
||||
}
|
||||
@@ -4064,6 +4067,12 @@ public class Window extends Container implements Accessible {
|
||||
return window.customDecorTitleBarHeight;
|
||||
}
|
||||
|
||||
private interface Win {
|
||||
Win INSTANCE = (Win) JBRApi.internalServiceBuilder(MethodHandles.lookup(), null)
|
||||
.withStatic("updateCustomDecoration", "sun.awt.windows.WFramePeer").build();
|
||||
void updateCustomDecoration(ComponentPeer peer);
|
||||
}
|
||||
|
||||
private interface MacOS {
|
||||
MacOS INSTANCE = (MacOS) JBRApi.internalServiceBuilder(MethodHandles.lookup(), null)
|
||||
.withStatic("setTitleBarHeight", "sun.lwawt.macosx.CPlatformWindow", "setCustomDecorationTitleBarHeight").build();
|
||||
|
||||
@@ -47,6 +47,7 @@ import java.util.Map;
|
||||
|
||||
import sun.awt.EmbeddedFrame;
|
||||
import sun.awt.OSInfo;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.swing.SwingAccessor;
|
||||
|
||||
import static javax.swing.ClientPropertyKey.PopupFactory_FORCE_HEAVYWEIGHT_POPUP;
|
||||
@@ -393,9 +394,13 @@ public class PopupFactory {
|
||||
}
|
||||
}
|
||||
|
||||
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
||||
if (popup == null ||
|
||||
((JWindow) popup.getComponent())
|
||||
.getFocusableWindowState() != focusPopup) {
|
||||
.getFocusableWindowState() != focusPopup ||
|
||||
(toolkit instanceof SunToolkit) &&
|
||||
(((SunToolkit) toolkit).popupMenusAreSpecial()) &&
|
||||
popup.isPopupMenu() != (contents instanceof JPopupMenu)) {
|
||||
|
||||
if(popup != null) {
|
||||
// The recycled popup can't serve us well
|
||||
@@ -419,6 +424,11 @@ public class PopupFactory {
|
||||
return popup;
|
||||
}
|
||||
|
||||
private boolean isPopupMenu() {
|
||||
Component[] components = ((JWindow) getComponent()).getContentPane().getComponents();
|
||||
return components.length == 1 && components[0] instanceof JPopupMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a previously disposed heavy weight <code>Popup</code>
|
||||
* associated with <code>window</code>. This will return null if
|
||||
|
||||
@@ -446,7 +446,11 @@ public class AWTThreading {
|
||||
synchronized (eventDispatchThreadStateNotifiers) {
|
||||
if (!isEventDispatchThreadFree) {
|
||||
eventDispatchThreadStateNotifiers.add(future);
|
||||
future.whenComplete((r, ex) -> eventDispatchThreadStateNotifiers.remove(future));
|
||||
future.whenComplete((r, ex) -> {
|
||||
synchronized (eventDispatchThreadStateNotifiers) {
|
||||
eventDispatchThreadStateNotifiers.remove(future);
|
||||
}
|
||||
});
|
||||
return future;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1992,6 +1992,10 @@ public abstract class SunToolkit extends Toolkit
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean popupMenusAreSpecial() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not a containing top level window for the passed
|
||||
* component is
|
||||
|
||||
@@ -415,6 +415,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
insets_corrected = true;
|
||||
reshape(dimensions, SET_SIZE, false);
|
||||
} else if (xe.get_parent() == root) {
|
||||
if (!isReparented()) {
|
||||
// X server on Windows (e.g. Cygwin/X) does perform a no-op reparenting to the root window
|
||||
return;
|
||||
}
|
||||
configure_seen = false;
|
||||
insets_corrected = false;
|
||||
|
||||
@@ -1209,7 +1213,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
|
||||
@Override
|
||||
boolean isOverrideRedirect() {
|
||||
return Window.Type.POPUP.equals(getWindowType());
|
||||
return Window.Type.POPUP.equals(getWindowType()) && !XWM.isKDE2();
|
||||
}
|
||||
|
||||
public boolean requestWindowFocus(long time, boolean timeProvided) {
|
||||
@@ -1225,6 +1229,11 @@ abstract class XDecoratedPeer extends XWindowPeer {
|
||||
Boolean.valueOf(target == focusedWindow));
|
||||
}
|
||||
|
||||
if (!ENABLE_MODAL_TRANSIENTS_CHAIN && modalBlocker != null) {
|
||||
((XBaseWindow)AWTAccessor.getComponentAccessor().getPeer(modalBlocker)).toFront();
|
||||
return false;
|
||||
}
|
||||
|
||||
XWindowPeer toFocus = this;
|
||||
while (toFocus.nextTransientFor != null) {
|
||||
toFocus = toFocus.nextTransientFor;
|
||||
|
||||
@@ -156,6 +156,95 @@ public class XInputMethod extends X11InputMethod {
|
||||
return peer.getContentWindow();
|
||||
}
|
||||
|
||||
|
||||
static void onXKeyEventFiltering(final boolean isXKeyEventFiltered) {
|
||||
// Fix of JBR-1573, JBR-2444, JBR-4394 (a.k.a. IDEA-246833).
|
||||
// Input method is considered broken if and only if all the following statements are true:
|
||||
// * XFilterEvent have filtered more than filteredEventsThreshold last events of types KeyPress, KeyRelease;
|
||||
// * Input method hasn't been changed (e.g. recreated);
|
||||
// * The input context is not in preedit state (XNPreeditStartCallback has been called but then XNPreeditDoneCallback - hasn't)
|
||||
|
||||
// The functionality is disabled
|
||||
if (BrokenImDetectionContext.EATEN_EVENTS_THRESHOLD < 1) {
|
||||
return;
|
||||
}
|
||||
// Must be called within AWT_LOCK
|
||||
if (!XToolkit.isAWTLockHeldByCurrentThread()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isXKeyEventFiltered) {
|
||||
final long nativeDataPtr = BrokenImDetectionContext.obtainCurrentXimNativeDataPtr();
|
||||
if (nativeDataPtr == 0) {
|
||||
++BrokenImDetectionContext.eatenKeyEventsCount;
|
||||
} else {
|
||||
final int isDuringPreediting = BrokenImDetectionContext.isDuringPreediting(nativeDataPtr);
|
||||
if (isDuringPreediting > 0) {
|
||||
BrokenImDetectionContext.eatenKeyEventsCount = 0;
|
||||
} else if (isDuringPreediting == 0) {
|
||||
++BrokenImDetectionContext.eatenKeyEventsCount;
|
||||
} else if (BrokenImDetectionContext.isCurrentXicPassive(nativeDataPtr)) {
|
||||
// Unfortunately for passive XIC (XIMPreeditNothing | XIMStatusNothing) we have no way to get know
|
||||
// whether the XIC is in preediting state or not, so we won't handle this case.
|
||||
BrokenImDetectionContext.eatenKeyEventsCount = 0;
|
||||
} else {
|
||||
++BrokenImDetectionContext.eatenKeyEventsCount;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
BrokenImDetectionContext.eatenKeyEventsCount = 0;
|
||||
}
|
||||
|
||||
if (BrokenImDetectionContext.eatenKeyEventsCount > BrokenImDetectionContext.EATEN_EVENTS_THRESHOLD) {
|
||||
BrokenImDetectionContext.eatenKeyEventsCount = 0;
|
||||
recreateAllXIC();
|
||||
}
|
||||
}
|
||||
|
||||
private static class BrokenImDetectionContext {
|
||||
static final int EATEN_EVENTS_THRESHOLD;
|
||||
|
||||
static int eatenKeyEventsCount = 0;
|
||||
|
||||
/**
|
||||
* @return pointer to X11InputMethodData
|
||||
*/
|
||||
static native long obtainCurrentXimNativeDataPtr();
|
||||
|
||||
/**
|
||||
* <0 - unknown
|
||||
* >0 - true
|
||||
* 0 - false
|
||||
*/
|
||||
static native int isDuringPreediting(long ximNativeDataPtr);
|
||||
|
||||
static native boolean isCurrentXicPassive(long ximNativeDataPtr);
|
||||
|
||||
|
||||
static {
|
||||
int eatenEventsThresholdInitializer = 7;
|
||||
final String eventsThresholdMode = System.getProperty("recreate.x11.input.method", "true");
|
||||
|
||||
if ("false".equals(eventsThresholdMode)) {
|
||||
eatenEventsThresholdInitializer = 0;
|
||||
} else if (!"true".equals(eventsThresholdMode)) {
|
||||
try {
|
||||
eatenEventsThresholdInitializer = Integer.parseInt(eventsThresholdMode);
|
||||
} catch (NumberFormatException err) {
|
||||
log.warning(
|
||||
"Invalid value of \"recreate.x11.input.method\" system property \"" +
|
||||
eventsThresholdMode +
|
||||
"\". Only \"true\", \"false\" and integer values are supported",
|
||||
err
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
EATEN_EVENTS_THRESHOLD = eatenEventsThresholdInitializer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Native methods
|
||||
*/
|
||||
|
||||
@@ -501,6 +501,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
|
||||
private static XMouseInfoPeer xPeer;
|
||||
|
||||
private static Boolean isXWayland;
|
||||
|
||||
static {
|
||||
initSecurityWarning();
|
||||
if (GraphicsEnvironment.isHeadless()) {
|
||||
@@ -1022,21 +1024,28 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (keyEventLog.isLoggable(PlatformLogger.Level.FINE) && (
|
||||
ev.get_type() == XConstants.KeyPress
|
||||
|| ev.get_type() == XConstants.KeyRelease)) {
|
||||
|
||||
final boolean isKeyEvent = ( (ev.get_type() == XConstants.KeyPress) ||
|
||||
(ev.get_type() == XConstants.KeyRelease) );
|
||||
|
||||
if (keyEventLog.isLoggable(PlatformLogger.Level.FINE) && isKeyEvent) {
|
||||
keyEventLog.fine("before XFilterEvent:" + ev);
|
||||
}
|
||||
if (XlibWrapper.XFilterEvent(ev.getPData(), w)) {
|
||||
if (isKeyEvent) {
|
||||
XInputMethod.onXKeyEventFiltering(true);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (keyEventLog.isLoggable(PlatformLogger.Level.FINE) && (
|
||||
ev.get_type() == XConstants.KeyPress
|
||||
|| ev.get_type() == XConstants.KeyRelease)) {
|
||||
if (keyEventLog.isLoggable(PlatformLogger.Level.FINE) && isKeyEvent) {
|
||||
keyEventLog.fine(
|
||||
"after XFilterEvent:" + ev); // IS THIS CORRECT?
|
||||
}
|
||||
|
||||
if (isKeyEvent) {
|
||||
XInputMethod.onXKeyEventFiltering(false);
|
||||
}
|
||||
|
||||
dispatchEvent(ev);
|
||||
// free event data if XGetEventData was called
|
||||
XlibWrapper.XFreeEventData(getDisplay(), ev.pData);
|
||||
@@ -2920,6 +2929,11 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
return ((X11GraphicsConfig)gc).isTranslucencyCapable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean popupMenusAreSpecial() {
|
||||
return XWM.isKDE2();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of "sun.awt.disablegrab" property. Default
|
||||
* value is {@code false}.
|
||||
@@ -2929,6 +2943,13 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
return AccessController.doPrivileged(new GetBooleanAction("sun.awt.disablegrab"));
|
||||
}
|
||||
|
||||
static synchronized boolean isXWayland() {
|
||||
if (isXWayland == null) {
|
||||
isXWayland = getEnv("WAYLAND_DISPLAY") != null;
|
||||
}
|
||||
return isXWayland;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static final boolean useCachedInsets = Boolean.parseBoolean(AccessController.doPrivileged(
|
||||
new GetPropertyAction("x11.cache.screen.insets", "true")));
|
||||
|
||||
@@ -28,19 +28,12 @@ package sun.awt.X11;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.InvocationEvent;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
import java.awt.peer.WindowPeer;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import sun.awt.AWTAccessor;
|
||||
import sun.awt.AWTAccessor.ComponentAccessor;
|
||||
@@ -54,6 +47,9 @@ import sun.util.logging.PlatformLogger;
|
||||
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JWindow;
|
||||
|
||||
class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
DisplayChangedListener {
|
||||
|
||||
@@ -67,6 +63,8 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
= "true".equals(GetPropertyAction.privilegedGetProperty("reparenting.check"));
|
||||
private static final boolean ENABLE_DESKTOP_CHECK
|
||||
= "true".equals(GetPropertyAction.privilegedGetProperty("transients.desktop.check", "true"));
|
||||
static final boolean ENABLE_MODAL_TRANSIENTS_CHAIN
|
||||
= "true".equals(GetPropertyAction.privilegedGetProperty("modal.transients.chain"));
|
||||
|
||||
// should be synchronized on awtLock
|
||||
private static Set<XWindowPeer> windows = new HashSet<XWindowPeer>();
|
||||
@@ -934,6 +932,12 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
}
|
||||
handleWindowFocusOut(oppositeWindow, xfe.get_serial());
|
||||
}
|
||||
if (XToolkit.isXWayland() && XAwtState.getGrabWindow() != null) {
|
||||
// under XWayland, pointer grab doesn't give us ability to receive button events for native Wayland
|
||||
// windows, so the logic in handleButtonPressRelease method won't work, and we need this workaround
|
||||
// to cancel the grab on switching to another application
|
||||
postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1230,7 +1234,11 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
|
||||
@Override
|
||||
void setUserTimeBeforeShowing() {
|
||||
if (winAttr.initialFocus || shouldSuppressWmTakeFocus()) {
|
||||
if (XWM.getWMID() == XWM.KDE2_WM && isSimpleWindow() && ((Window)target).getType() == Window.Type.POPUP) {
|
||||
// Workaround, to suppress blinking of taskbar icon, when hover popup is displayed for a background window
|
||||
setUserTime(XToolkit.getCurrentServerTime(), false);
|
||||
}
|
||||
else if (winAttr.initialFocus || shouldSuppressWmTakeFocus()) {
|
||||
super.setUserTimeBeforeShowing();
|
||||
}
|
||||
else {
|
||||
@@ -1321,7 +1329,15 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
|
||||
boolean isOverrideRedirect() {
|
||||
return XWM.getWMID() == XWM.OPENLOOK_WM ||
|
||||
Window.Type.POPUP.equals(getWindowType());
|
||||
Window.Type.POPUP.equals(getWindowType()) && (!XWM.isKDE2() || isPopupMenuWindow());
|
||||
}
|
||||
|
||||
private boolean isPopupMenuWindow() {
|
||||
if (!(target instanceof JWindow)) return false;
|
||||
Container contentPane = ((JWindow) target).getContentPane();
|
||||
if (contentPane == null) return false;
|
||||
Component[] components = contentPane.getComponents();
|
||||
return components.length == 1 && components[0] instanceof JPopupMenu;
|
||||
}
|
||||
|
||||
final boolean isOLWMDecorBug() {
|
||||
@@ -1733,7 +1749,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
if (!allStates && (window.getWMState() != transientForWindow.getWMState())) {
|
||||
return;
|
||||
}
|
||||
if (screenOrDesktopDiffers(window, transientForWindow)) {
|
||||
if (ENABLE_MODAL_TRANSIENTS_CHAIN && screenOrDesktopDiffers(window, transientForWindow)) {
|
||||
return;
|
||||
}
|
||||
long bpw = window.getWindow();
|
||||
@@ -1888,6 +1904,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
|
||||
private void addToTransientFors(XDialogPeer blockerPeer, Vector<XWindowPeer> javaToplevels)
|
||||
{
|
||||
if (!ENABLE_MODAL_TRANSIENTS_CHAIN) return;
|
||||
// blockerPeer chain iterator
|
||||
XWindowPeer blockerChain = blockerPeer;
|
||||
while (blockerChain.prevTransientFor != null) {
|
||||
@@ -1948,6 +1965,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
}
|
||||
|
||||
static void restoreTransientFor(XWindowPeer window) {
|
||||
if (!ENABLE_MODAL_TRANSIENTS_CHAIN) return;
|
||||
XWindowPeer ownerPeer = window.getOwnerPeer();
|
||||
if (ownerPeer != null) {
|
||||
setToplevelTransientFor(window, ownerPeer, false, true);
|
||||
@@ -1987,6 +2005,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
* @see #setModalBlocked
|
||||
*/
|
||||
private void removeFromTransientFors() {
|
||||
if (!ENABLE_MODAL_TRANSIENTS_CHAIN) return;
|
||||
// the head of the chain of this window
|
||||
XWindowPeer thisChain = this;
|
||||
// the head of the current chain
|
||||
|
||||
@@ -572,6 +572,9 @@ public final class X11GraphicsDevice extends GraphicsDevice
|
||||
public synchronized void displayChanged() {
|
||||
xrmXftDpi = getXrmXftDpi(-1);
|
||||
scale = initScaleFactor(1);
|
||||
|
||||
if (X11GraphicsEnvironment.useBoundsCache()) resetBoundsCache();
|
||||
|
||||
// On X11 the visuals do not change, and therefore we don't need
|
||||
// to reset the defaultConfig, config, doubleBufferVisuals,
|
||||
// neither do we need to reset the native data.
|
||||
@@ -616,6 +619,7 @@ public final class X11GraphicsDevice extends GraphicsDevice
|
||||
if (x11gd.isScaleFactorDefault.get() || !uiScaleEnabled) {
|
||||
x11gd.scale = (int)Math.round(xftDpiScale * (uiScaleEnabled ? GDK_SCALE_MULTIPLIER : 1));
|
||||
x11gd.isScaleFactorDefault.set(false);
|
||||
if (X11GraphicsEnvironment.useBoundsCache()) x11gd.resetBoundsCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,8 +364,8 @@ public abstract class X11InputMethod extends X11InputMethodBase {
|
||||
}
|
||||
}
|
||||
|
||||
static void recreateAllXIC() {
|
||||
// NOTE: called from native within AWT_LOCK
|
||||
protected static void recreateAllXIC() {
|
||||
// NOTE: called within AWT_LOCK
|
||||
Map<X11InputMethod, Integer> im2ctxid = new HashMap<>(activeInputMethods.size());
|
||||
for (X11InputMethod im : activeInputMethods) {
|
||||
im2ctxid.put(im, im.releaseXIC());
|
||||
|
||||
@@ -299,6 +299,33 @@ awt_fill_imgcv(ImgConvertFcn **array, int mask, int value, ImgConvertFcn fcn)
|
||||
}
|
||||
|
||||
#ifndef HEADLESS
|
||||
void cleanup_graphics_config_data(AwtGraphicsConfigDataPtr awt_data) {
|
||||
if (awt_data->awtImage != NULL) {
|
||||
free(awt_data->awtImage);
|
||||
awt_data->awtImage = NULL;
|
||||
}
|
||||
|
||||
if (awt_data->color_data != NULL) {
|
||||
if (awt_data->color_data->img_clr_tbl != NULL) {
|
||||
free(awt_data->color_data->img_clr_tbl);
|
||||
}
|
||||
if (awt_data->color_data->awt_icmLUT2Colors != NULL) {
|
||||
free(awt_data->color_data->awt_icmLUT2Colors);
|
||||
}
|
||||
if (awt_data->color_data->awt_icmLUT != NULL) {
|
||||
free(awt_data->color_data->awt_icmLUT);
|
||||
}
|
||||
if (awt_data->color_data->awt_Colors != NULL) {
|
||||
free(awt_data->color_data->awt_Colors);
|
||||
}
|
||||
if (awt_data->color_data->img_grays != NULL) {
|
||||
free(awt_data->color_data->img_grays);
|
||||
}
|
||||
free(awt_data->color_data);
|
||||
awt_data->color_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* called from X11Server_create() in xlib.c
|
||||
*/
|
||||
@@ -320,6 +347,9 @@ awt_allocate_colors(AwtGraphicsConfigDataPtr awt_data)
|
||||
char *forcemono;
|
||||
char *forcegray;
|
||||
|
||||
// Clean up awt_data for reuse, avoid memory leak
|
||||
cleanup_graphics_config_data(awt_data);
|
||||
|
||||
make_uns_ordered_dither_array(img_oda_alpha, 256);
|
||||
|
||||
|
||||
@@ -495,7 +525,7 @@ awt_allocate_colors(AwtGraphicsConfigDataPtr awt_data)
|
||||
OrdColorDcmOpqUnsImageConvert);
|
||||
#endif /* NEED_IMAGE_CONVERT */
|
||||
} else {
|
||||
free (awt_data->awtImage);
|
||||
cleanup_graphics_config_data(awt_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -510,14 +540,14 @@ awt_allocate_colors(AwtGraphicsConfigDataPtr awt_data)
|
||||
}
|
||||
|
||||
if (awt_data->awt_num_colors > paletteSize) {
|
||||
free(awt_data->awtImage);
|
||||
cleanup_graphics_config_data(awt_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Allocate ColorData structure */
|
||||
awt_data->color_data = ZALLOC (_ColorData);
|
||||
if (awt_data->color_data == NULL) {
|
||||
free(awt_data->awtImage);
|
||||
cleanup_graphics_config_data(awt_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -538,8 +568,7 @@ awt_allocate_colors(AwtGraphicsConfigDataPtr awt_data)
|
||||
awt_data->color_data->awt_Colors =
|
||||
(ColorEntry *)calloc(paletteSize, sizeof (ColorEntry));
|
||||
if (awt_data->color_data->awt_Colors == NULL) {
|
||||
free(awt_data->awtImage);
|
||||
free(awt_data->color_data);
|
||||
cleanup_graphics_config_data(awt_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -616,8 +645,7 @@ awt_allocate_colors(AwtGraphicsConfigDataPtr awt_data)
|
||||
awt_data->color_data->img_grays =
|
||||
(unsigned char *)calloc(256, sizeof(unsigned char));
|
||||
if ( awt_data->color_data->img_grays == NULL) {
|
||||
free(awt_data->awtImage);
|
||||
free(awt_data->color_data);
|
||||
cleanup_graphics_config_data(awt_data);
|
||||
return 0;
|
||||
}
|
||||
for (g = 0; g < 256; g++) {
|
||||
@@ -764,10 +792,10 @@ awt_allocate_colors(AwtGraphicsConfigDataPtr awt_data)
|
||||
(unsigned char *)calloc(LOOKUPSIZE * LOOKUPSIZE * LOOKUPSIZE,
|
||||
sizeof(unsigned char));
|
||||
if (awt_data->color_data->img_clr_tbl == NULL) {
|
||||
free(awt_data->awtImage);
|
||||
free(awt_data->color_data);
|
||||
cleanup_graphics_config_data(awt_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
img_makePalette(cmapsize, k, LOOKUPSIZE, 50, 250,
|
||||
allocatedColorsNum, TRUE, reds, greens, blues,
|
||||
awt_data->color_data->img_clr_tbl);
|
||||
@@ -817,8 +845,7 @@ awt_allocate_colors(AwtGraphicsConfigDataPtr awt_data)
|
||||
(unsigned char *)calloc(paletteSize, sizeof (unsigned char));
|
||||
awt_data->color_data->awt_icmLUT = (int *)calloc(paletteSize, sizeof(int));
|
||||
if (awt_data->color_data->awt_icmLUT2Colors == NULL || awt_data->color_data->awt_icmLUT == NULL) {
|
||||
free(awt_data->awtImage);
|
||||
free(awt_data->color_data);
|
||||
cleanup_graphics_config_data(awt_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -522,6 +522,7 @@ typedef FcFontSet* (*FcFontSortFuncType)(FcConfig *config,
|
||||
FcResult *result);
|
||||
typedef FcCharSet* (*FcCharSetUnionFuncType)(const FcCharSet *a,
|
||||
const FcCharSet *b);
|
||||
typedef FcCharSet* (*FcCharSetDestroyFuncType)(FcCharSet *fcs);
|
||||
typedef FcChar32 (*FcCharSetSubtractCountFuncType)(const FcCharSet *a,
|
||||
const FcCharSet *b);
|
||||
|
||||
@@ -802,6 +803,7 @@ Java_sun_font_FontConfigManager_getFontConfig
|
||||
FcFontSortFuncType FcFontSort;
|
||||
FcFontSetDestroyFuncType FcFontSetDestroy;
|
||||
FcCharSetUnionFuncType FcCharSetUnion;
|
||||
FcCharSetDestroyFuncType FcCharSetDestroy;
|
||||
FcCharSetSubtractCountFuncType FcCharSetSubtractCount;
|
||||
FcGetVersionFuncType FcGetVersion;
|
||||
FcConfigGetCacheDirsFuncType FcConfigGetCacheDirs;
|
||||
@@ -881,6 +883,8 @@ Java_sun_font_FontConfigManager_getFontConfig
|
||||
(FcFontSetDestroyFuncType)dlsym(libfontconfig, "FcFontSetDestroy");
|
||||
FcCharSetUnion =
|
||||
(FcCharSetUnionFuncType)dlsym(libfontconfig, "FcCharSetUnion");
|
||||
FcCharSetDestroy =
|
||||
(FcCharSetDestroyFuncType)dlsym(libfontconfig, "FcCharSetDestroy");
|
||||
FcCharSetSubtractCount =
|
||||
(FcCharSetSubtractCountFuncType)dlsym(libfontconfig,
|
||||
"FcCharSetSubtractCount");
|
||||
@@ -896,6 +900,7 @@ Java_sun_font_FontConfigManager_getFontConfig
|
||||
FcPatternGetCharSet == NULL ||
|
||||
FcFontSetDestroy == NULL ||
|
||||
FcCharSetUnion == NULL ||
|
||||
FcCharSetDestroy == NULL ||
|
||||
FcGetVersion == NULL ||
|
||||
FcCharSetSubtractCount == NULL) {/* problem with the library: return.*/
|
||||
closeFontConfig(libfontconfig, JNI_FALSE);
|
||||
@@ -959,6 +964,7 @@ Java_sun_font_FontConfigManager_getFontConfig
|
||||
FcChar8 **family, **styleStr, **fullname, **file;
|
||||
jarray fcFontArr = NULL;
|
||||
FcCharSet *unionCharset = NULL;
|
||||
FcCharSet *prevUnionCharset = NULL;
|
||||
|
||||
fcCompFontObj = (*env)->GetObjectArrayElement(env, fcCompFontArray, i);
|
||||
fcNameStr =
|
||||
@@ -1072,6 +1078,9 @@ Java_sun_font_FontConfigManager_getFontConfig
|
||||
free(file);
|
||||
(*FcPatternDestroy)(pattern);
|
||||
(*FcFontSetDestroy)(fontset);
|
||||
if (prevUnionCharset != NULL) {
|
||||
(*FcCharSetDestroy)(prevUnionCharset);
|
||||
}
|
||||
closeFontConfig(libfontconfig, JNI_FALSE);
|
||||
if (locale) {
|
||||
(*env)->ReleaseStringUTFChars(env, localeStr, (const char*)locale);
|
||||
@@ -1093,6 +1102,10 @@ Java_sun_font_FontConfigManager_getFontConfig
|
||||
if ((*FcCharSetSubtractCount)(charset, unionCharset)
|
||||
> minGlyphs) {
|
||||
unionCharset = (* FcCharSetUnion)(unionCharset, charset);
|
||||
if (prevUnionCharset != NULL) {
|
||||
(*FcCharSetDestroy)(prevUnionCharset);
|
||||
}
|
||||
prevUnionCharset = unionCharset;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
@@ -1111,6 +1124,11 @@ Java_sun_font_FontConfigManager_getFontConfig
|
||||
}
|
||||
}
|
||||
|
||||
// Release last instance of CharSet union
|
||||
if (prevUnionCharset != NULL) {
|
||||
(*FcCharSetDestroy)(prevUnionCharset);
|
||||
}
|
||||
|
||||
/* Once we get here 'fontCount' is the number of returned fonts
|
||||
* we actually want to use, so we create 'fcFontArr' of that length.
|
||||
* The non-null entries of "family[]" etc are those fonts.
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include <sun_awt_X11InputMethodBase.h>
|
||||
#include <sun_awt_X11_XInputMethod.h>
|
||||
#include <sun_awt_X11_XInputMethod_BrokenImDetectionContext.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -129,6 +130,10 @@ typedef struct _X11InputMethodData {
|
||||
#endif
|
||||
char *lookup_buf; /* buffer used for XmbLookupString */
|
||||
int lookup_buf_len; /* lookup buffer size in bytes */
|
||||
|
||||
struct {
|
||||
Boolean isBetweenPreeditStartAndPreeditDone;
|
||||
} brokenImDetectionContext;
|
||||
} X11InputMethodData;
|
||||
|
||||
/*
|
||||
@@ -404,6 +409,8 @@ freeX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData)
|
||||
free((void *)pX11IMData->lookup_buf);
|
||||
}
|
||||
|
||||
pX11IMData->brokenImDetectionContext.isBetweenPreeditStartAndPreeditDone = False;
|
||||
|
||||
free((void *)pX11IMData);
|
||||
}
|
||||
|
||||
@@ -1041,6 +1048,8 @@ createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w)
|
||||
XNResetState, XIMInitialState,
|
||||
NULL);
|
||||
|
||||
pX11IMData->brokenImDetectionContext.isBetweenPreeditStartAndPreeditDone = False;
|
||||
|
||||
/* Add the global reference object to X11InputMethod to the list. */
|
||||
addToX11InputMethodGRefList(pX11IMData->x11inputmethod);
|
||||
|
||||
@@ -1061,16 +1070,53 @@ createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w)
|
||||
static int
|
||||
PreeditStartCallback(XIC ic, XPointer client_data, XPointer call_data)
|
||||
{
|
||||
/*ARGSUSED*/
|
||||
/* printf("Native: PreeditStartCallback\n"); */
|
||||
/* printf("Native: PreeditStartCallback(%p, %p, %p)\n", ic, client_data, call_data); */
|
||||
|
||||
JNIEnv * const env = GetJNIEnv();
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
jobject javaInputMethodGRef = (jobject)client_data;
|
||||
if (!isX11InputMethodGRefInList(javaInputMethodGRef)) {
|
||||
goto finally;
|
||||
}
|
||||
|
||||
X11InputMethodData * const pX11IMData = getX11InputMethodData(env, javaInputMethodGRef);
|
||||
if (pX11IMData == NULL) {
|
||||
goto finally;
|
||||
}
|
||||
|
||||
pX11IMData->brokenImDetectionContext.isBetweenPreeditStartAndPreeditDone = True;
|
||||
|
||||
finally:
|
||||
AWT_UNLOCK();
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
PreeditDoneCallback(XIC ic, XPointer client_data, XPointer call_data)
|
||||
{
|
||||
/*ARGSUSED*/
|
||||
/* printf("Native: PreeditDoneCallback\n"); */
|
||||
/* printf("Native: PreeditDoneCallback(%p, %p, %p)\n", ic, client_data, call_data); */
|
||||
|
||||
JNIEnv * const env = GetJNIEnv();
|
||||
|
||||
AWT_LOCK();
|
||||
|
||||
jobject javaInputMethodGRef = (jobject)client_data;
|
||||
if (!isX11InputMethodGRefInList(javaInputMethodGRef)) {
|
||||
goto finally;
|
||||
}
|
||||
|
||||
X11InputMethodData * const pX11IMData = getX11InputMethodData(env, javaInputMethodGRef);
|
||||
if (pX11IMData == NULL) {
|
||||
goto finally;
|
||||
}
|
||||
|
||||
pX11IMData->brokenImDetectionContext.isBetweenPreeditStartAndPreeditDone = False;
|
||||
|
||||
finally:
|
||||
AWT_UNLOCK();
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1083,6 +1129,8 @@ static void
|
||||
PreeditDrawCallback(XIC ic, XPointer client_data,
|
||||
XIMPreeditDrawCallbackStruct *pre_draw)
|
||||
{
|
||||
/* printf("Native: PreeditDrawCallback(%p, %p, %p)\n", ic, client_data, pre_draw); */
|
||||
|
||||
JNIEnv *env = GetJNIEnv();
|
||||
X11InputMethodData *pX11IMData = NULL;
|
||||
jmethodID x11imMethodID;
|
||||
@@ -1175,7 +1223,7 @@ PreeditCaretCallback(XIC ic, XPointer client_data,
|
||||
XIMPreeditCaretCallbackStruct *pre_caret)
|
||||
{
|
||||
/*ARGSUSED*/
|
||||
/* printf("Native: PreeditCaretCallback\n"); */
|
||||
/* printf("Native: PreeditCaretCallback(%p, %p, %p)\n", ic, client_data, pre_caret); */
|
||||
}
|
||||
|
||||
#if defined(__linux__)
|
||||
@@ -1183,14 +1231,14 @@ static void
|
||||
StatusStartCallback(XIC ic, XPointer client_data, XPointer call_data)
|
||||
{
|
||||
/*ARGSUSED*/
|
||||
/*printf("StatusStartCallback:\n"); */
|
||||
/*printf("Native: StatusStartCallback(%p, %p, %p)\n", ic, client_data, call_data); */
|
||||
}
|
||||
|
||||
static void
|
||||
StatusDoneCallback(XIC ic, XPointer client_data, XPointer call_data)
|
||||
{
|
||||
/*ARGSUSED*/
|
||||
/*printf("StatusDoneCallback:\n"); */
|
||||
/*printf("Native: StatusDoneCallback(%p, %p, %p)\n", ic, client_data, call_data); */
|
||||
JNIEnv *env = GetJNIEnv();
|
||||
X11InputMethodData *pX11IMData = NULL;
|
||||
StatusWindow *statusWindow;
|
||||
@@ -1221,7 +1269,7 @@ StatusDrawCallback(XIC ic, XPointer client_data,
|
||||
XIMStatusDrawCallbackStruct *status_draw)
|
||||
{
|
||||
/*ARGSUSED*/
|
||||
/*printf("StatusDrawCallback:\n"); */
|
||||
/*printf("Native: StatusDrawCallback(%p, %p, %p)\n", ic, client_data, status_draw); */
|
||||
JNIEnv *env = GetJNIEnv();
|
||||
X11InputMethodData *pX11IMData = NULL;
|
||||
StatusWindow *statusWindow;
|
||||
@@ -1274,6 +1322,8 @@ StatusDrawCallback(XIC ic, XPointer client_data,
|
||||
#endif /* __linux__ */
|
||||
|
||||
static void CommitStringCallback(XIC ic, XPointer client_data, XPointer call_data) {
|
||||
/* printf("Native: CommitStringCallback(%p, %p, %p)\n", ic, client_data, call_data); */
|
||||
|
||||
JNIEnv *env = GetJNIEnv();
|
||||
XIMText * text = (XIMText *)call_data;
|
||||
X11InputMethodData *pX11IMData = NULL;
|
||||
@@ -1514,6 +1564,110 @@ Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
|
||||
AWT_UNLOCK();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XInputMethod_BrokenImDetectionContext
|
||||
* Method: obtainCurrentXimNativeDataPtr
|
||||
* Signature: ()J
|
||||
*
|
||||
* NOTE: MUST BE CALLED WITHIN AWT_LOCK
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XInputMethod_00024BrokenImDetectionContext_obtainCurrentXimNativeDataPtr
|
||||
(JNIEnv *env, jclass cls)
|
||||
{
|
||||
jlong result = 0;
|
||||
|
||||
if (isX11InputMethodGRefInList(currentX11InputMethodInstance)) {
|
||||
X11InputMethodData * const pX11IMData = getX11InputMethodData(env, currentX11InputMethodInstance);
|
||||
result = ptr_to_jlong(pX11IMData);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XInputMethod_BrokenImDetectionContext
|
||||
* Method: isCurrentXicPassive
|
||||
* Signature: (J)Z
|
||||
*
|
||||
* NOTE: MUST BE CALLED WITHIN AWT_LOCK
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XInputMethod_00024BrokenImDetectionContext_isCurrentXicPassive
|
||||
(JNIEnv *env, jclass cls, jlong ximNativeDataPtr)
|
||||
{
|
||||
X11InputMethodData * const pX11ImData = (X11InputMethodData *)jlong_to_ptr(ximNativeDataPtr);
|
||||
if (pX11ImData == NULL) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
const jboolean result = (pX11ImData->current_ic == NULL) ? JNI_FALSE
|
||||
: (pX11ImData->current_ic == pX11ImData->ic_passive) ? JNI_TRUE
|
||||
: JNI_FALSE;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static XIMPreeditState getPreeditStateOf(XIC xic) {
|
||||
#if defined(__linux__) && defined(_LP64) && !defined(_LITTLE_ENDIAN)
|
||||
// XIMPreeditState value which is used for XGetICValues must be 32bit on BigEndian XOrg's xlib
|
||||
unsigned int state = XIMPreeditUnKnown;
|
||||
#else
|
||||
XIMPreeditState state = XIMPreeditUnKnown;
|
||||
#endif
|
||||
|
||||
XVaNestedList preeditStateAttr = XVaCreateNestedList(0, XNPreeditState, &state, NULL);
|
||||
if (preeditStateAttr == NULL) {
|
||||
return XIMPreeditUnKnown;
|
||||
}
|
||||
const char * const unsupportedAttrs = XGetICValues(xic, XNPreeditAttributes, preeditStateAttr, NULL);
|
||||
XFree((void *)preeditStateAttr);
|
||||
|
||||
if (unsupportedAttrs != NULL) {
|
||||
return XIMPreeditUnKnown;
|
||||
}
|
||||
|
||||
return (state == XIMPreeditEnable) ? XIMPreeditEnable
|
||||
: (state == XIMPreeditDisable) ? XIMPreeditDisable
|
||||
: XIMPreeditUnKnown;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XInputMethod_BrokenImDetectionContext
|
||||
* Method: isDuringPreediting
|
||||
* Signature: ()I
|
||||
*
|
||||
* Returns the following values:
|
||||
* * >0 in case the IM is in preediting state;
|
||||
* * 0 in case the IM is not in preediting state;
|
||||
* * <0 in case it's unknown whether the IM is in preediting state or not.
|
||||
*
|
||||
* NOTE: MUST BE CALLED WITHIN AWT_LOCK
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_awt_X11_XInputMethod_00024BrokenImDetectionContext_isDuringPreediting
|
||||
(JNIEnv *env, jclass cls, jlong ximNativeDataPtr)
|
||||
{
|
||||
X11InputMethodData * const pX11ImData = (X11InputMethodData *)jlong_to_ptr(ximNativeDataPtr);
|
||||
if (pX11ImData == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
jint result = -1;
|
||||
|
||||
if (pX11ImData->brokenImDetectionContext.isBetweenPreeditStartAndPreeditDone) {
|
||||
result = 1;
|
||||
} else if (pX11ImData->current_ic != NULL) {
|
||||
const XIMPreeditState preeditState = getPreeditStateOf(pX11ImData->current_ic);
|
||||
if (preeditState == XIMPreeditEnable) {
|
||||
result = 1;
|
||||
} else if (preeditState == XIMPreeditDisable) {
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11InputMethodBase
|
||||
* Method: initIDs
|
||||
|
||||
@@ -653,61 +653,6 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XWindowEvent
|
||||
XWindowEvent( (Display *) jlong_to_ptr(display), (Window)window, event_mask, (XEvent *) jlong_to_ptr(event_return));
|
||||
}
|
||||
|
||||
static int filteredEventsCount = 0;
|
||||
static int filteredEventsThreshold = -1;
|
||||
static const int DEFAULT_THRESHOLD = 5;
|
||||
#define KeyPressEventType 2
|
||||
#define KeyReleaseEventType 3
|
||||
|
||||
static void checkBrokenInputMethod(XEvent * event, jboolean isEventFiltered) {
|
||||
// Fix for JBR-2444
|
||||
// By default filteredEventsThreshold == 5, you can turn it of with
|
||||
// recreate.x11.input.method=false
|
||||
if (filteredEventsThreshold < 0) {
|
||||
filteredEventsThreshold = 0;
|
||||
|
||||
// read from VM-property
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
jclass systemCls = (*env)->FindClass(env, "java/lang/System");
|
||||
CHECK_NULL(systemCls);
|
||||
jmethodID mid = (*env)->GetStaticMethodID(env, systemCls, "getProperty", "(Ljava/lang/String;)Ljava/lang/String;");
|
||||
CHECK_NULL(mid);
|
||||
jstring name = (*env)->NewStringUTF(env, "recreate.x11.input.method");
|
||||
CHECK_NULL(name);
|
||||
jstring jvalue = (*env)->CallStaticObjectMethod(env, systemCls, mid, name);
|
||||
if (jvalue != NULL) {
|
||||
const char * utf8string = (*env)->GetStringUTFChars(env, jvalue, NULL);
|
||||
if (utf8string != NULL) {
|
||||
const int parsedVal = atoi(utf8string);
|
||||
if (parsedVal > 0)
|
||||
filteredEventsThreshold = parsedVal;
|
||||
else if (strncmp(utf8string, "false", 5) == 0)
|
||||
filteredEventsThreshold = 0;
|
||||
}
|
||||
(*env)->ReleaseStringUTFChars(env, jvalue, utf8string);
|
||||
} else {
|
||||
filteredEventsThreshold = DEFAULT_THRESHOLD;
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, name);
|
||||
}
|
||||
if (filteredEventsThreshold <= 0)
|
||||
return;
|
||||
|
||||
if (event->type == KeyPressEventType || event->type == KeyReleaseEventType) {
|
||||
if (isEventFiltered) {
|
||||
filteredEventsCount++;
|
||||
} else {
|
||||
filteredEventsCount = 0;
|
||||
}
|
||||
|
||||
if (filteredEventsCount > filteredEventsThreshold) {
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11InputMethod", "recreateAllXIC", "()V");
|
||||
filteredEventsCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_X11_XlibWrapper
|
||||
* Method: XFilterEvent
|
||||
@@ -722,8 +667,10 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XFilterEvent
|
||||
return (jboolean)True;
|
||||
}
|
||||
#endif
|
||||
jboolean isEventFiltered = (jboolean) XFilterEvent((XEvent *) jlong_to_ptr(ptr), (Window) window);
|
||||
checkBrokenInputMethod((XEvent *)jlong_to_ptr(ptr), isEventFiltered);
|
||||
XEvent* const xEvent = (XEvent *)jlong_to_ptr(ptr);
|
||||
|
||||
const jboolean isEventFiltered = (jboolean) XFilterEvent(xEvent, (Window) window);
|
||||
|
||||
return isEventFiltered;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.awt.Frame;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.MenuBar;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
import java.awt.peer.FramePeer;
|
||||
import java.security.AccessController;
|
||||
|
||||
@@ -253,4 +254,10 @@ class WFramePeer extends WWindowPeer implements FramePeer {
|
||||
}
|
||||
|
||||
private native void synthesizeWmActivate(boolean activate);
|
||||
|
||||
// JBR API internals
|
||||
private static void updateCustomDecoration(ComponentPeer peer) {
|
||||
if (peer instanceof WFramePeer) ((WFramePeer) peer).updateCustomDecoration();
|
||||
}
|
||||
private native void updateCustomDecoration();
|
||||
}
|
||||
|
||||
@@ -515,7 +515,15 @@ MsgRouting AwtFrame::WmMouseMove(UINT flags, int x, int y) {
|
||||
* If this Frame is non-focusable then we should implement move and size operation for it by
|
||||
* ourselfves because we don't dispatch appropriate mouse messages to default window procedure.
|
||||
*/
|
||||
if (!IsFocusableWindow() && isInManualMoveOrSize) {
|
||||
if (isInManualMoveOrSize) {
|
||||
if (grabbedHitTest == HTCAPTION) {
|
||||
WINDOWPLACEMENT placement;
|
||||
::GetWindowPlacement(GetHWnd(), &placement);
|
||||
if (placement.showCmd == SW_SHOWMAXIMIZED) {
|
||||
placement.showCmd = SW_SHOWNORMAL;
|
||||
::SetWindowPlacement(GetHWnd(), &placement);
|
||||
}
|
||||
}
|
||||
DWORD curPos = ::GetMessagePos();
|
||||
x = GET_X_LPARAM(curPos);
|
||||
y = GET_Y_LPARAM(curPos);
|
||||
@@ -627,12 +635,29 @@ MsgRouting AwtFrame::WmNcMouseDown(WPARAM hitTest, int x, int y, int button) {
|
||||
// Do not handle events from caption itself to preserve native drag behavior
|
||||
if (HasCustomDecoration()) {
|
||||
switch (hitTest) {
|
||||
case HTCAPTION:
|
||||
case HTMINBUTTON:
|
||||
case HTMAXBUTTON:
|
||||
case HTCLOSE:
|
||||
case HTMENU:
|
||||
RECT rcWindow;
|
||||
GetWindowRect(GetHWnd(), &rcWindow);
|
||||
if (hitTest == HTCAPTION) {
|
||||
JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
jint customSpot = JNU_CallMethodByName(env, NULL, GetTarget(env),
|
||||
"hitTestCustomDecoration", "(II)I",
|
||||
ScaleDownX(x - rcWindow.left),
|
||||
ScaleDownY(y - rcWindow.top)).i;
|
||||
if (customSpot == java_awt_Window_CustomWindowDecoration_DRAGGABLE_AREA) {
|
||||
if (button & LEFT_BUTTON) {
|
||||
savedMousePos.x = x;
|
||||
savedMousePos.y = y;
|
||||
::SetCapture(GetHWnd());
|
||||
isInManualMoveOrSize = TRUE;
|
||||
grabbedHitTest = hitTest;
|
||||
}
|
||||
} else break;
|
||||
}
|
||||
WmMouseDown(GetButtonMK(button),
|
||||
x - rcWindow.left,
|
||||
y - rcWindow.top,
|
||||
@@ -1711,6 +1736,21 @@ BOOL AwtFrame::HasCustomDecoration()
|
||||
return *m_pHasCustomDecoration;
|
||||
}
|
||||
|
||||
void _UpdateCustomDecoration(void* p) {
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
jobject self = reinterpret_cast<jobject>(p);
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_GOTO(self, ret);
|
||||
|
||||
AwtFrame* frame = (AwtFrame*)pData;
|
||||
if (!frame->m_pHasCustomDecoration) frame->m_pHasCustomDecoration = new BOOL;
|
||||
*frame->m_pHasCustomDecoration = JNU_GetFieldByName(env, NULL, frame->GetTarget(env), "hasCustomDecoration", "Z").z;
|
||||
frame->RedrawNonClient();
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
}
|
||||
|
||||
void GetSysInsets(RECT* insets, AwtFrame* pFrame) {
|
||||
if (pFrame->IsUndecorated()) {
|
||||
::SetRectEmpty(insets);
|
||||
@@ -1768,6 +1808,7 @@ LRESULT HitTestNCA(AwtFrame* frame, int x, int y) {
|
||||
frame->ScaleDownY(y - rcWindow.top)).i;
|
||||
switch (customSpot) {
|
||||
case java_awt_Window_CustomWindowDecoration_NO_HIT_SPOT:
|
||||
case java_awt_Window_CustomWindowDecoration_DRAGGABLE_AREA:
|
||||
break; // Nothing
|
||||
case java_awt_Window_CustomWindowDecoration_MINIMIZE_BUTTON:
|
||||
return HTMINBUTTON;
|
||||
@@ -2205,6 +2246,17 @@ Java_sun_awt_windows_WFramePeer_updateIcon(JNIEnv *env, jobject self)
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_windows_WFramePeer_updateCustomDecoration(JNIEnv *env, jobject self)
|
||||
{
|
||||
TRY;
|
||||
|
||||
AwtToolkit::GetInstance().InvokeFunction(_UpdateCustomDecoration, env->NewGlobalRef(self));
|
||||
// global ref is deleted in _UpdateCustomDecoration()
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
||||
} /* extern "C" */
|
||||
|
||||
static bool SetFocusToPluginControl(HWND hwndPlugin)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2022, 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
|
||||
@@ -70,10 +70,12 @@ typedef struct tagBitmapheader {
|
||||
|
||||
jfieldID AwtTrayIcon::idID;
|
||||
jfieldID AwtTrayIcon::actionCommandID;
|
||||
jmethodID AwtTrayIcon::updateImageID;
|
||||
|
||||
HWND AwtTrayIcon::sm_msgWindow = NULL;
|
||||
AwtTrayIcon::TrayIconListItem* AwtTrayIcon::sm_trayIconList = NULL;
|
||||
int AwtTrayIcon::sm_instCount = 0;
|
||||
bool AwtTrayIcon::m_bDPIChanged = false;
|
||||
|
||||
/************************************************************************
|
||||
* AwtTrayIcon methods
|
||||
@@ -221,6 +223,18 @@ void AwtTrayIcon::InitNID(UINT uID)
|
||||
m_nid.uVersion = NOTIFYICON_VERSION;
|
||||
}
|
||||
|
||||
// Call updateImage() method on the peer when screen scale changes
|
||||
void AwtTrayIcon::UpdateImage()
|
||||
{
|
||||
JNIEnv *env =(JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
jobject peer = GetPeer(env);
|
||||
if (peer != NULL) {
|
||||
env->CallVoidMethod(peer, updateImageID);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
}
|
||||
|
||||
BOOL AwtTrayIcon::SendTrayMessage(DWORD dwMessage)
|
||||
{
|
||||
return Shell_NotifyIcon(dwMessage, (PNOTIFYICONDATA)&m_nid);
|
||||
@@ -248,6 +262,10 @@ LRESULT CALLBACK AwtTrayIcon::TrayWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_DPICHANGED:
|
||||
// Set the flag to update icon images, see WmTaskbarCreated
|
||||
m_bDPIChanged = true;
|
||||
break;
|
||||
default:
|
||||
if(uMsg == s_msgTaskbarCreated) {
|
||||
if (hwnd == AwtTrayIcon::sm_msgWindow) {
|
||||
@@ -474,12 +492,17 @@ MsgRouting AwtTrayIcon::WmContextMenu(UINT flags, int x, int y)
|
||||
MsgRouting AwtTrayIcon::WmTaskbarCreated() {
|
||||
TrayIconListItem* item;
|
||||
for (item = sm_trayIconList; item != NULL; item = item->m_next) {
|
||||
if (m_bDPIChanged) {
|
||||
// Update the icon image
|
||||
item->m_trayIcon->UpdateImage();
|
||||
}
|
||||
BOOL result = item->m_trayIcon->SendTrayMessage(NIM_ADD);
|
||||
// 6270114: Instructs the taskbar to behave according to the Shell version 5.0
|
||||
if (result) {
|
||||
item->m_trayIcon->SendTrayMessage(NIM_SETVERSION);
|
||||
}
|
||||
}
|
||||
m_bDPIChanged = false;
|
||||
return mrDoDefault;
|
||||
}
|
||||
|
||||
@@ -917,6 +940,14 @@ Java_java_awt_TrayIcon_initIDs(JNIEnv *env, jclass cls)
|
||||
DASSERT(AwtTrayIcon::actionCommandID != NULL);
|
||||
CHECK_NULL( AwtTrayIcon::actionCommandID);
|
||||
|
||||
jclass wPeerCls = env->FindClass("sun/awt/windows/WTrayIconPeer");
|
||||
DASSERT(wPeerCls != NULL);
|
||||
CHECK_NULL(wPeerCls);
|
||||
|
||||
AwtTrayIcon::updateImageID = env->GetMethodID(wPeerCls, "updateImage", "()V");
|
||||
DASSERT(AwtTrayIcon::updateImageID != NULL);
|
||||
CHECK_NULL(AwtTrayIcon::updateImageID);
|
||||
|
||||
CATCH_BAD_ALLOC;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2022, 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
|
||||
@@ -86,6 +86,8 @@ public:
|
||||
|
||||
void DisplayMessage(LPCTSTR caption, LPCTSTR text, LPCTSTR msgType);
|
||||
|
||||
void UpdateImage();
|
||||
|
||||
// Adds to the head of the list
|
||||
INLINE void AddTrayIconItem(UINT id) {
|
||||
TrayIconListItem* item = new TrayIconListItem(id, this);
|
||||
@@ -121,6 +123,7 @@ public:
|
||||
*/
|
||||
static jfieldID idID;
|
||||
static jfieldID actionCommandID;
|
||||
static jmethodID updateImageID;
|
||||
|
||||
// ************************
|
||||
|
||||
@@ -151,6 +154,8 @@ private:
|
||||
TrayIconListItem* m_next;
|
||||
};
|
||||
|
||||
static bool m_bDPIChanged;
|
||||
|
||||
public:
|
||||
static TrayIconListItem* sm_trayIconList;
|
||||
};
|
||||
|
||||
@@ -60,7 +60,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
import jdk.internal.module.Checks;
|
||||
import jdk.internal.module.DefaultRoots;
|
||||
import jdk.internal.module.IllegalAccessMaps;
|
||||
import jdk.internal.module.Modules;
|
||||
import jdk.internal.module.ModuleHashes;
|
||||
import jdk.internal.module.ModuleInfo.Attributes;
|
||||
@@ -622,9 +621,6 @@ public final class SystemModulesPlugin extends AbstractPlugin {
|
||||
// generate moduleReads
|
||||
genModuleReads(cw, cf);
|
||||
|
||||
// generate concealedPackagesToOpen and exportedPackagesToOpen
|
||||
genXXXPackagesToOpenMethods(cw);
|
||||
|
||||
return cw;
|
||||
}
|
||||
|
||||
@@ -855,16 +851,6 @@ public final class SystemModulesPlugin extends AbstractPlugin {
|
||||
generate(cw, "moduleReads", map, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate concealedPackagesToOpen and exportedPackagesToOpen methods.
|
||||
*/
|
||||
private void genXXXPackagesToOpenMethods(ClassWriter cw) {
|
||||
ModuleFinder finder = finderOf(moduleInfos);
|
||||
IllegalAccessMaps maps = IllegalAccessMaps.generate(finder);
|
||||
generate(cw, "concealedPackagesToOpen", maps.concealedPackagesToOpen(), false);
|
||||
generate(cw, "exportedPackagesToOpen", maps.exportedPackagesToOpen(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate method to return {@code Map<String, Set<String>>}.
|
||||
*
|
||||
|
||||
@@ -24,19 +24,59 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Custom window decoration allows merging of window content with native title bar,
|
||||
* which is usually done by treating title bar as part of client area, but with some
|
||||
* special behavior like dragging or maximizing on double click.
|
||||
* @implNote Behavior is platform-dependent, only macOS and Windows are supported.
|
||||
*/
|
||||
public interface CustomWindowDecoration {
|
||||
|
||||
/*CONST java.awt.Window.*_HIT_SPOT*/
|
||||
/*CONST java.awt.Window.*_BUTTON*/
|
||||
/*CONST java.awt.Window.MENU_BAR*/
|
||||
/*CONST java.awt.Window.DRAGGABLE_AREA*/
|
||||
|
||||
/**
|
||||
* Turn custom decoration on or off, {@link #setCustomDecorationTitleBarHeight(Window, int)}
|
||||
* must be called to configure title bar height.
|
||||
*/
|
||||
void setCustomDecorationEnabled(Window window, boolean enabled);
|
||||
/**
|
||||
* @see #setCustomDecorationEnabled(Window, boolean)
|
||||
*/
|
||||
boolean isCustomDecorationEnabled(Window window);
|
||||
|
||||
/**
|
||||
* Set list of hit test spots for a custom decoration.
|
||||
* Hit test spot is a special area inside custom-decorated title bar.
|
||||
* Each hit spot type has its own (probably platform-specific) behavior:
|
||||
* <ul>
|
||||
* <li>{@link #NO_HIT_SPOT} - default title bar area, can be dragged to move a window, maximizes on double-click</li>
|
||||
* <li>{@link #OTHER_HIT_SPOT} - generic hit spot, window cannot be moved with drag or maximized on double-click</li>
|
||||
* <li>{@link #MINIMIZE_BUTTON} - like {@link #OTHER_HIT_SPOT} but displays tooltip on Windows when hovered</li>
|
||||
* <li>{@link #MAXIMIZE_BUTTON} - like {@link #OTHER_HIT_SPOT} but displays tooltip / snap layout menu on Windows when hovered</li>
|
||||
* <li>{@link #CLOSE_BUTTON} - like {@link #OTHER_HIT_SPOT} but displays tooltip on Windows when hovered</li>
|
||||
* <li>{@link #MENU_BAR} - currently no different from {@link #OTHER_HIT_SPOT}</li>
|
||||
* <li>{@link #DRAGGABLE_AREA} - special type, moves window when dragged, but doesn't maximize on double-click</li>
|
||||
* </ul>
|
||||
* @param spots pairs of hit spot shapes with corresponding types.
|
||||
* @implNote Hit spots are tested in sequence, so in case of overlapping areas, first found wins.
|
||||
*/
|
||||
void setCustomDecorationHitTestSpots(Window window, List<Map.Entry<Shape, Integer>> spots);
|
||||
/**
|
||||
* @see #setCustomDecorationHitTestSpots(Window, List)
|
||||
*/
|
||||
List<Map.Entry<Shape, Integer>> getCustomDecorationHitTestSpots(Window window);
|
||||
|
||||
/**
|
||||
* Set height of custom window decoration, won't take effect until custom decoration
|
||||
* is enabled via {@link #setCustomDecorationEnabled(Window, boolean)}.
|
||||
*/
|
||||
void setCustomDecorationTitleBarHeight(Window window, int height);
|
||||
/**
|
||||
* @see #setCustomDecorationTitleBarHeight(Window, int)
|
||||
*/
|
||||
int getCustomDecorationTitleBarHeight(Window window);
|
||||
|
||||
|
||||
@@ -49,13 +89,14 @@ public interface CustomWindowDecoration {
|
||||
setCustomDecorationHitTestSpots,
|
||||
setCustomDecorationTitleBarHeight;
|
||||
private final Field peer;
|
||||
private final Class<?> wpeer;
|
||||
|
||||
__Fallback() throws Exception {
|
||||
hasCustomDecoration = Window.class.getDeclaredMethod("hasCustomDecoration");
|
||||
hasCustomDecoration.setAccessible(true);
|
||||
setHasCustomDecoration = Window.class.getDeclaredMethod("setHasCustomDecoration");
|
||||
setHasCustomDecoration.setAccessible(true);
|
||||
Class<?> wpeer = Class.forName("sun.awt.windows.WWindowPeer");
|
||||
wpeer = Class.forName("sun.awt.windows.WWindowPeer");
|
||||
setCustomDecorationHitTestSpots = wpeer.getDeclaredMethod("setCustomDecorationHitTestSpots", List.class);
|
||||
setCustomDecorationHitTestSpots.setAccessible(true);
|
||||
setCustomDecorationTitleBarHeight = wpeer.getDeclaredMethod("setCustomDecorationTitleBarHeight", int.class);
|
||||
@@ -89,10 +130,10 @@ public interface CustomWindowDecoration {
|
||||
public void setCustomDecorationHitTestSpots(Window window, List<Map.Entry<Shape, Integer>> spots) {
|
||||
List<Rectangle> hitTestSpots = spots.stream().map(e -> e.getKey().getBounds()).collect(Collectors.toList());
|
||||
try {
|
||||
setCustomDecorationHitTestSpots.invoke(peer.get(window), hitTestSpots);
|
||||
setCustomDecorationHitTestSpots.invoke(wpeer.cast(peer.get(window)), hitTestSpots);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch(ClassCastException | NullPointerException ignore) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,10 +144,10 @@ public interface CustomWindowDecoration {
|
||||
@Override
|
||||
public void setCustomDecorationTitleBarHeight(Window window, int height) {
|
||||
try {
|
||||
setCustomDecorationTitleBarHeight.invoke(peer.get(window), height);
|
||||
setCustomDecorationTitleBarHeight.invoke(wpeer.cast(peer.get(window)), height);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch(ClassCastException | NullPointerException ignore) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
# 2. When only new API is added, or some existing API was @Deprecated - increment MINOR, reset PATCH to 0
|
||||
# 3. For major backwards incompatible API changes - increment MAJOR, reset MINOR and PATCH to 0
|
||||
|
||||
VERSION = 0.0.4
|
||||
VERSION = 0.0.6
|
||||
|
||||
# Hash is used to track changes to jetbrains.api, so you would not forget to update version when needed.
|
||||
# When you make any changes, "make jbr-api" will fail and ask you to update hash and version number here.
|
||||
|
||||
HASH = 74417FA361EA554F9C90873A3FF354
|
||||
HASH = 2E2A7E994CCF6D942FB9EB347C8EA4
|
||||
|
||||
@@ -678,6 +678,7 @@ javax/security/auth/kerberos/KerberosTixDateTest.java 8039280 generic-
|
||||
sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java 8039280 generic-all
|
||||
sun/security/provider/PolicyParser/ExtDirsChange.java 8039280 generic-all
|
||||
sun/security/provider/PolicyParser/PrincipalExpansionError.java 8039280 generic-all
|
||||
sun/security/ssl/SSLSessionImpl/NoInvalidateSocketException.java 8277970 linux-all,macosx-x64
|
||||
|
||||
############################################################################
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ import javax.imageio.ImageIO;
|
||||
* @key headful
|
||||
* @bug 8215105 8211999
|
||||
* @summary tests that Robot can capture the common colors without artifacts
|
||||
* @run main/othervm CheckCommonColors
|
||||
* @run main/othervm -Xcheck:jni CheckCommonColors
|
||||
*/
|
||||
public final class CheckCommonColors {
|
||||
|
||||
|
||||
128
test/jdk/java/awt/TrayIcon/TrayIconScalingTest.java
Normal file
128
test/jdk/java/awt/TrayIcon/TrayIconScalingTest.java
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 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
|
||||
* @bug 8255439
|
||||
* @key headful
|
||||
* @library /java/awt/regtesthelpers
|
||||
* @build PassFailJFrame
|
||||
* @summary To test tray icon scaling with on-the-fly DPI/Scale changes on Windows
|
||||
* @run main/manual TrayIconScalingTest
|
||||
* @requires (os.family == "windows")
|
||||
*/
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.SystemTray;
|
||||
import java.awt.TrayIcon;
|
||||
import java.awt.font.TextLayout;
|
||||
import java.awt.image.BaseMultiResolutionImage;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TrayIconScalingTest {
|
||||
|
||||
private static SystemTray tray;
|
||||
private static TrayIcon icon;
|
||||
|
||||
private static final String INSTRUCTIONS =
|
||||
"This test checks if the tray icon gets updated when DPI / Scale" +
|
||||
" is changed on the fly.\n\n" +
|
||||
"STEPS: \n\n" +
|
||||
"1. Check the system tray / notification area on Windows" +
|
||||
" taskbar, you should see a white icon which displays a" +
|
||||
" number.\n\n" +
|
||||
"2. Navigate to Settings > System > Display and change the" +
|
||||
" display scale by selecting any value from" +
|
||||
" Scale & Layout dropdown.\n\n"+
|
||||
"3. When the scale changes, check the white tray icon," +
|
||||
" there should be no distortion, it should be displayed sharp,\n" +
|
||||
" and the displayed number should correspond to the current"+
|
||||
" scale:\n" +
|
||||
" 100% - 16, 125% - 20, 150% - 24, 175% - 28, 200% - 32.\n\n"+
|
||||
" If the icon is displayed sharp and without any distortion," +
|
||||
" press PASS, otherwise press FAIL.\n";
|
||||
|
||||
private static final Font font = new Font("Dialog", Font.BOLD, 12);
|
||||
|
||||
public static void main(String[] args)
|
||||
throws InterruptedException, InvocationTargetException {
|
||||
// check if SystemTray supported on the machine
|
||||
if (!SystemTray.isSupported()) {
|
||||
System.out.println("SystemTray is not supported");
|
||||
return;
|
||||
}
|
||||
PassFailJFrame passFailJFrame = new PassFailJFrame("TrayIcon " +
|
||||
"Test Instructions", INSTRUCTIONS, 8, 18, 85);
|
||||
createAndShowGUI();
|
||||
try {
|
||||
passFailJFrame.awaitAndCheck();
|
||||
} finally {
|
||||
tray.remove(icon);
|
||||
}
|
||||
}
|
||||
|
||||
private static void createAndShowGUI() {
|
||||
ArrayList<Image> imageList = new ArrayList<>();
|
||||
for (int size = 16; size <= 48; size += 4) {
|
||||
imageList.add(createIcon(size));
|
||||
}
|
||||
Image mRImage =
|
||||
new BaseMultiResolutionImage(imageList.toArray(new Image[0]));
|
||||
|
||||
tray = SystemTray.getSystemTray();
|
||||
icon = new TrayIcon(mRImage);
|
||||
|
||||
try {
|
||||
tray.add(icon);
|
||||
} catch (AWTException e) {
|
||||
throw new RuntimeException("Error while adding icon to system tray");
|
||||
}
|
||||
}
|
||||
|
||||
private static Image createIcon(int size) {
|
||||
BufferedImage image = new BufferedImage(size, size,
|
||||
BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g = image.createGraphics();
|
||||
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
g.setColor(Color.WHITE);
|
||||
g.fillRect(0, 0, size, size);
|
||||
g.setFont(font);
|
||||
g.setColor(Color.BLACK);
|
||||
|
||||
TextLayout layout = new TextLayout(String.valueOf(size),
|
||||
g.getFont(), g.getFontRenderContext());
|
||||
int height = (int) layout.getBounds().getHeight();
|
||||
int width = (int) layout.getBounds().getWidth();
|
||||
layout.draw(g, (size - width) / 2f - 1, (size + height) / 2f);
|
||||
g.dispose();
|
||||
return image;
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,8 @@ import javax.swing.tree.TreePath;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.Hashtable;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
@@ -92,6 +94,31 @@ public class AccessibleActionsTest extends AccessibleComponentTest {
|
||||
super.createUI(panel, "AccessibleActionsTest");
|
||||
}
|
||||
|
||||
private void createEditableTextArea() {
|
||||
AccessibleComponentTest.INSTRUCTIONS = "INSTRUCTIONS:\n"
|
||||
+ "Check a11y show context menu in editable JTextArea.\n\n"
|
||||
+ "Turn screen reader on and press Tab to move to the text area and vo+shif+m.\n\n"
|
||||
+ "If the menu appears tab further and press PASS, otherwise press FAIL.";
|
||||
|
||||
JTextArea textArea = new MyTextArea("some text to edit");
|
||||
JLabel label = new JLabel(textArea.getText().length() + " chars");
|
||||
label.setLabelFor(textArea);
|
||||
textArea.setEditable(true);
|
||||
textArea.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
label.setText(String.valueOf(textArea.getText().length()) + " chars");
|
||||
}
|
||||
});
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new FlowLayout());
|
||||
panel.add(textArea);
|
||||
panel.add(label);
|
||||
exceptionString = "Editable text area test failed!";
|
||||
super.createUI(panel, "AccessibleTextTest");
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
AccessibleActionsTest test = new AccessibleActionsTest();
|
||||
|
||||
@@ -110,6 +137,14 @@ public class AccessibleActionsTest extends AccessibleComponentTest {
|
||||
if (!testResult) {
|
||||
throw new RuntimeException(a11yTest.exceptionString);
|
||||
}
|
||||
|
||||
countDownLatch = test.createCountDownLatch();
|
||||
SwingUtilities.invokeLater(test::createEditableTextArea);
|
||||
countDownLatch.await();
|
||||
|
||||
if (!testResult) {
|
||||
throw new RuntimeException(a11yTest.exceptionString);
|
||||
}
|
||||
}
|
||||
|
||||
private class AccessibleActionsTestFrame extends JPanel {
|
||||
@@ -167,17 +202,70 @@ public class AccessibleActionsTest extends AccessibleComponentTest {
|
||||
}
|
||||
}
|
||||
|
||||
private static JPopupMenu createPopup() {
|
||||
JPopupMenu popup = new JPopupMenu("MENU");
|
||||
popup.add("One");
|
||||
popup.add("Two");
|
||||
popup.add("Three");
|
||||
return popup;
|
||||
}
|
||||
|
||||
|
||||
private static void changeText(JLabel label, String text) {
|
||||
label.setText(text);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class MyTextArea extends JTextArea {
|
||||
|
||||
public MyTextArea(String some_text_to_edit) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessibleContext getAccessibleContext() {
|
||||
if (accessibleContext == null) {
|
||||
accessibleContext = new MyAccessibleJTextArea();
|
||||
}
|
||||
return accessibleContext;
|
||||
}
|
||||
|
||||
private class MyAccessibleJTextArea extends JTextArea.AccessibleJTextArea {
|
||||
@Override
|
||||
public AccessibleAction getAccessibleAction() {
|
||||
return new AccessibleAction() {
|
||||
@Override
|
||||
public int getAccessibleActionCount() {
|
||||
AccessibleAction aa = MyAccessibleJTextArea.super.getAccessibleAction();
|
||||
if (aa == null) {
|
||||
return 1;
|
||||
}
|
||||
int count = aa.getAccessibleActionCount();
|
||||
return aa.getAccessibleActionCount() + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccessibleActionDescription(int i) {
|
||||
AccessibleAction aa = MyAccessibleJTextArea.super.getAccessibleAction();
|
||||
if ((aa != null) && (i >= 0) && (i < aa.getAccessibleActionCount())) {
|
||||
return aa.getAccessibleActionDescription(i);
|
||||
}
|
||||
return AccessibleAction.TOGGLE_POPUP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doAccessibleAction(int i) {
|
||||
AccessibleAction aa = MyAccessibleJTextArea.super.getAccessibleAction();
|
||||
if ((aa != null) && (i >= 0) && (i < aa.getAccessibleActionCount())) {
|
||||
return aa.doAccessibleAction(i);
|
||||
}
|
||||
JPopupMenu popup = createPopup();
|
||||
popup.show(MyTextArea.this, 0, 0);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static JPopupMenu createPopup() {
|
||||
JPopupMenu popup = new JPopupMenu("MENU");
|
||||
popup.add("One");
|
||||
popup.add("Two");
|
||||
popup.add("Three");
|
||||
return popup;
|
||||
}
|
||||
}
|
||||
|
||||
321
test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
Normal file
321
test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
Normal file
@@ -0,0 +1,321 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 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.
|
||||
*/
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.Timer;
|
||||
|
||||
import static javax.swing.SwingUtilities.invokeAndWait;
|
||||
import static javax.swing.SwingUtilities.isEventDispatchThread;
|
||||
|
||||
public class PassFailJFrame {
|
||||
|
||||
private static final String TITLE = "Test Instruction Frame";
|
||||
private static final long TEST_TIMEOUT = 5;
|
||||
private static final int ROWS = 10;
|
||||
private static final int COLUMNS = 40;
|
||||
|
||||
private static final List<Frame> frameList = new ArrayList<>();
|
||||
private static final Timer timer = new Timer(0, null);
|
||||
private static final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
private static volatile boolean failed;
|
||||
private static volatile boolean timeout;
|
||||
private static volatile String testFailedReason;
|
||||
private static JFrame frame;
|
||||
|
||||
public enum Position {HORIZONTAL, VERTICAL}
|
||||
|
||||
public PassFailJFrame(String instructions) throws InterruptedException,
|
||||
InvocationTargetException {
|
||||
this(instructions, TEST_TIMEOUT);
|
||||
}
|
||||
|
||||
public PassFailJFrame(String instructions, long testTimeOut) throws
|
||||
InterruptedException, InvocationTargetException {
|
||||
this(TITLE, instructions, testTimeOut);
|
||||
}
|
||||
|
||||
public PassFailJFrame(String title, String instructions,
|
||||
long testTimeOut) throws InterruptedException,
|
||||
InvocationTargetException {
|
||||
this(title, instructions, testTimeOut, ROWS, COLUMNS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a JFrame with a given title & serves as test instructional
|
||||
* frame where the user follows the specified test instruction in order
|
||||
* to test the test case & mark the test pass or fail. If the expected
|
||||
* result is seen then the user click on the 'Pass' button else click
|
||||
* on the 'Fail' button and the reason for the failure should be
|
||||
* specified in the JDialog JTextArea.
|
||||
*
|
||||
* @param title title of the Frame.
|
||||
* @param instructions the instruction for the tester on how to test
|
||||
* and what is expected (pass) and what is not
|
||||
* expected (fail).
|
||||
* @param testTimeOut test timeout where time is specified in minutes.
|
||||
* @param rows number of visible rows of the JTextArea where the
|
||||
* instruction is show.
|
||||
* @param columns Number of columns of the instructional
|
||||
* JTextArea
|
||||
* @throws InterruptedException exception thrown when thread is
|
||||
* interrupted
|
||||
* @throws InvocationTargetException if an exception is thrown while
|
||||
* creating the test instruction frame on
|
||||
* EDT
|
||||
*/
|
||||
public PassFailJFrame(String title, String instructions, long testTimeOut,
|
||||
int rows, int columns) throws InterruptedException,
|
||||
InvocationTargetException {
|
||||
if (isEventDispatchThread()) {
|
||||
createUI(title, instructions, testTimeOut, rows, columns);
|
||||
} else {
|
||||
invokeAndWait(() -> createUI(title, instructions, testTimeOut,
|
||||
rows, columns));
|
||||
}
|
||||
}
|
||||
|
||||
private static void createUI(String title, String instructions,
|
||||
long testTimeOut, int rows, int columns) {
|
||||
frame = new JFrame(title);
|
||||
frame.setLayout(new BorderLayout());
|
||||
JTextArea instructionsText = new JTextArea(instructions, rows, columns);
|
||||
instructionsText.setEditable(false);
|
||||
instructionsText.setLineWrap(true);
|
||||
|
||||
long tTimeout = TimeUnit.MINUTES.toMillis(testTimeOut);
|
||||
|
||||
final JLabel testTimeoutLabel = new JLabel(String.format("Test " +
|
||||
"timeout: %s", convertMillisToTimeStr(tTimeout)), JLabel.CENTER);
|
||||
final long startTime = System.currentTimeMillis();
|
||||
timer.setDelay(1000);
|
||||
timer.addActionListener((e) -> {
|
||||
long leftTime = tTimeout - (System.currentTimeMillis() - startTime);
|
||||
if ((leftTime < 0) || failed) {
|
||||
timer.stop();
|
||||
testFailedReason = "Failure Reason:\n"
|
||||
+ "Timeout User did not perform testing.";
|
||||
timeout = true;
|
||||
latch.countDown();
|
||||
}
|
||||
testTimeoutLabel.setText(String.format("Test timeout: %s", convertMillisToTimeStr(leftTime)));
|
||||
});
|
||||
timer.start();
|
||||
frame.add(testTimeoutLabel, BorderLayout.NORTH);
|
||||
frame.add(new JScrollPane(instructionsText), BorderLayout.CENTER);
|
||||
|
||||
JButton btnPass = new JButton("Pass");
|
||||
btnPass.addActionListener((e) -> {
|
||||
latch.countDown();
|
||||
timer.stop();
|
||||
});
|
||||
|
||||
JButton btnFail = new JButton("Fail");
|
||||
btnFail.addActionListener((e) -> {
|
||||
getFailureReason();
|
||||
timer.stop();
|
||||
});
|
||||
|
||||
JPanel buttonsPanel = new JPanel();
|
||||
buttonsPanel.add(btnPass);
|
||||
buttonsPanel.add(btnFail);
|
||||
|
||||
frame.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
super.windowClosing(e);
|
||||
testFailedReason = "Failure Reason:\n"
|
||||
+ "User closed the instruction Frame";
|
||||
failed = true;
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
frame.add(buttonsPanel, BorderLayout.SOUTH);
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
frameList.add(frame);
|
||||
}
|
||||
|
||||
private static String convertMillisToTimeStr(long millis) {
|
||||
if (millis < 0) {
|
||||
return "00:00:00";
|
||||
}
|
||||
long hours = millis / 3_600_000;
|
||||
long minutes = (millis - hours * 3_600_000) / 60_000;
|
||||
long seconds = (millis - hours * 3_600_000 - minutes * 60_000) / 1_000;
|
||||
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for the user decision i,e user selects pass or fail button.
|
||||
* If user does not select pass or fail button then the test waits for
|
||||
* the specified timeoutMinutes period and the test gets timeout.
|
||||
* Note: This method should be called from main() thread
|
||||
*
|
||||
* @throws InterruptedException exception thrown when thread is
|
||||
* interrupted
|
||||
* @throws InvocationTargetException if an exception is thrown while
|
||||
* disposing of frames on EDT
|
||||
*/
|
||||
public void awaitAndCheck() throws InterruptedException, InvocationTargetException {
|
||||
if (isEventDispatchThread()) {
|
||||
throw new IllegalStateException("awaitAndCheck() should not be called on EDT");
|
||||
}
|
||||
latch.await();
|
||||
invokeAndWait(PassFailJFrame::disposeFrames);
|
||||
|
||||
if (timeout) {
|
||||
throw new RuntimeException(testFailedReason);
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
throw new RuntimeException("Test failed! : " + testFailedReason);
|
||||
}
|
||||
|
||||
System.out.println("Test passed!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispose all the frame(s) i,e both the test instruction frame as
|
||||
* well as the frame that is added via addTestFrame(Frame frame)
|
||||
*/
|
||||
private static synchronized void disposeFrames() {
|
||||
for (Frame f : frameList) {
|
||||
f.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the test failure reason and add the reason to the test result
|
||||
* example in the jtreg .jtr file.
|
||||
*/
|
||||
private static void getFailureReason() {
|
||||
final JDialog dialog = new JDialog(frame, "Test Failure ", true);
|
||||
dialog.setTitle("Failure reason");
|
||||
JPanel jPanel = new JPanel(new BorderLayout());
|
||||
JTextArea jTextArea = new JTextArea(5, 20);
|
||||
|
||||
JButton okButton = new JButton("OK");
|
||||
okButton.addActionListener((ae) -> {
|
||||
testFailedReason = "Failure Reason:\n" + jTextArea.getText();
|
||||
dialog.setVisible(false);
|
||||
});
|
||||
|
||||
jPanel.add(new JScrollPane(jTextArea), BorderLayout.CENTER);
|
||||
|
||||
JPanel okayBtnPanel = new JPanel();
|
||||
okayBtnPanel.add(okButton);
|
||||
|
||||
jPanel.add(okayBtnPanel, BorderLayout.SOUTH);
|
||||
dialog.add(jPanel);
|
||||
dialog.setLocationRelativeTo(frame);
|
||||
dialog.pack();
|
||||
dialog.setVisible(true);
|
||||
|
||||
failed = true;
|
||||
dialog.dispose();
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Position the instruction frame with testFrame ( testcase created
|
||||
* frame) by the specified position
|
||||
* Note: This method should be invoked from the method that creates
|
||||
* testFrame
|
||||
*
|
||||
* @param testFrame test frame that the test is created
|
||||
* @param position position can be either HORIZONTAL (both test
|
||||
* instruction frame and test frame as arranged side by
|
||||
* side or VERTICAL ( both test instruction frame and
|
||||
* test frame as arranged up and down)
|
||||
*/
|
||||
public static void positionTestFrame(Frame testFrame, Position position) {
|
||||
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
if (position.equals(Position.HORIZONTAL)) {
|
||||
int newX = ((screenSize.width / 2) - frame.getWidth());
|
||||
frame.setLocation(newX, frame.getY());
|
||||
|
||||
testFrame.setLocation((frame.getLocation().x + frame.getWidth() + 5), frame.getY());
|
||||
} else if (position.equals(Position.VERTICAL)) {
|
||||
int newY = ((screenSize.height / 2) - frame.getHeight());
|
||||
frame.setLocation(frame.getX(), newY);
|
||||
|
||||
testFrame.setLocation(frame.getX(),
|
||||
(frame.getLocation().y + frame.getHeight() + 5));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the testFrame to the frameList so that test instruction frame
|
||||
* and testFrame and any other frame used in this test is disposed
|
||||
* via disposeFrames()
|
||||
*
|
||||
* @param testFrame testFrame that needs to be disposed
|
||||
*/
|
||||
public static synchronized void addTestFrame(Frame testFrame) {
|
||||
frameList.add(testFrame);
|
||||
}
|
||||
|
||||
/**
|
||||
* Forcibly pass the test.
|
||||
* <p>The sample usage:
|
||||
* <pre><code>
|
||||
* PrinterJob pj = PrinterJob.getPrinterJob();
|
||||
* if (pj == null || pj.getPrintService() == null) {
|
||||
* System.out.println(""Printer not configured or available.");
|
||||
* PassFailJFrame.forcePass();
|
||||
* }
|
||||
* </code></pre>
|
||||
*/
|
||||
public static void forcePass() {
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Forcibly fail the test.
|
||||
*/
|
||||
public static void forceFail() {
|
||||
failed = true;
|
||||
latch.countDown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
/* @test
|
||||
* @bug 7132924
|
||||
* @bug 7132924 8285515
|
||||
* @library /test/lib
|
||||
* @key intermittent
|
||||
* @summary Test DatagramChannel.disconnect when DatagramChannel is connected to an IPv4 socket
|
||||
|
||||
109
test/jdk/java/nio/file/DirectoryStream/ParallelHeavy.java
Executable file
109
test/jdk/java/nio/file/DirectoryStream/ParallelHeavy.java
Executable file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright 2022 JetBrains s.r.o.
|
||||
* 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 Verifies that DirectoryStream's iterator works correctly in
|
||||
* a multi-threaded environment.
|
||||
* @library ..
|
||||
* @run main/timeout=240 ParallelHeavy
|
||||
*/
|
||||
import java.io.IOException;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.DirectoryIteratorException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ParallelHeavy {
|
||||
static final int RETRIES = 42;
|
||||
static final int COUNT_TASKS = 7;
|
||||
static final int COUNT_FILES = 1024;
|
||||
static final int COUNT_DIRECTORIES = 1024;
|
||||
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
final Path testDir = Paths.get(System.getProperty("test.dir", "."));
|
||||
final Path dir = Files.createTempDirectory(testDir, "ParallelHeavy");
|
||||
|
||||
populateDir(dir);
|
||||
|
||||
for (int i = 0; i < RETRIES; i++) {
|
||||
runTest(dir, COUNT_DIRECTORIES + COUNT_FILES - i);
|
||||
}
|
||||
}
|
||||
|
||||
static void advanceIteratorThenCancel(final DirectoryStream<Path> stream, final Iterator<Path> iterator, int closeAfterReading) {
|
||||
while (closeAfterReading-- > 0) {
|
||||
try {
|
||||
iterator.next();
|
||||
} catch (NoSuchElementException e) {
|
||||
System.out.println("NoSuchElementException, stream may have been closed, remaining to read "
|
||||
+ closeAfterReading + ", thread " + Thread.currentThread().getId());
|
||||
break;
|
||||
}
|
||||
Thread.yield();
|
||||
}
|
||||
try {
|
||||
stream.close();
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
|
||||
static void runTest(final Path dir, int closeAfterReading) throws IOException {
|
||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
|
||||
final Iterator<Path> streamIterator = stream.iterator();
|
||||
|
||||
final ExecutorService pool = Executors.newCachedThreadPool();
|
||||
try {
|
||||
for (int i = 0; i < COUNT_TASKS - 1; i++) {
|
||||
pool.submit(() -> advanceIteratorThenCancel(stream, streamIterator, closeAfterReading));
|
||||
}
|
||||
pool.submit(() -> advanceIteratorThenCancel(stream, streamIterator, COUNT_FILES));
|
||||
try {
|
||||
pool.awaitTermination(3, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException ignored) {}
|
||||
|
||||
} finally {
|
||||
pool.shutdown();
|
||||
}
|
||||
} catch (DirectoryIteratorException ex) {
|
||||
throw ex.getCause();
|
||||
}
|
||||
}
|
||||
|
||||
static void populateDir(final Path root) throws IOException {
|
||||
for (int i = 0; i < COUNT_DIRECTORIES; i++) {
|
||||
final Path newDir = root.resolve("directory-number-" + i);
|
||||
Files.createDirectory(newDir);
|
||||
}
|
||||
|
||||
for (int i = 0; i < COUNT_FILES; i++) {
|
||||
final Path newFile = root.resolve("longer-file-name-number-" + i);
|
||||
Files.createFile(newFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2022, 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
|
||||
@@ -161,7 +161,7 @@ public class Basic {
|
||||
new ExType("doc", List.of("application/msword")),
|
||||
new ExType("docx", List.of("application/vnd.openxmlformats-officedocument.wordprocessingml.document")),
|
||||
new ExType("gz", List.of("application/gzip", "application/x-gzip")),
|
||||
new ExType("jar", List.of("application/java-archive", "application/x-java-archive")),
|
||||
new ExType("jar", List.of("application/java-archive", "application/x-java-archive", "application/jar")),
|
||||
new ExType("jpg", List.of("image/jpeg")),
|
||||
new ExType("js", List.of("text/javascript", "application/javascript")),
|
||||
new ExType("json", List.of("application/json")),
|
||||
|
||||
@@ -1412,10 +1412,10 @@ public class PathOps {
|
||||
.invalid();
|
||||
test("foo\u0000\bar")
|
||||
.invalid();
|
||||
test("C:\\foo ") // trailing space
|
||||
.invalid();
|
||||
test("C:\\foo ")
|
||||
.string("C:\\foo ");// trailing space
|
||||
test("C:\\foo \\bar")
|
||||
.invalid();
|
||||
.string("C:\\foo \\bar");
|
||||
//test("C:\\foo.") // trailing dot
|
||||
//.invalid();
|
||||
//test("C:\\foo...\\bar")
|
||||
|
||||
65
test/jdk/java/nio/file/Path/TrailingSpace.java
Normal file
65
test/jdk/java/nio/file/Path/TrailingSpace.java
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2022 JetBrains s.r.o.
|
||||
* 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
|
||||
* @bug 8190546
|
||||
* @summary Verifies that a path name that ends with a space can be
|
||||
* successfully created.
|
||||
*/
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Files;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TrailingSpace {
|
||||
static void testResolve(String parent, String... paths) {
|
||||
final Path p = Path.of(parent, paths);
|
||||
System.out.println("Path successfully created: " + p);
|
||||
}
|
||||
|
||||
static void testResolve(String path) {
|
||||
final Path p = Path.of(path);
|
||||
System.out.println("Path successfully created: " + p);
|
||||
}
|
||||
|
||||
static void testDelete(String path) throws IOException {
|
||||
final Path p = Files.createDirectories(Path.of(path));
|
||||
Files.delete(p);
|
||||
}
|
||||
|
||||
public static void main(String args[]) throws IOException {
|
||||
testResolve("./", "ends-with-space ");
|
||||
testResolve("ends-with-space ");
|
||||
testResolve("1", "2", "ends-with-space ", "3");
|
||||
testResolve("1\\2\\ends-with-space \\3");
|
||||
testResolve("1/2/ends-with-space /3");
|
||||
testResolve("1/2/ends-with-space \\3");
|
||||
testResolve("ends-with-space /");
|
||||
testResolve("ends-with-space ///");
|
||||
testResolve("ends-with-space \\");
|
||||
testResolve("ends-with-space \\\\\\");
|
||||
|
||||
testDelete("ends-with-space ");
|
||||
testDelete("ends-with-space-1 \\");
|
||||
}
|
||||
}
|
||||
@@ -35,9 +35,11 @@ jbr-${jbsdk_version}-linux-aarch64-b${build_number}.tar.gz
|
||||
jbr-${jbsdk_version}-linux-musl-aarch64-b${build_number}.tar.gz
|
||||
jbr-${jbsdk_version}-linux-musl-x64-b${build_number}.tar.gz
|
||||
jbr-${jbsdk_version}-linux-x64-b${build_number}.tar.gz
|
||||
jbr-${jbsdk_version}-linux-x86-b${build_number}.tar.gz
|
||||
jbr-${jbsdk_version}-osx-aarch64-b${build_number}.tar.gz
|
||||
jbr-${jbsdk_version}-osx-x64-b${build_number}.tar.gz
|
||||
jbr-${jbsdk_version}-windows-x64-b${build_number}.tar.gz
|
||||
jbr-${jbsdk_version}-windows-x86-b${build_number}.tar.gz
|
||||
|
||||
jbr_fd-${jbsdk_version}-linux-aarch64-b${build_number}.tar.gz
|
||||
jbr_fd-${jbsdk_version}-linux-x64-b${build_number}.tar.gz
|
||||
@@ -62,17 +64,21 @@ jbrsdk-${jbsdk_version}-linux-aarch64-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-linux-musl-aarch64-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-linux-musl-x64-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-linux-x64-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-linux-x86-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-osx-aarch64-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-osx-x64-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-windows-x64-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-windows-x86-b${build_number}.tar.gz
|
||||
|
||||
jbrsdk-${jbsdk_version}-linux-test-aarch64-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-linux-musl-test-aarch64-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-linux-musl-test-x64-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-linux-test-x64-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-linux-test-x86-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-osx-test-aarch64-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-osx-test-x64-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-windows-test-x64-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-windows-test-x86-b${build_number}.tar.gz
|
||||
|
||||
jbrsdk-${jbsdk_version}-linux-aarch64-fastdebug-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-linux-x64-fastdebug-b${build_number}.tar.gz
|
||||
@@ -80,11 +86,13 @@ jbrsdk-${jbsdk_version}-osx-aarch64-fastdebug-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-osx-x64-fastdebug-b${build_number}.tar.gz
|
||||
jbrsdk-${jbsdk_version}-windows-x64-fastdebug-b${build_number}.tar.gz
|
||||
|
||||
jbrsdk-${jbsdk_version}-linux-aarch64-b${build_number}_diz.tar.gz
|
||||
jbrsdk-${jbsdk_version}-linux-aarch64-fastdebug-b${build_number}_diz.tar.gz
|
||||
jbrsdk-${jbsdk_version}-linux-musl-aarch64-b${build_number}_diz.tar.gz
|
||||
jbrsdk-${jbsdk_version}-linux-musl-x64-b${build_number}_diz.tar.gz
|
||||
jbrsdk-${jbsdk_version}-linux-x64-b${build_number}_diz.tar.gz
|
||||
jbrsdk-${jbsdk_version}-linux-x64-fastdebug-b${build_number}_diz.tar.gz
|
||||
jbrsdk-${jbsdk_version}-linux-x86-b${build_number}_diz.tar.gz
|
||||
jbrsdk-${jbsdk_version}-osx-aarch64-b${build_number}_diz.tar.gz
|
||||
jbrsdk-${jbsdk_version}-osx-aarch64-fastdebug-b${build_number}_diz.tar.gz
|
||||
jbrsdk-${jbsdk_version}-osx-x64-b${build_number}_diz.tar.gz
|
||||
@@ -98,6 +106,7 @@ jbrsdk_jcef-${jbsdk_version}-osx-x64-b${build_number}.pkg
|
||||
jbrsdk_jcef-${jbsdk_version}-osx-x64-b${build_number}.tar.gz
|
||||
jbrsdk_jcef-${jbsdk_version}-windows-x64-b${build_number}.tar.gz
|
||||
|
||||
jbrsdk_jcef-${jbsdk_version}-linux-aarch64-b${build_number}_diz.tar.gz
|
||||
jbrsdk_jcef-${jbsdk_version}-linux-x64-b${build_number}_diz.tar.gz
|
||||
jbrsdk_jcef-${jbsdk_version}-osx-aarch64-b${build_number}_diz.tar.gz
|
||||
jbrsdk_jcef-${jbsdk_version}-osx-x64-b${build_number}_diz.tar.gz
|
||||
@@ -129,7 +138,7 @@ done
|
||||
if [ $n -eq 0 ]; then
|
||||
echo \#\#teamcity[testFinished name=\'$testname\']
|
||||
else
|
||||
echo \#\#teamcity[testFailed name=\'$testname\' message=\'Some artifacts cannot be found\']
|
||||
echo \#\#teamcity[testFailed name=\'$testname\' message=\'There are some incosistency between expected/actual set of artifacts \']
|
||||
fi
|
||||
|
||||
exit $n
|
||||
99
test/jdk/jb/hotspot/AbortHandler.java
Normal file
99
test/jdk/jb/hotspot/AbortHandler.java
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright 2022 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @requires (os.family == "mac" | os.family == "linux")
|
||||
* @summary Verifies that double-free causes hs_err file to be generated
|
||||
* (it is implied that the underlying malloc() is capable of
|
||||
* detecting this and will abort() in that case).
|
||||
* @library /test/lib
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @run main AbortHandler
|
||||
*/
|
||||
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.Utils;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import java.util.ArrayList;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Files;
|
||||
|
||||
public class AbortHandler {
|
||||
static final String MARKER_TEXT = "SHOULD NOT REACH HERE";
|
||||
static final String HS_ERR_FILE_NAME = "hs_err.txt";
|
||||
static final Unsafe unsafe = Unsafe.getUnsafe();
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
if (args.length > 0 && args[0].equals("--test")) {
|
||||
final long addr = unsafe.allocateMemory(42);
|
||||
unsafe.freeMemory(addr);
|
||||
unsafe.freeMemory(addr);
|
||||
unsafe.freeMemory(addr);
|
||||
unsafe.freeMemory(addr);
|
||||
System.out.println(MARKER_TEXT); // not supposed to get here if libc detected double-free
|
||||
} else {
|
||||
verifyErrorFileNotCreated(); // with default options
|
||||
verifyErrorFileCreated(); // with the option that enables SIGABRT to be caught
|
||||
}
|
||||
}
|
||||
|
||||
public static void verifyErrorFileNotCreated() throws Exception {
|
||||
ArrayList<String> opts = new ArrayList<>();
|
||||
opts.add("--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED");
|
||||
opts.add("-XX:-CreateCoredumpOnCrash");
|
||||
// opts.add("-XX:+CatchSIGABRT"); // By default, SIGABRT shouldn't generate hs_err
|
||||
opts.add("AbortHandler");
|
||||
opts.add("--test");
|
||||
ProcessBuilder pb = ProcessTools.createTestJvm(opts);
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
|
||||
final String hs_err_file = output.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1);
|
||||
if (hs_err_file != null) {
|
||||
throw new RuntimeException("hs_err_pid file generated with default options");
|
||||
}
|
||||
}
|
||||
|
||||
public static void verifyErrorFileCreated() throws Exception {
|
||||
ArrayList<String> opts = new ArrayList<>();
|
||||
opts.add("--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED");
|
||||
opts.add("-XX:-CreateCoredumpOnCrash");
|
||||
opts.add("-XX:+CatchSIGABRT");
|
||||
opts.add("AbortHandler");
|
||||
opts.add("--test");
|
||||
ProcessBuilder pb = ProcessTools.createTestJvm(opts);
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
|
||||
output.shouldNotContain(MARKER_TEXT);
|
||||
|
||||
final String hs_err_file = output.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1);
|
||||
if (hs_err_file == null) {
|
||||
throw new RuntimeException("Did not find hs_err_pid file in output");
|
||||
}
|
||||
|
||||
final Path hsErrPath = Paths.get(hs_err_file);
|
||||
if (!Files.exists(hsErrPath)) {
|
||||
throw new RuntimeException("hs_err_pid file missing at " + hsErrPath + ".\n");
|
||||
}
|
||||
|
||||
System.out.println(hs_err_file + " was created");
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@ import java.awt.Desktop;
|
||||
import java.awt.Robot;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @test
|
||||
@@ -33,7 +35,10 @@ import java.awt.event.KeyEvent;
|
||||
*/
|
||||
|
||||
public class AboutHandlerTest {
|
||||
private static final int WAIT_TIME = 1000;
|
||||
|
||||
private static CountDownLatch doneSignal = new CountDownLatch(1);
|
||||
|
||||
private static final int WAIT_TIME = 3000;
|
||||
|
||||
private static Robot robot;
|
||||
|
||||
@@ -45,9 +50,11 @@ public class AboutHandlerTest {
|
||||
robot = new Robot();
|
||||
robot.setAutoDelay(50);
|
||||
|
||||
long starttime = System.currentTimeMillis();
|
||||
Desktop.getDesktop().setAboutHandler(e -> {
|
||||
System.out.println("AboutHandler hits");
|
||||
testPassed = true;
|
||||
doneSignal.countDown();
|
||||
});
|
||||
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
@@ -55,8 +62,9 @@ public class AboutHandlerTest {
|
||||
});
|
||||
|
||||
// waiting for AboutHandler
|
||||
sleep(WAIT_TIME);
|
||||
|
||||
doneSignal.await(WAIT_TIME, TimeUnit.SECONDS);
|
||||
long endtime = System.currentTimeMillis();
|
||||
System.out.println("Duration (milisec): " + (endtime - starttime));
|
||||
myApp.dispose();
|
||||
|
||||
if (!testPassed)
|
||||
@@ -85,8 +93,4 @@ public class AboutHandlerTest {
|
||||
robot.keyPress(KeyEvent.VK_ENTER);
|
||||
robot.keyRelease(KeyEvent.VK_ENTER);
|
||||
}
|
||||
|
||||
private static void sleep(int millis) throws InterruptedException {
|
||||
Thread.sleep(millis);
|
||||
}
|
||||
}
|
||||
|
||||
93
test/jdk/jb/java/awt/Focus/FileDialogClosing.java
Normal file
93
test/jdk/jb/java/awt/Focus/FileDialogClosing.java
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright 2022 JetBrains s.r.o.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Regression test for JBR-4546 Focus is not returned back to IDE after closing "Open" dialog
|
||||
* @key headful
|
||||
*/
|
||||
|
||||
public class FileDialogClosing {
|
||||
private static final AtomicInteger pressedCount = new AtomicInteger();
|
||||
|
||||
private static Robot robot;
|
||||
private static Frame frame;
|
||||
private static Button button;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
robot = new Robot();
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(FileDialogClosing::initUI);
|
||||
robot.delay(1000);
|
||||
clickOn(button);
|
||||
robot.delay(1000);
|
||||
pressAndRelease(KeyEvent.VK_ESCAPE);
|
||||
robot.delay(1000);
|
||||
pressAndRelease(KeyEvent.VK_SPACE);
|
||||
robot.delay(1000);
|
||||
if (pressedCount.get() != 2) {
|
||||
throw new RuntimeException("Unexpected pressed count: " + pressedCount);
|
||||
}
|
||||
} finally {
|
||||
SwingUtilities.invokeAndWait(FileDialogClosing::disposeUI);
|
||||
}
|
||||
}
|
||||
|
||||
private static void initUI() {
|
||||
frame = new Frame("FileDialogClosing");
|
||||
button = new Button("Open dialog");
|
||||
button.addActionListener(e -> {
|
||||
pressedCount.incrementAndGet();
|
||||
new FileDialog(frame).setVisible(true);
|
||||
});
|
||||
frame.add(button);
|
||||
frame.setBounds(200, 200, 200, 200);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
private static void disposeUI() {
|
||||
if (frame != null) frame.dispose();
|
||||
}
|
||||
|
||||
private static void clickAt(int x, int y) {
|
||||
robot.mouseMove(x, y);
|
||||
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||
}
|
||||
|
||||
private static void clickOn(Component component) {
|
||||
Point location = component.getLocationOnScreen();
|
||||
clickAt(location.x + component.getWidth() / 2, location.y + component.getHeight() / 2);
|
||||
}
|
||||
|
||||
private static void pressAndRelease(int keyCode) {
|
||||
robot.keyPress(keyCode);
|
||||
robot.keyRelease(keyCode);
|
||||
}
|
||||
}
|
||||
123
test/jdk/jb/java/awt/Window/ZOrderOnModalDialogActivation.java
Normal file
123
test/jdk/jb/java/awt/Window/ZOrderOnModalDialogActivation.java
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright 2022 JetBrains s.r.o.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.File;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Regression test for JBR-4463 Activating app-modal dialog brings all app windows to front
|
||||
* @key headful
|
||||
*/
|
||||
|
||||
public class ZOrderOnModalDialogActivation {
|
||||
static final int EXPECTED_EXIT_CODE = 123;
|
||||
|
||||
private static Robot robot;
|
||||
private static JFrame frame1;
|
||||
private static JFrame frame2;
|
||||
private static Process otherProcess;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
robot = new Robot();
|
||||
try {
|
||||
SwingUtilities.invokeLater(ZOrderOnModalDialogActivation::initUI);
|
||||
robot.delay(1000);
|
||||
launchOtherProcess();
|
||||
robot.delay(1000);
|
||||
clickAt(350, 500); // Button 2 - make sure other process' window is activated
|
||||
robot.delay(1000);
|
||||
clickAt(200, 200); // modal dialog
|
||||
robot.delay(1000);
|
||||
clickAt(250, 500); // Button 1 (assuming other process' window is still shown above)
|
||||
if (!otherProcess.waitFor(5, TimeUnit.SECONDS)) {
|
||||
throw new RuntimeException("Child process hasn't exited");
|
||||
}
|
||||
if (otherProcess.exitValue() != EXPECTED_EXIT_CODE) {
|
||||
throw new RuntimeException("Unexpected exit code: " + otherProcess.exitValue());
|
||||
}
|
||||
} finally {
|
||||
SwingUtilities.invokeAndWait(ZOrderOnModalDialogActivation::disposeUI);
|
||||
}
|
||||
}
|
||||
|
||||
private static void initUI() {
|
||||
frame1 = new JFrame("ZOOMDA 1");
|
||||
frame1.setBounds(100, 100, 200, 200);
|
||||
frame1.setVisible(true);
|
||||
frame2 = new JFrame("ZOOMDA 2");
|
||||
frame2.setBounds(100, 400, 200, 200);
|
||||
frame2.setVisible(true);
|
||||
JDialog d = new JDialog(frame1, "ZOOMDA 3", true);
|
||||
d.setBounds(150, 150, 100, 100);
|
||||
d.setVisible(true);
|
||||
}
|
||||
|
||||
private static void disposeUI() {
|
||||
if (frame1 != null) frame1.dispose();
|
||||
if (frame2 != null) frame2.dispose();
|
||||
if (otherProcess != null) otherProcess.destroyForcibly();
|
||||
}
|
||||
|
||||
private static void launchOtherProcess() throws Exception {
|
||||
otherProcess = Runtime.getRuntime().exec(new String[]{
|
||||
System.getProperty("java.home") + File.separator + "bin" + File.separator + "java",
|
||||
"-cp",
|
||||
System.getProperty("java.class.path"),
|
||||
"ZOrderOnModalDialogActivationChild"
|
||||
});
|
||||
if (otherProcess.getInputStream().read() == -1) {
|
||||
throw new RuntimeException("Error starting process");
|
||||
}
|
||||
}
|
||||
|
||||
private static void clickAt(int x, int y) {
|
||||
robot.mouseMove(x, y);
|
||||
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||
}
|
||||
}
|
||||
|
||||
class ZOrderOnModalDialogActivationChild {
|
||||
public static void main(String[] args) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JFrame f = new JFrame("ZOOMDAC");
|
||||
f.addWindowFocusListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowGainedFocus(WindowEvent e) {
|
||||
System.out.println();
|
||||
}
|
||||
});
|
||||
f.setLayout(new BorderLayout());
|
||||
JButton button1 = new JButton("Button 1");
|
||||
button1.addActionListener(e -> System.exit(ZOrderOnModalDialogActivation.EXPECTED_EXIT_CODE));
|
||||
f.add(button1, BorderLayout.WEST);
|
||||
f.add(new JButton("Button 2"), BorderLayout.EAST);
|
||||
f.setBounds(200, 450, 200, 100);
|
||||
f.setVisible(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2021, 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
|
||||
* @bug 8266851
|
||||
* @library /test/lib
|
||||
* @build JbrIllegalAccessTest
|
||||
* @run testng JbrIllegalAccessTest
|
||||
* @summary Make sure that --jbr-illegal-access is working.
|
||||
*/
|
||||
|
||||
import jdk.test.lib.process.*;
|
||||
import org.testng.annotations.*;
|
||||
|
||||
/**
|
||||
* Make sure that --jbr-illegal-access is working as expected.
|
||||
*/
|
||||
|
||||
@Test
|
||||
public class JbrIllegalAccessTest {
|
||||
|
||||
void run(String text, String... vmopts)
|
||||
throws Exception
|
||||
{
|
||||
var outputAnalyzer = ProcessTools
|
||||
.executeTestJava(vmopts)
|
||||
.outputTo(System.out)
|
||||
.errorTo(System.out);
|
||||
outputAnalyzer.shouldNotContain(text);
|
||||
}
|
||||
|
||||
public void testObsolete() throws Exception {
|
||||
run("Unrecognized option: --jbr-illegal-access",
|
||||
"-XX:-IgnoreUnrecognizedVMOptions",
|
||||
"--jbr-illegal-access", "--version");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,3 +2,10 @@ java/awt/Toolkit/LWCToolkitInvokeAndWaitTest.java nobug macosx-all,linux-all,w
|
||||
java/awt/Toolkit/AWTThreadingTest.java nobug macosx-all,linux-all,windows-all
|
||||
java/awt/Toolkit/AWTThreadingCMenuTest.java nobug macosx-all,linux-all,windows-all
|
||||
sanity/client/SwingSet/src/TreeDemoTest.java JBR-3389 macosx-all
|
||||
java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.java nobug macosx-all,linux-all,windows-all
|
||||
java/awt/List/NofocusListDblClickTest/NofocusListDblClickTest.java nobug macosx-all,linux-all,windows-all
|
||||
javax/swing/JInternalFrame/Test6505027.java nobug macosx-all,linux-all,windows-all
|
||||
javax/swing/JPopupMenu/4634626/bug4634626.java nobug macosx-all,linux-all,windows-all
|
||||
javax/swing/JPopupMenu/4966112/bug4966112.java nobug macosx-all,linux-all,windows-all
|
||||
jb/java/awt/Desktop/AboutHandlerTest.java nobug macosx-all,linux-all,windows-all
|
||||
sun/java2d/GdiRendering/InsetClipping.java nobug macosx-all,linux-all,windows-all
|
||||
@@ -124,6 +124,7 @@ java/awt/Frame/MaximizedUndecorated/MaximizedUndecorated.java 8022302 generic-al
|
||||
java/awt/FileDialog/FileDialogIconTest/FileDialogIconTest.java 8160558 windows-all
|
||||
java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java 8060176 windows-all,macosx-all
|
||||
java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java 8060176 windows-all,macosx-all
|
||||
java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java 8204200 windows-all,linux-all
|
||||
java/awt/dnd/DropTargetEnterExitTest/MissedDragExitTest.java 8159694 linux-all
|
||||
java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java 8164464 linux-all,macosx-all
|
||||
java/awt/dnd/URIListBetweenJVMsTest/URIListBetweenJVMsTest.java 8171510,JBR-881 macosx-all,linux-all
|
||||
@@ -245,9 +246,9 @@ sun/awt/datatransfer/SuplementaryCharactersTransferTest.java 8011371 generic-all
|
||||
sun/awt/shell/ShellFolderMemoryLeak.java 8197794 windows-all
|
||||
sun/java2d/DirectX/OnScreenRenderingResizeTest/OnScreenRenderingResizeTest.java 8022403 generic-all
|
||||
sun/java2d/DirectX/OverriddenInsetsTest/OverriddenInsetsTest.java 8196102 generic-all
|
||||
sun/java2d/DirectX/RenderingToCachedGraphicsTest/RenderingToCachedGraphicsTest.java 8196180 windows-all,macosx-all
|
||||
sun/java2d/DirectX/RenderingToCachedGraphicsTest/RenderingToCachedGraphicsTest.java 8196180,8252812 windows-all,macosx-all,linux-all
|
||||
java/awt/Graphics2D/CopyAreaOOB.java 7001973 windows-all,macosx-all,linux-all
|
||||
java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java 8266283 generic-all
|
||||
java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java 8266283,JBR-3770 linux-aarch64,macosx-all
|
||||
sun/java2d/SunGraphics2D/EmptyClipRenderingTest.java 8144029 macosx-all,linux-all,windows-all
|
||||
sun/java2d/SunGraphics2D/DrawImageBilinear.java 8191406 generic-all
|
||||
sun/java2d/SunGraphics2D/PolyVertTest.java 6986565 generic-all
|
||||
@@ -738,6 +739,7 @@ javax/sound/midi/Sequencer/MetaCallback.java 8178698 linux-all
|
||||
javax/swing/plaf/basic/BasicComboPopup/JComboBoxPopupLocation/JComboBoxPopupLocation.java 8194945 macosx-all
|
||||
javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java 8253184 windows-all
|
||||
javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java 8233177 linux-all,windows-all
|
||||
javax/swing/plaf/nimbus/TestNimbusOverride.java 8253184 windows-all
|
||||
|
||||
javax/swing/border/TestTitledBorderLeak.java 8213531 linux-all,windows-all
|
||||
javax/swing/JButton/8151303/PressedIconTest.java 8266246 macosx-aarch64
|
||||
@@ -760,6 +762,7 @@ javax/swing/JPopupMenu/6800513/bug6800513.java 7184956 macosx-all
|
||||
javax/swing/JSplitPane/4885629/bug4885629.java 8019935 macosx-all
|
||||
javax/swing/JTabbedPane/8007563/Test8007563.java 8051591 generic-all
|
||||
javax/swing/JTabbedPane/4624207/bug4624207.java 8064922,8197552 macosx-all,windows-all 8064922:macosx-all, 8197552:windows-all
|
||||
javax/swing/JToolBar/4529206/bug4529206.java 8288707 linux-x64
|
||||
javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java 8160720 generic-all
|
||||
javax/swing/text/DefaultCaret/HidingSelection/HidingSelectionTest.java 8194048 windows-all
|
||||
javax/swing/text/DefaultCaret/HidingSelection/MultiSelectionTest.java 8213562 linux-all
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user