Compare commits

..

21 Commits

Author SHA1 Message Date
Vitaly Provodin
eb50d78993 JBR-4188 add exec permissions 2022-01-19 13:35:41 +07:00
Vitaly Provodin
06f278163f JBR-4188 fix misprint in checking if headers exist 2022-01-19 05:20:41 +07:00
Vitaly Provodin
a85ee0a793 Revert "exclude two tests carshing test runs on macosx-aarch64"
This reverts commit 72ae2bf54f.
2022-01-16 08:39:35 +07:00
Vitaly Provodin
7eaa648e23 Revert "JBR-4150 IDE regularly locks up at sun.lwawt.macosx.LWCToolkit.getScreenInsets"
This reverts commit 2aeb7aeab4.
2022-01-16 08:39:24 +07:00
Vitaly Provodin
145fa0245d Revert "JBR-4164 IDEs cannot be launched via launch configuration"
This reverts commit a8afa8da75.
2022-01-16 08:39:10 +07:00
Vitaly Provodin
72ae2bf54f exclude two tests carshing test runs on macosx-aarch64 2022-01-16 07:32:00 +07:00
Alexey Ushakov
a8afa8da75 JBR-4164 IDEs cannot be launched via launch configuration
Moved execution of displayChanged() to EDT
2022-01-14 22:33:35 +01:00
Artem Semenov
0a4ee1132a JBR-4167 [JCK] AccassibleJTree tests fail on Ubuntu 2022-01-14 19:30:30 +03:00
Maxim Kartashev
2bc2ee6614 JBR-4043 Make jar and module files in JBR build reproducible
Added a separate build step that invokes the freshly-built jar that supports
the --date option on jrt-fs.jar before the latter is added to java.base.jmod.
This way both jrt-fs.jar and java.base.jmod have files timestamped with
a pre-determined date in the "reproducible build" mode.
2022-01-14 10:12:28 +03:00
Vitaly Provodin
797b2893fe JBR-4169 add jdk.javadoc into JBR 2022-01-14 04:00:15 +07:00
Andrew Leonard
4483339cac JBR-4062 8279834: Alpine Linux fails to build when --with-source-date enabled
Reviewed-by: erikj
2022-01-12 10:38:02 +03:00
Maxim Kartashev
c32af223f5 JBR-4145 Make builds independent from build directory
Supplied the --disable-absolute-path-in-output option to the configure script
when building JBR. This option, however, didn't affect the generated
debug info, so added -fdebug-prefix-map to the list of C and
assembler options, which normalized debug info fully on MacOS and partly
on Linux.
On Linux, libjvm.debuginfo contained an ELF symbol of type FILE with an absolute
path name of linux_x86_64.o. This was solved by explicitly specifying
the .file assembler directive in that file and all the other asm files
without one for uniformity.
2022-01-11 16:42:42 +03:00
Nikita Gubarkov
306bc0e3f8 JBR API v0.0.2
Fixed NPE in JBRFileDialog
2022-01-11 01:43:28 +03:00
Alexey Ushakov
dc8888f2e0 JBR-3044 Regression test java/awt/Graphics2D/DrawString/LCDTextSrcEa.sh fails on macOS BigSur (11.1 aarch64 and 11.2 x64)
Disable the test on mac (there is no way to enable LCD)
2022-01-02 15:07:34 +01:00
Vitaly Provodin
df843f11b5 exclude java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java due to 8266283
& java/awt/dnd/URIListBetweenJVMsTest/URIListBetweenJVMsTest.java on linux due to JBR-881 linux-all
2021-12-31 03:49:10 +07:00
Vitaly Provodin
b1564db09a add exclude exclude list for the IDEA VMoptions test run cofnigs 2021-12-31 03:49:10 +07:00
Vladimir Dvorak
bc69f1d27b JBR-4148 - removed meaningless copying of data to itself 2021-12-29 17:40:27 +01:00
Alexey Ushakov
2aeb7aeab4 JBR-4150 IDE regularly locks up at sun.lwawt.macosx.LWCToolkit.getScreenInsets
Restored caching screen insets. Added handling of dock resize.
2021-12-29 14:05:10 +01:00
Vladimir Dvorak
9da926bdf0 JBR-4110 - disable UseEmptySlotsInSupers
dcevm instance transformation expects increasing field's offset when
fields of class are iterated. This ordering is no more valid if
UseEmptySlotsInSupers=true.
2021-12-27 12:36:28 +01:00
Vladimir Dvorak
b916bf4ef7 JBR-4125 - fix wrong addition of java.lang.Object as superclass 2021-12-27 12:36:18 +01:00
Dmitry Batrak
495e3f013c JBR-2907 [JCK] Font.equals(Font) returns false after serialization/deserialization
(cherry picked from commit 9cc82c39d9)
2021-12-27 12:16:15 +03:00
32 changed files with 310 additions and 123 deletions

