Merge
This commit is contained in:
commit
a0b1b7ca70
2
.hgtags
2
.hgtags
@ -256,3 +256,5 @@ efe7dbc6088691757404e0c8745f894e3ca9c022 jdk9-b09
|
||||
0809c9a4d36e6291f1c4384604c4bbf29e975722 jdk9-b11
|
||||
0d1f816217dce5e72187f167cc1816080cbeb453 jdk9-b12
|
||||
1a30593dcb9802faec3b6edb24d86ca088594e4e jdk9-b13
|
||||
97932f6ad950ae5a73a9da5c96e6e58503ff646b jdk9-b14
|
||||
74eb0778e4f2dbff6628e718378449fba27c4265 jdk9-b15
|
||||
|
@ -256,3 +256,5 @@ fa13f2b926f8426876ec03e7903f3ee0ee150f2e jdk9-b10
|
||||
ab55a18a95e1990a588929d5d29db3eb9985fea0 jdk9-b11
|
||||
59f6350295f9681fe5956d8bc889bf341914c6cb jdk9-b12
|
||||
5800456add07e1a68170a229fb5e27376f8875e5 jdk9-b13
|
||||
4e3aa9723e9972623e3dafc321b368e7db7e9b3b jdk9-b14
|
||||
b114474fb25af4e73cb7219f7c04bd8994da03a5 jdk9-b15
|
||||
|
14
README
14
README
@ -1,15 +1,15 @@
|
||||
README:
|
||||
This file should be located at the top of the OpenJDK Mercurial root
|
||||
repository. A full OpenJDK repository set (forest) should also include
|
||||
the following 6 nested repositories:
|
||||
"jdk", "hotspot", "langtools", "corba", "jaxws" and "jaxp".
|
||||
the following 7 nested repositories:
|
||||
"jdk", "hotspot", "langtools", "nashorn", "corba", "jaxws" and "jaxp".
|
||||
|
||||
The root repository can be obtained with something like:
|
||||
hg clone http://hg.openjdk.java.net/jdk8/jdk8 openjdk8
|
||||
hg clone http://hg.openjdk.java.net/jdk9/jdk9 openjdk9
|
||||
|
||||
You can run the get_source.sh script located in the root repository to get
|
||||
the other needed repositories:
|
||||
cd openjdk8 && sh ./get_source.sh
|
||||
cd openjdk9 && sh ./get_source.sh
|
||||
|
||||
People unfamiliar with Mercurial should read the first few chapters of
|
||||
the Mercurial book: http://hgbook.red-bean.com/read/
|
||||
@ -19,9 +19,9 @@ README:
|
||||
Simple Build Instructions:
|
||||
|
||||
0. Get the necessary system software/packages installed on your system, see
|
||||
http://hg.openjdk.java.net/jdk8/jdk8/raw-file/tip/README-builds.html
|
||||
http://hg.openjdk.java.net/jdk9/jdk9/raw-file/tip/README-builds.html
|
||||
|
||||
1. If you don't have a jdk7u7 or newer jdk, download and install it from
|
||||
1. If you don't have a jdk8 or newer jdk, download and install it from
|
||||
http://java.sun.com/javase/downloads/index.jsp
|
||||
Add the /bin directory of this installation to your PATH environment
|
||||
variable.
|
||||
@ -37,4 +37,4 @@ where make is GNU make 3.81 or newer, /usr/bin/make on Linux usually
|
||||
is 3.81 or newer. Note that on Solaris, GNU make is called "gmake".
|
||||
|
||||
Complete details are available in the file:
|
||||
http://hg.openjdk.java.net/jdk8/jdk8/raw-file/tip/README-builds.html
|
||||
http://hg.openjdk.java.net/jdk9/jdk9/raw-file/tip/README-builds.html
|
||||
|
@ -656,6 +656,9 @@ USE_EXTERNAL_LIBZ
|
||||
USE_EXTERNAL_LIBPNG
|
||||
PNG_LIBS
|
||||
PNG_CFLAGS
|
||||
USE_EXTERNAL_LCMS
|
||||
LCMS_LIBS
|
||||
LCMS_CFLAGS
|
||||
USE_EXTERNAL_LIBGIF
|
||||
USE_EXTERNAL_LIBJPEG
|
||||
ALSA_LIBS
|
||||
@ -1079,6 +1082,7 @@ with_alsa
|
||||
with_alsa_include
|
||||
with_alsa_lib
|
||||
with_giflib
|
||||
with_lcms
|
||||
with_libpng
|
||||
with_zlib
|
||||
with_stdc__lib
|
||||
@ -1192,6 +1196,8 @@ FREETYPE_CFLAGS
|
||||
FREETYPE_LIBS
|
||||
ALSA_CFLAGS
|
||||
ALSA_LIBS
|
||||
LCMS_CFLAGS
|
||||
LCMS_LIBS
|
||||
PNG_CFLAGS
|
||||
PNG_LIBS
|
||||
LIBFFI_CFLAGS
|
||||
@ -1934,6 +1940,8 @@ Optional Packages:
|
||||
--with-alsa-lib specify directory for the alsa library
|
||||
--with-giflib use giflib from build system or OpenJDK source
|
||||
(system, bundled) [bundled]
|
||||
--with-lcms use lcms2 from build system or OpenJDK source
|
||||
(system, bundled) [bundled]
|
||||
--with-libpng use libpng from build system or OpenJDK source
|
||||
(system, bundled) [bundled]
|
||||
--with-zlib use zlib from build system or OpenJDK source
|
||||
@ -2060,6 +2068,8 @@ Some influential environment variables:
|
||||
linker flags for FREETYPE, overriding pkg-config
|
||||
ALSA_CFLAGS C compiler flags for ALSA, overriding pkg-config
|
||||
ALSA_LIBS linker flags for ALSA, overriding pkg-config
|
||||
LCMS_CFLAGS C compiler flags for LCMS, overriding pkg-config
|
||||
LCMS_LIBS linker flags for LCMS, overriding pkg-config
|
||||
PNG_CFLAGS C compiler flags for PNG, overriding pkg-config
|
||||
PNG_LIBS linker flags for PNG, overriding pkg-config
|
||||
LIBFFI_CFLAGS
|
||||
@ -47307,6 +47317,115 @@ fi
|
||||
fi
|
||||
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Check for the lcms2 library
|
||||
#
|
||||
|
||||
|
||||
# Check whether --with-lcms was given.
|
||||
if test "${with_lcms+set}" = set; then :
|
||||
withval=$with_lcms;
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for which lcms to use" >&5
|
||||
$as_echo_n "checking for which lcms to use... " >&6; }
|
||||
|
||||
DEFAULT_LCMS=bundled
|
||||
|
||||
#
|
||||
# If user didn't specify, use DEFAULT_LCMS
|
||||
#
|
||||
if test "x${with_lcms}" = "x"; then
|
||||
with_lcms=${DEFAULT_LCMS}
|
||||
fi
|
||||
|
||||
if test "x${with_lcms}" = "xbundled"; then
|
||||
USE_EXTERNAL_LCMS=false
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: bundled" >&5
|
||||
$as_echo "bundled" >&6; }
|
||||
elif test "x${with_lcms}" = "xsystem"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: system" >&5
|
||||
$as_echo "system" >&6; }
|
||||
|
||||
pkg_failed=no
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LCMS" >&5
|
||||
$as_echo_n "checking for LCMS... " >&6; }
|
||||
|
||||
if test -n "$LCMS_CFLAGS"; then
|
||||
pkg_cv_LCMS_CFLAGS="$LCMS_CFLAGS"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lcms2\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "lcms2") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_LCMS_CFLAGS=`$PKG_CONFIG --cflags "lcms2" 2>/dev/null`
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
if test -n "$LCMS_LIBS"; then
|
||||
pkg_cv_LCMS_LIBS="$LCMS_LIBS"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lcms2\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "lcms2") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_LCMS_LIBS=`$PKG_CONFIG --libs "lcms2" 2>/dev/null`
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test $pkg_failed = yes; then
|
||||
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||||
_pkg_short_errors_supported=yes
|
||||
else
|
||||
_pkg_short_errors_supported=no
|
||||
fi
|
||||
if test $_pkg_short_errors_supported = yes; then
|
||||
LCMS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "lcms2" 2>&1`
|
||||
else
|
||||
LCMS_PKG_ERRORS=`$PKG_CONFIG --print-errors "lcms2" 2>&1`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$LCMS_PKG_ERRORS" >&5
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
LCMS_FOUND=no
|
||||
elif test $pkg_failed = untried; then
|
||||
LCMS_FOUND=no
|
||||
else
|
||||
LCMS_CFLAGS=$pkg_cv_LCMS_CFLAGS
|
||||
LCMS_LIBS=$pkg_cv_LCMS_LIBS
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
LCMS_FOUND=yes
|
||||
fi
|
||||
if test "x${LCMS_FOUND}" = "xyes"; then
|
||||
USE_EXTERNAL_LCMS=true
|
||||
else
|
||||
as_fn_error $? "--with-lcms=system specified, but no lcms found!" "$LINENO" 5
|
||||
fi
|
||||
else
|
||||
as_fn_error $? "Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled'" "$LINENO" 5
|
||||
fi
|
||||
|
||||
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Check for the png library
|
||||
|
@ -664,6 +664,42 @@ AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS],
|
||||
fi
|
||||
AC_SUBST(USE_EXTERNAL_LIBGIF)
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Check for the lcms2 library
|
||||
#
|
||||
|
||||
AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms],
|
||||
[use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
|
||||
|
||||
AC_MSG_CHECKING([for which lcms to use])
|
||||
|
||||
DEFAULT_LCMS=bundled
|
||||
|
||||
#
|
||||
# If user didn't specify, use DEFAULT_LCMS
|
||||
#
|
||||
if test "x${with_lcms}" = "x"; then
|
||||
with_lcms=${DEFAULT_LCMS}
|
||||
fi
|
||||
|
||||
if test "x${with_lcms}" = "xbundled"; then
|
||||
USE_EXTERNAL_LCMS=false
|
||||
AC_MSG_RESULT([bundled])
|
||||
elif test "x${with_lcms}" = "xsystem"; then
|
||||
AC_MSG_RESULT([system])
|
||||
PKG_CHECK_MODULES([LCMS], [lcms2], [LCMS_FOUND=yes], [LCMS_FOUND=no])
|
||||
if test "x${LCMS_FOUND}" = "xyes"; then
|
||||
USE_EXTERNAL_LCMS=true
|
||||
else
|
||||
AC_MSG_ERROR([--with-lcms=system specified, but no lcms found!])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled'])
|
||||
fi
|
||||
|
||||
AC_SUBST(USE_EXTERNAL_LCMS)
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Check for the png library
|
||||
|
@ -652,6 +652,10 @@ INSTALL_SYSCONFDIR=@sysconfdir@
|
||||
# Libraries
|
||||
#
|
||||
|
||||
USE_EXTERNAL_LCMS:=@USE_EXTERNAL_LCMS@
|
||||
LCMS_CFLAGS:=@LCMS_CFLAGS@
|
||||
LCMS_LIBS:=@LCMS_LIBS@
|
||||
|
||||
USE_EXTERNAL_LIBPNG:=@USE_EXTERNAL_LIBPNG@
|
||||
PNG_LIBS:=@PNG_LIBS@
|
||||
PNG_CFLAGS:=@PNG_CFLAGS@
|
||||
|
@ -256,3 +256,5 @@ a4bf701ac316946c2e5e83138ad8e687da6a4b30 jdk9-b06
|
||||
77ea0a2503582a28e4e66be7239a49a0d1dd313f jdk9-b11
|
||||
e212cdcc8c11f0ba5acf6f5ddb596c4c545a93f9 jdk9-b12
|
||||
088eec4c36f4d7f250fcd19c4969bf698e3d2cdc jdk9-b13
|
||||
a2b82f863ba95a596da555a4c1b871c404863e7e jdk9-b14
|
||||
e54022d0dd92106fff7f7fe670010cd7e6517ee3 jdk9-b15
|
||||
|
@ -416,3 +416,5 @@ ebc44d040cd149d2120d69fe183a3dae7840f4b4 jdk9-b10
|
||||
783309c3a1a629a452673399dcfa83ef7eca94d8 jdk9-b11
|
||||
1c383bb39e2849ca62cb763f4e182a29b421d60a jdk9-b12
|
||||
456ad9c99133803d4e1433124c85a6fd141b9ac9 jdk9-b13
|
||||
bd333491bb6c012d7b606939406d0fa9a5ac7ffd jdk9-b14
|
||||
170f6d733d7aec062f743a6b8c1cce940a7a984a jdk9-b15
|
||||
|
@ -274,6 +274,8 @@ void ClassLoaderData::add_class(Klass* k) {
|
||||
MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
|
||||
Klass* old_value = _klasses;
|
||||
k->set_next_link(old_value);
|
||||
// Make sure linked class is stable, since the class list is walked without a lock
|
||||
OrderAccess::storestore();
|
||||
// link the new item into the list
|
||||
_klasses = k;
|
||||
|
||||
|
@ -2036,7 +2036,7 @@ void ClassVerifier::verify_switch(
|
||||
while ((bcp + padding_offset) < aligned_bcp) {
|
||||
if(*(bcp + padding_offset) != 0) {
|
||||
verify_error(ErrorContext::bad_code(bci),
|
||||
"Nonzero padding byte in lookswitch or tableswitch");
|
||||
"Nonzero padding byte in lookupswitch or tableswitch");
|
||||
return;
|
||||
}
|
||||
padding_offset++;
|
||||
|
@ -307,6 +307,9 @@ bool CompilerOracle::should_print(methodHandle method) {
|
||||
return (check_predicate(PrintCommand, method));
|
||||
}
|
||||
|
||||
bool CompilerOracle::should_print_methods() {
|
||||
return lists[PrintCommand] != NULL;
|
||||
}
|
||||
|
||||
bool CompilerOracle::should_log(methodHandle method) {
|
||||
if (!LogCompilation) return false;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -73,6 +73,9 @@ class CompilerOracle : AllStatic {
|
||||
// For updating the oracle file
|
||||
static void append_comment_to_file(const char* message);
|
||||
static void append_exclude_to_file(methodHandle method);
|
||||
|
||||
// Tells whether there are any methods to print for print_method_statistics()
|
||||
static bool should_print_methods();
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_COMPILER_COMPILERORACLE_HPP
|
||||
|
@ -3095,7 +3095,7 @@ void Metaspace::ergo_initialize() {
|
||||
|
||||
void Metaspace::global_initialize() {
|
||||
// Initialize the alignment for shared spaces.
|
||||
int max_alignment = os::vm_page_size();
|
||||
int max_alignment = os::vm_allocation_granularity();
|
||||
size_t cds_total = 0;
|
||||
|
||||
MetaspaceShared::set_max_alignment(max_alignment);
|
||||
|
@ -1273,6 +1273,12 @@ bool InstanceKlass::find_field_from_offset(int offset, bool is_static, fieldDesc
|
||||
|
||||
|
||||
void InstanceKlass::methods_do(void f(Method* method)) {
|
||||
// Methods aren't stable until they are loaded. This can be read outside
|
||||
// a lock through the ClassLoaderData for profiling
|
||||
if (!is_loaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int len = methods()->length();
|
||||
for (int index = 0; index < len; index++) {
|
||||
Method* m = methods()->at(index);
|
||||
|
@ -307,9 +307,9 @@ JvmtiEnv::GetObjectSize(jobject object, jlong* size_ptr) {
|
||||
!java_lang_Class::is_primitive(mirror)) {
|
||||
Klass* k = java_lang_Class::as_Klass(mirror);
|
||||
assert(k != NULL, "class for non-primitive mirror must exist");
|
||||
*size_ptr = k->size() * wordSize;
|
||||
*size_ptr = (jlong)k->size() * wordSize;
|
||||
} else {
|
||||
*size_ptr = mirror->size() * wordSize;
|
||||
*size_ptr = (jlong)mirror->size() * wordSize;
|
||||
}
|
||||
return JVMTI_ERROR_NONE;
|
||||
} /* end GetObjectSize */
|
||||
|
@ -1449,7 +1449,7 @@ bool verify_object_alignment() {
|
||||
return true;
|
||||
}
|
||||
|
||||
uintx Arguments::max_heap_for_compressed_oops() {
|
||||
size_t Arguments::max_heap_for_compressed_oops() {
|
||||
// Avoid sign flip.
|
||||
assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size");
|
||||
// We need to fit both the NULL page and the heap into the memory budget, while
|
||||
|
@ -120,7 +120,8 @@ void collect_profiled_methods(Method* m) {
|
||||
}
|
||||
|
||||
void print_method_profiling_data() {
|
||||
if (ProfileInterpreter COMPILER1_PRESENT(|| C1UpdateMethodData)) {
|
||||
if (ProfileInterpreter COMPILER1_PRESENT(|| C1UpdateMethodData) &&
|
||||
(PrintMethodData || CompilerOracle::should_print_methods())) {
|
||||
ResourceMark rm;
|
||||
HandleMark hm;
|
||||
collected_profiled_methods = new GrowableArray<Method*>(1024);
|
||||
|
97
hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
Normal file
97
hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SHARE_VM_RUNTIME_SHAREDRUNTIMEMATH_HPP
|
||||
#define SHARE_VM_RUNTIME_SHAREDRUNTIMEMATH_HPP
|
||||
|
||||
#include <math.h>
|
||||
|
||||
// VM_LITTLE_ENDIAN is #defined appropriately in the Makefiles
|
||||
// [jk] this is not 100% correct because the float word order may different
|
||||
// from the byte order (e.g. on ARM FPA)
|
||||
#ifdef VM_LITTLE_ENDIAN
|
||||
# define __HI(x) *(1+(int*)&x)
|
||||
# define __LO(x) *(int*)&x
|
||||
#else
|
||||
# define __HI(x) *(int*)&x
|
||||
# define __LO(x) *(1+(int*)&x)
|
||||
#endif
|
||||
|
||||
static double copysignA(double x, double y) {
|
||||
__HI(x) = (__HI(x)&0x7fffffff)|(__HI(y)&0x80000000);
|
||||
return x;
|
||||
}
|
||||
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (c) 1998 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* scalbn (double x, int n)
|
||||
* scalbn(x,n) returns x* 2**n computed by exponent
|
||||
* manipulation rather than by actually performing an
|
||||
* exponentiation or a multiplication.
|
||||
*/
|
||||
|
||||
static const double
|
||||
two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
|
||||
twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
|
||||
hugeX = 1.0e+300,
|
||||
tiny = 1.0e-300;
|
||||
|
||||
static double scalbnA (double x, int n) {
|
||||
int k,hx,lx;
|
||||
hx = __HI(x);
|
||||
lx = __LO(x);
|
||||
k = (hx&0x7ff00000)>>20; /* extract exponent */
|
||||
if (k==0) { /* 0 or subnormal x */
|
||||
if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
|
||||
x *= two54;
|
||||
hx = __HI(x);
|
||||
k = ((hx&0x7ff00000)>>20) - 54;
|
||||
if (n< -50000) return tiny*x; /*underflow*/
|
||||
}
|
||||
if (k==0x7ff) return x+x; /* NaN or Inf */
|
||||
k = k+n;
|
||||
if (k > 0x7fe) return hugeX*copysignA(hugeX,x); /* overflow */
|
||||
if (k > 0) /* normal result */
|
||||
{__HI(x) = (hx&0x800fffff)|(k<<20); return x;}
|
||||
if (k <= -54) {
|
||||
if (n > 50000) /* in case integer overflow in n+k */
|
||||
return hugeX*copysignA(hugeX,x); /*overflow*/
|
||||
else return tiny*copysignA(tiny,x); /*underflow*/
|
||||
}
|
||||
k += 54; /* subnormal result */
|
||||
__HI(x) = (hx&0x800fffff)|(k<<20);
|
||||
return x*twom54;
|
||||
}
|
||||
|
||||
#endif // SHARE_VM_RUNTIME_SHAREDRUNTIMEMATH_HPP
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -43,78 +43,7 @@
|
||||
# pragma optimize ( "", off )
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
// VM_LITTLE_ENDIAN is #defined appropriately in the Makefiles
|
||||
// [jk] this is not 100% correct because the float word order may different
|
||||
// from the byte order (e.g. on ARM)
|
||||
#ifdef VM_LITTLE_ENDIAN
|
||||
# define __HI(x) *(1+(int*)&x)
|
||||
# define __LO(x) *(int*)&x
|
||||
#else
|
||||
# define __HI(x) *(int*)&x
|
||||
# define __LO(x) *(1+(int*)&x)
|
||||
#endif
|
||||
|
||||
#if !defined(AIX)
|
||||
double copysign(double x, double y) {
|
||||
__HI(x) = (__HI(x)&0x7fffffff)|(__HI(y)&0x80000000);
|
||||
return x;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (c) 1998 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* scalbn (double x, int n)
|
||||
* scalbn(x,n) returns x* 2**n computed by exponent
|
||||
* manipulation rather than by actually performing an
|
||||
* exponentiation or a multiplication.
|
||||
*/
|
||||
|
||||
static const double
|
||||
two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
|
||||
twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
|
||||
hugeX = 1.0e+300,
|
||||
tiny = 1.0e-300;
|
||||
|
||||
#if !defined(AIX)
|
||||
double scalbn (double x, int n) {
|
||||
int k,hx,lx;
|
||||
hx = __HI(x);
|
||||
lx = __LO(x);
|
||||
k = (hx&0x7ff00000)>>20; /* extract exponent */
|
||||
if (k==0) { /* 0 or subnormal x */
|
||||
if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
|
||||
x *= two54;
|
||||
hx = __HI(x);
|
||||
k = ((hx&0x7ff00000)>>20) - 54;
|
||||
if (n< -50000) return tiny*x; /*underflow*/
|
||||
}
|
||||
if (k==0x7ff) return x+x; /* NaN or Inf */
|
||||
k = k+n;
|
||||
if (k > 0x7fe) return hugeX*copysign(hugeX,x); /* overflow */
|
||||
if (k > 0) /* normal result */
|
||||
{__HI(x) = (hx&0x800fffff)|(k<<20); return x;}
|
||||
if (k <= -54) {
|
||||
if (n > 50000) /* in case integer overflow in n+k */
|
||||
return hugeX*copysign(hugeX,x); /*overflow*/
|
||||
else return tiny*copysign(tiny,x); /*underflow*/
|
||||
}
|
||||
k += 54; /* subnormal result */
|
||||
__HI(x) = (hx&0x800fffff)|(k<<20);
|
||||
return x*twom54;
|
||||
}
|
||||
#endif
|
||||
#include "runtime/sharedRuntimeMath.hpp"
|
||||
|
||||
/* __ieee754_log(x)
|
||||
* Return the logarithm of x
|
||||
@ -719,7 +648,7 @@ double __ieee754_pow(double x, double y) {
|
||||
z = one-(r-z);
|
||||
j = __HI(z);
|
||||
j += (n<<20);
|
||||
if((j>>20)<=0) z = scalbn(z,n); /* subnormal output */
|
||||
if((j>>20)<=0) z = scalbnA(z,n); /* subnormal output */
|
||||
else __HI(z) += (n<<20);
|
||||
return s*z;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -63,63 +63,7 @@
|
||||
#define SAFEBUF
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
// VM_LITTLE_ENDIAN is #defined appropriately in the Makefiles
|
||||
// [jk] this is not 100% correct because the float word order may different
|
||||
// from the byte order (e.g. on ARM)
|
||||
#ifdef VM_LITTLE_ENDIAN
|
||||
# define __HI(x) *(1+(int*)&x)
|
||||
# define __LO(x) *(int*)&x
|
||||
#else
|
||||
# define __HI(x) *(int*)&x
|
||||
# define __LO(x) *(1+(int*)&x)
|
||||
#endif
|
||||
|
||||
static double copysignA(double x, double y) {
|
||||
__HI(x) = (__HI(x)&0x7fffffff)|(__HI(y)&0x80000000);
|
||||
return x;
|
||||
}
|
||||
|
||||
/*
|
||||
* scalbn (double x, int n)
|
||||
* scalbn(x,n) returns x* 2**n computed by exponent
|
||||
* manipulation rather than by actually performing an
|
||||
* exponentiation or a multiplication.
|
||||
*/
|
||||
|
||||
static const double
|
||||
two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
|
||||
twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
|
||||
hugeX = 1.0e+300,
|
||||
tiny = 1.0e-300;
|
||||
|
||||
static double scalbnA (double x, int n) {
|
||||
int k,hx,lx;
|
||||
hx = __HI(x);
|
||||
lx = __LO(x);
|
||||
k = (hx&0x7ff00000)>>20; /* extract exponent */
|
||||
if (k==0) { /* 0 or subnormal x */
|
||||
if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
|
||||
x *= two54;
|
||||
hx = __HI(x);
|
||||
k = ((hx&0x7ff00000)>>20) - 54;
|
||||
if (n< -50000) return tiny*x; /*underflow*/
|
||||
}
|
||||
if (k==0x7ff) return x+x; /* NaN or Inf */
|
||||
k = k+n;
|
||||
if (k > 0x7fe) return hugeX*copysignA(hugeX,x); /* overflow */
|
||||
if (k > 0) /* normal result */
|
||||
{__HI(x) = (hx&0x800fffff)|(k<<20); return x;}
|
||||
if (k <= -54) {
|
||||
if (n > 50000) /* in case integer overflow in n+k */
|
||||
return hugeX*copysignA(hugeX,x); /*overflow*/
|
||||
else return tiny*copysignA(tiny,x); /*underflow*/
|
||||
}
|
||||
k += 54; /* subnormal result */
|
||||
__HI(x) = (hx&0x800fffff)|(k<<20);
|
||||
return x*twom54;
|
||||
}
|
||||
#include "runtime/sharedRuntimeMath.hpp"
|
||||
|
||||
/*
|
||||
* __kernel_rem_pio2(x,y,e0,nx,prec,ipio2)
|
||||
|
@ -83,6 +83,7 @@ needs_jdk = \
|
||||
runtime/RedefineObject/TestRedefineObject.java \
|
||||
runtime/XCheckJniJsig/XCheckJSig.java \
|
||||
serviceability/attach/AttachWithStalePidFile.java \
|
||||
serviceability/jvmti/8036666/GetObjectLockCount.java \
|
||||
serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java \
|
||||
serviceability/dcmd/DynLibDcmdTest.java
|
||||
|
||||
@ -135,6 +136,8 @@ needs_compact3 = \
|
||||
gc/parallelScavenge/TestDynShrinkHeap.java \
|
||||
runtime/InternalApi/ThreadCpuTimesDeadlock.java \
|
||||
serviceability/threads/TestFalseDeadLock.java \
|
||||
serviceability/jvmti/GetObjectSizeOverflow.java \
|
||||
serviceability/jvmti/TestRedefineWithUnresolvedClass.java \
|
||||
compiler/tiered/NonTieredLevelsTest.java \
|
||||
compiler/tiered/TieredLevelsTest.java \
|
||||
compiler/intrinsics/bmi/verifycode \
|
||||
|
@ -26,7 +26,7 @@
|
||||
* @bug 8016479
|
||||
* @summary Verify that the heap shrinks after full GC according to the current values of the Min/MaxHeapFreeRatio flags
|
||||
* @library /testlibrary
|
||||
* @run main/othervm -XX:+UseAdaptiveSizePolicyWithSystemGC -XX:+UseParallelGC -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 -verbose:gc TestDynShrinkHeap
|
||||
* @run main/othervm -XX:+UseAdaptiveSizePolicyWithSystemGC -XX:+UseParallelGC -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 -Xmx1g -verbose:gc TestDynShrinkHeap
|
||||
*/
|
||||
import com.oracle.java.testlibrary.DynamicVMOption;
|
||||
import java.lang.management.ManagementFactory;
|
||||
@ -41,7 +41,7 @@ public class TestDynShrinkHeap {
|
||||
public static final String MAX_FREE_RATIO_FLAG_NAME = "MaxHeapFreeRatio";
|
||||
|
||||
private static ArrayList<byte[]> list = new ArrayList<>(0);
|
||||
private static final int M = 1024 * 1024; // to make heap more manageable by test code
|
||||
private static final int LEN = 512 * 1024 + 1;
|
||||
|
||||
public TestDynShrinkHeap() {
|
||||
}
|
||||
@ -69,12 +69,12 @@ public class TestDynShrinkHeap {
|
||||
}
|
||||
|
||||
private void eat() {
|
||||
for (int i = 0; i < M; i++) {
|
||||
for (int i = 0; i < LEN; i++) {
|
||||
list.add(new byte[1024]);
|
||||
}
|
||||
MemoryUsagePrinter.printMemoryUsage("allocated " + M + " arrays");
|
||||
MemoryUsagePrinter.printMemoryUsage("allocated " + LEN + " arrays");
|
||||
|
||||
list.subList(0, M / 2).clear();
|
||||
list.subList(0, LEN / 2).clear();
|
||||
System.gc();
|
||||
MemoryUsagePrinter.printMemoryUsage("array halved");
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
public class T
|
||||
{
|
||||
public static boolean foo(boolean bar)
|
||||
{
|
||||
return bar;
|
||||
}
|
||||
|
||||
public static void printIt()
|
||||
{
|
||||
System.out.println("Hello");
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
#include <assert.h>
|
||||
#include <jni.h>
|
||||
#include <alloca.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
union env_union
|
||||
{
|
||||
void *void_env;
|
||||
JNIEnv *jni_env;
|
||||
};
|
||||
|
||||
union env_union tmp;
|
||||
JNIEnv* env;
|
||||
JavaVM* jvm;
|
||||
JavaVMInitArgs vm_args;
|
||||
JavaVMOption options[1];
|
||||
jclass class_id;
|
||||
jmethodID method_id;
|
||||
jint result;
|
||||
|
||||
long product(unsigned long n, unsigned long m) {
|
||||
if (m == 1) {
|
||||
return n;
|
||||
} else {
|
||||
int *p = alloca(sizeof (int));
|
||||
*p = n;
|
||||
return product (n, m-1) + *p;
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
floobydust (void *p)
|
||||
{
|
||||
(*jvm)->AttachCurrentThread(jvm, &tmp.void_env, NULL);
|
||||
env = tmp.jni_env;
|
||||
|
||||
class_id = (*env)->FindClass (env, "T");
|
||||
assert (class_id);
|
||||
|
||||
method_id = (*env)->GetStaticMethodID (env, class_id, "printIt", "()V");
|
||||
assert (method_id);
|
||||
|
||||
(*env)->CallStaticVoidMethod (env, class_id, method_id, NULL);
|
||||
|
||||
(*jvm)->DetachCurrentThread(jvm);
|
||||
|
||||
printf("%ld\n", product(5000,5000));
|
||||
|
||||
(*jvm)->AttachCurrentThread(jvm, &tmp.void_env, NULL);
|
||||
env = tmp.jni_env;
|
||||
|
||||
class_id = (*env)->FindClass (env, "T");
|
||||
assert (class_id);
|
||||
|
||||
method_id = (*env)->GetStaticMethodID (env, class_id, "printIt", "()V");
|
||||
assert (method_id);
|
||||
|
||||
(*env)->CallStaticVoidMethod (env, class_id, method_id, NULL);
|
||||
|
||||
(*jvm)->DetachCurrentThread(jvm);
|
||||
|
||||
printf("%ld\n", product(5000,5000));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, const char** argv)
|
||||
{
|
||||
options[0].optionString = "-Xss320k";
|
||||
|
||||
vm_args.version = JNI_VERSION_1_2;
|
||||
vm_args.ignoreUnrecognized = JNI_TRUE;
|
||||
vm_args.options = options;
|
||||
vm_args.nOptions = 1;
|
||||
|
||||
result = JNI_CreateJavaVM (&jvm, &tmp.void_env, &vm_args);
|
||||
assert (result >= 0);
|
||||
|
||||
env = tmp.jni_env;
|
||||
|
||||
floobydust (NULL);
|
||||
|
||||
pthread_t thr;
|
||||
pthread_create (&thr, NULL, floobydust, NULL);
|
||||
pthread_join (thr, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# 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 testme.sh
|
||||
# @bug 8009062
|
||||
# @summary Poor performance of JNI AttachCurrentThread after fix for 7017193
|
||||
# @compile DoOverflow.java
|
||||
# @run shell testme.sh
|
||||
|
||||
set -x
|
||||
if [ "${TESTSRC}" = "" ]
|
||||
then
|
||||
TESTSRC=${PWD}
|
||||
echo "TESTSRC not set. Using "${TESTSRC}" as default"
|
||||
fi
|
||||
echo "TESTSRC=${TESTSRC}"
|
||||
## Adding common setup Variables for running shell tests.
|
||||
. ${TESTSRC}/../../test_env.sh
|
||||
|
||||
if [ "${VM_OS}" != "linux" ]
|
||||
then
|
||||
echo "Test only valid for Linux"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
gcc_cmd=`which gcc`
|
||||
if [ "x$gcc_cmd" = "x" ]; then
|
||||
echo "WARNING: gcc not found. Cannot execute test." 2>&1
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
CFLAGS="-m${VM_BITS}"
|
||||
|
||||
LD_LIBRARY_PATH=.:${TESTJAVA}/jre/lib/${VM_CPU}/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH
|
||||
export LD_LIBRARY_PATH
|
||||
|
||||
cp ${TESTSRC}/invoke.c .
|
||||
|
||||
# Copy the result of our @compile action:
|
||||
cp ${TESTCLASSES}/DoOverflow.class .
|
||||
|
||||
echo "Architecture: ${VM_CPU}"
|
||||
echo "Compilation flag: ${CFLAGS}"
|
||||
echo "VM type: ${VM_TYPE}"
|
||||
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
|
||||
|
||||
# Note pthread may not be found thus invoke creation will fail to be created.
|
||||
# Check to ensure you have a /usr/lib/libpthread.so if you don't please look
|
||||
# for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation.
|
||||
|
||||
$gcc_cmd -DLINUX ${CFLAGS} -o invoke \
|
||||
-I${TESTJAVA}/include -I${TESTJAVA}/include/linux \
|
||||
-L${TESTJAVA}/jre/lib/${VM_CPU}/${VM_TYPE} \
|
||||
-ljvm -lpthread invoke.c
|
||||
|
||||
./invoke
|
||||
exit $?
|
@ -30,12 +30,16 @@ public class DoOverflow {
|
||||
overflow();
|
||||
}
|
||||
|
||||
public static void printAlive() {
|
||||
System.out.println("Java thread is alive.");
|
||||
}
|
||||
|
||||
public static void printIt() {
|
||||
System.out.println("Going to overflow stack");
|
||||
try {
|
||||
new DoOverflow().overflow();
|
||||
} catch(java.lang.StackOverflowError e) {
|
||||
System.out.println("Overflow OK " + count);
|
||||
System.out.println("Test PASSED. Got StackOverflowError at " + count + " iteration");
|
||||
}
|
||||
}
|
||||
}
|
266
hotspot/test/runtime/StackGuardPages/invoke.c
Normal file
266
hotspot/test/runtime/StackGuardPages/invoke.c
Normal file
@ -0,0 +1,266 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* This code tests the fact that we actually remove stack guard page when calling
|
||||
* JavaThread::exit() i.e. when detaching from current thread.
|
||||
* We overflow the stack and check that we get access error because of a guard page.
|
||||
* Than we detach from vm thread and overflow stack once again. This time we shouldn't
|
||||
* get access error because stack guard page is removed
|
||||
*
|
||||
* Notice: due a complicated interaction of signal handlers, the test may crash.
|
||||
* It's OK - don't file a bug.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <jni.h>
|
||||
#include <alloca.h>
|
||||
#include <signal.h>
|
||||
#include <sys/mman.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ucontext.h>
|
||||
#include <setjmp.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
JavaVM* _jvm;
|
||||
|
||||
static jmp_buf context;
|
||||
|
||||
static int _last_si_code = -1;
|
||||
static int _failures = 0;
|
||||
static int _rec_count = 0;
|
||||
static int _kp_rec_count = 0;
|
||||
|
||||
pid_t gettid() {
|
||||
return (pid_t) syscall(SYS_gettid);
|
||||
}
|
||||
|
||||
static void handler(int sig, siginfo_t *si, void *unused) {
|
||||
_last_si_code = si->si_code;
|
||||
printf("Got SIGSEGV(%d) at address: 0x%lx\n",si->si_code, (long) si->si_addr);
|
||||
longjmp(context, 1);
|
||||
}
|
||||
|
||||
void set_signal_handler() {
|
||||
static char altstack[SIGSTKSZ];
|
||||
|
||||
stack_t ss = {
|
||||
.ss_size = SIGSTKSZ,
|
||||
.ss_flags = 0,
|
||||
.ss_sp = altstack
|
||||
};
|
||||
|
||||
struct sigaction sa = {
|
||||
.sa_sigaction = handler,
|
||||
.sa_flags = SA_ONSTACK | SA_SIGINFO | SA_RESETHAND
|
||||
};
|
||||
|
||||
_last_si_code = -1;
|
||||
|
||||
sigaltstack(&ss, 0);
|
||||
sigemptyset(&sa.sa_mask);
|
||||
if (sigaction(SIGSEGV, &sa, NULL) == -1) {
|
||||
fprintf(stderr, "Test ERROR. Can't set sigaction (%d)\n", errno);
|
||||
exit(7);
|
||||
}
|
||||
}
|
||||
|
||||
void *run_java_overflow (void *p) {
|
||||
JNIEnv *env;
|
||||
jclass class_id;
|
||||
jmethodID method_id;
|
||||
int res;
|
||||
|
||||
res = (*_jvm)->AttachCurrentThread(_jvm, (void**)&env, NULL);
|
||||
if (res != JNI_OK) {
|
||||
fprintf(stderr, "Test ERROR. Can't attach to current thread\n");
|
||||
exit(7);
|
||||
}
|
||||
|
||||
class_id = (*env)->FindClass (env, "DoOverflow");
|
||||
if (class_id == NULL) {
|
||||
fprintf(stderr, "Test ERROR. Can't load class DoOverflow\n");
|
||||
exit(7);
|
||||
}
|
||||
|
||||
method_id = (*env)->GetStaticMethodID(env, class_id, "printIt", "()V");
|
||||
if (method_id == NULL) {
|
||||
fprintf(stderr, "Test ERROR. Can't find method DoOverflow.printIt\n");
|
||||
exit(7);
|
||||
}
|
||||
|
||||
(*env)->CallStaticVoidMethod(env, class_id, method_id, NULL);
|
||||
|
||||
res = (*_jvm)->DetachCurrentThread(_jvm);
|
||||
if (res != JNI_OK) {
|
||||
fprintf(stderr, "Test ERROR. Can't call detach from current thread\n");
|
||||
exit(7);
|
||||
}
|
||||
}
|
||||
|
||||
void do_overflow(){
|
||||
int *p = alloca(sizeof(int));
|
||||
if (_kp_rec_count == 0 || _rec_count < _kp_rec_count) {
|
||||
_rec_count ++;
|
||||
do_overflow();
|
||||
}
|
||||
}
|
||||
|
||||
void *run_native_overflow(void *p) {
|
||||
// Test that stack guard page is correctly set for initial and non initial thread
|
||||
// and correctly removed for the initial thread
|
||||
JNIEnv *env;
|
||||
jclass class_id;
|
||||
jmethodID method_id;
|
||||
int res;
|
||||
|
||||
printf("run_native_overflow %ld\n", (long) gettid());
|
||||
|
||||
res = (*_jvm)->AttachCurrentThread(_jvm, (void **)&env, NULL);
|
||||
if (res != JNI_OK) {
|
||||
fprintf(stderr, "Test ERROR. Can't attach to current thread\n");
|
||||
exit(7);
|
||||
}
|
||||
|
||||
class_id = (*env)->FindClass (env, "DoOverflow");
|
||||
if (class_id == NULL) {
|
||||
fprintf(stderr, "Test ERROR. Can't load class DoOverflow\n");
|
||||
exit(7);
|
||||
}
|
||||
|
||||
method_id = (*env)->GetStaticMethodID (env, class_id, "printAlive", "()V");
|
||||
if (method_id == NULL) {
|
||||
fprintf(stderr, "Test ERROR. Can't find method DoOverflow.printAlive\n");
|
||||
exit(7);
|
||||
}
|
||||
|
||||
(*env)->CallStaticVoidMethod (env, class_id, method_id, NULL);
|
||||
|
||||
set_signal_handler();
|
||||
if (! setjmp(context)) {
|
||||
do_overflow();
|
||||
}
|
||||
|
||||
if (_last_si_code == SEGV_ACCERR) {
|
||||
printf("Test PASSED. Got access violation accessing guard page at %d\n", _rec_count);
|
||||
}
|
||||
|
||||
res = (*_jvm)->DetachCurrentThread(_jvm);
|
||||
if (res != JNI_OK) {
|
||||
fprintf(stderr, "Test ERROR. Can't call detach from current thread\n");
|
||||
exit(7);
|
||||
}
|
||||
|
||||
if (getpid() != gettid()) {
|
||||
// For non-initial thread we don't unmap the region but call os::uncommit_memory and keep PROT_NONE
|
||||
// so if host has enough swap space we will get the same SEGV with code SEGV_ACCERR(2) trying
|
||||
// to access it as if the guard page is present.
|
||||
// We have no way to check this, so bail out, marking test as succeeded
|
||||
printf("Test PASSED. Not initial thread\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Limit depth of recursion for second run. It can't exceed one for first run.
|
||||
_kp_rec_count = _rec_count;
|
||||
_rec_count = 0;
|
||||
|
||||
set_signal_handler();
|
||||
if (! setjmp(context)) {
|
||||
do_overflow();
|
||||
}
|
||||
|
||||
if (_last_si_code == SEGV_ACCERR) {
|
||||
++ _failures;
|
||||
fprintf(stderr,"Test FAILED. Stack guard page is still there at %d\n", _rec_count);
|
||||
} else if (_last_si_code == -1) {
|
||||
printf("Test PASSED. No stack guard page is present. Maximum recursion level reached at %d\n", _rec_count);
|
||||
}
|
||||
else{
|
||||
printf("Test PASSED. No stack guard page is present. SIGSEGV(%d) at %d\n", _last_si_code, _rec_count);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void usage() {
|
||||
fprintf(stderr, "Usage: invoke test_java_overflow\n");
|
||||
fprintf(stderr, " invoke test_native_overflow\n");
|
||||
exit(7);
|
||||
}
|
||||
|
||||
|
||||
int main (int argc, const char** argv) {
|
||||
JavaVMInitArgs vm_args;
|
||||
JavaVMOption options[2];
|
||||
JNIEnv* env;
|
||||
|
||||
printf("Test started with pid: %ld\n", (long) getpid());
|
||||
|
||||
options[0].optionString = "-Xint";
|
||||
options[1].optionString = "-Xss320k";
|
||||
|
||||
vm_args.version = JNI_VERSION_1_2;
|
||||
vm_args.ignoreUnrecognized = JNI_TRUE;
|
||||
vm_args.options = options;
|
||||
vm_args.nOptions = 2;
|
||||
|
||||
if (JNI_CreateJavaVM (&_jvm, (void **)&env, &vm_args) < 0 ) {
|
||||
fprintf(stderr, "Test ERROR. Can't create JavaVM\n");
|
||||
exit(7);
|
||||
}
|
||||
|
||||
pthread_t thr;
|
||||
|
||||
if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
|
||||
printf("\nTesting JAVA_OVERFLOW\n");
|
||||
|
||||
printf("Testing stack guard page behaviour for other thread\n");
|
||||
pthread_create (&thr, NULL, run_java_overflow, NULL);
|
||||
pthread_join (thr, NULL);
|
||||
|
||||
printf("Testing stack guard page behaviour for initial thread\n");
|
||||
run_java_overflow(NULL);
|
||||
// This test crash on error
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (argc > 1 && strcmp(argv[1], "test_native_overflow") == 0) {
|
||||
printf("\nTesting NATIVE_OVERFLOW\n");
|
||||
|
||||
printf("Testing stack guard page behaviour for other thread\n");
|
||||
pthread_create (&thr, NULL, run_native_overflow, NULL);
|
||||
pthread_join (thr, NULL);
|
||||
|
||||
printf("Testing stack guard page behaviour for initial thread\n");
|
||||
run_native_overflow(NULL);
|
||||
|
||||
exit((_failures > 0) ? 1 : 0);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Test ERROR. Unknown parameter %s\n", ((argc > 1) ? argv[1] : "none"));
|
||||
usage();
|
||||
}
|
@ -1,13 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
##
|
||||
## @test Test6929067.sh
|
||||
## @bug 6929067
|
||||
## @bug 8021296
|
||||
## @bug 8025519
|
||||
## @summary Stack guard pages should be removed when thread is detached
|
||||
## @run shell Test6929067.sh
|
||||
##
|
||||
#
|
||||
# @test testme.sh
|
||||
# @summary Stack guard pages should be installed correctly and removed when thread is detached
|
||||
# @run shell testme.sh
|
||||
#
|
||||
|
||||
if [ "${TESTSRC}" = "" ]
|
||||
then
|
||||
@ -32,12 +29,9 @@ fi
|
||||
|
||||
CFLAGS=-m${VM_BITS}
|
||||
|
||||
LD_LIBRARY_PATH=.:${TESTJAVA}/jre/lib/${VM_CPU}/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH
|
||||
LD_LIBRARY_PATH=.:${TESTJAVA}/jre/lib/${VM_CPU}/${VM_TYPE}:${TESTJAVA}/lib/${VM_CPU}/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH
|
||||
export LD_LIBRARY_PATH
|
||||
|
||||
cp ${TESTSRC}/*.java ${THIS_DIR}
|
||||
${COMPILEJAVA}/bin/javac *.java
|
||||
|
||||
echo "Architecture: ${VM_CPU}"
|
||||
echo "Compilation flag: ${CFLAGS}"
|
||||
echo "VM type: ${VM_TYPE}"
|
||||
@ -47,10 +41,20 @@ echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
|
||||
# Check to ensure you have a /usr/lib/libpthread.so if you don't please look
|
||||
# for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation.
|
||||
|
||||
$gcc_cmd -DLINUX ${CFLAGS} -o invoke \
|
||||
cp ${TESTSRC}/DoOverflow.java .
|
||||
${COMPILEJAVA}/bin/javac DoOverflow.java
|
||||
|
||||
$gcc_cmd -DLINUX -g3 ${CFLAGS} -o invoke \
|
||||
-I${TESTJAVA}/include -I${TESTJAVA}/include/linux \
|
||||
-L${TESTJAVA}/jre/lib/${VM_CPU}/${VM_TYPE} \
|
||||
-L${TESTJAVA}/lib/${VM_CPU}/${VM_TYPE} \
|
||||
${TESTSRC}/invoke.c -ljvm -lpthread
|
||||
|
||||
./invoke
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "Compile failed, Ignoring failed compilation and forcing the test to pass"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
./invoke test_java_overflow
|
||||
./invoke test_native_overflow
|
||||
exit $?
|
64
hotspot/test/serviceability/jvmti/GetObjectSizeOverflow.java
Normal file
64
hotspot/test/serviceability/jvmti/GetObjectSizeOverflow.java
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* 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.io.PrintWriter;
|
||||
import com.oracle.java.testlibrary.*;
|
||||
|
||||
/*
|
||||
* Test to verify GetObjectSize does not overflow on a 600M element int[]
|
||||
*
|
||||
* @test
|
||||
* @bug 8027230
|
||||
* @library /testlibrary
|
||||
* @build GetObjectSizeOverflowAgent
|
||||
* @run main ClassFileInstaller GetObjectSizeOverflowAgent
|
||||
* @run main GetObjectSizeOverflow
|
||||
*/
|
||||
public class GetObjectSizeOverflow {
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
if (!Platform.is64bit()) {
|
||||
System.out.println("Test needs a 4GB heap and can only be run as a 64bit process, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
PrintWriter pw = new PrintWriter("MANIFEST.MF");
|
||||
pw.println("Premain-Class: GetObjectSizeOverflowAgent");
|
||||
pw.close();
|
||||
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
pb.command(new String[] { JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF", "agent.jar", "GetObjectSizeOverflowAgent.class"});
|
||||
pb.start().waitFor();
|
||||
|
||||
ProcessBuilder pt = ProcessTools.createJavaProcessBuilder(true, "-Xmx4000m", "-javaagent:agent.jar", "GetObjectSizeOverflowAgent");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pt.start());
|
||||
|
||||
if (output.getStdout().contains("Could not reserve enough space") || output.getStderr().contains("java.lang.OutOfMemoryError")) {
|
||||
System.out.println("stdout: " + output.getStdout());
|
||||
System.out.println("stderr: " + output.getStderr());
|
||||
System.out.println("Test could not reserve or allocate enough space, skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
output.stdoutShouldContain("GetObjectSizeOverflow passed");
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* 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.lang.instrument.*;
|
||||
|
||||
public class GetObjectSizeOverflowAgent {
|
||||
|
||||
static Instrumentation instrumentation;
|
||||
|
||||
public static void premain(String agentArgs, Instrumentation instrumentation) {
|
||||
GetObjectSizeOverflowAgent.instrumentation = instrumentation;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
int[] a = new int[600_000_000];
|
||||
long size = instrumentation.getObjectSize(a);
|
||||
|
||||
if (size < 2_400_000_000L) {
|
||||
throw new RuntimeException("Invalid size of array, expected >= 2400000000, got " + size);
|
||||
}
|
||||
|
||||
System.out.println("GetObjectSizeOverflow passed");
|
||||
}
|
||||
}
|
@ -256,3 +256,5 @@ f93a792fe37279d4d37aea86a99f3abbdc6fe79b jdk9-b09
|
||||
6b4280dceb00642f54d5bc1c2cb7d34c99a04992 jdk9-b11
|
||||
e88cecf5a21b760ff7d7761c2db6bb8c82bc9f0c jdk9-b12
|
||||
5eaf717f6e36037a6d3744ffeee0e4c88e64a0d2 jdk9-b13
|
||||
32b3fc4bc7374a34d52b7f4e2391b4b4b0c084e8 jdk9-b14
|
||||
6bad71866c7598587860e0981b0b0e51ec8c0476 jdk9-b15
|
||||
|
@ -1,60 +0,0 @@
|
||||
###########################################################################
|
||||
# reserved comment block
|
||||
# DO NOT REMOVE OR ALTER!
|
||||
###########################################################################
|
||||
##########################################################################
|
||||
# Copyright 2001-2004 The Apache Software Foundation.
|
||||
#
|
||||
# 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.
|
||||
##########################################################################
|
||||
#
|
||||
# $Id: Makefile.inc,v 1.2 2004/02/17 16:32:49 minchau Exp $
|
||||
#
|
||||
####################################################################
|
||||
# #
|
||||
# Makefile.inc for XSLT compiler #
|
||||
# #
|
||||
####################################################################
|
||||
|
||||
####################################################################
|
||||
# Useful macros #
|
||||
####################################################################
|
||||
|
||||
JAVAC = javac
|
||||
#JAVAC_FLAGS = -g -d $(XSLT)/src/classes
|
||||
JAVAC_FLAGS = -sourcepath $(XSLT)/src
|
||||
JAVACC = javacc
|
||||
JAVACC_FLAGS = -static=FALSE
|
||||
JAVACUP = javacup
|
||||
JAVACUP_FLAGS =
|
||||
JAVALEX = jlex
|
||||
JAVALEX_FLAGS =
|
||||
|
||||
####################################################################
|
||||
# Explicit rules #
|
||||
####################################################################
|
||||
|
||||
.SUFFIXES: .java .class .jj .lex .cup
|
||||
|
||||
.java.class:
|
||||
$(JAVAC) $(JAVAC_FLAGS) $<
|
||||
|
||||
.jj.java:
|
||||
$(JAVACC) $(JAVACC_FLAGS) $<
|
||||
|
||||
.cup.java:
|
||||
$(JAVACUP) $(JAVACUP_FLAGS) $<
|
||||
|
||||
.lex.java:
|
||||
$(JAVALEX) $(JAVALEX_FLAGS) $<
|
||||
|
@ -1 +0,0 @@
|
||||
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
|
@ -1 +0,0 @@
|
||||
com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl
|
@ -1 +0,0 @@
|
||||
com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl
|
@ -1 +0,0 @@
|
||||
com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl
|
@ -1 +0,0 @@
|
||||
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
|
@ -1 +0,0 @@
|
||||
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
|
@ -1 +0,0 @@
|
||||
com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory
|
@ -1 +0,0 @@
|
||||
com.sun.org.apache.xerces.internal.parsers.DTDConfiguration
|
@ -1 +0,0 @@
|
||||
com.sun.org.apache.xerces.internal.parsers.XML11Configuration
|
@ -1 +0,0 @@
|
||||
com.sun.org.apache.xerces.internal.parsers.XIncludeAwareParserConfiguration
|
@ -1,2 +0,0 @@
|
||||
com.sun.org.apache.xerces.internal.parsers.SAXParser
|
||||
|
@ -1 +0,0 @@
|
||||
com.sun.xml.internal.stream.events.XMLEventFactoryImpl
|
@ -1 +0,0 @@
|
||||
com.sun.xml.internal.stream.XMLInputFactoryImpl
|
@ -1 +0,0 @@
|
||||
com.sun.xml.internal.stream.XMLOutputFactoryImpl
|
@ -1,12 +0,0 @@
|
||||
SAX IS FREE
|
||||
-----------
|
||||
|
||||
I hereby abandon any property rights to SAX 2.0 (the Simple API for
|
||||
XML), and release all of the SAX 2.0 source code, compiled code, and
|
||||
documentation contained in this distribution into the Public Domain.
|
||||
SAX comes with NO WARRANTY or guarantee of fitness for any purpose.
|
||||
|
||||
|
||||
David Megginson
|
||||
david@megginson.com
|
||||
2000-01-14
|
@ -1,39 +0,0 @@
|
||||
SAX COPYRIGHT STATUS
|
||||
|
||||
Version 1.0 of the Simple API for XML (SAX), created collectively by
|
||||
the membership of the XML-DEV mailing list, is hereby released into
|
||||
the public domain.
|
||||
|
||||
No one owns SAX: you may use it freely in both commercial and
|
||||
non-commercial applications, bundle it with your software
|
||||
distribution, include it on a CD-ROM, list the source code in a book,
|
||||
mirror the documentation at your own web site, or use it in any other
|
||||
way you see fit.
|
||||
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
Because SAX is released to the public domain, there is no warranty for
|
||||
the design or for the software implementation, to the extent permitted
|
||||
by applicable law. Except when otherwise stated in writing the
|
||||
copyright holders and/or other parties provide SAX "as is" without
|
||||
warranty of any kind, either expressed or implied, including, but not
|
||||
limited to, the implied warranties of merchantability and fitness for
|
||||
a particular purpose. The entire risk as to the quality and
|
||||
performance of SAX is with you. Should SAX prove defective, you
|
||||
assume the cost of all necessary servicing, repair or correction.
|
||||
|
||||
In no event unless required by applicable law or agreed to in writing
|
||||
will any copyright holder, or any other party who may modify and/or
|
||||
redistribute SAX, be liable to you for damages, including any general,
|
||||
special, incidental or consequential damages arising out of the use or
|
||||
inability to use SAX (including but not limited to loss of data or
|
||||
data being rendered inaccurate or losses sustained by you or third
|
||||
parties or a failure of the SAX to operate with any other programs),
|
||||
even if such holder or other party has been advised of the possibility
|
||||
of such damages.
|
||||
|
||||
|
||||
David Megginson <sax@megginson.com>
|
||||
1998-05-11
|
||||
|
@ -259,3 +259,5 @@ c9e8bb8c1144a966ca7b481142c6b5e55d14a29c jdk9-b09
|
||||
1f953ba7db2b535e19f0354abfee6d67605e0684 jdk9-b11
|
||||
779f8b21c75f83e3918dac8499e4d0ecb3a54ed7 jdk9-b12
|
||||
3d42204854c9f703e3ccdc8891248e73057713ab jdk9-b13
|
||||
02e58850b7062825308413d420f2b02c1f25a724 jdk9-b14
|
||||
e9780330017a6b464a385356d77e5136f9de8d09 jdk9-b15
|
||||
|
@ -1,2 +0,0 @@
|
||||
com.sun.xml.internal.ws.db.glassfish.JAXBRIContextFactory
|
||||
# com.sun.xml.internal.ws.db.toplink.JAXBContextFactory
|
@ -1,131 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Copyright (c) 1997, 2012, 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.
|
||||
-->
|
||||
|
||||
<grammar
|
||||
xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
xmlns:r="http://relaxng.org/ns/structure/1.0"
|
||||
xmlns:a="http://relaxng.org/ns/annotation/1.0"
|
||||
xmlns:ref="urn:crossreference"
|
||||
xmlns:c="http://www.xml.gr.jp/xmlns/relaxngcc"
|
||||
c:runtime-type="com.sun.tools.internal.jxc.NGCCRuntimeEx"
|
||||
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
|
||||
c:package="com.sun.tools.internal.jxc.gen.config">
|
||||
|
||||
|
||||
<start c:class="Config" c:access="public">
|
||||
|
||||
<c:java-import>
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.io.File;
|
||||
</c:java-import>
|
||||
|
||||
<c:java-body>
|
||||
private File baseDir;
|
||||
private Classes classes;
|
||||
private List schema = new ArrayList();
|
||||
public Classes getClasses() { return this.classes;}
|
||||
public File getBaseDir() { return baseDir;}
|
||||
public List getSchema() { return this.schema;}
|
||||
</c:java-body>
|
||||
|
||||
<element name="config">
|
||||
<attribute name="baseDir">
|
||||
bd = <data type="string"/>
|
||||
baseDir = $runtime.getBaseDir(bd);
|
||||
</attribute>
|
||||
<ref name="Classes" c:alias="classes"/>
|
||||
<zeroOrMore>
|
||||
<ref name="Schema" c:alias="_schema" />(baseDir);
|
||||
this.schema.add (_schema);
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</start>
|
||||
|
||||
|
||||
<define name="Classes" c:access="public">
|
||||
<c:java-import>
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
</c:java-import>
|
||||
<c:java-body>
|
||||
private List includes = new ArrayList();
|
||||
public List getIncludes() { return $runtime.getIncludePatterns(this.includes);}
|
||||
private List excludes = new ArrayList();
|
||||
public List getExcludes() { return $runtime.getExcludePatterns(this.excludes);}
|
||||
</c:java-body>
|
||||
<element name="classes">
|
||||
|
||||
<element name="includes">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
<data type="string" c:alias="include_content"/>
|
||||
<c:java> this.includes.add(include_content); </c:java>
|
||||
</oneOrMore>
|
||||
</list>
|
||||
|
||||
</element>
|
||||
<optional>
|
||||
<element name="excludes">
|
||||
<list>
|
||||
<zeroOrMore>
|
||||
<data type="string" c:alias="exclude_content"/>
|
||||
<c:java> this.excludes.add(exclude_content); </c:java>
|
||||
</zeroOrMore>
|
||||
</list>
|
||||
|
||||
</element>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
|
||||
<define name="Schema" c:access="public" c:params="File baseDir">
|
||||
<c:java-import>
|
||||
import java.io.File;
|
||||
</c:java-import>
|
||||
<c:java-body>
|
||||
private File location;
|
||||
private String namespace;
|
||||
public String getNamespace() { return this.namespace;}
|
||||
public File getLocation() { return this.location;}
|
||||
</c:java-body>
|
||||
<element name="schema">
|
||||
<optional>
|
||||
<attribute name="namespace">
|
||||
namespace = <data type="string" />
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="location">
|
||||
loc = <data type="string" />
|
||||
location = new File(baseDir,loc);
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
</grammar>
|
@ -1,317 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Copyright (c) 1997, 2012, 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.
|
||||
-->
|
||||
|
||||
<!--
|
||||
DTD binding information file which is supported by this version of XJC.
|
||||
|
||||
- Changes from the EA1 is marked by "CHANGE:"
|
||||
- "ref:key" and "ref:keyref" are used to specify cross-reference
|
||||
information.
|
||||
- "a:defaultValue" is used to specify the default behavior.
|
||||
Note that default behaviors are hard-coded to the source code.
|
||||
Values specified in this schema is not used in the actual processing.
|
||||
-->
|
||||
<grammar
|
||||
xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
|
||||
xmlns:a="http://relaxng.org/ns/annotation/1.0"
|
||||
xmlns:ref="urn:crossreference"
|
||||
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
|
||||
<start>
|
||||
<element name="xml-java-binding-schema">
|
||||
<optional>
|
||||
<attribute name="version">
|
||||
<value>1.0ea2</value>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<interleave>
|
||||
<optional>
|
||||
<element name="options">
|
||||
<optional>
|
||||
<attribute name="package"/>
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="xjc:serializable">
|
||||
<optional>
|
||||
<attribute name="uid">
|
||||
<data type="long"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="xjc:superClass">
|
||||
<attribute name="name"/>
|
||||
</element>
|
||||
</optional>
|
||||
<!-- light-weight runtime -->
|
||||
<optional>
|
||||
<element name="xjc:noMarshaller">
|
||||
<empty/>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="xjc:noUnmarshaller">
|
||||
<empty/>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="xjc:noValidator">
|
||||
<empty/>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="xjc:noValidatingUnmarshaller">
|
||||
<empty/>
|
||||
</element>
|
||||
</optional>
|
||||
<zeroOrMore>
|
||||
<choice>
|
||||
<ref name="toplevel.declaration"/>
|
||||
<ref name="global.or.local.declaration"/>
|
||||
</choice>
|
||||
</zeroOrMore>
|
||||
</interleave>
|
||||
</element>
|
||||
</start>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- element-class declaration -->
|
||||
<define name="toplevel.declaration" combine="choice">
|
||||
<element name="element">
|
||||
<attribute name="name"/>
|
||||
<attribute name="type">
|
||||
<value>class</value>
|
||||
</attribute>
|
||||
<optional>
|
||||
<attribute name="class">
|
||||
<ref name="java.classname.datatype"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="root" a:defaultValue="false">
|
||||
<choice>
|
||||
<value>true</value>
|
||||
<value>false</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<interleave>
|
||||
<!-- attribute-property declaration -->
|
||||
<zeroOrMore>
|
||||
<element name="attribute">
|
||||
<attribute name="name"/>
|
||||
<optional>
|
||||
<attribute name="property"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<ref name="collection.att"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="convert">
|
||||
<text ref:keyref="conversion"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
|
||||
<zeroOrMore>
|
||||
<ref name="global.or.local.declaration"/>
|
||||
</zeroOrMore>
|
||||
|
||||
<!-- element-local declarations -->
|
||||
<zeroOrMore>
|
||||
<element name="constructor">
|
||||
<attribute name="properties">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
<!-- point to a property defined in this element -->
|
||||
<data type="token"/>
|
||||
</oneOrMore>
|
||||
</list>
|
||||
</attribute>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
|
||||
<optional>
|
||||
<element name="content">
|
||||
<interleave>
|
||||
<choice>
|
||||
<!-- general content-property declaration -->
|
||||
<ref name="collection.particle.decl"/>
|
||||
|
||||
<!-- model-based content property declaration -->
|
||||
<group>
|
||||
<zeroOrMore>
|
||||
<choice>
|
||||
<element name="element-ref">
|
||||
<attribute name="name"/>
|
||||
<optional>
|
||||
<attribute name="property"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<ref name="collection.att"/>
|
||||
</optional>
|
||||
</element>
|
||||
<element>
|
||||
<choice>
|
||||
<name>sequence</name>
|
||||
<name>choice</name>
|
||||
</choice>
|
||||
<ref name="collection.particle.decl"/>
|
||||
</element>
|
||||
</choice>
|
||||
</zeroOrMore>
|
||||
<optional><!-- followed by an optional <rest> -->
|
||||
<element name="rest">
|
||||
<ref name="collection.particle.decl"/>
|
||||
</element>
|
||||
</optional>
|
||||
</group>
|
||||
</choice>
|
||||
</interleave>
|
||||
</element>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name="collection.particle.decl">
|
||||
<attribute name="property"/>
|
||||
<optional>
|
||||
<ref name="collection.att"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="supertype"/>
|
||||
</optional>
|
||||
</define>
|
||||
|
||||
<define name="collection.att">
|
||||
<attribute name="collection">
|
||||
<!-- CHANGE: array is removed and set,vector are added -->
|
||||
<choice>
|
||||
<value>list</value>
|
||||
<value>set</value>
|
||||
<value>vector</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</define>
|
||||
|
||||
|
||||
|
||||
<!-- conversion declaration -->
|
||||
<define name="global.or.local.declaration" combine="choice">
|
||||
<element name="conversion">
|
||||
<attribute name="name" ref:key="conversion"/>
|
||||
<optional>
|
||||
<!-- defaults to @name -->
|
||||
<attribute name="type"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="parse" a:defaultValue="new"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="print" a:defaultValue="toString"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="whitespace" a:defaultValue="collapse">
|
||||
<choice>
|
||||
<value>preserve</value>
|
||||
<value>replace</value><!-- CHANGE: it was normalize -->
|
||||
<value>collapse</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<!-- element-value declaration -->
|
||||
<define name="toplevel.declaration" combine="choice">
|
||||
<element name="element">
|
||||
<attribute name="name"/>
|
||||
<attribute name="type">
|
||||
<value>value</value>
|
||||
</attribute>
|
||||
<optional>
|
||||
<attribute name="convert">
|
||||
<text ref:keyref="conversion"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<!-- interface declaration -->
|
||||
<define name="toplevel.declaration" combine="choice">
|
||||
<element name="interface">
|
||||
<attribute name="name">
|
||||
<ref name="java.classname.datatype"/>
|
||||
</attribute>
|
||||
<attribute name="members">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
<ref name="java.classname.datatype"/>
|
||||
</oneOrMore>
|
||||
</list>
|
||||
</attribute>
|
||||
<!-- CHANGE: TODO: @properties is not supported yet -->
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<!-- enumeration declaration -->
|
||||
<define name="global.or.local.declaration" combine="choice">
|
||||
<element name="enumeration">
|
||||
<attribute name="name">
|
||||
<ref name="java.classname.datatype"/>
|
||||
</attribute>
|
||||
<attribute name="members">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
<data type="token"/>
|
||||
</oneOrMore>
|
||||
</list>
|
||||
</attribute>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
|
||||
|
||||
<!-- valid Java name -->
|
||||
<define name="java.name.datatype">
|
||||
<!-- TODO: add pattern facet or implement a custom datatype -->
|
||||
<data type="token"/>
|
||||
</define>
|
||||
|
||||
<define name="java.classname.datatype">
|
||||
<ref name="java.name.datatype"/>
|
||||
</define>
|
||||
</grammar>
|
@ -1,913 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Copyright (c) 1997, 2012, 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.
|
||||
-->
|
||||
|
||||
<!DOCTYPE grammar [
|
||||
|
||||
|
||||
<!ENTITY XJCURI "http://java.sun.com/xml/ns/jaxb/xjc">
|
||||
]>
|
||||
<grammar
|
||||
xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
xmlns:cc="http://www.xml.gr.jp/xmlns/relaxngcc"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xjc="&XJCURI;"
|
||||
xmlns:p="post-processor-to-build-schema-for-validation"
|
||||
|
||||
ns="http://java.sun.com/xml/ns/jaxb"
|
||||
|
||||
cc:runtime-type="com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.NGCCRuntimeEx"
|
||||
cc:package="com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.parser"
|
||||
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
<!-- cc:$runtime-type="com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx">-->
|
||||
|
||||
<cc:java-import>
|
||||
import com.sun.codemodel.internal.*;
|
||||
import com.sun.tools.internal.xjc.generator.bean.field.*;
|
||||
import com.sun.tools.internal.xjc.model.*;
|
||||
import com.sun.xml.internal.bind.api.impl.NameConverter;
|
||||
import com.sun.xml.internal.bind.v2.WellKnownNamespace;
|
||||
import com.sun.xml.internal.bind.marshaller.SAX2DOMEx;
|
||||
import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.*;
|
||||
import com.sun.tools.internal.xjc.reader.Const;
|
||||
import org.xml.sax.*;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
import java.util.*;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
</cc:java-import>
|
||||
|
||||
<start cc:class="Root">
|
||||
<choice>
|
||||
<!-- root of the external binding file. -->
|
||||
<ref name="declaration"/>
|
||||
<!-- root of the internal binding -->
|
||||
<ref name="annotation"/>
|
||||
</choice>
|
||||
</start>
|
||||
|
||||
<!--
|
||||
in context of XML Schema annotation
|
||||
-->
|
||||
<define name="annotation" cc:access="public" cc:class="AnnotationState"
|
||||
cc:return-type="BindInfo" cc:return-value="bi">
|
||||
|
||||
<cc:java-import>
|
||||
import java.io.StringWriter;
|
||||
import com.sun.xml.internal.bind.marshaller.DataWriter;
|
||||
</cc:java-import>
|
||||
<cc:java-body>
|
||||
// customization declarations
|
||||
public BindInfo bi;
|
||||
|
||||
private StringWriter w;
|
||||
|
||||
private SAX2DOMEx sax2dom;
|
||||
</cc:java-body>
|
||||
|
||||
<element name="xs:annotation">
|
||||
bi = new BindInfo($runtime.copyLocator());
|
||||
$runtime.currentBindInfo = bi;
|
||||
|
||||
<p:ignore><ref name="anyAttributes"/></p:ignore>
|
||||
<zeroOrMore>
|
||||
<choice>
|
||||
<element name="xs:appinfo">
|
||||
<p:ignore><ref name="anyAttributes"/></p:ignore>
|
||||
<zeroOrMore>
|
||||
<choice>
|
||||
<group>
|
||||
result = <ref name="declaration" />
|
||||
bi.addDecl(result);
|
||||
</group>
|
||||
<element>
|
||||
<anyName><except>
|
||||
<nsName ns="&XJCURI;"/>
|
||||
<nsName /><!-- JAXB namespace URI -->
|
||||
<nsName ns="http://www.w3.org/2001/XMLSchema" />
|
||||
</except></anyName>
|
||||
|
||||
if($runtime.isExtensionURI($uri)) {
|
||||
// parse this sub-tree as an extension
|
||||
try {
|
||||
sax2dom = new SAX2DOMEx();
|
||||
} catch( ParserConfigurationException e ) {
|
||||
throw new Error(e); // impossible
|
||||
}
|
||||
$runtime.redirectSubtree(sax2dom,$uri,$localName,$qname);
|
||||
} else {
|
||||
// ignore this sub-tree
|
||||
sax2dom = null;
|
||||
$runtime.redirectSubtree(new DefaultHandler(),$uri,$localName,$qname);
|
||||
}
|
||||
<empty/>
|
||||
<p:ignore><ref name="anyContents"/></p:ignore>
|
||||
if(sax2dom!=null) {
|
||||
bi.addDecl(new BIXPluginCustomization(((Document)sax2dom.getDOM()).getDocumentElement(),$runtime.copyLocator()));
|
||||
}
|
||||
</element>
|
||||
<text/>
|
||||
</choice>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
<!-- ignore documentations -->
|
||||
<element name="xs:documentation">
|
||||
<p:ignore><ref name="anyAttributes"/></p:ignore>
|
||||
<zeroOrMore>
|
||||
<choice>
|
||||
<group>
|
||||
msg = <text />
|
||||
bi.appendDocumentation($runtime.truncateDocComment(msg),true);
|
||||
</group>
|
||||
<group>
|
||||
<element>
|
||||
<anyName />
|
||||
w = new StringWriter();
|
||||
DataWriter xw = new DataWriter(w,"UTF-8");
|
||||
xw.setXmlDecl(false);
|
||||
$runtime.redirectSubtree(xw,$uri,$localName,$qname);
|
||||
<empty/>
|
||||
<p:ignore><ref name="anyContents"/></p:ignore>
|
||||
</element>
|
||||
<![CDATA[
|
||||
bi.appendDocumentation("<pre>"+
|
||||
$runtime.escapeMarkup($runtime.truncateDocComment(w.toString()))+
|
||||
"</pre>",
|
||||
false );
|
||||
w=null;
|
||||
]]>
|
||||
</group>
|
||||
</choice>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</choice>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
Individual customization declarations
|
||||
|
||||
-->
|
||||
|
||||
<define name="declaration"
|
||||
cc:return-type="BIDeclaration" cc:return-value="result">
|
||||
|
||||
<cc:java-body>
|
||||
private BIDeclaration result;
|
||||
</cc:java-body>
|
||||
<!-- result field will have the parsed object -->
|
||||
<choice>
|
||||
result = <ref name="globalBindings" />
|
||||
result = <ref name="schemaBindings" />
|
||||
result = <ref name="class"/>
|
||||
result = <ref name="conversion"/>
|
||||
result = <ref name="property"/>
|
||||
result = <ref name="typesafeEnum"/>
|
||||
result = <ref name="enumMember"/>
|
||||
<!-- result = <ref name="idSymbolSpace"/-->
|
||||
<!-- result = <ref name="dom"/-->
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
|
||||
<define name="globalBindings"
|
||||
cc:return-type="BIGlobalBinding" cc:return-value="makeResult()">
|
||||
|
||||
<cc:java-body>
|
||||
private Locator loc;
|
||||
private Map globalConvs = new HashMap();
|
||||
private NameConverter nameConverter = NameConverter.standard;
|
||||
private String enableJavaNamingConvention = "true";
|
||||
private String fixedAttrToConstantProperty = "false";
|
||||
private String needIsSetMethod = "false";
|
||||
private String simpleTypeSubstitution = "false";
|
||||
private boolean flattenClasses = false;
|
||||
private Set enumBaseTypes = new HashSet();
|
||||
private int defaultEnumSizeCap = 256;
|
||||
private boolean generateEnumMemberName = false;
|
||||
private boolean choiceContentPropertyWithModelGroupBinding = false;
|
||||
private boolean xSmartWildcardDefaultBinding = false;
|
||||
private boolean xSimpleMode;
|
||||
private boolean generateValueClass = true;
|
||||
private boolean generateElementClass = false;
|
||||
private boolean generateMixedExtensions = false;
|
||||
|
||||
public BIGlobalBinding makeResult() {
|
||||
if( enumBaseTypes.size()==0 )
|
||||
enumBaseTypes.add(new QName(WellKnownNamespace.XML_SCHEMA,"NCName")); // defaults to NCName
|
||||
|
||||
return new BIGlobalBinding(
|
||||
globalConvs,nameConverter,
|
||||
choiceContentPropertyWithModelGroupBinding,
|
||||
generateValueClass,
|
||||
generateElementClass,
|
||||
$runtime.parseBoolean(enableJavaNamingConvention),
|
||||
$runtime.parseBoolean(fixedAttrToConstantProperty),
|
||||
$runtime.parseBoolean(needIsSetMethod),
|
||||
$runtime.parseBoolean(simpleTypeSubstitution),
|
||||
generateEnumMemberName,
|
||||
flattenClasses,
|
||||
enumBaseTypes,
|
||||
defaultEnumSizeCap,
|
||||
ct,
|
||||
serializable,
|
||||
xSuperClass,
|
||||
xSuperInterface,
|
||||
xSimpleMode,
|
||||
xSmartWildcardDefaultBinding,
|
||||
loc);
|
||||
}
|
||||
</cc:java-body>
|
||||
<element name="globalBindings">
|
||||
loc = $runtime.copyLocator();
|
||||
|
||||
<optional>
|
||||
<attribute name="underscoreBinding">
|
||||
<choice>
|
||||
<value>asWordSeparator</value><!-- default -->
|
||||
<group>
|
||||
<value>asCharInWord</value>
|
||||
nameConverter = NameConverter.jaxrpcCompatible;
|
||||
</group>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="enableJavaNamingConventions">
|
||||
enableJavaNamingConvention = <data type="boolean"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="fixedAttributeAsConstantProperty">
|
||||
fixedAttrToConstantProperty = <data type="boolean"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="generateIsSetMethod">
|
||||
needIsSetMethod = <data type="boolean"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="mapSimpleTypeDef">
|
||||
simpleTypeSubstitution = <data type="boolean"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="localScoping">
|
||||
<choice>
|
||||
<group>
|
||||
<value>nested</value>
|
||||
flattenClasses = false;
|
||||
</group>
|
||||
<group>
|
||||
<value>toplevel</value>
|
||||
flattenClasses = true;
|
||||
</group>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="collectionType">
|
||||
ct = <ref name="collectionType" />
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="typesafeEnumMemberName">
|
||||
<choice>
|
||||
<value>generateError</value> <!-- default -->
|
||||
<group>
|
||||
<value>generateName</value>
|
||||
generateEnumMemberName = true;
|
||||
</group>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="typesafeEnumBase">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
value = <data type="QName"/>
|
||||
QName qn = $runtime.parseQName(value);
|
||||
enumBaseTypes.add( qn );
|
||||
</oneOrMore>
|
||||
</list>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="typesafeEnumMaxMembers">
|
||||
<list>
|
||||
<oneOrMore>
|
||||
value = <data type="int"/>
|
||||
defaultEnumSizeCap = Integer.parseInt(value);
|
||||
</oneOrMore>
|
||||
</list>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
|
||||
<optional>
|
||||
<attribute name="choiceContentProperty">
|
||||
value = <data type="boolean"/>
|
||||
choiceContentPropertyWithModelGroupBinding = $runtime.parseBoolean(value);
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="generateValueClass">
|
||||
value = <data type="boolean"/>
|
||||
generateValueClass = $runtime.parseBoolean(value);
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="generateElementClass">
|
||||
value = <data type="boolean"/>
|
||||
generateElementClass = $runtime.parseBoolean(value);
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="generateMixedExtensions">
|
||||
value = <data type="boolean"/>
|
||||
generateMixedExtensions = $runtime.parseBoolean(value);
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<!-- unimplemented attributes -->
|
||||
<optional>
|
||||
<attribute name="enableValidation">
|
||||
value = <data type="boolean"/>
|
||||
if( $runtime.parseBoolean(value)==true )
|
||||
$runtime.reportUnsupportedFeature("enableValidation");
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="enableFailFastCheck">
|
||||
value = <data type="boolean"/>
|
||||
if( $runtime.parseBoolean(value)==true )
|
||||
$runtime.reportUnsupportedFeature("enableFailFastCheck");
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<!-- body -->
|
||||
<zeroOrMore>
|
||||
<choice>
|
||||
<element name="javaType">
|
||||
<attribute name="xmlType">
|
||||
xmlType = <data type="QName"/>
|
||||
</attribute>
|
||||
conv = <ref name="conversionBody" />
|
||||
|
||||
globalConvs.put( $runtime.parseQName(xmlType), conv );
|
||||
</element>
|
||||
<element name="serializable">
|
||||
<optional>
|
||||
<attribute name="uid">
|
||||
serialuid = <data type="long"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
if(serialuid!=null)
|
||||
serializable = new BISerializable(Long.parseLong(serialuid));
|
||||
else
|
||||
serializable = new BISerializable(null);
|
||||
</element>
|
||||
|
||||
<!-- global vendor extensions -->
|
||||
serializable = <ref name="serializable"/>
|
||||
xSuperClass = <ref name="superClass"/>
|
||||
xSuperInterface = <ref name="superInterface"/>
|
||||
<ref name="typeSubstitution" />
|
||||
<element name="xjc:smartWildcardDefaultBinding">
|
||||
<!--
|
||||
changes the default binding of wildcards so that unknown elements will be
|
||||
bound to DOM. This feature is not publicly available, and we may change it
|
||||
later.
|
||||
-->
|
||||
xSmartWildcardDefaultBinding = true;
|
||||
<empty />
|
||||
</element>
|
||||
|
||||
<element name="xjc:simple">
|
||||
xSimpleMode = true;
|
||||
<empty />
|
||||
</element>
|
||||
|
||||
<!--
|
||||
light-weight runtime. we no longer support them,
|
||||
but we don't issue an error when we see them.
|
||||
-->
|
||||
<element name="xjc:noMarshaller">
|
||||
<empty />
|
||||
</element>
|
||||
<element name="xjc:noUnmarshaller">
|
||||
<empty />
|
||||
</element>
|
||||
<element name="xjc:noValidator">
|
||||
<empty />
|
||||
</element>
|
||||
<element name="xjc:noValidatingUnmarshaller">
|
||||
<empty />
|
||||
</element>
|
||||
</choice>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
|
||||
<define name="schemaBindings"
|
||||
cc:return-type="BISchemaBinding" cc:return-value="makeResult()">
|
||||
|
||||
<cc:java-body>
|
||||
private Locator loc;
|
||||
public BISchemaBinding makeResult() {
|
||||
return new BISchemaBinding(packageName,javadoc,tt,et,at,mt,nt,loc);
|
||||
}
|
||||
</cc:java-body>
|
||||
|
||||
<element name="schemaBindings">
|
||||
loc = $runtime.copyLocator();
|
||||
|
||||
<optional>
|
||||
<element name="package">
|
||||
<optional>
|
||||
packageName = <attribute name="name"/>
|
||||
</optional>
|
||||
<optional>
|
||||
javadoc = <ref name="javadoc"/>
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="nameXmlTransform">
|
||||
<!-- use newer version of RELAXNGCC and wrap them by <interleave> -->
|
||||
<zeroOrMore>
|
||||
<choice>
|
||||
<element name="typeName">
|
||||
tt = <ref name="nameXmlTransformRule"/>
|
||||
</element>
|
||||
<element name="elementName">
|
||||
et = <ref name="nameXmlTransformRule"/>
|
||||
</element>
|
||||
<element name="attributeName">
|
||||
at = <ref name="nameXmlTransformRule"/>
|
||||
</element>
|
||||
<element name="modelGroupName">
|
||||
mt = <ref name="nameXmlTransformRule"/>
|
||||
</element>
|
||||
<element name="anonymousTypeName">
|
||||
nt = <ref name="nameXmlTransformRule"/>
|
||||
</element>
|
||||
</choice>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name="nameXmlTransformRule"
|
||||
cc:return-type="BISchemaBinding.NamingRule"
|
||||
cc:return-value="new BISchemaBinding.NamingRule(prefix,suffix)">
|
||||
|
||||
<cc:java-body>
|
||||
private String prefix="";
|
||||
private String suffix="";
|
||||
</cc:java-body>
|
||||
|
||||
|
||||
<optional>
|
||||
<attribute name="prefix">
|
||||
prefix = <data type="NCName"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="suffix">
|
||||
suffix = <data type="NCName"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
</define>
|
||||
|
||||
|
||||
|
||||
<define name="javadoc" cc:return-type="String" cc:return-value="javadoc">
|
||||
<element name="javadoc">
|
||||
javadoc = <text />
|
||||
javadoc = $runtime.truncateDocComment(javadoc);
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name="collectionType" cc:class="CollectionTypeState"
|
||||
cc:return-type="FieldRenderer" cc:return-value="r">
|
||||
<cc:java-body>
|
||||
private FieldRenderer r = null;
|
||||
</cc:java-body>
|
||||
type = <data type="token"/>
|
||||
|
||||
if( type.equals("indexed") )
|
||||
r = FieldRenderer.ARRAY;
|
||||
else
|
||||
try {
|
||||
r = new UntypedListFieldRenderer( $runtime.codeModel.ref(type) );
|
||||
} catch( ClassNotFoundException e ) {
|
||||
throw new NoClassDefFoundError(e.getMessage());
|
||||
}
|
||||
</define>
|
||||
|
||||
|
||||
|
||||
<define name="class" cc:class="BIClassState"
|
||||
cc:return-type="BIClass" cc:return-value="makeResult()">
|
||||
|
||||
<cc:java-body>
|
||||
private Locator loc;
|
||||
public BIClass makeResult() {
|
||||
return new BIClass(loc,name,implClass,javadoc);
|
||||
}
|
||||
</cc:java-body>
|
||||
|
||||
<element name="class">
|
||||
loc = $runtime.copyLocator();
|
||||
<optional>
|
||||
javadoc = <ref name="javadoc"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="name">
|
||||
name = <data type="identifier" datatypeLibrary="http://java.sun.com/xml/ns/relaxng/java-datatypes"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
implClass = <attribute name="implClass"/>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name="property"
|
||||
cc:return-type="BIProperty" cc:return-value="makeResult()">
|
||||
|
||||
<cc:java-body>
|
||||
private Locator loc;
|
||||
private Boolean isConst = null;
|
||||
private Boolean isSet = null;
|
||||
private Boolean genElemProp = null;
|
||||
|
||||
public BIProperty makeResult() throws SAXException {
|
||||
JType baseTypeRef = null;
|
||||
if(baseType!=null)
|
||||
baseTypeRef = $runtime.getType(baseType);
|
||||
|
||||
return new BIProperty(loc,name,javadoc,baseTypeRef,conv,ct,isConst,isSet,genElemProp);
|
||||
}
|
||||
</cc:java-body>
|
||||
|
||||
<element name="property">
|
||||
loc = $runtime.copyLocator();
|
||||
<optional>
|
||||
name = <attribute name="name"/>
|
||||
</optional>
|
||||
<optional>
|
||||
baseType = <attribute name="baseType"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="collectionType">
|
||||
ct = <ref name="collectionType" />
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="fixedAttributeAsConstantProperty">
|
||||
isConstStr = <data type="boolean"/>
|
||||
isConst = $runtime.parseBoolean(isConstStr)?Boolean.TRUE:Boolean.FALSE;
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="generateIsSetMethod">
|
||||
isSetStr = <data type="boolean"/>
|
||||
isSet = $runtime.parseBoolean(isSetStr)?Boolean.TRUE:Boolean.FALSE;
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="generateElementProperty">
|
||||
genElemPropStr = <data type="boolean"/>
|
||||
genElemProp = $runtime.parseBoolean(genElemPropStr)?Boolean.TRUE:Boolean.FALSE;
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="generateFailFastSetterMethod">
|
||||
failFast = <data type="boolean"/>
|
||||
</attribute>
|
||||
if( $runtime.parseBoolean(failFast) ) {
|
||||
$runtime.reportUnimplementedFeature("generateFailFastSetterMethod");
|
||||
}
|
||||
</optional>
|
||||
|
||||
|
||||
<interleave>
|
||||
<optional>
|
||||
javadoc = <ref name="javadoc"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="baseType">
|
||||
conv = <ref name="conversion"/>
|
||||
</element>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name="conversion"
|
||||
cc:return-type="BIConversion" cc:return-value="r">
|
||||
<element name="javaType">
|
||||
r = <ref name="conversionBody"/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
|
||||
<define name="conversionBody"
|
||||
cc:return-type="BIConversion" cc:return-value="makeResult()">
|
||||
|
||||
<cc:java-import>
|
||||
import com.sun.tools.internal.xjc.generator.util.WhitespaceNormalizer;
|
||||
</cc:java-import>
|
||||
<cc:java-body><![CDATA[
|
||||
public BIConversion makeResult() throws SAXException {
|
||||
return new BIConversion.User( $runtime.copyLocator(), parse, print, $runtime.getType(type) );
|
||||
}
|
||||
|
||||
// initialize with default values.
|
||||
private String type = "java.lang.String"; // in case a schema has an error
|
||||
private String parse = null;
|
||||
private String print = null;
|
||||
private boolean context = false;
|
||||
]]></cc:java-body>
|
||||
|
||||
|
||||
<optional>
|
||||
parse = <attribute name="parseMethod" />
|
||||
</optional>
|
||||
<optional>
|
||||
print = <attribute name="printMethod" />
|
||||
</optional>
|
||||
<attribute name="name" cc:alias="type"/>
|
||||
<optional>
|
||||
<attribute name="hasNsContext">
|
||||
_context = <data type="boolean"/>
|
||||
context = $runtime.parseBoolean(_context);
|
||||
</attribute>
|
||||
</optional>
|
||||
</define>
|
||||
|
||||
|
||||
<!-- type safe enum customization -->
|
||||
<define name="typesafeEnum"
|
||||
cc:return-type="BIEnum" cc:return-value="makeResult()">
|
||||
|
||||
<cc:java-import>
|
||||
import java.util.HashMap;
|
||||
</cc:java-import>
|
||||
<cc:java-body>
|
||||
private HashMap members = new HashMap();
|
||||
private boolean dontBind = false;
|
||||
private Locator loc,loc2;
|
||||
|
||||
private BIEnum makeResult() {
|
||||
return new BIEnum(loc,dontBind,name,javadoc,members);
|
||||
}
|
||||
</cc:java-body>
|
||||
|
||||
<element name="typesafeEnumClass">
|
||||
loc = $runtime.copyLocator();
|
||||
<choice>
|
||||
<attribute name="map">
|
||||
<value>false</value>
|
||||
dontBind = true;
|
||||
</attribute>
|
||||
<group>
|
||||
<optional>
|
||||
name = <attribute name="name"/>
|
||||
</optional>
|
||||
<optional>
|
||||
javadoc = <ref name="javadoc" />
|
||||
</optional>
|
||||
<zeroOrMore>
|
||||
jname = null;
|
||||
javadoc = null;
|
||||
<element name="typesafeEnumMember">
|
||||
loc2 = $runtime.copyLocator();
|
||||
<optional>
|
||||
jname = <attribute name="name"/>
|
||||
</optional>
|
||||
value = <attribute name="value"/>
|
||||
<optional>
|
||||
javadoc = <ref name="javadoc" />
|
||||
</optional>
|
||||
members.put( value, new BIEnumMember(loc2,jname,javadoc) );
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
</group>
|
||||
</choice>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
|
||||
<!-- stand-alone type safe enum member customization -->
|
||||
<!--
|
||||
Note that only the name attribute is allowed here, and the same element
|
||||
under the typesafeEnumClass is handled differently.
|
||||
-->
|
||||
<define name="enumMember"
|
||||
cc:return-type="BIEnumMember" cc:return-value="makeResult()">
|
||||
<cc:java-body>
|
||||
private Locator loc;
|
||||
private BIEnumMember makeResult() {
|
||||
return new BIEnumMember(loc,name,javadoc);
|
||||
}
|
||||
</cc:java-body>
|
||||
|
||||
<element name="typesafeEnumMember">
|
||||
loc = $runtime.copyLocator();
|
||||
name = <attribute name="name"/>
|
||||
<optional>
|
||||
javadoc = <ref name="javadoc" />
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
|
||||
<!-- XJC-exntension: root class support -->
|
||||
<define name="superClass" cc:return-type="JDefinedClass" cc:return-value="makeResult()">
|
||||
<cc:java-body>
|
||||
private JDefinedClass makeResult() {
|
||||
try {
|
||||
JDefinedClass c = $runtime.codeModel._class(name);
|
||||
c.hide();
|
||||
return c;
|
||||
} catch( JClassAlreadyExistsException e ) {
|
||||
return e.getExistingClass();
|
||||
}
|
||||
}
|
||||
</cc:java-body>
|
||||
|
||||
<element name="xjc:superClass">
|
||||
name = <attribute name="name" />
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<!-- XJC-exntension: root interface support -->
|
||||
<define name="superInterface" cc:return-type="JDefinedClass" cc:return-value="makeResult()">
|
||||
<cc:java-body>
|
||||
private JDefinedClass makeResult() {
|
||||
try {
|
||||
JDefinedClass c = $runtime.codeModel._class(name,ClassType.INTERFACE);
|
||||
c.hide();
|
||||
return c;
|
||||
} catch( JClassAlreadyExistsException e ) {
|
||||
return e.getExistingClass();
|
||||
}
|
||||
}
|
||||
</cc:java-body>
|
||||
|
||||
<element name="xjc:superInterface">
|
||||
name = <attribute name="name" />
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<!-- XJC-exntension: serialization support -->
|
||||
<define name="serializable" cc:return-type="BISerializable" cc:return-value="makeResult()">
|
||||
<cc:java-body>
|
||||
private long uid = 1;
|
||||
private BISerializable makeResult() {
|
||||
return new BISerializable(uid);
|
||||
}
|
||||
</cc:java-body>
|
||||
|
||||
<element name="xjc:serializable">
|
||||
// loc = $runtime.copyLocator();
|
||||
<optional>
|
||||
<attribute name="uid">
|
||||
v = <data type="long"/>
|
||||
uid = Long.parseLong(v);
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
|
||||
<!-- XJC extension: type substitution -->
|
||||
<define name="typeSubstitution" cc:return-type="boolean" cc:return-value="true">
|
||||
<element name="xjc:typeSubstitution">
|
||||
<attribute name="type"><value>complex</value></attribute>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
|
||||
<!-- XJC extension: ID symbol space support -->
|
||||
<!--define name="idSymbolSpace" cc:return-type="BIXIdSymbolSpace" cc:return-value="makeResult()">
|
||||
<cc:java-body>
|
||||
private Locator loc;
|
||||
private BIXIdSymbolSpace makeResult() {
|
||||
return new BIXIdSymbolSpace(loc,name);
|
||||
}
|
||||
</cc:java-body>
|
||||
|
||||
<element name="xjc:idSymbolSpace">
|
||||
loc = $runtime.copyLocator();
|
||||
name = <attribute name="name"/>
|
||||
</element>
|
||||
</define-->
|
||||
|
||||
|
||||
<!-- XJC extension: DOM support -->
|
||||
<!--define name="dom" cc:return-type="BIXDom" cc:return-value="makeResult()">
|
||||
<cc:java-import>
|
||||
import com.sun.tools.internal.xjc.grammar.ext.*;
|
||||
</cc:java-import>
|
||||
<cc:java-body>
|
||||
private String factoryName = "w3c";
|
||||
private Locator loc;
|
||||
private BIXDom makeResult() {
|
||||
try {
|
||||
return new BIXDom(DOMItemFactory.getInstance(factoryName),loc);
|
||||
} catch( DOMItemFactory.UndefinedNameException e ) {
|
||||
throw new InternalError(); // impossible since we use validation to reject incorrect values
|
||||
}
|
||||
}
|
||||
</cc:java-body>
|
||||
|
||||
<element name="xjc:dom">
|
||||
loc = $runtime.copyLocator();
|
||||
<optional>
|
||||
<attribute name="type">
|
||||
<choice>
|
||||
factoryName = <value>dom4j</value>
|
||||
factoryName = <value>w3c</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</define-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p:ignore>
|
||||
<!-- these patterns are ignored when using RelaxNGCC -->
|
||||
<define name="anyContents">
|
||||
<zeroOrMore>
|
||||
<choice>
|
||||
<text/>
|
||||
<ref name="anyAttributes"/>
|
||||
<element>
|
||||
<anyName/>
|
||||
<ref name="anyContents"/>
|
||||
</element>
|
||||
</choice>
|
||||
</zeroOrMore>
|
||||
</define>
|
||||
|
||||
<define name="anyAttributes">
|
||||
<zeroOrMore>
|
||||
<attribute>
|
||||
<anyName/>
|
||||
<text/>
|
||||
</attribute>
|
||||
</zeroOrMore>
|
||||
</define>
|
||||
</p:ignore>
|
||||
</grammar>
|
File diff suppressed because it is too large
Load Diff
@ -582,7 +582,8 @@ public class AttachmentPartImpl extends AttachmentPart {
|
||||
mailMap.addMailcap("text/xml;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler");
|
||||
mailMap.addMailcap("application/xml;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler");
|
||||
mailMap.addMailcap("application/fastinfoset;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.FastInfosetDataContentHandler");
|
||||
mailMap.addMailcap("multipart/*;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.MultipartDataContentHandler");
|
||||
// this handler seems to be not used according VCS history ...
|
||||
// mailMap.addMailcap("multipart/*;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.MultipartDataContentHandler");
|
||||
mailMap.addMailcap("image/*;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.ImageDataContentHandler");
|
||||
mailMap.addMailcap("text/plain;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.StringDataContentHandler");
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -40,7 +40,7 @@ import javax.xml.ws.WebServiceContext;
|
||||
*/
|
||||
public final class DefaultResourceInjector extends ResourceInjector {
|
||||
public void inject(@NotNull WSWebServiceContext context, @NotNull Object instance) {
|
||||
InjectionPlan.buildInjectionPlan(
|
||||
InjectionPlan.<Object, WebServiceContext>buildInjectionPlan(
|
||||
instance.getClass(),WebServiceContext.class,false).inject(instance,context);
|
||||
}
|
||||
|
||||
|
@ -256,3 +256,5 @@ ab06ba2894313a47e4969ca37792ff119c49e711 jdk9-b10
|
||||
47feccd164b7187a0147693a922ee47c6629643c jdk9-b11
|
||||
83d9bc20973de232cae45b139fdff8a4549c130f jdk9-b12
|
||||
c7c8002d02721e02131d104549ebeb8b379fb8d2 jdk9-b13
|
||||
5c7a17a81afd0906b53ee31d95a3211c96ff6b25 jdk9-b14
|
||||
4537360f09fe23ab339ee588747b657feb12d0c8 jdk9-b15
|
||||
|
@ -38,7 +38,7 @@ EXCLUDES :=
|
||||
|
||||
##########################################################################################
|
||||
|
||||
EXCLUDES += com/sun/pept \
|
||||
EXCLUDES += \
|
||||
com/sun/tools/example/trace \
|
||||
com/sun/tools/example/debug/bdi \
|
||||
com/sun/tools/example/debug/event \
|
||||
|
@ -30,7 +30,6 @@ COPY_PATTERNS := .icu _dict .dat _options .js aliasmap .spp .wav .css \
|
||||
|
||||
# These directories should not be copied at all
|
||||
EXCLUDES += \
|
||||
com/sun/org/apache/xml/internal/security/resource/schema \
|
||||
java/awt/doc-files \
|
||||
java/lang/doc-files \
|
||||
javax/swing/doc-files \
|
||||
@ -111,20 +110,8 @@ else
|
||||
ALL_META-INF_DIRS := $(ALL_META-INF_DIRS_share)
|
||||
endif
|
||||
|
||||
ifndef OPENJDK
|
||||
ALL_META-INF_DIRS += $(JDK_TOPDIR)/src/closed/share/classes/sun/java2d/cmm/kcms/META-INF
|
||||
endif
|
||||
|
||||
SRC_SERVICES_FILES := $(wildcard $(addsuffix /services/*, $(ALL_META-INF_DIRS)))
|
||||
|
||||
ifdef OPENJDK
|
||||
SRC_SERVICES_FILES := $(filter-out %sun/dc/META-INF/services/sun.java2d.pipe.RenderingEngine, $(SRC_SERVICES_FILES))
|
||||
SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/kcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES))
|
||||
else
|
||||
SRC_SERVICES_FILES := $(filter-out %sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine, $(SRC_SERVICES_FILES))
|
||||
SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES))
|
||||
endif
|
||||
|
||||
# The number of services files are relatively few. If the increase in numbers, then
|
||||
# we have to use ListPathsSafelyNow here.
|
||||
# Change $(JDK_TOPDIR)/src/.../META-INF/services/yyyy into $(JDK_OUTPUTDIR)/classes/META-INF/services/yyyy
|
||||
|
@ -318,7 +318,7 @@ ifeq ($(OPENJDK_TARGET_OS), aix)
|
||||
endif
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
LIBAWT_FILES += awt_LoadLibrary.c img_colors.c
|
||||
LIBAWT_FILES += awt_LoadLibrary.c
|
||||
LIBAWT_CFLAGS += -F/System/Library/Frameworks/JavaVM.framework/Frameworks
|
||||
endif
|
||||
|
||||
@ -606,7 +606,6 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
|
||||
debug_mem.c \
|
||||
debug_trace.c \
|
||||
debug_util.c \
|
||||
awt_Plugin.c \
|
||||
gnome_interface.c \
|
||||
gtk2_interface.c \
|
||||
swing_GTKEngine.c \
|
||||
@ -657,17 +656,34 @@ endif
|
||||
|
||||
##########################################################################################
|
||||
|
||||
LIBLCMS_DIR := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms
|
||||
|
||||
ifeq ($(USE_EXTERNAL_LCMS), true)
|
||||
# If we're using an external library, we'll just need the wrapper part.
|
||||
# By including it explicitely, all other files will be excluded.
|
||||
BUILD_LIBLCMS_INCLUDE_FILES := LCMS.c
|
||||
BUILD_LIBLCMS_HEADERS :=
|
||||
else
|
||||
BUILD_LIBLCMS_INCLUDE_FILES :=
|
||||
# If we're using the bundled library, we'll need to include it in the
|
||||
# include path explicitly. Otherwise the system headers will be used.
|
||||
BUILD_LIBLCMS_HEADERS := -I$(LIBLCMS_DIR)
|
||||
endif
|
||||
|
||||
# TODO: Update awt lib path when awt is converted
|
||||
$(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
|
||||
LIBRARY := lcms, \
|
||||
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
|
||||
SRC := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms, \
|
||||
SRC := $(LIBLCMS_DIR), \
|
||||
INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \
|
||||
LANG := C, \
|
||||
OPTIMIZATION := HIGHEST, \
|
||||
CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \
|
||||
$(SHARED_LIBRARY_FLAGS) \
|
||||
-I$(JDK_TOPDIR)/src/share/native/sun/java2d \
|
||||
-I$(JDK_TOPDIR)/src/share/native/sun/awt/debug, \
|
||||
-I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
|
||||
$(BUILD_LIBLCMS_HEADERS) \
|
||||
$(LCMS_CFLAGS), \
|
||||
CFLAGS_solaris := -xc99=no_lib, \
|
||||
CFLAGS_windows := -DCMS_IS_WINDOWS_, \
|
||||
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
|
||||
@ -675,10 +691,10 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
LDFLAGS_solaris := /usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2, \
|
||||
LDFLAGS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
|
||||
LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc, \
|
||||
LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm, \
|
||||
LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm, \
|
||||
LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm,\
|
||||
LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc $(LCMS_LIBS), \
|
||||
LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm $(LCMS_LIBS), \
|
||||
LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm $(LCMS_LIBS), \
|
||||
LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm $(LCMS_LIBS),\
|
||||
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
|
||||
RC_FLAGS := $(RC_FLAGS) \
|
||||
-D "JDK_FNAME=lcms.dll" \
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -249,11 +249,6 @@ SUNWprivate_1.1 {
|
||||
Java_sun_awt_motif_XsessionWMcommand;
|
||||
Java_sun_awt_motif_XsessionWMcommand_New;
|
||||
|
||||
# Java Plugin
|
||||
getAwtLockFunctions;
|
||||
getAwtData;
|
||||
getAwtDisplay;
|
||||
|
||||
# libfontmanager entry points
|
||||
AWTIsHeadless;
|
||||
AWTCountFonts;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -173,13 +173,6 @@ SUNWprivate_1.1 {
|
||||
Java_sun_awt_motif_XsessionWMcommand;
|
||||
Java_sun_awt_motif_XsessionWMcommand_New;
|
||||
|
||||
# Java Plugin
|
||||
# This is in awt_LoadLibrary.c and falls through to libmawt.
|
||||
# Evidently plugin needs this for backward compatability.
|
||||
getAwtLockFunctions;
|
||||
getAwtData;
|
||||
getAwtDisplay;
|
||||
|
||||
# libfontmanager entry points
|
||||
AWTIsHeadless;
|
||||
GrPrim_Sg2dGetCompInfo;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -152,13 +152,6 @@ SUNWprivate_1.1 {
|
||||
# Evidently CDE needs this for backward compatability.
|
||||
Java_sun_awt_motif_XsessionWMcommand;
|
||||
|
||||
# Java Plugin
|
||||
# This is in awt_LoadLibrary.c and falls through to libmawt.
|
||||
# Evidently plugin needs this for backward compatability.
|
||||
getAwtLockFunctions;
|
||||
getAwtData;
|
||||
getAwtDisplay;
|
||||
|
||||
# libfontmanager entry points
|
||||
AWTIsHeadless;
|
||||
GrPrim_Sg2dGetCompInfo;
|
||||
@ -283,11 +276,6 @@ SUNWprivate_1.1 {
|
||||
# CDE private entry point
|
||||
Java_sun_awt_motif_XsessionWMcommand;
|
||||
|
||||
# Java Plugin
|
||||
getAwtLockFunctions;
|
||||
getAwtData;
|
||||
getAwtDisplay;
|
||||
|
||||
# libfontmanager entry points
|
||||
AWTIsHeadless;
|
||||
AWTCountFonts;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -449,12 +449,6 @@ SUNWprivate_1.1 {
|
||||
awt_Lock;
|
||||
awt_GetComponent;
|
||||
|
||||
# Java Plugin
|
||||
# This is in awt_LoadLibrary.c and falls through to libmawt.
|
||||
# Evidently plugin needs this for backward compatability.
|
||||
getAwtLockFunctions;
|
||||
getAwtData;
|
||||
getAwtDisplay;
|
||||
#XAWT entry point for CDE
|
||||
Java_sun_awt_motif_XsessionWMcommand;
|
||||
Java_sun_awt_motif_XsessionWMcommand_New;
|
||||
|
@ -270,7 +270,10 @@ SUNWprivate_1.1 {
|
||||
Java_sun_misc_Version_getJvmVersionInfo;
|
||||
Java_sun_misc_Version_getJvmSpecialVersion;
|
||||
Java_sun_misc_VM_latestUserDefinedLoader;
|
||||
Java_sun_misc_VM_isSetUID;
|
||||
Java_sun_misc_VM_getuid;
|
||||
Java_sun_misc_VM_geteuid;
|
||||
Java_sun_misc_VM_getgid;
|
||||
Java_sun_misc_VM_getegid;
|
||||
Java_sun_misc_VM_initialize;
|
||||
Java_sun_misc_VMSupport_initAgentProperties;
|
||||
Java_sun_misc_VMSupport_getVMTemporaryDirectory;
|
||||
|
@ -31,10 +31,6 @@ SUNWprivate_1.1 {
|
||||
|
||||
Java_sun_awt_image_JPEGImageDecoder_initIDs;
|
||||
Java_sun_awt_image_JPEGImageDecoder_readImage;
|
||||
Java_sun_awt_image_codec_JPEGImageDecoderImpl_initDecoder;
|
||||
Java_sun_awt_image_codec_JPEGImageDecoderImpl_readJPEGStream;
|
||||
Java_sun_awt_image_codec_JPEGImageEncoderImpl_initEncoder;
|
||||
Java_sun_awt_image_codec_JPEGImageEncoderImpl_writeJPEGStream;
|
||||
|
||||
Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initReaderIDs;
|
||||
Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initJPEGImageReader;
|
||||
|
@ -239,6 +239,4 @@ FULL_JRE_INCLUDE_METAINF_SERVICES := \
|
||||
META-INF/services/javax.sound.sampled.spi.AudioFileReader \
|
||||
META-INF/services/javax.sound.sampled.spi.AudioFileWriter \
|
||||
META-INF/services/javax.sound.sampled.spi.FormatConversionProvider \
|
||||
META-INF/services/javax.sound.sampled.spi.MixerProvider \
|
||||
META-INF/services/sun.java2d.cmm.PCMM \
|
||||
META-INF/services/sun.java2d.pipe.RenderingEngine
|
||||
META-INF/services/javax.sound.sampled.spi.MixerProvider
|
||||
|
@ -121,6 +121,10 @@ class AquaComboBoxPopup extends BasicComboPopup {
|
||||
public void show() {
|
||||
final int startItemCount = comboBox.getItemCount();
|
||||
|
||||
if (startItemCount == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Rectangle popupBounds = adjustPopupAndGetBounds();
|
||||
if (popupBounds == null) return; // null means don't show
|
||||
|
||||
|
@ -46,10 +46,8 @@ import com.apple.laf.AquaIcon.JRSUIControlSpec;
|
||||
import com.apple.laf.AquaIcon.SystemIcon;
|
||||
import com.apple.laf.AquaUtils.RecyclableObject;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import sun.awt.image.MultiResolutionBufferedImage;
|
||||
import sun.awt.image.MultiResolutionImage;
|
||||
import sun.awt.image.MultiResolutionCachedImage;
|
||||
|
||||
public class AquaImageFactory {
|
||||
public static IconUIResource getConfirmImageIcon() {
|
||||
@ -57,7 +55,7 @@ public class AquaImageFactory {
|
||||
|
||||
return new IconUIResource(new AquaIcon.CachingScalingIcon(kAlertIconSize, kAlertIconSize) {
|
||||
Image createImage() {
|
||||
return getThisApplicationsIcon(kAlertIconSize, kAlertIconSize);
|
||||
return getGenericJavaIcon();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -83,24 +81,6 @@ public class AquaImageFactory {
|
||||
return getAppIconCompositedOn(lockIcon);
|
||||
}
|
||||
|
||||
static Image getThisApplicationsIcon(final int width, final int height) {
|
||||
final String path = getPathToThisApplication();
|
||||
|
||||
if (path == null) {
|
||||
return getGenericJavaIcon();
|
||||
}
|
||||
|
||||
if (path.endsWith("/Home/bin")) {
|
||||
return getGenericJavaIcon();
|
||||
}
|
||||
|
||||
if (path.startsWith("/usr/bin")) {
|
||||
return getGenericJavaIcon();
|
||||
}
|
||||
|
||||
return AquaUtils.getCImageCreator().createImageOfFile(path, height, width);
|
||||
}
|
||||
|
||||
static Image getGenericJavaIcon() {
|
||||
return java.security.AccessController.doPrivileged(new PrivilegedAction<Image>() {
|
||||
public Image run() {
|
||||
@ -125,9 +105,9 @@ public class AquaImageFactory {
|
||||
private static final int kAlertIconSize = 64;
|
||||
static IconUIResource getAppIconCompositedOn(final Image background) {
|
||||
|
||||
if (background instanceof MultiResolutionBufferedImage) {
|
||||
if (background instanceof MultiResolutionCachedImage) {
|
||||
int width = background.getWidth(null);
|
||||
Image mrIconImage = ((MultiResolutionBufferedImage) background).map(
|
||||
Image mrIconImage = ((MultiResolutionCachedImage) background).map(
|
||||
rv -> getAppIconImageCompositedOn(rv, rv.getWidth(null) / width));
|
||||
return new IconUIResource(new ImageIcon(mrIconImage));
|
||||
}
|
||||
@ -144,7 +124,7 @@ public class AquaImageFactory {
|
||||
final Icon smallAppIconScaled = new AquaIcon.CachingScalingIcon(
|
||||
kAlertSubIconSize, kAlertSubIconSize) {
|
||||
Image createImage() {
|
||||
return getThisApplicationsIcon(kAlertSubIconSize, kAlertSubIconSize);
|
||||
return getGenericJavaIcon();
|
||||
}
|
||||
};
|
||||
|
||||
@ -306,21 +286,7 @@ public class AquaImageFactory {
|
||||
private static Image getNSIcon(String imageName) {
|
||||
Image icon = Toolkit.getDefaultToolkit()
|
||||
.getImage("NSImage://" + imageName);
|
||||
|
||||
if (icon instanceof MultiResolutionImage) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
int w = icon.getWidth(null);
|
||||
int h = icon.getHeight(null);
|
||||
|
||||
Dimension[] sizes = new Dimension[]{
|
||||
new Dimension(w, h), new Dimension(2 * w, 2 * h)
|
||||
};
|
||||
|
||||
return new MultiResolutionBufferedImage(icon, sizes, (width, height) ->
|
||||
AquaUtils.getCImageCreator().createImageFromName(
|
||||
imageName, width, height));
|
||||
return icon;
|
||||
}
|
||||
|
||||
public static class NineSliceMetrics {
|
||||
@ -530,4 +496,4 @@ public class AquaImageFactory {
|
||||
public static Color getSelectionInactiveForegroundColorUIResource() {
|
||||
return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.INACTIVE_SELECTION_FOREGROUND_COLOR));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -174,11 +174,7 @@ abstract class AquaPainter <T extends JRSUIState> {
|
||||
bounds, controlState);
|
||||
Image img = cache.getImage(key);
|
||||
if (img == null) {
|
||||
|
||||
Image baseImage = createImage(imgX, imgY, imgW, imgH, bounds,
|
||||
control, controlState);
|
||||
|
||||
img = new MultiResolutionBufferedImage(baseImage,
|
||||
img = new MultiResolutionCachedImage(imgW, imgH,
|
||||
(rvWidth, rvHeight) -> createImage(imgX, imgY,
|
||||
rvWidth, rvHeight, bounds, control, controlState));
|
||||
|
||||
|
@ -48,7 +48,7 @@ import sun.security.action.GetPropertyAction;
|
||||
import sun.swing.SwingUtilities2;
|
||||
|
||||
import com.apple.laf.AquaImageFactory.SlicedImageControl;
|
||||
import sun.awt.image.MultiResolutionBufferedImage;
|
||||
import sun.awt.image.MultiResolutionCachedImage;
|
||||
|
||||
final class AquaUtils {
|
||||
|
||||
@ -124,8 +124,8 @@ final class AquaUtils {
|
||||
|
||||
static Image generateLightenedImage(final Image image, final int percent) {
|
||||
final GrayFilter filter = new GrayFilter(true, percent);
|
||||
return (image instanceof MultiResolutionBufferedImage)
|
||||
? ((MultiResolutionBufferedImage) image).map(
|
||||
return (image instanceof MultiResolutionCachedImage)
|
||||
? ((MultiResolutionCachedImage) image).map(
|
||||
rv -> generateLightenedImage(rv, filter))
|
||||
: generateLightenedImage(image, filter);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ import javax.swing.plaf.FontUIResource;
|
||||
|
||||
import sun.awt.FontConfiguration;
|
||||
import sun.awt.HeadlessToolkit;
|
||||
import sun.misc.ThreadGroupUtils;
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
import sun.lwawt.macosx.*;
|
||||
|
||||
public class CFontManager extends SunFontManager {
|
||||
|
@ -171,7 +171,9 @@ final class LWChoicePeer extends LWComponentPeer<Choice, JComboBox<String>>
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JPopupMenu popupMenu = getPopupMenu();
|
||||
// Need to override the invoker for proper grab handling
|
||||
if (popupMenu != null && popupMenu.getInvoker() != getTarget()) {
|
||||
if (popupMenu != null
|
||||
&& popupMenu.isShowing()
|
||||
&& popupMenu.getInvoker() != getTarget()) {
|
||||
// The popup is now visible with correct location
|
||||
// Save it and restore after toggling visibility and changing invoker
|
||||
Point loc = popupMenu.getLocationOnScreen();
|
||||
|
@ -63,8 +63,6 @@ import javax.swing.JComponent;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.RepaintManager;
|
||||
|
||||
import sun.lwawt.macosx.CDropTarget;
|
||||
|
||||
import com.sun.java.swing.SwingUtilities3;
|
||||
|
||||
public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||
@ -137,7 +135,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||
private final Object dropTargetLock = new Object();
|
||||
|
||||
private int fNumDropTargets = 0;
|
||||
private CDropTarget fDropTarget = null;
|
||||
private PlatformDropTarget fDropTarget = null;
|
||||
|
||||
private final PlatformComponent platformComponent;
|
||||
|
||||
@ -1063,11 +1061,11 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||
// if it's the first (or last) one for the component. Otherwise this call is a no-op.
|
||||
if (++fNumDropTargets == 1) {
|
||||
// Having a non-null drop target would be an error but let's check just in case:
|
||||
if (fDropTarget != null)
|
||||
System.err.println("CComponent.addDropTarget(): current drop target is non-null.");
|
||||
|
||||
if (fDropTarget != null) {
|
||||
throw new IllegalStateException("Current drop target is not null");
|
||||
}
|
||||
// Create a new drop target:
|
||||
fDropTarget = CDropTarget.createDropTarget(dt, target, this);
|
||||
fDropTarget = LWToolkit.getLWToolkit().createDropTarget(dt, target, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ package sun.lwawt;
|
||||
import java.awt.*;
|
||||
import java.awt.List;
|
||||
import java.awt.datatransfer.*;
|
||||
import java.awt.dnd.DropTarget;
|
||||
import java.awt.image.*;
|
||||
import java.awt.peer.*;
|
||||
import java.security.*;
|
||||
@ -35,7 +36,7 @@ import java.util.*;
|
||||
|
||||
import sun.awt.*;
|
||||
import sun.print.*;
|
||||
import sun.misc.ThreadGroupUtils;
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
|
||||
import static sun.lwawt.LWWindowPeer.PeerType;
|
||||
|
||||
@ -440,6 +441,10 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
||||
|
||||
protected abstract FileDialogPeer createFileDialogPeer(FileDialog target);
|
||||
|
||||
protected abstract PlatformDropTarget createDropTarget(DropTarget dropTarget,
|
||||
Component component,
|
||||
LWComponentPeer<?, ?> peer);
|
||||
|
||||
// ---- UTILITY METHODS ---- //
|
||||
|
||||
/*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,32 +23,12 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/** Java interface "Acceptor.java" generated from Poseidon for UML.
|
||||
* Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
|
||||
* Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
|
||||
*/
|
||||
package com.sun.pept.ept;
|
||||
package sun.lwawt;
|
||||
|
||||
import java.util.*;
|
||||
public interface PlatformDropTarget {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* @author Dr. Harold Carr
|
||||
* </p>
|
||||
*/
|
||||
public interface Acceptor extends EPTFactory {
|
||||
|
||||
///////////////////////////////////////
|
||||
// operations
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Does ...
|
||||
* </p><p>
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public void accept();
|
||||
|
||||
} // end Acceptor
|
||||
/**
|
||||
* Release native dragging destination, if any
|
||||
*/
|
||||
void dispose();
|
||||
}
|
@ -31,6 +31,7 @@ import sun.awt.image.ImageRepresentation;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.text.Normalizer;
|
||||
import java.text.Normalizer.Form;
|
||||
import java.util.*;
|
||||
@ -126,7 +127,7 @@ public class CDataTransferer extends DataTransferer {
|
||||
|
||||
if (format == CF_URL && URL.class.equals(flavor.getRepresentationClass()))
|
||||
{
|
||||
String charset = getDefaultTextCharset();
|
||||
String charset = Charset.defaultCharset().name();
|
||||
if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
|
||||
try {
|
||||
charset = new String((byte[])transferable.getTransferData(javaTextEncodingFlavor), "UTF-8");
|
||||
|
@ -25,54 +25,37 @@
|
||||
|
||||
package sun.lwawt.macosx;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
import sun.lwawt.LWComponentPeer;
|
||||
import sun.lwawt.PlatformDropTarget;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.dnd.DropTarget;
|
||||
|
||||
import sun.lwawt.LWComponentPeer;
|
||||
import sun.lwawt.PlatformWindow;
|
||||
|
||||
final class CDropTarget implements PlatformDropTarget {
|
||||
private long fNativeDropTarget;
|
||||
|
||||
public final class CDropTarget {
|
||||
|
||||
Component fComponent;
|
||||
ComponentPeer fPeer;
|
||||
DropTarget fDropTarget;
|
||||
private long fNativeDropTarget;
|
||||
|
||||
public static CDropTarget createDropTarget(DropTarget dropTarget, Component component, ComponentPeer peer) {
|
||||
return new CDropTarget(dropTarget, component, peer);
|
||||
}
|
||||
|
||||
private CDropTarget(DropTarget dropTarget, Component component, ComponentPeer peer) {
|
||||
super();
|
||||
|
||||
fDropTarget = dropTarget;
|
||||
fComponent = component;
|
||||
fPeer = peer;
|
||||
|
||||
long nativePeer = CPlatformWindow.getNativeViewPtr(((LWComponentPeer) peer).getPlatformWindow());
|
||||
CDropTarget(DropTarget dropTarget, Component component, LWComponentPeer<?, ?> peer) {
|
||||
long nativePeer = CPlatformWindow.getNativeViewPtr(peer.getPlatformWindow());
|
||||
if (nativePeer == 0L) return; // Unsupported for a window without a native view (plugin)
|
||||
|
||||
// Create native dragging destination:
|
||||
fNativeDropTarget = this.createNativeDropTarget(dropTarget, component, peer, nativePeer);
|
||||
fNativeDropTarget = createNativeDropTarget(dropTarget, component, nativePeer);
|
||||
if (fNativeDropTarget == 0) {
|
||||
throw new IllegalStateException("CDropTarget.createNativeDropTarget() failed.");
|
||||
}
|
||||
}
|
||||
|
||||
public DropTarget getDropTarget() {
|
||||
return fDropTarget;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// Release native dragging destination, if any:
|
||||
if (fNativeDropTarget != 0) {
|
||||
this.releaseNativeDropTarget(fNativeDropTarget);
|
||||
releaseNativeDropTarget(fNativeDropTarget);
|
||||
fNativeDropTarget = 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected native long createNativeDropTarget(DropTarget dropTarget, Component component, ComponentPeer peer, long nativePeer);
|
||||
protected native long createNativeDropTarget(DropTarget dropTarget,
|
||||
Component component,
|
||||
long nativePeer);
|
||||
protected native void releaseNativeDropTarget(long nativeDropTarget);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ import java.awt.image.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import sun.awt.image.MultiResolutionImage;
|
||||
import sun.awt.image.MultiResolutionBufferedImage;
|
||||
import sun.awt.image.MultiResolutionCachedImage;
|
||||
|
||||
import sun.awt.image.SunWritableRaster;
|
||||
|
||||
@ -62,41 +62,41 @@ public class CImage extends CFRetainedResource {
|
||||
// This is used to create a CImage with an NSImage pointer. It MUST be a CFRetained
|
||||
// NSImage, and the CImage takes ownership of the non-GC retain. If callers need the
|
||||
// NSImage themselves, they MUST call retain on the NSImage themselves.
|
||||
public BufferedImage createImageUsingNativeSize(final long image) {
|
||||
public Image createImageUsingNativeSize(final long image) {
|
||||
if (image == 0) return null;
|
||||
final Dimension2D size = nativeGetNSImageSize(image);
|
||||
return createBufferedImage(image, size.getWidth(), size.getHeight());
|
||||
return createImage(image, size.getWidth(), size.getHeight());
|
||||
}
|
||||
|
||||
// the width and height passed in as a parameter could differ than the width and the height of the NSImage (image), in that case, the image will be scaled
|
||||
BufferedImage createBufferedImage(long image, double width, double height) {
|
||||
Image createImage(long image, double width, double height) {
|
||||
if (image == 0) throw new Error("Unable to instantiate CImage with null native image reference.");
|
||||
return createImageWithSize(image, width, height);
|
||||
}
|
||||
|
||||
public BufferedImage createImageWithSize(final long image, final double width, final double height) {
|
||||
public Image createImageWithSize(final long image, final double width, final double height) {
|
||||
final CImage img = new CImage(image);
|
||||
img.resize(width, height);
|
||||
return img.toImage();
|
||||
}
|
||||
|
||||
// This is used to create a CImage that represents the icon of the given file.
|
||||
public BufferedImage createImageOfFile(final String file, final int width, final int height) {
|
||||
return createBufferedImage(nativeCreateNSImageOfFileFromLaunchServices(file), width, height);
|
||||
public Image createImageOfFile(final String file, final int width, final int height) {
|
||||
return createImage(nativeCreateNSImageOfFileFromLaunchServices(file), width, height);
|
||||
}
|
||||
|
||||
public BufferedImage createImageFromFile(final String file, final double width, final double height) {
|
||||
public Image createImageFromFile(final String file, final double width, final double height) {
|
||||
final long image = nativeCreateNSImageFromFileContents(file);
|
||||
nativeSetNSImageSize(image, width, height);
|
||||
return createBufferedImage(image, width, height);
|
||||
return createImage(image, width, height);
|
||||
}
|
||||
|
||||
public BufferedImage createSystemImageFromSelector(final String iconSelector, final int width, final int height) {
|
||||
return createBufferedImage(nativeCreateNSImageFromIconSelector(getSelectorAsInt(iconSelector)), width, height);
|
||||
public Image createSystemImageFromSelector(final String iconSelector, final int width, final int height) {
|
||||
return createImage(nativeCreateNSImageFromIconSelector(getSelectorAsInt(iconSelector)), width, height);
|
||||
}
|
||||
|
||||
public Image createImageFromName(final String name, final int width, final int height) {
|
||||
return createBufferedImage(nativeCreateNSImageFromImageName(name), width, height);
|
||||
return createImage(nativeCreateNSImageFromImageName(name), width, height);
|
||||
}
|
||||
|
||||
public Image createImageFromName(final String name) {
|
||||
@ -232,7 +232,7 @@ public class CImage extends CFRetainedResource {
|
||||
}
|
||||
|
||||
/** @return A MultiResolution image created from nsImagePtr, or null. */
|
||||
private BufferedImage toImage() {
|
||||
private Image toImage() {
|
||||
if (ptr == 0) return null;
|
||||
|
||||
final Dimension2D size = nativeGetNSImageSize(ptr);
|
||||
@ -243,11 +243,11 @@ public class CImage extends CFRetainedResource {
|
||||
= nativeGetNSImageRepresentationSizes(ptr,
|
||||
size.getWidth(), size.getHeight());
|
||||
|
||||
BufferedImage baseImage = toImage(w, h, w, h);
|
||||
|
||||
return sizes == null || sizes.length < 2 ? baseImage
|
||||
: new MultiResolutionBufferedImage(baseImage, sizes,
|
||||
(width, height) -> toImage(w, h, width, height));
|
||||
return sizes == null || sizes.length < 2 ?
|
||||
new MultiResolutionCachedImage(w, h, (width, height)
|
||||
-> toImage(w, h, width, height))
|
||||
: new MultiResolutionCachedImage(w, h, sizes, (width, height)
|
||||
-> toImage(w, h, width, height));
|
||||
}
|
||||
|
||||
private BufferedImage toImage(int srcWidth, int srcHeight, int dstWidth, int dstHeight) {
|
||||
|
@ -309,6 +309,10 @@ public final class CWarningWindow extends CPlatformWindow
|
||||
@Override
|
||||
public void dispose() {
|
||||
cancelTasks();
|
||||
SurfaceData surfaceData = contentView.getSurfaceData();
|
||||
if (surfaceData != null) {
|
||||
surfaceData.invalidate();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
@ -611,19 +611,20 @@ public final class LWCToolkit extends LWToolkit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Kicks an event over to the appropriate eventqueue and waits for it to
|
||||
* Kicks an event over to the appropriate event queue and waits for it to
|
||||
* finish To avoid deadlocking, we manually run the NSRunLoop while waiting
|
||||
* Any selector invoked using ThreadUtilities performOnMainThread will be
|
||||
* processed in doAWTRunLoop The InvocationEvent will call
|
||||
* LWCToolkit.stopAWTRunLoop() when finished, which will stop our manual
|
||||
* runloop Does not dispatch native events while in the loop
|
||||
* run loop. Does not dispatch native events while in the loop
|
||||
*/
|
||||
public static void invokeAndWait(Runnable runnable, Component component)
|
||||
throws InvocationTargetException {
|
||||
final long mediator = createAWTRunLoopMediator();
|
||||
Objects.requireNonNull(component, "Null component provided to invokeAndWait");
|
||||
|
||||
long mediator = createAWTRunLoopMediator();
|
||||
InvocationEvent invocationEvent =
|
||||
new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(),
|
||||
new InvocationEvent(component,
|
||||
runnable,
|
||||
() -> {
|
||||
if (mediator != 0) {
|
||||
@ -632,49 +633,42 @@ public final class LWCToolkit extends LWToolkit {
|
||||
},
|
||||
true);
|
||||
|
||||
if (component != null) {
|
||||
AppContext appContext = SunToolkit.targetToAppContext(component);
|
||||
SunToolkit.postEvent(appContext, invocationEvent);
|
||||
|
||||
// 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
|
||||
SunToolkit.flushPendingEvents(appContext);
|
||||
} else {
|
||||
// This should be the equivalent to EventQueue.invokeAndWait
|
||||
((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent);
|
||||
}
|
||||
|
||||
AppContext appContext = SunToolkit.targetToAppContext(component);
|
||||
SunToolkit.postEvent(appContext, invocationEvent);
|
||||
// 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
|
||||
SunToolkit.flushPendingEvents(appContext);
|
||||
doAWTRunLoop(mediator, false);
|
||||
|
||||
Throwable eventException = invocationEvent.getException();
|
||||
if (eventException != null) {
|
||||
if (eventException instanceof UndeclaredThrowableException) {
|
||||
eventException = ((UndeclaredThrowableException)eventException).getUndeclaredThrowable();
|
||||
}
|
||||
throw new InvocationTargetException(eventException);
|
||||
}
|
||||
checkException(invocationEvent);
|
||||
}
|
||||
|
||||
public static void invokeLater(Runnable event, Component component)
|
||||
throws InvocationTargetException {
|
||||
final InvocationEvent invocationEvent =
|
||||
new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event);
|
||||
Objects.requireNonNull(component, "Null component provided to invokeLater");
|
||||
|
||||
if (component != null) {
|
||||
final AppContext appContext = SunToolkit.targetToAppContext(component);
|
||||
SunToolkit.postEvent(appContext, invocationEvent);
|
||||
InvocationEvent invocationEvent = new InvocationEvent(component, event);
|
||||
|
||||
// 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
|
||||
SunToolkit.flushPendingEvents(appContext);
|
||||
} else {
|
||||
// This should be the equivalent to EventQueue.invokeAndWait
|
||||
((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent);
|
||||
}
|
||||
AppContext appContext = SunToolkit.targetToAppContext(component);
|
||||
SunToolkit.postEvent(SunToolkit.targetToAppContext(component), invocationEvent);
|
||||
// 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
|
||||
SunToolkit.flushPendingEvents(appContext);
|
||||
|
||||
final Throwable eventException = invocationEvent.getException();
|
||||
checkException(invocationEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if exception occurred while {@code InvocationEvent} was processed and rethrows it as
|
||||
* an {@code InvocationTargetException}
|
||||
*
|
||||
* @param event the event to check for an exception
|
||||
* @throws InvocationTargetException if exception occurred when event was processed
|
||||
*/
|
||||
private static void checkException(InvocationEvent event) throws InvocationTargetException {
|
||||
Throwable eventException = event.getException();
|
||||
if (eventException == null) return;
|
||||
|
||||
if (eventException instanceof UndeclaredThrowableException) {
|
||||
throw new InvocationTargetException(((UndeclaredThrowableException)eventException).getUndeclaredThrowable());
|
||||
eventException = ((UndeclaredThrowableException)eventException).getUndeclaredThrowable();
|
||||
}
|
||||
throw new InvocationTargetException(eventException);
|
||||
}
|
||||
@ -686,11 +680,6 @@ public final class LWCToolkit extends LWToolkit {
|
||||
*/
|
||||
native static void performOnMainThreadAfterDelay(Runnable r, long delay);
|
||||
|
||||
// This exists purely to get around permissions issues with getSystemEventQueueImpl
|
||||
EventQueue getSystemEventQueueForInvokeAndWait() {
|
||||
return getSystemEventQueueImpl();
|
||||
}
|
||||
|
||||
// DnD support
|
||||
|
||||
@Override
|
||||
@ -712,7 +701,14 @@ public final class LWCToolkit extends LWToolkit {
|
||||
return (T)dgr;
|
||||
}
|
||||
|
||||
// InputMethodSupport Method
|
||||
@Override
|
||||
protected PlatformDropTarget createDropTarget(DropTarget dropTarget,
|
||||
Component component,
|
||||
LWComponentPeer<?, ?> peer) {
|
||||
return new CDropTarget(dropTarget, component, peer);
|
||||
}
|
||||
|
||||
// InputMethodSupport Method
|
||||
/**
|
||||
* Returns the default keyboard locale of the underlying operating system
|
||||
*/
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#import <JavaNativeFoundation/JavaNativeFoundation.h>
|
||||
#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
|
||||
#import "jni_util.h"
|
||||
|
||||
#import "ThreadUtilities.h"
|
||||
#import "AWTView.h"
|
||||
@ -391,14 +392,12 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
(jint)absP.x, (jint)absP.y,
|
||||
[event deltaY],
|
||||
[event deltaX]);
|
||||
if (jEvent == nil) {
|
||||
// Unable to create event by some reason.
|
||||
return;
|
||||
}
|
||||
CHECK_NULL(jEvent);
|
||||
|
||||
static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
|
||||
static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
|
||||
JNFCallVoidMethod(env, m_cPlatformView, jm_deliverMouseEvent, jEvent);
|
||||
(*env)->DeleteLocalRef(env, jEvent);
|
||||
}
|
||||
|
||||
- (void) resetTrackingArea {
|
||||
@ -447,20 +446,22 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
|
||||
static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IISLjava/lang/String;)V");
|
||||
jobject jevent = JNFNewObject(env, jctor_NSEvent,
|
||||
jobject jEvent = JNFNewObject(env, jctor_NSEvent,
|
||||
[event type],
|
||||
[event modifierFlags],
|
||||
[event keyCode],
|
||||
characters);
|
||||
CHECK_NULL(jEvent);
|
||||
|
||||
static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
|
||||
static JNF_MEMBER_CACHE(jm_deliverKeyEvent, jc_PlatformView,
|
||||
"deliverKeyEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
|
||||
JNFCallVoidMethod(env, m_cPlatformView, jm_deliverKeyEvent, jevent);
|
||||
JNFCallVoidMethod(env, m_cPlatformView, jm_deliverKeyEvent, jEvent);
|
||||
|
||||
if (characters != NULL) {
|
||||
(*env)->DeleteLocalRef(env, characters);
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, jEvent);
|
||||
}
|
||||
|
||||
-(void) deliverResize: (NSRect) rect {
|
||||
|
@ -261,7 +261,8 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
|
||||
// returns id for the topmost window under mouse
|
||||
+ (NSInteger) getTopmostWindowUnderMouseID {
|
||||
|
||||
NSInteger result = -1;
|
||||
|
||||
NSRect screenRect = [[NSScreen mainScreen] frame];
|
||||
NSPoint nsMouseLocation = [NSEvent mouseLocation];
|
||||
CGPoint cgMouseLocation = CGPointMake(nsMouseLocation.x, screenRect.size.height - nsMouseLocation.y);
|
||||
@ -274,11 +275,13 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
CGRect rect;
|
||||
CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[window objectForKey:(id)kCGWindowBounds], &rect);
|
||||
if (CGRectContainsPoint(rect, cgMouseLocation)) {
|
||||
return [[window objectForKey:(id)kCGWindowNumber] integerValue];
|
||||
result = [[window objectForKey:(id)kCGWindowNumber] integerValue];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
[windows release];
|
||||
return result;
|
||||
}
|
||||
|
||||
// checks that this window is under the mouse cursor and this point is not overlapped by others windows
|
||||
|
@ -48,7 +48,7 @@
|
||||
+ (CDropTarget *) currentDropTarget;
|
||||
|
||||
// Common methods:
|
||||
- (id)init:(jobject)dropTarget component:(jobject)jcomponent peer:(jobject)jpeer control:(id)control;
|
||||
- (id)init:(jobject)dropTarget component:(jobject)jcomponent control:(id)control;
|
||||
- (void)controlModelControlValid;
|
||||
- (void)removeFromView:(JNIEnv *)env;
|
||||
|
||||
|
@ -65,7 +65,7 @@ extern JNFClassInfo jc_CDropTargetContextPeer;
|
||||
return sCurrentDropTarget;
|
||||
}
|
||||
|
||||
- (id)init:(jobject)jdropTarget component:(jobject)jcomponent peer:(jobject)jpeer control:(id)control
|
||||
- (id)init:(jobject)jdropTarget component:(jobject)jcomponent control:(id)control
|
||||
{
|
||||
self = [super init];
|
||||
DLog2(@"[CDropTarget init]: %@\n", self);
|
||||
@ -714,13 +714,13 @@ extern JNFClassInfo jc_CDropTargetContextPeer;
|
||||
* Signature: (Ljava/awt/dnd/DropTarget;Ljava/awt/Component;Ljava/awt/peer/ComponentPeer;J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CDropTarget_createNativeDropTarget
|
||||
(JNIEnv *env, jobject jthis, jobject jdroptarget, jobject jcomponent, jobject jpeer, jlong jnativepeer)
|
||||
(JNIEnv *env, jobject jthis, jobject jdroptarget, jobject jcomponent, jlong jnativepeer)
|
||||
{
|
||||
CDropTarget* dropTarget = nil;
|
||||
|
||||
JNF_COCOA_ENTER(env);
|
||||
id controlObj = (id) jlong_to_ptr(jnativepeer);
|
||||
dropTarget = [[CDropTarget alloc] init:jdroptarget component:jcomponent peer:jpeer control:controlObj];
|
||||
dropTarget = [[CDropTarget alloc] init:jdroptarget component:jcomponent control:controlObj];
|
||||
JNF_COCOA_EXIT(env);
|
||||
|
||||
return ptr_to_jlong(dropTarget);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -66,7 +66,8 @@ static CFMutableArrayRef getAllValidDisplayModes(jint displayID){
|
||||
CFArrayAppendValue(validModes, cRef);
|
||||
}
|
||||
}
|
||||
|
||||
CFRelease(allModes);
|
||||
|
||||
CGDisplayModeRef currentMode = CGDisplayCopyDisplayMode(displayID);
|
||||
|
||||
BOOL containsCurrentMode = NO;
|
||||
@ -81,6 +82,7 @@ static CFMutableArrayRef getAllValidDisplayModes(jint displayID){
|
||||
if (!containsCurrentMode) {
|
||||
CFArrayAppendValue(validModes, currentMode);
|
||||
}
|
||||
CGDisplayModeRelease(currentMode);
|
||||
|
||||
return validModes;
|
||||
}
|
||||
@ -154,14 +156,12 @@ JNIEXPORT jdouble JNICALL
|
||||
Java_sun_awt_CGraphicsDevice_nativeGetXResolution
|
||||
(JNIEnv *env, jclass class, jint displayID)
|
||||
{
|
||||
// TODO: this is the physically correct answer, but we probably want
|
||||
// to use NSScreen API instead...
|
||||
// CGDisplayScreenSize can return 0 if displayID is invalid
|
||||
CGSize size = CGDisplayScreenSize(displayID);
|
||||
CGRect rect = CGDisplayBounds(displayID);
|
||||
// 1 inch == 25.4 mm
|
||||
jfloat inches = size.width / 25.4f;
|
||||
jfloat dpi = rect.size.width / inches;
|
||||
return dpi;
|
||||
return inches > 0 ? rect.size.width / inches : 72;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -173,14 +173,12 @@ JNIEXPORT jdouble JNICALL
|
||||
Java_sun_awt_CGraphicsDevice_nativeGetYResolution
|
||||
(JNIEnv *env, jclass class, jint displayID)
|
||||
{
|
||||
// TODO: this is the physically correct answer, but we probably want
|
||||
// to use NSScreen API instead...
|
||||
// CGDisplayScreenSize can return 0 if displayID is invalid
|
||||
CGSize size = CGDisplayScreenSize(displayID);
|
||||
CGRect rect = CGDisplayBounds(displayID);
|
||||
// 1 inch == 25.4 mm
|
||||
jfloat inches = size.height / 25.4f;
|
||||
jfloat dpi = rect.size.height / inches;
|
||||
return dpi;
|
||||
return inches > 0 ? rect.size.height / inches : 72;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -235,17 +233,19 @@ Java_sun_awt_CGraphicsDevice_nativeSetDisplayMode
|
||||
{
|
||||
JNF_COCOA_ENTER(env);
|
||||
CFArrayRef allModes = getAllValidDisplayModes(displayID);
|
||||
|
||||
CGDisplayModeRef closestMatch = getBestModeForParameters(allModes, (int)w, (int)h, (int)bpp, (int)refrate);
|
||||
|
||||
__block CGError retCode = kCGErrorSuccess;
|
||||
if (closestMatch != NULL) {
|
||||
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
|
||||
CGDisplayModeRetain(closestMatch);
|
||||
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
|
||||
CGDisplayConfigRef config;
|
||||
retCode = CGBeginDisplayConfiguration(&config);
|
||||
if (retCode == kCGErrorSuccess) {
|
||||
CGConfigureDisplayWithDisplayMode(config, displayID, closestMatch, NULL);
|
||||
retCode = CGCompleteDisplayConfiguration(config, kCGConfigureForAppOnly);
|
||||
}
|
||||
CGDisplayModeRelease(closestMatch);
|
||||
}];
|
||||
} else {
|
||||
[JNFException raise:env as:kIllegalArgumentException reason:"Invalid display mode"];
|
||||
@ -253,8 +253,7 @@ Java_sun_awt_CGraphicsDevice_nativeSetDisplayMode
|
||||
|
||||
if (retCode != kCGErrorSuccess){
|
||||
[JNFException raise:env as:kIllegalArgumentException reason:"Unable to set display mode!"];
|
||||
}
|
||||
|
||||
}
|
||||
CFRelease(allModes);
|
||||
JNF_COCOA_EXIT(env);
|
||||
}
|
||||
|
@ -76,17 +76,17 @@ static void CImage_CopyNSImageIntoArray
|
||||
|
||||
static NSBitmapImageRep* CImage_CreateImageRep(JNIEnv *env, jintArray buffer, jint width, jint height)
|
||||
{
|
||||
NSBitmapImageRep* imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
|
||||
pixelsWide:width
|
||||
pixelsHigh:height
|
||||
bitsPerSample:8
|
||||
samplesPerPixel:4
|
||||
hasAlpha:YES
|
||||
isPlanar:NO
|
||||
colorSpaceName:NSDeviceRGBColorSpace
|
||||
bitmapFormat:NSAlphaFirstBitmapFormat
|
||||
bytesPerRow:width*4 // TODO: use explicit scanStride
|
||||
bitsPerPixel:32];
|
||||
NSBitmapImageRep* imageRep = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
|
||||
pixelsWide:width
|
||||
pixelsHigh:height
|
||||
bitsPerSample:8
|
||||
samplesPerPixel:4
|
||||
hasAlpha:YES
|
||||
isPlanar:NO
|
||||
colorSpaceName:NSDeviceRGBColorSpace
|
||||
bitmapFormat:NSAlphaFirstBitmapFormat
|
||||
bytesPerRow:width*4 // TODO: use explicit scanStride
|
||||
bitsPerPixel:32] autorelease];
|
||||
|
||||
jint *imgData = (jint *)[imageRep bitmapData];
|
||||
if (imgData == NULL) return 0L;
|
||||
@ -115,9 +115,8 @@ JNF_COCOA_ENTER(env);
|
||||
|
||||
NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, width, height);
|
||||
if (imageRep) {
|
||||
NSImage *nsImage = [[[NSImage alloc] initWithSize:NSMakeSize(width, height)] retain];
|
||||
NSImage *nsImage = [[NSImage alloc] initWithSize:NSMakeSize(width, height)];
|
||||
[nsImage addRepresentation:imageRep];
|
||||
[imageRep release];
|
||||
result = ptr_to_jlong(nsImage);
|
||||
}
|
||||
|
||||
@ -160,7 +159,7 @@ JNF_COCOA_ENTER(env);
|
||||
(*env)->ReleaseIntArrayElements(env, widths, ws, JNI_ABORT);
|
||||
}
|
||||
if ([reps count]) {
|
||||
NSImage *nsImage = [[[NSImage alloc] initWithSize:NSMakeSize(0, 0)] retain];
|
||||
NSImage *nsImage = [[NSImage alloc] initWithSize:NSMakeSize(0, 0)];
|
||||
[nsImage addRepresentations: reps];
|
||||
result = ptr_to_jlong(nsImage);
|
||||
}
|
||||
@ -184,7 +183,7 @@ JNF_COCOA_ENTER(env);
|
||||
|
||||
IconRef iconRef;
|
||||
if (noErr == GetIconRef(kOnSystemDisk, kSystemIconsCreator, selector, &iconRef)) {
|
||||
image = [[[NSImage alloc] initWithIconRef:iconRef] retain];
|
||||
image = [[NSImage alloc] initWithIconRef:iconRef];
|
||||
ReleaseIconRef(iconRef);
|
||||
}
|
||||
|
||||
@ -206,7 +205,7 @@ JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CImage_nativeCreateNSImageFromFile
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
NSString *path = JNFNormalizedNSStringForPath(env, file);
|
||||
image = [[[NSImage alloc] initByReferencingFile:path] retain];
|
||||
image = [[NSImage alloc] initByReferencingFile:path];
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
|
||||
@ -435,7 +434,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_lwawt_macosx_CImage_nativeGetPlatformImage
|
||||
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
NSBitmapImageRep* imageRep = [CImage_CreateImageRep(env, buffer, width, height) autorelease];
|
||||
NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, width, height);
|
||||
if (imageRep) {
|
||||
NSData *tiffImage = [imageRep TIFFRepresentation];
|
||||
jsize tiffSize = (jsize)[tiffImage length];
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <JavaNativeFoundation/JavaNativeFoundation.h>
|
||||
#import "jni_util.h"
|
||||
|
||||
#import "CTrayIcon.h"
|
||||
#import "ThreadUtilities.h"
|
||||
@ -146,14 +147,12 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize) {
|
||||
(jint)absP.x, (jint)absP.y,
|
||||
[event deltaY],
|
||||
[event deltaX]);
|
||||
if (jEvent == nil) {
|
||||
// Unable to create event by some reason.
|
||||
return;
|
||||
}
|
||||
CHECK_NULL(jEvent);
|
||||
|
||||
static JNF_CLASS_CACHE(jc_TrayIcon, "sun/lwawt/macosx/CTrayIcon");
|
||||
static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
|
||||
JNFCallVoidMethod(env, peer, jm_handleMouseEvent, jEvent);
|
||||
(*env)->DeleteLocalRef(env, jEvent);
|
||||
}
|
||||
|
||||
@end //AWTTrayIcon
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -157,61 +157,6 @@ JNF_COCOA_ENTER(env);
|
||||
JNF_COCOA_EXIT(env);
|
||||
}
|
||||
|
||||
static JNF_CLASS_CACHE(jc_Component, "java/awt/Component");
|
||||
static JNF_MEMBER_CACHE(jf_Component_appContext, jc_Component, "appContext", "Lsun/awt/AppContext;");
|
||||
static JNF_CLASS_CACHE(jc_MenuComponent, "java/awt/MenuComponent");
|
||||
static JNF_MEMBER_CACHE(jf_MenuComponent_appContext, jc_MenuComponent, "appContext", "Lsun/awt/AppContext;");
|
||||
|
||||
/*
|
||||
* Class: sun_awt_SunToolkit
|
||||
* Method: getAppContext
|
||||
* Signature: (Ljava/awt/Object;)Lsun/awt/AppContext;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_sun_awt_SunToolkit_getAppContext
|
||||
(JNIEnv *env, jclass cls, jobject obj)
|
||||
{
|
||||
jobject appContext = NULL;
|
||||
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
if (JNFIsInstanceOf(env, obj, &jc_Component)) {
|
||||
appContext = JNFGetObjectField(env, obj, jf_Component_appContext);
|
||||
} else if (JNFIsInstanceOf(env, obj, &jc_MenuComponent)) {
|
||||
appContext = JNFGetObjectField(env, obj, jf_MenuComponent_appContext);
|
||||
}
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
|
||||
return appContext;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_awt_SunToolkit
|
||||
* Method: setAppContext
|
||||
* Signature: (Ljava/lang/Object;Lsun/awt/AppContext;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_SunToolkit_setAppContext
|
||||
(JNIEnv *env, jclass cls, jobject obj, jobject appContext)
|
||||
{
|
||||
jboolean isComponent;
|
||||
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
if (JNFIsInstanceOf(env, obj, &jc_Component)) {
|
||||
JNFSetObjectField(env, obj, jf_Component_appContext, appContext);
|
||||
isComponent = JNI_TRUE;
|
||||
} else if (JNFIsInstanceOf(env, obj, &jc_MenuComponent)) {
|
||||
JNFSetObjectField(env, obj, jf_MenuComponent_appContext, appContext);
|
||||
isComponent = JNI_FALSE;
|
||||
}
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
|
||||
return isComponent;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_lwawt_macosx_LWCToolkit
|
||||
* Method: beep
|
||||
|
@ -435,7 +435,7 @@ JNF_COCOA_ENTER(env);
|
||||
forceEmbeddedMode = YES;
|
||||
}
|
||||
JNIEnv* env = [ThreadUtilities getJNIEnvUncached];
|
||||
jclass jc_ThreadGroupUtils = (*env)->FindClass(env, "sun/misc/ThreadGroupUtils");
|
||||
jclass jc_ThreadGroupUtils = (*env)->FindClass(env, "sun/awt/util/ThreadGroupUtils");
|
||||
jmethodID sjm_getRootThreadGroup = (*env)->GetStaticMethodID(env, jc_ThreadGroupUtils, "getRootThreadGroup", "()Ljava/lang/ThreadGroup;");
|
||||
jobject rootThreadGroup = (*env)->CallStaticObjectMethod(env, jc_ThreadGroupUtils, sjm_getRootThreadGroup);
|
||||
[ThreadUtilities setAppkitThreadGroup:(*env)->NewGlobalRef(env, rootThreadGroup)];
|
||||
|
@ -32,9 +32,10 @@
|
||||
#define kInternalError "java/lang/InternalError"
|
||||
|
||||
#define AWT_DEBUG_LOG(str) \
|
||||
NSLog(@"Cocoa AWT: %@ %@", str, [NSThread callStackSymbols])
|
||||
NSLog(@"\tCocoa AWT: %@ %@", str, [NSThread callStackSymbols])
|
||||
|
||||
#define AWT_DEBUG_BUG_REPORT_MESSAGE \
|
||||
NSLog(@"\tPlease file a bug report at http://java.net/jira/browse/MACOSX_PORT with this message and a reproducible test case.")
|
||||
NSLog(@"\tPlease file a bug report at http://bugreport.java.com/bugreport \
|
||||
with this message and a reproducible test case.")
|
||||
|
||||
#endif
|
||||
|
@ -739,6 +739,9 @@ SetClassPath(const char *s)
|
||||
if (s == NULL)
|
||||
return;
|
||||
s = JLI_WildcardExpandClasspath(s);
|
||||
if (sizeof(format) - 2 + JLI_StrLen(s) < JLI_StrLen(s))
|
||||
// s is became corrupted after expanding wildcards
|
||||
return;
|
||||
def = JLI_MemAlloc(sizeof(format)
|
||||
- 2 /* strlen("%s") */
|
||||
+ JLI_StrLen(s));
|
||||
@ -1358,9 +1361,11 @@ AddApplicationOptions(int cpathc, const char **cpathv)
|
||||
if (s) {
|
||||
s = (char *) JLI_WildcardExpandClasspath(s);
|
||||
/* 40 for -Denv.class.path= */
|
||||
envcp = (char *)JLI_MemAlloc(JLI_StrLen(s) + 40);
|
||||
sprintf(envcp, "-Denv.class.path=%s", s);
|
||||
AddOption(envcp, NULL);
|
||||
if (JLI_StrLen(s) + 40 > JLI_StrLen(s)) { // Safeguard from overflow
|
||||
envcp = (char *)JLI_MemAlloc(JLI_StrLen(s) + 40);
|
||||
sprintf(envcp, "-Denv.class.path=%s", s);
|
||||
AddOption(envcp, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -131,14 +131,14 @@ public final class DHParameters extends AlgorithmParametersSpi {
|
||||
protected String engineToString() {
|
||||
String LINE_SEP = System.getProperty("line.separator");
|
||||
|
||||
StringBuffer strbuf
|
||||
= new StringBuffer("SunJCE Diffie-Hellman Parameters:"
|
||||
StringBuilder sb
|
||||
= new StringBuilder("SunJCE Diffie-Hellman Parameters:"
|
||||
+ LINE_SEP + "p:" + LINE_SEP
|
||||
+ Debug.toHexString(this.p)
|
||||
+ LINE_SEP + "g:" + LINE_SEP
|
||||
+ Debug.toHexString(this.g));
|
||||
if (this.l != 0)
|
||||
strbuf.append(LINE_SEP + "l:" + LINE_SEP + " " + this.l);
|
||||
return strbuf.toString();
|
||||
sb.append(LINE_SEP + "l:" + LINE_SEP + " " + this.l);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -260,8 +260,8 @@ javax.crypto.interfaces.DHPublicKey, Serializable {
|
||||
public String toString() {
|
||||
String LINE_SEP = System.getProperty("line.separator");
|
||||
|
||||
StringBuffer strbuf
|
||||
= new StringBuffer("SunJCE Diffie-Hellman Public Key:"
|
||||
StringBuilder sb
|
||||
= new StringBuilder("SunJCE Diffie-Hellman Public Key:"
|
||||
+ LINE_SEP + "y:" + LINE_SEP
|
||||
+ Debug.toHexString(this.y)
|
||||
+ LINE_SEP + "p:" + LINE_SEP
|
||||
@ -269,8 +269,8 @@ javax.crypto.interfaces.DHPublicKey, Serializable {
|
||||
+ LINE_SEP + "g:" + LINE_SEP
|
||||
+ Debug.toHexString(this.g));
|
||||
if (this.l != 0)
|
||||
strbuf.append(LINE_SEP + "l:" + LINE_SEP + " " + this.l);
|
||||
return strbuf.toString();
|
||||
sb.append(LINE_SEP + "l:" + LINE_SEP + " " + this.l);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private void parseKeyBits() throws InvalidKeyException {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -238,7 +238,7 @@ public final class OAEPParameters extends AlgorithmParametersSpi {
|
||||
}
|
||||
|
||||
protected String engineToString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("MD: " + mdName + "\n");
|
||||
sb.append("MGF: MGF1" + mgfSpec.getDigestAlgorithm() + "\n");
|
||||
sb.append("PSource: PSpecified " +
|
||||
|
@ -664,6 +664,12 @@ public class PNGImageReader extends ImageReader {
|
||||
try {
|
||||
while (true) {
|
||||
int chunkLength = stream.readInt();
|
||||
|
||||
// verify the chunk length first
|
||||
if (chunkLength < 0 || chunkLength + 4 < 0) {
|
||||
throw new IIOException("Invalid chunk length " + chunkLength);
|
||||
}
|
||||
|
||||
int chunkType = stream.readInt();
|
||||
|
||||
if (chunkType == IDAT_TYPE) {
|
||||
@ -692,7 +698,7 @@ public class PNGImageReader extends ImageReader {
|
||||
|
||||
// verify the chunk length
|
||||
if (chunkLength < 0) {
|
||||
throw new IIOException("Invalid chunk lenght " + chunkLength);
|
||||
throw new IIOException("Invalid chunk length " + chunkLength);
|
||||
};
|
||||
|
||||
try {
|
||||
|
@ -1683,6 +1683,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
|
||||
* adjustments that windows/metal do. This is because gtk doesn't
|
||||
* provide margins/insets for checkbox/radiobuttons.
|
||||
*/
|
||||
@SuppressWarnings("fallthrough")
|
||||
private static class GnomeLayoutStyle extends DefaultLayoutStyle {
|
||||
private static GnomeLayoutStyle INSTANCE = new GnomeLayoutStyle();
|
||||
|
||||
|
@ -2409,6 +2409,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
|
||||
|
||||
// Windows LayoutStyle. From:
|
||||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch14e.asp
|
||||
@SuppressWarnings("fallthrough")
|
||||
private class WindowsLayoutStyle extends DefaultLayoutStyle {
|
||||
@Override
|
||||
public int getPreferredGap(JComponent component1,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user