This commit is contained in:
Abhijit Saha 2018-01-12 15:05:35 -08:00
commit f96c816c07
74 changed files with 1050 additions and 436 deletions

View File

@ -463,3 +463,4 @@ d8c634b016c628622c9abbdc6bf50509e5dedbec jdk-10+35
cb54a299aa91419cb7caef3992592e7b22488163 jdk-10+36
4f830b447edf04fb4a52151a5ad44d9bb60723cd jdk-10+37
e569e83139fdfbecfeb3cd9014d560917787f158 jdk-10+38
5b834ec962366e00d4445352a999a3ac14e26f64 jdk-10+39

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 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,7 +46,6 @@ PROP_SRC_DIRS := \
$(TOPDIR)/src/java.desktop/share/classes/sun/awt/resources \
$(TOPDIR)/src/java.desktop/share/classes/com/sun/accessibility/internal/resources \
$(TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/resources \
$(TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/resources \
$(TOPDIR)/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources \
$(TOPDIR)/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources \
$(TOPDIR)/src/java.desktop/share/classes/com/sun/swing/internal/plaf/synth/resources \
@ -61,7 +60,10 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
endif
ifeq ($(OPENJDK_TARGET_OS), windows)
PROP_SRC_DIRS += $(TOPDIR)/src/java.desktop/windows/classes/sun/awt/windows
PROP_SRC_DIRS += \
$(TOPDIR)/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/resources \
$(TOPDIR)/src/java.desktop/windows/classes/sun/awt/windows \
#
endif
ifeq ($(filter $(OPENJDK_TARGET_OS), windows macosx), )

View File

@ -55,5 +55,9 @@ const bool CCallingConventionRequiresIntsAsLongs = true;
#define SUPPORT_RESERVED_STACK_AREA
#define THREAD_LOCAL_POLL
// If UseSIGTRAP is active, we only use the poll bit and no polling page.
// Otherwise, we fall back to usage of the polling page in nmethods.
// Define the condition to use this -XX flag.
#define USE_POLL_BIT_ONLY UseSIGTRAP
#endif // CPU_PPC_VM_GLOBALDEFINITIONS_PPC_HPP

View File

@ -30,6 +30,7 @@
#include "asm/macroAssembler.hpp"
#include "asm/codeBuffer.hpp"
#include "code/codeCache.hpp"
#include "runtime/safepointMechanism.hpp"
inline bool MacroAssembler::is_ld_largeoffset(address a) {
const int inst1 = *(int *)a;
@ -261,7 +262,12 @@ inline address MacroAssembler::last_calls_return_pc() {
// Read from the polling page, its address is already in a register.
inline void MacroAssembler::load_from_polling_page(Register polling_page_address, int offset) {
ld(R0, offset, polling_page_address);
if (SafepointMechanism::uses_thread_local_poll() && USE_POLL_BIT_ONLY) {
int encoding = SafepointMechanism::poll_bit();
tdi(traptoGreaterThanUnsigned | traptoEqual, polling_page_address, encoding);
} else {
ld(R0, offset, polling_page_address);
}
}
// Trap-instruction-based checks.

View File

@ -31,6 +31,7 @@
#include "memory/allocation.hpp"
#include "runtime/icache.hpp"
#include "runtime/os.hpp"
#include "runtime/safepointMechanism.hpp"
// We have interfaces for the following instructions:
//
@ -93,6 +94,11 @@ class NativeInstruction VALUE_OBJ_CLASS_SPEC {
bool is_safepoint_poll() {
// Is the current instruction a POTENTIAL read access to the polling page?
// The current arguments of the instruction are not checked!
if (SafepointMechanism::uses_thread_local_poll() && USE_POLL_BIT_ONLY) {
int encoding = SafepointMechanism::poll_bit();
return MacroAssembler::is_tdi(long_at(0), Assembler::traptoGreaterThanUnsigned | Assembler::traptoEqual,
-1, encoding);
}
return MacroAssembler::is_load_from_polling_page(long_at(0), NULL);
}

View File

@ -30,8 +30,18 @@
#include <sys/mman.h>
void SafepointMechanism::pd_initialize() {
// No special code needed if we can use SIGTRAP
if (ThreadLocalHandshakes && USE_POLL_BIT_ONLY) {
default_initialize();
return;
}
// Allocate one protected page
char* map_address = (char*)MAP_FAILED;
const size_t page_size = os::vm_page_size();
const int prot = PROT_READ;
const int flags = MAP_PRIVATE | MAP_ANONYMOUS;
// Use optimized addresses for the polling page,
// e.g. map it to a special 32-bit address.
if (OptimizePollingPageLocation) {
@ -57,14 +67,14 @@ void SafepointMechanism::pd_initialize() {
// Try to map with current address wish.
// AIX: AIX needs MAP_FIXED if we provide an address and mmap will
// fail if the address is already mapped.
map_address = (char*) ::mmap(address_wishes[i] - (ssize_t)page_size,
page_size, PROT_READ,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED,
map_address = (char*) ::mmap(address_wishes[i],
page_size, prot,
flags | MAP_FIXED,
-1, 0);
log_debug(os)("SafePoint Polling Page address: %p (wish) => %p",
address_wishes[i], map_address + (ssize_t)page_size);
log_debug(os)("SafePoint Polling Page address: %p (wish) => %p",
address_wishes[i], map_address);
if (map_address + (ssize_t)page_size == address_wishes[i]) {
if (map_address == address_wishes[i]) {
// Map succeeded and map_address is at wished address, exit loop.
break;
}
@ -78,8 +88,17 @@ void SafepointMechanism::pd_initialize() {
}
}
if (map_address == (char*)MAP_FAILED) {
map_address = os::reserve_memory(page_size, NULL, page_size);
map_address = (char*) ::mmap(NULL, page_size, prot, flags, -1, 0);
}
guarantee(map_address != (char*)MAP_FAILED, "SafepointMechanism::pd_initialize: failed to allocate polling page");
log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(map_address));
os::set_polling_page((address)(map_address));
// Use same page for ThreadLocalHandshakes without SIGTRAP
if (ThreadLocalHandshakes) {
set_uses_thread_local_poll();
intptr_t bad_page_val = reinterpret_cast<intptr_t>(map_address);
_poll_armed_value = reinterpret_cast<void*>(bad_page_val | poll_bit());
_poll_disarmed_value = NULL; // Readable on AIX
}
}

View File

@ -47,6 +47,7 @@
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/osThread.hpp"
#include "runtime/safepointMechanism.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/thread.inline.hpp"
@ -374,9 +375,12 @@ JVM_handle_aix_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrec
goto run_stub;
}
else if (sig == SIGSEGV && os::is_poll_address(addr)) {
else if ((SafepointMechanism::uses_thread_local_poll() && USE_POLL_BIT_ONLY)
? (sig == SIGTRAP && ((NativeInstruction*)pc)->is_safepoint_poll())
: (sig == SIGSEGV && os::is_poll_address(addr))) {
if (TraceTraps) {
tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (SIGSEGV)", pc);
tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (%s)", p2i(pc),
(SafepointMechanism::uses_thread_local_poll() && USE_POLL_BIT_ONLY) ? "SIGTRAP" : "SIGSEGV");
}
stub = SharedRuntime::get_poll_stub(pc);
goto run_stub;

View File

@ -46,6 +46,7 @@
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/osThread.hpp"
#include "runtime/safepointMechanism.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/thread.inline.hpp"
@ -382,7 +383,7 @@ JVM_handle_linux_signal(int sig,
stub = SharedRuntime::get_handle_wrong_method_stub();
}
else if (sig == SIGSEGV &&
else if (sig == ((SafepointMechanism::uses_thread_local_poll() && USE_POLL_BIT_ONLY) ? SIGTRAP : SIGSEGV) &&
// A linux-ppc64 kernel before 2.6.6 doesn't set si_addr on some segfaults
// in 64bit mode (cf. http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.6),
// especially when we try to read from the safepoint polling page. So the check
@ -393,7 +394,8 @@ JVM_handle_linux_signal(int sig,
((cb = CodeCache::find_blob(pc)) != NULL) &&
cb->is_compiled()) {
if (TraceTraps) {
tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (SIGSEGV)", p2i(pc));
tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (%s)", p2i(pc),
(SafepointMechanism::uses_thread_local_poll() && USE_POLL_BIT_ONLY) ? "SIGTRAP" : "SIGSEGV");
}
stub = SharedRuntime::get_poll_stub(pc);
}

View File

@ -1164,28 +1164,30 @@ ciInstance* ciEnv::unloaded_ciinstance() {
void ciEnv::dump_compile_data(outputStream* out) {
CompileTask* task = this->task();
Method* method = task->method();
int entry_bci = task->osr_bci();
int comp_level = task->comp_level();
out->print("compile %s %s %s %d %d",
method->klass_name()->as_quoted_ascii(),
method->name()->as_quoted_ascii(),
method->signature()->as_quoted_ascii(),
entry_bci, comp_level);
if (compiler_data() != NULL) {
if (is_c2_compile(comp_level)) {
if (task) {
Method* method = task->method();
int entry_bci = task->osr_bci();
int comp_level = task->comp_level();
out->print("compile %s %s %s %d %d",
method->klass_name()->as_quoted_ascii(),
method->name()->as_quoted_ascii(),
method->signature()->as_quoted_ascii(),
entry_bci, comp_level);
if (compiler_data() != NULL) {
if (is_c2_compile(comp_level)) {
#ifdef COMPILER2
// Dump C2 inlining data.
((Compile*)compiler_data())->dump_inline_data(out);
// Dump C2 inlining data.
((Compile*)compiler_data())->dump_inline_data(out);
#endif
} else if (is_c1_compile(comp_level)) {
} else if (is_c1_compile(comp_level)) {
#ifdef COMPILER1
// Dump C1 inlining data.
((Compilation*)compiler_data())->dump_inline_data(out);
// Dump C1 inlining data.
((Compilation*)compiler_data())->dump_inline_data(out);
#endif
}
}
out->cr();
}
out->cr();
}
void ciEnv::dump_replay_data_unsafe(outputStream* out) {

View File

@ -2734,43 +2734,58 @@ Handle SystemDictionary::find_method_handle_type(Symbol* signature,
return method_type;
}
Handle SystemDictionary::find_field_handle_type(Symbol* signature,
Klass* accessing_klass,
TRAPS) {
Handle empty;
ResourceMark rm(THREAD);
SignatureStream ss(signature, /*is_method=*/ false);
if (!ss.is_done()) {
Handle class_loader, protection_domain;
if (accessing_klass != NULL) {
class_loader = Handle(THREAD, accessing_klass->class_loader());
protection_domain = Handle(THREAD, accessing_klass->protection_domain());
}
oop mirror = ss.as_java_mirror(class_loader, protection_domain, SignatureStream::NCDFError, CHECK_(empty));
ss.next();
if (ss.is_done()) {
return Handle(THREAD, mirror);
}
}
return empty;
}
// Ask Java code to find or construct a method handle constant.
Handle SystemDictionary::link_method_handle_constant(Klass* caller,
int ref_kind, //e.g., JVM_REF_invokeVirtual
Klass* callee,
Symbol* name_sym,
Symbol* name,
Symbol* signature,
TRAPS) {
Handle empty;
Handle name = java_lang_String::create_from_symbol(name_sym, CHECK_(empty));
Handle type;
if (signature->utf8_length() > 0 && signature->byte_at(0) == '(') {
type = find_method_handle_type(signature, caller, CHECK_(empty));
} else if (caller == NULL) {
// This should not happen. JDK code should take care of that.
if (caller == NULL) {
THROW_MSG_(vmSymbols::java_lang_InternalError(), "bad MH constant", empty);
} else {
ResourceMark rm(THREAD);
SignatureStream ss(signature, false);
if (!ss.is_done()) {
oop mirror = ss.as_java_mirror(Handle(THREAD, caller->class_loader()),
Handle(THREAD, caller->protection_domain()),
SignatureStream::NCDFError, CHECK_(empty));
type = Handle(THREAD, mirror);
ss.next();
if (!ss.is_done()) type = Handle(); // error!
}
}
if (type.is_null()) {
THROW_MSG_(vmSymbols::java_lang_LinkageError(), "bad signature", empty);
}
Handle name_str = java_lang_String::create_from_symbol(name, CHECK_(empty));
Handle signature_str = java_lang_String::create_from_symbol(signature, CHECK_(empty));
// Put symbolic info from the MH constant into freshly created MemberName and resolve it.
Handle mname = MemberName_klass()->allocate_instance_handle(CHECK_(empty));
java_lang_invoke_MemberName::set_clazz(mname(), callee->java_mirror());
java_lang_invoke_MemberName::set_name (mname(), name_str());
java_lang_invoke_MemberName::set_type (mname(), signature_str());
java_lang_invoke_MemberName::set_flags(mname(), MethodHandles::ref_kind_to_flags(ref_kind));
MethodHandles::resolve_MemberName(mname, caller, CHECK_(empty));
// After method/field resolution succeeded, it's safe to resolve MH signature as well.
Handle type = MethodHandles::resolve_MemberName_type(mname, caller, CHECK_(empty));
// call java.lang.invoke.MethodHandleNatives::linkMethodHandleConstant(Class caller, int refKind, Class callee, String name, Object type) -> MethodHandle
JavaCallArguments args;
args.push_oop(Handle(THREAD, caller->java_mirror())); // the referring class
args.push_int(ref_kind);
args.push_oop(Handle(THREAD, callee->java_mirror())); // the target class
args.push_oop(name);
args.push_oop(name_str);
args.push_oop(type);
JavaValue result(T_OBJECT);
JavaCalls::call_static(&result,

View File

@ -532,6 +532,11 @@ public:
Klass* accessing_klass,
TRAPS);
// find a java.lang.Class object for a given signature
static Handle find_field_handle_type(Symbol* signature,
Klass* accessing_klass,
TRAPS);
// ask Java to compute a java.lang.invoke.MethodHandle object for a given CP entry
static Handle link_method_handle_constant(Klass* caller,
int ref_kind, //e.g., JVM_REF_invokeVirtual

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -4786,7 +4786,7 @@ public:
timer->record_time_secs(G1GCPhaseTimes::YoungFreeCSet, worker_id, young_time);
}
if (has_non_young_time) {
timer->record_time_secs(G1GCPhaseTimes::NonYoungFreeCSet, worker_id, young_time);
timer->record_time_secs(G1GCPhaseTimes::NonYoungFreeCSet, worker_id, non_young_time);
}
}
};

View File

@ -122,6 +122,48 @@ enum {
ALL_KINDS = IS_METHOD | IS_CONSTRUCTOR | IS_FIELD | IS_TYPE
};
int MethodHandles::ref_kind_to_flags(int ref_kind) {
assert(ref_kind_is_valid(ref_kind), "%d", ref_kind);
int flags = (ref_kind << REFERENCE_KIND_SHIFT);
if (ref_kind_is_field(ref_kind)) {
flags |= IS_FIELD;
} else if (ref_kind_is_method(ref_kind)) {
flags |= IS_METHOD;
} else if (ref_kind == JVM_REF_newInvokeSpecial) {
flags |= IS_CONSTRUCTOR;
}
return flags;
}
Handle MethodHandles::resolve_MemberName_type(Handle mname, Klass* caller, TRAPS) {
Handle empty;
Handle type(THREAD, java_lang_invoke_MemberName::type(mname()));
if (!java_lang_String::is_instance_inlined(type())) {
return type; // already resolved
}
Symbol* signature = java_lang_String::as_symbol_or_null(type());
if (signature == NULL) {
return empty; // no such signature exists in the VM
}
Handle resolved;
int flags = java_lang_invoke_MemberName::flags(mname());
switch (flags & ALL_KINDS) {
case IS_METHOD:
case IS_CONSTRUCTOR:
resolved = SystemDictionary::find_method_handle_type(signature, caller, CHECK_(empty));
break;
case IS_FIELD:
resolved = SystemDictionary::find_field_handle_type(signature, caller, CHECK_(empty));
break;
default:
THROW_MSG_(vmSymbols::java_lang_InternalError(), "unrecognized MemberName format", empty);
}
if (resolved.is_null()) {
THROW_MSG_(vmSymbols::java_lang_InternalError(), "bad MemberName type", empty);
}
return resolved;
}
oop MethodHandles::init_MemberName(Handle mname, Handle target, TRAPS) {
// This method is used from java.lang.invoke.MemberName constructors.
// It fills in the new MemberName from a java.lang.reflect.Member.

View File

@ -70,6 +70,8 @@ class MethodHandles: AllStatic {
static int find_MemberNames(Klass* k, Symbol* name, Symbol* sig,
int mflags, Klass* caller,
int skip, objArrayHandle results, TRAPS);
static Handle resolve_MemberName_type(Handle mname, Klass* caller, TRAPS);
// bit values for suppress argument to expand_MemberName:
enum { _suppress_defc = 1, _suppress_name = 2, _suppress_type = 4 };
@ -191,6 +193,8 @@ public:
ref_kind == JVM_REF_invokeInterface);
}
static int ref_kind_to_flags(int ref_kind);
#include CPU_HEADER(methodHandles)
// Tracing

View File

@ -36,23 +36,39 @@ void* SafepointMechanism::_poll_disarmed_value;
void SafepointMechanism::default_initialize() {
if (ThreadLocalHandshakes) {
set_uses_thread_local_poll();
const size_t page_size = os::vm_page_size();
const size_t allocation_size = 2 * page_size;
char* polling_page = os::reserve_memory(allocation_size, NULL, page_size);
os::commit_memory_or_exit(polling_page, allocation_size, false, "Unable to commit Safepoint polling page");
char* bad_page = polling_page;
char* good_page = polling_page + page_size;
// Poll bit values
intptr_t poll_armed_value = poll_bit();
intptr_t poll_disarmed_value = 0;
os::protect_memory(bad_page, page_size, os::MEM_PROT_NONE);
os::protect_memory(good_page, page_size, os::MEM_PROT_READ);
#ifdef USE_POLL_BIT_ONLY
if (!USE_POLL_BIT_ONLY)
#endif
{
// Polling page
const size_t page_size = os::vm_page_size();
const size_t allocation_size = 2 * page_size;
char* polling_page = os::reserve_memory(allocation_size, NULL, page_size);
os::commit_memory_or_exit(polling_page, allocation_size, false, "Unable to commit Safepoint polling page");
log_info(os)("SafePoint Polling address, bad (protected) page:" INTPTR_FORMAT ", good (unprotected) page:" INTPTR_FORMAT, p2i(bad_page), p2i(good_page));
os::set_polling_page((address)(bad_page));
char* bad_page = polling_page;
char* good_page = polling_page + page_size;
intptr_t poll_page_val = reinterpret_cast<intptr_t>(bad_page);
_poll_armed_value = reinterpret_cast<void*>(poll_page_val | poll_bit());
_poll_disarmed_value = good_page;
os::protect_memory(bad_page, page_size, os::MEM_PROT_NONE);
os::protect_memory(good_page, page_size, os::MEM_PROT_READ);
log_info(os)("SafePoint Polling address, bad (protected) page:" INTPTR_FORMAT ", good (unprotected) page:" INTPTR_FORMAT, p2i(bad_page), p2i(good_page));
os::set_polling_page((address)(bad_page));
// Poll address values
intptr_t bad_page_val = reinterpret_cast<intptr_t>(bad_page),
good_page_val = reinterpret_cast<intptr_t>(good_page);
poll_armed_value |= bad_page_val;
poll_disarmed_value |= good_page_val;
}
_poll_armed_value = reinterpret_cast<void*>(poll_armed_value);
_poll_disarmed_value = reinterpret_cast<void*>(poll_disarmed_value);
} else {
const size_t page_size = os::vm_page_size();
char* polling_page = os::reserve_memory(page_size, NULL, page_size);

View File

@ -900,9 +900,9 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
buf.append(getName(clazz));
buf.append('.');
}
String name = getName();
String name = this.name; // avoid expanding from VM
buf.append(name == null ? "*" : name);
Object type = getType();
Object type = this.type; // avoid expanding from VM
if (!isInvocable()) {
buf.append('/');
buf.append(type == null ? "*" : getName(type));

View File

@ -1,38 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--
Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. 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.
-->
<html>
<head>
<title>javax.lang.model</title>
</head>
<body bgcolor="white">
Packages used to model various aspects of the Java programming language.
@since 1.6
</body>
</html>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -25,8 +25,6 @@
package javax.tools;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Iterator;
@ -101,17 +99,6 @@ public class ToolProvider {
return null;
}
private static final boolean useLegacy;
static {
Class<?> c = null;
try {
c = Class.forName("java.lang.Module");
} catch (Throwable t) {
}
useLegacy = (c == null);
}
/**
* Get an instance of a system tool using the service loader.
* @implNote By default, this returns the implementation in the specified module.
@ -126,14 +113,6 @@ public class ToolProvider {
* @return the specified implementation of the tool
*/
private static <T> T getSystemTool(Class<T> clazz, String moduleName, String className) {
if (useLegacy) {
try {
return Class.forName(className, true, ClassLoader.getSystemClassLoader()).
asSubclass(clazz).getConstructor().newInstance();
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
try {
ServiceLoader<T> sl = ServiceLoader.load(clazz, ClassLoader.getSystemClassLoader());
@ -150,24 +129,16 @@ public class ToolProvider {
/**
* Determine if this is the desired tool instance.
* @param <T> the interface of the tool
* @param tool the instance of the tool
* @param moduleName the name of the module containing the desired implementation
* @param <T> the interface of the tool
* @param tool the instance of the tool
* @param moduleName the name of the module containing the desired implementation
* @return true if and only if the tool matches the specified criteria
*/
private static <T> boolean matches(T tool, String moduleName) {
PrivilegedAction<Boolean> pa = () -> {
// for now, use reflection to implement
// return moduleName.equals(tool.getClass().getModule().getName());
try {
Method getModuleMethod = Class.class.getDeclaredMethod("getModule");
Object toolModule = getModuleMethod.invoke(tool.getClass());
Method getNameMethod = toolModule.getClass().getDeclaredMethod("getName");
String toolModuleName = (String) getNameMethod.invoke(toolModule);
return moduleName.equals(toolModuleName);
} catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) {
return false;
}
Module toolModule = tool.getClass().getModule();
String toolModuleName = toolModule.getName();
return toolModuleName.equals(moduleName);
};
return AccessController.doPrivileged(pa);
}

View File

@ -1,54 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--
Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. 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.
-->
<html>
<head>
<title>javax.tools</title>
</head>
<body>
<p>
The Java&trade; programming language compiler API is a set of interfaces that describes the
functions provided by a compiler. This API has three
main objectives:
</p>
<ul>
<li>Allow invocation of a compiler from a program using
standardized interfaces.</li>
<li>Provide interfaces enabling the compiler to report diagnostics in a
structured way.</li>
<li>Provide interfaces enabling clients of the compiler to override
how file objects are found. "File objects" is a file
abstraction.</li>
</ul>
</body>
</html>

View File

@ -448,7 +448,7 @@ final class Win32ShellFolderManager2 extends ShellFolderManager {
Win32ShellFolder2 sf = (Win32ShellFolder2)dir;
return (sf.isFileSystem() && sf.parent != null &&
sf.parent.equals(Win32ShellFolder2.listRoots()));
sf.parent.equals(getDrives()));
}
String path = dir.getPath();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -312,6 +312,7 @@ public class TypeAnnotationPosition {
Assert.check(!hasExceptionIndex(), "exception_index already set");
Assert.check(exception_index >= 0, "Expected a valid index into exception table");
this.exception_index = exception_index;
this.isValidOffset = true;
}
public boolean hasCatchType() {

View File

@ -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
@ -3226,7 +3226,7 @@ public class Lower extends TreeTranslator {
JCVariableDecl indexdef = make.VarDef(index, make.Literal(INT, 0));
indexdef.init.type = indexdef.type = syms.intType.constType(0);
List<JCStatement> loopinit = List.of(lencachedef, indexdef);
List<JCStatement> loopinit = List.of(arraycachedef, lencachedef, indexdef);
JCBinary cond = makeBinary(LT, make.Ident(index), make.Ident(lencache));
JCExpressionStatement step = make.Exec(makeUnary(PREINC, make.Ident(index)));
@ -3236,20 +3236,18 @@ public class Lower extends TreeTranslator {
make.Ident(index)).setType(elemtype);
JCVariableDecl loopvardef = (JCVariableDecl)make.VarDef(tree.var.mods,
tree.var.name,
tree.var.vartype, loopvarinit).setType(tree.var.type);
tree.var.vartype,
loopvarinit).setType(tree.var.type);
loopvardef.sym = tree.var.sym;
JCBlock body = make.
Block(0, List.of(loopvardef, tree.body));
JCBlock body = make.Block(0, List.of(loopvardef, tree.body));
arraycachedef = translate(arraycachedef);
result = translate(make.
ForLoop(loopinit,
cond,
List.of(step),
body));
patchTargets(body, tree, result);
JCStatement nullAssignToArr = make.Assignment(arraycache, make.Literal(BOT, null).setType(syms.botType));
result = make.Block(0, List.of(arraycachedef, (JCStatement)result, nullAssignToArr));
}
/** Patch up break and continue targets. */
private void patchTargets(JCTree body, final JCTree src, final JCTree dest) {
@ -3303,7 +3301,7 @@ public class Lower extends TreeTranslator {
types.erasure(types.asSuper(iterator.type.getReturnType(), syms.iteratorType.tsym)),
currentMethodSym);
JCStatement init = make.
JCStatement init = make.
VarDef(itvar, make.App(make.Select(tree.expr, iterator)
.setType(types.erasure(iterator.type))));
@ -3328,15 +3326,12 @@ public class Lower extends TreeTranslator {
indexDef.sym = tree.var.sym;
JCBlock body = make.Block(0, List.of(indexDef, tree.body));
body.endpos = TreeInfo.endPos(tree.body);
init = translate(init);
result = translate(make.
ForLoop(List.nil(),
ForLoop(List.of(init),
cond,
List.nil(),
body));
patchTargets(body, tree, result);
JCStatement nullAssignToIterator = make.Assignment(itvar, make.Literal(BOT, null).setType(syms.botType));
result = make.Block(0, List.of(init, (JCStatement)result, nullAssignToIterator));
}
public void visitVarDef(JCVariableDecl tree) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2015, 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
@ -2100,15 +2100,19 @@ public class Code {
}
private void fillLocalVarPosition(LocalVar lv) {
if (lv == null || lv.sym == null || !lv.sym.hasTypeAnnotations())
if (lv == null || lv.sym == null || lv.sym.isExceptionParameter()|| !lv.sym.hasTypeAnnotations())
return;
LocalVar.Range widestRange = lv.getWidestRange();
for (Attribute.TypeCompound ta : lv.sym.getRawTypeAttributes()) {
TypeAnnotationPosition p = ta.position;
LocalVar.Range widestRange = lv.getWidestRange();
p.lvarOffset = new int[] { (int)widestRange.start_pc };
p.lvarLength = new int[] { (int)widestRange.length };
p.lvarIndex = new int[] { (int)lv.reg };
p.isValidOffset = true;
if (widestRange.closed() && widestRange.length > 0) {
p.lvarOffset = new int[] { (int)widestRange.start_pc };
p.lvarLength = new int[] { (int)widestRange.length };
p.lvarIndex = new int[] { (int)lv.reg };
p.isValidOffset = true;
} else {
p.isValidOffset = false;
}
}
}

View File

@ -34,7 +34,6 @@ import java.lang.reflect.Modifier;
import java.util.Objects;
import jdk.vm.ci.code.CodeUtil;
import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.meta.DeoptimizationAction;
import jdk.vm.ci.meta.DeoptimizationReason;
@ -284,11 +283,9 @@ public class HotSpotMetaAccessProvider implements MetaAccessProvider {
ResolvedJavaType elementType = lookupJavaType.getComponentType();
JavaKind elementKind = elementType.getJavaKind();
final int headerSize = getArrayBaseOffset(elementKind);
TargetDescription target = runtime.getHostJVMCIBackend().getTarget();
int sizeOfElement = getArrayIndexScale(elementKind);
int alignment = target.wordSize;
int log2ElementSize = CodeUtil.log2(sizeOfElement);
return computeArrayAllocationSize(length, alignment, headerSize, log2ElementSize);
return computeArrayAllocationSize(length, headerSize, log2ElementSize);
}
return lookupJavaType.instanceSize();
}
@ -303,11 +300,13 @@ public class HotSpotMetaAccessProvider implements MetaAccessProvider {
* alignment requirements.
*
* @param length the number of elements in the array
* @param alignment the object alignment requirement
* @param headerSize the size of the array header
* @param log2ElementSize log2 of the size of an element in the array
* @return the size of the memory chunk
*/
public static int computeArrayAllocationSize(int length, int alignment, int headerSize, int log2ElementSize) {
public int computeArrayAllocationSize(int length, int headerSize, int log2ElementSize) {
HotSpotVMConfig config = runtime.getConfig();
int alignment = config.objectAlignment;
int size = (length << log2ElementSize) + headerSize + (alignment - 1);
int mask = ~(alignment - 1);
return size & mask;

View File

@ -68,6 +68,8 @@ class HotSpotVMConfig extends HotSpotVMConfigAccess {
final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class);
final int objectAlignment = getFlag("ObjectAlignmentInBytes", Integer.class);
final int prototypeMarkWordOffset = getFieldOffset("Klass::_prototype_header", Integer.class, "markOop");
final int subklassOffset = getFieldOffset("Klass::_subklass", Integer.class, "Klass*");
final int nextSiblingOffset = getFieldOffset("Klass::_next_sibling", Integer.class, "Klass*");

View File

@ -565,6 +565,28 @@ public class HotSpotReplacementsUtil {
return WordFactory.unsigned(ComputeObjectAddressNode.get(a, getArrayBaseOffset(JavaKind.Int)));
}
@Fold
public static int objectAlignment(@InjectedParameter GraalHotSpotVMConfig config) {
return config.objectAlignment;
}
/**
* Computes the size of the memory chunk allocated for an array. This size accounts for the
* array header size, body size and any padding after the last element to satisfy object
* alignment requirements.
*
* @param length the number of elements in the array
* @param headerSize the size of the array header
* @param log2ElementSize log2 of the size of an element in the array
* @return the size of the memory chunk
*/
public static int arrayAllocationSize(int length, int headerSize, int log2ElementSize) {
int alignment = objectAlignment(INJECTED_VMCONFIG);
int size = (length << log2ElementSize) + headerSize + (alignment - 1);
int mask = ~(alignment - 1);
return size & mask;
}
@Fold
public static int instanceHeaderSize(@InjectedParameter GraalHotSpotVMConfig config) {
return config.useCompressedClassPointers ? (2 * wordSize()) - 4 : 2 * wordSize();

View File

@ -23,7 +23,6 @@
package org.graalvm.compiler.hotspot.replacements;
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
import static jdk.vm.ci.hotspot.HotSpotMetaAccessProvider.computeArrayAllocationSize;
import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
import static org.graalvm.compiler.core.common.calc.UnsignedMath.belowThan;
import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfig.INJECTED_VMCONFIG;
@ -33,6 +32,7 @@ import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.PROTOTYPE_MARK_WORD_LOCATION;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.TLAB_END_LOCATION;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.TLAB_TOP_LOCATION;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayAllocationSize;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayKlassOffset;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayLengthOffset;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.config;
@ -52,7 +52,6 @@ import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.useBiasedLocking;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.useTLAB;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.verifyOop;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.wordSize;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.writeTlabTop;
import static org.graalvm.compiler.hotspot.replacements.HotspotSnippetsOptions.ProfileAllocations;
import static org.graalvm.compiler.hotspot.replacements.HotspotSnippetsOptions.ProfileAllocationsContext;
@ -315,8 +314,7 @@ public class NewObjectSnippets implements Snippets {
private static Object allocateArrayImpl(KlassPointer hub, int length, Word prototypeMarkWord, int headerSize, int log2ElementSize, boolean fillContents, Register threadRegister,
boolean maybeUnroll, String typeContext, boolean skipNegativeCheck, OptionValues options, Counters counters) {
Object result;
int alignment = wordSize();
int allocationSize = computeArrayAllocationSize(length, alignment, headerSize, log2ElementSize);
int allocationSize = arrayAllocationSize(length, headerSize, log2ElementSize);
Word thread = registerAsWord(threadRegister);
Word top = readTlabTop(thread);
Word end = readTlabEnd(thread);

View File

@ -23,6 +23,7 @@
package org.graalvm.compiler.hotspot.stubs;
import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfig.INJECTED_VMCONFIG;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayAllocationSize;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayPrototypeMarkWord;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.getAndClearObjectResult;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperElementTypeMask;
@ -34,7 +35,6 @@ import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.readLayoutHelper;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.registerAsWord;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.useCMSIncrementalMode;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.wordSize;
import static org.graalvm.compiler.hotspot.replacements.NewObjectSnippets.MAX_ARRAY_FAST_PATH_ALLOCATION_LENGTH;
import static org.graalvm.compiler.hotspot.replacements.NewObjectSnippets.formatArray;
import static org.graalvm.compiler.hotspot.stubs.NewInstanceStub.refillAllocate;
@ -42,7 +42,6 @@ import static org.graalvm.compiler.hotspot.stubs.StubUtil.handlePendingException
import static org.graalvm.compiler.hotspot.stubs.StubUtil.newDescriptor;
import static org.graalvm.compiler.hotspot.stubs.StubUtil.printf;
import static org.graalvm.compiler.hotspot.stubs.StubUtil.verifyObject;
import static jdk.vm.ci.hotspot.HotSpotMetaAccessProvider.computeArrayAllocationSize;
import org.graalvm.compiler.api.replacements.Fold;
import org.graalvm.compiler.api.replacements.Snippet;
@ -112,7 +111,7 @@ public class NewArrayStub extends SnippetStub {
int log2ElementSize = (layoutHelper >> layoutHelperLog2ElementSizeShift(INJECTED_VMCONFIG)) & layoutHelperLog2ElementSizeMask(INJECTED_VMCONFIG);
int headerSize = (layoutHelper >> layoutHelperHeaderSizeShift(INJECTED_VMCONFIG)) & layoutHelperHeaderSizeMask(INJECTED_VMCONFIG);
int elementKind = (layoutHelper >> layoutHelperElementTypeShift(INJECTED_VMCONFIG)) & layoutHelperElementTypeMask(INJECTED_VMCONFIG);
int sizeInBytes = computeArrayAllocationSize(length, wordSize(), headerSize, log2ElementSize);
int sizeInBytes = arrayAllocationSize(length, headerSize, log2ElementSize);
if (logging(options)) {
printf("newArray: element kind %d\n", elementKind);
printf("newArray: array length %d\n", length);

View File

@ -212,6 +212,13 @@ public enum ToolOption {
}
},
ADD_OPENS("--add-opens", true) {
@Override
public void process(Helper helper, String arg) throws InvalidValueException {
Option.ADD_OPENS.process(helper.getOptionHelper(), opt, arg);
}
},
// ----- doclet options -----
DOCLET("-doclet", true), // handled in setDocletInvoker

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, 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
@ -204,9 +204,10 @@ public class HtmlConfiguration extends BaseConfiguration {
public boolean frames = true;
/**
* This is the HTML version of the generated pages. HTML 4.01 is the default output version.
* This is the HTML version of the generated pages.
* The default value is determined later.
*/
public HtmlVersion htmlVersion = HtmlVersion.HTML4;
public HtmlVersion htmlVersion = null;
/**
* Collected set of doclint options
@ -298,6 +299,12 @@ public class HtmlConfiguration extends BaseConfiguration {
if (!generalValidOptions()) {
return false;
}
if (htmlVersion == null) {
reporter.print(WARNING, getText("doclet.HTML_version_not_specified", helpfile));
htmlVersion = HtmlVersion.HTML4;
}
// check if helpfile exists
if (!helpfile.isEmpty()) {
DocFile help = DocFile.createFileForInput(this, helpfile);

View File

@ -384,3 +384,11 @@ doclet.usage.xdoclint-package.description=\
name prefix followed by .*, which expands to all sub-packages\n\
of the given package. Prefix the package specifier with - to\n\
disable checks for the specified packages.
# L10N: do not localize the option names -html4 and -html5
doclet.HTML_version_not_specified=\
You have not specified the version of HTML to use.\n\
The default is currently HTML 4.01, but this will change to HTML5\n\
in a future release. To suppress this warning, please specify the\n\
version of HTML used in your documentation comments and to be\n\
generated by this doclet, using the -html4 or -html5 options.

View File

@ -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
@ -189,6 +189,13 @@ public enum ToolOption {
}
},
ADD_OPENS("--add-opens", HIDDEN, true) {
@Override
public void process(Helper helper, String arg) throws InvalidValueException {
Option.ADD_OPENS.process(helper.getOptionHelper(), primaryName, arg);
}
},
// ----- doclet options -----
DOCLET("-doclet", STANDARD, true), // handled in setDocletInvoker

View File

@ -1,10 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>javap: class file disassembler</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Javap is a class file disassembler.
</body>
</html>

View File

@ -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
@ -42,6 +42,7 @@
compiler/ciReplay/TestSAServer.java 8029528 generic-all
compiler/codecache/stress/OverloadCompileQueueTest.java 8166554 generic-all
compiler/codegen/Test6896617.java 8193479 generic-all
compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java 8140405 generic-all
compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java 8158860 generic-all
compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java 8163894 generic-all
@ -66,6 +67,7 @@ gc/survivorAlignment/TestPromotionToSurvivor.java 8129886 generic-all
gc/g1/logging/TestG1LoggingFailure.java 8169634 generic-all
gc/g1/humongousObjects/TestHeapCounters.java 8178918 generic-all
gc/g1/TestVerifyGCType.java 8193067 generic-all
gc/stress/gclocker/TestGCLockerWithParallel.java 8180622 generic-all
gc/stress/gclocker/TestGCLockerWithG1.java 8179226 generic-all
gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java 8177765 generic-all

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
@ -29,6 +29,7 @@
* java.management
*
* @build sun.hotspot.WhiteBox
* compiler.tiered.LevelTransitionTest
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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,6 +23,7 @@
*/
import jdk.test.lib.Utils;
import jdk.test.lib.BuildHelper;
import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.Platform;
import jdk.test.lib.cds.CDSOptions;
@ -107,6 +108,19 @@ public class TestCommon extends CDSTestUtils {
return createArchive(opts);
}
// If you use -XX:+UseAppCDS or -XX:-UseAppCDS in your JVM command-line, call this method
// to wrap the arguments. On commercial builds, -XX:+UnlockCommercialFeatures will be
// prepended to the command-line. See JDK-8193664.
public static String[] makeCommandLineForAppCDS(String... args) throws Exception {
if (BuildHelper.isCommercialBuild()) {
String[] newArgs = new String[args.length + 1];
newArgs[0] = "-XX:+UnlockCommercialFeatures";
System.arraycopy(args, 0, newArgs, 1, args.length);
return newArgs;
} else {
return args;
}
}
// Create AppCDS archive using appcds options
public static OutputAnalyzer createArchive(AppCDSOptions opts)
@ -139,7 +153,7 @@ public class TestCommon extends CDSTestUtils {
for (String s : opts.suffix) cmd.add(s);
String[] cmdLine = cmd.toArray(new String[cmd.size()]);
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, cmdLine);
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, makeCommandLineForAppCDS(cmdLine));
return executeAndLog(pb, "dump");
}
@ -166,7 +180,7 @@ public class TestCommon extends CDSTestUtils {
for (String s : opts.suffix) cmd.add(s);
String[] cmdLine = cmd.toArray(new String[cmd.size()]);
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, cmdLine);
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, makeCommandLineForAppCDS(cmdLine));
return executeAndLog(pb, "exec");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
@ -122,14 +122,14 @@ public class UseAppCDS {
static void dumpLoadedClasses(boolean useAppCDS, String[] expectedClasses,
String[] unexpectedClasses) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
true,
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
TestCommon.makeCommandLineForAppCDS(
"-XX:DumpLoadedClassList=" + CLASSLIST_FILE,
"-cp",
TESTJAR,
useAppCDS ? "-XX:+UseAppCDS" : "-XX:-UseAppCDS",
TESTNAME,
TEST_OUT);
TEST_OUT));
OutputAnalyzer output = TestCommon.executeAndLog(pb, "dump-loaded-classes")
.shouldHaveExitValue(0).shouldContain(TEST_OUT);
@ -152,8 +152,8 @@ public class UseAppCDS {
static void dumpArchive(boolean useAppCDS, String[] expectedClasses,
String[] unexpectedClasses) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
true,
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
TestCommon.makeCommandLineForAppCDS(
useAppCDS ? "-XX:-UnlockDiagnosticVMOptions" :
"-XX:+UnlockDiagnosticVMOptions",
"-cp",
@ -162,7 +162,7 @@ public class UseAppCDS {
"-XX:SharedClassListFile=" + CLASSLIST_FILE,
"-XX:SharedArchiveFile=" + ARCHIVE_FILE,
"-Xlog:cds",
"-Xshare:dump");
"-Xshare:dump"));
OutputAnalyzer output = TestCommon.executeAndLog(pb, "dump-archive")
.shouldHaveExitValue(0);
@ -179,8 +179,8 @@ public class UseAppCDS {
static void useArchive(boolean useAppCDS, String[] expectedClasses,
String[] unexpectedClasses) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
true,
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
TestCommon.makeCommandLineForAppCDS(
useAppCDS ? "-XX:-UnlockDiagnosticVMOptions" :
"-XX:+UnlockDiagnosticVMOptions",
"-cp",
@ -190,7 +190,7 @@ public class UseAppCDS {
"-verbose:class",
"-Xshare:on",
TESTNAME,
TEST_OUT );
TEST_OUT));
OutputAnalyzer output = TestCommon.executeAndLog(pb, "use-archive");
if (CDSTestUtils.isUnableToMap(output))

View File

@ -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
@ -50,6 +50,7 @@ public class SharedStringsBasic {
TestCommon.getSourceFile("SharedStringsBasic.txt").toString();
ProcessBuilder dumpPb = ProcessTools.createJavaProcessBuilder(true,
TestCommon.makeCommandLineForAppCDS(
"-XX:+UseAppCDS",
"-XX:+UseCompressedOops",
"-XX:+UseG1GC",
@ -57,13 +58,14 @@ public class SharedStringsBasic {
"-XX:SharedArchiveConfigFile=" + sharedArchiveConfigFile,
"-XX:SharedArchiveFile=./SharedStringsBasic.jsa",
"-Xshare:dump",
"-Xlog:cds,cds+hashtables");
"-Xlog:cds,cds+hashtables"));
TestCommon.executeAndLog(dumpPb, "dump")
.shouldContain("Shared string table stats")
.shouldHaveExitValue(0);
ProcessBuilder runPb = ProcessTools.createJavaProcessBuilder(true,
TestCommon.makeCommandLineForAppCDS(
"-XX:+UseAppCDS",
"-XX:+UseCompressedOops",
"-XX:+UseG1GC",
@ -71,7 +73,7 @@ public class SharedStringsBasic {
"-XX:SharedArchiveFile=./SharedStringsBasic.jsa",
"-Xshare:auto",
"-showversion",
"HelloString");
"HelloString"));
TestCommon.executeAndLog(runPb, "run").shouldHaveExitValue(0);
}

View File

@ -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
@ -42,21 +42,23 @@ public class SysDictCrash {
// SharedBaseAddress=0 puts the archive at a very high address on solaris,
// which provokes the crash.
ProcessBuilder dumpPb = ProcessTools.createJavaProcessBuilder(true,
TestCommon.makeCommandLineForAppCDS(
"-XX:+UseG1GC", "-XX:MaxRAMPercentage=12.5",
"-XX:+UseAppCDS",
"-cp", ".",
"-XX:SharedBaseAddress=0", "-XX:SharedArchiveFile=./SysDictCrash.jsa",
"-Xshare:dump",
"-showversion", "-Xlog:cds,cds+hashtables");
"-showversion", "-Xlog:cds,cds+hashtables"));
TestCommon.checkDump(TestCommon.executeAndLog(dumpPb, "dump"));
ProcessBuilder runPb = ProcessTools.createJavaProcessBuilder(true,
TestCommon.makeCommandLineForAppCDS(
"-XX:+UseG1GC", "-XX:MaxRAMPercentage=12.5",
"-XX:+UseAppCDS",
"-XX:SharedArchiveFile=./SysDictCrash.jsa",
"-Xshare:on",
"-version");
"-version"));
TestCommon.checkExec(TestCommon.executeAndLog(runPb, "exec"));
}

View File

@ -0,0 +1,57 @@
/*
* Copyright (c) 2017, 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.
*
*/
package runtime/invokedynamic;
super public class MethodHandleConstantHelper
version 51:0
{
static Field "testField":"I";
static Method "testMethod":"()V"
{
return;
}
public static Method "testMethodSignatureResolutionFailure":"()V"
stack 1 locals 1
{
ldc MethodHandle REF_invokeStatic:
MethodHandleConstantHelper.testMethod:
"(LNotExist;)V";
return;
}
public static Method "testFieldSignatureResolutionFailure":"()V"
stack 1 locals 1
{
ldc MethodHandle REF_getField:
MethodHandleConstantHelper.testField:
"LNotExist;";
return;
}
}

View File

@ -0,0 +1,69 @@
/*
* Copyright (c) 2017, 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 8188145
* @compile MethodHandleConstantHelper.jasm
* @run main runtime.invokedynamic.MethodHandleConstantTest
*/
package runtime.invokedynamic;
import java.lang.invoke.*;
public class MethodHandleConstantTest {
static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
static final MethodType TEST_MT = MethodType.methodType(void.class);
static final Class<?> TEST_CLASS;
static {
try {
TEST_CLASS = Class.forName("runtime.invokedynamic.MethodHandleConstantHelper");
} catch (ClassNotFoundException e) {
throw new Error(e);
}
}
static void test(String testName, Class<? extends Throwable> expectedError) {
System.out.print(testName);
try {
LOOKUP.findStatic(TEST_CLASS, testName, TEST_MT).invokeExact();
} catch (Throwable e) {
if (expectedError.isInstance(e)) {
// expected
} else {
e.printStackTrace();
String msg = String.format("%s: wrong exception: %s, but %s expected",
testName, e.getClass().getName(), expectedError.getName());
throw new AssertionError(msg);
}
}
System.out.println(": PASSED");
}
public static void main(String[] args) throws Throwable {
test("testMethodSignatureResolutionFailure", NoSuchMethodError.class);
test("testFieldSignatureResolutionFailure", NoSuchFieldError.class);
}
}

View File

@ -40,10 +40,7 @@ import jdk.test.lib.process.OutputAnalyzer;
public class OsCpuLoggingTest {
static void analyzeOutputForOsLog(OutputAnalyzer output) throws Exception {
// Aix has it's own logging
if (!Platform.isAix()) {
output.shouldContain("SafePoint Polling address");
}
output.shouldContain("SafePoint Polling address");
output.shouldHaveExitValue(0);
}
@ -58,7 +55,10 @@ public class OsCpuLoggingTest {
OutputAnalyzer output = new OutputAnalyzer(pb.start());
analyzeOutputForOsCpuLog(output);
pb = ProcessTools.createJavaProcessBuilder("-Xlog:os", "-version");
// PPC64 only uses polling pages when UseSIGTRAP is off.
pb = (Platform.isPPC() && Platform.is64bit())
? ProcessTools.createJavaProcessBuilder("-Xlog:os", "-XX:-UseSIGTRAP", "-version")
: ProcessTools.createJavaProcessBuilder("-Xlog:os", "-version");
output = new OutputAnalyzer(pb.start());
analyzeOutputForOsLog(output);
}

View File

@ -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
@ -21,6 +21,11 @@
* questions.
*/
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.JDKToolLauncher;
import jdk.test.lib.Platform;
@ -69,7 +74,18 @@ public class JhsdbThreadInfoTest {
out.shouldMatch(" JavaThread state: _thread_.+");
out.shouldNotContain(" java.lang.Thread.State: UNKNOWN");
out.stderrShouldBeEmpty();
// stderr should be empty except for VM warnings.
if (!out.getStderr().isEmpty()) {
List<String> lines = Arrays.asList(out.getStderr().split("(\\r\\n|\\n|\\r)"));
Pattern p = Pattern.compile(".*VM warning.*");
for (String line : lines) {
Matcher m = p.matcher(line);
if (!m.matches()) {
throw new RuntimeException("Stderr has output other than VM warnings");
}
}
}
System.out.println("Test Completed");
} catch (InterruptedException ie) {

View File

@ -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,11 @@
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Asserts;
import jdk.test.lib.JDKToolLauncher;
@ -76,7 +80,19 @@ public class TestJhsdbJstackLock {
out.shouldMatch("^\\s+- waiting to lock <0x[0-9a-f]+> \\(a java\\.lang\\.Class for LingeredAppWithLock\\)$");
out.shouldMatch("^\\s+- locked <0x[0-9a-f]+> \\(a java\\.lang\\.Thread\\)$");
out.shouldMatch("^\\s+- locked <0x[0-9a-f]+> \\(a java\\.lang\\.Class for int\\)$");
out.stderrShouldBeEmpty();
// stderr should be empty except for VM warnings.
if (!out.getStderr().isEmpty()) {
List<String> lines = Arrays.asList(out.getStderr().split("(\\r\\n|\\n|\\r)"));
Pattern p = Pattern.compile(".*VM warning.*");
for (String line : lines) {
Matcher m = p.matcher(line);
if (!m.matches()) {
throw new RuntimeException("Stderr has output other than VM warnings");
}
}
}
System.out.println("Test Completed");
} finally {

View File

@ -22,7 +22,8 @@
*/
/**
* @test 8155740
* @test
* @bug 8155740
* @key headful
* @summary See <rdar://problem/3429130>: Events: actionPerformed() method not
* called when it is button is clicked (system load related)

View File

@ -22,7 +22,8 @@
*/
/**
* @test 8155740
* @test
* @bug 8155740
* @key headful
* @summary See <rdar://problem/3429130>: Events: actionPerformed() method not
* called when it is button is clicked (system load related)

View File

@ -36,7 +36,8 @@ import static jdk.testlibrary.Asserts.assertNull;
import static jdk.testlibrary.Asserts.assertTrue;
/*
* @test 8155742
* @test
* @bug 8155742
* @key headful
* @summary Make sure that modifier key mask is set when robot press
* some key with one or more modifiers.

View File

@ -29,7 +29,8 @@ import java.awt.event.InputEvent;
import java.awt.image.BufferedImage;
/*
* @test 6384991
* @test
* @bug 6384991
* @summary Check if ActionEvent is triggered by a TrayIcon when
* it is double clicked with mouse button 1 on windows
* or single clicked with button 3 on Mac OS X

View File

@ -22,7 +22,8 @@
*/
/*
* @test 8020968
* @test
* @bug 8020968
* @summary Test security permission check
* @run main/othervm/java.security.policy=noperms.policy SecurityExceptions true
* @run main/othervm/java.security.policy=stackwalk.policy SecurityExceptions false

View File

@ -31,7 +31,8 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/*
* @test 8163162
* @test
* @bug 8163162
* @summary Checks that LazyLoggers are returned for System.Logger instances
* created by modules in the platform class loader.
* @modules java.base/java.lang:open

View File

@ -23,7 +23,7 @@
/*
* @test
* @test 4422738
* @bug 4422738
* @compile InvalidParameters.java
* @run main InvalidParameters
* @summary Make sure PKIXBuilderParameters(Set) detects invalid

View File

@ -23,7 +23,7 @@
/**
* @test
* @test 4422738
* @bug 4422738
* @compile InvalidParameters.java
* @run main InvalidParameters
* @summary Make sure PKIXParameters(Set) and setTrustAnchors() detects invalid

View File

@ -22,7 +22,8 @@
*/
/**
* @test 8037857
* @test
* @bug 8037857
* @summary tests for stream and spliterator factory methods
* @run testng StreamAndSpliterator
*/

View File

@ -22,7 +22,8 @@
*/
/**
* @test 8014076 8025067
* @test
* @bug 8014076 8025067
* @summary unit test for Arrays.ParallelPrefix().
* @author Tristan Yan
* @modules java.management jdk.management

View File

@ -22,8 +22,9 @@
*/
/**
* @test 4235519 8004212 8005394 8007298 8006295 8006315 8006530 8007379 8008925
* 8014217 8025003 8026330 8028397 8129544 8165243
* @test
* @bug 4235519 8004212 8005394 8007298 8006295 8006315 8006530 8007379 8008925
* 8014217 8025003 8026330 8028397 8129544 8165243
* @summary tests java.util.Base64
* @library /test/lib
* @build jdk.test.lib.RandomFactory

View File

@ -22,7 +22,8 @@
*/
/*
* @test 4235519
* @test
* @bug 4235519
* @author Eric Wang <yiming.wang@oracle.com>
* @summary tests java.util.Base64
*/

View File

@ -28,7 +28,8 @@ import java.util.logging.LogRecord;
import java.util.logging.Logger;
/**
* @test 8152515
* @test
* @bug 8152515
* @summary Checks that LinkageError are ignored when closing handlers
* during Shutdown.
* @build LinkageErrorTest

View File

@ -0,0 +1,59 @@
/*
* 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 8194044
* @summary Test if Win32ShellFolder2 root folder object gets identified as such.
* @requires os.family=="windows"
* @modules java.desktop/sun.awt.shell
* @run main FileSystemRootTest
*/
import sun.awt.shell.ShellFolder;
import javax.swing.filechooser.FileSystemView;
import java.io.File;
public class FileSystemRootTest {
public static void main(String[] args) throws Exception {
FileSystemView fileSystemView = FileSystemView.getFileSystemView();
/*
* This is the only way to get the Win32ShellFolder2 object, since
* it is an internal class, which cannot be instantiated directly.
* On windows, this returns "C:\Users\<user-name>\Documents"
*/
File def = fileSystemView.getDefaultDirectory();
File root = fileSystemView.getParentDirectory(
fileSystemView.getParentDirectory(
fileSystemView.getParentDirectory(def)));
if (! (root instanceof ShellFolder && ShellFolder.isFileSystemRoot(root))) {
throw new RuntimeException("Test failed: root drive reported as false");
}
if (fileSystemView.getSystemDisplayName(root).isEmpty()) {
throw new RuntimeException("Root drive display name is empty.");
}
}
}

View File

@ -0,0 +1,103 @@
/*
* 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 javax.swing.UIManager;
import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
/**
* @test
* @bug 8193673
* @summary The test verifies that l&f specific properties are accessible
*/
public final class TestProperties {
private static final String[] windowsProperties = {
"FileChooser.viewMenuButtonToolTipText",
"FileChooser.viewMenuButtonAccessibleName",
};
private static final String[] aquaProperties = {
"FileChooser.mac.newFolder",
};
private static final String[] gtkProperties = {
"FileChooser.renameFileDialogText",
};
private static final String[] motifProperties = {
"FileChooser.enterFolderNameLabel.textAndMnemonic",
};
private static final String[] nimbusProperties = {
"FileChooser.refreshActionLabelText",
};
private static final String[] metalProperties = {
"MetalTitlePane.iconify.titleAndMnemonic",
};
public static void main(final String[] args) throws Exception {
UIManager.setLookAndFeel(new MetalLookAndFeel());
test(metalProperties);
UIManager.setLookAndFeel(new NimbusLookAndFeel());
test(nimbusProperties);
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
test(motifProperties);
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
test(windowsProperties);
} catch (Exception e) {
// ignore
}
try {
UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel");
test(aquaProperties);
} catch (Exception e) {
// ignore
}
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
test(gtkProperties);
} catch (Exception e) {
// ignore
}
}
private static void test(final String[] properties) {
for (final String name : properties) {
String value = UIManager.getString(name);
if (value == null) {
System.err.println("Current LookAndFeel = "
+ UIManager.getLookAndFeel().getDescription());
System.err.printf("The value for %s property is null\n", name);
throw new Error();
}
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, 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
@ -29,7 +29,7 @@
* jfx app class, a main-class for the manifest, a bogus one and none.
* All should execute except the incorrect fx app class entries.
* @run main/othervm FXLauncherTest
* @key intermittent
* @key intermittent headful
*/
import java.io.File;
import java.io.IOException;

View File

@ -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
@ -71,6 +71,10 @@ public class RunpathTest extends TestHelper {
public static void main(String... args) throws Exception {
if (isSolaris || isLinux) {
RunpathTest rp = new RunpathTest();
if (rp.elfreaderCmd == null) {
System.err.println("Warning: test passes vacuously");
return;
}
rp.testRpath();
}
}

View 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 8194955
* @summary Warn when default HTML version is used.
* @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
* @build JavadocTester
* @run main TestHtmlWarning
*/
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
public class TestHtmlWarning extends JavadocTester {
public static void main(String... args) throws Exception {
Files.write(testFile,
List.of("/** Comment. */", "public class C { }"));
TestHtmlWarning tester = new TestHtmlWarning();
tester.runTests();
}
private static final Path testFile = Paths.get("C.java");
private static final String warning =
"javadoc: warning - You have not specified the version of HTML to use.";
@Test
void testHtml4() {
javadoc("-d", "out-4",
"-html4",
testFile.toString());
checkExit(Exit.OK);
checkOutput(Output.OUT, false, warning);
}
@Test
void testHtml5() {
javadoc("-d", "out-5",
"-html5",
testFile.toString());
checkExit(Exit.OK);
checkOutput(Output.OUT, false, warning);
}
@Test
void testDefault() {
javadoc("-d", "out-default",
testFile.toString());
checkExit(Exit.OK);
checkOutput(Output.OUT, true, warning);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 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
@ -63,6 +63,7 @@ public class Test {
// For some reason, this must be the first option when used.
opts.addAll(list("-locale", "en_US"));
opts.add("-Xdoclint:none");
opts.add("-html4");
opts.addAll(list("-classpath", System.getProperty("test.src")));
opts.addAll(list("-d", testOutDir.getPath()));
opts.addAll(testOpts);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 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
@ -47,6 +47,7 @@ public class Test {
File testSrc = new File(System.getProperty("test.src"));
String[] args = {
"-Xdoclint:none",
"-html4",
"-source", "8",
"-classpath", ".",
"-package",

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 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
@ -58,6 +58,7 @@ public class TestStdDoclet {
cmdArgs.addAll(Arrays.asList(
"-classpath", ".", // insulates us from ambient classpath
"-Xdoclint:none",
"-html4",
"-package",
new File(testSrc, thisClassName + ".java").getPath()
));

View File

@ -0,0 +1,76 @@
/*
* 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 8181878
* @summary javadoc should support/ignore --add-opens
* @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
* @build toolbox.JavacTask toolbox.JavadocTask toolbox.TestRunner toolbox.ToolBox
* @run main AddOpensTest
*/
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import toolbox.JavadocTask;
import toolbox.Task;
import toolbox.TestRunner;
import toolbox.ToolBox;
public class AddOpensTest extends TestRunner {
public static void main(String... args) throws Exception {
AddOpensTest t = new AddOpensTest();
t.runTests();
}
private final ToolBox tb = new ToolBox();
private final Path src = Paths.get("src");
private final Path api = Paths.get("api");
AddOpensTest() throws Exception {
super(System.err);
init();
}
void init() throws IOException {
tb.writeJavaFiles(src, "public class C { }");
}
@Test
public void testEncoding() {
Task.Result result = new JavadocTask(tb, Task.Mode.EXEC)
.options("-d", api.toString(),
"--add-opens", "some.module")
.files(src.resolve("C.java"))
.run(Task.Expect.SUCCESS)
.writeAll();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2016, 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
@ -75,7 +75,7 @@ public class MaxWarns {
String javadoc(File f) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
String[] args = { "-Xdoclint:none", "-d", "api", f.getPath() };
String[] args = { "-Xdoclint:none", "-html4", "-d", "api", f.getPath() };
int rc = jdk.javadoc.internal.tool.Main.execute(args, pw);
pw.flush();
return sw.toString();

View File

@ -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
@ -62,6 +62,7 @@ public class QuietOption {
void run1() throws Exception {
List<String> output = doTest(javadoc.getPath(),
"-classpath", ".", // insulates us from ambient classpath
"-html4",
"-quiet",
new File(testSrc, thisClassName + ".java").getPath());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, 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
@ -92,6 +92,7 @@ public class DocLintTest {
/* 05 */ "}\n";
private final String rawDiags = "-XDrawDiagnostics";
private final String htmlVersion = "-html4";
private enum Message {
// doclint messages
@ -141,66 +142,66 @@ public class DocLintTest {
javadoc = ToolProvider.getSystemDocumentationTool();
fm = javadoc.getStandardFileManager(null, null, null);
try {
fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(".")));
fm.setLocation(StandardLocation.CLASS_OUTPUT, List.of(new File(".")));
fm.setLocation(StandardLocation.CLASS_PATH, Collections.<File>emptyList());
files = Arrays.asList(new TestJFO("Test.java", code));
files = List.of(new TestJFO("Test.java", code));
test(Collections.<String>emptyList(),
test(List.of(htmlVersion),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR9A, Message.DL_WRN12A));
test(Arrays.asList(rawDiags),
test(List.of(htmlVersion, rawDiags),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR9, Message.DL_WRN12));
// test(Arrays.asList("-Xdoclint:none"),
// test(List.of("-Xdoclint:none"),
// Main.Result.OK,
// EnumSet.of(Message.JD_WRN10, Message.JD_WRN13));
test(Arrays.asList(rawDiags, "-Xdoclint"),
test(List.of(htmlVersion, rawDiags, "-Xdoclint"),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR9, Message.DL_WRN12));
test(Arrays.asList(rawDiags, "-Xdoclint:all/public"),
test(List.of(htmlVersion, rawDiags, "-Xdoclint:all/public"),
Main.Result.ERROR,
EnumSet.of(Message.OPT_BADQUAL));
test(Arrays.asList(rawDiags, "-Xdoclint:all", "-public"),
test(List.of(htmlVersion, rawDiags, "-Xdoclint:all", "-public"),
Main.Result.OK,
EnumSet.of(Message.DL_WRN12));
test(Arrays.asList(rawDiags, "-Xdoclint:syntax"),
test(List.of(htmlVersion, rawDiags, "-Xdoclint:syntax"),
Main.Result.OK,
EnumSet.of(Message.DL_WRN12));
test(Arrays.asList(rawDiags, "-private"),
test(List.of(htmlVersion, rawDiags, "-private"),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR6, Message.DL_ERR9, Message.DL_WRN12));
test(Arrays.asList(rawDiags, "-Xdoclint:syntax", "-private"),
test(List.of(htmlVersion, rawDiags, "-Xdoclint:syntax", "-private"),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR6, Message.DL_WRN12));
test(Arrays.asList(rawDiags, "-Xdoclint:reference"),
test(List.of(htmlVersion, rawDiags, "-Xdoclint:reference"),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR9));
test(Arrays.asList(rawDiags, "-Xdoclint:badarg"),
test(List.of(htmlVersion, rawDiags, "-Xdoclint:badarg"),
Main.Result.ERROR,
EnumSet.of(Message.OPT_BADARG));
files = Arrays.asList(new TestJFO("p1/P1Test.java", p1Code),
files = List.of(new TestJFO("p1/P1Test.java", p1Code),
new TestJFO("p2/P2Test.java", p2Code));
test(Arrays.asList(rawDiags),
test(List.of(htmlVersion, rawDiags),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR_P1TEST, Message.DL_ERR_P2TEST));
test(Arrays.asList(rawDiags, "-Xdoclint/package:p1"),
test(List.of(htmlVersion, rawDiags, "-Xdoclint/package:p1"),
Main.Result.ERROR,
EnumSet.of(Message.DL_ERR_P1TEST));
test(Arrays.asList(rawDiags, "-Xdoclint/package:*p"),
test(List.of(htmlVersion, rawDiags, "-Xdoclint/package:*p"),
Main.Result.ERROR,
EnumSet.of(Message.OPT_BADPACKAGEARG));

View 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 8187805
* @summary bogus RuntimeVisibleTypeAnnotations for unused local in a block
* @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.util
* @run main BogusRTTAForUnusedVarTest
*/
import com.sun.tools.classfile.*;
import java.io.File;
import java.lang.annotation.Target;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import com.sun.tools.classfile.Attribute;
import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
import com.sun.tools.classfile.TypeAnnotation;
import com.sun.tools.classfile.TypeAnnotation.Position;
import com.sun.tools.javac.util.Assert;
public class BogusRTTAForUnusedVarTest {
class Foo {
void something() {
{
@MyAnno Object o = new Object();
}
}
}
@Target(ElementType.TYPE_USE)
@Retention(RetentionPolicy.RUNTIME)
@interface MyAnno {}
public static void main(String args[]) throws Throwable {
new BogusRTTAForUnusedVarTest().run();
}
void run() throws Throwable {
checkRTTA();
}
void checkRTTA() throws Throwable {
File testClasses = new File(System.getProperty("test.classes"));
File file = new File(testClasses,
BogusRTTAForUnusedVarTest.class.getName() + "$Foo.class");
ClassFile classFile = ClassFile.read(file);
for (Method m : classFile.methods) {
if (m.getName(classFile.constant_pool).equals("something")) {
for (Attribute a : m.attributes) {
if (a.getName(classFile.constant_pool).equals("Code")) {
Code_attribute code = (Code_attribute)a;
for (Attribute codeAttrs : code.attributes) {
if (codeAttrs.getName(classFile.constant_pool).equals("RuntimeVisibleTypeAnnotations")) {
throw new AssertionError("no RuntimeVisibleTypeAnnotations attribute should have been generated in this case");
}
}
}
}
}
}
}
}

View File

@ -1,116 +0,0 @@
/*
* Copyright (c) 2017, 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 8192885
* @summary Compiler in JDK 10-ea+33 misses to include entry in LineNumberTable for goto instruction of foreach loop
* @library /tools/lib
* @modules jdk.jdeps/com.sun.tools.classfile
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.util
* jdk.jdeps/com.sun.tools.javap
* @build toolbox.ToolBox toolbox.JavacTask
* @run main AddGotoAfterForLoopToLNTTest
*/
import java.io.File;
import java.nio.file.Paths;
import com.sun.tools.classfile.ClassFile;
import com.sun.tools.classfile.Code_attribute;
import com.sun.tools.classfile.LineNumberTable_attribute;
import com.sun.tools.classfile.Method;
import com.sun.tools.javac.util.Assert;
import toolbox.JavacTask;
import toolbox.ToolBox;
public class AddGotoAfterForLoopToLNTTest {
static final String testSource =
/* 01 */ "class GotoAtEnhancedForTest {\n" +
/* 02 */ " void lookForThisMethod() {\n" +
/* 03 */ " for (Object o : java.util.Collections.emptyList()) {\n" +
/* 04 */ " }\n" +
/* 05 */ " }\n" +
/* 06 */ "}";
static final int[][] expectedLNT = {
// {line-number, start-pc},
{3, 0},
{4, 25},
{3, 28},
{5, 30},
};
static final String methodToLookFor = "lookForThisMethod";
public static void main(String[] args) throws Exception {
new AddGotoAfterForLoopToLNTTest().run();
}
ToolBox tb = new ToolBox();
void run() throws Exception {
compileTestClass();
checkClassFile(new File(Paths.get(System.getProperty("user.dir"),
"GotoAtEnhancedForTest.class").toUri()), methodToLookFor);
}
void compileTestClass() throws Exception {
new JavacTask(tb)
.sources(testSource)
.run();
}
void checkClassFile(final File cfile, String methodToFind) throws Exception {
ClassFile classFile = ClassFile.read(cfile);
boolean methodFound = false;
for (Method method : classFile.methods) {
if (method.getName(classFile.constant_pool).equals(methodToFind)) {
methodFound = true;
Code_attribute code = (Code_attribute) method.attributes.get("Code");
LineNumberTable_attribute lnt =
(LineNumberTable_attribute) code.attributes.get("LineNumberTable");
Assert.check(lnt.line_number_table_length == expectedLNT.length,
"The LineNumberTable found has a length different to the expected one");
int i = 0;
for (LineNumberTable_attribute.Entry entry: lnt.line_number_table) {
Assert.check(entry.line_number == expectedLNT[i][0] &&
entry.start_pc == expectedLNT[i][1],
"LNT entry at pos " + i + " differ from expected." +
"Found " + entry.line_number + ":" + entry.start_pc +
". Expected " + expectedLNT[i][0] + ":" + expectedLNT[i][1]);
i++;
}
}
}
Assert.check(methodFound, "The seek method was not found");
}
void error(String msg) {
throw new AssertionError(msg);
}
}

View File

@ -3,7 +3,7 @@
public class TestCaseForEach {
@AliveRange(varName="o", bytecodeStart=25, bytecodeLength=11)
@AliveRange(varName="o", bytecodeStart=41, bytecodeLength=1)
@AliveRange(varName="o", bytecodeStart=39, bytecodeLength=1)
void m(String[] args) {
Object o;
for (String s : args) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 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
@ -57,6 +57,7 @@ public class TestStdDoclet {
cmdArgs.add(javadoc.getPath());
cmdArgs.addAll(Arrays.asList(
"-classpath", ".", // insulates us from ambient classpath
"-html4",
"-Xdoclint:none",
"-package",
new File(testSrc, thisClassName + ".java").getPath()

View File

@ -0,0 +1,77 @@
/*
* 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 8181878
* @summary javadoc should support/ignore --add-opens
* @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 AddOpensTest
*/
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import toolbox.JavadocTask;
import toolbox.Task;
import toolbox.TestRunner;
import toolbox.ToolBox;
public class AddOpensTest extends TestRunner {
public static void main(String... args) throws Exception {
AddOpensTest t = new AddOpensTest();
t.runTests();
}
private final ToolBox tb = new ToolBox();
private final Path src = Paths.get("src");
private final Path api = Paths.get("api");
AddOpensTest() throws Exception {
super(System.err);
init();
}
void init() throws IOException {
tb.writeJavaFiles(src, "public class C { }");
}
@Test
public void testEncoding() {
Task.Result result = new JavadocTask(tb, Task.Mode.EXEC)
.options("-docletpath", System.getProperty("test.class.path"),
"-doclet", "ToyDoclet",
"--add-opens", "some.module")
.files(src.resolve("C.java"))
.run(Task.Expect.SUCCESS)
.writeAll();
}
}