View File

@@ -36,7 +36,7 @@ REPRODUCIBLE_BUILD_OPTS="--enable-reproducible-build
--with-source-date=$SOURCE_DATE_EPOCH
--with-hotspot-build-time=$BUILD_TIME
--with-copyright-year=$COPYRIGHT_YEAR
--with-native-debug-symbols=none"
--disable-absolute-paths-in-output"
function do_exit() {
exit_code=$1

4
jb/project/tools/test/perfcmp.sh Normal file → Executable file
View File

@@ -49,7 +49,7 @@ echo $refFile
echo $resFile
curValues=`cat "$curFile" | cut -f 2 | tr -d '\t'`
if [ -z noHeaders ]; then
if [ -z $noHeaders ]; then
curValuesHeader=`echo "$curValues" | head -n +1`_cur
header=`cat "$refFile" | head -n +1 | awk -F'\t' -v x=$curValuesHeader '{print " "$1"\t"$2"_ref\t"x"\tratio"}'`
testContent=`paste -d '\t' $refFile <(echo "$curValues") | tail -n +2`
@@ -58,7 +58,7 @@ else
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)} }'`
if [ -z noHeaders ]; then
if [ -z $noHeaders ]; then
echo "$header" > $resFile
fi
echo "$testContent" >> $resFile

View File

@@ -228,6 +228,19 @@ else
JMOD_SOURCE_DATE :=
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)
endif
endif
# Create jmods in the support dir and then move them into place to keep the
# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
$(eval $(call SetupExecute, create_$(JMOD_FILE), \

View File

@@ -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
@@ -356,9 +356,9 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
fi
AC_SUBST(IS_GNU_TIME)
# Check if it's GNU date
AC_MSG_CHECKING([if date is the GNU version])
check_date=`$DATE --version 2>&1 | $GREP GNU`
# Check if it's a GNU date compatible version
AC_MSG_CHECKING([if date is a GNU compatible version])
check_date=`$DATE --version 2>&1 | $GREP "GNU\|BusyBox"`
if test "x$check_date" != x; then
AC_MSG_RESULT([yes])
IS_GNU_DATE=yes

View File

@@ -778,6 +778,8 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
FILE_MACRO_CFLAGS=
]
)
# -fdebug-prefix-map is supported by all modern versions of gcc/clang
DEBUG_PREFIX_CFLAGS=" -fdebug-prefix-map=${workspace_root_trailing_slash}="
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft &&
test "x$ENABLE_REPRODUCIBLE_BUILD" = xtrue; then
# There is a known issue with the pathmap if the mapping is made to the
@@ -810,12 +812,12 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
$TOOLCHAIN_CFLAGS_JVM ${$1_TOOLCHAIN_CFLAGS_JVM} \
$OS_CFLAGS $OS_CFLAGS_JVM $CFLAGS_OS_DEF_JVM $DEBUG_CFLAGS_JVM \
$WARNING_CFLAGS $WARNING_CFLAGS_JVM $JVM_PICFLAG $FILE_MACRO_CFLAGS \
$REPRODUCIBLE_CFLAGS"
$REPRODUCIBLE_CFLAGS $DEBUG_PREFIX_CFLAGS"
CFLAGS_JDK_COMMON="$ALWAYS_CFLAGS_JDK $ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \
$OS_CFLAGS $CFLAGS_OS_DEF_JDK $DEBUG_CFLAGS_JDK $DEBUG_OPTIONS_FLAGS_JDK \
$WARNING_CFLAGS $WARNING_CFLAGS_JDK $DEBUG_SYMBOLS_CFLAGS_JDK \
$FILE_MACRO_CFLAGS $REPRODUCIBLE_CFLAGS"
$FILE_MACRO_CFLAGS $REPRODUCIBLE_CFLAGS $DEBUG_PREFIX_CFLAGS"
# Use ${$2EXTRA_CFLAGS} to block EXTRA_CFLAGS to be added to build flags.
# (Currently we don't have any OPENJDK_BUILD_EXTRA_CFLAGS, but that might

