This commit is contained in:
Yong Jeffrey Huang 2012-12-23 19:11:15 -08:00
commit 2185318b56
590 changed files with 8783 additions and 3108 deletions

View File

@ -189,3 +189,4 @@ cdaa6122185f9bf512dcd6600f56bfccc4824e8c jdk8-b61
a2cf4d4a484378caea2e827ed604b2bbae58bdba jdk8-b65
17820b958ae84f7c1cc6719319c8e2232f7a4f1d jdk8-b66
76cc9bd3ece407d3a15d3bea537b57927973c5e7 jdk8-b67
cb33628d4e8f11e879c371959e5948b66a53376f jdk8-b68

View File

@ -189,3 +189,4 @@ e07f499b9dccb529ecf74172cf6ac11a195ec57a jdk8-b60
b772de306dc24c17f7bd1398531ddeb58723b804 jdk8-b65
13bb8c326e7b7b0b19d78c8088033e3932e3f7ca jdk8-b66
9a6ec97ec45c1a62d5233cefa91e8390e380e13a jdk8-b67
cdb401a60cea6ad5ef3f498725ed1decf8dda1ea jdk8-b68

View File

@ -90,13 +90,25 @@ AC_DEFUN([BASIC_FIXUP_EXECUTABLE],
tmp="$complete EOL"
arguments="${tmp#* }"
new_path=`$WHICH $path 2> /dev/null`
# Cannot rely on the command "which" here since it doesn't always work.
is_absolute_path=`$ECHO "$path" | $GREP ^/`
if test -z "$is_absolute_path"; then
# Path to executable is not absolute. Find it.
IFS_save="$IFS"
IFS=:
for p in $PATH; do
if test -f "$p/$path" && test -x "$p/$path"; then
new_path="$p/$path"
break
fi
done
IFS="$IFS_save"
else
AC_MSG_NOTICE([Resolving $1 (as $path) failed, using $path directly.])
new_path="$path"
fi
if test "x$new_path" = x; then
is_absolute_path=`$ECHO "$path" | $GREP ^/`
if test "x$is_absolute_path" != x; then
AC_MSG_NOTICE([Resolving $1 (as $path) with 'which' failed, using $path directly.])
new_path="$path"
else
AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
has_space=`$ECHO "$complete" | $GREP " "`
if test "x$has_space" != x; then
@ -104,20 +116,19 @@ AC_DEFUN([BASIC_FIXUP_EXECUTABLE],
fi
AC_MSG_ERROR([Cannot locate the the path of $1])
fi
fi
fi
# Now join together the path and the arguments once again
if test "x$arguments" != xEOL; then
new_complete="$new_path ${arguments% *}"
else
new_complete="$new_path"
fi
# Now join together the path and the arguments once again
if test "x$arguments" != xEOL; then
new_complete="$new_path ${arguments% *}"
else
new_complete="$new_path"
fi
if test "x$complete" != "x$new_complete"; then
$1="$new_complete"
AC_MSG_NOTICE([Rewriting $1 to "$new_complete"])
fi
$1="$new_complete"
AC_MSG_NOTICE([Rewriting $1 to "$new_complete"])
fi
])
AC_DEFUN([BASIC_REMOVE_SYMBOLIC_LINKS],

File diff suppressed because it is too large Load Diff

194
common/bin/hgforest.sh Normal file
View File

@ -0,0 +1,194 @@
#!/bin/sh
#
# Copyright (c) 2009, 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.
#
# 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.
#
# Shell script for a fast parallel forest command
command="$1"
pull_extra_base="$2"
# Python always buffers stdout significantly, thus we will not see any output from hg clone jdk,
# until a lot of time has passed! By passing -u to python, we get incremental updates
# on stdout. Much nicer.
whichhg="`which hg`"
if [ "${whichhg}" = "" ] ; then
echo Cannot find hg!
exit 1
fi
if [ "" = "$command" ] ; then
echo No command to hg supplied!
exit 1
fi
has_hash_bang="`head -n 1 "${whichhg}" | cut -b 1-2`"
python=""
bpython=""
if [ "#!" = "$has_hash_bang" ] ; then
python="`head -n 1 ${whichhg} | cut -b 3-`"
bpython="`basename "$python"`"
fi
if [ "python" = "$bpython" -a -x "$python" ] ; then
hg="${python} -u ${whichhg}"
else
echo Cannot find python from hg launcher. Running plain hg, which probably has buffered stdout.
hg="hg"
fi
# Clean out the temporary directory that stores the pid files.
tmp=/tmp/forest.$$
rm -f -r ${tmp}
mkdir -p ${tmp}
safe_interrupt () {
if [ -d ${tmp} ]; then
if [ "`ls ${tmp}`" != "" ]; then
echo "Waiting for processes ( `cat ${tmp}/* | tr '\n' ' '`) to terminate nicely!"
sleep 1
# Pipe stderr to dev/null to silence kill, that complains when trying to kill
# a subprocess that has already exited.
kill -TERM `cat ${tmp}/* | tr '\n' ' '` 2> /dev/null
wait
echo Interrupt complete!
fi
fi
rm -f -r ${tmp}
exit 1
}
nice_exit () {
if [ -d ${tmp} ]; then
if [ "`ls ${tmp}`" != "" ]; then
wait
fi
fi
rm -f -r ${tmp}
}
trap 'safe_interrupt' INT QUIT
trap 'nice_exit' EXIT
# Only look in specific locations for possible forests (avoids long searches)
pull_default=""
repos=""
repos_extra=""
if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then
subrepos="corba jaxp jaxws langtools jdk hotspot"
if [ -f .hg/hgrc ] ; then
pull_default=`hg paths default`
if [ "${pull_default}" = "" ] ; then
echo "ERROR: Need initial clone with 'hg paths default' defined"
exit 1
fi
fi
if [ "${pull_default}" = "" ] ; then
echo "ERROR: Need initial repository to use this script"
exit 1
fi
for i in ${subrepos} ; do
if [ ! -f ${i}/.hg/hgrc ] ; then
repos="${repos} ${i}"
fi
done
if [ "${pull_extra_base}" != "" ] ; then
subrepos_extra="jdk/src/closed jdk/make/closed jdk/test/closed hotspot/make/closed hotspot/src/closed hotspot/test/closed deploy install sponsors pubs"
pull_default_tail=`echo ${pull_default} | sed -e 's@^.*://[^/]*/\(.*\)@\1@'`
pull_extra="${pull_extra_base}/${pull_default_tail}"
for i in ${subrepos_extra} ; do
if [ ! -f ${i}/.hg/hgrc ] ; then
repos_extra="${repos_extra} ${i}"
fi
done
fi
at_a_time=2
# Any repos to deal with?
if [ "${repos}" = "" -a "${repos_extra}" = "" ] ; then
exit
fi
else
hgdirs=`ls -d ./.hg ./*/.hg ./*/*/.hg ./*/*/*/.hg ./*/*/*/*/.hg 2>/dev/null`
# Derive repository names from the .hg directory locations
for i in ${hgdirs} ; do
repos="${repos} `echo ${i} | sed -e 's@/.hg$@@'`"
done
for i in ${repos} ; do
if [ -h ${i}/.hg/store/lock -o -f ${i}/.hg/store/lock ] ; then
locked="${i} ${locked}"
fi
done
at_a_time=8
# Any repos to deal with?
if [ "${repos}" = "" ] ; then
echo "No repositories to process."
exit
fi
if [ "${locked}" != "" ] ; then
echo "These repositories are locked: ${locked}"
exit
fi
fi
# Echo out what repositories we do a command on.
echo "# Repositories: ${repos} ${repos_extra}"
echo
# Run the supplied command on all repos in parallel.
n=0
for i in ${repos} ${repos_extra} ; do
n=`expr ${n} '+' 1`
repopidfile=`echo ${i} | sed -e 's@./@@' -e 's@/@_@g'`
reponame=`echo ${i} | sed -e :a -e 's/^.\{1,20\}$/ &/;ta'`
pull_base="${pull_default}"
for j in $repos_extra ; do
if [ "$i" = "$j" ] ; then
pull_base="${pull_extra}"
fi
done
(
(
if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then
pull_newrepo="`echo ${pull_base}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`"
echo ${hg} clone ${pull_newrepo} ${i}
${hg} clone ${pull_newrepo} ${i} &
else
echo "cd ${i} && ${hg} $*"
cd ${i} && ${hg} "$@" &
fi
echo $! > ${tmp}/${repopidfile}.pid
) 2>&1 | sed -e "s@^@${reponame}: @") &
if [ `expr ${n} '%' ${at_a_time}` -eq 0 ] ; then
sleep 2
echo Waiting 5 secs before spawning next background command.
sleep 3
fi
done
# Wait for all hg commands to complete
wait
# Terminate with exit 0 all the time (hard to know when to say "failed")
exit 0

View File

@ -131,6 +131,7 @@ CORE_PKGS = \
java.util.concurrent \
java.util.concurrent.atomic \
java.util.concurrent.locks \
java.util.function \
java.util.jar \
java.util.logging \
java.util.prefs \

View File

@ -189,3 +189,4 @@ d54dc53e223ed9ce7d5f4d2cd02ad9d5def3c2db jdk8-b59
5132f7900a8f0c30c3ca7f7a32f9433f4fee7745 jdk8-b65
65771ad1ca557ca26e4979d4dc633cf685435cb8 jdk8-b66
394515ad2a55d4d54df990b36065505d3e7a3cbb jdk8-b67
82000531feaa7baef76b6406099e5cd88943d635 jdk8-b68

View File

@ -26,8 +26,8 @@
#
# Get clones of all nested repositories
sh ./make/scripts/hgforest.sh clone $*
sh ./common/bin/hgforest.sh clone "$@"
# Update all existing repositories to the latest sources
sh ./make/scripts/hgforest.sh pull -u
sh ./common/bin/hgforest.sh pull -u

View File

@ -299,3 +299,5 @@ cfc5309f03b7bd6c1567618b63cf1fc74c0f2a8f hs25-b10
b61d9c88b759d1594b8af1655598e8fa00393672 hs25-b11
25bdce771bb3a7ae9825261a284d292cda700122 jdk8-b67
a35a72dd2e1255239d31f796f9f693e49b36bc9f hs25-b12
121aa71316af6cd877bf455e775fa3fdbcdd4b65 jdk8-b68
b6c9c0109a608eedbb6b868d260952990e3c91fe hs25-b13

View File

@ -69,6 +69,8 @@ public class ConstMethod extends VMObject {
signatureIndex = new CIntField(type.getCIntegerField("_signature_index"), 0);
idnum = new CIntField(type.getCIntegerField("_method_idnum"), 0);
maxStack = new CIntField(type.getCIntegerField("_max_stack"), 0);
maxLocals = new CIntField(type.getCIntegerField("_max_locals"), 0);
sizeOfParameters = new CIntField(type.getCIntegerField("_size_of_parameters"), 0);
// start of byte code
bytecodeOffset = type.getSize();
@ -96,6 +98,8 @@ public class ConstMethod extends VMObject {
private static CIntField signatureIndex;
private static CIntField idnum;
private static CIntField maxStack;
private static CIntField maxLocals;
private static CIntField sizeOfParameters;
// start of bytecode
private static long bytecodeOffset;
@ -151,6 +155,14 @@ public class ConstMethod extends VMObject {
return maxStack.getValue(this);
}
public long getMaxLocals() {
return maxLocals.getValue(this);
}
public long getSizeOfParameters() {
return sizeOfParameters.getValue(this);
}
public Symbol getName() {
return getMethod().getName();
}
@ -247,6 +259,8 @@ public class ConstMethod extends VMObject {
visitor.doCInt(signatureIndex, true);
visitor.doCInt(codeSize, true);
visitor.doCInt(maxStack, true);
visitor.doCInt(maxLocals, true);
visitor.doCInt(sizeOfParameters, true);
}
// Accessors

View File

@ -50,8 +50,6 @@ public class Method extends Metadata {
constMethod = type.getAddressField("_constMethod");
methodData = type.getAddressField("_method_data");
methodSize = new CIntField(type.getCIntegerField("_method_size"), 0);
maxLocals = new CIntField(type.getCIntegerField("_max_locals"), 0);
sizeOfParameters = new CIntField(type.getCIntegerField("_size_of_parameters"), 0);
accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0);
code = type.getAddressField("_code");
vtableIndex = new CIntField(type.getCIntegerField("_vtable_index"), 0);
@ -83,8 +81,6 @@ public class Method extends Metadata {
private static AddressField constMethod;
private static AddressField methodData;
private static CIntField methodSize;
private static CIntField maxLocals;
private static CIntField sizeOfParameters;
private static CIntField accessFlags;
private static CIntField vtableIndex;
private static CIntField invocationCounter;
@ -134,8 +130,8 @@ public class Method extends Metadata {
/** WARNING: this is in words, not useful in this system; use getObjectSize() instead */
public long getMethodSize() { return methodSize.getValue(this); }
public long getMaxStack() { return getConstMethod().getMaxStack(); }
public long getMaxLocals() { return maxLocals.getValue(this); }
public long getSizeOfParameters() { return sizeOfParameters.getValue(this); }
public long getMaxLocals() { return getConstMethod().getMaxLocals(); }
public long getSizeOfParameters() { return getConstMethod().getSizeOfParameters(); }
public long getNameIndex() { return getConstMethod().getNameIndex(); }
public long getSignatureIndex() { return getConstMethod().getSignatureIndex(); }
public long getGenericSignatureIndex() { return getConstMethod().getGenericSignatureIndex(); }
@ -282,8 +278,6 @@ public class Method extends Metadata {
public void iterateFields(MetadataVisitor visitor) {
visitor.doCInt(methodSize, true);
visitor.doCInt(maxLocals, true);
visitor.doCInt(sizeOfParameters, true);
visitor.doCInt(accessFlags, true);
}

View File

@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2012
HS_MAJOR_VER=25
HS_MINOR_VER=0
HS_BUILD_NUMBER=12
HS_BUILD_NUMBER=13
JDK_MAJOR_VER=1
JDK_MINOR_VER=8

View File

@ -582,7 +582,9 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
// the following temporary registers are used during frame creation
const Register Gtmp1 = G3_scratch ;
const Register Gtmp2 = G1_scratch;
const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset()));
const Register RconstMethod = Gtmp1;
const Address constMethod(G5_method, 0, in_bytes(Method::const_offset()));
const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset()));
bool inc_counter = UseCompiler || CountCompiledCalls;
@ -618,6 +620,7 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
}
#endif // ASSERT
__ ld_ptr(constMethod, RconstMethod);
__ lduh(size_of_parameters, Gtmp1);
__ sll(Gtmp1, LogBytesPerWord, Gtmp2); // parameter size in bytes
__ add(Gargs, Gtmp2, Gargs); // points to first local + BytesPerWord
@ -1047,8 +1050,6 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(const Register
const Register Gtmp = G3_scratch;
const Address constMethod (G5_method, 0, in_bytes(Method::const_offset()));
const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset()));
const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset()));
const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset()));
// slop factor is two extra slots on the expression stack so that
// we always have room to store a result when returning from a call without parameters
@ -1066,6 +1067,9 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(const Register
// Now compute new frame size
if (native) {
const Register RconstMethod = Gtmp;
const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset()));
__ ld_ptr(constMethod, RconstMethod);
__ lduh( size_of_parameters, Gtmp );
__ calc_mem_param_words(Gtmp, Gtmp); // space for native call parameters passed on the stack in words
} else {
@ -1236,9 +1240,13 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(const Register
}
if (init_value != noreg) {
Label clear_loop;
const Register RconstMethod = O1;
const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset()));
const Address size_of_locals (RconstMethod, 0, in_bytes(ConstMethod::size_of_locals_offset()));
// NOTE: If you change the frame layout, this code will need to
// be updated!
__ ld_ptr( constMethod, RconstMethod );
__ lduh( size_of_locals, O2 );
__ lduh( size_of_parameters, O1 );
__ sll( O2, LogBytesPerWord, O2);
@ -1483,13 +1491,16 @@ void CppInterpreterGenerator::adjust_callers_stack(Register args) {
//
// assert_different_registers(state, prev_state);
const Register Gtmp = G3_scratch;
const RconstMethod = G3_scratch;
const Register tmp = O2;
const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset()));
const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset()));
const Address constMethod(G5_method, 0, in_bytes(Method::const_offset()));
const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset()));
const Address size_of_locals (RconstMethod, 0, in_bytes(ConstMethod::size_of_locals_offset()));
__ ld_ptr(constMethod, RconstMethod);
__ lduh(size_of_parameters, tmp);
__ sll(tmp, LogBytesPerWord, Gtmp); // parameter size in bytes
__ add(args, Gtmp, Gargs); // points to first local + BytesPerWord
__ sll(tmp, LogBytesPerWord, Gargs); // parameter size in bytes
__ add(args, Gargs, Gargs); // points to first local + BytesPerWord
// NEW
__ add(Gargs, -wordSize, Gargs); // points to first local[0]
// determine extra space for non-argument locals & adjust caller's SP
@ -1541,8 +1552,6 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) {
const Address constMethod (G5_method, 0, in_bytes(Method::const_offset()));
const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset()));
const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset()));
const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset()));
address entry_point = __ pc();
__ mov(G0, prevState); // no current activation
@ -1750,7 +1759,9 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) {
__ ld_ptr(STATE(_result._to_call._callee), L4_scratch); // called method
__ ld_ptr(STATE(_stack), L1_scratch); // get top of java expr stack
__ lduh(L4_scratch, in_bytes(Method::size_of_parameters_offset()), L2_scratch); // get parameter size
// get parameter size
__ ld_ptr(L4_scratch, in_bytes(Method::const_offset()), L2_scratch);
__ lduh(L2_scratch, in_bytes(ConstMethod::size_of_parameters_offset()), L2_scratch);
__ sll(L2_scratch, LogBytesPerWord, L2_scratch ); // parameter size in bytes
__ add(L1_scratch, L2_scratch, L1_scratch); // stack destination for result
__ ld(L4_scratch, in_bytes(Method::result_index_offset()), L3_scratch); // called method result type index

View File

@ -171,7 +171,8 @@ void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm,
if (VerifyMethodHandles && !for_compiler_entry) {
// make sure recv is already on stack
__ load_sized_value(Address(method_temp, Method::size_of_parameters_offset()),
__ ld_ptr(method_temp, in_bytes(Method::const_offset()), temp2);
__ load_sized_value(Address(temp2, ConstMethod::size_of_parameters_offset()),
temp2,
sizeof(u2), /*is_signed*/ false);
// assert(sizeof(u2) == sizeof(Method::_size_of_parameters), "");
@ -233,7 +234,8 @@ address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler*
int ref_kind = signature_polymorphic_intrinsic_ref_kind(iid);
assert(ref_kind != 0 || iid == vmIntrinsics::_invokeBasic, "must be _invokeBasic or a linkTo intrinsic");
if (ref_kind == 0 || MethodHandles::ref_kind_has_receiver(ref_kind)) {
__ load_sized_value(Address(G5_method, Method::size_of_parameters_offset()),
__ ld_ptr(G5_method, in_bytes(Method::const_offset()), O4_param_size);
__ load_sized_value(Address(O4_param_size, ConstMethod::size_of_parameters_offset()),
O4_param_size,
sizeof(u2), /*is_signed*/ false);
// assert(sizeof(u2) == sizeof(Method::_size_of_parameters), "");

View File

@ -494,9 +494,6 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
// (gri - 2/25/2000)
const Address size_of_parameters(G5_method, Method::size_of_parameters_offset());
const Address size_of_locals (G5_method, Method::size_of_locals_offset());
const Address constMethod (G5_method, Method::const_offset());
int rounded_vm_local_words = round_to( frame::interpreter_frame_vm_local_words, WordsPerLong );
const int extra_space =
@ -506,11 +503,15 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
(native_call ? frame::interpreter_frame_extra_outgoing_argument_words : 0);
const Register Glocals_size = G3;
const Register RconstMethod = Glocals_size;
const Register Otmp1 = O3;
const Register Otmp2 = O4;
// Lscratch can't be used as a temporary because the call_stub uses
// it to assert that the stack frame was setup correctly.
const Address constMethod (G5_method, Method::const_offset());
const Address size_of_parameters(RconstMethod, ConstMethod::size_of_parameters_offset());
__ ld_ptr( constMethod, RconstMethod );
__ lduh( size_of_parameters, Glocals_size);
// Gargs points to first local + BytesPerWord
@ -530,6 +531,8 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
//
// Compute number of locals in method apart from incoming parameters
//
const Address size_of_locals (Otmp1, ConstMethod::size_of_locals_offset());
__ ld_ptr( constMethod, Otmp1 );
__ lduh( size_of_locals, Otmp1 );
__ sub( Otmp1, Glocals_size, Glocals_size );
__ round_to( Glocals_size, WordsPerLong );
@ -1256,8 +1259,7 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) {
// make sure registers are different!
assert_different_registers(G2_thread, G5_method, Gargs, Gtmp1, Gtmp2);
const Address size_of_parameters(G5_method, Method::size_of_parameters_offset());
const Address size_of_locals (G5_method, Method::size_of_locals_offset());
const Address constMethod (G5_method, Method::const_offset());
// Seems like G5_method is live at the point this is used. So we could make this look consistent
// and use in the asserts.
const Address access_flags (Lmethod, Method::access_flags_offset());
@ -1307,8 +1309,13 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) {
init_value = G0;
Label clear_loop;
const Register RconstMethod = O1;
const Address size_of_parameters(RconstMethod, ConstMethod::size_of_parameters_offset());
const Address size_of_locals (RconstMethod, ConstMethod::size_of_locals_offset());
// NOTE: If you change the frame layout, this code will need to
// be updated!
__ ld_ptr( constMethod, RconstMethod );
__ lduh( size_of_locals, O2 );
__ lduh( size_of_parameters, O1 );
__ sll( O2, Interpreter::logStackElementSize, O2);
@ -1823,9 +1830,13 @@ void TemplateInterpreterGenerator::generate_throw_exception() {
const Register Gtmp1 = G3_scratch;
const Register Gtmp2 = G1_scratch;
const Register RconstMethod = Gtmp1;
const Address constMethod(Lmethod, Method::const_offset());
const Address size_of_parameters(RconstMethod, ConstMethod::size_of_parameters_offset());
// Compute size of arguments for saving when returning to deoptimized caller
__ lduh(Lmethod, in_bytes(Method::size_of_parameters_offset()), Gtmp1);
__ ld_ptr(constMethod, RconstMethod);
__ lduh(size_of_parameters, Gtmp1);
__ sll(Gtmp1, Interpreter::logStackElementSize, Gtmp1);
__ sub(Llocals, Gtmp1, Gtmp2);
__ add(Gtmp2, wordSize, Gtmp2);

View File

@ -3040,7 +3040,8 @@ void TemplateTable::invokevfinal_helper(Register Rscratch, Register Rret) {
Register Rtemp = G4_scratch;
// Load receiver from stack slot
__ lduh(G5_method, in_bytes(Method::size_of_parameters_offset()), G4_scratch);
__ ld_ptr(G5_method, in_bytes(Method::const_offset()), G4_scratch);
__ lduh(G4_scratch, in_bytes(ConstMethod::size_of_parameters_offset()), G4_scratch);
__ load_receiver(G4_scratch, O0);
// receiver NULL check

View File

@ -611,8 +611,6 @@ void InterpreterGenerator::generate_counter_overflow(Label* do_continue) {
// C++ interpreter only
// rsi/r13 - previous interpreter state pointer
const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
// InterpreterRuntime::frequency_counter_overflow takes one argument
// indicating if the counter overflow occurs at a backwards branch (non-NULL bcp).
// The call returns the address of the verified entry point for the method or NULL
@ -977,15 +975,16 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
// to save/restore.
address entry_point = __ pc();
const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
const Address size_of_locals (rbx, Method::size_of_locals_offset());
const Address constMethod (rbx, Method::const_offset());
const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset());
const Address access_flags (rbx, Method::access_flags_offset());
const Address size_of_parameters(rcx, ConstMethod::size_of_parameters_offset());
// rsi/r13 == state/locals rdi == prevstate
const Register locals = rdi;
// get parameter size (always needed)
__ movptr(rcx, constMethod);
__ load_unsigned_short(rcx, size_of_parameters);
// rbx: Method*
@ -994,6 +993,7 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
// for natives the size of locals is zero
// compute beginning of parameters /locals
__ lea(locals, Address(rsp, rcx, Address::times_ptr, -wordSize));
// initialize fixed part of activation frame
@ -1107,11 +1107,14 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
const Register method = rbx;
const Register thread = LP64_ONLY(r15_thread) NOT_LP64(rdi);
const Register t = InterpreterRuntime::SignatureHandlerGenerator::temp(); // rcx|rscratch1
const Address constMethod (method, Method::const_offset());
const Address size_of_parameters(t, ConstMethod::size_of_parameters_offset());
// allocate space for parameters
__ movptr(method, STATE(_method));
__ verify_method_ptr(method);
__ load_unsigned_short(t, Address(method, Method::size_of_parameters_offset()));
__ movptr(t, constMethod);
__ load_unsigned_short(t, size_of_parameters);
__ shll(t, 2);
#ifdef _LP64
__ subptr(rsp, t);
@ -1700,15 +1703,17 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) {
// save sender sp
__ push(rcx);
const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
const Address size_of_locals (rbx, Method::size_of_locals_offset());
const Address constMethod (rbx, Method::const_offset());
const Address access_flags (rbx, Method::access_flags_offset());
const Address size_of_parameters(rdx, ConstMethod::size_of_parameters_offset());
const Address size_of_locals (rdx, ConstMethod::size_of_locals_offset());
// const Address monitor_block_top (rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
// const Address monitor_block_bot (rbp, frame::interpreter_frame_initial_sp_offset * wordSize);
// const Address monitor(rbp, frame::interpreter_frame_initial_sp_offset * wordSize - (int)sizeof(BasicObjectLock));
// get parameter size (always needed)
__ movptr(rdx, constMethod);
__ load_unsigned_short(rcx, size_of_parameters);
// rbx: Method*
@ -1989,7 +1994,9 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) {
__ movptr(rbx, STATE(_result._to_call._callee));
// callee left args on top of expression stack, remove them
__ load_unsigned_short(rcx, Address(rbx, Method::size_of_parameters_offset()));
__ movptr(rcx, constMethod);
__ load_unsigned_short(rcx, Address(rcx, ConstMethod::size_of_parameters_offset()));
__ lea(rsp, Address(rsp, rcx, Address::times_ptr));
__ movl(rcx, Address(rbx, Method::result_index_offset()));
@ -2159,7 +2166,9 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) {
// Make it look like call_stub calling conventions
// Get (potential) receiver
__ load_unsigned_short(rcx, size_of_parameters); // get size of parameters in words
// get size of parameters in words
__ movptr(rcx, constMethod);
__ load_unsigned_short(rcx, Address(rcx, ConstMethod::size_of_parameters_offset()));
ExternalAddress recursive(CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation));
__ pushptr(recursive.addr()); // make it look good in the debugger

View File

@ -169,8 +169,9 @@ void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm,
if (VerifyMethodHandles && !for_compiler_entry) {
// make sure recv is already on stack
__ movptr(temp2, Address(method_temp, Method::const_offset()));
__ load_sized_value(temp2,
Address(method_temp, Method::size_of_parameters_offset()),
Address(temp2, ConstMethod::size_of_parameters_offset()),
sizeof(u2), /*is_signed*/ false);
// assert(sizeof(u2) == sizeof(Method::_size_of_parameters), "");
Label L;
@ -234,8 +235,9 @@ address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler*
int ref_kind = signature_polymorphic_intrinsic_ref_kind(iid);
assert(ref_kind != 0 || iid == vmIntrinsics::_invokeBasic, "must be _invokeBasic or a linkTo intrinsic");
if (ref_kind == 0 || MethodHandles::ref_kind_has_receiver(ref_kind)) {
__ movptr(rdx_argp, Address(rbx_method, Method::const_offset()));
__ load_sized_value(rdx_argp,
Address(rbx_method, Method::size_of_parameters_offset()),
Address(rdx_argp, ConstMethod::size_of_parameters_offset()),
sizeof(u2), /*is_signed*/ false);
// assert(sizeof(u2) == sizeof(Method::_size_of_parameters), "");
rdx_first_arg_addr = __ argument_address(rdx_argp, -1);

View File

@ -424,8 +424,6 @@ void InterpreterGenerator::generate_counter_overflow(Label* do_continue) {
// C++ interpreter only
// rsi - previous interpreter state pointer
const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
// InterpreterRuntime::frequency_counter_overflow takes one argument
// indicating if the counter overflow occurs at a backwards branch (non-NULL bcp).
// The call returns the address of the verified entry point for the method or NULL
@ -868,12 +866,13 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
// rsi: previous interpreter state (C++ interpreter) must preserve
address entry_point = __ pc();
const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
const Address constMethod (rbx, Method::const_offset());
const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset());
const Address access_flags (rbx, Method::access_flags_offset());
const Address size_of_parameters(rcx, ConstMethod::size_of_parameters_offset());
// get parameter size (always needed)
__ movptr(rcx, constMethod);
__ load_unsigned_short(rcx, size_of_parameters);
// native calls don't need the stack size check since they have no expression stack
@ -988,7 +987,9 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
// allocate space for parameters
__ get_method(method);
__ load_unsigned_short(t, Address(method, Method::size_of_parameters_offset()));
__ movptr(t, Address(method, Method::const_offset()));
__ load_unsigned_short(t, Address(t, ConstMethod::size_of_parameters_offset()));
__ shlptr(t, Interpreter::logStackElementSize);
__ addptr(t, 2*wordSize); // allocate two more slots for JNIEnv and possible mirror
__ subptr(rsp, t);
@ -1297,13 +1298,14 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) {
// rsi: sender sp
address entry_point = __ pc();
const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
const Address size_of_locals (rbx, Method::size_of_locals_offset());
const Address constMethod (rbx, Method::const_offset());
const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset());
const Address access_flags (rbx, Method::access_flags_offset());
const Address size_of_parameters(rdx, ConstMethod::size_of_parameters_offset());
const Address size_of_locals (rdx, ConstMethod::size_of_locals_offset());
// get parameter size (always needed)
__ movptr(rdx, constMethod);
__ load_unsigned_short(rcx, size_of_parameters);
// rbx,: Method*
@ -1734,7 +1736,8 @@ void TemplateInterpreterGenerator::generate_throw_exception() {
// Compute size of arguments for saving when returning to deoptimized caller
__ get_method(rax);
__ load_unsigned_short(rax, Address(rax, in_bytes(Method::size_of_parameters_offset())));
__ movptr(rax, Address(rax, Method::const_offset()));
__ load_unsigned_short(rax, Address(rax, ConstMethod::size_of_parameters_offset()));
__ shlptr(rax, Interpreter::logStackElementSize);
__ restore_locals();
__ subptr(rdi, rax);

View File

@ -369,9 +369,6 @@ void InterpreterGenerator::generate_counter_overflow(Label* do_continue) {
// Everything as it was on entry
// rdx is not restored. Doesn't appear to really be set.
const Address size_of_parameters(rbx,
Method::size_of_parameters_offset());
// InterpreterRuntime::frequency_counter_overflow takes two
// arguments, the first (thread) is passed by call_VM, the second
// indicates if the counter overflow occurs at a backwards branch
@ -844,14 +841,17 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
address entry_point = __ pc();
const Address size_of_parameters(rbx, Method::
size_of_parameters_offset());
const Address constMethod (rbx, Method::const_offset());
const Address invocation_counter(rbx, Method::
invocation_counter_offset() +
InvocationCounter::counter_offset());
const Address access_flags (rbx, Method::access_flags_offset());
const Address size_of_parameters(rcx, ConstMethod::
size_of_parameters_offset());
// get parameter size (always needed)
__ movptr(rcx, constMethod);
__ load_unsigned_short(rcx, size_of_parameters);
// native calls don't need the stack size check since they have no
@ -967,9 +967,8 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
// allocate space for parameters
__ get_method(method);
__ load_unsigned_short(t,
Address(method,
Method::size_of_parameters_offset()));
__ movptr(t, Address(method, Method::const_offset()));
__ load_unsigned_short(t, Address(t, ConstMethod::size_of_parameters_offset()));
__ shll(t, Interpreter::logStackElementSize);
__ subptr(rsp, t);
@ -1302,15 +1301,18 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) {
// r13: sender sp
address entry_point = __ pc();
const Address size_of_parameters(rbx,
Method::size_of_parameters_offset());
const Address size_of_locals(rbx, Method::size_of_locals_offset());
const Address constMethod(rbx, Method::const_offset());
const Address invocation_counter(rbx,
Method::invocation_counter_offset() +
InvocationCounter::counter_offset());
const Address access_flags(rbx, Method::access_flags_offset());
const Address size_of_parameters(rdx,
ConstMethod::size_of_parameters_offset());
const Address size_of_locals(rdx, ConstMethod::size_of_locals_offset());
// get parameter size (always needed)
__ movptr(rdx, constMethod);
__ load_unsigned_short(rcx, size_of_parameters);
// rbx: Method*
@ -1752,7 +1754,8 @@ void TemplateInterpreterGenerator::generate_throw_exception() {
// Compute size of arguments for saving when returning to
// deoptimized caller
__ get_method(rax);
__ load_unsigned_short(rax, Address(rax, in_bytes(Method::
__ movptr(rax, Address(rax, Method::const_offset()));
__ load_unsigned_short(rax, Address(rax, in_bytes(ConstMethod::
size_of_parameters_offset())));
__ shll(rax, Interpreter::logStackElementSize);
__ restore_locals(); // XXX do we need this?

View File

@ -327,14 +327,14 @@ jchar* java_lang_String::as_unicode_string(oop java_string, int& length) {
return result;
}
unsigned int java_lang_String::to_hash(oop java_string) {
unsigned int java_lang_String::hash_code(oop java_string) {
int length = java_lang_String::length(java_string);
// Zero length string will hash to zero with String.toHash() function.
// Zero length string will hash to zero with String.hashCode() function.
if (length == 0) return 0;
typeArrayOop value = java_lang_String::value(java_string);
int offset = java_lang_String::offset(java_string);
return java_lang_String::to_hash(value->char_at_addr(offset), length);
return java_lang_String::hash_code(value->char_at_addr(offset), length);
}
char* java_lang_String::as_quoted_ascii(oop java_string) {

View File

@ -166,8 +166,8 @@ class java_lang_String : AllStatic {
// objects in the shared archive file.
// hash P(31) from Kernighan & Ritchie
//
// For this reason, THIS ALGORITHM MUST MATCH String.toHash().
template <typename T> static unsigned int to_hash(T* s, int len) {
// For this reason, THIS ALGORITHM MUST MATCH String.hashCode().
template <typename T> static unsigned int hash_code(T* s, int len) {
unsigned int h = 0;
while (len-- > 0) {
h = 31*h + (unsigned int) *s;
@ -175,10 +175,10 @@ class java_lang_String : AllStatic {
}
return h;
}
static unsigned int to_hash(oop java_string);
static unsigned int hash_code(oop java_string);
// This is the string hash code used by the StringTable, which may be
// the same as String.toHash or an alternate hash code.
// the same as String.hashCode or an alternate hash code.
static unsigned int hash_string(oop java_string);
static bool equals(oop java_string, jchar* chars, int len);

View File

@ -179,7 +179,7 @@ Symbol* SymbolTable::lookup(int index, const char* name,
unsigned int SymbolTable::hash_symbol(const char* s, int len) {
return use_alternate_hashcode() ?
AltHashing::murmur3_32(seed(), (const jbyte*)s, len) :
java_lang_String::to_hash(s, len);
java_lang_String::hash_code(s, len);
}
@ -617,7 +617,7 @@ bool StringTable::_needs_rehashing = false;
// Pick hashing algorithm
unsigned int StringTable::hash_string(const jchar* s, int len) {
return use_alternate_hashcode() ? AltHashing::murmur3_32(seed(), s, len) :
java_lang_String::to_hash(s, len);
java_lang_String::hash_code(s, len);
}
oop StringTable::lookup(int index, jchar* name,

View File

@ -46,27 +46,11 @@
// Concurrent marking bit map wrapper
CMBitMapRO::CMBitMapRO(ReservedSpace rs, int shifter) :
_bm((uintptr_t*)NULL,0),
CMBitMapRO::CMBitMapRO(int shifter) :
_bm(),
_shifter(shifter) {
_bmStartWord = (HeapWord*)(rs.base());
_bmWordSize = rs.size()/HeapWordSize; // rs.size() is in bytes
ReservedSpace brs(ReservedSpace::allocation_align_size_up(
(_bmWordSize >> (_shifter + LogBitsPerByte)) + 1));
MemTracker::record_virtual_memory_type((address)brs.base(), mtGC);
guarantee(brs.is_reserved(), "couldn't allocate concurrent marking bit map");
// For now we'll just commit all of the bit map up fromt.
// Later on we'll try to be more parsimonious with swap.
guarantee(_virtual_space.initialize(brs, brs.size()),
"couldn't reseve backing store for concurrent marking bit map");
assert(_virtual_space.committed_size() == brs.size(),
"didn't reserve backing store for all of concurrent marking bit map?");
_bm.set_map((uintptr_t*)_virtual_space.low());
assert(_virtual_space.committed_size() << (_shifter + LogBitsPerByte) >=
_bmWordSize, "inconsistency in bit map sizing");
_bm.set_size(_bmWordSize >> _shifter);
_bmStartWord = 0;
_bmWordSize = 0;
}
HeapWord* CMBitMapRO::getNextMarkedWordAddress(HeapWord* addr,
@ -108,15 +92,40 @@ int CMBitMapRO::heapWordDiffToOffsetDiff(size_t diff) const {
}
#ifndef PRODUCT
bool CMBitMapRO::covers(ReservedSpace rs) const {
bool CMBitMapRO::covers(ReservedSpace heap_rs) const {
// assert(_bm.map() == _virtual_space.low(), "map inconsistency");
assert(((size_t)_bm.size() * ((size_t)1 << _shifter)) == _bmWordSize,
"size inconsistency");
return _bmStartWord == (HeapWord*)(rs.base()) &&
_bmWordSize == rs.size()>>LogHeapWordSize;
return _bmStartWord == (HeapWord*)(heap_rs.base()) &&
_bmWordSize == heap_rs.size()>>LogHeapWordSize;
}
#endif
bool CMBitMap::allocate(ReservedSpace heap_rs) {
_bmStartWord = (HeapWord*)(heap_rs.base());
_bmWordSize = heap_rs.size()/HeapWordSize; // heap_rs.size() is in bytes
ReservedSpace brs(ReservedSpace::allocation_align_size_up(
(_bmWordSize >> (_shifter + LogBitsPerByte)) + 1));
if (!brs.is_reserved()) {
warning("ConcurrentMark marking bit map allocation failure");
return false;
}
MemTracker::record_virtual_memory_type((address)brs.base(), mtGC);
// For now we'll just commit all of the bit map up front.
// Later on we'll try to be more parsimonious with swap.
if (!_virtual_space.initialize(brs, brs.size())) {
warning("ConcurrentMark marking bit map backing store failure");
return false;
}
assert(_virtual_space.committed_size() == brs.size(),
"didn't reserve backing store for all of concurrent marking bit map?");
_bm.set_map((uintptr_t*)_virtual_space.low());
assert(_virtual_space.committed_size() << (_shifter + LogBitsPerByte) >=
_bmWordSize, "inconsistency in bit map sizing");
_bm.set_size(_bmWordSize >> _shifter);
return true;
}
void CMBitMap::clearAll() {
_bm.clear();
return;
@ -163,20 +172,79 @@ CMMarkStack::CMMarkStack(ConcurrentMark* cm) :
#endif
{}
void CMMarkStack::allocate(size_t size) {
_base = NEW_C_HEAP_ARRAY(oop, size, mtGC);
if (_base == NULL) {
vm_exit_during_initialization("Failed to allocate CM region mark stack");
bool CMMarkStack::allocate(size_t capacity) {
// allocate a stack of the requisite depth
ReservedSpace rs(ReservedSpace::allocation_align_size_up(capacity * sizeof(oop)));
if (!rs.is_reserved()) {
warning("ConcurrentMark MarkStack allocation failure");
return false;
}
_index = 0;
_capacity = (jint) size;
MemTracker::record_virtual_memory_type((address)rs.base(), mtGC);
if (!_virtual_space.initialize(rs, rs.size())) {
warning("ConcurrentMark MarkStack backing store failure");
// Release the virtual memory reserved for the marking stack
rs.release();
return false;
}
assert(_virtual_space.committed_size() == rs.size(),
"Didn't reserve backing store for all of ConcurrentMark stack?");
_base = (oop*) _virtual_space.low();
setEmpty();
_capacity = (jint) capacity;
_saved_index = -1;
NOT_PRODUCT(_max_depth = 0);
return true;
}
void CMMarkStack::expand() {
// Called, during remark, if we've overflown the marking stack during marking.
assert(isEmpty(), "stack should been emptied while handling overflow");
assert(_capacity <= (jint) MarkStackSizeMax, "stack bigger than permitted");
// Clear expansion flag
_should_expand = false;
if (_capacity == (jint) MarkStackSizeMax) {
if (PrintGCDetails && Verbose) {
gclog_or_tty->print_cr(" (benign) Can't expand marking stack capacity, at max size limit");
}
return;
}
// Double capacity if possible
jint new_capacity = MIN2(_capacity*2, (jint) MarkStackSizeMax);
// Do not give up existing stack until we have managed to
// get the double capacity that we desired.
ReservedSpace rs(ReservedSpace::allocation_align_size_up(new_capacity *
sizeof(oop)));
if (rs.is_reserved()) {
// Release the backing store associated with old stack
_virtual_space.release();
// Reinitialize virtual space for new stack
if (!_virtual_space.initialize(rs, rs.size())) {
fatal("Not enough swap for expanded marking stack capacity");
}
_base = (oop*)(_virtual_space.low());
_index = 0;
_capacity = new_capacity;
} else {
if (PrintGCDetails && Verbose) {
// Failed to double capacity, continue;
gclog_or_tty->print(" (benign) Failed to expand marking stack capacity from "
SIZE_FORMAT"K to " SIZE_FORMAT"K",
_capacity / K, new_capacity / K);
}
}
}
void CMMarkStack::set_should_expand() {
// If we're resetting the marking state because of an
// marking stack overflow, record that we should, if
// possible, expand the stack.
_should_expand = _cm->has_overflown();
}
CMMarkStack::~CMMarkStack() {
if (_base != NULL) {
FREE_C_HEAP_ARRAY(oop, _base, mtGC);
_base = NULL;
_virtual_space.release();
}
}
@ -217,7 +285,7 @@ void CMMarkStack::par_adjoin_arr(oop* ptr_arr, int n) {
jint res = Atomic::cmpxchg(next_index, &_index, index);
if (res == index) {
for (int i = 0; i < n; i++) {
int ind = index + i;
int ind = index + i;
assert(ind < _capacity, "By overflow test above.");
_base[ind] = ptr_arr[i];
}
@ -228,7 +296,6 @@ void CMMarkStack::par_adjoin_arr(oop* ptr_arr, int n) {
}
}
void CMMarkStack::par_push_arr(oop* ptr_arr, int n) {
MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
jint start = _index;
@ -244,9 +311,9 @@ void CMMarkStack::par_push_arr(oop* ptr_arr, int n) {
assert(ind < _capacity, "By overflow test above.");
_base[ind] = ptr_arr[i];
}
NOT_PRODUCT(_max_depth = MAX2(_max_depth, next_index));
}
bool CMMarkStack::par_pop_arr(oop* ptr_arr, int max, int* n) {
MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
jint index = _index;
@ -255,7 +322,7 @@ bool CMMarkStack::par_pop_arr(oop* ptr_arr, int max, int* n) {
return false;
} else {
int k = MIN2(max, index);
jint new_ind = index - k;
jint new_ind = index - k;
for (int j = 0; j < k; j++) {
ptr_arr[j] = _base[new_ind + j];
}
@ -404,9 +471,10 @@ uint ConcurrentMark::scale_parallel_threads(uint n_par_threads) {
return MAX2((n_par_threads + 2) / 4, 1U);
}
ConcurrentMark::ConcurrentMark(ReservedSpace rs, uint max_regions) :
_markBitMap1(rs, MinObjAlignment - 1),
_markBitMap2(rs, MinObjAlignment - 1),
ConcurrentMark::ConcurrentMark(G1CollectedHeap* g1h, ReservedSpace heap_rs) :
_g1h(g1h),
_markBitMap1(MinObjAlignment - 1),
_markBitMap2(MinObjAlignment - 1),
_parallel_marking_threads(0),
_max_parallel_marking_threads(0),
@ -415,10 +483,10 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs, uint max_regions) :
_cleanup_sleep_factor(0.0),
_cleanup_task_overhead(1.0),
_cleanup_list("Cleanup List"),
_region_bm((BitMap::idx_t) max_regions, false /* in_resource_area*/),
_card_bm((rs.size() + CardTableModRefBS::card_size - 1) >>
CardTableModRefBS::card_shift,
false /* in_resource_area*/),
_region_bm((BitMap::idx_t)(g1h->max_regions()), false /* in_resource_area*/),
_card_bm((heap_rs.size() + CardTableModRefBS::card_size - 1) >>
CardTableModRefBS::card_shift,
false /* in_resource_area*/),
_prevMarkBitMap(&_markBitMap1),
_nextMarkBitMap(&_markBitMap2),
@ -449,7 +517,8 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs, uint max_regions) :
_parallel_workers(NULL),
_count_card_bitmaps(NULL),
_count_marked_bytes(NULL) {
_count_marked_bytes(NULL),
_completed_initialization(false) {
CMVerboseLevel verbose_level = (CMVerboseLevel) G1MarkingVerboseLevel;
if (verbose_level < no_verbose) {
verbose_level = no_verbose;
@ -464,61 +533,34 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs, uint max_regions) :
"heap end = "PTR_FORMAT, _heap_start, _heap_end);
}
_markStack.allocate(MarkStackSize);
if (!_markBitMap1.allocate(heap_rs)) {
warning("Failed to allocate first CM bit map");
return;
}
if (!_markBitMap2.allocate(heap_rs)) {
warning("Failed to allocate second CM bit map");
return;
}
// Create & start a ConcurrentMark thread.
_cmThread = new ConcurrentMarkThread(this);
assert(cmThread() != NULL, "CM Thread should have been created");
assert(cmThread()->cm() != NULL, "CM Thread should refer to this cm");
_g1h = G1CollectedHeap::heap();
assert(CGC_lock != NULL, "Where's the CGC_lock?");
assert(_markBitMap1.covers(rs), "_markBitMap1 inconsistency");
assert(_markBitMap2.covers(rs), "_markBitMap2 inconsistency");
assert(_markBitMap1.covers(heap_rs), "_markBitMap1 inconsistency");
assert(_markBitMap2.covers(heap_rs), "_markBitMap2 inconsistency");
SATBMarkQueueSet& satb_qs = JavaThread::satb_mark_queue_set();
satb_qs.set_buffer_size(G1SATBBufferSize);
_root_regions.init(_g1h, this);
_tasks = NEW_C_HEAP_ARRAY(CMTask*, _max_worker_id, mtGC);
_accum_task_vtime = NEW_C_HEAP_ARRAY(double, _max_worker_id, mtGC);
_count_card_bitmaps = NEW_C_HEAP_ARRAY(BitMap, _max_worker_id, mtGC);
_count_marked_bytes = NEW_C_HEAP_ARRAY(size_t*, _max_worker_id, mtGC);
BitMap::idx_t card_bm_size = _card_bm.size();
// so that the assertion in MarkingTaskQueue::task_queue doesn't fail
_active_tasks = _max_worker_id;
for (uint i = 0; i < _max_worker_id; ++i) {
CMTaskQueue* task_queue = new CMTaskQueue();
task_queue->initialize();
_task_queues->register_queue(i, task_queue);
_count_card_bitmaps[i] = BitMap(card_bm_size, false);
_count_marked_bytes[i] = NEW_C_HEAP_ARRAY(size_t, (size_t) max_regions, mtGC);
_tasks[i] = new CMTask(i, this,
_count_marked_bytes[i],
&_count_card_bitmaps[i],
task_queue, _task_queues);
_accum_task_vtime[i] = 0.0;
}
// Calculate the card number for the bottom of the heap. Used
// in biasing indexes into the accounting card bitmaps.
_heap_bottom_card_num =
intptr_t(uintptr_t(_g1h->reserved_region().start()) >>
CardTableModRefBS::card_shift);
// Clear all the liveness counting data
clear_all_count_data();
if (ConcGCThreads > ParallelGCThreads) {
vm_exit_during_initialization("Can't have more ConcGCThreads "
"than ParallelGCThreads.");
warning("Can't have more ConcGCThreads (" UINT32_FORMAT ") "
"than ParallelGCThreads (" UINT32_FORMAT ").",
ConcGCThreads, ParallelGCThreads);
return;
}
if (ParallelGCThreads == 0) {
// if we are not running with any parallel GC threads we will not
@ -590,9 +632,86 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs, uint max_regions) :
}
}
if (FLAG_IS_DEFAULT(MarkStackSize)) {
uintx mark_stack_size =
MIN2(MarkStackSizeMax,
MAX2(MarkStackSize, (uintx) (parallel_marking_threads() * TASKQUEUE_SIZE)));
// Verify that the calculated value for MarkStackSize is in range.
// It would be nice to use the private utility routine from Arguments.
if (!(mark_stack_size >= 1 && mark_stack_size <= MarkStackSizeMax)) {
warning("Invalid value calculated for MarkStackSize (" UINTX_FORMAT "): "
"must be between " UINTX_FORMAT " and " UINTX_FORMAT,
mark_stack_size, 1, MarkStackSizeMax);
return;
}
FLAG_SET_ERGO(uintx, MarkStackSize, mark_stack_size);
} else {
// Verify MarkStackSize is in range.
if (FLAG_IS_CMDLINE(MarkStackSize)) {
if (FLAG_IS_DEFAULT(MarkStackSizeMax)) {
if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) {
warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT "): "
"must be between " UINTX_FORMAT " and " UINTX_FORMAT,
MarkStackSize, 1, MarkStackSizeMax);
return;
}
} else if (FLAG_IS_CMDLINE(MarkStackSizeMax)) {
if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) {
warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT ")"
" or for MarkStackSizeMax (" UINTX_FORMAT ")",
MarkStackSize, MarkStackSizeMax);
return;
}
}
}
}
if (!_markStack.allocate(MarkStackSize)) {
warning("Failed to allocate CM marking stack");
return;
}
_tasks = NEW_C_HEAP_ARRAY(CMTask*, _max_worker_id, mtGC);
_accum_task_vtime = NEW_C_HEAP_ARRAY(double, _max_worker_id, mtGC);
_count_card_bitmaps = NEW_C_HEAP_ARRAY(BitMap, _max_worker_id, mtGC);
_count_marked_bytes = NEW_C_HEAP_ARRAY(size_t*, _max_worker_id, mtGC);
BitMap::idx_t card_bm_size = _card_bm.size();
// so that the assertion in MarkingTaskQueue::task_queue doesn't fail
_active_tasks = _max_worker_id;
size_t max_regions = (size_t) _g1h->max_regions();
for (uint i = 0; i < _max_worker_id; ++i) {
CMTaskQueue* task_queue = new CMTaskQueue();
task_queue->initialize();
_task_queues->register_queue(i, task_queue);
_count_card_bitmaps[i] = BitMap(card_bm_size, false);
_count_marked_bytes[i] = NEW_C_HEAP_ARRAY(size_t, max_regions, mtGC);
_tasks[i] = new CMTask(i, this,
_count_marked_bytes[i],
&_count_card_bitmaps[i],
task_queue, _task_queues);
_accum_task_vtime[i] = 0.0;
}
// Calculate the card number for the bottom of the heap. Used
// in biasing indexes into the accounting card bitmaps.
_heap_bottom_card_num =
intptr_t(uintptr_t(_g1h->reserved_region().start()) >>
CardTableModRefBS::card_shift);
// Clear all the liveness counting data
clear_all_count_data();
// so that the call below can read a sensible value
_heap_start = (HeapWord*) rs.base();
_heap_start = (HeapWord*) heap_rs.base();
set_non_marking_state();
_completed_initialization = true;
}
void ConcurrentMark::update_g1_committed(bool force) {
@ -1165,6 +1284,11 @@ void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) {
assert(!restart_for_overflow(), "sanity");
}
// Expand the marking stack, if we have to and if we can.
if (_markStack.should_expand()) {
_markStack.expand();
}
// Reset the marking state if marking completed
if (!restart_for_overflow()) {
set_non_marking_state();
@ -2785,7 +2909,7 @@ void ConcurrentMark::verify_no_cset_oops(bool verify_stacks,
// Verify entries on the task queues
for (uint i = 0; i < _max_worker_id; i += 1) {
cl.set_phase(VerifyNoCSetOopsQueues, i);
OopTaskQueue* queue = _task_queues->queue(i);
CMTaskQueue* queue = _task_queues->queue(i);
queue->oops_do(&cl);
}
}
@ -2840,8 +2964,8 @@ void ConcurrentMark::verify_no_cset_oops(bool verify_stacks,
#endif // PRODUCT
void ConcurrentMark::clear_marking_state(bool clear_overflow) {
_markStack.setEmpty();
_markStack.clear_overflow();
_markStack.set_should_expand();
_markStack.setEmpty(); // Also clears the _markStack overflow flag
if (clear_overflow) {
clear_has_overflown();
} else {
@ -2850,7 +2974,7 @@ void ConcurrentMark::clear_marking_state(bool clear_overflow) {
_finger = _heap_start;
for (uint i = 0; i < _max_worker_id; ++i) {
OopTaskQueue* queue = _task_queues->queue(i);
CMTaskQueue* queue = _task_queues->queue(i);
queue->set_empty();
}
}

View File

@ -63,7 +63,7 @@ class CMBitMapRO VALUE_OBJ_CLASS_SPEC {
public:
// constructor
CMBitMapRO(ReservedSpace rs, int shifter);
CMBitMapRO(int shifter);
enum { do_yield = true };
@ -117,8 +117,11 @@ class CMBitMap : public CMBitMapRO {
public:
// constructor
CMBitMap(ReservedSpace rs, int shifter) :
CMBitMapRO(rs, shifter) {}
CMBitMap(int shifter) :
CMBitMapRO(shifter) {}
// Allocates the back store for the marking bitmap
bool allocate(ReservedSpace heap_rs);
// write marks
void mark(HeapWord* addr) {
@ -155,17 +158,18 @@ class CMBitMap : public CMBitMapRO {
MemRegion getAndClearMarkedRegion(HeapWord* addr, HeapWord* end_addr);
};
// Represents a marking stack used by the CM collector.
// Ideally this should be GrowableArray<> just like MSC's marking stack(s).
// Represents a marking stack used by ConcurrentMarking in the G1 collector.
class CMMarkStack VALUE_OBJ_CLASS_SPEC {
VirtualSpace _virtual_space; // Underlying backing store for actual stack
ConcurrentMark* _cm;
oop* _base; // bottom of stack
jint _index; // one more than last occupied index
jint _capacity; // max #elements
jint _saved_index; // value of _index saved at start of GC
NOT_PRODUCT(jint _max_depth;) // max depth plumbed during run
jint _index; // one more than last occupied index
jint _capacity; // max #elements
jint _saved_index; // value of _index saved at start of GC
NOT_PRODUCT(jint _max_depth;) // max depth plumbed during run
bool _overflow;
bool _overflow;
bool _should_expand;
DEBUG_ONLY(bool _drain_in_progress;)
DEBUG_ONLY(bool _drain_in_progress_yields;)
@ -173,7 +177,13 @@ class CMMarkStack VALUE_OBJ_CLASS_SPEC {
CMMarkStack(ConcurrentMark* cm);
~CMMarkStack();
void allocate(size_t size);
#ifndef PRODUCT
jint max_depth() const {
return _max_depth;
}
#endif
bool allocate(size_t capacity);
oop pop() {
if (!isEmpty()) {
@ -231,11 +241,17 @@ class CMMarkStack VALUE_OBJ_CLASS_SPEC {
bool isEmpty() { return _index == 0; }
bool isFull() { return _index == _capacity; }
int maxElems() { return _capacity; }
int maxElems() { return _capacity; }
bool overflow() { return _overflow; }
void clear_overflow() { _overflow = false; }
bool should_expand() const { return _should_expand; }
void set_should_expand();
// Expand the stack, typically in response to an overflow condition
void expand();
int size() { return _index; }
void setEmpty() { _index = 0; clear_overflow(); }
@ -344,6 +360,7 @@ public:
class ConcurrentMarkThread;
class ConcurrentMark: public CHeapObj<mtGC> {
friend class CMMarkStack;
friend class ConcurrentMarkThread;
friend class CMTask;
friend class CMBitMapClosure;
@ -577,6 +594,9 @@ protected:
// the card bitmaps.
intptr_t _heap_bottom_card_num;
// Set to true when initialization is complete
bool _completed_initialization;
public:
// Manipulation of the global mark stack.
// Notice that the first mark_stack_push is CAS-based, whereas the
@ -636,7 +656,7 @@ public:
return _task_queues->steal(worker_id, hash_seed, obj);
}
ConcurrentMark(ReservedSpace rs, uint max_regions);
ConcurrentMark(G1CollectedHeap* g1h, ReservedSpace heap_rs);
~ConcurrentMark();
ConcurrentMarkThread* cmThread() { return _cmThread; }
@ -907,6 +927,11 @@ public:
// Should *not* be called from parallel code.
inline bool mark_and_count(oop obj);
// Returns true if initialization was successfully completed.
bool completed_initialization() const {
return _completed_initialization;
}
protected:
// Clear all the per-task bitmaps and arrays used to store the
// counting data.

View File

@ -2079,7 +2079,11 @@ jint G1CollectedHeap::initialize() {
// Create the ConcurrentMark data structure and thread.
// (Must do this late, so that "max_regions" is defined.)
_cm = new ConcurrentMark(heap_rs, max_regions());
_cm = new ConcurrentMark(this, heap_rs);
if (_cm == NULL || !_cm->completed_initialization()) {
vm_shutdown_during_initialization("Could not create/initialize ConcurrentMark");
return JNI_ENOMEM;
}
_cmThread = _cm->cmThread();
// Initialize the from_card cache structure of HeapRegionRemSet.
@ -2087,7 +2091,7 @@ jint G1CollectedHeap::initialize() {
// Now expand into the initial heap size.
if (!expand(init_byte_size)) {
vm_exit_during_initialization("Failed to allocate initial heap.");
vm_shutdown_during_initialization("Failed to allocate initial heap.");
return JNI_ENOMEM;
}

View File

@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "gc_implementation/parallelScavenge/adjoiningVirtualSpaces.hpp"
#include "memory/allocation.inline.hpp"
#include "runtime/java.hpp"
AdjoiningVirtualSpaces::AdjoiningVirtualSpaces(ReservedSpace rs,

View File

@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "gc_implementation/shared/gcStats.hpp"
#include "gc_implementation/shared/gcUtil.hpp"
#include "memory/allocation.inline.hpp"
GCStats::GCStats() {
_avg_promoted = new AdaptivePaddedNoZeroDevAverage(

View File

@ -46,6 +46,7 @@
// | interp_kind | flags | code_size |
// | name index | signature index |
// | method_idnum | max_stack |
// | max_locals | size_of_parameters |
// |------------------------------------------------------|
// | |
// | byte codes |
@ -150,7 +151,8 @@ private:
// initially corresponds to the index into the methods array.
// but this may change with redefinition
u2 _max_stack; // Maximum number of entries on the expression stack
u2 _max_locals; // Number of local variables used by this method
u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words
// Constructor
ConstMethod(int byte_code_size,
@ -338,6 +340,11 @@ public:
static ByteSize max_stack_offset()
{ return byte_offset_of(ConstMethod, _max_stack); }
static ByteSize size_of_locals_offset()
{ return byte_offset_of(ConstMethod, _max_locals); }
static ByteSize size_of_parameters_offset()
{ return byte_offset_of(ConstMethod, _size_of_parameters); }
// Unique id for the method
static const u2 MAX_IDNUM;
@ -349,6 +356,14 @@ public:
int max_stack() const { return _max_stack; }
void set_max_stack(int size) { _max_stack = size; }
// max locals
int max_locals() const { return _max_locals; }
void set_max_locals(int size) { _max_locals = size; }
// size of parameters
int size_of_parameters() const { return _size_of_parameters; }
void set_size_of_parameters(int size) { _size_of_parameters = size; }
// Deallocation for RedefineClasses
void deallocate_contents(ClassLoaderData* loader_data);
bool is_klass() const { return false; }

View File

@ -73,8 +73,7 @@
// |------------------------------------------------------|
// | result_index (C++ interpreter only) |
// |------------------------------------------------------|
// | method_size | max_locals |
// | size_of_parameters | intrinsic_id| flags |
// | method_size | intrinsic_id| flags |
// |------------------------------------------------------|
// | throwout_count | num_breakpoints |
// |------------------------------------------------------|
@ -116,8 +115,6 @@ class Method : public Metadata {
int _result_index; // C++ interpreter needs for converting results to/from stack
#endif
u2 _method_size; // size of this object
u2 _max_locals; // Number of local variables used by this method
u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words
u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none)
u1 _jfr_towrite : 1, // Flags
_force_inline : 1,
@ -292,8 +289,8 @@ class Method : public Metadata {
void set_max_stack(int size) { constMethod()->set_max_stack(size); }
// max locals
int max_locals() const { return _max_locals; }
void set_max_locals(int size) { _max_locals = size; }
int max_locals() const { return constMethod()->max_locals(); }
void set_max_locals(int size) { constMethod()->set_max_locals(size); }
int highest_comp_level() const;
void set_highest_comp_level(int level);
@ -311,7 +308,8 @@ class Method : public Metadata {
void set_interpreter_throwout_count(int count) { _interpreter_throwout_count = count; }
// size of parameters
int size_of_parameters() const { return _size_of_parameters; }
int size_of_parameters() const { return constMethod()->size_of_parameters(); }
void set_size_of_parameters(int size) { constMethod()->set_size_of_parameters(size); }
bool has_stackmap_table() const {
return constMethod()->has_stackmap_table();
@ -588,8 +586,6 @@ class Method : public Metadata {
#ifdef CC_INTERP
static ByteSize result_index_offset() { return byte_offset_of(Method, _result_index ); }
#endif /* CC_INTERP */
static ByteSize size_of_locals_offset() { return byte_offset_of(Method, _max_locals ); }
static ByteSize size_of_parameters_offset() { return byte_offset_of(Method, _size_of_parameters); }
static ByteSize from_compiled_offset() { return byte_offset_of(Method, _from_compiled_entry); }
static ByteSize code_offset() { return byte_offset_of(Method, _code); }
static ByteSize invocation_counter_offset() { return byte_offset_of(Method, _invocation_counter); }
@ -796,9 +792,6 @@ class Method : public Metadata {
Array<AnnotationArray*>* methods_default_annotations,
bool idempotent = false);
// size of parameters
void set_size_of_parameters(int size) { _size_of_parameters = size; }
// Deallocation function for redefine classes or if an error occurs
void deallocate_contents(ClassLoaderData* loader_data);

View File

@ -1499,13 +1499,12 @@ void Arguments::set_g1_gc_flags() {
Abstract_VM_Version::parallel_worker_threads());
}
if (FLAG_IS_DEFAULT(MarkStackSize)) {
FLAG_SET_DEFAULT(MarkStackSize, 128 * TASKQUEUE_SIZE);
}
if (PrintGCDetails && Verbose) {
tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk",
MarkStackSize / K, MarkStackSizeMax / K);
tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
// MarkStackSize will be set (if it hasn't been set by the user)
// when concurrent marking is initialized.
// Its value will be based upon the number of parallel marking threads.
// But we do set the maximum mark stack size here.
if (FLAG_IS_DEFAULT(MarkStackSizeMax)) {
FLAG_SET_DEFAULT(MarkStackSizeMax, 128 * TASKQUEUE_SIZE);
}
if (FLAG_IS_DEFAULT(GCTimeRatio) || GCTimeRatio == 0) {
@ -1517,6 +1516,12 @@ void Arguments::set_g1_gc_flags() {
// is allocation). We might consider increase it further.
FLAG_SET_DEFAULT(GCTimeRatio, 9);
}
if (PrintGCDetails && Verbose) {
tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk",
MarkStackSize / K, MarkStackSizeMax / K);
tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
}
}
void Arguments::set_heap_size() {
@ -1980,6 +1985,9 @@ bool Arguments::check_vm_args_consistency() {
status = status && verify_min_value(ClassMetaspaceSize, 1*M,
"ClassMetaspaceSize");
status = status && verify_interval(MarkStackSizeMax,
1, (max_jint - 1), "MarkStackSizeMax");
#ifdef SPARC
if (UseConcMarkSweepGC || UseG1GC) {
// Issue a stern warning if the user has explicitly set

View File

@ -355,8 +355,6 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
nonstatic_field(Method, _access_flags, AccessFlags) \
nonstatic_field(Method, _vtable_index, int) \
nonstatic_field(Method, _method_size, u2) \
nonstatic_field(Method, _max_locals, u2) \
nonstatic_field(Method, _size_of_parameters, u2) \
nonstatic_field(Method, _interpreter_throwout_count, u2) \
nonstatic_field(Method, _number_of_breakpoints, u2) \
nonstatic_field(Method, _invocation_counter, InvocationCounter) \
@ -378,6 +376,8 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
nonstatic_field(ConstMethod, _signature_index, u2) \
nonstatic_field(ConstMethod, _method_idnum, u2) \
nonstatic_field(ConstMethod, _max_stack, u2) \
nonstatic_field(ConstMethod, _max_locals, u2) \
nonstatic_field(ConstMethod, _size_of_parameters, u2) \
nonstatic_field(ObjArrayKlass, _element_klass, Klass*) \
nonstatic_field(ObjArrayKlass, _bottom_klass, Klass*) \
volatile_nonstatic_field(Symbol, _refcount, int) \

View File

@ -189,3 +189,4 @@ af9e8b0f1900b631a8a0fcccff9f1514fe58c808 jdk8-b59
5cf3c69a93d6d088a1cdfa28031d4f0f9438c0de jdk8-b65
e6af1ad464e3d9b1154b9f9ed9a5373b97d129fc jdk8-b66
83df3493ca3cf0be077f1d0dd90119456f266f54 jdk8-b67
b854e70084214e9dcf1b37373f6e4b1a68760e03 jdk8-b68

View File

@ -189,3 +189,4 @@ d265b9b4c0f55c23a1c9fda02a8052fd9df2eec5 jdk8-b62
fbe54291c9d337ea4dfef4d846f1d9a22f76249c jdk8-b65
3eb7f11cb4e000555c1b6f0f1a10fe2919633c8e jdk8-b66
eb06aa51dfc225614dba2d89ae7ca6cedddff982 jdk8-b67
d3fe408f3a9ad250bc9a4e9365bdfc3f28c1d3f4 jdk8-b68

View File

@ -189,3 +189,4 @@ f117a3e06f78a258074674ad17601f99bcb1ce0d jdk8-b63
130d3a54d28becaac0846137256c2684adb34c33 jdk8-b65
4d337fae2250135729ee9ed2bf8baf3c60da5d6d jdk8-b66
ce9b02a3a17edd1983201002cfa0f364e4ab7524 jdk8-b67
53fb43e4d614c92310e1fb00ec41d1960fd9facf jdk8-b68

View File

@ -35,7 +35,7 @@ SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
include $(BUILDDIR)/common/Defs.gmk
SUBDIRS = auth
SUBDIRS_misc = jgss sasl auth/module
SUBDIRS_misc = jgss sasl auth/module ntlm
include $(BUILDDIR)/common/Subdirs.gmk
all build clean clobber::

View File

@ -0,0 +1,39 @@
#
# Copyright (c) 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.
#
BUILDDIR = ../../../..
PACKAGE = com.sun.security.ntlm
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
#
# Files
#
AUTO_FILES_JAVA_DIRS = com/sun/security/ntlm
#
# Rules
#
include $(BUILDDIR)/common/Classes.gmk

View File

@ -40,7 +40,8 @@ AUTO_FILES_JAVA_DIRS = java/security
# Directories
#
PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security
# The default security properties file is for linux
PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-linux
ifeq ($(PLATFORM), solaris)
PROPS_SRC = $(TOPDIR)/src/share/lib/security/java.security-solaris

View File

@ -38,10 +38,12 @@ SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
include $(BUILDDIR)/common/Defs.gmk
# build sun/security/jgss/wrapper on non-windows platform
# build sun/security/jgss/wrapper on non-windows non-macosx platforms
JGSS_WRAPPER =
ifneq ($(PLATFORM), windows)
JGSS_WRAPPER = jgss/wrapper
ifneq ($(PLATFORM), macosx)
JGSS_WRAPPER = jgss/wrapper
endif
endif
# Build PKCS#11 on all platforms

View File

@ -29,6 +29,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -86,7 +87,23 @@ class Bundle {
private final static String[] ERA_KEYS = {
"long.Eras",
"Eras",
"short.Eras"
"narrow.Eras"
};
// Keys for individual time zone names
private final static String TZ_GEN_LONG_KEY = "timezone.displayname.generic.long";
private final static String TZ_GEN_SHORT_KEY = "timezone.displayname.generic.short";
private final static String TZ_STD_LONG_KEY = "timezone.displayname.standard.long";
private final static String TZ_STD_SHORT_KEY = "timezone.displayname.standard.short";
private final static String TZ_DST_LONG_KEY = "timezone.displayname.daylight.long";
private final static String TZ_DST_SHORT_KEY = "timezone.displayname.daylight.short";
private final static String[] ZONE_NAME_KEYS = {
TZ_STD_LONG_KEY,
TZ_STD_SHORT_KEY,
TZ_DST_LONG_KEY,
TZ_DST_SHORT_KEY,
TZ_GEN_LONG_KEY,
TZ_GEN_SHORT_KEY
};
private final String id;
@ -98,6 +115,7 @@ class Bundle {
return bundles.get(id);
}
@SuppressWarnings("ConvertToStringSwitch")
Bundle(String id, String cldrPath, String bundles, String currencies) {
this.id = id;
this.cldrPath = cldrPath;
@ -242,9 +260,12 @@ class Bundle {
// handle multiple inheritance for month and day names
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthNames");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthAbbreviations");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "MonthNarrows");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayNames");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayAbbreviations");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "DayNarrows");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "AmPmMarkers");
handleMultipleInheritance(myMap, parentsMap, calendarPrefix + "narrow.AmPmMarkers");
adjustEraNames(myMap, calendarType);
@ -253,6 +274,99 @@ class Bundle {
handleDateTimeFormatPatterns(DATETIME_PATTERN_KEYS, myMap, parentsMap, calendarType, "DateTimePatterns");
}
// if myMap has any empty timezone or metazone names, weed out them.
// Fill in any missing abbreviations if locale is "en".
for (Iterator<String> it = myMap.keySet().iterator(); it.hasNext();) {
String key = it.next();
if (key.startsWith(CLDRConverter.TIMEZONE_ID_PREFIX)
|| key.startsWith(CLDRConverter.METAZONE_ID_PREFIX)) {
@SuppressWarnings("unchecked")
Map<String, String> nameMap = (Map<String, String>) myMap.get(key);
if (nameMap.isEmpty()) {
// Some zones have only exemplarCity, which become empty.
// Remove those from the map.
it.remove();
continue;
}
if (id.startsWith("en")) {
fillInAbbrs(key, nameMap);
}
}
}
for (Iterator<String> it = myMap.keySet().iterator(); it.hasNext();) {
String key = it.next();
if (key.startsWith(CLDRConverter.TIMEZONE_ID_PREFIX)
|| key.startsWith(CLDRConverter.METAZONE_ID_PREFIX)) {
@SuppressWarnings("unchecked")
Map<String, String> nameMap = (Map<String, String>) myMap.get(key);
// Convert key/value pairs to an array.
String[] names = new String[ZONE_NAME_KEYS.length];
int ix = 0;
for (String nameKey : ZONE_NAME_KEYS) {
String name = nameMap.get(nameKey);
if (name == null) {
@SuppressWarnings("unchecked")
Map<String, String> parentNames = (Map<String, String>) parentsMap.get(key);
if (parentNames != null) {
name = parentNames.get(nameKey);
}
}
names[ix++] = name;
}
if (hasNulls(names)) {
String metaKey = toMetaZoneKey(key);
if (metaKey != null) {
Object obj = myMap.get(metaKey);
if (obj instanceof String[]) {
String[] metaNames = (String[]) obj;
for (int i = 0; i < names.length; i++) {
if (names[i] == null) {
names[i] = metaNames[i];
}
}
} else if (obj instanceof Map) {
@SuppressWarnings("unchecked")
Map<String, String> m = (Map<String, String>) obj;
for (int i = 0; i < names.length; i++) {
if (names[i] == null) {
names[i] = m.get(ZONE_NAME_KEYS[i]);
}
}
}
}
// If there are still any nulls, try filling in them from en data.
if (hasNulls(names) && !id.equals("en")) {
@SuppressWarnings("unchecked")
String[] enNames = (String[]) Bundle.getBundle("en").getTargetMap().get(key);
if (enNames == null) {
if (metaKey != null) {
@SuppressWarnings("unchecked")
String[] metaNames = (String[]) Bundle.getBundle("en").getTargetMap().get(metaKey);
enNames = metaNames;
}
}
if (enNames != null) {
for (int i = 0; i < names.length; i++) {
if (names[i] == null) {
names[i] = enNames[i];
}
}
}
// If there are still nulls, give up names.
if (hasNulls(names)) {
names = null;
}
}
}
// replace the Map with the array
if (names != null) {
myMap.put(key, names);
} else {
it.remove();
}
}
}
return myMap;
}
@ -352,20 +466,10 @@ class Bundle {
realKeys[index] = realKey;
eraNames[index++] = value;
}
if (eraNames[0] != null) {
if (eraNames[1] != null) {
if (eraNames[2] == null) {
// Eras -> short.Eras
// long.Eras -> Eras
map.put(realKeys[2], map.get(realKeys[1]));
map.put(realKeys[1], map.get(realKeys[0]));
}
} else {
// long.Eras -> Eras
map.put(realKeys[1], map.get(realKeys[0]));
for (int i = 0; i < eraNames.length; i++) {
if (eraNames[i] == null) {
map.put(realKeys[i], null);
}
// remove long.Eras
map.remove(realKeys[0]);
}
}
@ -473,6 +577,86 @@ class Bundle {
return jrePattern.toString();
}
private String toMetaZoneKey(String tzKey) {
if (tzKey.startsWith(CLDRConverter.TIMEZONE_ID_PREFIX)) {
String tz = tzKey.substring(CLDRConverter.TIMEZONE_ID_PREFIX.length());
String meta = CLDRConverter.handlerMetaZones.get(tz);
if (meta != null) {
return CLDRConverter.METAZONE_ID_PREFIX + meta;
}
}
return null;
}
private void fillInAbbrs(String key, Map<String, String> map) {
fillInAbbrs(TZ_STD_LONG_KEY, TZ_STD_SHORT_KEY, map);
fillInAbbrs(TZ_DST_LONG_KEY, TZ_DST_SHORT_KEY, map);
fillInAbbrs(TZ_GEN_LONG_KEY, TZ_GEN_SHORT_KEY, map);
// If the standard std is "Standard Time" and daylight std is "Summer Time",
// replace the standard std with the generic std to avoid using
// the same abbrivation except for Australia time zone names.
String std = map.get(TZ_STD_SHORT_KEY);
String dst = map.get(TZ_DST_SHORT_KEY);
String gen = map.get(TZ_GEN_SHORT_KEY);
if (std != null) {
if (dst == null) {
// if dst is null, create long and short names from the standard
// std. ("Something Standard Time" to "Something Daylight Time",
// or "Something Time" to "Something Summer Time")
String name = map.get(TZ_STD_LONG_KEY);
if (name != null) {
if (name.contains("Standard Time")) {
name = name.replace("Standard Time", "Daylight Time");
} else if (name.endsWith("Mean Time")) {
name = name.replace("Mean Time", "Summer Time");
} else if (name.endsWith(" Time")) {
name = name.replace(" Time", " Summer Time");
}
map.put(TZ_DST_LONG_KEY, name);
fillInAbbrs(TZ_DST_LONG_KEY, TZ_DST_SHORT_KEY, map);
}
}
if (gen == null) {
String name = map.get(TZ_STD_LONG_KEY);
if (name != null) {
if (name.endsWith("Standard Time")) {
name = name.replace("Standard Time", "Time");
} else if (name.endsWith("Mean Time")) {
name = name.replace("Mean Time", "Time");
}
map.put(TZ_GEN_LONG_KEY, name);
fillInAbbrs(TZ_GEN_LONG_KEY, TZ_GEN_SHORT_KEY, map);
}
}
}
}
private void fillInAbbrs(String longKey, String shortKey, Map<String, String> map) {
String abbr = map.get(shortKey);
if (abbr == null) {
String name = map.get(longKey);
if (name != null) {
abbr = toAbbr(name);
if (abbr != null) {
map.put(shortKey, abbr);
}
}
}
}
private String toAbbr(String name) {
String[] substrs = name.split("\\s+");
StringBuilder sb = new StringBuilder();
for (String s : substrs) {
char c = s.charAt(0);
if (c >= 'A' && c <= 'Z') {
sb.append(c);
}
}
return sb.length() > 0 ? sb.toString() : null;
}
private void convert(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb) {
switch (cldrLetter) {
case 'G':
@ -539,4 +723,13 @@ class Bundle {
sb.append(c);
}
}
private static boolean hasNulls(Object[] array) {
for (int i = 0; i < array.length; i++) {
if (array[i] == null) {
return true;
}
}
return false;
}
}

View File

@ -30,8 +30,27 @@ import java.util.Map;
import java.util.SortedSet;
public interface BundleGenerator {
static enum BundleType {
PLAIN("java.util.ListResourceBundle"),
OPEN("sun.util.resources.OpenListResourceBundle"),
TIMEZONE("sun.util.resources.TimeZoneNamesBundle");
private final String pathName, className;
private BundleType(String name) {
pathName = name;
int x = name.lastIndexOf('.');
className = name.substring(x + 1);
}
String getPathName() {
return pathName;
}
String getClassName() {
return className;
}
};
public void generateBundle(String packageName, String baseName, String localeID,
boolean useJava, Map<String, ?> map, boolean open) throws IOException;
boolean useJava, Map<String, ?> map, BundleType type) throws IOException;
public void generateMetaInfo(Map<String, SortedSet<String>> metaInfo) throws IOException;
}

View File

@ -25,6 +25,7 @@
package build.tools.cldrconverter;
import build.tools.cldrconverter.BundleGenerator.BundleType;
import java.io.File;
import java.nio.file.DirectoryStream;
import java.nio.file.FileSystems;
@ -58,9 +59,8 @@ public class CLDRConverter {
static final String CURRENCY_SYMBOL_PREFIX = "currency.symbol.";
static final String CURRENCY_NAME_PREFIX = "currency.displayname.";
static final String TIMEZONE_ID_PREFIX = "timezone.id.";
static final String TIMEZONE_NAME_PREFIX = "timezone.displayname.";
static final String ZONE_NAME_PREFIX = "timezone.displayname.";
static final String METAZONE_ID_PREFIX = "metazone.id.";
static final String METAZONE_NAME_PREFIX = "metazone.displayname.";
private static SupplementDataParseHandler handlerSuppl;
static NumberingSystemsParseHandler handlerNumbering;
@ -236,7 +236,14 @@ public class CLDRConverter {
if (sb.indexOf("root") == -1) {
sb.append("root");
}
retList.add(new Bundle(id, sb.toString(), null, null));
Bundle b = new Bundle(id, sb.toString(), null, null);
// Insert the bundle for en at the top so that it will get
// processed first.
if ("en".equals(id)) {
retList.add(0, b);
} else {
retList.add(b);
}
}
}
}
@ -312,6 +319,7 @@ public class CLDRConverter {
Map<String, SortedSet<String>> metaInfo = new HashMap<>();
metaInfo.put("LocaleNames", new TreeSet<String>());
metaInfo.put("CurrencyNames", new TreeSet<String>());
metaInfo.put("TimeZoneNames", new TreeSet<String>());
metaInfo.put("CalendarData", new TreeSet<String>());
metaInfo.put("FormatData", new TreeSet<String>());
@ -348,24 +356,28 @@ public class CLDRConverter {
Map<String, Object> localeNamesMap = extractLocaleNames(targetMap, bundle.getID());
if (!localeNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("LocaleNames").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "LocaleNames", bundle.getID(), true, localeNamesMap, true);
bundleGenerator.generateBundle("util", "LocaleNames", bundle.getID(), true, localeNamesMap, BundleType.OPEN);
}
}
if (bundleTypes.contains(Bundle.Type.CURRENCYNAMES)) {
Map<String, Object> currencyNamesMap = extractCurrencyNames(targetMap, bundle.getID(), bundle.getCurrencies());
if (!currencyNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("CurrencyNames").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "CurrencyNames", bundle.getID(), true, currencyNamesMap, true);
bundleGenerator.generateBundle("util", "CurrencyNames", bundle.getID(), true, currencyNamesMap, BundleType.OPEN);
}
}
if (bundleTypes.contains(Bundle.Type.TIMEZONENAMES)) {
Map<String, Object> zoneNamesMap = extractZoneNames(targetMap, bundle.getID());
if (!zoneNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("TimeZoneNames").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "TimeZoneNames", bundle.getID(), true, zoneNamesMap, BundleType.TIMEZONE);
}
}
if (bundleTypes.contains(Bundle.Type.CALENDARDATA)) {
Map<String, Object> calendarDataMap = extractCalendarData(targetMap, bundle.getID());
if (!calendarDataMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("CalendarData").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "CalendarData", bundle.getID(), true, calendarDataMap, false);
bundleGenerator.generateBundle("util", "CalendarData", bundle.getID(), true, calendarDataMap, BundleType.PLAIN);
}
}
if (bundleTypes.contains(Bundle.Type.FORMATDATA)) {
@ -373,9 +385,10 @@ public class CLDRConverter {
// LocaleData.getAvailableLocales depends on having FormatData bundles around
if (!formatDataMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("FormatData").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("text", "FormatData", bundle.getID(), true, formatDataMap, false);
bundleGenerator.generateBundle("text", "FormatData", bundle.getID(), true, formatDataMap, BundleType.PLAIN);
}
}
// For testing
SortedSet<String> allLocales = new TreeSet<>();
allLocales.addAll(metaInfo.get("CurrencyNames"));
@ -431,6 +444,7 @@ public class CLDRConverter {
private KeyComparator() {
}
@Override
public int compare(String o1, String o2) {
int len1 = o1.length();
int len2 = o2.length();
@ -476,7 +490,26 @@ public class CLDRConverter {
}
private static Map<String, Object> extractZoneNames(Map<String, Object> map, String id) {
return null;
Map<String, Object> names = new HashMap<>();
for (String tzid : handlerMetaZones.keySet()) {
String tzKey = TIMEZONE_ID_PREFIX + tzid;
Object data = map.get(tzKey);
if (data instanceof String[]) {
names.put(tzid, data);
} else {
String meta = handlerMetaZones.get(tzid);
if (meta != null) {
String metaKey = METAZONE_ID_PREFIX + meta;
data = map.get(metaKey);
if (data instanceof String[]) {
// Keep the metazone prefix here.
names.put(metaKey, data);
names.put(tzid, meta);
}
}
}
}
return names;
}
private static Map<String, Object> extractCalendarData(Map<String, Object> map, String id) {
@ -494,11 +527,19 @@ public class CLDRConverter {
copyIfPresent(map, prefix + "standalone.MonthNames", formatData);
copyIfPresent(map, prefix + "MonthAbbreviations", formatData);
copyIfPresent(map, prefix + "standalone.MonthAbbreviations", formatData);
copyIfPresent(map, prefix + "MonthNarrow", formatData);
copyIfPresent(map, prefix + "standalone.MonthNarrows", formatData);
copyIfPresent(map, prefix + "DayNames", formatData);
copyIfPresent(map, prefix + "standalone.DayNames", formatData);
copyIfPresent(map, prefix + "DayAbbreviations", formatData);
copyIfPresent(map, prefix + "standalone.DayAbbreviations", formatData);
copyIfPresent(map, prefix + "DayNarrows", formatData);
copyIfPresent(map, prefix + "standalone.DayNarrows", formatData);
copyIfPresent(map, prefix + "AmPmMarkers", formatData);
copyIfPresent(map, prefix + "narrow.AmPmMarkers", formatData);
copyIfPresent(map, prefix + "long.Eras", formatData);
copyIfPresent(map, prefix + "Eras", formatData);
copyIfPresent(map, prefix + "short.Eras", formatData);
copyIfPresent(map, prefix + "narrow.Eras", formatData);
copyIfPresent(map, prefix + "TimePatterns", formatData);
copyIfPresent(map, prefix + "DatePatterns", formatData);
copyIfPresent(map, prefix + "DateTimePatterns", formatData);
@ -560,7 +601,6 @@ public class CLDRConverter {
if (x == 0 || escapeSpace) {
outBuffer.append('\\');
}
outBuffer.append(' ');
break;
case '\\':
@ -584,7 +624,7 @@ public class CLDRConverter {
outBuffer.append('f');
break;
default:
if (!USE_UTF8 && ((aChar < 0x0020) || (aChar > 0x007e))) {
if (aChar < 0x0020 || (!USE_UTF8 && aChar > 0x007e)) {
formatter.format("\\u%04x", (int)aChar);
} else {
if (specialSaveChars.indexOf(aChar) != -1) {

View File

@ -155,6 +155,9 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
case "abbreviated":
pushStringArrayEntry(qName, attributes, prefix + "MonthAbbreviations/" + getContainerKey(), 13);
break;
case "narrow":
pushStringArrayEntry(qName, attributes, prefix + "MonthNarrows/" + getContainerKey(), 13);
break;
default:
pushIgnoredContainer(qName);
break;
@ -191,6 +194,9 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
case "abbreviated":
pushStringArrayEntry(qName, attributes, prefix + "DayAbbreviations/" + getContainerKey(), 7);
break;
case "narrow":
pushStringArrayEntry(qName, attributes, prefix + "DayNarrows/" + getContainerKey(), 7);
break;
default:
pushIgnoredContainer(qName);
break;
@ -219,25 +225,36 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
case "dayPeriodWidth":
// for FormatData
// create string array entry for am/pm. only keeping wide
if ("wide".equals(attributes.getValue("type"))) {
switch (attributes.getValue("type")) {
case "wide":
pushStringArrayEntry(qName, attributes, "AmPmMarkers/" + getContainerKey(), 2);
} else {
break;
case "narrow":
pushStringArrayEntry(qName, attributes, "narrow.AmPmMarkers/" + getContainerKey(), 2);
break;
default:
pushIgnoredContainer(qName);
break;
}
break;
case "dayPeriod":
// for FormatData
// add to string array entry of AmPmMarkers element
switch (attributes.getValue("type")) {
case "am":
pushStringArrayElement(qName, attributes, 0);
break;
case "pm":
pushStringArrayElement(qName, attributes, 1);
break;
default:
if (attributes.getValue("alt") == null) {
switch (attributes.getValue("type")) {
case "am":
pushStringArrayElement(qName, attributes, 0);
break;
case "pm":
pushStringArrayElement(qName, attributes, 1);
break;
default:
pushIgnoredContainer(qName);
break;
}
} else {
// discard alt values
pushIgnoredContainer(qName);
break;
}
break;
case "eraNames":
@ -269,7 +286,7 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
assert currentContainer instanceof IgnoredContainer;
pushIgnoredContainer(qName);
} else {
String key = currentCalendarType.keyElementName() + "short.Eras";
String key = currentCalendarType.keyElementName() + "narrow.Eras";
pushStringArrayEntry(qName, attributes, key, currentCalendarType.getEraLength(qName));
}
break;
@ -301,15 +318,15 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
break;
case "zone":
{
String zone = attributes.getValue("type");
String tzid = attributes.getValue("type"); // Olson tz id
zonePrefix = CLDRConverter.TIMEZONE_ID_PREFIX;
put(zonePrefix + zone, new HashMap<String, String>());
pushKeyContainer(qName, attributes, zone);
put(zonePrefix + tzid, new HashMap<String, String>());
pushKeyContainer(qName, attributes, tzid);
}
break;
case "metazone":
{
String zone = attributes.getValue("type");
String zone = attributes.getValue("type"); // LDML meta zone id
zonePrefix = CLDRConverter.METAZONE_ID_PREFIX;
put(zonePrefix + zone, new HashMap<String, String>());
pushKeyContainer(qName, attributes, zone);
@ -323,16 +340,12 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
zoneNameStyle = "short";
pushContainer(qName, attributes);
break;
case "generic": // not used in JDK
pushIgnoredContainer(qName);
case "generic": // generic name
case "standard": // standard time name
case "daylight": // daylight saving (summer) time name
pushStringEntry(qName, attributes, CLDRConverter.ZONE_NAME_PREFIX + qName + "." + zoneNameStyle);
break;
case "standard": // standard time
pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "standard." + zoneNameStyle);
break;
case "daylight":
pushStringEntry(qName, attributes, CLDRConverter.TIMEZONE_NAME_PREFIX + "daylight." + zoneNameStyle);
break;
case "exemplarCity":
case "exemplarCity": // not used in JDK
pushIgnoredContainer(qName);
break;
@ -530,6 +543,7 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
case "timeZoneNames":
zonePrefix = null;
break;
case "generic":
case "standard":
case "daylight":
if (zonePrefix != null && (currentContainer instanceof Entry)) {

View File

@ -46,8 +46,9 @@ class MetaZonesParseHandler extends AbstractLDMLHandler<String> {
return null;
}
// metaZone: ID -> metazone
// per locale: ID -> names, metazone -> names
@Override
@SuppressWarnings("fallthrough")
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
switch (qName) {
case "timezone":

View File

@ -28,14 +28,16 @@ package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Formatter;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
class ResourceBundleGenerator implements BundleGenerator {
@Override
public void generateBundle(String packageName, String baseName, String localeID, boolean useJava,
Map<String, ?> map, boolean open) throws IOException {
Map<String, ?> map, BundleType type) throws IOException {
String suffix = useJava ? ".java" : ".properties";
String lang = CLDRConverter.getLanguageCode(localeID);
String dirName = CLDRConverter.DESTINATION_DIR + File.separator + "sun" + File.separator
@ -67,6 +69,28 @@ class ResourceBundleGenerator implements BundleGenerator {
encoding = "iso-8859-1";
}
Formatter fmt = null;
if (type == BundleType.TIMEZONE) {
fmt = new Formatter();
Set<String> metaKeys = new HashSet<>();
for (String key : map.keySet()) {
if (key.startsWith(CLDRConverter.METAZONE_ID_PREFIX)) {
String meta = key.substring(CLDRConverter.METAZONE_ID_PREFIX.length());
String[] value;
value = (String[]) map.get(key);
fmt.format(" final String[] %s = new String[] {\n", meta);
for (String s : value) {
fmt.format(" \"%s\",\n", CLDRConverter.saveConvert(s, useJava));
}
fmt.format(" };\n");
metaKeys.add(key);
}
}
for (String key : metaKeys) {
map.remove(key);
}
}
try (PrintWriter out = new PrintWriter(file, encoding)) {
// Output copyright headers
out.println(CopyrightHeaders.getOpenJDKCopyright());
@ -74,16 +98,15 @@ class ResourceBundleGenerator implements BundleGenerator {
if (useJava) {
out.println("package sun." + packageName + ";\n");
if (open) {
out.println("import sun.util.resources.OpenListResourceBundle;\n");
out.println("public class " + baseName + ("root".equals(localeID) ? "" : "_" + localeID) + " extends OpenListResourceBundle {");
} else {
out.println("import java.util.ListResourceBundle;\n");
out.println("public class " + baseName + ("root".equals(localeID) ? "" : "_" + localeID) + " extends ListResourceBundle {");
}
out.printf("import %s;\n\n", type.getPathName());
out.printf("public class %s%s extends %s {\n", baseName, "root".equals(localeID) ? "" : "_" + localeID, type.getClassName());
out.println(" @Override\n" +
" protected final Object[][] getContents() {\n" +
" final Object[][] data = new Object[][] {");
" protected final Object[][] getContents() {");
if (fmt != null) {
out.print(fmt.toString());
}
out.println(" final Object[][] data = new Object[][] {");
}
for (String key : map.keySet()) {
if (useJava) {
@ -91,7 +114,11 @@ class ResourceBundleGenerator implements BundleGenerator {
if (value == null) {
CLDRConverter.warning("null value for " + key);
} else if (value instanceof String) {
out.println(" { \"" + key + "\", \"" + CLDRConverter.saveConvert((String) value, useJava) + "\" },");
if (type == BundleType.TIMEZONE) {
out.printf(" { \"%s\", %s },\n", key, CLDRConverter.saveConvert((String) value, useJava));
} else {
out.printf(" { \"%s\", \"%s\" },\n", key, CLDRConverter.saveConvert((String) value, useJava));
}
} else if (value instanceof String[]) {
String[] values = (String[]) value;
out.println(" { \"" + key + "\",\n new String[] {");

View File

@ -90,14 +90,11 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\
ARFLAGS:=$(ARFLAGS),\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm))
BUILD_LIBRARIES += $(BUILD_LIBFDLIBM)
else
#
# On macosx they do partial (incremental) linking of fdlibm
# code it here...rather than add support to NativeCompilation
# as this is firt time I see it
$(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\
# On macosx the old build does partial (incremental) linking of fdlibm instead of
# a plain static library.
$(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM_MAC,\
LIBRARY:=fdlibm,\
OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm,\
SRC:=$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/src,\
@ -107,11 +104,12 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\
LDFLAGS:=-nostdlib -r -arch x86_64,\
OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm))
$(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) : $(BUILD_LIBFDLIBM)
BUILD_LIBFDLIBM := $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
$(BUILD_LIBFDLIBM) : $(BUILD_LIBFDLIBM_MAC)
$(CP) -a $< $@
BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
endif
BUILD_LIBRARIES += $(BUILD_LIBFDLIBM)
##########################################################################################
@ -2540,6 +2538,7 @@ BUILD_LIBRARIES += $(BUILD_LIBJ2PCSC)
##########################################################################################
ifneq ($(OPENJDK_TARGET_OS), windows)
ifneq ($(OPENJDK_TARGET_OS), macosx)
$(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\
LIBRARY:=j2gss,\
OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
@ -2559,6 +2558,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\
BUILD_LIBRARIES += $(BUILD_LIBJ2GSS)
endif
endif
##########################################################################################

View File

@ -356,21 +356,9 @@ COPY_FILES += $(JVMCFG)
##########################################################################################
PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security
PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-$(OPENJDK_TARGET_OS)
PROPS_DST := $(JDK_OUTPUTDIR)/lib/security/java.security
ifeq ($(OPENJDK_TARGET_OS), solaris)
PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-solaris
endif
ifeq ($(OPENJDK_TARGET_OS), windows)
PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-windows
endif
ifeq ($(OPENJDK_TARGET_OS), macosx)
PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-macosx
endif
$(PROPS_DST): $(PROPS_SRC)
$(MKDIR) -p $(@D)
$(RM) $@

View File

@ -810,9 +810,8 @@ EXPORTED_PRIVATE_PKGS = com.sun.servicetag \
$(IMAGES_OUTPUTDIR)/symbols/_the.symbols: $(IMAGES_OUTPUTDIR)/lib/rt.jar
$(RM) -r $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
$(MKDIR) -p $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
$(JAVA) \
-Xbootclasspath/a:$(JDK_OUTPUTDIR)/classes \
$(JAVAC_JARS) \
$(JAVA) $(JAVAC_JARS) \
-bootclasspath $(JDK_OUTPUTDIR)/classes \
-XDprocess.packages -proc:only \
-processor com.sun.tools.javac.sym.CreateSymbols \
-Acom.sun.tools.javac.sym.Jar=$(IMAGES_OUTPUTDIR)/lib/rt.jar \

View File

@ -210,9 +210,9 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
* and DialogPeer interfaces.
*/
private LWWindowPeer createDelegatedPeer(Window target, PlatformComponent platformComponent,
PlatformWindow platformWindow)
PlatformWindow platformWindow, LWWindowPeer.PeerType peerType)
{
LWWindowPeer peer = new LWWindowPeer(target, platformComponent, platformWindow);
LWWindowPeer peer = new LWWindowPeer(target, platformComponent, platformWindow, peerType);
targetCreatedPeer(target, peer);
peer.initialize();
return peer;
@ -222,22 +222,29 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
public WindowPeer createWindow(Window target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.SIMPLEWINDOW);
return createDelegatedPeer(target, platformComponent, platformWindow);
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.SIMPLEWINDOW);
}
@Override
public FramePeer createFrame(Frame target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.FRAME);
return createDelegatedPeer(target, platformComponent, platformWindow);
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.FRAME);
}
public LWWindowPeer createEmbeddedFrame(CEmbeddedFrame target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.EMBEDDEDFRAME);
return createDelegatedPeer(target, platformComponent, platformWindow);
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.EMBEDDED_FRAME);
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.EMBEDDED_FRAME);
}
public LWWindowPeer createEmbeddedFrame(CViewEmbeddedFrame target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.VIEW_EMBEDDED_FRAME);
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.VIEW_EMBEDDED_FRAME);
}
CPrinterDialogPeer createCPrinterDialog(CPrinterDialog target) {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.DIALOG);
@ -254,7 +261,7 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
PlatformComponent platformComponent = createPlatformComponent();
PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.DIALOG);
return createDelegatedPeer(target, platformComponent, platformWindow);
return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.DIALOG);
}
@Override

View File

@ -47,7 +47,8 @@ public class LWWindowPeer
SIMPLEWINDOW,
FRAME,
DIALOG,
EMBEDDEDFRAME
EMBEDDED_FRAME,
VIEW_EMBEDDED_FRAME
}
private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWWindowPeer");
@ -108,6 +109,8 @@ public class LWWindowPeer
private volatile boolean textured;
private final PeerType peerType;
/**
* Current modal blocker or null.
*
@ -116,10 +119,11 @@ public class LWWindowPeer
private LWWindowPeer blocker;
public LWWindowPeer(Window target, PlatformComponent platformComponent,
PlatformWindow platformWindow)
PlatformWindow platformWindow, PeerType peerType)
{
super(target, platformComponent);
this.platformWindow = platformWindow;
this.peerType = peerType;
Window owner = target.getOwner();
LWWindowPeer ownerPeer = (owner != null) ? (LWWindowPeer)owner.getPeer() : null;
@ -275,6 +279,11 @@ public class LWWindowPeer
@Override
public void setBounds(int x, int y, int w, int h, int op) {
if((op & NO_EMBEDDED_CHECK) == 0 && getPeerType() == PeerType.VIEW_EMBEDDED_FRAME) {
return;
}
if ((op & SET_CLIENT_SIZE) != 0) {
// SET_CLIENT_SIZE is only applicable to window peers, so handle it here
// instead of pulling 'insets' field up to LWComponentPeer
@ -1210,6 +1219,10 @@ public class LWWindowPeer
return this == grabbingWindow;
}
public PeerType getPeerType() {
return peerType;
}
@Override
public String toString() {
return super.toString() + " [target is " + getTarget() + "]";

View File

@ -151,4 +151,6 @@ public interface PlatformWindow {
public long getLayerPtr();
public LWWindowPeer getPeer();
public boolean isUnderMouse();
}

View File

@ -26,7 +26,6 @@
package sun.lwawt.macosx;
import java.awt.Window;
import sun.lwawt.LWMouseInfoPeer;
import sun.lwawt.LWWindowPeer;
@ -41,10 +40,6 @@ public class CMouseInfoPeer extends LWMouseInfoPeer
return false;
}
LWWindowPeer peer = (LWWindowPeer)w.getPeer();
CPlatformWindow platformWindow = (CPlatformWindow)peer.getPlatformWindow();
return nativeIsWindowUnderMouse(platformWindow.getNSWindowPtr());
return ((LWWindowPeer)w.getPeer()).getPlatformWindow().isUnderMouse();
}
private static native boolean nativeIsWindowUnderMouse(long ptr);
}

View File

@ -25,16 +25,13 @@
package sun.lwawt.macosx;
import sun.lwawt.PlatformWindow;
import sun.lwawt.LWWindowPeer;
import sun.java2d.opengl.CGLLayer;
import sun.java2d.SurfaceData;
import sun.awt.CausedFocusEvent;
import java.awt.*;
import sun.awt.CausedFocusEvent;
import sun.java2d.SurfaceData;
import sun.java2d.opengl.CGLLayer;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.LWWindowPeer.PeerType;
import sun.lwawt.PlatformWindow;
import sun.util.logging.PlatformLogger;
/*
@ -134,6 +131,7 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
// This method should be properly implemented for applets.
// It returns null just as a stub.
@Override
public PlatformWindow getTopmostPlatformWindowUnderMouse() { return null; }
@Override
@ -192,4 +190,13 @@ public class CPlatformEmbeddedFrame implements PlatformWindow {
@Override
public void setModalBlocked(boolean blocked) {}
/*
* The method could not be implemented due to CALayer restrictions.
* The exeption enforce clients not to use it.
*/
@Override
public boolean isUnderMouse() {
throw new RuntimeException("Not implemented");
}
}

View File

@ -26,8 +26,11 @@
package sun.lwawt.macosx;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.image.VolatileImage;
import sun.awt.CGraphicsConfig;
import sun.awt.CGraphicsEnvironment;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.macosx.event.NSEvent;
@ -37,6 +40,10 @@ import sun.java2d.opengl.CGLSurfaceData;
public class CPlatformView extends CFRetainedResource {
private native long nativeCreateView(int x, int y, int width, int height, long windowLayerPtr);
private static native void nativeSetAutoResizable(long awtView, boolean toResize);
private static native int nativeGetNSViewDisplayID(long awtView);
private static native Rectangle2D nativeGetLocationOnScreen(long awtView);
private static native boolean nativeIsViewUnderMouse(long ptr);
private LWWindowPeer peer;
private SurfaceData surfaceData;
@ -59,7 +66,7 @@ public class CPlatformView extends CFRetainedResource {
public long getAWTView() {
return ptr;
}
}
public boolean isOpaque() {
return !peer.isTranslucent();
@ -158,10 +165,46 @@ public class CPlatformView extends CFRetainedResource {
}
}
public void setAutoResizable(boolean toResize) {
nativeSetAutoResizable(this.getAWTView(), toResize);
}
public boolean isUnderMouse() {
return nativeIsViewUnderMouse(getAWTView());
}
public GraphicsDevice getGraphicsDevice() {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
CGraphicsEnvironment cge = (CGraphicsEnvironment)ge;
int displayID = nativeGetNSViewDisplayID(getAWTView());
GraphicsDevice gd = cge.getScreenDevice(displayID);
if (gd == null) {
// this could possibly happen during device removal
// use the default screen device in this case
gd = ge.getDefaultScreenDevice();
}
return gd;
}
public Point getLocationOnScreen() {
Rectangle r = nativeGetLocationOnScreen(this.getAWTView()).getBounds();
return new Point(r.x, r.y);
}
// ----------------------------------------------------------------------
// NATIVE CALLBACKS
// ----------------------------------------------------------------------
/*
* The callback is called only in the embedded case when the view is
* automatically resized by the superview.
* In normal mode this method is never called.
*/
private void deliverResize(int x, int y, int w, int h) {
peer.notifyReshape(x, y, w, h);
}
private void deliverMouseEvent(NSEvent event) {
int x = event.getX();
int y = getBounds().height - event.getY();

View File

@ -64,8 +64,6 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor
private static native void nativeDispose(long nsWindowPtr);
private static native CPlatformWindow nativeGetTopmostPlatformWindowUnderMouse();
private static native int nativeGetNSWindowDisplayID(long nsWindowPtr);
// Loger to report issues happened during execution but that do not affect functionality
private static final PlatformLogger logger = PlatformLogger.getLogger("sun.lwawt.macosx.CPlatformWindow");
private static final PlatformLogger focusLogger = PlatformLogger.getLogger("sun.lwawt.macosx.focus.CPlatformWindow");
@ -211,9 +209,8 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor
private CPlatformResponder responder;
private volatile boolean zoomed = false; // from native perspective
public CPlatformWindow(final PeerType peerType) {
public CPlatformWindow() {
super(0, true);
assert (peerType == PeerType.SIMPLEWINDOW || peerType == PeerType.DIALOG || peerType == PeerType.FRAME);
}
/*
@ -429,16 +426,7 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor
@Override
public GraphicsDevice getGraphicsDevice() {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
CGraphicsEnvironment cge = (CGraphicsEnvironment)ge;
int displayID = nativeGetNSWindowDisplayID(getNSWindowPtr());
GraphicsDevice gd = cge.getScreenDevice(displayID);
if (gd == null) {
// this could possibly happen during device removal
// use the default screen device in this case
gd = ge.getDefaultScreenDevice();
}
return gd;
return contentView.getGraphicsDevice();
}
@Override // PlatformWindow
@ -833,6 +821,11 @@ public final class CPlatformWindow extends CFRetainedResource implements Platfor
return peer;
}
@Override
public boolean isUnderMouse() {
return contentView.isUnderMouse();
}
public CPlatformView getContentView() {
return contentView;
}

View File

@ -41,7 +41,7 @@ public class CPrinterDialogPeer extends LWWindowPeer {
public CPrinterDialogPeer(CPrinterDialog target, PlatformComponent platformComponent,
PlatformWindow platformWindow)
{
super(target, platformComponent, platformWindow);
super(target, platformComponent, platformWindow, LWWindowPeer.PeerType.DIALOG);
//super(target);
fTarget = target;
super.initialize();

View File

@ -0,0 +1,102 @@
/*
* Copyright (c) 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.
*/
package sun.lwawt.macosx;
import java.awt.AWTKeyStroke;
import java.awt.Toolkit;
import java.lang.reflect.InvocationTargetException;
import sun.awt.EmbeddedFrame;
import sun.lwawt.LWToolkit;
import sun.lwawt.LWWindowPeer;
/*
* The CViewEmbeddedFrame class is used in the SWT_AWT bridge.
* This is a part of public API and should not be renamed or moved
*/
public class CViewEmbeddedFrame extends EmbeddedFrame {
private final long nsViewPtr;
private boolean isActive = false;
public CViewEmbeddedFrame(long nsViewPtr) {
this.nsViewPtr = nsViewPtr;
}
@SuppressWarnings("deprecation")
@Override
public void addNotify() {
if (getPeer() == null) {
LWToolkit toolkit = (LWToolkit) Toolkit.getDefaultToolkit();
setPeer(toolkit.createEmbeddedFrame(this));
}
super.addNotify();
}
public long getEmbedderHandle() {
return nsViewPtr;
}
@Override
public void registerAccelerator(AWTKeyStroke awtks) {
}
@Override
public void unregisterAccelerator(AWTKeyStroke awtks) {
}
public boolean isParentWindowActive() {
return isActive;
}
/*
* Synthetic event delivery for focus management
*/
@Override
public void synthesizeWindowActivation(boolean activated) {
if (isActive != activated) {
isActive = activated;
((LWWindowPeer)getPeer()).notifyActivation(activated, null);
}
}
/*
* Initializes the embedded frame bounds and validates a component.
* Designed to be called from the main thread
* This method should be called once from the initialization of the SWT_AWT Bridge
*/
@SuppressWarnings("deprecation")
public void validateWithBounds(final int x, final int y, final int width, final int height) {
try {
LWCToolkit.invokeAndWait(new Runnable() {
@Override
public void run() {
((LWWindowPeer) getPeer()).setBoundsPrivate(0, 0, width, height);
validate();
setVisible(true);
}
}, null);
} catch (InterruptedException | InvocationTargetException ex) {}
}
}

View File

@ -0,0 +1,211 @@
/*
* Copyright (c) 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.
*/
package sun.lwawt.macosx;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.GraphicsDevice;
import java.awt.Insets;
import java.awt.MenuBar;
import java.awt.Point;
import java.awt.Window;
import sun.awt.CausedFocusEvent.Cause;
import sun.java2d.SurfaceData;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.PlatformWindow;
public class CViewPlatformEmbeddedFrame implements PlatformWindow {
private CPlatformView view;
private LWWindowPeer peer;
private CViewEmbeddedFrame target;
private CPlatformResponder responder;
@Override // PlatformWindow
public void initialize(Window target, final LWWindowPeer peer, PlatformWindow owner) {
this.peer = peer;
this.target = (CViewEmbeddedFrame) target;
responder = new CPlatformResponder(peer, false);
view = new CPlatformView();
view.initialize(peer, responder);
CWrapper.NSView.addSubview(this.target.getEmbedderHandle(), view.getAWTView());
view.setAutoResizable(true);
}
public long getNSViewPtr() {
return view.getAWTView();
}
@Override
public long getLayerPtr() {
return view.getWindowLayerPtr();
}
@Override
public LWWindowPeer getPeer() {
return peer;
}
@Override
public void dispose() {
CWrapper.NSView.removeFromSuperview(view.getAWTView());
view.dispose();
}
@Override
public void setVisible(boolean visible) {
CWrapper.NSView.setHidden(view.getAWTView(), !visible);
}
@Override
public void setTitle(String title) {
}
@Override
public void setBounds(int x, int y, int w, int h) {
view.setBounds(x, y, w, h);
peer.notifyReshape(x, y, w, h);
}
@Override
public GraphicsDevice getGraphicsDevice() {
return view.getGraphicsDevice();
}
@Override
public Point getLocationOnScreen() {
return view.getLocationOnScreen();
}
@Override
public Insets getInsets() {
return new Insets(0, 0, 0, 0);
}
@Override
public FontMetrics getFontMetrics(Font f) {
throw new RuntimeException("Not implemented");
}
@Override
public SurfaceData getScreenSurface() {
return view.getSurfaceData();
}
@Override
public SurfaceData replaceSurfaceData() {
return view.replaceSurfaceData();
}
@Override
public void setModalBlocked(boolean blocked) {
}
@Override
public void toFront() {
}
@Override
public void toBack() {
}
@Override
public void setMenuBar(MenuBar mb) {
}
@Override
public void setAlwaysOnTop(boolean value) {
}
@Override
public PlatformWindow getTopmostPlatformWindowUnderMouse() {
return null;
}
@Override
public void updateFocusableWindowState() {
}
@Override
public boolean rejectFocusRequest(Cause cause) {
return false;
}
@Override
public boolean requestWindowFocus() {
return true;
}
@Override
public boolean isActive() {
return target.isParentWindowActive();
}
@Override
public void setResizable(boolean resizable) {
}
@Override
public void setSizeConstraints(int minW, int minH, int maxW, int maxH) {
}
@Override
public Graphics transformGraphics(Graphics g) {
return g;
}
@Override
public void updateIconImages() {
}
@Override
public void setOpacity(float opacity) {
}
@Override
public void setOpaque(boolean isOpaque) {
}
@Override
public void enterFullScreenMode() {
}
@Override
public void exitFullScreenMode() {
}
@Override
public void setWindowState(int windowState) {
}
@Override
public boolean isUnderMouse() {
return view.isUnderMouse();
}
}

View File

@ -85,6 +85,8 @@ public final class CWrapper {
public static native void enterFullScreenMode(long view);
public static native void exitFullScreenMode(long view);
public static native void setHidden(long view, boolean hidden);
}
public static final class NSObject {

View File

@ -156,10 +156,13 @@ public final class LWCToolkit extends LWToolkit {
@Override
protected PlatformWindow createPlatformWindow(PeerType peerType) {
if (peerType == PeerType.EMBEDDEDFRAME) {
if (peerType == PeerType.EMBEDDED_FRAME) {
return new CPlatformEmbeddedFrame();
} else if (peerType == PeerType.VIEW_EMBEDDED_FRAME) {
return new CViewPlatformEmbeddedFrame();
} else {
return new CPlatformWindow(peerType);
assert (peerType == PeerType.SIMPLEWINDOW || peerType == PeerType.DIALOG || peerType == PeerType.FRAME);
return new CPlatformWindow();
}
}

View File

@ -99,17 +99,16 @@ Java_sun_lwawt_macosx_CPlatformComponent_nativeCreateComponent
__block AWTSurfaceLayers *surfaceLayers = nil;
JNF_COCOA_ENTER(env);
AWT_ASSERT_NOT_APPKIT_THREAD;
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
AWT_ASSERT_APPKIT_THREAD;
CALayer *windowLayer = jlong_to_ptr(windowLayerPtr);
surfaceLayers = [[AWTSurfaceLayers alloc] initWithWindowLayer: windowLayer];
CFRetain(surfaceLayers);
[surfaceLayers release];
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
AWT_ASSERT_APPKIT_THREAD;
CALayer *windowLayer = jlong_to_ptr(windowLayerPtr);
surfaceLayers = [[AWTSurfaceLayers alloc] initWithWindowLayer: windowLayer];
CFRetain(surfaceLayers);
[surfaceLayers release];
}];
JNF_COCOA_EXIT(env);
return ptr_to_jlong(surfaceLayers);
@ -126,12 +125,13 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformComponent_nativeSetBounds
JNF_COCOA_ENTER(env);
AWTSurfaceLayers *surfaceLayers = OBJC(surfaceLayersPtr);
[JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
AWT_ASSERT_APPKIT_THREAD;
CGRect rect = CGRectMake(x, y, width, height);
[surfaceLayers setBounds: rect];
}];
}];
JNF_COCOA_EXIT(env);
}

View File

@ -83,6 +83,7 @@ AWT_ASSERT_APPKIT_THREAD;
mouseIsOver = NO;
[self resetTrackingArea];
[self setAutoresizesSubviews:NO];
if (windowLayer != nil) {
self.cglLayer = windowLayer;
@ -174,6 +175,11 @@ AWT_ASSERT_APPKIT_THREAD;
* Automatically triggered functions.
*/
- (void)resizeWithOldSuperviewSize:(NSSize)oldBoundsSize {
[super resizeWithOldSuperviewSize: oldBoundsSize];
[self deliverResize: [self frame]];
}
/*
* MouseEvents support
*/
@ -437,6 +443,18 @@ AWT_ASSERT_APPKIT_THREAD;
}
}
-(void) deliverResize: (NSRect) rect {
jint x = (jint) rect.origin.x;
jint y = (jint) rect.origin.y;
jint w = (jint) rect.size.width;
jint h = (jint) rect.size.height;
JNIEnv *env = [ThreadUtilities getJNIEnv];
static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
static JNF_MEMBER_CACHE(jm_deliverResize, jc_PlatformView, "deliverResize", "(IIII)V");
JNFCallVoidMethod(env, m_cPlatformView, jm_deliverResize, x,y,w,h);
}
- (void) drawRect:(NSRect)dirtyRect {
AWT_ASSERT_APPKIT_THREAD;
@ -1220,21 +1238,19 @@ Java_sun_lwawt_macosx_CPlatformView_nativeCreateView
__block AWTView *newView = nil;
JNF_COCOA_ENTER(env);
AWT_ASSERT_NOT_APPKIT_THREAD;
NSRect rect = NSMakeRect(originX, originY, width, height);
jobject cPlatformView = (*env)->NewGlobalRef(env, obj);
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
AWT_ASSERT_APPKIT_THREAD;
CALayer *windowLayer = jlong_to_ptr(windowLayerPtr);
AWTView *view = [[AWTView alloc] initWithRect:rect
platformView:cPlatformView
windowLayer:windowLayer];
CFRetain(view);
[view release]; // GC
newView = view;
}];
@ -1242,3 +1258,125 @@ JNF_COCOA_EXIT(env);
return ptr_to_jlong(newView);
}
/*
* Class: sun_lwawt_macosx_CPlatformView
* Method: nativeSetAutoResizable
* Signature: (JZ)V;
*/
JNIEXPORT void JNICALL
Java_sun_lwawt_macosx_CPlatformView_nativeSetAutoResizable
(JNIEnv *env, jclass cls, jlong viewPtr, jboolean toResize)
{
JNF_COCOA_ENTER(env);
NSView *view = (NSView *)jlong_to_ptr(viewPtr);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
AWT_ASSERT_APPKIT_THREAD;
if (toResize) {
[view setAutoresizingMask: NSViewHeightSizable | NSViewWidthSizable];
} else {
[view setAutoresizingMask: NSViewMinYMargin | NSViewMaxXMargin];
}
if ([view superview] != nil) {
[[view superview] setAutoresizesSubviews:(BOOL)toResize];
}
}];
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CPlatformView
* Method: nativeGetNSViewDisplayID
* Signature: (J)I;
*/
JNIEXPORT jint JNICALL
Java_sun_lwawt_macosx_CPlatformView_nativeGetNSViewDisplayID
(JNIEnv *env, jclass cls, jlong viewPtr)
{
__block jint ret; //CGDirectDisplayID
JNF_COCOA_ENTER(env);
NSView *view = (NSView *)jlong_to_ptr(viewPtr);
NSWindow *window = [view window];
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
AWT_ASSERT_APPKIT_THREAD;
ret = (jint)[[AWTWindow getNSWindowDisplayID_AppKitThread: window] intValue];
}];
JNF_COCOA_EXIT(env);
return ret;
}
/*
* Class: sun_lwawt_macosx_CPlatformView
* Method: nativeGetLocationOnScreen
* Signature: (J)Ljava/awt/Rectangle;
*/
JNIEXPORT jobject JNICALL
Java_sun_lwawt_macosx_CPlatformView_nativeGetLocationOnScreen
(JNIEnv *env, jclass cls, jlong viewPtr)
{
jobject jRect = NULL;
JNF_COCOA_ENTER(env);
__block NSRect rect = NSZeroRect;
NSView *view = (NSView *)jlong_to_ptr(viewPtr);
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
AWT_ASSERT_APPKIT_THREAD;
NSRect viewBounds = [view bounds];
NSRect frameInWindow = [view convertRect:viewBounds toView:nil];
rect = [[view window] convertRectToScreen:frameInWindow];
NSRect screenRect = [[NSScreen mainScreen] frame];
//Convert coordinates to top-left corner origin
rect.origin.y = screenRect.size.height - rect.origin.y - viewBounds.size.height;
}];
jRect = NSToJavaRect(env, rect);
JNF_COCOA_EXIT(env);
return jRect;
}
/*
* Class: sun_lwawt_macosx_CPlatformView
* Method: nativeIsViewUnderMouse
* Signature: (J)Z;
*/
JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_CPlatformView_nativeIsViewUnderMouse
(JNIEnv *env, jclass clazz, jlong viewPtr)
{
__block jboolean underMouse = JNI_FALSE;
JNF_COCOA_ENTER(env);
NSView *nsView = OBJC(viewPtr);
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
AWT_ASSERT_APPKIT_THREAD;
NSPoint ptWindowCoords = [[nsView window] mouseLocationOutsideOfEventStream];
NSPoint ptViewCoords = [nsView convertPoint:ptWindowCoords fromView:nil];
underMouse = [nsView hitTest:ptViewCoords] != nil;
}];
JNF_COCOA_EXIT(env);
return underMouse;
}

View File

@ -1154,34 +1154,6 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMou
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: nativeGetDisplayID_AppKitThread
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
Java_sun_lwawt_macosx_CPlatformWindow_nativeGetNSWindowDisplayID
(JNIEnv *env, jclass clazz, jlong windowPtr)
{
__block jint ret; // CGDirectDisplayID
JNF_COCOA_ENTER(env);
NSWindow *window = OBJC(windowPtr);
if ([NSThread isMainThread]) {
ret = (jint)[[AWTWindow getNSWindowDisplayID_AppKitThread: window] intValue];
} else {
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
ret = (jint)[[AWTWindow getNSWindowDisplayID_AppKitThread: window] intValue];
}];
}
JNF_COCOA_EXIT(env);
return ret;
}
/*
* Class: sun_lwawt_macosx_CPlatformWindow
* Method: _toggleFullScreenMode
@ -1203,27 +1175,6 @@ JNF_COCOA_ENTER(env);
JNF_COCOA_EXIT(env);
}
JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_CMouseInfoPeer_nativeIsWindowUnderMouse
(JNIEnv *env, jclass clazz, jlong windowPtr)
{
__block jboolean underMouse = JNI_FALSE;
JNF_COCOA_ENTER(env);
AWT_ASSERT_NOT_APPKIT_THREAD;
NSWindow *nsWindow = OBJC(windowPtr);
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^() {
AWT_ASSERT_APPKIT_THREAD;
NSPoint pt = [nsWindow mouseLocationOutsideOfEventStream];
underMouse = [[nsWindow contentView] hitTest:pt] != nil;
}];
JNF_COCOA_EXIT(env);
return underMouse;
}
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSetEnabled
(JNIEnv *env, jclass clazz, jlong windowPtr, jboolean isEnabled)
{

View File

@ -123,14 +123,15 @@ Java_sun_lwawt_macosx_CCursorManager_nativeGetCursorPosition
jobject jpt = NULL;
JNF_COCOA_ENTER(env);
AWT_ASSERT_NOT_APPKIT_THREAD;
__block NSPoint pt = NSZeroPoint;
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
AWT_ASSERT_APPKIT_THREAD;
pt = ConvertNSScreenPoint(env, [NSEvent mouseLocation]);
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
AWT_ASSERT_APPKIT_THREAD;
pt = ConvertNSScreenPoint(env, [NSEvent mouseLocation]);
}];
jpt = NSToJavaPoint(env, pt);
JNF_COCOA_EXIT(env);

View File

@ -650,6 +650,26 @@ JNF_COCOA_EXIT(env);
return windowPtr;
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSView
* Method: setHidden
* Signature: (JZ)V
*/
JNIEXPORT jlong JNICALL
Java_sun_lwawt_macosx_CWrapper_00024NSView_setHidden
(JNIEnv *env, jclass cls, jlong viewPtr, jboolean toHide)
{
JNF_COCOA_ENTER(env);
NSView *view = (NSView *)jlong_to_ptr(viewPtr);
[JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
[view setHidden:(BOOL)toHide];
}];
JNF_COCOA_EXIT(env);
}
/*
* Class: sun_lwawt_macosx_CWrapper$NSScreen
* Method: frame

View File

@ -95,7 +95,7 @@ AWT_ASSERT_APPKIT_THREAD;
CFRelease(busyObserver);
CFRelease(notBusyObserver);
if (!headless) setBusy(YES);
// Set the java name of the AppKit main thread appropriately.
@ -367,7 +367,8 @@ AWT_ASSERT_APPKIT_THREAD;
CFRunLoopRef runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop];
CFRunLoopRemoveObserver(runLoop, busyObserver, kCFRunLoopDefaultMode);
CFRunLoopRemoveObserver(runLoop, notBusyObserver, kCFRunLoopDefaultMode);
// We don't track if the runloop is busy, so set it free to let AWT finish when it needs
setBusy(NO);
busyObserver = NULL;
notBusyObserver = NULL;
} else {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2008, 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
@ -16,9 +16,9 @@
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
* 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 <JavaNativeFoundation/JavaNativeFoundation.h>

View File

@ -151,16 +151,15 @@ Java_sun_java2d_opengl_CGLLayer_nativeCreateLayer
__block CGLLayer *layer = nil;
JNF_COCOA_ENTER(env);
AWT_ASSERT_NOT_APPKIT_THREAD;
JNFJObjectWrapper *javaLayer = [JNFJObjectWrapper wrapperWithJObject:obj withEnv:env];
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
AWT_ASSERT_APPKIT_THREAD;
layer = [[CGLLayer alloc] initWithJavaLayer: javaLayer];
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
AWT_ASSERT_APPKIT_THREAD;
layer = [[CGLLayer alloc] initWithJavaLayer: javaLayer];
}];
JNF_COCOA_EXIT(env);
return ptr_to_jlong(layer);

View File

@ -139,7 +139,7 @@ __attribute__((visibility("default")))
+ (JNIEnv*)getJNIEnvUncached;
+ (void)performOnMainThread:(SEL)aSelector onObject:(id)target withObject:(id)arg waitUntilDone:(BOOL)wait awtMode:(BOOL)inAWT;
+ (void)performOnMainThreadWaiting:(BOOL)wait block:(void (^)())block;
@end
void OSXAPP_SetJavaVM(JavaVM *vm);

View File

@ -245,6 +245,14 @@ AWT_ASSERT_APPKIT_THREAD;
}
}
+ (void)performOnMainThreadWaiting:(BOOL)wait block:(void (^)())block {
if ([NSThread isMainThread] && wait == YES) {
block();
} else {
[JNFRunLoop performOnMainThreadWaiting:wait withBlock:block];
}
}
@end

View File

@ -25,8 +25,6 @@
package com.sun.java.util.jar.pack;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
@ -42,40 +40,39 @@ import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.jar.Pack200;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* Control block for publishing Pack200 options to the other classes.
*/
final class PropMap implements SortedMap<String, String> {
private final TreeMap<String, String> theMap = new TreeMap<>();;
private final List<PropertyChangeListener> listenerList = new ArrayList<>(1);
void addListener(PropertyChangeListener listener) {
// type is erased, elements are of type java.beans.PropertyChangeListener
private final List<Object> listenerList = new ArrayList<>(1);
void addListener(Object listener) {
assert Beans.isPropertyChangeListener(listener);
listenerList.add(listener);
}
void removeListener(PropertyChangeListener listener) {
void removeListener(Object listener) {
assert Beans.isPropertyChangeListener(listener);
listenerList.remove(listener);
}
void addListeners(ArrayList<PropertyChangeListener> listeners) {
listenerList.addAll(listeners);
}
void removeListeners(ArrayList<PropertyChangeListener> listeners) {
listenerList.removeAll(listeners);
}
// Override:
public String put(String key, String value) {
String oldValue = theMap.put(key, value);
if (value != oldValue && !listenerList.isEmpty()) {
assert Beans.isBeansPresent();
// Post the property change event.
PropertyChangeEvent event =
new PropertyChangeEvent(this, key,
oldValue, value);
for (PropertyChangeListener listener : listenerList) {
listener.propertyChange(event);
Object event = Beans.newPropertyChangeEvent(this, key, oldValue, value);
for (Object listener : listenerList) {
Beans.invokePropertyChange(listener, event);
}
}
return oldValue;
@ -339,4 +336,113 @@ final class PropMap implements SortedMap<String, String> {
public String lastKey() {
return theMap.lastKey();
}
/**
* A class that provides access to the java.beans.PropertyChangeListener
* and java.beans.PropertyChangeEvent without creating a static dependency
* on java.beans. This class can be removed once the addPropertyChangeListener
* and removePropertyChangeListener methods are removed from Packer and
* Unpacker.
*/
private static class Beans {
private static final Class<?> propertyChangeListenerClass =
getClass("java.beans.PropertyChangeListener");
private static final Class<?> propertyChangeEventClass =
getClass("java.beans.PropertyChangeEvent");
private static final Method propertyChangeMethod =
getMethod(propertyChangeListenerClass,
"propertyChange",
propertyChangeEventClass);
private static final Constructor<?> propertyEventCtor =
getConstructor(propertyChangeEventClass,
Object.class,
String.class,
Object.class,
Object.class);
private static Class<?> getClass(String name) {
try {
return Class.forName(name, true, Beans.class.getClassLoader());
} catch (ClassNotFoundException e) {
return null;
}
}
private static Constructor<?> getConstructor(Class<?> c, Class<?>... types) {
try {
return (c == null) ? null : c.getDeclaredConstructor(types);
} catch (NoSuchMethodException x) {
throw new AssertionError(x);
}
}
private static Method getMethod(Class<?> c, String name, Class<?>... types) {
try {
return (c == null) ? null : c.getMethod(name, types);
} catch (NoSuchMethodException e) {
throw new AssertionError(e);
}
}
/**
* Returns {@code true} if java.beans is present.
*/
static boolean isBeansPresent() {
return propertyChangeListenerClass != null &&
propertyChangeEventClass != null;
}
/**
* Returns {@code true} if the given object is a PropertyChangeListener
*/
static boolean isPropertyChangeListener(Object obj) {
if (propertyChangeListenerClass == null) {
return false;
} else {
return propertyChangeListenerClass.isInstance(obj);
}
}
/**
* Returns a new PropertyChangeEvent with the given source, property
* name, old and new values.
*/
static Object newPropertyChangeEvent(Object source, String prop,
Object oldValue, Object newValue)
{
try {
return propertyEventCtor.newInstance(source, prop, oldValue, newValue);
} catch (InstantiationException | IllegalAccessException x) {
throw new AssertionError(x);
} catch (InvocationTargetException x) {
Throwable cause = x.getCause();
if (cause instanceof Error)
throw (Error)cause;
if (cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new AssertionError(x);
}
}
/**
* Invokes the given PropertyChangeListener's propertyChange method
* with the given event.
*/
static void invokePropertyChange(Object listener, Object ev) {
try {
propertyChangeMethod.invoke(listener, ev);
} catch (IllegalAccessException x) {
throw new AssertionError(x);
} catch (InvocationTargetException x) {
Throwable cause = x.getCause();
if (cause instanceof Error)
throw (Error)cause;
if (cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new AssertionError(x);
}
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -53,12 +53,13 @@ public class KeyManagerFactory {
/**
* <p>The default KeyManager can be changed by setting the value of the
* "sun.ssl.keymanager.type" security property (in the Java security
* properties file) to the desired name.
* {@code sun.ssl.keymanager.type} security property to the desired name.
*
* @return the default type as specified in the
* Java security properties file, or an implementation-specific default
* if no such property exists.
* @return the default type as specified by the
* {@code sun.ssl.keymanager.type} security property, or an
* implementation-specific default if no such property exists.
*
* @see java.security.Security security properties
*/
public final static String getDefaultAlgorithm() {
String type;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -53,12 +53,13 @@ public class TrustManagerFactory {
/**
* <p>The default TrustManager can be changed by setting the value of the
* "sun.ssl.trustmanager.type" security property
* (in the Java security properties file) to the desired name.
* {@code sun.ssl.trustmanager.type} security property to the desired name.
*
* @return the default type as specified in the
* Java security properties file, or an implementation-specific default
* if no such property exists.
* @return the default type as specified by the
* {@code sun.ssl.trustmanager.type} security property, or an
* implementation-specific default if no such property exists.
*
* @see java.security.Security security properties
*/
public final static String getDefaultAlgorithm() {
String type;

View File

@ -264,7 +264,7 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
* <code>false</code> otherwise
*/
public boolean writeData(RowSetInternal caller) throws SQLException {
boolean conflict = false;
long conflicts = 0;
boolean showDel = false;
PreparedStatement pstmtIns = null;
iChangedValsInDbAndCRS = 0;
@ -337,8 +337,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
while (crs.next()) {
if (crs.rowDeleted()) {
// The row has been deleted.
if (conflict = (deleteOriginalRow(crs, this.crsResolve)) == true) {
if (deleteOriginalRow(crs, this.crsResolve)) {
status.add(rows, SyncResolver.DELETE_ROW_CONFLICT);
conflicts++;
} else {
// delete happened without any occurrence of conflicts
// so update status accordingly
@ -349,8 +350,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
// The row has been inserted.
pstmtIns = con.prepareStatement(insertCmd);
if ( (conflict = insertNewRow(crs, pstmtIns, this.crsResolve)) == true) {
if (insertNewRow(crs, pstmtIns, this.crsResolve)) {
status.add(rows, SyncResolver.INSERT_ROW_CONFLICT);
conflicts++;
} else {
// insert happened without any occurrence of conflicts
// so update status accordingly
@ -358,8 +360,9 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
}
} else if (crs.rowUpdated()) {
// The row has been updated.
if ( conflict = (updateOriginalRow(crs)) == true) {
if (updateOriginalRow(crs)) {
status.add(rows, SyncResolver.UPDATE_ROW_CONFLICT);
conflicts++;
} else {
// update happened without any occurrence of conflicts
// so update status accordingly
@ -395,21 +398,12 @@ public class CachedRowSetWriter implements TransactionalWriter, Serializable {
// reset
crs.setShowDeleted(showDel);
boolean boolConf = false;
for (int j=1;j<status.size();j++){
// ignore status for index = 0 which is set to null
if(! ((status.get(j)).equals(SyncResolver.NO_ROW_CONFLICT))) {
// there is at least one conflict which needs to be resolved
boolConf = true;
break;
}
}
crs.beforeFirst();
this.crsResolve.beforeFirst();
if(boolConf) {
SyncProviderException spe = new SyncProviderException(status.size() - 1+resBundle.handleGetObject("crswriter.conflictsno").toString());
if(conflicts != 0) {
SyncProviderException spe = new SyncProviderException(conflicts + " " +
resBundle.handleGetObject("crswriter.conflictsno").toString());
//SyncResolver syncRes = spe.getSyncResolver();
SyncResolverImpl syncResImpl = (SyncResolverImpl) spe.getSyncResolver();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -59,13 +59,9 @@ import sun.security.util.PropertyExpander;
*
* <ol>
* <li>
* Loop through the <code>java.security.Security</code> properties,
* Loop through the security properties,
* <i>auth.policy.url.1</i>, <i>auth.policy.url.2</i>, ...,
* <i>auth.policy.url.X</i>". These properties are set
* in the Java security properties file, which is located in the file named
* &lt;JAVA_HOME&gt;/lib/security/java.security.
* &lt;JAVA_HOME&gt; refers to the value of the java.home system property,
* and specifies the directory where the JRE is installed.
* <i>auth.policy.url.X</i>".
* Each property value specifies a <code>URL</code> pointing to a
* policy file to be loaded. Read in and load each policy.
*
@ -235,6 +231,7 @@ import sun.security.util.PropertyExpander;
* @see java.security.CodeSource
* @see java.security.Permissions
* @see java.security.ProtectionDomain
* @see java.security.Security security properties
*/
@Deprecated
public class PolicyFile extends javax.security.auth.Policy {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -49,13 +49,9 @@ import sun.security.util.PropertyExpander;
*
* <ol>
* <li>
* Loop through the <code>java.security.Security</code> properties,
* Loop through the security properties,
* <i>login.config.url.1</i>, <i>login.config.url.2</i>, ...,
* <i>login.config.url.X</i>. These properties are set
* in the Java security properties file, which is located in the file named
* &lt;JAVA_HOME&gt;/lib/security/java.security.
* &lt;JAVA_HOME&gt; refers to the value of the java.home system property,
* and specifies the directory where the JRE is installed.
* <i>login.config.url.X</i>.
* Each property value specifies a <code>URL</code> pointing to a
* login configuration file to be loaded. Read in and load
* each configuration.
@ -87,6 +83,7 @@ import sun.security.util.PropertyExpander;
* <code>javax.security.auth.login.Configuration</code> class.
*
* @see javax.security.auth.login.LoginContext
* @see java.security.Security security properties
*/
public class ConfigFile extends javax.security.auth.login.Configuration {

View File

@ -1067,10 +1067,6 @@ public class Krb5LoginModule implements LoginModule {
if (ktab != null) {
if (!privCredSet.contains(ktab)) {
privCredSet.add(ktab);
// Compatibility; also add keys to privCredSet
for (KerberosKey key: ktab.getKeys(kerbClientPrinc)) {
privCredSet.add(new Krb5Util.KeysFromKeyTab(key));
}
}
} else {
succeeded = false;

View File

@ -25,19 +25,21 @@
package java.lang;
import java.lang.ref.*;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Supplier;
/**
* This class provides thread-local variables. These variables differ from
* their normal counterparts in that each thread that accesses one (via its
* <tt>get</tt> or <tt>set</tt> method) has its own, independently initialized
* copy of the variable. <tt>ThreadLocal</tt> instances are typically private
* {@code get} or {@code set} method) has its own, independently initialized
* copy of the variable. {@code ThreadLocal} instances are typically private
* static fields in classes that wish to associate state with a thread (e.g.,
* a user ID or Transaction ID).
*
* <p>For example, the class below generates unique identifiers local to each
* thread.
* A thread's id is assigned the first time it invokes <tt>ThreadId.get()</tt>
* A thread's id is assigned the first time it invokes {@code ThreadId.get()}
* and remains unchanged on subsequent calls.
* <pre>
* import java.util.concurrent.atomic.AtomicInteger;
@ -61,7 +63,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* }
* </pre>
* <p>Each thread holds an implicit reference to its copy of a thread-local
* variable as long as the thread is alive and the <tt>ThreadLocal</tt>
* variable as long as the thread is alive and the {@code ThreadLocal}
* instance is accessible; after a thread goes away, all of its copies of
* thread-local instances are subject to garbage collection (unless other
* references to these copies exist).
@ -108,14 +110,14 @@ public class ThreadLocal<T> {
* thread-local variable. This method will be invoked the first
* time a thread accesses the variable with the {@link #get}
* method, unless the thread previously invoked the {@link #set}
* method, in which case the <tt>initialValue</tt> method will not
* method, in which case the {@code initialValue} method will not
* be invoked for the thread. Normally, this method is invoked at
* most once per thread, but it may be invoked again in case of
* subsequent invocations of {@link #remove} followed by {@link #get}.
*
* <p>This implementation simply returns <tt>null</tt>; if the
* <p>This implementation simply returns {@code null}; if the
* programmer desires thread-local variables to have an initial
* value other than <tt>null</tt>, <tt>ThreadLocal</tt> must be
* value other than {@code null}, {@code ThreadLocal} must be
* subclassed, and this method overridden. Typically, an
* anonymous inner class will be used.
*
@ -125,8 +127,22 @@ public class ThreadLocal<T> {
return null;
}
/**
* Creates a thread local variable. The initial value of the variable is
* determined by invoking the {@code get} method on the {@code Supplier}.
*
* @param supplier the supplier to be used to determine the initial value
* @return a new thread local variable
* @throws NullPointerException if the specified supplier is null
* @since 1.8
*/
public static <T> ThreadLocal<T> withInitial(Supplier<? extends T> supplier) {
return new SuppliedThreadLocal<>(supplier);
}
/**
* Creates a thread local variable.
* @see #withInitial(java.util.function.Supplier)
*/
public ThreadLocal() {
}
@ -195,7 +211,7 @@ public class ThreadLocal<T> {
* reinitialized by invoking its {@link #initialValue} method,
* unless its value is {@linkplain #set set} by the current thread
* in the interim. This may result in multiple invocations of the
* <tt>initialValue</tt> method in the current thread.
* {@code initialValue} method in the current thread.
*
* @since 1.5
*/
@ -250,6 +266,24 @@ public class ThreadLocal<T> {
throw new UnsupportedOperationException();
}
/**
* An extension of ThreadLocal that obtains its initial value from
* the specified {@code Supplier}.
*/
static final class SuppliedThreadLocal<T> extends ThreadLocal<T> {
private final Supplier<? extends T> supplier;
SuppliedThreadLocal(Supplier<? extends T> supplier) {
this.supplier = Objects.requireNonNull(supplier);
}
@Override
protected T initialValue() {
return supplier.get();
}
}
/**
* ThreadLocalMap is a customized hash map suitable only for
* maintaining thread local values. No operations are exported
@ -599,9 +633,9 @@ public class ThreadLocal<T> {
* @param i a position known NOT to hold a stale entry. The
* scan starts at the element after i.
*
* @param n scan control: <tt>log2(n)</tt> cells are scanned,
* @param n scan control: {@code log2(n)} cells are scanned,
* unless a stale entry is found, in which case
* <tt>log2(table.length)-1</tt> additional cells are scanned.
* {@code log2(table.length)-1} additional cells are scanned.
* When called from insertions, this parameter is the number
* of elements, but when from replaceStaleEntry, it is the
* table length. (Note: all this could be changed to be either

View File

@ -25,15 +25,15 @@
package java.lang.invoke;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.security.ProtectionDomain;
import java.util.concurrent.atomic.AtomicInteger;
import sun.util.logging.PlatformLogger;
import jdk.internal.org.objectweb.asm.*;
import static jdk.internal.org.objectweb.asm.Opcodes.*;
import sun.misc.Unsafe;
import java.security.AccessController;
import java.security.PrivilegedAction;
/**
* InnerClassLambdaMetafactory
@ -120,13 +120,34 @@ import sun.misc.Unsafe;
*
* @return a CallSite, which, when invoked, will return an instance of the
* functional interface
* @throws ReflectiveOperationException
* @throws ReflectiveOperationException, LambdaConversionException
*/
@Override
CallSite buildCallSite() throws ReflectiveOperationException, LambdaConversionException {
final Class<?> innerClass = spinInnerClass();
if (invokedType.parameterCount() == 0) {
return new ConstantCallSite(MethodHandles.constant(samBase, innerClass.newInstance()));
final Constructor[] ctrs = AccessController.doPrivileged(
new PrivilegedAction<Constructor[]>() {
@Override
public Constructor[] run() {
return innerClass.getDeclaredConstructors();
}
});
if (ctrs.length != 1) {
throw new ReflectiveOperationException("Expected one lambda constructor for "
+ innerClass.getCanonicalName() + ", got " + ctrs.length);
}
// The lambda implementing inner class constructor is private, set
// it accessible (by us) before creating the constant sole instance
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
ctrs[0].setAccessible(true);
return null;
}
});
Object inst = ctrs[0].newInstance();
return new ConstantCallSite(MethodHandles.constant(samBase, inst));
} else {
return new ConstantCallSite(
MethodHandles.Lookup.IMPL_LOOKUP
@ -144,7 +165,7 @@ import sun.misc.Unsafe;
private <T> Class<? extends T> spinInnerClass() throws LambdaConversionException {
String samName = samBase.getName().replace('.', '/');
cw.visit(CLASSFILE_VERSION, ACC_PUBLIC + ACC_SUPER, lambdaClassName, null, NAME_MAGIC_ACCESSOR_IMPL,
cw.visit(CLASSFILE_VERSION, ACC_SUPER, lambdaClassName, null, NAME_MAGIC_ACCESSOR_IMPL,
isSerializable ? new String[]{samName, NAME_SERIALIZABLE} : new String[]{samName});
// Generate final fields to be filled in by constructor
@ -186,17 +207,27 @@ import sun.misc.Unsafe;
final byte[] classBytes = cw.toByteArray();
if (System.getProperty("debug.dump.generated") != null) {
/*** Uncomment to dump the generated file
System.out.printf("Loaded: %s (%d bytes) %n", lambdaClassName, classBytes.length);
try (FileOutputStream fos = new FileOutputStream(lambdaClassName.replace('/', '.') + ".class")) {
fos.write(classBytes);
} catch (IOException ex) {
PlatformLogger.getLogger(InnerClassLambdaMetafactory.class.getName()).severe(ex.getMessage(), ex);
Logger.getLogger(InnerClassLambdaMetafactory.class.getName()).log(Level.SEVERE, null, ex);
}
}
***/
ClassLoader loader = targetClass.getClassLoader();
ProtectionDomain pd = (loader == null) ? null : targetClass.getProtectionDomain();
ProtectionDomain pd = (loader == null)
? null
: AccessController.doPrivileged(
new PrivilegedAction<ProtectionDomain>() {
@Override
public ProtectionDomain run() {
return targetClass.getProtectionDomain();
}
}
);
return (Class<? extends T>) Unsafe.getUnsafe().defineClass(lambdaClassName, classBytes, 0, classBytes.length, loader, pd);
}
@ -205,7 +236,7 @@ import sun.misc.Unsafe;
*/
private void generateConstructor() {
// Generate constructor
MethodVisitor ctor = cw.visitMethod(ACC_PUBLIC, NAME_CTOR, constructorDesc, null, null);
MethodVisitor ctor = cw.visitMethod(ACC_PRIVATE, NAME_CTOR, constructorDesc, null, null);
ctor.visitCode();
ctor.visitVarInsn(ALOAD, 0);
ctor.visitMethodInsn(INVOKESPECIAL, NAME_MAGIC_ACCESSOR_IMPL, NAME_CTOR, METHOD_DESCRIPTOR_VOID);

View File

@ -30,6 +30,8 @@ import java.util.StringTokenizer;
import java.util.NoSuchElementException;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Date;
import java.util.Locale;
import java.util.Objects;
@ -89,7 +91,10 @@ public final class HttpCookie implements Cloneable {
private final static String[] COOKIE_DATE_FORMATS = {
"EEE',' dd-MMM-yyyy HH:mm:ss 'GMT'",
"EEE',' dd MMM yyyy HH:mm:ss 'GMT'",
"EEE MMM dd yyyy HH:mm:ss 'GMT'Z"
"EEE MMM dd yyyy HH:mm:ss 'GMT'Z",
"EEE',' dd-MMM-yy HH:mm:ss 'GMT'",
"EEE',' dd MMM yy HH:mm:ss 'GMT'",
"EEE MMM dd yy HH:mm:ss 'GMT'Z"
};
// constant strings represent set-cookie header token
@ -1025,13 +1030,29 @@ public final class HttpCookie implements Cloneable {
* specified by dateString
*/
private long expiryDate2DeltaSeconds(String dateString) {
Calendar cal = new GregorianCalendar(GMT);
for (int i = 0; i < COOKIE_DATE_FORMATS.length; i++) {
SimpleDateFormat df = new SimpleDateFormat(COOKIE_DATE_FORMATS[i],
Locale.US);
cal.set(1970, 0, 1, 0, 0, 0);
df.setTimeZone(GMT);
df.setLenient(false);
df.set2DigitYearStart(cal.getTime());
try {
Date date = df.parse(dateString);
return (date.getTime() - whenCreated) / 1000;
cal.setTime(df.parse(dateString));
if (!COOKIE_DATE_FORMATS[i].contains("yyyy")) {
// 2-digit years following the standard set
// out it rfc 6265
int year = cal.get(Calendar.YEAR);
year %= 100;
if (year < 70) {
year += 2000;
} else {
year += 1900;
}
cal.set(Calendar.YEAR, year);
}
return (cal.getTimeInMillis() - whenCreated) / 1000;
} catch (Exception e) {
// Ignore, try the next date format
}

View File

@ -25,9 +25,9 @@
package java.net;
import java.io.ObjectInputStream;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.util.Enumeration;
/**
@ -116,7 +116,8 @@ import java.util.Enumeration;
* <h4> Special IPv6 address </h4>
*
* <blockquote>
* <table cellspacing=2 summary="Description of IPv4-mapped address"> <tr><th valign=top><i>IPv4-mapped address</i></th>
* <table cellspacing=2 summary="Description of IPv4-mapped address">
* <tr><th valign=top><i>IPv4-mapped address</i></th>
* <td>Of the form::ffff:w.x.y.z, this IPv6 address is used to
* represent an IPv4 address. It allows the native program to
* use the same address data structure and also the same
@ -130,35 +131,40 @@ import java.util.Enumeration;
* address.</td></tr>
* </table></blockquote>
* <p>
* <h4> <A NAME="scoped">Textual representation of IPv6 scoped addresses</a> </h4>
* <p>
* The textual representation of IPv6 addresses as described above can be extended
* to specify IPv6 scoped addresses. This extension to the basic addressing architecture
* is described in [draft-ietf-ipngwg-scoping-arch-04.txt].
* <p>
* Because link-local and site-local addresses are non-global, it is possible that different hosts
* may have the same destination address and may be reachable through different interfaces on the
* same originating system. In this case, the originating system is said to be connected
* to multiple zones of the same scope. In order to disambiguate which is the intended destination
* zone, it is possible to append a zone identifier (or <i>scope_id</i>) to an IPv6 address.
* <p>
* The general format for specifying the <i>scope_id</i> is the following:
* <h4><A NAME="scoped">Textual representation of IPv6 scoped addresses</a></h4>
*
* <p> The textual representation of IPv6 addresses as described above can be
* extended to specify IPv6 scoped addresses. This extension to the basic
* addressing architecture is described in [draft-ietf-ipngwg-scoping-arch-04.txt].
*
* <p> Because link-local and site-local addresses are non-global, it is possible
* that different hosts may have the same destination address and may be
* reachable through different interfaces on the same originating system. In
* this case, the originating system is said to be connected to multiple zones
* of the same scope. In order to disambiguate which is the intended destination
* zone, it is possible to append a zone identifier (or <i>scope_id</i>) to an
* IPv6 address.
*
* <p> The general format for specifying the <i>scope_id</i> is the following:
*
* <p><blockquote><i>IPv6-address</i>%<i>scope_id</i></blockquote>
* <p> The IPv6-address is a literal IPv6 address as described above.
* The <i>scope_id</i> refers to an interface on the local system, and it can be specified
* in two ways.
* <p><ol><li><i>As a numeric identifier.</i> This must be a positive integer that identifies the
* particular interface and scope as understood by the system. Usually, the numeric
* values can be determined through administration tools on the system. Each interface may
* have multiple values, one for each scope. If the scope is unspecified, then the default value
* used is zero.</li><p>
* <li><i>As a string.</i> This must be the exact string that is returned by
* {@link java.net.NetworkInterface#getName()} for the particular interface in question.
* When an Inet6Address is created in this way, the numeric scope-id is determined at the time
* the object is created by querying the relevant NetworkInterface.</li>
* </ol><p>
* Note also, that the numeric <i>scope_id</i> can be retrieved from Inet6Address instances returned from the
* NetworkInterface class. This can be used to find out the current scope ids configured on the system.
* The <i>scope_id</i> refers to an interface on the local system, and it can be
* specified in two ways.
* <p><ol><li><i>As a numeric identifier.</i> This must be a positive integer
* that identifies the particular interface and scope as understood by the
* system. Usually, the numeric values can be determined through administration
* tools on the system. Each interface may have multiple values, one for each
* scope. If the scope is unspecified, then the default value used is zero.</li>
* <p><li><i>As a string.</i> This must be the exact string that is returned by
* {@link java.net.NetworkInterface#getName()} for the particular interface in
* question. When an Inet6Address is created in this way, the numeric scope-id
* is determined at the time the object is created by querying the relevant
* NetworkInterface.</li></ol>
*
* <p> Note also, that the numeric <i>scope_id</i> can be retrieved from
* Inet6Address instances returned from the NetworkInterface class. This can be
* used to find out the current scope ids configured on the system.
* @since 1.4
*/
@ -169,7 +175,7 @@ class Inet6Address extends InetAddress {
/*
* cached scope_id - for link-local address use only.
*/
private transient int cached_scope_id = 0;
private transient int cached_scope_id; // 0
/**
* Holds a 128-bit (16 bytes) IPv6 address.
@ -179,37 +185,28 @@ class Inet6Address extends InetAddress {
byte[] ipaddress;
/**
* scope_id. The scope specified when the object is created. If the object is created
* with an interface name, then the scope_id is not determined until the time it is needed.
* scope_id. The scope specified when the object is created. If the object
* is created with an interface name, then the scope_id is not determined
* until the time it is needed.
*/
private int scope_id = 0;
private int scope_id; // 0
/**
* This will be set to true when the scope_id field contains a valid
* integer scope_id.
*/
private boolean scope_id_set = false;
private boolean scope_id_set; // false
/**
* scoped interface. scope_id is derived from this as the scope_id of the first
* address whose scope is the same as this address for the named interface.
*/
private transient NetworkInterface scope_ifname = null;
/**
* set if the object is constructed with a scoped interface instead of a
* numeric scope id.
*/
private boolean scope_ifname_set = false;
private transient NetworkInterface scope_ifname; // null
private static final long serialVersionUID = 6880410070516793377L;
/*
* Perform initializations.
*/
static {
init();
}
// Perform native initialization
static { init(); }
Inet6Address() {
super();
@ -239,19 +236,24 @@ class Inet6Address extends InetAddress {
} catch (UnknownHostException e) {} /* cant happen if ifname is null */
}
Inet6Address (String hostName, byte addr[], NetworkInterface nif) throws UnknownHostException {
Inet6Address (String hostName, byte addr[], NetworkInterface nif)
throws UnknownHostException
{
initif (hostName, addr, nif);
}
Inet6Address (String hostName, byte addr[], String ifname) throws UnknownHostException {
Inet6Address (String hostName, byte addr[], String ifname)
throws UnknownHostException
{
initstr (hostName, addr, ifname);
}
/**
* Create an Inet6Address in the exact manner of {@link InetAddress#getByAddress(String,byte[])}
* except that the IPv6 scope_id is set to the value corresponding to the given interface
* for the address type specified in <code>addr</code>.
* The call will fail with an UnknownHostException if the given interface does not have a numeric
* Create an Inet6Address in the exact manner of {@link
* InetAddress#getByAddress(String,byte[])} except that the IPv6 scope_id is
* set to the value corresponding to the given interface for the address
* type specified in <code>addr</code>. The call will fail with an
* UnknownHostException if the given interface does not have a numeric
* scope_id assigned for the given address type (eg. link-local or site-local).
* See <a href="Inet6Address.html#scoped">here</a> for a description of IPv6
* scoped addresses.
@ -260,14 +262,16 @@ class Inet6Address extends InetAddress {
* @param addr the raw IP address in network byte order
* @param nif an interface this address must be associated with.
* @return an Inet6Address object created from the raw IP address.
* @exception UnknownHostException if IP address is of illegal length, or if the interface
* does not have a numeric scope_id assigned for the given address type.
* @throws UnknownHostException
* if IP address is of illegal length, or if the interface does not
* have a numeric scope_id assigned for the given address type.
*
* @since 1.5
*/
public static Inet6Address getByAddress(String host, byte[] addr, NetworkInterface nif)
throws UnknownHostException {
public static Inet6Address getByAddress(String host, byte[] addr,
NetworkInterface nif)
throws UnknownHostException
{
if (host != null && host.length() > 0 && host.charAt(0) == '[') {
if (host.charAt(host.length()-1) == ']') {
host = host.substring(1, host.length() -1);
@ -282,9 +286,10 @@ class Inet6Address extends InetAddress {
}
/**
* Create an Inet6Address in the exact manner of {@link InetAddress#getByAddress(String,byte[])}
* except that the IPv6 scope_id is set to the given numeric value.
* The scope_id is not checked to determine if it corresponds to any interface on the system.
* Create an Inet6Address in the exact manner of {@link
* InetAddress#getByAddress(String,byte[])} except that the IPv6 scope_id is
* set to the given numeric value. The scope_id is not checked to determine
* if it corresponds to any interface on the system.
* See <a href="Inet6Address.html#scoped">here</a> for a description of IPv6
* scoped addresses.
*
@ -292,13 +297,14 @@ class Inet6Address extends InetAddress {
* @param addr the raw IP address in network byte order
* @param scope_id the numeric scope_id for the address.
* @return an Inet6Address object created from the raw IP address.
* @exception UnknownHostException if IP address is of illegal length.
* @throws UnknownHostException if IP address is of illegal length.
*
* @since 1.5
*/
public static Inet6Address getByAddress(String host, byte[] addr, int scope_id)
throws UnknownHostException {
public static Inet6Address getByAddress(String host, byte[] addr,
int scope_id)
throws UnknownHostException
{
if (host != null && host.length() > 0 && host.charAt(0) == '[') {
if (host.charAt(host.length()-1) == ']') {
host = host.substring(1, host.length() -1);
@ -312,7 +318,9 @@ class Inet6Address extends InetAddress {
throw new UnknownHostException("addr is of illegal length");
}
private void initstr (String hostName, byte addr[], String ifname) throws UnknownHostException {
private void initstr(String hostName, byte addr[], String ifname)
throws UnknownHostException
{
try {
NetworkInterface nif = NetworkInterface.getByName (ifname);
if (nif == null) {
@ -324,16 +332,17 @@ class Inet6Address extends InetAddress {
}
}
private void initif(String hostName, byte addr[],NetworkInterface nif) throws UnknownHostException {
private void initif(String hostName, byte addr[],NetworkInterface nif)
throws UnknownHostException
{
this.hostName = hostName;
if (addr.length == INADDRSZ) { // normal IPv6 address
family = IPv6;
ipaddress = addr.clone();
}
if (nif != null) {
this.scope_ifname = nif;
scope_ifname_set = true;
scope_id = deriveNumericScope (nif);
scope_ifname = nif;
scope_id = deriveNumericScope(nif);
scope_id_set = true;
}
}
@ -344,17 +353,16 @@ class Inet6Address extends InetAddress {
* return true otherwise.
*/
private boolean differentLocalAddressTypes(Inet6Address other) {
if (isLinkLocalAddress() && !other.isLinkLocalAddress()) {
if (isLinkLocalAddress() && !other.isLinkLocalAddress())
return false;
}
if (isSiteLocalAddress() && !other.isSiteLocalAddress()) {
if (isSiteLocalAddress() && !other.isSiteLocalAddress())
return false;
}
return true;
}
private int deriveNumericScope (NetworkInterface ifc) throws UnknownHostException {
private int deriveNumericScope(NetworkInterface ifc)
throws UnknownHostException
{
Enumeration<InetAddress> addresses = ifc.getInetAddresses();
while (addresses.hasMoreElements()) {
InetAddress addr = addresses.nextElement();
@ -373,16 +381,17 @@ class Inet6Address extends InetAddress {
throw new UnknownHostException ("no scope_id found");
}
private int deriveNumericScope (String ifname) throws UnknownHostException {
private int deriveNumericScope(String ifname) throws UnknownHostException {
Enumeration<NetworkInterface> en;
try {
en = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e) {
throw new UnknownHostException ("could not enumerate local network interfaces");
throw new UnknownHostException(
"could not enumerate local network interfaces");
}
while (en.hasMoreElements()) {
NetworkInterface ifc = en.nextElement();
if (ifc.getName().equals (ifname)) {
if (ifc.getName().equals(ifname)) {
Enumeration<InetAddress> addresses = ifc.getInetAddresses();
while (addresses.hasMoreElements()) {
InetAddress addr = addresses.nextElement();
@ -400,7 +409,8 @@ class Inet6Address extends InetAddress {
}
}
}
throw new UnknownHostException ("No matching address found for interface : " +ifname);
throw new UnknownHostException(
"No matching address found for interface : " +ifname);
}
/**
@ -410,22 +420,14 @@ class Inet6Address extends InetAddress {
*/
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
scope_ifname = null;
scope_ifname_set = false;
s.defaultReadObject();
if (ifname != null && !"".equals (ifname)) {
if (ifname != null && !ifname.equals("")) {
try {
scope_ifname = NetworkInterface.getByName(ifname);
if (scope_ifname == null) {
/* the interface does not exist on this system, so we clear
* the scope information completely */
scope_id_set = false;
scope_ifname_set = false;
scope_id = 0;
} else {
if (scope_ifname != null) {
try {
scope_id = deriveNumericScope (scope_ifname);
scope_id = deriveNumericScope(scope_ifname);
} catch (UnknownHostException e) {
// typically should not happen, but it may be that
// the machine being used for deserialization has
@ -455,8 +457,9 @@ class Inet6Address extends InetAddress {
* address. 11111111 at the start of the address identifies the
* address as being a multicast address.
*
* @return a <code>boolean</code> indicating if the InetAddress is
* an IP multicast address
* @return a {@code boolean} indicating if the InetAddress is an IP
* multicast address
*
* @since JDK1.1
*/
@Override
@ -466,8 +469,10 @@ class Inet6Address extends InetAddress {
/**
* Utility routine to check if the InetAddress in a wildcard address.
* @return a <code>boolean</code> indicating if the Inetaddress is
*
* @return a {@code boolean} indicating if the Inetaddress is
* a wildcard address.
*
* @since 1.4
*/
@Override
@ -482,8 +487,9 @@ class Inet6Address extends InetAddress {
/**
* Utility routine to check if the InetAddress is a loopback address.
*
* @return a <code>boolean</code> indicating if the InetAddress is
* a loopback address; or false otherwise.
* @return a {@code boolean} indicating if the InetAddress is a loopback
* address; or false otherwise.
*
* @since 1.4
*/
@Override
@ -498,8 +504,9 @@ class Inet6Address extends InetAddress {
/**
* Utility routine to check if the InetAddress is an link local address.
*
* @return a <code>boolean</code> indicating if the InetAddress is
* a link local address; or false if address is not a link local unicast address.
* @return a {@code boolean} indicating if the InetAddress is a link local
* address; or false if address is not a link local unicast address.
*
* @since 1.4
*/
@Override
@ -511,8 +518,9 @@ class Inet6Address extends InetAddress {
/**
* Utility routine to check if the InetAddress is a site local address.
*
* @return a <code>boolean</code> indicating if the InetAddress is
* a site local address; or false if address is not a site local unicast address.
* @return a {@code boolean} indicating if the InetAddress is a site local
* address; or false if address is not a site local unicast address.
*
* @since 1.4
*/
@Override
@ -524,9 +532,10 @@ class Inet6Address extends InetAddress {
/**
* Utility routine to check if the multicast address has global scope.
*
* @return a <code>boolean</code> indicating if the address has
* is a multicast address of global scope, false if it is not
* of global scope or it is not a multicast address
* @return a {@code boolean} indicating if the address has is a multicast
* address of global scope, false if it is not of global scope or
* it is not a multicast address
*
* @since 1.4
*/
@Override
@ -538,9 +547,10 @@ class Inet6Address extends InetAddress {
/**
* Utility routine to check if the multicast address has node scope.
*
* @return a <code>boolean</code> indicating if the address has
* is a multicast address of node-local scope, false if it is not
* of node-local scope or it is not a multicast address
* @return a {@code boolean} indicating if the address has is a multicast
* address of node-local scope, false if it is not of node-local
* scope or it is not a multicast address
*
* @since 1.4
*/
@Override
@ -552,9 +562,10 @@ class Inet6Address extends InetAddress {
/**
* Utility routine to check if the multicast address has link scope.
*
* @return a <code>boolean</code> indicating if the address has
* is a multicast address of link-local scope, false if it is not
* of link-local scope or it is not a multicast address
* @return a {@code boolean} indicating if the address has is a multicast
* address of link-local scope, false if it is not of link-local
* scope or it is not a multicast address
*
* @since 1.4
*/
@Override
@ -566,9 +577,10 @@ class Inet6Address extends InetAddress {
/**
* Utility routine to check if the multicast address has site scope.
*
* @return a <code>boolean</code> indicating if the address has
* is a multicast address of site-local scope, false if it is not
* of site-local scope or it is not a multicast address
* @return a {@code boolean} indicating if the address has is a multicast
* address of site-local scope, false if it is not of site-local
* scope or it is not a multicast address
*
* @since 1.4
*/
@Override
@ -580,10 +592,10 @@ class Inet6Address extends InetAddress {
/**
* Utility routine to check if the multicast address has organization scope.
*
* @return a <code>boolean</code> indicating if the address has
* is a multicast address of organization-local scope,
* false if it is not of organization-local scope
* or it is not a multicast address
* @return a {@code boolean} indicating if the address has is a multicast
* address of organization-local scope, false if it is not of
* organization-local scope or it is not a multicast address
*
* @since 1.4
*/
@Override
@ -593,9 +605,9 @@ class Inet6Address extends InetAddress {
}
/**
* Returns the raw IP address of this <code>InetAddress</code>
* object. The result is in network byte order: the highest order
* byte of the address is in <code>getAddress()[0]</code>.
* Returns the raw IP address of this {@code InetAddress} object. The result
* is in network byte order: the highest order byte of the address is in
* {@code getAddress()[0]}.
*
* @return the raw IP address of this object.
*/
@ -609,9 +621,10 @@ class Inet6Address extends InetAddress {
* an interface. If no scoped_id is set, the returned value is zero.
*
* @return the scopeId, or zero if not set.
*
* @since 1.5
*/
public int getScopeId () {
public int getScopeId() {
return scope_id;
}
@ -622,22 +635,23 @@ class Inet6Address extends InetAddress {
* @return the scoped interface, or null if not set.
* @since 1.5
*/
public NetworkInterface getScopedInterface () {
public NetworkInterface getScopedInterface() {
return scope_ifname;
}
/**
* Returns the IP address string in textual presentation. If the instance was created
* specifying a scope identifier then the scope id is appended to the IP address preceded by
* a "%" (per-cent) character. This can be either a numeric value or a string, depending on which
* was used to createthe instance.
* Returns the IP address string in textual presentation. If the instance
* was created specifying a scope identifier then the scope id is appended
* to the IP address preceded by a "%" (per-cent) character. This can be
* either a numeric value or a string, depending on which was used to create
* the instance.
*
* @return the raw IP address in a string format.
*/
@Override
public String getHostAddress() {
String s = numericToTextFormat(ipaddress);
if (scope_ifname_set) { /* must check this first */
if (scope_ifname != null) { /* must check this first */
s = s + "%" + scope_ifname.getName();
} else if (scope_id_set) {
s = s + "%" + scope_id;
@ -674,29 +688,27 @@ class Inet6Address extends InetAddress {
}
/**
* Compares this object against the specified object.
* The result is <code>true</code> if and only if the argument is
* not <code>null</code> and it represents the same IP address as
* this object.
* <p>
* Two instances of <code>InetAddress</code> represent the same IP
* address if the length of the byte arrays returned by
* <code>getAddress</code> is the same for both, and each of the
* array components is the same for the byte arrays.
* Compares this object against the specified object. The result is {@code
* true} if and only if the argument is not {@code null} and it represents
* the same IP address as this object.
*
* <p> Two instances of {@code InetAddress} represent the same IP address
* if the length of the byte arrays returned by {@code getAddress} is the
* same for both, and each of the array components is the same for the byte
* arrays.
*
* @param obj the object to compare against.
* @return <code>true</code> if the objects are the same;
* <code>false</code> otherwise.
*
* @return {@code true} if the objects are the same; {@code false} otherwise.
*
* @see java.net.InetAddress#getAddress()
*/
@Override
public boolean equals(Object obj) {
if (obj == null ||
!(obj instanceof Inet6Address))
if (obj == null || !(obj instanceof Inet6Address))
return false;
Inet6Address inetAddr = (Inet6Address)obj;
for (int i = 0; i < INADDRSZ; i++) {
if (ipaddress[i] != inetAddr.ipaddress[i])
return false;
@ -709,8 +721,9 @@ class Inet6Address extends InetAddress {
* Utility routine to check if the InetAddress is an
* IPv4 compatible IPv6 address.
*
* @return a <code>boolean</code> indicating if the InetAddress is
* an IPv4 compatible IPv6 address; or false if address is IPv4 address.
* @return a {@code boolean} indicating if the InetAddress is an IPv4
* compatible IPv6 address; or false if address is IPv4 address.
*
* @since 1.4
*/
public boolean isIPv4CompatibleAddress() {
@ -727,6 +740,7 @@ class Inet6Address extends InetAddress {
// Utilities
private final static int INT16SZ = 2;
/*
* Convert IPv6 binary address into presentation (printable) format.
*
@ -735,9 +749,8 @@ class Inet6Address extends InetAddress {
* textual representation format
* @since 1.4
*/
static String numericToTextFormat(byte[] src)
{
StringBuffer sb = new StringBuffer(39);
static String numericToTextFormat(byte[] src) {
StringBuilder sb = new StringBuilder(39);
for (int i = 0; i < (INADDRSZ / INT16SZ); i++) {
sb.append(Integer.toHexString(((src[i<<1]<<8) & 0xff00)
| (src[(i<<1)+1] & 0xff)));
@ -766,9 +779,8 @@ class Inet6Address extends InetAddress {
private synchronized void writeObject(java.io.ObjectOutputStream s)
throws IOException
{
if (scope_ifname_set) {
if (scope_ifname != null)
ifname = scope_ifname.getName();
}
s.defaultWriteObject();
}
}

View File

@ -1,5 +1,5 @@
<!--
Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 1998, 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
@ -237,6 +237,6 @@ tuning on how the cache is operating.</P>
</UL>
<P>Since these 2 properties are part of the security policy, they are
not set by either the -D option or the System.setProperty() API,
instead they are set in the JRE security policy file <code>lib/security/java.security</code>.</P>
instead they are set as security properties.</P>
</BODY>
</HTML>

View File

@ -695,27 +695,23 @@ public class KeyStore {
}
/**
* Returns the default keystore type as specified in the Java security
* properties file, or the string
* &quot;jks&quot; (acronym for &quot;Java keystore&quot;)
* Returns the default keystore type as specified by the
* {@code keystore.type} security property, or the string
* {@literal "jks"} (acronym for {@literal "Java keystore"})
* if no such property exists.
* The Java security properties file is located in the file named
* &lt;JAVA_HOME&gt;/lib/security/java.security.
* &lt;JAVA_HOME&gt; refers to the value of the java.home system property,
* and specifies the directory where the JRE is installed.
*
* <p>The default keystore type can be used by applications that do not
* want to use a hard-coded keystore type when calling one of the
* <code>getInstance</code> methods, and want to provide a default keystore
* {@code getInstance} methods, and want to provide a default keystore
* type in case a user does not specify its own.
*
* <p>The default keystore type can be changed by setting the value of the
* "keystore.type" security property (in the Java security properties
* file) to the desired keystore type.
* {@code keystore.type} security property to the desired keystore type.
*
* @return the default keystore type as specified in the
* Java security properties file, or the string &quot;jks&quot;
* @return the default keystore type as specified by the
* {@code keystore.type} security property, or the string {@literal "jks"}
* if no such property exists.
* @see java.security.Security security properties
*/
public final static String getDefaultType() {
String kstype;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* 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
@ -48,12 +48,8 @@ import sun.security.util.SecurityConstants;
* <code>getPolicy</code> installs an instance of the default Policy
* implementation (a default subclass implementation of this abstract class).
* The default Policy implementation can be changed by setting the value
* of the "policy.provider" security property (in the Java security properties
* file) to the fully qualified name of the desired Policy subclass
* implementation. The Java security properties file is located in the
* file named &lt;JAVA_HOME&gt;/lib/security/java.security.
* &lt;JAVA_HOME&gt; refers to the value of the java.home system property,
* and specifies the directory where the JRE is installed.
* of the {@code policy.provider} security property to the fully qualified
* name of the desired Policy subclass implementation.
*
* <p> Application code can directly subclass Policy to provide a custom
* implementation. In addition, an instance of a Policy object can be
@ -84,6 +80,7 @@ import sun.security.util.SecurityConstants;
* @see java.security.Provider
* @see java.security.ProtectionDomain
* @see java.security.Permission
* @see java.security.Security security properties
*/
public abstract class Policy {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
@ -39,6 +39,10 @@ import sun.security.jca.*;
* <p>This class centralizes all security properties and common security
* methods. One of its primary uses is to manage providers.
*
* <p>The default values of security properties are read from an
* implementation-specific location, which is typically the properties file
* {@code lib/security/java.security} in the Java installation directory.
*
* @author Benjamin Renaud
*/

View File

@ -281,25 +281,23 @@ public class CertPathBuilder {
}
/**
* Returns the default <code>CertPathBuilder</code> type as specified in
* the Java security properties file, or the string &quot;PKIX&quot;
* if no such property exists. The Java security properties file is
* located in the file named &lt;JAVA_HOME&gt;/lib/security/java.security.
* &lt;JAVA_HOME&gt; refers to the value of the java.home system property,
* and specifies the directory where the JRE is installed.
* Returns the default {@code CertPathBuilder} type as specified by
* the {@code certpathbuilder.type} security property, or the string
* {@literal "PKIX"} if no such property exists.
*
* <p>The default <code>CertPathBuilder</code> type can be used by
* <p>The default {@code CertPathBuilder} type can be used by
* applications that do not want to use a hard-coded type when calling one
* of the <code>getInstance</code> methods, and want to provide a default
* of the {@code getInstance} methods, and want to provide a default
* type in case a user does not specify its own.
*
* <p>The default <code>CertPathBuilder</code> type can be changed by
* setting the value of the "certpathbuilder.type" security property
* (in the Java security properties file) to the desired type.
* <p>The default {@code CertPathBuilder} type can be changed by
* setting the value of the {@code certpathbuilder.type} security property
* to the desired type.
*
* @return the default <code>CertPathBuilder</code> type as specified
* in the Java security properties file, or the string &quot;PKIX&quot;
* if no such property exists.
* @see java.security.Security security properties
* @return the default {@code CertPathBuilder} type as specified
* by the {@code certpathbuilder.type} security property, or the string
* {@literal "PKIX"} if no such property exists.
*/
public final static String getDefaultType() {
String cpbtype =

View File

@ -293,25 +293,23 @@ public class CertPathValidator {
}
/**
* Returns the default <code>CertPathValidator</code> type as specified in
* the Java security properties file, or the string &quot;PKIX&quot;
* if no such property exists. The Java security properties file is
* located in the file named &lt;JAVA_HOME&gt;/lib/security/java.security.
* &lt;JAVA_HOME&gt; refers to the value of the java.home system property,
* and specifies the directory where the JRE is installed.
* Returns the default {@code CertPathValidator} type as specified by
* the {@code certpathvalidator.type} security property, or the string
* {@literal "PKIX"} if no such property exists.
*
* <p>The default <code>CertPathValidator</code> type can be used by
* <p>The default {@code CertPathValidator} type can be used by
* applications that do not want to use a hard-coded type when calling one
* of the <code>getInstance</code> methods, and want to provide a default
* of the {@code getInstance} methods, and want to provide a default
* type in case a user does not specify its own.
*
* <p>The default <code>CertPathValidator</code> type can be changed by
* setting the value of the "certpathvalidator.type" security property
* (in the Java security properties file) to the desired type.
* <p>The default {@code CertPathValidator} type can be changed by
* setting the value of the {@code certpathvalidator.type} security
* property to the desired type.
*
* @return the default <code>CertPathValidator</code> type as specified
* in the Java security properties file, or the string &quot;PKIX&quot;
* if no such property exists.
* @see java.security.Security security properties
* @return the default {@code CertPathValidator} type as specified
* by the {@code certpathvalidator.type} security property, or the string
* {@literal "PKIX"} if no such property exists.
*/
public final static String getDefaultType() {
String cpvtype =

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -389,25 +389,23 @@ public class CertStore {
}
/**
* Returns the default <code>CertStore</code> type as specified in the
* Java security properties file, or the string &quot;LDAP&quot; if no
* such property exists. The Java security properties file is located in
* the file named &lt;JAVA_HOME&gt;/lib/security/java.security.
* &lt;JAVA_HOME&gt; refers to the value of the java.home system property,
* and specifies the directory where the JRE is installed.
* Returns the default {@code CertStore} type as specified by the
* {@code certstore.type} security property, or the string
* {@literal "LDAP"} if no such property exists.
*
* <p>The default <code>CertStore</code> type can be used by applications
* <p>The default {@code CertStore} type can be used by applications
* that do not want to use a hard-coded type when calling one of the
* <code>getInstance</code> methods, and want to provide a default
* <code>CertStore</code> type in case a user does not specify its own.
* {@code getInstance} methods, and want to provide a default
* {@code CertStore} type in case a user does not specify its own.
*
* <p>The default <code>CertStore</code> type can be changed by setting
* the value of the "certstore.type" security property (in the Java
* security properties file) to the desired type.
* <p>The default {@code CertStore} type can be changed by setting
* the value of the {@code certstore.type} security property to the
* desired type.
*
* @return the default <code>CertStore</code> type as specified in the
* Java security properties file, or the string &quot;LDAP&quot;
* if no such property exists.
* @see java.security.Security security properties
* @return the default {@code CertStore} type as specified by the
* {@code certstore.type} security property, or the string
* {@literal "LDAP"} if no such property exists.
*/
public final static String getDefaultType() {
String cstype;

View File

@ -688,7 +688,16 @@ public class DateFormatSymbols implements Serializable, Cloneable {
}
ResourceBundle resource = adapter.getLocaleData().getDateFormatData(locale);
eras = resource.getStringArray("Eras");
// JRE and CLDR use different keys
// JRE: Eras, short.Eras and narrow.Eras
// CLDR: long.Eras, Eras and narrow.Eras
if (resource.containsKey("Eras")) {
eras = resource.getStringArray("Eras");
} else if (resource.containsKey("long.Eras")) {
eras = resource.getStringArray("long.Eras");
} else if (resource.containsKey("short.Eras")) {
eras = resource.getStringArray("short.Eras");
}
months = resource.getStringArray("MonthNames");
shortMonths = resource.getStringArray("MonthAbbreviations");
ampms = resource.getStringArray("AmPmMarkers");

View File

@ -48,12 +48,13 @@ import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.Map;
import java.util.SimpleTimeZone;
import java.util.SortedMap;
import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.calendar.CalendarUtils;
import sun.util.calendar.ZoneInfoFile;
import sun.util.locale.provider.LocaleProviderAdapter;
/**
* <code>SimpleDateFormat</code> is a concrete class for formatting and
@ -1593,6 +1594,17 @@ public class SimpleDateFormat extends DateFormat {
private int matchString(String text, int start, int field,
Map<String,Integer> data, CalendarBuilder calb) {
if (data != null) {
// TODO: make this default when it's in the spec.
if (data instanceof SortedMap) {
for (String name : data.keySet()) {
if (text.regionMatches(true, start, name, 0, name.length())) {
calb.set(field, data.get(name));
return start + name.length();
}
}
return -start;
}
String bestMatch = null;
for (String name : data.keySet()) {
@ -1803,7 +1815,7 @@ public class SimpleDateFormat extends DateFormat {
boolean obeyCount, boolean[] ambiguousYear,
ParsePosition origPos,
boolean useFollowingMinusSignAsDelimiter, CalendarBuilder calb) {
Number number = null;
Number number;
int value = 0;
ParsePosition pos = new ParsePosition(0);
pos.index = start;
@ -1876,9 +1888,7 @@ public class SimpleDateFormat extends DateFormat {
return index;
}
} else {
Map<String, Integer> map = calendar.getDisplayNames(field,
Calendar.ALL_STYLES,
locale);
Map<String, Integer> map = getDisplayNamesMap(field, locale);
if ((index = matchString(text, start, field, map, calb)) > 0) {
return index;
}
@ -1940,7 +1950,7 @@ public class SimpleDateFormat extends DateFormat {
// count >= 3 // i.e., MMM or MMMM
// Want to be able to parse both short and long forms.
// Try count == 4 first:
int newStart = 0;
int newStart;
if ((newStart = matchString(text, start, Calendar.MONTH,
formatData.getMonths(), calb)) > 0) {
return newStart;
@ -1951,9 +1961,7 @@ public class SimpleDateFormat extends DateFormat {
return index;
}
} else {
Map<String, Integer> map = calendar.getDisplayNames(field,
Calendar.ALL_STYLES,
locale);
Map<String, Integer> map = getDisplayNamesMap(field, locale);
if ((index = matchString(text, start, field, map, calb)) > 0) {
return index;
}
@ -1979,7 +1987,7 @@ public class SimpleDateFormat extends DateFormat {
if (useDateFormatSymbols) {
// Want to be able to parse both short and long forms.
// Try count == 4 (DDDD) first:
int newStart = 0;
int newStart;
if ((newStart=matchString(text, start, Calendar.DAY_OF_WEEK,
formatData.getWeekdays(), calb)) > 0) {
return newStart;
@ -2008,7 +2016,7 @@ public class SimpleDateFormat extends DateFormat {
return index;
}
} else {
Map<String,Integer> map = calendar.getDisplayNames(field, Calendar.ALL_STYLES, locale);
Map<String,Integer> map = getDisplayNamesMap(field, locale);
if ((index = matchString(text, start, field, map, calb)) > 0) {
return index;
}
@ -2098,7 +2106,7 @@ public class SimpleDateFormat extends DateFormat {
break parsing;
}
int sign = 0;
int sign;
char c = text.charAt(pos.index);
if (c == 'Z') {
calb.set(Calendar.ZONE_OFFSET, 0).set(Calendar.DST_OFFSET, 0);
@ -2340,6 +2348,21 @@ public class SimpleDateFormat extends DateFormat {
&& formatData.equals(that.formatData));
}
private static final int[] REST_OF_STYLES = {
Calendar.SHORT_STANDALONE, Calendar.LONG_FORMAT, Calendar.LONG_STANDALONE,
};
private Map<String, Integer> getDisplayNamesMap(int field, Locale locale) {
Map<String, Integer> map = calendar.getDisplayNames(field, Calendar.SHORT_FORMAT, locale);
// Get all SHORT and LONG styles (avoid NARROW styles).
for (int style : REST_OF_STYLES) {
Map<String, Integer> m = calendar.getDisplayNames(field, style, locale);
if (m != null) {
map.putAll(m);
}
}
return map;
}
/**
* After reading an object from the input stream, the format
* pattern in the object is verified.

View File

@ -289,8 +289,8 @@ public class Base64 {
*
* <p> This method first encodes all input bytes into a base64 encoded
* byte array and then constructs a new String by using the encoded byte
* array and the {@link java.nio.charset.StandardCharsets.ISO_8859_1 ISO-8859-1}
* charset.
* array and the {@link java.nio.charset.StandardCharsets#ISO_8859_1
* ISO-8859-1} charset.
*
* <p> In other words, an invocation of this method has exactly the same
* effect as invoking
@ -358,9 +358,9 @@ public class Base64 {
* to encode any more input bytes. The encoding operation can be
* continued, if there is more bytes in input buffer to be encoded,
* by invoking this method again with an output buffer that has more
* {@linkplain Buffer#remaining remaining} bytes. This is typically
* done by draining any encoded bytes from the output buffer. The
* value returned from last invocation needs to be passed in as the
* {@linkplain java.nio.Buffer#remaining remaining} bytes. This is
* typically done by draining any encoded bytes from the output buffer.
* The value returned from last invocation needs to be passed in as the
* third parameter {@code bytesOut} if it is to continue an unfinished
* encoding, 0 otherwise.
*
@ -806,9 +806,9 @@ public class Base64 {
* buffer has insufficient space to decode any more input bytes.
* The decoding operation can be continued, if there is more bytes
* in input buffer to be decoded, by invoking this method again with
* an output buffer that has more {@linkplain Buffer#remaining remaining}
* bytes.This is typically done by draining any decoded bytes from the
* output buffer.
* an output buffer that has more {@linkplain java.nio.Buffer#remaining
* remaining} bytes. This is typically done by draining any decoded
* bytes from the output buffer.
*
* <p><b>Recommended Usage Example</b>
* <pre>

View File

@ -53,9 +53,7 @@ import java.text.DateFormat;
import java.text.DateFormatSymbols;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.spi.CalendarDataProvider;
import sun.util.BuddhistCalendar;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.calendar.ZoneInfo;
import sun.util.locale.provider.CalendarDataUtility;
@ -743,6 +741,32 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
*/
public static final int LONG = 2;
/**
* A style specifier for {@link #getDisplayName(int, int, Locale)
* getDisplayName} and {@link #getDisplayNames(int, int, Locale)
* getDisplayNames} indicating a narrow name used for format. Narrow names
* are typically single character strings, such as "M" for Monday.
*
* @see #NARROW_STANDALONE
* @see #SHORT_FORMAT
* @see #LONG_FOTMAT
* @since 1.8
*/
public static final int NARROW_FORMAT = 4;
/**
* A style specifier for {@link #getDisplayName(int, int, Locale)
* getDisplayName} and {@link #getDisplayNames(int, int, Locale)
* getDisplayNames} indicating a narrow name independently. Narrow names
* are typically single character strings, such as "M" for Monday.
*
* @see #NARROW_FORMAT
* @see #SHORT_STANDALONE
* @see #LONG_STANDALONE
* @since 1.8
*/
public static final int NARROW_STANDALONE = NARROW_FORMAT | STANDALONE_MASK;
/**
* A style specifier for {@link #getDisplayName(int, int, Locale)
* getDisplayName} and {@link #getDisplayNames(int, int, Locale)
@ -1472,30 +1496,31 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* @param style
* the style applied to the string representation; one of {@link
* #SHORT_FORMAT} ({@link #SHORT}), {@link #SHORT_STANDALONE},
* {@link #LONG_FORMAT} ({@link #LONG}) or {@link #LONG_STANDALONE}.
* {@link #LONG_FORMAT} ({@link #LONG}), {@link #LONG_STANDALONE},
* {@link #NARROW_FORMAT}, or {@link #NARROW_STANDALONE}.
* @param locale
* the locale for the string representation
* (any calendar types specified by {@code locale} are ignored)
* @return the string representation of the given
* <code>field</code> in the given <code>style</code>, or
* <code>null</code> if no string representation is
* {@code field} in the given {@code style}, or
* {@code null} if no string representation is
* applicable.
* @exception IllegalArgumentException
* if <code>field</code> or <code>style</code> is invalid,
* or if this <code>Calendar</code> is non-lenient and any
* if {@code field} or {@code style} is invalid,
* or if this {@code Calendar} is non-lenient and any
* of the calendar fields have invalid values
* @exception NullPointerException
* if <code>locale</code> is null
* if {@code locale} is null
* @since 1.6
*/
public String getDisplayName(int field, int style, Locale locale) {
if (!checkDisplayNameParams(field, style, SHORT, LONG, locale,
if (!checkDisplayNameParams(field, style, SHORT, NARROW_FORMAT, locale,
ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
return null;
}
// the standalone styles are supported only through CalendarDataProviders.
if (isStandaloneStyle(style)) {
// the standalone and narrow styles are supported only through CalendarDataProviders.
if (isStandaloneStyle(style) || isNarrowStyle(style)) {
return CalendarDataUtility.retrieveFieldValueName(getCalendarType(),
field, get(field),
style, locale);
@ -1513,26 +1538,30 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
}
/**
* Returns a <code>Map</code> containing all names of the calendar
* <code>field</code> in the given <code>style</code> and
* <code>locale</code> and their corresponding field values. For
* example, if this <code>Calendar</code> is a {@link
* Returns a {@code Map} containing all names of the calendar
* {@code field} in the given {@code style} and
* {@code locale} and their corresponding field values. For
* example, if this {@code Calendar} is a {@link
* GregorianCalendar}, the returned map would contain "Jan" to
* {@link #JANUARY}, "Feb" to {@link #FEBRUARY}, and so on, in the
* {@linkplain #SHORT short} style in an English locale.
*
* <p>Narrow names may not be unique due to use of single characters,
* such as "S" for Sunday and Saturday. In that case narrow names are not
* included in the returned {@code Map}.
*
* <p>The values of other calendar fields may be taken into
* account to determine a set of display names. For example, if
* this <code>Calendar</code> is a lunisolar calendar system and
* this {@code Calendar} is a lunisolar calendar system and
* the year value given by the {@link #YEAR} field has a leap
* month, this method would return month names containing the leap
* month name, and month names are mapped to their values specific
* for the year.
*
* <p>The default implementation supports display names contained in
* a {@link DateFormatSymbols}. For example, if <code>field</code>
* is {@link #MONTH} and <code>style</code> is {@link
* #ALL_STYLES}, this method returns a <code>Map</code> containing
* a {@link DateFormatSymbols}. For example, if {@code field}
* is {@link #MONTH} and {@code style} is {@link
* #ALL_STYLES}, this method returns a {@code Map} containing
* all strings returned by {@link DateFormatSymbols#getShortMonths()}
* and {@link DateFormatSymbols#getMonths()}.
*
@ -1541,30 +1570,31 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
* @param style
* the style applied to the string representation; one of {@link
* #SHORT_FORMAT} ({@link #SHORT}), {@link #SHORT_STANDALONE},
* {@link #LONG_FORMAT} ({@link #LONG}) or {@link #LONG_STANDALONE}.
* {@link #LONG_FORMAT} ({@link #LONG}), {@link #LONG_STANDALONE},
* {@link #NARROW_FORMAT}, or {@link #NARROW_STANDALONE}
* @param locale
* the locale for the display names
* @return a <code>Map</code> containing all display names in
* <code>style</code> and <code>locale</code> and their
* field values, or <code>null</code> if no display names
* are defined for <code>field</code>
* @return a {@code Map} containing all display names in
* {@code style} and {@code locale} and their
* field values, or {@code null} if no display names
* are defined for {@code field}
* @exception IllegalArgumentException
* if <code>field</code> or <code>style</code> is invalid,
* or if this <code>Calendar</code> is non-lenient and any
* if {@code field} or {@code style} is invalid,
* or if this {@code Calendar} is non-lenient and any
* of the calendar fields have invalid values
* @exception NullPointerException
* if <code>locale</code> is null
* if {@code locale} is null
* @since 1.6
*/
public Map<String, Integer> getDisplayNames(int field, int style, Locale locale) {
if (!checkDisplayNameParams(field, style, ALL_STYLES, LONG, locale,
if (!checkDisplayNameParams(field, style, ALL_STYLES, NARROW_FORMAT, locale,
ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
return null;
}
if (style == ALL_STYLES || isStandaloneStyle(style)) {
return CalendarDataUtility.retrieveFieldValueNames(getCalendarType(), field, style, locale);
}
// SHORT or LONG
// SHORT, LONG, or NARROW
return getDisplayNamesImpl(field, style, locale);
}
@ -1599,6 +1629,12 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
private String[] getFieldStrings(int field, int style, DateFormatSymbols symbols) {
int baseStyle = getBaseStyle(style); // ignore the standalone mask
// DateFormatSymbols doesn't support any narrow names.
if (baseStyle == NARROW_FORMAT) {
return null;
}
String[] strings = null;
switch (field) {
case ERA:
@ -1948,6 +1984,10 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
return (style & STANDALONE_MASK) != 0;
}
boolean isNarrowStyle(int style) {
return style == NARROW_FORMAT || style == NARROW_STANDALONE;
}
/**
* Returns the pseudo-time-stamp for two fields, given their
* individual pseudo-time-stamps. If either of the fields

View File

@ -946,8 +946,9 @@ class JapaneseImperialCalendar extends Calendar {
set(field, getRolledValue(internalGet(field), amount, min, max));
}
@Override
public String getDisplayName(int field, int style, Locale locale) {
if (!checkDisplayNameParams(field, style, SHORT, LONG, locale,
if (!checkDisplayNameParams(field, style, SHORT, NARROW_FORMAT, locale,
ERA_MASK|YEAR_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
return null;
}
@ -956,11 +957,12 @@ class JapaneseImperialCalendar extends Calendar {
// "GanNen" is supported only in the LONG style.
if (field == YEAR
&& (getBaseStyle(style) == SHORT || fieldValue != 1 || get(ERA) == 0)) {
&& (getBaseStyle(style) != LONG || fieldValue != 1 || get(ERA) == 0)) {
return null;
}
String name = CalendarDataUtility.retrieveFieldValueName("japanese", field, fieldValue, style, locale);
String name = CalendarDataUtility.retrieveFieldValueName(getCalendarType(), field,
fieldValue, style, locale);
// If the ERA value is null, then
// try to get its name or abbreviation from the Era instance.
if (name == null && field == ERA && fieldValue < eras.length) {
@ -970,27 +972,37 @@ class JapaneseImperialCalendar extends Calendar {
return name;
}
@Override
public Map<String,Integer> getDisplayNames(int field, int style, Locale locale) {
if (!checkDisplayNameParams(field, style, ALL_STYLES, LONG, locale,
if (!checkDisplayNameParams(field, style, ALL_STYLES, NARROW_FORMAT, locale,
ERA_MASK|YEAR_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
return null;
}
Map<String, Integer> names = CalendarDataUtility.retrieveFieldValueNames("japanese", field, style, locale);
Map<String, Integer> names;
names = CalendarDataUtility.retrieveFieldValueNames(getCalendarType(), field, style, locale);
// If strings[] has fewer than eras[], get more names from eras[].
if (field == ERA) {
int size = names.size();
if (style == ALL_STYLES) {
size /= 2; // SHORT and LONG
}
if (size < eras.length) {
int baseStyle = getBaseStyle(style);
for (int i = size; i < eras.length; i++) {
Era era = eras[i];
if (baseStyle == ALL_STYLES || baseStyle == SHORT) {
names.put(era.getAbbreviation(), i);
if (names != null) {
if (field == ERA) {
int size = names.size();
if (style == ALL_STYLES) {
Set<Integer> values = new HashSet<>();
// count unique era values
for (String key : names.keySet()) {
values.add(names.get(key));
}
if (baseStyle == ALL_STYLES || baseStyle == LONG) {
names.put(era.getName(), i);
size = values.size();
}
if (size < eras.length) {
int baseStyle = getBaseStyle(style);
for (int i = size; i < eras.length; i++) {
Era era = eras[i];
if (baseStyle == ALL_STYLES || baseStyle == SHORT
|| baseStyle == NARROW_FORMAT) {
names.put(era.getAbbreviation(), i);
}
if (baseStyle == ALL_STYLES || baseStyle == LONG) {
names.put(era.getName(), i);
}
}
}
}

View File

@ -43,12 +43,12 @@ import java.lang.ref.SoftReference;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.concurrent.ConcurrentHashMap;
import sun.misc.SharedSecrets;
import sun.misc.JavaAWTAccess;
import sun.misc.SharedSecrets;
import sun.security.action.GetPropertyAction;
import sun.util.locale.provider.TimeZoneNameUtility;
import sun.util.calendar.ZoneInfo;
import sun.util.calendar.ZoneInfoFile;
import sun.util.locale.provider.TimeZoneNameUtility;
/**
* <code>TimeZone</code> represents a time zone offset, and also figures out daylight
@ -399,28 +399,23 @@ abstract public class TimeZone implements Serializable, Cloneable {
if (style != SHORT && style != LONG) {
throw new IllegalArgumentException("Illegal style: " + style);
}
String id = getID();
String[] names = getDisplayNames(id, locale);
if (names == null) {
if (id.startsWith("GMT") && id.length() > 3) {
char sign = id.charAt(3);
if (sign == '+' || sign == '-') {
return id;
}
}
int offset = getRawOffset();
if (daylight) {
offset += getDSTSavings();
}
return ZoneInfoFile.toCustomID(offset);
String name = TimeZoneNameUtility.retrieveDisplayName(id, daylight, style, locale);
if (name != null) {
return name;
}
int index = daylight ? 3 : 1;
if (style == SHORT) {
index++;
if (id.startsWith("GMT") && id.length() > 3) {
char sign = id.charAt(3);
if (sign == '+' || sign == '-') {
return id;
}
}
return names[index];
int offset = getRawOffset();
if (daylight) {
offset += getDSTSavings();
}
return ZoneInfoFile.toCustomID(offset);
}
private static class DisplayNames {
@ -429,9 +424,12 @@ abstract public class TimeZone implements Serializable, Cloneable {
// Map(key=id, value=SoftReference(Map(key=locale, value=displaynames)))
private static final Map<String, SoftReference<Map<Locale, String[]>>> CACHE =
new ConcurrentHashMap<>();
private DisplayNames() {
}
}
private static final String[] getDisplayNames(String id, Locale locale) {
private static String[] getDisplayNames(String id, Locale locale) {
Map<String, SoftReference<Map<Locale, String[]>>> displayNames = DisplayNames.CACHE;
SoftReference<Map<Locale, String[]>> ref = displayNames.get(id);
@ -631,14 +629,14 @@ abstract public class TimeZone implements Serializable, Cloneable {
}
private static synchronized TimeZone setDefaultZone() {
TimeZone tz = null;
TimeZone tz;
// get the time zone ID from the system properties
String zoneID = AccessController.doPrivileged(
new GetPropertyAction("user.timezone"));
// if the time zone ID is not set (yet), perform the
// platform to Java time zone ID mapping.
if (zoneID == null || zoneID.equals("")) {
if (zoneID == null || zoneID.isEmpty()) {
String country = AccessController.doPrivileged(
new GetPropertyAction("user.country"));
String javaHome = AccessController.doPrivileged(
@ -670,8 +668,9 @@ abstract public class TimeZone implements Serializable, Cloneable {
assert tz != null;
final String id = zoneID;
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
System.setProperty("user.timezone", id);
return null;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 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

Some files were not shown because too many files have changed in this diff Show More