Merge
This commit is contained in:
commit
3c2e5acfce
1
.hgtags
1
.hgtags
@ -463,3 +463,4 @@ d8c634b016c628622c9abbdc6bf50509e5dedbec jdk-10+35
|
||||
0ee20aad71c4f33c426372b4c8bcc1235ce2ec08 jdk-11+0
|
||||
959f2f7cbaa6d2ee45d50029744efb219721576c jdk-10+36
|
||||
4f830b447edf04fb4a52151a5ad44d9bb60723cd jdk-10+37
|
||||
e569e83139fdfbecfeb3cd9014d560917787f158 jdk-10+38
|
||||
|
@ -887,7 +887,7 @@ void VM_Version::get_processor_features() {
|
||||
FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
|
||||
}
|
||||
|
||||
if (UseSHA) {
|
||||
if (UseSHA && supports_avx2() && supports_bmi2()) {
|
||||
if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, true);
|
||||
}
|
||||
|
@ -31,16 +31,11 @@
|
||||
#include "logging/log.hpp"
|
||||
#include "osContainer_linux.hpp"
|
||||
|
||||
/*
|
||||
* Warning: Some linux distros use 0x7FFFFFFFFFFFF000
|
||||
* and others use 0x7FFFFFFFFFFFFFFF for unlimited.
|
||||
*/
|
||||
#define UNLIMITED_MEM CONST64(0x7FFFFFFFFFFFF000)
|
||||
|
||||
#define PER_CPU_SHARES 1024
|
||||
|
||||
bool OSContainer::_is_initialized = false;
|
||||
bool OSContainer::_is_containerized = false;
|
||||
julong _unlimited_memory;
|
||||
|
||||
class CgroupSubsystem: CHeapObj<mtInternal> {
|
||||
friend class OSContainer;
|
||||
@ -217,6 +212,8 @@ void OSContainer::init() {
|
||||
_is_initialized = true;
|
||||
_is_containerized = false;
|
||||
|
||||
_unlimited_memory = (LONG_MAX / os::vm_page_size()) * os::vm_page_size();
|
||||
|
||||
log_trace(os, container)("OSContainer::init: Initializing Container Support");
|
||||
if (!UseContainerSupport) {
|
||||
log_trace(os, container)("Container Support not enabled");
|
||||
@ -419,37 +416,37 @@ char * OSContainer::container_type() {
|
||||
* OSCONTAINER_ERROR for not supported
|
||||
*/
|
||||
jlong OSContainer::memory_limit_in_bytes() {
|
||||
GET_CONTAINER_INFO(jlong, memory, "/memory.limit_in_bytes",
|
||||
"Memory Limit is: " JLONG_FORMAT, JLONG_FORMAT, memlimit);
|
||||
GET_CONTAINER_INFO(julong, memory, "/memory.limit_in_bytes",
|
||||
"Memory Limit is: " JULONG_FORMAT, JULONG_FORMAT, memlimit);
|
||||
|
||||
if (memlimit >= UNLIMITED_MEM) {
|
||||
if (memlimit >= _unlimited_memory) {
|
||||
log_trace(os, container)("Memory Limit is: Unlimited");
|
||||
return (jlong)-1;
|
||||
}
|
||||
else {
|
||||
return memlimit;
|
||||
return (jlong)memlimit;
|
||||
}
|
||||
}
|
||||
|
||||
jlong OSContainer::memory_and_swap_limit_in_bytes() {
|
||||
GET_CONTAINER_INFO(jlong, memory, "/memory.memsw.limit_in_bytes",
|
||||
"Memory and Swap Limit is: " JLONG_FORMAT, JLONG_FORMAT, memswlimit);
|
||||
if (memswlimit >= UNLIMITED_MEM) {
|
||||
GET_CONTAINER_INFO(julong, memory, "/memory.memsw.limit_in_bytes",
|
||||
"Memory and Swap Limit is: " JULONG_FORMAT, JULONG_FORMAT, memswlimit);
|
||||
if (memswlimit >= _unlimited_memory) {
|
||||
log_trace(os, container)("Memory and Swap Limit is: Unlimited");
|
||||
return (jlong)-1;
|
||||
} else {
|
||||
return memswlimit;
|
||||
return (jlong)memswlimit;
|
||||
}
|
||||
}
|
||||
|
||||
jlong OSContainer::memory_soft_limit_in_bytes() {
|
||||
GET_CONTAINER_INFO(jlong, memory, "/memory.soft_limit_in_bytes",
|
||||
"Memory Soft Limit is: " JLONG_FORMAT, JLONG_FORMAT, memsoftlimit);
|
||||
if (memsoftlimit >= UNLIMITED_MEM) {
|
||||
GET_CONTAINER_INFO(julong, memory, "/memory.soft_limit_in_bytes",
|
||||
"Memory Soft Limit is: " JULONG_FORMAT, JULONG_FORMAT, memsoftlimit);
|
||||
if (memsoftlimit >= _unlimited_memory) {
|
||||
log_trace(os, container)("Memory Soft Limit is: Unlimited");
|
||||
return (jlong)-1;
|
||||
} else {
|
||||
return memsoftlimit;
|
||||
return (jlong)memsoftlimit;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -600,6 +600,9 @@ JVMCIEnv::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler, Hand
|
||||
|
||||
if (!compiled_code->is_a(HotSpotCompiledNmethod::klass())) {
|
||||
oop stubName = HotSpotCompiledCode::name(compiled_code_obj);
|
||||
if (oopDesc::is_null(stubName)) {
|
||||
JVMCI_ERROR_OK("stub should have a name");
|
||||
}
|
||||
char* name = strdup(java_lang_String::as_utf8_string(stubName));
|
||||
cb = RuntimeStub::new_runtime_stub(name,
|
||||
&buffer,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 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
|
||||
@ -66,6 +66,8 @@ class LinuxFileStore
|
||||
}
|
||||
|
||||
// step 2: find mount point
|
||||
List<UnixMountEntry> procMountsEntries =
|
||||
fs.getMountEntries("/proc/mounts");
|
||||
UnixPath parent = path.getParent();
|
||||
while (parent != null) {
|
||||
UnixFileAttributes attrs = null;
|
||||
@ -74,16 +76,23 @@ class LinuxFileStore
|
||||
} catch (UnixException x) {
|
||||
x.rethrowAsIOException(parent);
|
||||
}
|
||||
if (attrs.dev() != dev())
|
||||
break;
|
||||
if (attrs.dev() != dev()) {
|
||||
// step 3: lookup mounted file systems (use /proc/mounts to
|
||||
// ensure we find the file system even when not in /etc/mtab)
|
||||
byte[] dir = path.asByteArray();
|
||||
for (UnixMountEntry entry : procMountsEntries) {
|
||||
if (Arrays.equals(dir, entry.dir()))
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
path = parent;
|
||||
parent = parent.getParent();
|
||||
}
|
||||
|
||||
// step 3: lookup mounted file systems (use /proc/mounts to ensure we
|
||||
// find the file system even when not in /etc/mtab)
|
||||
// step 3: lookup mounted file systems (use /proc/mounts to
|
||||
// ensure we find the file system even when not in /etc/mtab)
|
||||
byte[] dir = path.asByteArray();
|
||||
for (UnixMountEntry entry: fs.getMountEntries("/proc/mounts")) {
|
||||
for (UnixMountEntry entry : procMountsEntries) {
|
||||
if (Arrays.equals(dir, entry.dir()))
|
||||
return entry;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 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
|
||||
@ -75,7 +75,7 @@ class LinuxFileSystem extends UnixFileSystem {
|
||||
/**
|
||||
* Returns object to iterate over the mount entries in the given fstab file.
|
||||
*/
|
||||
Iterable<UnixMountEntry> getMountEntries(String fstab) {
|
||||
List<UnixMountEntry> getMountEntries(String fstab) {
|
||||
ArrayList<UnixMountEntry> entries = new ArrayList<>();
|
||||
try {
|
||||
long fp = setmntent(Util.toBytes(fstab), Util.toBytes("r"));
|
||||
@ -101,7 +101,7 @@ class LinuxFileSystem extends UnixFileSystem {
|
||||
* Returns object to iterate over the mount entries in /etc/mtab
|
||||
*/
|
||||
@Override
|
||||
Iterable<UnixMountEntry> getMountEntries() {
|
||||
List<UnixMountEntry> getMountEntries() {
|
||||
return getMountEntries("/etc/mtab");
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ package java.io;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* This class implements an output stream in which the data is
|
||||
@ -147,10 +148,7 @@ public class ByteArrayOutputStream extends OutputStream {
|
||||
* @param len the number of bytes to write.
|
||||
*/
|
||||
public synchronized void write(byte b[], int off, int len) {
|
||||
if ((off < 0) || (off > b.length) || (len < 0) ||
|
||||
((off + len) - b.length > 0)) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
Objects.checkFromIndexSize(off, len, b.length);
|
||||
ensureCapacity(count + len);
|
||||
System.arraycopy(b, off, buf, count, len);
|
||||
count += len;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 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
|
||||
@ -2256,7 +2256,7 @@ public class File
|
||||
private transient volatile Path filePath;
|
||||
|
||||
/**
|
||||
* Returns a {@link Path java.nio.file.Path} object constructed from the
|
||||
* Returns a {@link Path java.nio.file.Path} object constructed from
|
||||
* this abstract path. The resulting {@code Path} is associated with the
|
||||
* {@link java.nio.file.FileSystems#getDefault default-filesystem}.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 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
|
||||
@ -55,6 +55,93 @@ public abstract class InputStream implements Closeable {
|
||||
|
||||
private static final int DEFAULT_BUFFER_SIZE = 8192;
|
||||
|
||||
/**
|
||||
* Returns a new {@code InputStream} that reads no bytes. The returned
|
||||
* stream is initially open. The stream is closed by calling the
|
||||
* {@code close()} method. Subsequent calls to {@code close()} have no
|
||||
* effect.
|
||||
*
|
||||
* <p> While the stream is open, the {@code available()}, {@code read()},
|
||||
* {@code read(byte[])}, {@code read(byte[], int, int)},
|
||||
* {@code readAllBytes()}, {@code readNBytes()}, {@code skip()}, and
|
||||
* {@code transferTo()} methods all behave as if end of stream has been
|
||||
* reached. After the stream has been closed, these methods all throw
|
||||
* {@code IOException}.
|
||||
*
|
||||
* <p> The {@code markSupported()} method returns {@code false}. The
|
||||
* {@code mark()} method does nothing, and the {@code reset()} method
|
||||
* throws {@code IOException}.
|
||||
*
|
||||
* @return an {@code InputStream} which contains no bytes
|
||||
*
|
||||
* @since 11
|
||||
*/
|
||||
public static InputStream nullInputStream() {
|
||||
return new InputStream() {
|
||||
private volatile boolean closed;
|
||||
|
||||
private void ensureOpen() throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException("Stream closed");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int available () throws IOException {
|
||||
ensureOpen();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
ensureOpen();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
Objects.checkFromIndexSize(off, len, b.length);
|
||||
if (len == 0) {
|
||||
return 0;
|
||||
}
|
||||
ensureOpen();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] readAllBytes() throws IOException {
|
||||
ensureOpen();
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int readNBytes(byte[] b, int off, int len)
|
||||
throws IOException {
|
||||
Objects.checkFromIndexSize(off, len, b.length);
|
||||
ensureOpen();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long skip(long n) throws IOException {
|
||||
ensureOpen();
|
||||
return 0L;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long transferTo(OutputStream out) throws IOException {
|
||||
Objects.requireNonNull(out);
|
||||
ensureOpen();
|
||||
return 0L;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
closed = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the next byte of data from the input stream. The value byte is
|
||||
* returned as an <code>int</code> in the range <code>0</code> to
|
||||
@ -166,7 +253,6 @@ public abstract class InputStream implements Closeable {
|
||||
* @see java.io.InputStream#read()
|
||||
*/
|
||||
public int read(byte b[], int off, int len) throws IOException {
|
||||
Objects.requireNonNull(b);
|
||||
Objects.checkFromIndexSize(off, len, b.length);
|
||||
if (len == 0) {
|
||||
return 0;
|
||||
@ -326,7 +412,6 @@ public abstract class InputStream implements Closeable {
|
||||
* @since 9
|
||||
*/
|
||||
public int readNBytes(byte[] b, int off, int len) throws IOException {
|
||||
Objects.requireNonNull(b);
|
||||
Objects.checkFromIndexSize(off, len, b.length);
|
||||
|
||||
int n = 0;
|
||||
|
@ -1296,7 +1296,6 @@ public class ObjectInputStream
|
||||
* @throws InvalidClassException if the filter rejects creation
|
||||
*/
|
||||
private void checkArray(Class<?> arrayType, int arrayLength) throws InvalidClassException {
|
||||
Objects.requireNonNull(arrayType);
|
||||
if (! arrayType.isArray()) {
|
||||
throw new IllegalArgumentException("not an array type");
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 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
|
||||
@ -46,6 +46,51 @@ import java.util.Objects;
|
||||
* @since 1.0
|
||||
*/
|
||||
public abstract class OutputStream implements Closeable, Flushable {
|
||||
/**
|
||||
* Returns a new {@code OutputStream} which discards all bytes. The
|
||||
* returned stream is initially open. The stream is closed by calling
|
||||
* the {@code close()} method. Subsequent calls to {@code close()} have
|
||||
* no effect.
|
||||
*
|
||||
* <p> While the stream is open, the {@code write(int)}, {@code
|
||||
* write(byte[])}, and {@code write(byte[], int, int)} methods do nothing.
|
||||
* After the stream has been closed, these methods all throw {@code
|
||||
* IOException}.
|
||||
*
|
||||
* <p> The {@code flush()} method does nothing.
|
||||
*
|
||||
* @return an {@code OutputStream} which discards all bytes
|
||||
*
|
||||
* @since 11
|
||||
*/
|
||||
public static OutputStream nullOutputStream() {
|
||||
return new OutputStream() {
|
||||
private volatile boolean closed;
|
||||
|
||||
private void ensureOpen() throws IOException {
|
||||
if (closed) {
|
||||
throw new IOException("Stream closed");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
ensureOpen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte b[], int off, int len) throws IOException {
|
||||
Objects.checkFromIndexSize(off, len, b.length);
|
||||
ensureOpen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
closed = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the specified byte to this output stream. The general
|
||||
* contract for <code>write</code> is that one byte is written
|
||||
@ -106,7 +151,6 @@ public abstract class OutputStream implements Closeable, Flushable {
|
||||
* stream is closed.
|
||||
*/
|
||||
public void write(byte b[], int off, int len) throws IOException {
|
||||
Objects.requireNonNull(b);
|
||||
Objects.checkFromIndexSize(off, len, b.length);
|
||||
// len == 0 condition implicitly handled by loop bounds
|
||||
for (int i = 0 ; i < len ; i++) {
|
||||
|
@ -1667,6 +1667,7 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
|
||||
/** Craft a LambdaForm customized for this particular MethodHandle */
|
||||
/*non-public*/
|
||||
void customize() {
|
||||
final LambdaForm form = this.form;
|
||||
if (form.customized == null) {
|
||||
LambdaForm newForm = form.customize(this);
|
||||
updateForm(newForm);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -317,10 +317,9 @@ public class InetSocketAddress
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the {@code InetAddress}.
|
||||
*
|
||||
* @return the InetAdress or {@code null} if it is unresolved.
|
||||
* @return the InetAddress or {@code null} if it is unresolved.
|
||||
*/
|
||||
public final InetAddress getAddress() {
|
||||
return holder.getAddress();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 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
|
||||
@ -953,6 +953,12 @@ public final class Pattern
|
||||
*/
|
||||
private int flags;
|
||||
|
||||
/**
|
||||
* The temporary pattern flags used during compiling. The flags might be turn
|
||||
* on and off by embedded flag.
|
||||
*/
|
||||
private transient int flags0;
|
||||
|
||||
/**
|
||||
* Boolean indicating this Pattern is compiled; this is necessary in order
|
||||
* to lazily compile deserialized Patterns.
|
||||
@ -1137,7 +1143,7 @@ public final class Pattern
|
||||
* @return The match flags specified when this pattern was compiled
|
||||
*/
|
||||
public int flags() {
|
||||
return flags;
|
||||
return flags0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1369,6 +1375,9 @@ public final class Pattern
|
||||
// Read in all fields
|
||||
s.defaultReadObject();
|
||||
|
||||
// reset the flags
|
||||
flags0 = flags;
|
||||
|
||||
// Initialize counts
|
||||
capturingGroupCount = 1;
|
||||
localCount = 0;
|
||||
@ -1400,6 +1409,9 @@ public final class Pattern
|
||||
if ((flags & UNICODE_CHARACTER_CLASS) != 0)
|
||||
flags |= UNICODE_CASE;
|
||||
|
||||
// 'flags' for compiling
|
||||
flags0 = flags;
|
||||
|
||||
// Reset group index count
|
||||
capturingGroupCount = 1;
|
||||
localCount = 0;
|
||||
@ -1841,7 +1853,7 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
||||
* Indicates whether a particular flag is set or not.
|
||||
*/
|
||||
private boolean has(int f) {
|
||||
return (flags & f) != 0;
|
||||
return (flags0 & f) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2718,7 +2730,7 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
||||
ch == 0x53 || ch == 0x73 || //S and s
|
||||
ch == 0x4b || ch == 0x6b || //K and k
|
||||
ch == 0xc5 || ch == 0xe5))) { //A+ring
|
||||
bits.add(ch, flags());
|
||||
bits.add(ch, flags0);
|
||||
return null;
|
||||
}
|
||||
return single(ch);
|
||||
@ -2931,7 +2943,7 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
||||
boolean capturingGroup = false;
|
||||
Node head = null;
|
||||
Node tail = null;
|
||||
int save = flags;
|
||||
int save = flags0;
|
||||
int saveTCNCount = topClosureNodes.size();
|
||||
root = null;
|
||||
int ch = next();
|
||||
@ -3032,7 +3044,7 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
||||
}
|
||||
|
||||
accept(')', "Unclosed group");
|
||||
flags = save;
|
||||
flags0 = save;
|
||||
|
||||
// Check for quantifiers
|
||||
Node node = closure(head);
|
||||
@ -3135,28 +3147,28 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
||||
for (;;) {
|
||||
switch (ch) {
|
||||
case 'i':
|
||||
flags |= CASE_INSENSITIVE;
|
||||
flags0 |= CASE_INSENSITIVE;
|
||||
break;
|
||||
case 'm':
|
||||
flags |= MULTILINE;
|
||||
flags0 |= MULTILINE;
|
||||
break;
|
||||
case 's':
|
||||
flags |= DOTALL;
|
||||
flags0 |= DOTALL;
|
||||
break;
|
||||
case 'd':
|
||||
flags |= UNIX_LINES;
|
||||
flags0 |= UNIX_LINES;
|
||||
break;
|
||||
case 'u':
|
||||
flags |= UNICODE_CASE;
|
||||
flags0 |= UNICODE_CASE;
|
||||
break;
|
||||
case 'c':
|
||||
flags |= CANON_EQ;
|
||||
flags0 |= CANON_EQ;
|
||||
break;
|
||||
case 'x':
|
||||
flags |= COMMENTS;
|
||||
flags0 |= COMMENTS;
|
||||
break;
|
||||
case 'U':
|
||||
flags |= (UNICODE_CHARACTER_CLASS | UNICODE_CASE);
|
||||
flags0 |= (UNICODE_CHARACTER_CLASS | UNICODE_CASE);
|
||||
break;
|
||||
case '-': // subFlag then fall through
|
||||
ch = next();
|
||||
@ -3178,28 +3190,28 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
||||
for (;;) {
|
||||
switch (ch) {
|
||||
case 'i':
|
||||
flags &= ~CASE_INSENSITIVE;
|
||||
flags0 &= ~CASE_INSENSITIVE;
|
||||
break;
|
||||
case 'm':
|
||||
flags &= ~MULTILINE;
|
||||
flags0 &= ~MULTILINE;
|
||||
break;
|
||||
case 's':
|
||||
flags &= ~DOTALL;
|
||||
flags0 &= ~DOTALL;
|
||||
break;
|
||||
case 'd':
|
||||
flags &= ~UNIX_LINES;
|
||||
flags0 &= ~UNIX_LINES;
|
||||
break;
|
||||
case 'u':
|
||||
flags &= ~UNICODE_CASE;
|
||||
flags0 &= ~UNICODE_CASE;
|
||||
break;
|
||||
case 'c':
|
||||
flags &= ~CANON_EQ;
|
||||
flags0 &= ~CANON_EQ;
|
||||
break;
|
||||
case 'x':
|
||||
flags &= ~COMMENTS;
|
||||
flags0 &= ~COMMENTS;
|
||||
break;
|
||||
case 'U':
|
||||
flags &= ~(UNICODE_CHARACTER_CLASS | UNICODE_CASE);
|
||||
flags0 &= ~(UNICODE_CHARACTER_CLASS | UNICODE_CASE);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, 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 javax.tools;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Package-private utility methods to convert between files and paths.
|
||||
*
|
||||
* @since 9
|
||||
*/
|
||||
class FileManagerUtils {
|
||||
private FileManagerUtils() { }
|
||||
|
||||
static Iterable<Path> asPaths(final Iterable<? extends File> files) {
|
||||
return () -> new Iterator<Path>() {
|
||||
Iterator<? extends File> iter = files.iterator();
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return iter.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path next() {
|
||||
return iter.next().toPath();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static Iterable<File> asFiles(final Iterable<? extends Path> paths) {
|
||||
return () -> new Iterator<File>() {
|
||||
Iterator<? extends Path> iter = paths.iterator();
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return iter.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File next() {
|
||||
Path p = iter.next();
|
||||
try {
|
||||
return p.toFile();
|
||||
} catch (UnsupportedOperationException e) {
|
||||
throw new IllegalArgumentException(p.toString(), e);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 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
|
||||
@ -30,8 +30,7 @@ import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import static javax.tools.FileManagerUtils.*;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* File manager based on {@linkplain File java.io.File} and {@linkplain Path java.nio.file.Path}.
|
||||
@ -447,4 +446,42 @@ public interface StandardJavaFileManager extends JavaFileManager {
|
||||
* @since 9
|
||||
*/
|
||||
default void setPathFactory(PathFactory f) { }
|
||||
|
||||
|
||||
private static Iterable<Path> asPaths(final Iterable<? extends File> files) {
|
||||
return () -> new Iterator<Path>() {
|
||||
Iterator<? extends File> iter = files.iterator();
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return iter.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path next() {
|
||||
return iter.next().toPath();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static Iterable<File> asFiles(final Iterable<? extends Path> paths) {
|
||||
return () -> new Iterator<File>() {
|
||||
Iterator<? extends Path> iter = paths.iterator();
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return iter.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File next() {
|
||||
Path p = iter.next();
|
||||
try {
|
||||
return p.toFile();
|
||||
} catch (UnsupportedOperationException e) {
|
||||
throw new IllegalArgumentException(p.toString(), e);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ final class AOTBackend {
|
||||
|
||||
void printCompiledMethod(HotSpotResolvedJavaMethod resolvedMethod, CompilationResult compResult) {
|
||||
// This is really not installing the method.
|
||||
InstalledCode installedCode = codeCache.addCode(resolvedMethod, HotSpotCompiledCodeBuilder.createCompiledCode(codeCache, null, null, compResult), null, null);
|
||||
InstalledCode installedCode = codeCache.addCode(resolvedMethod, HotSpotCompiledCodeBuilder.createCompiledCode(codeCache, resolvedMethod, null, compResult), null, null);
|
||||
String disassembly = codeCache.disassemble(installedCode);
|
||||
if (disassembly != null) {
|
||||
main.printer.printlnDebug(disassembly);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 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
|
||||
@ -37,8 +37,10 @@ import javax.lang.model.element.Name;
|
||||
import javax.tools.StandardLocation;
|
||||
|
||||
import com.sun.source.doctree.DocCommentTree;
|
||||
import com.sun.source.tree.BlockTree;
|
||||
import com.sun.source.tree.ClassTree;
|
||||
import com.sun.source.tree.CompilationUnitTree;
|
||||
import com.sun.source.tree.LambdaExpressionTree;
|
||||
import com.sun.source.tree.ModuleTree;
|
||||
import com.sun.source.tree.PackageTree;
|
||||
import com.sun.source.tree.MethodTree;
|
||||
@ -398,6 +400,7 @@ public class DocLint implements Plugin {
|
||||
visitDecl(tree, null);
|
||||
return super.visitPackage(tree, ignore);
|
||||
}
|
||||
|
||||
@Override @DefinedBy(Api.COMPILER_TREE)
|
||||
public Void visitClass(ClassTree tree, Void ignore) {
|
||||
visitDecl(tree, tree.getSimpleName());
|
||||
@ -407,7 +410,6 @@ public class DocLint implements Plugin {
|
||||
@Override @DefinedBy(Api.COMPILER_TREE)
|
||||
public Void visitMethod(MethodTree tree, Void ignore) {
|
||||
visitDecl(tree, tree.getName());
|
||||
//return super.visitMethod(tree, ignore);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -431,6 +433,16 @@ public class DocLint implements Plugin {
|
||||
return super.visitCompilationUnit(node, p);
|
||||
}
|
||||
|
||||
@Override @DefinedBy(Api.COMPILER_TREE)
|
||||
public Void visitBlock(BlockTree tree, Void ignore) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override @DefinedBy(Api.COMPILER_TREE)
|
||||
public Void visitLambdaExpression(LambdaExpressionTree tree, Void ignore) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// </editor-fold>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 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
|
||||
@ -4743,9 +4743,8 @@ public class Attr extends JCTree.Visitor {
|
||||
// Check for proper use of serialVersionUID
|
||||
if (env.info.lint.isEnabled(LintCategory.SERIAL)
|
||||
&& isSerializable(c.type)
|
||||
&& (c.flags() & Flags.ENUM) == 0
|
||||
&& !c.isAnonymous()
|
||||
&& checkForSerial(c)) {
|
||||
&& (c.flags() & (Flags.ENUM | Flags.INTERFACE)) == 0
|
||||
&& !c.isAnonymous()) {
|
||||
checkSerialVersionUID(tree, c);
|
||||
}
|
||||
if (allowTypeAnnos) {
|
||||
@ -4757,17 +4756,6 @@ public class Attr extends JCTree.Visitor {
|
||||
}
|
||||
}
|
||||
// where
|
||||
boolean checkForSerial(ClassSymbol c) {
|
||||
if ((c.flags() & ABSTRACT) == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return c.members().anyMatch(anyNonAbstractOrDefaultMethod);
|
||||
}
|
||||
}
|
||||
|
||||
public static final Filter<Symbol> anyNonAbstractOrDefaultMethod = s ->
|
||||
s.kind == MTH && (s.flags() & (DEFAULT | ABSTRACT)) != ABSTRACT;
|
||||
|
||||
/** get a diagnostic position for an attribute of Type t, or null if attribute missing */
|
||||
private DiagnosticPosition getDiagnosticPosition(JCClassDecl tree, Type t) {
|
||||
for(List<JCAnnotation> al = tree.mods.annotations; !al.isEmpty(); al = al.tail) {
|
||||
|
@ -3464,6 +3464,7 @@ public class Check {
|
||||
types.hasSameArgs(sym.type, byName.type) ||
|
||||
types.hasSameArgs(types.erasure(sym.type), types.erasure(byName.type)))) {
|
||||
if ((sym.flags() & VARARGS) != (byName.flags() & VARARGS)) {
|
||||
sym.flags_field |= CLASH;
|
||||
varargsDuplicateError(pos, sym, byName);
|
||||
return true;
|
||||
} else if (sym.kind == MTH && !types.hasSameArgs(sym.type, byName.type, false)) {
|
||||
|
@ -1618,19 +1618,30 @@ public class Resolve {
|
||||
if ((m1.flags() & BRIDGE) != (m2.flags() & BRIDGE))
|
||||
return ((m1.flags() & BRIDGE) != 0) ? m2 : m1;
|
||||
|
||||
if (m1.baseSymbol() == m2.baseSymbol()) {
|
||||
// this is the same imported symbol which has been cloned twice.
|
||||
// Return the first one (either will do).
|
||||
return m1;
|
||||
}
|
||||
|
||||
// if one overrides or hides the other, use it
|
||||
TypeSymbol m1Owner = (TypeSymbol)m1.owner;
|
||||
TypeSymbol m2Owner = (TypeSymbol)m2.owner;
|
||||
if (types.asSuper(m1Owner.type, m2Owner) != null &&
|
||||
((m1.owner.flags_field & INTERFACE) == 0 ||
|
||||
(m2.owner.flags_field & INTERFACE) != 0) &&
|
||||
m1.overrides(m2, m1Owner, types, false))
|
||||
return m1;
|
||||
if (types.asSuper(m2Owner.type, m1Owner) != null &&
|
||||
((m2.owner.flags_field & INTERFACE) == 0 ||
|
||||
(m1.owner.flags_field & INTERFACE) != 0) &&
|
||||
m2.overrides(m1, m2Owner, types, false))
|
||||
return m2;
|
||||
// the two owners can never be the same if the target methods are compiled from source,
|
||||
// but we need to protect against cases where the methods are defined in some classfile
|
||||
// and make sure we issue an ambiguity error accordingly (by skipping the logic below).
|
||||
if (m1Owner != m2Owner) {
|
||||
if (types.asSuper(m1Owner.type, m2Owner) != null &&
|
||||
((m1.owner.flags_field & INTERFACE) == 0 ||
|
||||
(m2.owner.flags_field & INTERFACE) != 0) &&
|
||||
m1.overrides(m2, m1Owner, types, false))
|
||||
return m1;
|
||||
if (types.asSuper(m2Owner.type, m1Owner) != null &&
|
||||
((m2.owner.flags_field & INTERFACE) == 0 ||
|
||||
(m1.owner.flags_field & INTERFACE) != 0) &&
|
||||
m2.overrides(m1, m2Owner, types, false))
|
||||
return m2;
|
||||
}
|
||||
boolean m1Abstract = (m1.flags() & ABSTRACT) != 0;
|
||||
boolean m2Abstract = (m2.flags() & ABSTRACT) != 0;
|
||||
if (m1Abstract && !m2Abstract) return m2;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 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
|
||||
@ -1678,7 +1678,7 @@ public class ClassWriter extends ClassFile {
|
||||
try {
|
||||
writeClassFile(out, c);
|
||||
if (verbose)
|
||||
log.printVerbose("wrote.file", outFile);
|
||||
log.printVerbose("wrote.file", outFile.getName());
|
||||
out.close();
|
||||
out = null;
|
||||
} finally {
|
||||
|
@ -116,7 +116,7 @@ class BeanLinker extends AbstractJavaLinker implements TypeBasedGuardingDynamicL
|
||||
if(clazz.isArray()) {
|
||||
// Some languages won't have a notion of manipulating collections. Exposing "length" on arrays as an
|
||||
// explicit property is beneficial for them.
|
||||
setPropertyGetter("length", MethodHandles.arrayLength(clazz), ValidationType.EXACT_CLASS);
|
||||
setPropertyGetter("length", GET_ARRAY_LENGTH, ValidationType.IS_ARRAY);
|
||||
} else if(Collection.class.isAssignableFrom(clazz)) {
|
||||
setPropertyGetter("length", GET_COLLECTION_LENGTH, ValidationType.INSTANCE_OF);
|
||||
} else if(Map.class.isAssignableFrom(clazz)) {
|
||||
@ -546,6 +546,9 @@ class BeanLinker extends AbstractJavaLinker implements TypeBasedGuardingDynamicL
|
||||
private static final MethodHandle GET_MAP_LENGTH = Lookup.PUBLIC.findVirtual(Map.class, "size",
|
||||
MethodType.methodType(int.class));
|
||||
|
||||
private static final MethodHandle GET_ARRAY_LENGTH = Lookup.PUBLIC.findStatic(Array.class, "getLength",
|
||||
MethodType.methodType(int.class, Object.class));
|
||||
|
||||
private static void assertParameterCount(final CallSiteDescriptor descriptor, final int paramCount) {
|
||||
if(descriptor.getMethodType().parameterCount() != paramCount) {
|
||||
throw new BootstrapMethodError(descriptor.getOperation() + " must have exactly " + paramCount + " parameters.");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 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
|
||||
@ -159,6 +159,7 @@ public enum ToolOption {
|
||||
public void process(Helper helper, String arg) {
|
||||
helper.encoding = arg;
|
||||
helper.setCompilerOpt(opt, arg);
|
||||
helper.setFileManagerOpt(Option.ENCODING, arg);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -820,11 +820,14 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
Content summary = new ContentBuilder();
|
||||
if (display(usesTrees)) {
|
||||
description = usesTrees.get(t);
|
||||
if (description != null) {
|
||||
summary.addContent(description);
|
||||
if (description != null && !description.isEmpty()) {
|
||||
summary.addContent(HtmlTree.DIV(HtmlStyle.block, description));
|
||||
} else {
|
||||
addSummaryComment(t, summary);
|
||||
}
|
||||
} else {
|
||||
summary.addContent(Contents.SPACE);
|
||||
}
|
||||
addSummaryComment(t, summary);
|
||||
table.addRow(typeLinkContent, summary);
|
||||
}
|
||||
}
|
||||
@ -847,11 +850,12 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
|
||||
Content desc = new ContentBuilder();
|
||||
if (display(providesTrees)) {
|
||||
description = providesTrees.get(srv);
|
||||
if (description != null) {
|
||||
desc.addContent(description);
|
||||
desc.addContent((description != null && !description.isEmpty())
|
||||
? HtmlTree.DIV(HtmlStyle.block, description)
|
||||
: Contents.SPACE);
|
||||
} else {
|
||||
desc.addContent(Contents.SPACE);
|
||||
}
|
||||
}
|
||||
addSummaryComment(srv, desc);
|
||||
// Only display the implementation details in the "all" mode.
|
||||
if (moduleMode == ModuleMode.ALL && !implSet.isEmpty()) {
|
||||
desc.addContent(new HtmlTree(HtmlTag.BR));
|
||||
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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
|
||||
* @requires vm.aot
|
||||
* @library / /test/lib /testlibrary
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build compiler.aot.cli.jaotc.CompileClassWithDebugTest
|
||||
* @run driver ClassFileInstaller compiler.aot.cli.jaotc.data.HelloWorldOne
|
||||
* @run driver compiler.aot.cli.jaotc.CompileClassWithDebugTest
|
||||
* @summary check that jaotc can compile a class with a --debug flag
|
||||
*/
|
||||
|
||||
package compiler.aot.cli.jaotc;
|
||||
|
||||
import compiler.aot.cli.jaotc.data.HelloWorldOne;
|
||||
import java.io.File;
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class CompileClassWithDebugTest {
|
||||
public static void main(String[] args) {
|
||||
OutputAnalyzer oa = JaotcTestHelper.compileLibrary("--debug", "--class-name", JaotcTestHelper
|
||||
.getClassAotCompilationName(HelloWorldOne.class));
|
||||
oa.shouldHaveExitValue(0);
|
||||
File compiledLibrary = new File(JaotcTestHelper.DEFAULT_LIB_PATH);
|
||||
Asserts.assertTrue(compiledLibrary.exists(), "Compiled library file missing");
|
||||
Asserts.assertGT(compiledLibrary.length(), 0L, "Unexpected compiled library size");
|
||||
JaotcTestHelper.checkLibraryUsage(HelloWorldOne.class.getName());
|
||||
}
|
||||
}
|
@ -218,6 +218,8 @@ java/net/MulticastSocket/Test.java 7145658 macosx-a
|
||||
|
||||
java/net/DatagramSocket/SendDatagramToBadAddress.java 7143960 macosx-all
|
||||
|
||||
java/net/httpclient/SplitResponseSSL.java 8194151 windows-all
|
||||
|
||||
############################################################################
|
||||
|
||||
# jdk_nio
|
||||
|
200
test/jdk/java/io/InputStream/NullInputStream.java
Normal file
200
test/jdk/java/io/InputStream/NullInputStream.java
Normal file
@ -0,0 +1,200 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4358774
|
||||
* @run testng NullInputStream
|
||||
* @summary Check for expected behavior of InputStream.nullInputStream().
|
||||
*/
|
||||
public class NullInputStream {
|
||||
private static InputStream openStream;
|
||||
private static InputStream closedStream;
|
||||
|
||||
@BeforeGroups(groups="open")
|
||||
public static void openStream() {
|
||||
openStream = InputStream.nullInputStream();
|
||||
}
|
||||
|
||||
@BeforeGroups(groups="closed")
|
||||
public static void openAndCloseStream() {
|
||||
closedStream = InputStream.nullInputStream();
|
||||
try {
|
||||
closedStream.close();
|
||||
} catch (IOException e) {
|
||||
fail("Unexpected IOException");
|
||||
}
|
||||
}
|
||||
|
||||
@AfterGroups(groups="open")
|
||||
public static void closeStream() {
|
||||
try {
|
||||
openStream.close();
|
||||
} catch (IOException e) {
|
||||
fail("Unexpected IOException");
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = "open")
|
||||
public static void testOpen() {
|
||||
assertNotNull(openStream, "InputStream.nullInputStream() returned null");
|
||||
}
|
||||
|
||||
@Test(groups = "open")
|
||||
public static void testAvailable() {
|
||||
try {
|
||||
assertEquals(0, openStream.available(), "available() != 0");
|
||||
} catch (IOException ioe) {
|
||||
fail("Unexpected IOException");
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = "open")
|
||||
public static void testRead() {
|
||||
try {
|
||||
assertEquals(-1, openStream.read(), "read() != -1");
|
||||
} catch (IOException ioe) {
|
||||
fail("Unexpected IOException");
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = "open")
|
||||
public static void testReadBII() {
|
||||
try {
|
||||
assertEquals(-1, openStream.read(new byte[1], 0, 1),
|
||||
"read(byte[],int,int) != -1");
|
||||
} catch (IOException ioe) {
|
||||
fail("Unexpected IOException");
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = "open")
|
||||
public static void testReadAllBytes() {
|
||||
try {
|
||||
assertEquals(0, openStream.readAllBytes().length,
|
||||
"readAllBytes().length != 0");
|
||||
} catch (IOException ioe) {
|
||||
fail("Unexpected IOException");
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = "open")
|
||||
public static void testreadNBytes() {
|
||||
try {
|
||||
assertEquals(0, openStream.readNBytes(new byte[1], 0, 1),
|
||||
"readNBytes(byte[],int,int) != 0");
|
||||
} catch (IOException ioe) {
|
||||
fail("Unexpected IOException");
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = "open")
|
||||
public static void testSkip() {
|
||||
try {
|
||||
assertEquals(0, openStream.skip(1), "skip() != 0");
|
||||
} catch (IOException ioe) {
|
||||
fail("Unexpected IOException");
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = "open")
|
||||
public static void testTransferTo() {
|
||||
try {
|
||||
assertEquals(0, openStream.transferTo(new ByteArrayOutputStream(7)),
|
||||
"transferTo() != 0");
|
||||
} catch (IOException ioe) {
|
||||
fail("Unexpected IOException");
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = "closed")
|
||||
public static void testAvailableClosed() {
|
||||
try {
|
||||
closedStream.available();
|
||||
fail("Expected IOException not thrown");
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = "closed")
|
||||
public static void testReadClosed() {
|
||||
try {
|
||||
closedStream.read();
|
||||
fail("Expected IOException not thrown");
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = "closed")
|
||||
public static void testReadBIIClosed() {
|
||||
try {
|
||||
closedStream.read(new byte[1], 0, 1);
|
||||
fail("Expected IOException not thrown");
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = "closed")
|
||||
public static void testReadAllBytesClosed() {
|
||||
try {
|
||||
closedStream.readAllBytes();
|
||||
fail("Expected IOException not thrown");
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = "closed")
|
||||
public static void testReadNBytesClosed() {
|
||||
try {
|
||||
closedStream.readNBytes(new byte[1], 0, 1);
|
||||
fail("Expected IOException not thrown");
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = "closed")
|
||||
public static void testSkipClosed() {
|
||||
try {
|
||||
closedStream.skip(1);
|
||||
fail("Expected IOException not thrown");
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups = "closed")
|
||||
public static void testTransferToClosed() {
|
||||
try {
|
||||
closedStream.transferTo(new ByteArrayOutputStream(7));
|
||||
fail("Expected IOException not thrown");
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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 4008296 4008293 4190090 4193729
|
||||
* @bug 4008296 4008293 4190090 4193729 4358774
|
||||
* @summary Check for correct handling of parameters to
|
||||
* XXXXInputStream.read(b, off, len).
|
||||
*
|
||||
@ -197,6 +197,11 @@ public class ReadParams {
|
||||
doTest1(ifs);
|
||||
ifs.close();
|
||||
|
||||
InputStream nis = InputStream.nullInputStream();
|
||||
doTest(nis);
|
||||
doTest1(nis);
|
||||
nis.close();
|
||||
|
||||
/* cleanup */
|
||||
fn.delete();
|
||||
}
|
||||
|
106
test/jdk/java/io/OutputStream/NullOutputStream.java
Normal file
106
test/jdk/java/io/OutputStream/NullOutputStream.java
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4358774
|
||||
* @run testng NullOutputStream
|
||||
* @summary Check for expected behavior of OutputStream.nullOutputStream().
|
||||
*/
|
||||
public class NullOutputStream {
|
||||
private static OutputStream openStream;
|
||||
private static OutputStream closedStream;
|
||||
|
||||
@BeforeGroups(groups="open")
|
||||
public static void openStream() {
|
||||
openStream = OutputStream.nullOutputStream();
|
||||
}
|
||||
|
||||
@BeforeGroups(groups="closed")
|
||||
public static void openAndCloseStream() {
|
||||
closedStream = OutputStream.nullOutputStream();
|
||||
try {
|
||||
closedStream.close();
|
||||
} catch (IOException e) {
|
||||
fail("Unexpected IOException");
|
||||
}
|
||||
}
|
||||
|
||||
@AfterGroups(groups="open")
|
||||
public static void closeStream() {
|
||||
try {
|
||||
openStream.close();
|
||||
} catch (IOException e) {
|
||||
fail("Unexpected IOException");
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups="open")
|
||||
public static void testOpen() {
|
||||
assertNotNull(openStream,
|
||||
"OutputStream.nullOutputStream() returned null");
|
||||
}
|
||||
|
||||
@Test(groups="open")
|
||||
public static void testWrite() {
|
||||
try {
|
||||
openStream.write(62832);
|
||||
} catch (IOException e) {
|
||||
fail("Unexpected IOException");
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups="open")
|
||||
public static void testWriteBII() {
|
||||
try {
|
||||
openStream.write(new byte[] {(byte)6}, 0, 1);
|
||||
} catch (Exception e) {
|
||||
fail("Unexpected IOException");
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups="closed")
|
||||
public static void testWriteClosed() {
|
||||
try {
|
||||
closedStream.write(62832);
|
||||
fail("Expected IOException not thrown");
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(groups="closed")
|
||||
public static void testWriteBIIClosed() {
|
||||
try {
|
||||
closedStream.write(new byte[] {(byte)6}, 0, 1);
|
||||
fail("Expected IOException not thrown");
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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 1267039 1267043 4193729
|
||||
* @bug 1267039 1267043 4193729 4358774
|
||||
* @summary Check for correct handling of parameters to
|
||||
* XXXXOutputStream.write(b, off, len).
|
||||
*
|
||||
@ -152,6 +152,11 @@ public class WriteParams {
|
||||
doTest1(dfos);
|
||||
dfos.close();
|
||||
|
||||
OutputStream nos = OutputStream.nullOutputStream();
|
||||
doTest(nos);
|
||||
doTest1(nos);
|
||||
nos.close();
|
||||
|
||||
/* cleanup */
|
||||
fn.delete();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 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
|
||||
@ -24,7 +24,7 @@
|
||||
/*
|
||||
*
|
||||
* @test
|
||||
* @bug 8176841
|
||||
* @bug 8176841 8194148
|
||||
* @summary Tests *Format class deals with Unicode extensions
|
||||
* correctly.
|
||||
* @modules jdk.localedata
|
||||
@ -73,6 +73,7 @@ public class FormatTests {
|
||||
private static final String NUM_SINH = "\u0de7\u0de8,\u0de9\u0dea\u0deb.\u0dec\u0ded\u0dee\u0def";
|
||||
|
||||
private static final Date testDate = new Calendar.Builder()
|
||||
.setCalendarType("gregory")
|
||||
.setDate(2017, 7, 10)
|
||||
.setTimeOfDay(15, 15, 0)
|
||||
.setTimeZone(AMLA)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 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
|
||||
@ -24,11 +24,11 @@
|
||||
/*
|
||||
*
|
||||
* @test
|
||||
* @bug 8176841
|
||||
* @bug 8176841 8194148
|
||||
* @summary Tests *FormatSymbols class deals with Unicode extensions
|
||||
* correctly.
|
||||
* @modules jdk.localedata
|
||||
* @run testng/othervm -Djava.locale.providers=CLDR FormatTests
|
||||
* @run testng/othervm -Djava.locale.providers=CLDR SymbolsTests
|
||||
*/
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
@ -66,11 +66,11 @@ public class SymbolsTests {
|
||||
return new Object[][] {
|
||||
// Locale, expected decimal separator, expected grouping separator
|
||||
|
||||
{RG_AT, ",", "."},
|
||||
{Locale.US, ".", ","},
|
||||
{RG_AT, ',', '.'},
|
||||
{Locale.US, '.', ','},
|
||||
|
||||
// -nu & -rg mixed. -nu should win
|
||||
{Locale.forLanguageTag("ar-EG-u-nu-latn-rg-mazzzz"), ".", ","},
|
||||
{Locale.forLanguageTag("ar-EG-u-nu-latn-rg-mazzzz"), '.', ','},
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 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
|
||||
@ -35,6 +35,7 @@
|
||||
* 8027645 8035076 8039124 8035975 8074678 6854417 8143854 8147531 7071819
|
||||
* 8151481 4867170 7080302 6728861 6995635 6736245 4916384 6328855 6192895
|
||||
* 6345469 6988218 6693451 7006761 8140212 8143282 8158482 8176029 8184706
|
||||
* 8194667
|
||||
*
|
||||
* @library /test/lib
|
||||
* @build jdk.test.lib.RandomFactory
|
||||
@ -1367,24 +1368,35 @@ public class RegExTest {
|
||||
report("Reluctant Repetition");
|
||||
}
|
||||
|
||||
private static Pattern serializedPattern(Pattern p) throws Exception {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||
oos.writeObject(p);
|
||||
oos.close();
|
||||
try (ObjectInputStream ois = new ObjectInputStream(
|
||||
new ByteArrayInputStream(baos.toByteArray()))) {
|
||||
return (Pattern)ois.readObject();
|
||||
}
|
||||
}
|
||||
|
||||
private static void serializeTest() throws Exception {
|
||||
String patternStr = "(b)";
|
||||
String matchStr = "b";
|
||||
Pattern pattern = Pattern.compile(patternStr);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||
oos.writeObject(pattern);
|
||||
oos.close();
|
||||
ObjectInputStream ois = new ObjectInputStream(
|
||||
new ByteArrayInputStream(baos.toByteArray()));
|
||||
Pattern serializedPattern = (Pattern)ois.readObject();
|
||||
ois.close();
|
||||
Pattern serializedPattern = serializedPattern(pattern);
|
||||
Matcher matcher = serializedPattern.matcher(matchStr);
|
||||
if (!matcher.matches())
|
||||
failCount++;
|
||||
if (matcher.groupCount() != 1)
|
||||
failCount++;
|
||||
|
||||
pattern = Pattern.compile("a(?-i)b", Pattern.CASE_INSENSITIVE);
|
||||
serializedPattern = serializedPattern(pattern);
|
||||
if (!serializedPattern.matcher("Ab").matches())
|
||||
failCount++;
|
||||
if (serializedPattern.matcher("AB").matches())
|
||||
failCount++;
|
||||
|
||||
report("Serialization");
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@ import java.util.stream.TestData;
|
||||
/*
|
||||
* @test
|
||||
* @bug 8071597 8193856
|
||||
* @run main/timeout=240
|
||||
*/
|
||||
@Test
|
||||
public class WhileOpTest extends OpTestCase {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 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
|
||||
@ -65,15 +65,15 @@ enum CipherSuite implements Parameter {
|
||||
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384(
|
||||
Protocol.TLSV1_2, JdkRelease.JDK7),
|
||||
TLS_RSA_WITH_AES_256_CBC_SHA256(
|
||||
Protocol.TLSV1_2, JdkRelease.JDK7),
|
||||
Protocol.TLSV1_2, JdkRelease.JDK6),
|
||||
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384(
|
||||
Protocol.TLSV1_2, JdkRelease.JDK7),
|
||||
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384(
|
||||
Protocol.TLSV1_2, JdkRelease.JDK7),
|
||||
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256(
|
||||
Protocol.TLSV1_2, JdkRelease.JDK7),
|
||||
Protocol.TLSV1_2, JdkRelease.JDK6),
|
||||
TLS_DHE_DSS_WITH_AES_256_CBC_SHA256(
|
||||
Protocol.TLSV1_2, JdkRelease.JDK7),
|
||||
Protocol.TLSV1_2, JdkRelease.JDK6),
|
||||
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA(),
|
||||
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA(),
|
||||
TLS_RSA_WITH_AES_256_CBC_SHA(),
|
||||
@ -86,15 +86,15 @@ enum CipherSuite implements Parameter {
|
||||
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256(
|
||||
Protocol.TLSV1_2, JdkRelease.JDK7),
|
||||
TLS_RSA_WITH_AES_128_CBC_SHA256(
|
||||
Protocol.TLSV1_2, JdkRelease.JDK7),
|
||||
Protocol.TLSV1_2, JdkRelease.JDK6),
|
||||
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256(
|
||||
Protocol.TLSV1_2, JdkRelease.JDK7),
|
||||
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256(
|
||||
Protocol.TLSV1_2, JdkRelease.JDK7),
|
||||
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256(
|
||||
Protocol.TLSV1_2, JdkRelease.JDK7),
|
||||
Protocol.TLSV1_2, JdkRelease.JDK6),
|
||||
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256(
|
||||
Protocol.TLSV1_2, JdkRelease.JDK7),
|
||||
Protocol.TLSV1_2, JdkRelease.JDK6),
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA(),
|
||||
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA(),
|
||||
TLS_RSA_WITH_AES_128_CBC_SHA(),
|
||||
|
@ -48,6 +48,7 @@ import java.util.function.ToLongFunction;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
/**
|
||||
* LambdaTestHelpers -- assertion methods and useful objects for lambda test cases
|
||||
@ -277,7 +278,7 @@ public class LambdaTestHelpers {
|
||||
|
||||
public static<T> void assertContents(Iterable<T> actual, Iterable<T> expected) {
|
||||
if (actual instanceof Collection && expected instanceof Collection) {
|
||||
assertEquals(actual, expected);
|
||||
assertIterableEquals(actual, expected);
|
||||
} else {
|
||||
assertContents(actual.iterator(), expected.iterator());
|
||||
}
|
||||
@ -287,6 +288,42 @@ public class LambdaTestHelpers {
|
||||
assertEquals(toBoxedList(actual), toBoxedList(expected));
|
||||
}
|
||||
|
||||
// Workaround excessive String creation in inner loop in org.testng.Assert.assertEquals(Iterable<?>, Iterable<?>)
|
||||
static public void assertIterableEquals(Iterable<?> actual, Iterable<?> expected) {
|
||||
if(actual == expected) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(actual == null || expected == null) {
|
||||
fail("Iterables not equal: expected: " + expected + " and actual: " + actual);
|
||||
}
|
||||
|
||||
assertIteratorsEquals(actual.iterator(), expected.iterator());
|
||||
}
|
||||
|
||||
// Workaround excessive String creation in inner loop in org.testng.Assert.assertEquals(Iterator<?>, Iterator<?>)
|
||||
static public void assertIteratorsEquals(Iterator<?> actual, Iterator<?> expected) {
|
||||
if (actual == expected) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (actual == null || expected == null) {
|
||||
fail("Iterators not equal: expected: " + expected + " and actual: " + actual);
|
||||
}
|
||||
|
||||
while (actual.hasNext() && expected.hasNext()) {
|
||||
Object e = expected.next();
|
||||
Object a = actual.next();
|
||||
assertEquals(a, e, "Iterator contents differ");
|
||||
}
|
||||
|
||||
if(actual.hasNext()) {
|
||||
fail("Actual iterator returned more elements than the expected iterator.");
|
||||
} else if(expected.hasNext()) {
|
||||
fail("Expected iterator returned more elements than the actual iterator.");
|
||||
}
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
@SuppressWarnings("varargs")
|
||||
public static<T> void assertContents(Iterator<T> actual, T... expected) {
|
||||
|
@ -37,7 +37,7 @@ jdk/javadoc/doclet/testIOException/TestIOException.java
|
||||
# jshell
|
||||
|
||||
jdk/jshell/UserJdiUserRemoteTest.java 8173079 linux-all
|
||||
jdk/jshell/UserInputTest.java 8169536 generic-all
|
||||
jdk/jshell/UserInputTest.java 8169536 generic-all
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
@ -55,6 +55,7 @@ tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java
|
||||
tools/javac/warnings/suppress/TypeAnnotations.java 8057683 generic-all improve ordering of errors with type annotations
|
||||
tools/javac/modules/SourceInSymlinkTest.java 8180263 windows-all fails when run on a subst drive
|
||||
tools/javac/options/release/ReleaseOptionUnsupported.java 8193784 generic-all temporary until support for --release 11 is worked out
|
||||
tools/javac/jvm/VerboseOutTest.java 8194968 windows-all
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8178067
|
||||
* @bug 8178067 8192007
|
||||
* @summary tests the module's services, such as provides and uses
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.api
|
||||
* jdk.javadoc/jdk.javadoc.internal.tool
|
||||
@ -34,6 +34,7 @@
|
||||
* @run main TestModuleServices
|
||||
*/
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
@ -51,6 +52,106 @@ public class TestModuleServices extends JavadocTester {
|
||||
tb = new ToolBox();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkModuleServicesDescription(Path base) throws Exception {
|
||||
Path src = Files.createDirectories(base.resolve("src"));
|
||||
ModuleBuilder mb = new ModuleBuilder(tb, "moduleService")
|
||||
.comment("This module exports a package containing the declaration of a service type.")
|
||||
.exports("pkgService")
|
||||
.classes("/**A Package that has a service.*/ package pkgService;")
|
||||
.classes("package pkgService; /**A service Interface for service providers.*/ "
|
||||
+ "public interface Service {\n"
|
||||
+ " /**\n"
|
||||
+ " * A test method for the service.\n"
|
||||
+ " */\n"
|
||||
+ " void testMethod1();\n"
|
||||
+ " /**\n"
|
||||
+ " * Another test method for the service.\n"
|
||||
+ " */\n"
|
||||
+ " void testMethod2();\n"
|
||||
+ "}");
|
||||
mb.write(src);
|
||||
mb = new ModuleBuilder(tb, "moduleServiceProvider")
|
||||
.comment("This module provides an implementation of a service.\n" +
|
||||
"@provides pkgService.Service Provides a service whose name is ServiceProvider.")
|
||||
.requires("moduleService")
|
||||
.provides("pkgService.Service", "pkgServiceProvider.ServiceProvider")
|
||||
.classes("/**A Package that has a service provider.*/ package pkgServiceProvider;")
|
||||
.classes("package pkgServiceProvider;\n"
|
||||
+ "public class ServiceProvider implements pkgService.Service {\n"
|
||||
+ " /**\n"
|
||||
+ " * {@inheritDoc}\n"
|
||||
+ " */\n"
|
||||
+ " public void testMethod1() {}\n"
|
||||
+ " /**\n"
|
||||
+ " * This is an internal implementation so the documentation will not be seen.\n"
|
||||
+ " */\n"
|
||||
+ " public void testMethod2() {}\n"
|
||||
+ "}");
|
||||
mb.write(src);
|
||||
mb = new ModuleBuilder(tb, "moduleServiceUser")
|
||||
.comment("This module uses a service defined in another module.\n"
|
||||
+ "@uses pkgService.Service If no other provider is found, a default internal implementation will be used.")
|
||||
.requires("moduleService")
|
||||
.uses("pkgService.Service")
|
||||
.classes("/**A Package that has a service user.*/ package pkgServiceUser;")
|
||||
.classes("package pkgServiceUser;\n"
|
||||
+ "/**\n"
|
||||
+ " * A service user class.\n"
|
||||
+ " */\n"
|
||||
+ "public class ServiceUser {\n"
|
||||
+ "}");
|
||||
mb.write(src);
|
||||
mb = new ModuleBuilder(tb, "moduleServiceUserNoDescription")
|
||||
.comment("This is another module that uses a service defined in another module.\n"
|
||||
+ "@uses pkgService.Service")
|
||||
.requires("moduleService")
|
||||
.uses("pkgService.Service")
|
||||
.classes("/**A Package that has a service user with no description.*/ package pkgServiceUserNoDescription;")
|
||||
.classes("package pkgServiceUserNoDescription;\n"
|
||||
+ "/**\n"
|
||||
+ " * A service user class.\n"
|
||||
+ " */\n"
|
||||
+ "public class ServiceUserNoDescription {\n"
|
||||
+ "}");
|
||||
mb.write(src);
|
||||
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-quiet", "-noindex",
|
||||
"--module-source-path", src.toString(),
|
||||
"--module", "moduleService,moduleServiceProvider,moduleServiceUser,moduleServiceUserNoDescription",
|
||||
"pkgService", "moduleServiceProvider/pkgServiceProvider", "moduleServiceUser/pkgServiceUser",
|
||||
"moduleServiceUserNoDescription/pkgServiceUserNoDescription");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
checkOutput("moduleServiceProvider-summary.html", true,
|
||||
"<tr class=\"altColor\">\n"
|
||||
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"pkgService/Service.html\" "
|
||||
+ "title=\"interface in pkgService\">Service</a></th>\n"
|
||||
+ "<td class=\"colLast\">\n"
|
||||
+ "<div class=\"block\">Provides a service whose name is ServiceProvider.</div>\n"
|
||||
+ "</td>\n"
|
||||
+ "</tr>");
|
||||
checkOutput("moduleServiceUser-summary.html", true,
|
||||
"<tr class=\"altColor\">\n"
|
||||
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"pkgService/Service.html\" title=\"interface in pkgService\">Service</a></th>\n"
|
||||
+ "<td class=\"colLast\">\n"
|
||||
+ "<div class=\"block\">If no other provider is found, a default internal implementation will be used.</div>\n"
|
||||
+ "</td>\n"
|
||||
+ "</tr>");
|
||||
checkOutput("moduleServiceUserNoDescription-summary.html", true,
|
||||
"<tr class=\"altColor\">\n"
|
||||
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"pkgService/Service.html\" title=\"interface in pkgService\">Service</a></th>\n"
|
||||
+ "<td class=\"colLast\">\n"
|
||||
+ "<div class=\"block\">A service Interface for service providers.</div>\n"
|
||||
+ "</td>\n"
|
||||
+ "</tr>");
|
||||
checkOutput("moduleServiceProvider-summary.html", false,
|
||||
"A service Interface for service providers.");
|
||||
checkOutput("moduleServiceUser-summary.html", false,
|
||||
"A service Interface for service providers.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkUsesNoApiTagModuleModeDefault(Path base) throws Exception {
|
||||
ModuleBuilder mb = new ModuleBuilder(tb, "m")
|
||||
@ -251,7 +352,8 @@ public class TestModuleServices extends JavadocTester {
|
||||
"<tbody>\n" +
|
||||
"<tr class=\"altColor\">\n" +
|
||||
"<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"interface in p1\">A</a></th>\n" +
|
||||
"<td class=\"colLast\">abc </td>\n" +
|
||||
"<td class=\"colLast\">\n" +
|
||||
"<div class=\"block\">abc</div>\n</td>\n" +
|
||||
"</tr>\n" +
|
||||
"</tbody>\n" +
|
||||
"</table>\n");
|
||||
@ -292,7 +394,8 @@ public class TestModuleServices extends JavadocTester {
|
||||
"<tbody>\n" +
|
||||
"<tr class=\"altColor\">\n" +
|
||||
"<th class=\"colFirst\" scope=\"row\"><a href=\"p1/A.html\" title=\"interface in p1\">A</a></th>\n" +
|
||||
"<td class=\"colLast\">abc </td>\n" +
|
||||
"<td class=\"colLast\">\n" +
|
||||
"<div class=\"block\">abc</div>\n</td>\n" +
|
||||
"</tr>\n" +
|
||||
"</tbody>\n" +
|
||||
"</table>",
|
||||
@ -305,7 +408,8 @@ public class TestModuleServices extends JavadocTester {
|
||||
"<tbody>\n" +
|
||||
"<tr class=\"altColor\">\n" +
|
||||
"<th class=\"colFirst\" scope=\"row\"><a href=\"p2/B.html\" title=\"class in p2\">B</a></th>\n" +
|
||||
"<td class=\"colLast\">def </td>\n" +
|
||||
"<td class=\"colLast\">\n" +
|
||||
"<div class=\"block\">def</div>\n</td>\n" +
|
||||
"</tr>\n" +
|
||||
"</tbody>\n" +
|
||||
"</table>\n");
|
||||
|
@ -26,7 +26,7 @@
|
||||
* @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
|
||||
* 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218
|
||||
* 8175823 8166306 8178043 8181622 8183511 8169819 8074407 8183037 8191464
|
||||
8164407
|
||||
8164407 8192007
|
||||
* @summary Test modules support in javadoc.
|
||||
* @author bpatel
|
||||
* @library ../lib
|
||||
@ -764,7 +764,8 @@ public class TestModules extends JavadocTester {
|
||||
+ "</a>",
|
||||
"<tr class=\"altColor\">\n"
|
||||
+ "<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/TestClassInModuleB.html\" title=\"class in testpkgmdlB\">TestClassInModuleB</a></th>\n"
|
||||
+ "<td class=\"colLast\">With a test description for uses. </td>\n"
|
||||
+ "<td class=\"colLast\">\n"
|
||||
+ "<div class=\"block\">With a test description for uses.</div>\n</td>\n"
|
||||
+ "</tr>",
|
||||
"<caption><span>Opens</span><span class=\"tabEnd\"> </span></caption>\n"
|
||||
+ "<tr>\n"
|
||||
@ -931,7 +932,8 @@ public class TestModules extends JavadocTester {
|
||||
+ "<td class=\"colLast\"><a href=\"testpkgmdlB/package-summary.html\">testpkgmdlB</a></td>\n");
|
||||
checkOutput("moduleB-summary.html", true,
|
||||
"<th class=\"colFirst\" scope=\"row\"><a href=\"testpkgmdlB/TestClassInModuleB.html\" title=\"class in testpkgmdlB\">TestClassInModuleB</a></th>\n"
|
||||
+ "<td class=\"colLast\">With a test description for uses. </td>");
|
||||
+ "<td class=\"colLast\">\n"
|
||||
+ "<div class=\"block\">With a test description for uses.</div>\n</td>\n");
|
||||
checkOutput("moduletags-summary.html", true,
|
||||
"<li><a href=\"#module.description\">Description</a> | <a href=\"#modules.summary\">Modules"
|
||||
+ "</a> | <a href=\"#packages.summary\">Packages</a> | Services</li>",
|
||||
|
81
test/langtools/jdk/javadoc/tool/EncodingTest.java
Normal file
81
test/langtools/jdk/javadoc/tool/EncodingTest.java
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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 8188649
|
||||
* @summary ensure javadoc -encoding is not ignored
|
||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||
* @modules jdk.compiler/com.sun.tools.javac.main
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.api
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @library /tools/lib /tools/javadoc/lib
|
||||
* @build toolbox.JavacTask toolbox.JavadocTask toolbox.TestRunner toolbox.ToolBox
|
||||
* @run main EncodingTest
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import toolbox.JavadocTask;
|
||||
import toolbox.Task;
|
||||
import toolbox.TestRunner;
|
||||
import toolbox.ToolBox;
|
||||
|
||||
public class EncodingTest extends TestRunner {
|
||||
public static void main(String... args) throws Exception {
|
||||
EncodingTest t = new EncodingTest();
|
||||
t.runTests();
|
||||
}
|
||||
|
||||
private final ToolBox tb = new ToolBox();
|
||||
private final Path src = Paths.get("src");
|
||||
private final Path api = Paths.get("api");
|
||||
|
||||
EncodingTest() throws Exception {
|
||||
super(System.err);
|
||||
init();
|
||||
}
|
||||
|
||||
void init() throws IOException {
|
||||
Files.createDirectories(src);
|
||||
Files.write(src.resolve("C.java"),
|
||||
"/** \u03b1\u03b2\u03b3 */ public class C { }".getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncoding() {
|
||||
Task.Result result = new JavadocTask(tb, Task.Mode.EXEC)
|
||||
.outdir(api)
|
||||
.options("-J-Dfile.encoding=ASCII",
|
||||
"-encoding", "UTF-8",
|
||||
"-docencoding", "UTF-8")
|
||||
.files(src.resolve("C.java"))
|
||||
.run(Task.Expect.SUCCESS)
|
||||
.writeAll();
|
||||
}
|
||||
}
|
||||
|
54
test/langtools/tools/doclint/LambdaTest.java
Normal file
54
test/langtools/tools/doclint/LambdaTest.java
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 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 8194069
|
||||
* @summary ignore declarations in lambda expressions
|
||||
* @modules jdk.compiler/com.sun.tools.doclint
|
||||
* @build DocLintTester
|
||||
* @run main DocLintTester -Xmsgs:all SyntheticTest.java
|
||||
*/
|
||||
|
||||
package acme;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* The class has docs.
|
||||
*/
|
||||
public final class LambdaTest
|
||||
{
|
||||
/**
|
||||
* The field itself has docs.
|
||||
*/
|
||||
// Ensure no warning for lambda parameter, at 'string ->'
|
||||
static final Function<String, String> someFunction = string -> {
|
||||
// Ensure no warning for 'localVariable'
|
||||
int localVariable = 3;
|
||||
return Integer.toString(localVariable);
|
||||
};
|
||||
}
|
||||
|
115
test/langtools/tools/javac/8194932/Foo.jcod
Normal file
115
test/langtools/tools/javac/8194932/Foo.jcod
Normal file
@ -0,0 +1,115 @@
|
||||
class Foo {
|
||||
0xCAFEBABE;
|
||||
0; // minor version
|
||||
52; // version
|
||||
[] { // Constant Pool
|
||||
; // first element is empty
|
||||
Method #4 #14; // #1
|
||||
String #15; // #2
|
||||
class #16; // #3
|
||||
class #17; // #4
|
||||
Utf8 "<init>"; // #5
|
||||
Utf8 "()V"; // #6
|
||||
Utf8 "Code"; // #7
|
||||
Utf8 "LineNumberTable"; // #8
|
||||
Utf8 "m"; // #9
|
||||
Utf8 "m2"; // #10
|
||||
Utf8 "()Ljava/lang/String;"; // #11
|
||||
Utf8 "SourceFile"; // #12
|
||||
Utf8 "Foo.java"; // #13
|
||||
NameAndType #5 #6; // #14
|
||||
Utf8 "Hello"; // #15
|
||||
Utf8 "Foo"; // #16
|
||||
Utf8 "java/lang/Object"; // #17
|
||||
} // Constant Pool
|
||||
|
||||
0x0020; // access
|
||||
#3;// this_cpx
|
||||
#4;// super_cpx
|
||||
|
||||
[] { // Interfaces
|
||||
} // Interfaces
|
||||
|
||||
[] { // fields
|
||||
} // fields
|
||||
|
||||
[] { // methods
|
||||
{ // Member
|
||||
0x0000; // access
|
||||
#5; // name_cpx
|
||||
#6; // sig_cpx
|
||||
[] { // Attributes
|
||||
Attr(#7) { // Code
|
||||
1; // max_stack
|
||||
1; // max_locals
|
||||
Bytes[]{
|
||||
0x2AB70001B1;
|
||||
};
|
||||
[] { // Traps
|
||||
} // end Traps
|
||||
[] { // Attributes
|
||||
Attr(#8) { // LineNumberTable
|
||||
[] { // LineNumberTable
|
||||
0 1;
|
||||
}
|
||||
} // end LineNumberTable
|
||||
} // Attributes
|
||||
} // end Code
|
||||
} // Attributes
|
||||
} // Member
|
||||
;
|
||||
{ // Member
|
||||
0x0000; // access
|
||||
#9; // name_cpx
|
||||
#6; // sig_cpx
|
||||
[] { // Attributes
|
||||
Attr(#7) { // Code
|
||||
0; // max_stack
|
||||
1; // max_locals
|
||||
Bytes[]{
|
||||
0xB1;
|
||||
};
|
||||
[] { // Traps
|
||||
} // end Traps
|
||||
[] { // Attributes
|
||||
Attr(#8) { // LineNumberTable
|
||||
[] { // LineNumberTable
|
||||
0 2;
|
||||
}
|
||||
} // end LineNumberTable
|
||||
} // Attributes
|
||||
} // end Code
|
||||
} // Attributes
|
||||
} // Member
|
||||
;
|
||||
{ // Member
|
||||
0x0000; // access
|
||||
#9; // name_cpx
|
||||
#11; // sig_cpx
|
||||
[] { // Attributes
|
||||
Attr(#7) { // Code
|
||||
1; // max_stack
|
||||
1; // max_locals
|
||||
Bytes[]{
|
||||
0x1202B0;
|
||||
};
|
||||
[] { // Traps
|
||||
} // end Traps
|
||||
[] { // Attributes
|
||||
Attr(#8) { // LineNumberTable
|
||||
[] { // LineNumberTable
|
||||
0 3;
|
||||
}
|
||||
} // end LineNumberTable
|
||||
} // Attributes
|
||||
} // end Code
|
||||
} // Attributes
|
||||
} // Member
|
||||
} // methods
|
||||
|
||||
[] { // Attributes
|
||||
Attr(#12) { // SourceFile
|
||||
#13;
|
||||
} // end SourceFile
|
||||
} // Attributes
|
||||
} // end class Foo
|
13
test/langtools/tools/javac/8194932/T8194932.java
Normal file
13
test/langtools/tools/javac/8194932/T8194932.java
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8194932
|
||||
* @summary no ambuguity error is emitted if classfile contains two identical methods with different return types
|
||||
* @build Foo
|
||||
* @compile/fail/ref=T8194932.out -XDrawDiagnostics T8194932.java
|
||||
*/
|
||||
|
||||
class T8194932 {
|
||||
void test(Foo foo) {
|
||||
foo.m(); //should get an ambiguity here
|
||||
}
|
||||
}
|
2
test/langtools/tools/javac/8194932/T8194932.out
Normal file
2
test/langtools/tools/javac/8194932/T8194932.out
Normal file
@ -0,0 +1,2 @@
|
||||
T8194932.java:11:12: compiler.err.ref.ambiguous: m, kindname.method, m(), Foo, kindname.method, m(), Foo
|
||||
1 error
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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
|
||||
@ -23,26 +23,31 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6356530
|
||||
* @summary -Xlint:serial does not flag abstract classes with concrete methods/members
|
||||
* @compile/fail/ref=SerializableAbstractClassWithNonAbstractMethodsTest.out -XDrawDiagnostics -Werror -Xlint:serial SerializableAbstractClassWithNonAbstractMethodsTest.java
|
||||
* @bug 6356530 8191637
|
||||
* @summary -Xlint:serial does not flag abstract classes with persisent fields
|
||||
* @compile/fail/ref=SerializableAbstractClassTest.out -XDrawDiagnostics -Werror -Xlint:serial SerializableAbstractClassTest.java
|
||||
*/
|
||||
|
||||
abstract class SerializableAbstractClassWithNonAbstractMethodsTest implements java.io.Serializable {
|
||||
void m1() {}
|
||||
abstract class SerializableAbstractClassTest implements java.io.Serializable {
|
||||
// no serialVersionUID; error
|
||||
abstract void m2();
|
||||
|
||||
abstract class AWithUID implements java.io.Serializable {
|
||||
static abstract class AWithUID implements java.io.Serializable {
|
||||
private static final long serialVersionUID = 0;
|
||||
void m(){}
|
||||
}
|
||||
|
||||
interface I extends java.io.Serializable {
|
||||
// no need for serialVersionUID
|
||||
}
|
||||
|
||||
interface IDefault extends java.io.Serializable {
|
||||
// no need for serialVersionUID
|
||||
default int m() { return 1; }
|
||||
}
|
||||
|
||||
interface IDefaultAndUID extends java.io.Serializable {
|
||||
interface IUID extends java.io.Serializable {
|
||||
// no need for serialVersionUID, but not wrong
|
||||
static final long serialVersionUID = 0;
|
||||
default int m() { return 1; }
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
SerializableAbstractClassTest.java:31:10: compiler.warn.missing.SVUID: SerializableAbstractClassTest
|
||||
- compiler.err.warnings.and.werror
|
||||
1 error
|
||||
1 warning
|
@ -1,5 +0,0 @@
|
||||
SerializableAbstractClassWithNonAbstractMethodsTest.java:40:5: compiler.warn.missing.SVUID: SerializableAbstractClassWithNonAbstractMethodsTest.IDefault
|
||||
SerializableAbstractClassWithNonAbstractMethodsTest.java:31:10: compiler.warn.missing.SVUID: SerializableAbstractClassWithNonAbstractMethodsTest
|
||||
- compiler.err.warnings.and.werror
|
||||
1 error
|
||||
2 warnings
|
65
test/langtools/tools/javac/jvm/VerboseOutTest.java
Normal file
65
test/langtools/tools/javac/jvm/VerboseOutTest.java
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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 8194893
|
||||
* @summary javac -verbose prints wrong paths for output files
|
||||
* @modules jdk.compiler
|
||||
* @run main VerboseOutTest
|
||||
*/
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.spi.ToolProvider;
|
||||
|
||||
public class VerboseOutTest {
|
||||
public static void main(String... args) throws Exception {
|
||||
new VerboseOutTest().run();
|
||||
}
|
||||
|
||||
void run() throws Exception {
|
||||
String className = getClass().getName();
|
||||
Path testSrc = Paths.get(System.getProperty("test.src"));
|
||||
Path file = testSrc.resolve(className + ".java");
|
||||
ToolProvider javac = ToolProvider.findFirst("javac").orElseThrow();
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw, true);
|
||||
int rc = javac.run(pw, pw,
|
||||
"-d", ".",
|
||||
"-verbose",
|
||||
file.toString());
|
||||
String log = sw.toString();
|
||||
System.out.println(log);
|
||||
if (rc != 0) {
|
||||
throw new Exception("compilation failed: rc=" + rc);
|
||||
}
|
||||
String expected = "[wrote ./" + className + ".class]";
|
||||
if (!log.contains(expected)) {
|
||||
throw new Exception("expected output not found: " + expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
80
test/langtools/tools/javadoc/EncodingTest.java
Normal file
80
test/langtools/tools/javadoc/EncodingTest.java
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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 8188649
|
||||
* @summary javadoc -encoding doesn't work when using the old doclet API
|
||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||
* @modules jdk.compiler/com.sun.tools.javac.main
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.api
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @library /tools/lib /tools/javadoc/lib
|
||||
* @build toolbox.JavacTask toolbox.JavadocTask toolbox.TestRunner toolbox.ToolBox ToyDoclet
|
||||
* @run main EncodingTest
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import toolbox.JavadocTask;
|
||||
import toolbox.Task;
|
||||
import toolbox.TestRunner;
|
||||
import toolbox.ToolBox;
|
||||
|
||||
public class EncodingTest extends TestRunner {
|
||||
public static void main(String... args) throws Exception {
|
||||
EncodingTest t = new EncodingTest();
|
||||
t.runTests();
|
||||
}
|
||||
|
||||
private final ToolBox tb = new ToolBox();
|
||||
private final Path src = Paths.get("src");
|
||||
|
||||
EncodingTest() throws Exception {
|
||||
super(System.err);
|
||||
init();
|
||||
}
|
||||
|
||||
void init() throws IOException {
|
||||
Files.createDirectories(src);
|
||||
Files.write(src.resolve("C.java"),
|
||||
"/** \u03b1\u03b2\u03b3 */ public class C { }".getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncoding() {
|
||||
Task.Result result = new JavadocTask(tb, Task.Mode.EXEC)
|
||||
.options("-docletpath", System.getProperty("test.class.path"),
|
||||
"-doclet", "ToyDoclet",
|
||||
"-J-Dfile.encoding=ASCII",
|
||||
"-encoding", "UTF-8")
|
||||
.files(src.resolve("C.java"))
|
||||
.run(Task.Expect.SUCCESS)
|
||||
.writeAll();
|
||||
}
|
||||
}
|
||||
|
35
test/nashorn/script/basic/JDK-8157251.js
Normal file
35
test/nashorn/script/basic/JDK-8157251.js
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* JDK-8157251: BeanLinker relinks array length operations for array types
|
||||
*
|
||||
* @test
|
||||
* @run
|
||||
*/
|
||||
|
||||
var intArray = Java.type("int[]")
|
||||
var doubleArray = Java.type("double[]")
|
||||
var arrs = [new intArray(20), new doubleArray(0)]
|
||||
for (var i in arrs)
|
||||
print(arrs[i].length)
|
2
test/nashorn/script/basic/JDK-8157251.js.EXPECTED
Normal file
2
test/nashorn/script/basic/JDK-8157251.js.EXPECTED
Normal file
@ -0,0 +1,2 @@
|
||||
20
|
||||
0
|
Loading…
Reference in New Issue
Block a user