View File

@@ -82,6 +82,14 @@ AC_DEFUN([FLAGS_SETUP_ASFLAGS],
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
BASIC_ASFLAGS="-nologo -c"
fi
if test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = "xfalse"; then
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
workspace_root_trailing_slash="${WORKSPACE_ROOT%/}/"
BASIC_ASFLAGS+=" -fdebug-prefix-map=${workspace_root_trailing_slash}="
fi
fi
AC_SUBST(BASIC_ASFLAGS)
if test "x$OPENJDK_TARGET_OS" = xmacosx; then

View File

@@ -31,6 +31,7 @@ jdk.httpserver,
jdk.internal.ed,
jdk.internal.le,
jdk.internal.vm.ci,
jdk.javadoc,
jdk.jdi,
jdk.jdwp.agent,
jdk.jfr,

View File

@@ -25,6 +25,7 @@
#define CFUNC(x) _##x
.file "copy_bsd_aarch64.S"
.global CFUNC(_Copy_conjoint_words)
.global CFUNC(_Copy_disjoint_words)

View File

@@ -31,6 +31,7 @@
#define ELF_TYPE(name, description) .type name,description
#endif
.file "bsd_x86_32.S"
.globl SYMBOL(fixcw)
# NOTE WELL! The _Copy functions are called directly

View File

@@ -30,6 +30,7 @@
#define ELF_TYPE(name, description) .type name,description
#endif
.file "bsd_x86_64.S"
# NOTE WELL! The _Copy functions are called directly
# from server-compiler-generated code via CallLeafNoFP,
# which means that they *must* either not use floating

View File

@@ -19,7 +19,7 @@
// or visit www.oracle.com if you need additional information or have any
// questions.
.file "atomic_linux_aarch64.S"
.text

View File

@@ -21,6 +21,8 @@
* questions.
*
*/
.file "copy_linux_aarch64.S"
.global _Copy_conjoint_words
.global _Copy_disjoint_words

View File

@@ -19,6 +19,8 @@
// or visit www.oracle.com if you need additional information or have any
// questions.
.file "threadLS_linux_aarch64.S"
// JavaThread::aarch64_get_thread_helper()
//
// Return the current thread pointer in x0.

View File

@@ -21,6 +21,7 @@
# questions.
#
.file "linux_arm_32.S"
# NOTE WELL! The _Copy functions are called directly
# from server-compiler-generated code via CallLeafNoFP,

View File

@@ -22,6 +22,8 @@
#
.file "linux_x86_32.S"
# NOTE WELL! The _Copy functions are called directly
# from server-compiler-generated code via CallLeafNoFP,
# which means that they *must* either not use floating

View File

@@ -21,6 +21,7 @@
# questions.
#
.file "linux_x86_64.S"
# NOTE WELL! The _Copy functions are called directly
# from server-compiler-generated code via CallLeafNoFP,

View File

@@ -1535,8 +1535,6 @@ methodHandle Method::clone_with_new_data(const methodHandle& m, u_char* new_code
// Reset correct method/const method, method size, and parameter info
newm->set_constMethod(newcm);
newm->set_new_version(newm->new_version());
newm->set_old_version(newm->old_version());
newm->constMethod()->set_code_size(new_code_length);
newm->constMethod()->set_constMethod_size(new_const_method_size);
assert(newm->code_size() == new_code_length, "check");

View File

@@ -1073,7 +1073,7 @@ int VM_EnhancedRedefineClasses::calculate_redefinition_flags(InstanceKlass* new_
cur_klass = new_class->super();
while (cur_klass != NULL) {
if (!the_class->is_subclass_of(cur_klass->old_version())) {
if (!the_class->is_subclass_of(cur_klass->is_redefining() ? cur_klass->old_version() : cur_klass)) {
log_info(redefine, class, load)("added super class %s", cur_klass->name()->as_C_string());
result = result | Klass::ModifyClass | Klass::ModifyInstances;
}

View File

@@ -4038,6 +4038,10 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
setup_hotswap_agent();
if (AllowEnhancedClassRedefinition) {
UseEmptySlotsInSupers = false;
}
#if !INCLUDE_CDS
if (DumpSharedSpaces || RequireSharedSpaces) {
jio_fprintf(defaultStream::error_stream(),

View File

@@ -276,8 +276,8 @@ public class Font implements java.io.Serializable
font.font2DHandle = handle;
}
public void setCreatedFont(Font font) {
font.createdFont = true;
public void setWithFallback(Font font) {
font.withFallback = true;
}
public boolean isCreatedFont(Font font) {
@@ -462,7 +462,13 @@ public class Font implements java.io.Serializable
* If the origin of a Font is a created font then this attribute
* must be set on all derived fonts too.
*/
private boolean createdFont = false;
private transient boolean createdFont = false;
/*
* Font with fallback components (using CompositeFont), its font2dHandle
* should be copied to derived fonts.
*/
private transient boolean withFallback;
/*
* This is true if the font transform is not identity. It
@@ -620,27 +626,25 @@ public class Font implements java.io.Serializable
/* This constructor is used by deriveFont when attributes is null */
private Font(String name, int style, float sizePts,
boolean created, Font2DHandle handle, boolean useOldHandle) {
boolean created, boolean withFallback,
Font2DHandle handle, boolean useOldHandle) {
this(name, style, sizePts);
this.createdFont = created;
this.withFallback = withFallback;
/* Fonts created from a stream will use the same font2D instance
* as the parent.
* One exception is that if the derived font is requested to be
* in a different style, then also check if its a CompositeFont
* and if so build a new CompositeFont from components of that style.
* CompositeFonts can only be marked as "created" if they are used
* to add fall backs to a physical font. And non-composites are
* always from "Font.createFont()" and shouldn't get this treatment.
* When a derived font is requested to be in a different style
* than a base font with fallback, then build a new CompositeFont
* from components of that style.
*/
if (created) {
if (handle.font2D instanceof CompositeFont &&
handle.font2D.getStyle() != style) {
if (withFallback) {
if (handle.font2D.getStyle() != style) {
FontManager fm = FontManagerFactory.getInstance();
this.font2DHandle = fm.getNewComposite(null, style, handle);
} else {
this.font2DHandle = handle;
}
} else if (useOldHandle) {
} else if (created || useOldHandle) {
this.font2DHandle = handle;
}
}
@@ -668,7 +672,7 @@ public class Font implements java.io.Serializable
* parent. They can be distinguished because the "created" argument
* will be "true". Since there is no way to recreate these fonts they
* need to have the handle to the underlying font2D passed in.
* "created" is also true when a special composite is referenced by the
* "withFallback" flag is set when a special composite is referenced by the
* handle for essentially the same reasons.
* But when deriving a font in these cases two particular attributes
* need special attention: family/face and style.
@@ -687,10 +691,12 @@ public class Font implements java.io.Serializable
* In these cases there is no need to interrogate "values".
*/
private Font(AttributeValues values, String oldName, int oldStyle,
boolean created, Font2DHandle handle, boolean useOldHandle) {
boolean created, boolean withFallback,
Font2DHandle handle, boolean useOldHandle) {
this.createdFont = created;
if (created) {
this.withFallback = withFallback;
if (created || withFallback) {
this.font2DHandle = handle;
String newName = null;
@@ -706,7 +712,7 @@ public class Font implements java.io.Serializable
if (values.getPosture() >= .2f) newStyle |= ITALIC;
if (oldStyle == newStyle) newStyle = -1;
}
if (handle.font2D instanceof CompositeFont) {
if (withFallback) {
if (newStyle != -1 || newName != null) {
FontManager fm = FontManagerFactory.getInstance();
this.font2DHandle =
@@ -714,6 +720,7 @@ public class Font implements java.io.Serializable
}
} else if (newName != null) {
this.createdFont = false;
this.withFallback = false;
this.font2DHandle = null;
}
} else if (useOldHandle) {
@@ -758,6 +765,7 @@ public class Font implements java.io.Serializable
}
this.font2DHandle = font.font2DHandle;
this.createdFont = font.createdFont;
this.withFallback = font.withFallback;
}
/**
@@ -887,7 +895,8 @@ public class Font implements java.io.Serializable
values = font.getAttributeValues().clone();
values.merge(attributes, SECONDARY_MASK);
return new Font(values, font.name, font.style,
font.createdFont, font.font2DHandle, false);
font.createdFont, font.withFallback,
font.font2DHandle, false);
}
return new Font(attributes);
}
@@ -898,7 +907,8 @@ public class Font implements java.io.Serializable
AttributeValues values = font.getAttributeValues().clone();
values.merge(attributes, SECONDARY_MASK);
return new Font(values, font.name, font.style,
font.createdFont, font.font2DHandle, false);
font.createdFont, font.withFallback,
font.font2DHandle, false);
}
return font;
@@ -1868,7 +1878,7 @@ public class Font implements java.io.Serializable
nonIdentityTx == font.nonIdentityTx &&
hasLayoutAttributes == font.hasLayoutAttributes &&
pointSize == font.pointSize &&
createdFont == font.createdFont &&
withFallback == font.withFallback &&
name.equals(font.name)) {
/* 'values' is usually initialized lazily, except when
@@ -2102,13 +2112,15 @@ public class Font implements java.io.Serializable
*/
public Font deriveFont(int style, float size){
if (values == null) {
return new Font(name, style, size, createdFont, font2DHandle, false);
return new Font(name, style, size, createdFont, withFallback,
font2DHandle, false);
}
AttributeValues newValues = getAttributeValues().clone();
int oldStyle = (this.style != style) ? this.style : -1;
applyStyle(style, newValues);
newValues.setSize(size);
return new Font(newValues, null, oldStyle, createdFont, font2DHandle, false);
return new Font(newValues, null, oldStyle, createdFont, withFallback,
font2DHandle, false);
}
/**
@@ -2127,7 +2139,8 @@ public class Font implements java.io.Serializable
int oldStyle = (this.style != style) ? this.style : -1;
applyStyle(style, newValues);
applyTransform(trans, newValues);
return new Font(newValues, null, oldStyle, createdFont, font2DHandle, false);
return new Font(newValues, null, oldStyle, createdFont, withFallback,
font2DHandle, false);
}
/**
@@ -2139,11 +2152,13 @@ public class Font implements java.io.Serializable
*/
public Font deriveFont(float size){
if (values == null) {
return new Font(name, style, size, createdFont, font2DHandle, true);
return new Font(name, style, size, createdFont, withFallback,
font2DHandle, true);
}
AttributeValues newValues = getAttributeValues().clone();
newValues.setSize(size);
return new Font(newValues, null, -1, createdFont, font2DHandle, true);
return new Font(newValues, null, -1, createdFont, withFallback,
font2DHandle, true);
}
/**
@@ -2159,7 +2174,8 @@ public class Font implements java.io.Serializable
public Font deriveFont(AffineTransform trans){
AttributeValues newValues = getAttributeValues().clone();
applyTransform(trans, newValues);
return new Font(newValues, null, -1, createdFont, font2DHandle, true);
return new Font(newValues, null, -1, createdFont, withFallback,
font2DHandle, true);
}
/**
@@ -2171,12 +2187,14 @@ public class Font implements java.io.Serializable
*/
public Font deriveFont(int style){
if (values == null) {
return new Font(name, style, size, createdFont, font2DHandle, false);
return new Font(name, style, size, createdFont, withFallback,
font2DHandle, false);
}
AttributeValues newValues = getAttributeValues().clone();
int oldStyle = (this.style != style) ? this.style : -1;
applyStyle(style, newValues);
return new Font(newValues, null, oldStyle, createdFont, font2DHandle, false);
return new Font(newValues, null, oldStyle, createdFont, withFallback,
font2DHandle, false);
}
/*
@@ -2213,8 +2231,8 @@ public class Font implements java.io.Serializable
break;
}
}
return new Font(newValues, name, style, createdFont, font2DHandle,
keepFont2DHandle);
return new Font(newValues, name, style, createdFont, withFallback,
font2DHandle, keepFont2DHandle);
}
/**

View File

@@ -50,6 +50,7 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serial;
import java.io.Serializable;
import java.security.PrivilegedAction;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -4250,6 +4251,18 @@ public class JTree extends JComponent implements Scrollable, Accessible
return accessibleContext;
}
private static final boolean EXCLUDE_ACCESSIBLE_CHILDREN_FROM_CLOSED_NODES;
static {
@SuppressWarnings("removal") boolean eaccn = java.security.AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
@Override
public Boolean run() {
return Boolean.getBoolean("javax.swing.JTree.excludeAccessibleChildrenFromClosedNodes");
}
});
EXCLUDE_ACCESSIBLE_CHILDREN_FROM_CLOSED_NODES = eaccn;
}
/**
* This class implements accessibility support for the
* <code>JTree</code> class. It provides an implementation of the
@@ -5004,7 +5017,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
* @return the number of accessible children in the object.
*/
public int getAccessibleChildrenCount() {
if (tree.isCollapsed(path)) return 0; // skip children of collapsed node
if (tree.isCollapsed(path) && EXCLUDE_ACCESSIBLE_CHILDREN_FROM_CLOSED_NODES) return 0; // skip children of collapsed node
// Tree nodes can't be so complex that they have
// two sets of children -> we're ignoring that case
return treeModel.getChildCount(obj);

View File

@@ -45,7 +45,7 @@ public abstract class FontAccess {
public abstract Font2D getFont2D(Font f);
public abstract Font2D getFont2DWithSubstitution(Font f);
public abstract void setFont2D(Font f, Font2DHandle h);
public abstract void setCreatedFont(Font f);
public abstract void setWithFallback(Font f);
public abstract boolean isCreatedFont(Font f);
public abstract FontPeer getFontPeer(Font f);
}

View File

@@ -453,10 +453,10 @@ public final class FontUtilities {
compMap.put(physicalFont, compFont);
}
FontAccess.getFontAccess().setFont2D(fuir, compFont.handle);
/* marking this as a created font is needed as only created fonts
* copy their creator's handles.
/* marking this as a font with fallback to make sure its
* handle is copied to derived fonts.
*/
FontAccess.getFontAccess().setCreatedFont(fuir);
FontAccess.getFontAccess().setWithFallback(fuir);
return fuir;
}

View File

@@ -732,14 +732,13 @@ public final class X11FontManager extends FcFontManager {
/* The name of the font will be that of the physical font in slot,
* but by setting the handle to that of the CompositeFont it
* renders as that CompositeFont.
* It also needs to be marked as a created font which is the
* current mechanism to signal that deriveFont etc must copy
* the handle from the original font.
* Font is marked as having fallback components to signal that
* deriveFont etc must copy the handle from the original font.
*/
FontUIResource fuir =
new FontUIResource(font2D.getFamilyName(null), style, size);
FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
FontAccess.getFontAccess().setCreatedFont(fuir);
FontAccess.getFontAccess().setWithFallback(fuir);
return fuir;
}
}

View File

@@ -44,7 +44,7 @@ import java.lang.reflect.InvocationTargetException;
*/
public class JBR {
static final ServiceApi api;
private static final ServiceApi api;
private static final Exception bootstrapException;
static {
ServiceApi a = null;
@@ -66,6 +66,10 @@ public class JBR {
private JBR() {}
static <T> T getService(Class<T> interFace) {
return api == null ? null : api.getService(interFace);
}
/**
* @return true when running on JBR which implements JBR API
*/
@@ -85,7 +89,7 @@ public class JBR {
/**
* Internal API interface, contains most basic methods for communication between client and JBR.
*/
interface ServiceApi {
private interface ServiceApi {
<T> T getService(Class<T> interFace);
}

View File

@@ -47,6 +47,6 @@ public interface JBRFileDialog {
}
interface JBRFileDialogService {
JBRFileDialogService INSTANCE = JBR.api.getService(JBRFileDialogService.class);
JBRFileDialogService INSTANCE = JBR.getService(JBRFileDialogService.class);
JBRFileDialog getFileDialog(FileDialog dialog);
}

View File

@@ -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.1
VERSION = 0.0.2
# 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 = A232F8ABEF52AF676E15457E0C18FD
HASH = 814F29888E5EB6C23DF27B53636E9F94

View File

@@ -1,64 +0,0 @@
#!/bin/bash
#
# Copyright 2000-2021 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
# @key headful
# @bug 6996867
# @summary Render as LCD Text in SrcEa composite mode
# @requires (os.family == "mac")
# @comment sh file is used to fix JBR-1388 for macOS versions >= 10.14
if [ -z "${TESTSRC}" ]; then
echo "TESTSRC is undefined: set to ."
TESTSRC=.
fi
if [ -z "${TESTCLASSES}" ]; then
echo "TESTCLASSES is undefined: set to ."
TESTCLASSES=.
fi
if [ -z "${TESTJAVA}" ]; then
echo "TESTJAVA is undefined: testing cancelled"
exit 1
fi
cd ${TESTSRC}
${TESTJAVA}/bin/javac -d ${TESTCLASSES} LCDTextSrcEa.java
echo "reading current CGFontRenderingFontSmoothingDisabled value"
oldKeyValue=$(defaults read -g CGFontRenderingFontSmoothingDisabled)
# should not affect the test run on macOS versions < 10.14
defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO
${TESTJAVA}/bin/java -cp ${TESTCLASSES} LCDTextSrcEa
exit_code=$?
if [ -z "$oldKeyValue" ]; then
defaults delete -g CGFontRenderingFontSmoothingDisabled
elif [ "$oldKeyValue" -eq 1 ]; then
defaults write -g CGFontRenderingFontSmoothingDisabled -bool YES
fi
case $exit_code in
0) echo "PASSED"
;;
*) echo "FAILED"
exit 1
;;
esac
exit 0

View File

@@ -0,0 +1,114 @@
/*
* Copyright 2021 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 8185261
* @summary Tests that font fallback works reliably in JEditorPane
* @key headful
*/
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
public class JEditorPaneFontFallback {
public static final char CHINESE_CHAR = '\u4e2d';
public static void main(String[] args) throws Exception {
String fontFamily = findSuitableFont();
if (fontFamily == null) {
System.out.println("No suitable fonts, test cannot be performed");
return;
}
System.out.println("Fount font: " + fontFamily);
BufferedImage img1 = renderJEditorPaneInSubprocess(fontFamily, false);
BufferedImage img2 = renderJEditorPaneInSubprocess(fontFamily, true);
if (!imagesAreEqual(img1, img2)) {
throw new RuntimeException("Unexpected rendering in JEditorPane");
}
}
private static String findSuitableFont() {
String[] familyNames = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
for (String familyName : familyNames) {
if (!familyName.contains("'") && !familyName.contains("<") && !familyName.contains("&")) {
Font font = new Font(familyName, Font.PLAIN, 1);
if (!font.canDisplay(CHINESE_CHAR)) return familyName;
}
}
return null;
}
private static boolean imagesAreEqual(BufferedImage i1, BufferedImage i2) {
if (i1.getWidth() != i2.getWidth() || i1.getHeight() != i2.getHeight()) return false;
for (int i = 0; i < i1.getWidth(); i++) {
for (int j = 0; j < i1.getHeight(); j++) {
if (i1.getRGB(i, j) != i2.getRGB(i, j)) {
return false;
}
}
}
return true;
}
private static BufferedImage renderJEditorPaneInSubprocess(String fontFamilyName, boolean afterFontInfoCaching)
throws Exception {
String tmpFileName = "image.png";
int exitCode = Runtime.getRuntime().exec(new String[]{
System.getProperty("java.home") + File.separator + "bin" + File.separator + "java",
"-cp",
System.getProperty("test.classes", "."),
JEditorPaneRenderer.class.getName(),
fontFamilyName,
Boolean.toString(afterFontInfoCaching),
tmpFileName
}).waitFor();
if (exitCode != 0) {
throw new RuntimeException("Sub-process exited abnormally: " + exitCode);
}
return ImageIO.read(new File(tmpFileName));
}
}
class JEditorPaneRenderer {
private static final int FONT_SIZE = 12;
private static final int WIDTH = 20;
private static final int HEIGHT = 20;
public static void main(String[] args) throws Exception {
String fontFamily = args[0];
JEditorPane pane = new JEditorPane("text/html",
"<html><head><style>body {font-family:'" + fontFamily + "'; font-size:" + FONT_SIZE +
"pt;}</style></head><body>" + JEditorPaneFontFallback.CHINESE_CHAR + "</body></html>");
pane.setSize(WIDTH, HEIGHT);
if (Boolean.parseBoolean(args[1])) pane.getFontMetrics(new Font(fontFamily, Font.PLAIN, FONT_SIZE));
BufferedImage img = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
Graphics2D g = img.createGraphics();
pane.paint(g);
g.dispose();
ImageIO.write(img, "png", new File(args[2]));
}
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright 2000-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 regression test for JBR-4169 add the module jdk.javadoc
* @run main CheckDocLintTest
*/
public class CheckDocLintTest {
static final String CLASS_NAMES[] = {
"jdk.javadoc.internal.doclint.DocLint",
"com.sun.tools.doclint.DocLint"
};
public static void main(String[] args) {
Class<?> klass;
boolean failed = false;
for (String klassName : CLASS_NAMES)
try {
klass = Class.forName(klassName);
System.out.println(klass + " exists");
} catch(ClassNotFoundException e) {
System.out.println("*** " + klassName + " does not exist");
failed = true;
}
if (failed) {
throw new RuntimeException("Test failed");
}
System.out.println("Test passed");
}
}

View File

@@ -126,7 +126,7 @@ java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java 8060176
java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java 8060176 windows-all,macosx-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 macosx-all
java/awt/dnd/URIListBetweenJVMsTest/URIListBetweenJVMsTest.java 8171510,JBR-881 macosx-all,linux-all
javax/swing/dnd/7171812/bug7171812.java 8041447 macosx-all
java/awt/Focus/ChoiceFocus/ChoiceFocus.java 8169103 windows-all,macosx-all
java/awt/Focus/ClearLwQueueBreakTest/ClearLwQueueBreakTest.java 8198618 macosx-all
@@ -246,6 +246,7 @@ sun/java2d/DirectX/OnScreenRenderingResizeTest/OnScreenRenderingResizeTest.java
sun/java2d/DirectX/OverriddenInsetsTest/OverriddenInsetsTest.java 8196102 generic-all
sun/java2d/DirectX/RenderingToCachedGraphicsTest/RenderingToCachedGraphicsTest.java 8196180 windows-all,macosx-all
java/awt/Graphics2D/CopyAreaOOB.java 7001973 windows-all,macosx-all,linux-all
java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java 8266283 generic-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

View File

@@ -0,0 +1,11 @@
# the test failed in VMoptions mode
javax/swing/JFileChooser/6520101/bug6520101.java nobug generic-all
java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java nobug generic-all
java/awt/Window/OwnedWindowsLeak/OwnedWindowsLeak.java nobug generic-all
java/beans/Introspector/8159696/UnloadClassBeanInfo.java nobug generic-all
java/beans/Introspector/Test8027905.java nobug generic-all
javax/imageio/plugins/png/ItxtUtf8Test.java nobug generic-all
javax/swing/JFileChooser/FileSystemView/FileSystemViewListenerLeak.java nobug generic-all
javax/swing/JProgressBar/8161664/ProgressBarMemoryLeakTest.java nobug generic-all
javax/swing/RepaintManager/DisplayListenerLeak/DisplayListenerLeak.java nobug generic-all
javax/swing/UI/UnninstallUIMemoryLeaks/UnninstallUIMemoryLeaks.java nobug generic-all