Merge
This commit is contained in:
commit
c2735a15d7
make
autoconf
data/characterdata
src
hotspot/cpu/aarch64
java.base/share/classes
jdk.compiler/share/classes/com/sun/tools/javac/code
test
jdk
java
security/Provider
util
ArrayList
Base64
Collection
jar/JarFile/mrjar
jdk/nio/zipfs
lib/testlibrary/java/util/jar
sun
net/www/protocol/jar
nio/cs
EUCTWBufferBoundaryDecodeTest.javaMalformedSurrogateStringTest.javaTestCp834_SBCS.javatradChinese.potradChinese.win.po
security/tools/jarsigner/multiRelease
langtools/tools/javac/MethodParameters
@ -1187,9 +1187,6 @@ AC_DEFUN_ONCE([BASIC_CHECK_SRC_PERMS],
|
||||
|
||||
AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES],
|
||||
[
|
||||
# Did user specify any unknown variables?
|
||||
BASIC_CHECK_LEFTOVER_OVERRIDDEN
|
||||
|
||||
AC_MSG_CHECKING([if build directory is on local disk])
|
||||
BASIC_CHECK_DIR_ON_LOCAL_DISK($OUTPUTDIR,
|
||||
[OUTPUT_DIR_IS_LOCAL="yes"],
|
||||
|
@ -280,6 +280,9 @@ CUSTOM_LATE_HOOK
|
||||
# This needs to be done after CUSTOM_LATE_HOOK since we can setup custom features.
|
||||
HOTSPOT_VALIDATE_JVM_FEATURES
|
||||
|
||||
# Did user specify any unknown variables?
|
||||
BASIC_CHECK_LEFTOVER_OVERRIDDEN
|
||||
|
||||
# We're messing a bit with internal autoconf variables to put the config.status
|
||||
# in the output directory instead of the current directory.
|
||||
CONFIG_STATUS="$CONFIGURESUPPORT_OUTPUTDIR/config.status"
|
||||
|
@ -5215,7 +5215,7 @@ VS_SDK_PLATFORM_NAME_2017=
|
||||
#CUSTOM_AUTOCONF_INCLUDE
|
||||
|
||||
# Do not change or remove the following line, it is needed for consistency checks:
|
||||
DATE_WHEN_GENERATED=1517244998
|
||||
DATE_WHEN_GENERATED=1517446789
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
@ -69083,16 +69083,6 @@ $as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
# Did user specify any unknown variables?
|
||||
|
||||
if test "x$CONFIGURE_OVERRIDDEN_VARIABLES" != x; then
|
||||
# Replace the separating ! with spaces before presenting for end user.
|
||||
unknown_variables=${CONFIGURE_OVERRIDDEN_VARIABLES//!/ }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The following variables might be unknown to configure: $unknown_variables" >&5
|
||||
$as_echo "$as_me: WARNING: The following variables might be unknown to configure: $unknown_variables" >&2;}
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if build directory is on local disk" >&5
|
||||
$as_echo_n "checking if build directory is on local disk... " >&6; }
|
||||
|
||||
@ -69174,6 +69164,16 @@ $as_echo "$JVM_FEATURES_TO_TEST" >&6; }
|
||||
done
|
||||
|
||||
|
||||
# Did user specify any unknown variables?
|
||||
|
||||
if test "x$CONFIGURE_OVERRIDDEN_VARIABLES" != x; then
|
||||
# Replace the separating ! with spaces before presenting for end user.
|
||||
unknown_variables=${CONFIGURE_OVERRIDDEN_VARIABLES//!/ }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The following variables might be unknown to configure: $unknown_variables" >&5
|
||||
$as_echo "$as_me: WARNING: The following variables might be unknown to configure: $unknown_variables" >&2;}
|
||||
fi
|
||||
|
||||
|
||||
# We're messing a bit with internal autoconf variables to put the config.status
|
||||
# in the output directory instead of the current directory.
|
||||
CONFIG_STATUS="$CONFIGURESUPPORT_OUTPUTDIR/config.status"
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
package java.lang;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/** The CharacterData class encapsulates the large tables found in
|
||||
Java.lang.Character. */
|
||||
|
||||
@ -159,20 +161,39 @@ class CharacterDataLatin1 extends CharacterData {
|
||||
return toUpperCase(ch);
|
||||
}
|
||||
|
||||
// Digit values for codePoints in the 0-255 range. Contents generated using:
|
||||
// for (char i = 0; i < 256; i++) {
|
||||
// int v = -1;
|
||||
// if (i >= '0' && i <= '9') { v = i - '0'; }
|
||||
// else if (i >= 'A' && i <= 'Z') { v = i - 'A' + 10; }
|
||||
// else if (i >= 'a' && i <= 'z') { v = i - 'a' + 10; }
|
||||
// if (i % 20 == 0) System.out.println();
|
||||
// System.out.printf("%2d, ", v);
|
||||
// }
|
||||
//
|
||||
// Analysis has shown that generating the whole array allows the JIT to generate
|
||||
// better code compared to a slimmed down array, such as one cutting off after 'z'
|
||||
private static final byte[] DIGITS = new byte[] {
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1,
|
||||
-1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
||||
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1, 10, 11, 12,
|
||||
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
|
||||
33, 34, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
|
||||
|
||||
int digit(int ch, int radix) {
|
||||
int value = -1;
|
||||
if (radix >= Character.MIN_RADIX && radix <= Character.MAX_RADIX) {
|
||||
int val = getProperties(ch);
|
||||
int kind = val & $$maskType;
|
||||
if (kind == Character.DECIMAL_DIGIT_NUMBER) {
|
||||
value = ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit;
|
||||
}
|
||||
else if ((val & $$maskNumericType) == $$valueJavaSupradecimal) {
|
||||
// Java supradecimal digit
|
||||
value = (ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit) + 10;
|
||||
}
|
||||
int value = DIGITS[ch];
|
||||
if (value >= 0 && radix >= Character.MIN_RADIX && radix <= Character.MAX_RADIX) {
|
||||
value = (value < radix) ? value : -1;
|
||||
}
|
||||
return (value < radix) ? value : -1;
|
||||
return value;
|
||||
}
|
||||
|
||||
int getNumericValue(int ch) {
|
||||
|
@ -1050,7 +1050,7 @@ void MacroAssembler::lookup_virtual_method(Register recv_klass,
|
||||
} else {
|
||||
vtable_offset_in_bytes += vtable_index.as_constant() * wordSize;
|
||||
ldr(method_result,
|
||||
form_address(rscratch1, recv_klass, vtable_offset_in_bytes));
|
||||
form_address(rscratch1, recv_klass, vtable_offset_in_bytes, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1143,6 +1143,23 @@ public class ArrayList<E> extends AbstractList<E>
|
||||
return modified;
|
||||
}
|
||||
|
||||
public Object[] toArray() {
|
||||
checkForComodification();
|
||||
return Arrays.copyOfRange(root.elementData, offset, offset + size);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T[] toArray(T[] a) {
|
||||
checkForComodification();
|
||||
if (a.length < size)
|
||||
return (T[]) Arrays.copyOfRange(
|
||||
root.elementData, offset, offset + size, a.getClass());
|
||||
System.arraycopy(root.elementData, offset, a, 0, size);
|
||||
if (a.length > size)
|
||||
a[size] = null;
|
||||
return a;
|
||||
}
|
||||
|
||||
public Iterator<E> iterator() {
|
||||
return listIterator();
|
||||
}
|
||||
|
@ -116,8 +116,8 @@ public class Base64 {
|
||||
*
|
||||
* @param lineLength
|
||||
* the length of each output line (rounded down to nearest multiple
|
||||
* of 4). If {@code lineLength <= 0} the output will not be separated
|
||||
* in lines
|
||||
* of 4). If the rounded down line length is not a positive value,
|
||||
* the output will not be separated in lines
|
||||
* @param lineSeparator
|
||||
* the line separator for each output line
|
||||
*
|
||||
@ -135,10 +135,12 @@ public class Base64 {
|
||||
throw new IllegalArgumentException(
|
||||
"Illegal base64 line separator character 0x" + Integer.toString(b, 16));
|
||||
}
|
||||
// round down to nearest multiple of 4
|
||||
lineLength &= ~0b11;
|
||||
if (lineLength <= 0) {
|
||||
return Encoder.RFC4648;
|
||||
}
|
||||
return new Encoder(false, lineSeparator, lineLength >> 2 << 2, true);
|
||||
return new Encoder(false, lineSeparator, lineLength, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -236,10 +236,8 @@ public class DoubleByte {
|
||||
int b2 = src[sp++] & 0xff;
|
||||
if (b2 < b2Min || b2 > b2Max ||
|
||||
(c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
|
||||
if (b2c[b1] == B2C_UNMAPPABLE || // isNotLeadingByte
|
||||
b2c[b2] != B2C_UNMAPPABLE || // isLeadingByte
|
||||
decodeSingle(b2) != UNMAPPABLE_DECODING) {
|
||||
sp--;
|
||||
if (crMalformedOrUnmappable(b1, b2).length() == 1) {
|
||||
sp--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -472,6 +470,13 @@ public class DoubleByte {
|
||||
b2cSB_UNMAPPABLE = new char[0x100];
|
||||
Arrays.fill(b2cSB_UNMAPPABLE, UNMAPPABLE_DECODING);
|
||||
}
|
||||
|
||||
// always returns unmappableForLenth(2) for doublebyte_only
|
||||
@Override
|
||||
protected CoderResult crMalformedOrUnmappable(int b1, int b2) {
|
||||
return CoderResult.unmappableForLength(2);
|
||||
}
|
||||
|
||||
public Decoder_DBCSONLY(Charset cs, char[][] b2c, char[] b2cSB, int b2Min, int b2Max,
|
||||
boolean isASCIICompatible) {
|
||||
super(cs, 0.5f, 1.0f, b2c, b2cSB_UNMAPPABLE, b2Min, b2Max, isASCIICompatible);
|
||||
|
@ -1889,7 +1889,7 @@ public abstract class Symbol extends AnnoConstruct implements Element {
|
||||
Name paramName = name.table.fromString("arg" + i);
|
||||
VarSymbol param = new VarSymbol(PARAMETER, paramName, t, this);
|
||||
newParams.append(param);
|
||||
|
||||
i++;
|
||||
}
|
||||
params = newParams.toList();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,7 +27,7 @@ import java.lang.Exception;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8030823 8130696
|
||||
* @bug 8030823 8130696 8196414
|
||||
* @run main/othervm ProviderVersionCheck
|
||||
* @summary Verify all providers in the default Providers list have the proper
|
||||
* version for the release
|
||||
@ -42,7 +42,8 @@ public class ProviderVersionCheck {
|
||||
|
||||
for (Provider p: Security.getProviders()) {
|
||||
System.out.print(p.getName() + " ");
|
||||
if (p.getVersion() != 10.0d) {
|
||||
String specVersion = System.getProperty("java.specification.version");
|
||||
if (p.getVersion() != Double.parseDouble(specVersion)) {
|
||||
System.out.println("failed. " + "Version received was " +
|
||||
p.getVersion());
|
||||
failure = true;
|
||||
|
@ -642,6 +642,24 @@ public class IteratorMicroBenchmark {
|
||||
for (Object o : a)
|
||||
sum[0] += (Integer) o;
|
||||
check.sum(sum[0]);}}},
|
||||
new Job("ArrayList subList .toArray()") {
|
||||
public void work() throws Throwable {
|
||||
int[] sum = new int[1];
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
sum[0] = 0;
|
||||
for (Object o : asSubList(al).toArray())
|
||||
sum[0] += (Integer) o;
|
||||
check.sum(sum[0]);}}},
|
||||
new Job("ArrayList subList .toArray(a)") {
|
||||
public void work() throws Throwable {
|
||||
Integer[] a = new Integer[size];
|
||||
int[] sum = new int[1];
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
sum[0] = 0;
|
||||
asSubList(al).toArray(a);
|
||||
for (Object o : a)
|
||||
sum[0] += (Integer) o;
|
||||
check.sum(sum[0]);}}},
|
||||
new Job("ArrayDeque.toArray()") {
|
||||
public void work() throws Throwable {
|
||||
int[] sum = new int[1];
|
||||
|
@ -34,23 +34,23 @@ import static java.nio.charset.StandardCharsets.US_ASCII;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8007799
|
||||
* @bug 8007799 8176379
|
||||
* @summary test Encoder with linemax == 0, line separator should not appear in encoded data
|
||||
*/
|
||||
|
||||
public class Base64GetEncoderTest {
|
||||
|
||||
public static void main(String args[]) throws Throwable {
|
||||
final Base64.Encoder encoder = Base64.getMimeEncoder(0, "$$$".getBytes(US_ASCII));
|
||||
|
||||
testEncodeToString(encoder);
|
||||
for (int maxlen = -4; maxlen < 4; maxlen++) {
|
||||
|
||||
testWrapEncode1(encoder);
|
||||
|
||||
testEncodeToStringWithLongInputData(encoder);
|
||||
|
||||
testWrapEncode2(encoder);
|
||||
final Base64.Encoder encoder = Base64.getMimeEncoder(maxlen, "$$$".getBytes(US_ASCII));
|
||||
|
||||
testEncodeToString(encoder);
|
||||
testWrapEncode1(encoder);
|
||||
testEncodeToStringWithLongInputData(encoder);
|
||||
testWrapEncode2(encoder);
|
||||
}
|
||||
}
|
||||
|
||||
private static void testWrapEncode2(final Base64.Encoder encoder)
|
||||
|
@ -24,7 +24,7 @@
|
||||
/**
|
||||
* @test
|
||||
* @bug 4235519 8004212 8005394 8007298 8006295 8006315 8006530 8007379 8008925
|
||||
* 8014217 8025003 8026330 8028397 8129544 8165243
|
||||
* 8014217 8025003 8026330 8028397 8129544 8165243 8176379
|
||||
* @summary tests java.util.Base64
|
||||
* @library /test/lib
|
||||
* @build jdk.test.lib.RandomFactory
|
||||
@ -78,6 +78,21 @@ public class TestBase64 {
|
||||
numRuns, numBytes);
|
||||
}
|
||||
|
||||
// test mime case with < 4 length
|
||||
for (int len = 0; len < 4; len++) {
|
||||
test(Base64.getMimeEncoder(len, nl_1),
|
||||
Base64.getMimeDecoder(),
|
||||
numRuns, numBytes);
|
||||
|
||||
test(Base64.getMimeEncoder(len, nl_2),
|
||||
Base64.getMimeDecoder(),
|
||||
numRuns, numBytes);
|
||||
|
||||
test(Base64.getMimeEncoder(len, nl_3),
|
||||
Base64.getMimeDecoder(),
|
||||
numRuns, numBytes);
|
||||
}
|
||||
|
||||
testNull(Base64.getEncoder());
|
||||
testNull(Base64.getUrlEncoder());
|
||||
testNull(Base64.getMimeEncoder());
|
||||
|
@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
import static java.util.stream.Collectors.summingInt;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static java.util.stream.Collectors.toCollection;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayDeque;
|
||||
@ -46,6 +46,7 @@ import java.util.Vector;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.LinkedTransferQueue;
|
||||
@ -55,6 +56,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.LongAdder;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Usage: [iterations=N] [size=N] [filter=REGEXP] [warmup=SECONDS]
|
||||
@ -79,7 +81,7 @@ public class IteratorMicroBenchmark {
|
||||
final int size; // number of elements in collections
|
||||
final double warmupSeconds;
|
||||
final long warmupNanos;
|
||||
final Pattern filter; // select subset of Jobs to run
|
||||
final Pattern nameFilter; // select subset of Jobs to run
|
||||
final boolean reverse; // reverse order of Jobs
|
||||
final boolean shuffle; // randomize order of Jobs
|
||||
|
||||
@ -87,7 +89,7 @@ public class IteratorMicroBenchmark {
|
||||
iterations = intArg(args, "iterations", 10_000);
|
||||
size = intArg(args, "size", 1000);
|
||||
warmupSeconds = doubleArg(args, "warmup", 7.0);
|
||||
filter = patternArg(args, "filter");
|
||||
nameFilter = patternArg(args, "filter");
|
||||
reverse = booleanArg(args, "reverse");
|
||||
shuffle = booleanArg(args, "shuffle");
|
||||
|
||||
@ -204,13 +206,6 @@ public class IteratorMicroBenchmark {
|
||||
throw new IllegalArgumentException(val);
|
||||
}
|
||||
|
||||
private static List<Job> filter(Pattern filter, List<Job> jobs) {
|
||||
return (filter == null) ? jobs
|
||||
: jobs.stream()
|
||||
.filter(job -> filter.matcher(job.name()).find())
|
||||
.collect(toList());
|
||||
}
|
||||
|
||||
private static void deoptimize(int sum) {
|
||||
if (sum == 42)
|
||||
System.out.println("the answer");
|
||||
@ -249,7 +244,7 @@ public class IteratorMicroBenchmark {
|
||||
void run() throws Throwable {
|
||||
// System.out.printf(
|
||||
// "iterations=%d size=%d, warmup=%1g, filter=\"%s\"%n",
|
||||
// iterations, size, warmupSeconds, filter);
|
||||
// iterations, size, warmupSeconds, nameFilter);
|
||||
|
||||
final ArrayList<Integer> al = new ArrayList<>(size);
|
||||
|
||||
@ -268,34 +263,48 @@ public class IteratorMicroBenchmark {
|
||||
abq.add(abq.remove());
|
||||
}
|
||||
|
||||
ArrayList<Job> jobs = new ArrayList<>();
|
||||
|
||||
List.<Collection<Integer>>of(
|
||||
al, ad, abq,
|
||||
new LinkedList<>(al),
|
||||
new PriorityQueue<>(al),
|
||||
new Vector<>(al),
|
||||
new ConcurrentLinkedQueue<>(al),
|
||||
new ConcurrentLinkedDeque<>(al),
|
||||
new LinkedBlockingQueue<>(al),
|
||||
new LinkedBlockingDeque<>(al),
|
||||
new LinkedTransferQueue<>(al),
|
||||
new PriorityBlockingQueue<>(al)).forEach(
|
||||
x -> {
|
||||
jobs.addAll(collectionJobs(x));
|
||||
if (x instanceof Deque)
|
||||
jobs.addAll(dequeJobs((Deque<Integer>)x));
|
||||
});
|
||||
ArrayList<Job> jobs = Stream.<Collection<Integer>>of(
|
||||
al, ad, abq,
|
||||
new LinkedList<>(al),
|
||||
new PriorityQueue<>(al),
|
||||
new Vector<>(al),
|
||||
new CopyOnWriteArrayList<>(al),
|
||||
new ConcurrentLinkedQueue<>(al),
|
||||
new ConcurrentLinkedDeque<>(al),
|
||||
new LinkedBlockingQueue<>(al),
|
||||
new LinkedBlockingDeque<>(al),
|
||||
new LinkedTransferQueue<>(al),
|
||||
new PriorityBlockingQueue<>(al))
|
||||
.flatMap(x -> jobs(x))
|
||||
.filter(job ->
|
||||
nameFilter == null || nameFilter.matcher(job.name()).find())
|
||||
.collect(toCollection(ArrayList::new));
|
||||
|
||||
if (reverse) Collections.reverse(jobs);
|
||||
if (shuffle) Collections.shuffle(jobs);
|
||||
|
||||
time(filter(filter, jobs));
|
||||
time(jobs);
|
||||
}
|
||||
|
||||
List<Job> collectionJobs(Collection<Integer> x) {
|
||||
@SafeVarargs @SuppressWarnings("varargs")
|
||||
private <T> Stream<T> concatStreams(Stream<T> ... streams) {
|
||||
return Stream.of(streams).flatMap(s -> s);
|
||||
}
|
||||
|
||||
Stream<Job> jobs(Collection<Integer> x) {
|
||||
return concatStreams(
|
||||
collectionJobs(x),
|
||||
(x instanceof Deque)
|
||||
? dequeJobs((Deque<Integer>)x)
|
||||
: Stream.empty(),
|
||||
(x instanceof List)
|
||||
? listJobs((List<Integer>)x)
|
||||
: Stream.empty());
|
||||
}
|
||||
|
||||
Stream<Job> collectionJobs(Collection<Integer> x) {
|
||||
String klazz = x.getClass().getSimpleName();
|
||||
return List.of(
|
||||
return Stream.of(
|
||||
new Job(klazz + " iterate for loop") {
|
||||
public void work() throws Throwable {
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
@ -436,9 +445,9 @@ public class IteratorMicroBenchmark {
|
||||
check.sum(sum[0]);}}});
|
||||
}
|
||||
|
||||
List<Job> dequeJobs(Deque<Integer> x) {
|
||||
Stream<Job> dequeJobs(Deque<Integer> x) {
|
||||
String klazz = x.getClass().getSimpleName();
|
||||
return List.of(
|
||||
return Stream.of(
|
||||
new Job(klazz + " descendingIterator() loop") {
|
||||
public void work() throws Throwable {
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
@ -455,4 +464,50 @@ public class IteratorMicroBenchmark {
|
||||
x.descendingIterator().forEachRemaining(n -> sum[0] += n);
|
||||
check.sum(sum[0]);}}});
|
||||
}
|
||||
|
||||
Stream<Job> listJobs(List<Integer> x) {
|
||||
String klazz = x.getClass().getSimpleName();
|
||||
return Stream.of(
|
||||
new Job(klazz + " subList toArray()") {
|
||||
public void work() throws Throwable {
|
||||
int size = x.size();
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
int total = Stream.of(x.subList(0, size / 2),
|
||||
x.subList(size / 2, size))
|
||||
.mapToInt(subList -> {
|
||||
int sum = 0;
|
||||
for (Object o : subList.toArray())
|
||||
sum += (Integer) o;
|
||||
return sum; })
|
||||
.sum();
|
||||
check.sum(total);}}},
|
||||
new Job(klazz + " subList toArray(a)") {
|
||||
public void work() throws Throwable {
|
||||
int size = x.size();
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
int total = Stream.of(x.subList(0, size / 2),
|
||||
x.subList(size / 2, size))
|
||||
.mapToInt(subList -> {
|
||||
int sum = 0;
|
||||
Integer[] a = new Integer[subList.size()];
|
||||
for (Object o : subList.toArray(a))
|
||||
sum += (Integer) o;
|
||||
return sum; })
|
||||
.sum();
|
||||
check.sum(total);}}},
|
||||
new Job(klazz + " subList toArray(empty)") {
|
||||
public void work() throws Throwable {
|
||||
int size = x.size();
|
||||
Integer[] empty = new Integer[0];
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
int total = Stream.of(x.subList(0, size / 2),
|
||||
x.subList(size / 2, size))
|
||||
.mapToInt(subList -> {
|
||||
int sum = 0;
|
||||
for (Object o : subList.toArray(empty))
|
||||
sum += (Integer) o;
|
||||
return sum; })
|
||||
.sum();
|
||||
check.sum(total);}}});
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8132734
|
||||
* @bug 8132734 8194070
|
||||
* @summary Test the System properties for JarFile that support multi-release jar files
|
||||
* @library /lib/testlibrary/java/util/jar
|
||||
* @modules jdk.jartool
|
||||
@ -31,17 +31,14 @@
|
||||
* jdk.httpserver
|
||||
* @build Compiler JarBuilder CreateMultiReleaseTestJars SimpleHttpServer
|
||||
* @run testng MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=0 MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=8 MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=9 MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=10 MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=0 MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=8 MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=9 MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=100 MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=8 -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=9 -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=10 -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=8 -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=9 -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=10 -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=8 -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=9 -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=8 -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=9 -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarHttpProperties
|
||||
* @run testng/othervm -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarHttpProperties
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,22 +23,19 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8132734 8144062
|
||||
* @bug 8132734 8144062 8194070
|
||||
* @summary Test the System properties for JarFile that support multi-release jar files
|
||||
* @library /lib/testlibrary/java/util/jar
|
||||
* @build Compiler JarBuilder CreateMultiReleaseTestJars
|
||||
* @run testng MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=0 MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=8 MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=9 MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=10 MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=0 MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=8 MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=9 MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=100 MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=8 -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=9 -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=10 -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=8 -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=9 -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=10 -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=8 -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=9 -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=8 -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.version=9 -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarProperties
|
||||
* @run testng/othervm -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarProperties
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8144355 8144062 8176709
|
||||
* @bug 8144355 8144062 8176709 8194070
|
||||
* @summary Test aliasing additions to ZipFileSystem for multi-release jar files
|
||||
* @library /lib/testlibrary/java/util/jar
|
||||
* @build Compiler JarBuilder CreateMultiReleaseTestJars
|
||||
@ -92,9 +92,9 @@ public class MultiReleaseJarTest {
|
||||
{"0", 8},
|
||||
{"8", 8},
|
||||
{"9", 9},
|
||||
{"10", 10},
|
||||
{"11", 10},
|
||||
{"50", 10}
|
||||
{Integer.toString(MAJOR_VERSION), MAJOR_VERSION},
|
||||
{Integer.toString(MAJOR_VERSION+1), MAJOR_VERSION},
|
||||
{"50", MAJOR_VERSION}
|
||||
};
|
||||
}
|
||||
|
||||
@ -105,9 +105,9 @@ public class MultiReleaseJarTest {
|
||||
{new Integer(0), 8},
|
||||
{new Integer(8), 8},
|
||||
{new Integer(9), 9},
|
||||
{new Integer(10), 10},
|
||||
{new Integer(11), 10},
|
||||
{new Integer(100), 10}
|
||||
{new Integer(MAJOR_VERSION), MAJOR_VERSION},
|
||||
{new Integer(MAJOR_VERSION + 1), MAJOR_VERSION},
|
||||
{new Integer(100), MAJOR_VERSION}
|
||||
};
|
||||
}
|
||||
|
||||
@ -116,9 +116,8 @@ public class MultiReleaseJarTest {
|
||||
return new Object[][] {
|
||||
{Version.parse("8"), 8},
|
||||
{Version.parse("9"), 9},
|
||||
{Version.parse("10"), 10},
|
||||
{Version.parse("11"), 10},
|
||||
{Version.parse("100"), 10}
|
||||
{Version.parse("11"), MAJOR_VERSION},
|
||||
{Version.parse("100"), MAJOR_VERSION}
|
||||
};
|
||||
}
|
||||
|
||||
@ -168,8 +167,8 @@ public class MultiReleaseJarTest {
|
||||
|
||||
@Test
|
||||
public void testShortJar() throws Throwable {
|
||||
integerEnv.put("multi-release", Integer.valueOf(10));
|
||||
runTest(smruri, integerEnv, 10);
|
||||
integerEnv.put("multi-release", Integer.valueOf(MAJOR_VERSION));
|
||||
runTest(smruri, integerEnv, MAJOR_VERSION);
|
||||
integerEnv.put("multi-release", Integer.valueOf(9));
|
||||
runTest(smruri, integerEnv, 8);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -69,13 +69,15 @@ public class CreateMultiReleaseTestJars {
|
||||
+ " return 9;\n"
|
||||
+ " }\n"
|
||||
+ "}\n";
|
||||
final private String java10 = java8.replace("8", "10");
|
||||
final int currentVersion = Runtime.version().major();
|
||||
final String currentVersionStr = Integer.toString(currentVersion);
|
||||
final private String javaCurrent = java8.replace("8", currentVersionStr);
|
||||
final String readme8 = "This is the root readme file";
|
||||
final String readme9 = "This is the version nine readme file";
|
||||
final String readme10 = "This is the version ten readme file";
|
||||
final String readmeCurrent = "This is the current version readme file";
|
||||
private Map<String,byte[]> rootClasses;
|
||||
private Map<String,byte[]> version9Classes;
|
||||
private Map<String,byte[]> version10Classes;
|
||||
private Map<String,byte[]> versionCurrentClasses;
|
||||
|
||||
public void buildUnversionedJar() throws IOException {
|
||||
JarBuilder jb = new JarBuilder("unversioned.jar");
|
||||
@ -134,9 +136,9 @@ public class CreateMultiReleaseTestJars {
|
||||
jb.addEntry("META-INF/versions/9/version/Version.java", java9.getBytes());
|
||||
jb.addEntry("META-INF/versions/9/version/PackagePrivate.java", ppjava9.getBytes());
|
||||
jb.addEntry("META-INF/versions/9/version/PackagePrivate.class", version9Classes.get("version.PackagePrivate"));
|
||||
jb.addEntry("META-INF/versions/10/README", readme10.getBytes());
|
||||
jb.addEntry("META-INF/versions/10/version/Version.java", java10.getBytes());
|
||||
jb.addEntry("META-INF/versions/10/version/Version.class", version10Classes.get("version.Version"));
|
||||
jb.addEntry("META-INF/versions/" + currentVersionStr + "/README", readmeCurrent.getBytes());
|
||||
jb.addEntry("META-INF/versions/" + currentVersionStr + "/version/Version.java", javaCurrent.getBytes());
|
||||
jb.addEntry("META-INF/versions/" + currentVersionStr + "/version/Version.class", versionCurrentClasses.get("version.Version"));
|
||||
}
|
||||
|
||||
public void buildSignedMultiReleaseJar() throws Exception {
|
||||
@ -186,7 +188,7 @@ public class CreateMultiReleaseTestJars {
|
||||
input.put("version.PackagePrivate", ppjava9);
|
||||
version9Classes = (new Compiler(input)).setRelease(9).compile();
|
||||
input.clear();
|
||||
input.put("version.Version", java10);
|
||||
version10Classes = (new Compiler(input)).setRelease(9).compile(); // fixme in JDK 10
|
||||
input.put("version.Version", javaCurrent);
|
||||
versionCurrentClasses = (new Compiler(input)).compile(); // Use default release
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8132734 8144062 8159785
|
||||
* @bug 8132734 8144062 8159785 8194070
|
||||
* @summary Test that URL connections to multi-release jars can be runtime versioned
|
||||
* @library /lib/testlibrary/java/util/jar
|
||||
* @modules jdk.compiler
|
||||
@ -108,7 +108,8 @@ public class MultiReleaseJarURLConnection {
|
||||
Assert.assertTrue(readAndCompare(new URL(baseUrlEntry), "return 8"));
|
||||
|
||||
// the following tests will not work with unversioned jars
|
||||
if (style.equals("unversioned")) return;
|
||||
if (style.equals("unversioned"))
|
||||
return;
|
||||
|
||||
// direct access to versioned entry
|
||||
String versUrlEntry = urlFile + "META-INF/versions/" + Runtime.version().major()
|
||||
@ -117,12 +118,6 @@ public class MultiReleaseJarURLConnection {
|
||||
// adding any fragment does not change things
|
||||
Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#runtime"), rtreturn));
|
||||
Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#fragment"), rtreturn));
|
||||
|
||||
// it really doesn't change things
|
||||
versUrlEntry = urlFile + "META-INF/versions/10/version/Version.java";
|
||||
Assert.assertTrue(readAndCompare(new URL(versUrlEntry), "return 10"));
|
||||
Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#runtime"), "return 10"));
|
||||
Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#fragment"), "return 10"));
|
||||
}
|
||||
|
||||
@Test(dataProvider = "data")
|
||||
@ -225,7 +220,6 @@ public class MultiReleaseJarURLConnection {
|
||||
cldr.close();
|
||||
}
|
||||
|
||||
|
||||
private boolean readAndCompare(URL url, String match) throws Exception {
|
||||
boolean result;
|
||||
// necessary to do it this way, instead of openStream(), so we can
|
||||
|
88
test/jdk/sun/nio/cs/EUCTWBufferBoundaryDecodeTest.java
Normal file
88
test/jdk/sun/nio/cs/EUCTWBufferBoundaryDecodeTest.java
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4734607 4767225 4863613
|
||||
* @summary Decode a file using EUC-TW, test for decode errors
|
||||
* @modules jdk.charsets
|
||||
* @run main EUCTWBufferBoundaryDecodeTest
|
||||
*/
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
|
||||
/*
|
||||
* Tests for decode errors in NIO EUC-TW decoder. 4734607 details
|
||||
* decoding errors which occur when the input file > 8k in size
|
||||
* and contains numerous US-ASCII range chars
|
||||
*/
|
||||
public class EUCTWBufferBoundaryDecodeTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
final String inputFileName
|
||||
= System.getProperty("os.name").startsWith("Windows")
|
||||
? "tradChinese.win.po"
|
||||
: "tradChinese.po";
|
||||
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024 * 120);
|
||||
|
||||
File inputFile = new File(System.getProperty("test.src"), inputFileName);
|
||||
FileInputStream fis = new FileInputStream(inputFile);
|
||||
|
||||
// Decode the EUC_TW source file, re-encode it -- (roundtrip)
|
||||
// input and output files ought to be byte for byte identical
|
||||
BufferedReader bin
|
||||
= new BufferedReader(new InputStreamReader(fis, "EUC_TW"));
|
||||
BufferedWriter bout
|
||||
= new BufferedWriter(new OutputStreamWriter(bos, "EUC-TW"));
|
||||
|
||||
String line = bin.readLine();
|
||||
|
||||
while (line != null) {
|
||||
bout.write(line);
|
||||
bout.newLine();
|
||||
line = bin.readLine();
|
||||
}
|
||||
|
||||
bout.close();
|
||||
bin.close();
|
||||
|
||||
// Compare the output with the expected output byte by byte
|
||||
byte[] outputBytes = bos.toByteArray();
|
||||
int i = 0;
|
||||
FileInputStream fi = new FileInputStream(inputFile);
|
||||
|
||||
while (i < outputBytes.length) {
|
||||
byte b = (byte) fi.read();
|
||||
if (b != outputBytes[i++]) {
|
||||
throw new Exception("bug 4734607: test failed");
|
||||
}
|
||||
}
|
||||
fi.close();
|
||||
}
|
||||
}
|
88
test/jdk/sun/nio/cs/MalformedSurrogateStringTest.java
Normal file
88
test/jdk/sun/nio/cs/MalformedSurrogateStringTest.java
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4153987 6354525
|
||||
* @summary Malformed surrogates should be handled by the converter in
|
||||
* substitution mode.
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
|
||||
public class MalformedSurrogateStringTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
String fe = System.getProperty("file.encoding");
|
||||
if ( fe.equalsIgnoreCase("UTF8")
|
||||
|| fe.equalsIgnoreCase("UTF-8")
|
||||
|| fe.equalsIgnoreCase("UTF_8"))
|
||||
// This test is meaningless if the default charset
|
||||
// does handle surrogates
|
||||
return;
|
||||
|
||||
System.out.println("Testing string conversion...");
|
||||
/* Example with malformed surrogate, and an offset */
|
||||
String t = "abc\uD800\uDB00efgh";
|
||||
String t2 = t.substring(2);
|
||||
byte[] b = t2.getBytes();
|
||||
System.err.println(b.length);
|
||||
for (int i = 0; i < b.length; i++)
|
||||
System.err.println("[" + i + "]" + "=" + (char) b[i]
|
||||
+ "=" + (int) b[i]);
|
||||
if (b.length != 7) {
|
||||
throw new Exception("Bad string conversion for bad surrogate");
|
||||
}
|
||||
|
||||
/* Example with a proper surrogate, no offset. Always worked */
|
||||
String t3 = "abc\uD800\uDC00efgh";
|
||||
byte[] b2 = t3.getBytes();
|
||||
System.out.println(b2.length);
|
||||
for(int i = 0; i < b2.length; i++)
|
||||
System.err.println("[" + i + "]" + "=" + (char) b2[i]);
|
||||
if (b2.length != 8) {
|
||||
throw new Exception("Bad string conversion for good surrogate");
|
||||
}
|
||||
|
||||
OutputStream os = new ByteArrayOutputStream();
|
||||
OutputStreamWriter osw = new OutputStreamWriter(os);
|
||||
System.out.println("Testing flush....");
|
||||
/* Check for the case where the converter has a left over
|
||||
high surrogate when flush is called on the converter */
|
||||
osw.flush();
|
||||
String s = "abc\uD800"; // High surrogate
|
||||
char[] c = s.toCharArray();
|
||||
osw.write(s, 0, 4);
|
||||
osw.flush();
|
||||
|
||||
System.out.println("Testing convert...");
|
||||
/* Verify that all other characters go through */
|
||||
for (int k = 1; k < 65535 ; k++) {
|
||||
osw.write("Char[" + k + "]=\"" + ((char) k) + "\"");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
/* @test
|
||||
* @bug 6379808
|
||||
* @bug 6379808 8166339
|
||||
* @summary Check all Cp933 SBCS characters are not supported in Cp834
|
||||
* @modules jdk.charsets
|
||||
*/
|
||||
@ -62,17 +62,34 @@ public class TestCp834_SBCS {
|
||||
if ((c = cb.get()) != '\ufffd') {
|
||||
// OK, this is a SBCS character in Cp933
|
||||
if (dec834.decode(ByteBuffer.wrap(ba)).get() != '\ufffd')
|
||||
throw new Exception("SBCS is supported in IBM834 decoder");
|
||||
throw new RuntimeException("SBCS is supported in IBM834 decoder");
|
||||
|
||||
if (enc834.canEncode(c))
|
||||
throw new Exception("SBCS can be encoded in IBM834 encoder");
|
||||
throw new RuntimeException("SBCS can be encoded in IBM834 encoder");
|
||||
|
||||
ca[0] = c;
|
||||
ByteBuffer bb = enc834.encode(CharBuffer.wrap(ca));
|
||||
if (bb.get() != (byte)0xfe || bb.get() != (byte)0xfe)
|
||||
throw new Exception("SBCS is supported in IBM834 encoder");
|
||||
throw new RuntimeException("SBCS is supported in IBM834 encoder");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 8166339: cp834 should handle unmappable bytes as dobule-byte pair.
|
||||
if (! new String("\ufffd".getBytes("cp834"), "cp834").equals("\ufffd")) {
|
||||
throw new RuntimeException("u+fffd roundtrip failed");
|
||||
}
|
||||
|
||||
if (! new String("a".getBytes("cp834"), "cp834").equals("\ufffd") ||
|
||||
! new String(new byte[] { 0x41, 0x40}, "cp834").equals("\ufffd")) {
|
||||
throw new RuntimeException("decoding unmappable don't return u+fffd");
|
||||
}
|
||||
|
||||
CoderResult cr = Charset.forName("Cp834").newDecoder().decode(
|
||||
ByteBuffer.wrap(new byte[] { 0x41, 0x40}), CharBuffer.wrap(new char[2]), true);
|
||||
if (cr.isError() && cr.length() != 2) {
|
||||
throw new RuntimeException("decoding unmappable don't return unmmappable(2)");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
2380
test/jdk/sun/nio/cs/tradChinese.po
Normal file
2380
test/jdk/sun/nio/cs/tradChinese.po
Normal file
File diff suppressed because it is too large
Load Diff
4760
test/jdk/sun/nio/cs/tradChinese.win.po
Normal file
4760
test/jdk/sun/nio/cs/tradChinese.win.po
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -81,7 +81,7 @@ public class MVJarSigningTest {
|
||||
private static final String KEYPASS = "changeit";
|
||||
private static final String SIGNED_JAR = "Signed.jar";
|
||||
private static final String POLICY_FILE = "SignedJar.policy";
|
||||
private static final String VERSION = "" + Runtime.version().major();
|
||||
private static final String VERSION = Integer.toString(10);
|
||||
private static final String VERSION_MESSAGE = "I am running on version " + VERSION;
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
|
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright 2017 Google Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8194268
|
||||
* @summary Incorrect parameter names for synthetic methods
|
||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||
* jdk.compiler/com.sun.tools.javac.code
|
||||
* jdk.compiler/com.sun.tools.javac.tree
|
||||
* jdk.compiler/com.sun.tools.javac.util
|
||||
* @compile DefaultParamNames.java
|
||||
* @run main DefaultParamNames
|
||||
*/
|
||||
|
||||
import static java.util.stream.Collectors.joining;
|
||||
|
||||
import com.sun.tools.javac.api.BasicJavacTask;
|
||||
import com.sun.tools.javac.code.Flags;
|
||||
import com.sun.tools.javac.code.Symbol.MethodSymbol;
|
||||
import com.sun.tools.javac.code.Symtab;
|
||||
import com.sun.tools.javac.code.Type.MethodType;
|
||||
import com.sun.tools.javac.util.Assert;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
import com.sun.tools.javac.util.List;
|
||||
import com.sun.tools.javac.util.Names;
|
||||
import java.util.Objects;
|
||||
import javax.tools.JavaCompiler;
|
||||
import javax.tools.ToolProvider;
|
||||
|
||||
public class DefaultParamNames {
|
||||
|
||||
public static void main(String[] args) {
|
||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
BasicJavacTask task = (BasicJavacTask) compiler.getTask(null, null, null, null, null, null);
|
||||
Context context = task.getContext();
|
||||
Names names = Names.instance(context);
|
||||
Symtab symtab = Symtab.instance(context);
|
||||
MethodType mt =
|
||||
new MethodType(
|
||||
List.of(symtab.intType, symtab.stringType, symtab.objectType),
|
||||
symtab.voidType,
|
||||
List.nil(),
|
||||
symtab.methodClass);
|
||||
MethodSymbol ms =
|
||||
new MethodSymbol(Flags.SYNTHETIC, names.fromString("test"), mt, symtab.methodClass);
|
||||
String paramNames =
|
||||
ms.params().stream().map(p -> p.getSimpleName().toString()).collect(joining(","));
|
||||
assertEquals("arg0,arg1,arg2", paramNames);
|
||||
}
|
||||
|
||||
static void assertEquals(Object expected, Object actual) {
|
||||
Assert.check(
|
||||
Objects.equals(expected, actual),
|
||||
String.format("expected: %s, but was: %s", expected, actual));
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user