From 75ed38eaafc88aacbb7b6f06f73756c0376f5f06 Mon Sep 17 00:00:00 2001 From: Jesper Wilhelmsson Date: Thu, 14 Feb 2019 01:22:07 +0100 Subject: [PATCH 001/109] Added tag jdk-12+32 for changeset 4ce47bc1fb92 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 0a2ba5b9f1a..0deec91eab8 100644 --- a/.hgtags +++ b/.hgtags @@ -534,3 +534,4 @@ f15d443f97318e9b40e6f451e327ff69ed4ec361 jdk-12+27 44f41693631f9b5ac78ff4d2bfabd6734fe46df2 jdk-12+29 6c377af36a5c4203f16aed8a5e4c2ecc08fcd8bd jdk-12+30 b5f7bb57de2f797be34f6c75d45c3245ad37ab97 jdk-12+31 +4ce47bc1fb92cf94c6e3d1f49d582f02dcb851ab jdk-12+32 From 799c9a66fd2c9959244ec5a41eda75416672e32d Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Tue, 19 Feb 2019 08:58:55 +0100 Subject: [PATCH 002/109] 8218721: C1's CEE optimization produces safepoint poll with invalid debug information Bail out of CEE if one of the gotos is a safepoint but the if is not. Reviewed-by: vlivanov, mdoerr --- src/hotspot/share/c1/c1_Optimizer.cpp | 8 +- .../hotspot/jtreg/compiler/c1/TestGotoIf.jasm | 171 ++++++++++++++++++ .../jtreg/compiler/c1/TestGotoIfMain.java | 46 +++++ 3 files changed, 224 insertions(+), 1 deletion(-) create mode 100644 test/hotspot/jtreg/compiler/c1/TestGotoIf.jasm create mode 100644 test/hotspot/jtreg/compiler/c1/TestGotoIfMain.java diff --git a/src/hotspot/share/c1/c1_Optimizer.cpp b/src/hotspot/share/c1/c1_Optimizer.cpp index f5931ced20b..2e65a543b13 100644 --- a/src/hotspot/share/c1/c1_Optimizer.cpp +++ b/src/hotspot/share/c1/c1_Optimizer.cpp @@ -174,6 +174,12 @@ void CE_Eliminator::block_do(BlockBegin* block) { for_each_phi_fun(t_block, phi, return; ); for_each_phi_fun(f_block, phi, return; ); + // Only replace safepoint gotos if state_before information is available (if is a safepoint) + bool is_safepoint = if_->is_safepoint(); + if (!is_safepoint && (t_goto->is_safepoint() || f_goto->is_safepoint())) { + return; + } + // 2) substitute conditional expression // with an IfOp followed by a Goto // cut if_ away and get node before @@ -202,7 +208,7 @@ void CE_Eliminator::block_do(BlockBegin* block) { // append Goto to successor ValueStack* state_before = if_->state_before(); - Goto* goto_ = new Goto(sux, state_before, if_->is_safepoint() || t_goto->is_safepoint() || f_goto->is_safepoint()); + Goto* goto_ = new Goto(sux, state_before, is_safepoint); // prepare state for Goto ValueStack* goto_state = if_state; diff --git a/test/hotspot/jtreg/compiler/c1/TestGotoIf.jasm b/test/hotspot/jtreg/compiler/c1/TestGotoIf.jasm new file mode 100644 index 00000000000..b5dc03af232 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c1/TestGotoIf.jasm @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2019, 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. + * + */ + +public class compiler/c1/TestGotoIf version 52:0 { + public Field f1:"I"; + public Field f2:"I"; + public static Field i:"I"; + + Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + public Method test1:"()I" stack 3 locals 1 { + aload_0; + getfield Field f1:"I"; + aload_0; + getfield Field f2:"I"; + iconst_1; + isub; + // Without the fix, if got eliminated by CEE + if_icmpgt Null; + iconst_1; + Return: stack_frame_type stack1; + stack_map int; + ireturn; + Null: stack_frame_type same; + iconst_0; + goto Return; // Backbranch (t_goto) with safepoint + } + + public Method test2:"()I" stack 3 locals 1 { + aload_0; + getfield Field f1:"I"; + aload_0; + getfield Field f2:"I"; + iconst_1; + isub; + goto Skip; + Return: stack_frame_type full; + stack_map int; + ireturn; + Skip: stack_frame_type full; + stack_map int, int; + // Without the fix, if got eliminated by CEE + if_icmpgt Null; + iconst_1; + goto Return; // Backbranch (f_goto) with safepoint + Null: stack_frame_type full; + stack_map; + iconst_0; + goto Return; // Backbranch (t_goto) with safepoint + } + + public Method test3:"()I" stack 3 locals 1 { + aload_0; + getfield Field f1:"I"; + aload_0; + getfield Field f2:"I"; + iconst_1; + isub; + goto Skip; + Return: stack_frame_type full; + stack_map int; + ireturn; + Null: stack_frame_type full; + stack_map; + iconst_0; + goto Return; // Backbranch (t_goto) with safepoint + Skip: stack_frame_type full; + stack_map int, int; + // If will be eliminated by CEE + if_icmpgt Null; // Backbranch (if) with safepoint + iconst_1; + goto Return; // Backbranch (f_goto) with safepoint + } + + public Method test4:"()I" stack 3 locals 1 { + aload_0; + getfield Field f1:"I"; + aload_0; + getfield Field f2:"I"; + iconst_1; + isub; + goto Skip; + Null: stack_frame_type full; + stack_map; + iconst_0; + Return: stack_frame_type full; + stack_map int; + ireturn; + Skip: stack_frame_type full; + stack_map int, int; + // If will be eliminated by CEE + if_icmpgt Null; // Backbranch (if) with safepoint + iconst_1; + goto Return; // Backbranch (f_goto) with safepoint + } + + public Method test5:"()I" stack 3 locals 2 { + aload_0; + getfield Field f1:"I"; + aload_0; + getfield Field f2:"I"; + iconst_1; + isub; + goto Skip; + Null: stack_frame_type full; + stack_map; + iconst_0; + goto Return; + Skip: stack_frame_type full; + stack_map int, int; + // If will be eliminated by CEE + if_icmpgt Null; // Backbranch (if) with safepoint + iconst_1; + Return: stack_frame_type full; + stack_map int; + ireturn; + } + + public Method test6:"()I" stack 4 locals 1 { + getstatic Field i:"I"; + Loop: stack_frame_type full; + stack_map int; + // Decrement i and exit loop if < 0 + iconst_0; + getstatic Field i:"I"; + iconst_1; + isub; + dup; + putstatic Field i:"I"; + if_icmpgt Exit; + + iconst_1; + // Without the fix, if got eliminated by CEE + if_icmpgt Null; + iconst_1; + goto Loop; // Backbranch (f_goto) with safepoint + Null: stack_frame_type same; + iconst_0; + goto Loop; // Backbranch (t_goto) with safepoint + + Exit: stack_frame_type full; + stack_map int; + iconst_0; + ireturn; + } +} diff --git a/test/hotspot/jtreg/compiler/c1/TestGotoIfMain.java b/test/hotspot/jtreg/compiler/c1/TestGotoIfMain.java new file mode 100644 index 00000000000..ac8b1b8bedc --- /dev/null +++ b/test/hotspot/jtreg/compiler/c1/TestGotoIfMain.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019, 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 8218721 + * @compile TestGotoIf.jasm + * @run main/othervm -XX:TieredStopAtLevel=1 -Xcomp + * -XX:CompileCommand=compileonly,compiler.c1.TestGotoIf::test* + * compiler.c1.TestGotoIfMain + */ + +package compiler.c1; + +public class TestGotoIfMain { + public static void main(String[] args) { + TestGotoIf test = new TestGotoIf(); + test.i = 5; + test.test1(); + test.test2(); + test.test3(); + test.test4(); + test.test5(); + test.test6(); + } +} From b6987a91a3db7e077f13d04327de3c076eeed231 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Mon, 18 Feb 2019 09:38:43 +0100 Subject: [PATCH 003/109] 8219112: name_and_sig_as_C_string usages in frame_s390 miss ResourceMark Reviewed-by: shade, lucy --- src/hotspot/cpu/s390/frame_s390.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/s390/frame_s390.cpp b/src/hotspot/cpu/s390/frame_s390.cpp index 35173f04f5b..67d519ac327 100644 --- a/src/hotspot/cpu/s390/frame_s390.cpp +++ b/src/hotspot/cpu/s390/frame_s390.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016 SAP SE. All rights reserved. + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, SAP SE. 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 @@ -479,6 +479,7 @@ void frame::back_trace(outputStream* st, intptr_t* start_sp, intptr_t* top_pc, u // name Method* method = *(Method**)((address)current_fp + _z_ijava_state_neg(method)); if (method) { + ResourceMark rm; if (method->is_synchronized()) st->print("synchronized "); if (method->is_static()) st->print("static "); if (method->is_native()) st->print("native "); @@ -543,6 +544,7 @@ void frame::back_trace(outputStream* st, intptr_t* start_sp, intptr_t* top_pc, u // name Method* method = ((nmethod *)blob)->method(); if (method) { + ResourceMark rm; method->name_and_sig_as_C_string(buf, sizeof(buf)); st->print("%s ", buf); } From e79488cc1bd31c0e4e10b609a4d5dc97ec298db3 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 19 Feb 2019 10:00:51 +0100 Subject: [PATCH 004/109] 8218731: SA: Use concrete class the as return type of VMObjectFactory.newObject Reviewed-by: eosterlund --- .../classes/sun/jvm/hotspot/runtime/VMObjectFactory.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VMObjectFactory.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VMObjectFactory.java index 7ab2c4a6d3b..ec486667979 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VMObjectFactory.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VMObjectFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -45,14 +45,14 @@ import sun.jvm.hotspot.types.*; */ public class VMObjectFactory { - public static Object newObject(Class clazz, Address addr) + public static T newObject(Class clazz, Address addr) throws ConstructionException { try { if (addr == null) { return null; } - Constructor c = clazz.getConstructor(new Class[] { + Constructor c = clazz.getConstructor(new Class[] { Address.class }); return c.newInstance(new Object[] { addr }); From ec5471796079f53deb44fc224d6402f664ab2ea1 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 19 Feb 2019 10:01:50 +0100 Subject: [PATCH 005/109] 8218732: SA: Resolves ZPageAllocator::_physical incorrectly Reviewed-by: eosterlund, jgeorge --- .../classes/sun/jvm/hotspot/gc/z/ZPageAllocator.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageAllocator.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageAllocator.java index 07e859097fa..41d90b2a599 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageAllocator.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageAllocator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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,7 +37,7 @@ import sun.jvm.hotspot.types.TypeDataBase; public class ZPageAllocator extends VMObject { - private static AddressField physicalField; + private static long physicalFieldOffset; private static CIntegerField usedField; static { @@ -47,12 +47,12 @@ public class ZPageAllocator extends VMObject { static private synchronized void initialize(TypeDataBase db) { Type type = db.lookupType("ZPageAllocator"); - physicalField = type.getAddressField("_physical"); + physicalFieldOffset = type.getAddressField("_physical").getOffset(); usedField = type.getCIntegerField("_used"); } private ZPhysicalMemoryManager physical() { - Address physicalAddr = physicalField.getValue(addr); + Address physicalAddr = addr.addOffsetTo(physicalFieldOffset); return (ZPhysicalMemoryManager)VMObjectFactory.newObject(ZPhysicalMemoryManager.class, physicalAddr); } From 797122c227c29c44da4abe2cb0331b4e839393aa Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 19 Feb 2019 10:02:00 +0100 Subject: [PATCH 006/109] 8218733: SA: CollectedHeap provides broken implementation for used() and capacity() Reviewed-by: shade, jgeorge, eosterlund --- .../sun/jvm/hotspot/gc/epsilon/EpsilonHeap.java | 10 ++++++++++ .../sun/jvm/hotspot/gc/shared/CollectedHeap.java | 6 +++--- .../jvm/hotspot/gc/shenandoah/ShenandoahHeap.java | 5 +++++ .../classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java | 12 +++++++++++- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/epsilon/EpsilonHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/epsilon/EpsilonHeap.java index 0c82492a22a..4b6ef34caf7 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/epsilon/EpsilonHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/epsilon/EpsilonHeap.java @@ -66,6 +66,16 @@ public class EpsilonHeap extends CollectedHeap { return CollectedHeapName.EPSILON; } + @Override + public long capacity() { + return space.capacity(); + } + + @Override + public long used() { + return space.used(); + } + public ContiguousSpace space() { return space; } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java index ec47fab40d3..c240b53bd6c 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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,8 +58,8 @@ public abstract class CollectedHeap extends VMObject { return reservedRegion().start(); } - public long capacity() { return 0; } - public long used() { return 0; } + public abstract long capacity(); + public abstract long used(); public MemRegion reservedRegion() { return new MemRegion(addr.addOffsetTo(reservedFieldOffset)); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java index 200633eedcc..f12a650a416 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java @@ -63,6 +63,11 @@ public class ShenandoahHeap extends CollectedHeap { return numRegions.getValue(addr); } + @Override + public long capacity() { + return numOfRegions() * ShenandoahHeapRegion.regionSizeBytes(); + } + @Override public long used() { return used.getValue(addr); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java index da30683387a..321d8b24bc2 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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 @@ -70,6 +70,16 @@ public class ZCollectedHeap extends CollectedHeap { super(addr); } + @Override + public long capacity() { + return heap().capacity(); + } + + @Override + public long used() { + return heap().used(); + } + public OopHandle oop_load_at(OopHandle handle, long offset) { assert(!VM.getVM().isCompressedOopsEnabled()); From 5f5c6362d9aa7f752d09be672da96c4fd3ce3b12 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 19 Feb 2019 10:02:42 +0100 Subject: [PATCH 007/109] 8218734: SA: Incorrect and raw loads of OopHandles Reviewed-by: eosterlund, coleenp, jgeorge --- src/hotspot/share/oops/oopHandle.hpp | 1 + src/hotspot/share/runtime/vmStructs.cpp | 4 +- .../hotspot/classfile/ClassLoaderData.java | 17 ++--- .../jvm/hotspot/gc/shared/CollectedHeap.java | 4 ++ .../sun/jvm/hotspot/gc/z/ZCollectedHeap.java | 21 +++++- .../classes/sun/jvm/hotspot/oops/Klass.java | 20 ++---- .../sun/jvm/hotspot/oops/VMOopHandle.java | 65 +++++++++++++++++++ 7 files changed, 103 insertions(+), 29 deletions(-) create mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/VMOopHandle.java diff --git a/src/hotspot/share/oops/oopHandle.hpp b/src/hotspot/share/oops/oopHandle.hpp index 7742106ac18..c07d4f1e976 100644 --- a/src/hotspot/share/oops/oopHandle.hpp +++ b/src/hotspot/share/oops/oopHandle.hpp @@ -36,6 +36,7 @@ // future uses for read barriers. class OopHandle { + friend class VMStructs; private: oop* _obj; diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index dbab2aaf124..30c6e4d86da 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -332,6 +332,7 @@ typedef PaddedEnd PaddedObjectMonitor; unchecked_nonstatic_field(Symbol, _body, sizeof(u1)) /* NOTE: no type */ \ nonstatic_field(Symbol, _body[0], u1) \ nonstatic_field(TypeArrayKlass, _max_length, jint) \ + nonstatic_field(OopHandle, _obj, oop*) \ \ /***********************/ \ /* Constant Pool Cache */ \ @@ -1299,7 +1300,8 @@ typedef PaddedEnd PaddedObjectMonitor; declare_oop_type(oop) \ declare_oop_type(narrowOop) \ declare_oop_type(typeArrayOop) \ - declare_oop_type(OopHandle) \ + \ + declare_toplevel_type(OopHandle) \ \ /*************************************/ \ /* MethodOop-related data structures */ \ diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/classfile/ClassLoaderData.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/classfile/ClassLoaderData.java index d79538b0b77..e8e6e2a72d5 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/classfile/ClassLoaderData.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/classfile/ClassLoaderData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, 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,6 @@ package sun.jvm.hotspot.classfile; -import java.io.PrintStream; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.memory.*; import sun.jvm.hotspot.runtime.*; @@ -42,14 +41,14 @@ public class ClassLoaderData extends VMObject { private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { Type type = db.lookupType("ClassLoaderData"); - classLoaderField = type.getAddressField("_class_loader"); + classLoaderFieldOffset = type.getAddressField("_class_loader").getOffset(); nextField = type.getAddressField("_next"); klassesField = new MetadataField(type.getAddressField("_klasses"), 0); isUnsafeAnonymousField = new CIntField(type.getCIntegerField("_is_unsafe_anonymous"), 0); dictionaryField = type.getAddressField("_dictionary"); } - private static AddressField classLoaderField; + private static long classLoaderFieldOffset; private static AddressField nextField; private static MetadataField klassesField; private static CIntField isUnsafeAnonymousField; @@ -72,13 +71,9 @@ public class ClassLoaderData extends VMObject { } public Oop getClassLoader() { - Address handle = classLoaderField.getValue(getAddress()); - if (handle != null) { - // Load through the handle - OopHandle refs = handle.getOopHandleAt(0); - return (Instance)VM.getVM().getObjectHeap().newOop(refs); - } - return null; + Address addr = getAddress().addOffsetTo(classLoaderFieldOffset); + VMOopHandle vmOopHandle = VMObjectFactory.newObject(VMOopHandle.class, addr); + return vmOopHandle.resolve(); } public boolean getisUnsafeAnonymous() { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java index c240b53bd6c..1a4a8e0dc4d 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java @@ -83,6 +83,10 @@ public abstract class CollectedHeap extends VMObject { return handle.getOopHandleAt(offset); } + public OopHandle oop_load_in_native(Address addr) { + return addr.getOopHandleAt(0); + } + public void print() { printOn(System.out); } public void printOn(PrintStream tty) { MemRegion mr = reservedRegion(); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java index 321d8b24bc2..46aef865dff 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java @@ -80,11 +80,9 @@ public class ZCollectedHeap extends CollectedHeap { return heap().used(); } - public OopHandle oop_load_at(OopHandle handle, long offset) { - assert(!VM.getVM().isCompressedOopsEnabled()); - Address oopAddress = handle.getAddressAt(offset); + private OopHandle oop_load_barrier(Address oopAddress) { oopAddress = ZBarrier.weak_barrier(oopAddress); if (oopAddress == null) { return null; @@ -93,6 +91,23 @@ public class ZCollectedHeap extends CollectedHeap { return oopAddress.addOffsetToAsOopHandle(0); } + @Override + public OopHandle oop_load_at(OopHandle handle, long offset) { + assert(!VM.getVM().isCompressedOopsEnabled()); + + Address oopAddress = handle.getAddressAt(offset); + + return oop_load_barrier(oopAddress); + } + + // addr can be either in heap or in native + @Override + public OopHandle oop_load_in_native(Address addr) { + Address oopAddress = addr.getAddressAt(0); + + return oop_load_barrier(oopAddress); + } + public String oopAddressDescription(OopHandle handle) { Address origOop = ZOop.to_address(handle); Address loadBarrieredOop = ZBarrier.weak_barrier(origOop); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Klass.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Klass.java index 81210e97f54..7740278cb08 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Klass.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Klass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -51,7 +51,7 @@ public class Klass extends Metadata implements ClassConstants { private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { Type type = db.lookupType("Klass"); - javaMirror = type.getAddressField("_java_mirror"); + javaMirrorFieldOffset = type.getField("_java_mirror").getOffset(); superField = new MetadataField(type.getAddressField("_super"), 0); layoutHelper = new IntField(type.getJIntField("_layout_helper"), 0); name = type.getAddressField("_name"); @@ -89,7 +89,7 @@ public class Klass extends Metadata implements ClassConstants { public boolean isArrayKlass() { return false; } // Fields - private static AddressField javaMirror; + private static long javaMirrorFieldOffset; private static MetadataField superField; private static IntField layoutHelper; private static AddressField name; @@ -101,23 +101,15 @@ public class Klass extends Metadata implements ClassConstants { private static CIntField vtableLen; private static AddressField classLoaderData; - private Address getValue(AddressField field) { - return addr.getAddressAt(field.getOffset()); - } - protected Symbol getSymbol(AddressField field) { return Symbol.create(addr.getAddressAt(field.getOffset())); } // Accessors for declared fields public Instance getJavaMirror() { - Address handle = javaMirror.getValue(getAddress()); - if (handle != null) { - // Load through the handle - OopHandle refs = handle.getOopHandleAt(0); - return (Instance)VM.getVM().getObjectHeap().newOop(refs); - } - return null; + Address addr = getAddress().addOffsetTo(javaMirrorFieldOffset); + VMOopHandle vmOopHandle = VMObjectFactory.newObject(VMOopHandle.class, addr); + return vmOopHandle.resolve(); } public Klass getSuper() { return (Klass) superField.getValue(this); } public Klass getJavaSuper() { return null; } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/VMOopHandle.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/VMOopHandle.java new file mode 100644 index 00000000000..56ae46df6c0 --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/VMOopHandle.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2019, 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 sun.jvm.hotspot.oops; + +import sun.jvm.hotspot.debugger.Address; +import sun.jvm.hotspot.debugger.OopHandle; +import sun.jvm.hotspot.runtime.VM; +import sun.jvm.hotspot.runtime.VMObject; +import sun.jvm.hotspot.types.AddressField; +import sun.jvm.hotspot.types.Type; +import sun.jvm.hotspot.types.TypeDataBase; + +public class VMOopHandle extends VMObject { + private static AddressField objField; + + static { + VM.registerVMInitializedObserver((o, d) -> initialize(VM.getVM().getTypeDataBase())); + } + + private static synchronized void initialize(TypeDataBase db) { + Type type = db.lookupType("OopHandle"); + + objField = type.getAddressField("_obj"); + } + + public VMOopHandle(Address addr) { + super(addr); + } + + public Address getObj() { + return objField.getValue(addr); + } + + public Instance resolve() { + Address handle = getObj(); + if (handle != null) { + // Load through the handle + OopHandle refs = VM.getVM().getUniverse().heap().oop_load_in_native(handle); + return (Instance)VM.getVM().getObjectHeap().newOop(refs); + } + return null; + } +} From fc881dd8fe9ca5597e1653a16c503949381c2b8c Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 19 Feb 2019 10:02:54 +0100 Subject: [PATCH 008/109] 8218743: SA: Add support for large bitmaps Reviewed-by: eosterlund, jgeorge --- .../jvm/hotspot/gc/shared/CollectedHeap.java | 6 ++ .../hotspot/utilities/BitMapInterface.java | 32 ++++++ .../hotspot/utilities/BitMapSegmented.java | 99 +++++++++++++++++++ .../sun/jvm/hotspot/utilities/MarkBits.java | 25 ++--- 4 files changed, 143 insertions(+), 19 deletions(-) create mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/BitMapInterface.java create mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/BitMapSegmented.java diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java index 1a4a8e0dc4d..ac3ba6c0f95 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java @@ -31,6 +31,8 @@ import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.memory.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.BitMapInterface; +import sun.jvm.hotspot.utilities.BitMapSegmented; public abstract class CollectedHeap extends VMObject { private static long reservedFieldOffset; @@ -93,4 +95,8 @@ public abstract class CollectedHeap extends VMObject { tty.println("unknown subtype of CollectedHeap @ " + getAddress() + " (" + mr.start() + "," + mr.end() + ")"); } + + public BitMapInterface createBitMap(long bits) { + return new BitMapSegmented(bits); + } } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/BitMapInterface.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/BitMapInterface.java new file mode 100644 index 00000000000..109c737e1bb --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/BitMapInterface.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2019, 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 sun.jvm.hotspot.utilities; + +/** Minimal bitmap interface to support bitmaps spanning more than Integer.MAX_VALUE bits. */ +public interface BitMapInterface { + public boolean at(long offset); + public void atPut(long offset, boolean value); + public void clear(); +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/BitMapSegmented.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/BitMapSegmented.java new file mode 100644 index 00000000000..765709e7820 --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/BitMapSegmented.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2019, 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 sun.jvm.hotspot.utilities; + +/** A BitMap implementing the BitMapInterface. */ +public class BitMapSegmented implements BitMapInterface { + private static final int SegmentSizeBits = 30; + private static final int SegmentSize = 1 << (SegmentSizeBits - 1); + + public BitMapSegmented(long sizeInBits) { + this.size = sizeInBits; + + if (sizeInBits == 0) { + segmentBitMaps = new BitMap[0]; + return; + } + + int lastSegmentSize = (int)(sizeInBits % SegmentSize); + + int segments = segmentIndex(sizeInBits - 1) + 1; + int completeSegments = segments - ((lastSegmentSize != 0) ? 1 : 0); + + segmentBitMaps = new BitMap[segments]; + + for (int i = 0; i < completeSegments; i++) { + segmentBitMaps[i] = new BitMap(SegmentSize); + } + + if (lastSegmentSize != 0) { + segmentBitMaps[completeSegments] = new BitMap(lastSegmentSize); + } + } + + public long size() { + return size; + } + + // Accessors + public boolean at(long offset) { + assert offset < size; + + int segmentIndex = segmentIndex(offset); + int segmentOffset = segmentOffset(offset); + return segmentBitMaps[segmentIndex].at(segmentOffset); + } + + public void atPut(long offset, boolean value) { + assert offset < size; + + int segmentIndex = segmentIndex(offset); + int segmentOffset = segmentOffset(offset); + segmentBitMaps[segmentIndex].atPut(segmentOffset, value); + } + + public void clear() { + for (BitMap map : segmentBitMaps) { + map.clear(); + } + } + + //---------------------------------------------------------------------- + // Internals only below this point + // + private final long size; // in bits + private final BitMap[] segmentBitMaps; + + private int segmentIndex(long offset) { + long longIndex = offset / SegmentSize; + + assert longIndex < Integer.MAX_VALUE; + return (int)longIndex; + } + + private int segmentOffset(long offset) { + return (int)(offset % SegmentSize); + } +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/MarkBits.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/MarkBits.java index 5b247573749..a3c52ad316a 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/MarkBits.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/MarkBits.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -41,8 +41,7 @@ public class MarkBits { start = reserved.start(); end = reserved.end(); long numOopHandles = end.minus(start) / VM.getVM().getOopSize(); - // FIXME: will have trouble with larger heap sizes - bits = new BitMap((int) numOopHandles); + bits = heap.createBitMap(numOopHandles); } public void clear() { @@ -60,34 +59,22 @@ public class MarkBits { } OopHandle handle = obj.getHandle(); - // FIXME: will have trouble with larger heap sizes long idx = handle.minus(start) / VM.getVM().getOopSize(); - if ((idx < 0) || (idx >= bits.size())) { - System.err.println("MarkBits: WARNING: object " + handle + " outside of heap, ignoring"); - return false; - } - int intIdx = (int) idx; - if (bits.at(intIdx)) { + if (bits.at(idx)) { return false; // already marked } - bits.atPut(intIdx, true); + bits.atPut(idx, true); return true; } /** Forces clearing of a given mark bit. */ public void clear(Oop obj) { OopHandle handle = obj.getHandle(); - // FIXME: will have trouble with larger heap sizes long idx = handle.minus(start) / VM.getVM().getOopSize(); - if ((idx < 0) || (idx >= bits.size())) { - System.err.println("MarkBits: WARNING: object " + handle + " outside of heap, ignoring"); - return; - } - int intIdx = (int) idx; - bits.atPut(intIdx, false); + bits.atPut(idx, false); } - private BitMap bits; + private BitMapInterface bits; private Address start; private Address end; } From a5ec26c6817f1c979f40a3a21f50254af618175b Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 19 Feb 2019 10:03:29 +0100 Subject: [PATCH 009/109] 8218746: SA: Implement discontiguous bitmap for ZGC Reviewed-by: eosterlund, jgeorge --- .../sun/jvm/hotspot/gc/z/ZCollectedHeap.java | 7 ++ .../sun/jvm/hotspot/gc/z/ZExternalBitMap.java | 111 ++++++++++++++++++ .../classes/sun/jvm/hotspot/gc/z/ZPage.java | 8 +- 3 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZExternalBitMap.java diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java index 46aef865dff..dc7e443c4f2 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java @@ -34,6 +34,7 @@ import sun.jvm.hotspot.runtime.VM; import sun.jvm.hotspot.runtime.VMObjectFactory; import sun.jvm.hotspot.types.Type; import sun.jvm.hotspot.types.TypeDataBase; +import sun.jvm.hotspot.utilities.BitMapInterface; // Mirror class for ZCollectedHeap. @@ -117,4 +118,10 @@ public class ZCollectedHeap extends CollectedHeap { return handle.toString(); } } + + @Override + public BitMapInterface createBitMap(long size) { + // Ignores the size + return new ZExternalBitMap(this); + } } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZExternalBitMap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZExternalBitMap.java new file mode 100644 index 00000000000..c0d11d86958 --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZExternalBitMap.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2019, 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 sun.jvm.hotspot.gc.z; + +import java.util.HashMap; + +import sun.jvm.hotspot.runtime.VM; +import sun.jvm.hotspot.utilities.BitMap; +import sun.jvm.hotspot.utilities.BitMapInterface; + +/** Discontiguous bitmap for ZGC. */ +public class ZExternalBitMap implements BitMapInterface { + private ZPageTable pageTable; + private final long oopSize; + + private HashMap pageToBitMap = new HashMap(); + + public ZExternalBitMap(ZCollectedHeap collectedHeap) { + pageTable = collectedHeap.heap().pageTable(); + oopSize = VM.getVM().getOopSize(); + } + + private ZPage getPage(long zOffset) { + if (zOffset > ZGlobals.ZAddressOffsetMask) { + throw new RuntimeException("Not a Z offset: " + zOffset); + } + + ZPage page = pageTable.get(ZOop.to_address(zOffset)); + if (page == null) { + throw new RuntimeException("Address not in pageTable: " + zOffset); + } + return page; + } + + private BitMap getOrAddBitMap(ZPage page) { + BitMap bitMap = pageToBitMap.get(page); + if (bitMap == null) { + long size = page.size(); + + long maxNumObjects = size >>> page.object_alignment_shift(); + if (maxNumObjects > Integer.MAX_VALUE) { + throw new RuntimeException("int overflow"); + } + int intMaxNumObjects = (int)maxNumObjects; + + bitMap = new BitMap(intMaxNumObjects); + pageToBitMap.put(page, bitMap); + } + + return bitMap; + } + + private int pageLocalBitMapIndex(ZPage page, long zOffset) { + long pageLocalZOffset = zOffset - page.start(); + return (int)(pageLocalZOffset >>> page.object_alignment_shift()); + } + + private long convertToZOffset(long offset) { + long addr = ZGlobals.ZAddressSpaceStart + oopSize * offset; + return addr & ZGlobals.ZAddressOffsetMask; + } + + @Override + public boolean at(long offset) { + long zOffset = convertToZOffset(offset); + ZPage page = getPage(zOffset); + BitMap bitMap = getOrAddBitMap(page); + int index = pageLocalBitMapIndex(page, zOffset); + + return bitMap.at(index); + } + + @Override + public void atPut(long offset, boolean value) { + long zOffset = convertToZOffset(offset); + ZPage page = getPage(zOffset); + BitMap bitMap = getOrAddBitMap(page); + int index = pageLocalBitMapIndex(page, zOffset); + + bitMap.atPut(index, value); + } + + @Override + public void clear() { + for (BitMap bitMap : pageToBitMap.values()) { + bitMap.clear(); + } + } +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPage.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPage.java index 806b1d66774..82ef313ca3e 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPage.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,10 +65,14 @@ public class ZPage extends VMObject { return (ZForwardingTable)VMObjectFactory.newObject(ZForwardingTable.class, addr.addOffsetTo(forwardingFieldOffset)); } - private long start() { + long start() { return virtual().start(); } + long size() { + return virtual().end() - virtual().start(); + } + Address forward_object(Address from) { // Lookup address in forwarding table long from_offset = ZAddress.offset(from); From f9dfc701c8a80d814635fb8a22982da9a4f9d696 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 19 Feb 2019 10:03:41 +0100 Subject: [PATCH 010/109] 8219003: SA: Refactor live regions iteration in preparation for JDK-8218922 Reviewed-by: eosterlund, ysuenaga --- .../gc/cms/CompactibleFreeListSpace.java | 15 ++-- .../gc/cms/ConcurrentMarkSweepGeneration.java | 5 +- .../jvm/hotspot/gc/epsilon/EpsilonHeap.java | 5 ++ .../jvm/hotspot/gc/g1/G1CollectedHeap.java | 14 ++- .../sun/jvm/hotspot/gc/g1/HeapRegion.java | 9 +- .../hotspot/gc/parallel/ImmutableSpace.java | 4 +- .../jvm/hotspot/gc/parallel/MutableSpace.java | 6 +- .../gc/parallel/ParallelScavengeHeap.java | 32 ++++++- .../hotspot/gc/serial/DefNewGeneration.java | 7 +- .../hotspot/gc/serial/TenuredGeneration.java | 6 +- .../jvm/hotspot/gc/shared/CollectedHeap.java | 3 + .../hotspot/gc/shared/ContiguousSpace.java | 8 +- .../hotspot/gc/shared/GenCollectedHeap.java | 11 ++- .../sun/jvm/hotspot/gc/shared/Generation.java | 3 +- .../hotspot/gc/shared/GenerationFactory.java | 4 +- .../hotspot/gc/shared/LiveRegionsClosure.java | 29 ++++++ .../gc/shared/LiveRegionsProvider.java | 33 +++++++ .../sun/jvm/hotspot/gc/shared/Space.java | 5 +- .../hotspot/gc/shenandoah/ShenandoahHeap.java | 7 ++ .../sun/jvm/hotspot/gc/z/ZCollectedHeap.java | 9 +- .../sun/jvm/hotspot/oops/ObjectHeap.java | 89 +++++-------------- 21 files changed, 205 insertions(+), 99 deletions(-) create mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/LiveRegionsClosure.java create mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/LiveRegionsProvider.java diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/CompactibleFreeListSpace.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/CompactibleFreeListSpace.java index 01034aeeb7e..0678c1b1b92 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/CompactibleFreeListSpace.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/CompactibleFreeListSpace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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,7 +35,7 @@ import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.types.*; import sun.jvm.hotspot.utilities.*; -public class CompactibleFreeListSpace extends CompactibleSpace { +public class CompactibleFreeListSpace extends CompactibleSpace implements LiveRegionsProvider { private static AddressField collectorField; private static AddressField indexedFreeListField; private static AddressField dictionaryField; @@ -93,10 +93,10 @@ public class CompactibleFreeListSpace extends CompactibleSpace { } public long used0() { - List regions = getLiveRegions(); + List regions = getLiveRegions(); long usedSize = 0L; - for (Iterator itr = regions.iterator(); itr.hasNext();) { - MemRegion mr = (MemRegion) itr.next(); + for (Iterator itr = regions.iterator(); itr.hasNext();) { + MemRegion mr = itr.next(); usedSize += mr.byteSize(); } return usedSize; @@ -154,8 +154,9 @@ public class CompactibleFreeListSpace extends CompactibleSpace { return addr; } - public List/**/ getLiveRegions() { - List res = new ArrayList(); // List + @Override + public List getLiveRegions() { + List res = new ArrayList<>(); VM vm = VM.getVM(); Debugger dbg = vm.getDebugger(); ObjectHeap heap = vm.getObjectHeap(); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/ConcurrentMarkSweepGeneration.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/ConcurrentMarkSweepGeneration.java index 86b1caad447..22a4ef40f9d 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/ConcurrentMarkSweepGeneration.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/ConcurrentMarkSweepGeneration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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,9 @@ public class ConcurrentMarkSweepGeneration extends CardGeneration { public void spaceIterate(SpaceClosure blk, boolean usedOnly) { blk.doSpace(cmsSpace()); } + public void liveRegionsIterate(LiveRegionsClosure closure) { + closure.doLiveRegions(cmsSpace()); + } public Generation.Name kind() { return Generation.Name.CONCURRENT_MARK_SWEEP; diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/epsilon/EpsilonHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/epsilon/EpsilonHeap.java index 4b6ef34caf7..7360927f783 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/epsilon/EpsilonHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/epsilon/EpsilonHeap.java @@ -80,6 +80,11 @@ public class EpsilonHeap extends CollectedHeap { return space; } + @Override + public void liveRegionsIterate(LiveRegionsClosure closure) { + closure.doLiveRegions(space()); + } + @Override public void printOn(PrintStream tty) { MemRegion mr = reservedRegion(); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java index 65e7caac7bf..0d359d7f8b3 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2019, 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 @@ -32,8 +32,9 @@ import java.util.Observer; import sun.jvm.hotspot.debugger.Address; import sun.jvm.hotspot.gc.shared.CollectedHeap; import sun.jvm.hotspot.gc.shared.CollectedHeapName; -import sun.jvm.hotspot.gc.shared.SpaceClosure; +import sun.jvm.hotspot.gc.shared.LiveRegionsClosure; import sun.jvm.hotspot.gc.shared.PrintRegionClosure; +import sun.jvm.hotspot.gc.shared.SpaceClosure; import sun.jvm.hotspot.memory.MemRegion; import sun.jvm.hotspot.runtime.VM; import sun.jvm.hotspot.runtime.VMObjectFactory; @@ -137,6 +138,15 @@ public class G1CollectedHeap extends CollectedHeap { return CollectedHeapName.G1; } + @Override + public void liveRegionsIterate(LiveRegionsClosure closure) { + Iterator iter = heapRegionIterator(); + while (iter.hasNext()) { + HeapRegion hr = iter.next(); + closure.doLiveRegions(hr); + } + } + @Override public void printOn(PrintStream tty) { MemRegion mr = reservedRegion(); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/HeapRegion.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/HeapRegion.java index 47d721386ea..126f8308038 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/HeapRegion.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/HeapRegion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2019, 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 @@ -32,6 +32,7 @@ import java.util.Observer; import sun.jvm.hotspot.debugger.Address; import sun.jvm.hotspot.debugger.OopHandle; import sun.jvm.hotspot.gc.shared.CompactibleSpace; +import sun.jvm.hotspot.gc.shared.LiveRegionsProvider; import sun.jvm.hotspot.memory.MemRegion; import sun.jvm.hotspot.runtime.VM; import sun.jvm.hotspot.runtime.VMObjectFactory; @@ -43,7 +44,7 @@ import sun.jvm.hotspot.types.TypeDataBase; // Mirror class for HeapRegion. Currently we don't actually include // any of its fields but only iterate over it. -public class HeapRegion extends CompactibleSpace { +public class HeapRegion extends CompactibleSpace implements LiveRegionsProvider { // static int GrainBytes; static private CIntegerField grainBytesField; static private AddressField topField; @@ -86,8 +87,8 @@ public class HeapRegion extends CompactibleSpace { } @Override - public List getLiveRegions() { - List res = new ArrayList(); + public List getLiveRegions() { + List res = new ArrayList<>(); res.add(new MemRegion(bottom(), top())); return res; } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ImmutableSpace.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ImmutableSpace.java index 61a3b749c34..831e13d6661 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ImmutableSpace.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ImmutableSpace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -73,7 +73,7 @@ public abstract class ImmutableSpace extends VMObject { } /** returns all MemRegions where live objects are */ - public abstract List/**/ getLiveRegions(); + public abstract List getLiveRegions(); /** Returned value is in bytes */ public long capacity() { return end().minus(bottom()); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/MutableSpace.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/MutableSpace.java index 7a6aa3914ad..540fc981d7b 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/MutableSpace.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/MutableSpace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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,8 +62,8 @@ public class MutableSpace extends ImmutableSpace { } /** returns all MemRegions where live objects are */ - public List/**/ getLiveRegions() { - List res = new ArrayList(); + public List getLiveRegions() { + List res = new ArrayList<>(); res.add(new MemRegion(bottom(), top())); return res; } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java index 220fe9d3a41..93b62112359 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ import java.util.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.gc.shared.*; +import sun.jvm.hotspot.memory.MemRegion; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.types.*; @@ -88,6 +89,35 @@ public class ParallelScavengeHeap extends CollectedHeap { return CollectedHeapName.PARALLEL; } + // Simple wrapper to provide toString() usable for debugging. + private class LiveRegionProviderImpl implements LiveRegionsProvider { + private String name; + private MutableSpace space; + + public LiveRegionProviderImpl(String name, MutableSpace space) { + this.name = name; + this.space = space; + } + + @Override + public List getLiveRegions() { + return space.getLiveRegions(); + } + @Override + public String toString() { + return name; + } + } + + public void liveRegionsIterate(LiveRegionsClosure closure) { + // Add eden space + closure.doLiveRegions(new LiveRegionProviderImpl("eden", youngGen().edenSpace())); + // Add from-space but not to-space + closure.doLiveRegions(new LiveRegionProviderImpl("from", youngGen().fromSpace())); + + closure.doLiveRegions(new LiveRegionProviderImpl("old ", oldGen().objectSpace())); + } + public void printOn(PrintStream tty) { tty.print("ParallelScavengeHeap [ "); youngGen().printOn(tty); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/DefNewGeneration.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/DefNewGeneration.java index 620c2d76cdf..8fbe0f93c9f 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/DefNewGeneration.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/DefNewGeneration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -94,6 +94,11 @@ public class DefNewGeneration extends Generation { } } + public void liveRegionsIterate(LiveRegionsClosure closure) { + closure.doLiveRegions(eden()); + closure.doLiveRegions(from()); + } + public void printOn(PrintStream tty) { tty.print(" eden"); eden().printOn(tty); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java index 9a81b0774e7..18e09a01d8a 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -76,6 +76,10 @@ public class TenuredGeneration extends CardGeneration { blk.doSpace(theSpace()); } + public void liveRegionsIterate(LiveRegionsClosure closure) { + closure.doLiveRegions(theSpace()); + } + public void printOn(PrintStream tty) { tty.print(" old "); theSpace().printOn(tty); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java index ac3ba6c0f95..d27d311d39f 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java @@ -28,6 +28,7 @@ import java.io.*; import java.util.*; import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.gc.shared.*; import sun.jvm.hotspot.memory.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.types.*; @@ -77,6 +78,8 @@ public abstract class CollectedHeap extends VMObject { public abstract CollectedHeapName kind(); + public abstract void liveRegionsIterate(LiveRegionsClosure closure); + public String oopAddressDescription(OopHandle handle) { return handle.toString(); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/ContiguousSpace.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/ContiguousSpace.java index c62c47dc97c..9530d88dac6 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/ContiguousSpace.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/ContiguousSpace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -32,7 +32,7 @@ import sun.jvm.hotspot.memory.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.types.*; -public class ContiguousSpace extends CompactibleSpace { +public class ContiguousSpace extends CompactibleSpace implements LiveRegionsProvider { private static AddressField topField; static { @@ -79,8 +79,8 @@ public class ContiguousSpace extends CompactibleSpace { } /** Returns regions of Space where live objects live */ - public List/**/ getLiveRegions() { - List res = new ArrayList(); + public List getLiveRegions() { + List res = new ArrayList<>(); res.add(new MemRegion(bottom(), top())); return res; } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenCollectedHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenCollectedHeap.java index ad49d153c38..33f2452a9f1 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenCollectedHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenCollectedHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -28,6 +28,7 @@ import java.io.*; import java.util.*; import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.gc.shared.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.types.*; import sun.jvm.hotspot.utilities.*; @@ -134,6 +135,14 @@ abstract public class GenCollectedHeap extends CollectedHeap { } } + public void liveRegionsIterate(LiveRegionsClosure closure) { + // Run through all generations, obtaining bottom-top pairs. + for (int i = 0; i < nGens(); i++) { + Generation gen = getGen(i); + gen.liveRegionsIterate(closure); + } + } + public void printOn(PrintStream tty) { for (int i = 0; i < nGens(); i++) { tty.print("Gen " + i + ": "); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java index fcefa7386ed..03ca5a17b89 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Generation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -184,6 +184,7 @@ public abstract class Generation extends VMObject { /** Iteration - do not use for time critical operations */ public abstract void spaceIterate(SpaceClosure blk, boolean usedOnly); + public abstract void liveRegionsIterate(LiveRegionsClosure closure); public void print() { printOn(System.out); } public abstract void printOn(PrintStream tty); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenerationFactory.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenerationFactory.java index 5818513c330..5ae969218bd 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenerationFactory.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenerationFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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,6 +65,8 @@ public class GenerationFactory { } public void spaceIterate(SpaceClosure blk, boolean usedOnly) { } + public void liveRegionsIterate(LiveRegionsClosure closure) { + } public void printOn(java.io.PrintStream tty) { tty.println("unknown subtype of Generation @ " + getAddress() + " (" + virtualSpace().low() + "," + virtualSpace().high() + ")"); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/LiveRegionsClosure.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/LiveRegionsClosure.java new file mode 100644 index 00000000000..9b7298536e2 --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/LiveRegionsClosure.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2019, 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 sun.jvm.hotspot.gc.shared; + +public interface LiveRegionsClosure { + public void doLiveRegions(LiveRegionsProvider lrp); +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/LiveRegionsProvider.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/LiveRegionsProvider.java new file mode 100644 index 00000000000..45fcf83f4fd --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/LiveRegionsProvider.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2019, 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 sun.jvm.hotspot.gc.shared; + +import java.util.List; + +import sun.jvm.hotspot.memory.MemRegion; + +public interface LiveRegionsProvider { + public List getLiveRegions(); +} diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Space.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Space.java index 1f941e9747b..56008b2dec4 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Space.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/Space.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -89,9 +89,6 @@ public abstract class Space extends VMObject { return handle.addOffsetToAsOopHandle(size); } - /** returns all MemRegions where live objects are */ - public abstract List/**/ getLiveRegions(); - /** Returned value is in bytes */ public long capacity() { return end().minus(bottom()); } /** Returned value is in bytes */ diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java index f12a650a416..001ed51f430 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeap.java @@ -25,6 +25,7 @@ package sun.jvm.hotspot.gc.shenandoah; import sun.jvm.hotspot.gc.shared.CollectedHeap; import sun.jvm.hotspot.gc.shared.CollectedHeapName; +import sun.jvm.hotspot.gc.shared.LiveRegionsClosure; import sun.jvm.hotspot.debugger.Address; import sun.jvm.hotspot.runtime.VM; import sun.jvm.hotspot.types.Type; @@ -77,6 +78,12 @@ public class ShenandoahHeap extends CollectedHeap { return committed.getValue(addr); } + @Override + public void liveRegionsIterate(LiveRegionsClosure closure) { + // Operation (currently) not supported with Shenandoah GC. + System.err.println("Warning: Operation not supported with Shenandoah GC"); + } + @Override public void printOn(PrintStream tty) { MemRegion mr = reservedRegion(); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java index dc7e443c4f2..61d1a0a19f4 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java @@ -30,6 +30,7 @@ import sun.jvm.hotspot.debugger.Address; import sun.jvm.hotspot.debugger.OopHandle; import sun.jvm.hotspot.gc.shared.CollectedHeap; import sun.jvm.hotspot.gc.shared.CollectedHeapName; +import sun.jvm.hotspot.gc.shared.LiveRegionsClosure; import sun.jvm.hotspot.runtime.VM; import sun.jvm.hotspot.runtime.VMObjectFactory; import sun.jvm.hotspot.types.Type; @@ -39,7 +40,6 @@ import sun.jvm.hotspot.utilities.BitMapInterface; // Mirror class for ZCollectedHeap. public class ZCollectedHeap extends CollectedHeap { - private static long zHeapFieldOffset; static { @@ -119,6 +119,13 @@ public class ZCollectedHeap extends CollectedHeap { } } + @Override + public void liveRegionsIterate(LiveRegionsClosure closure) { + // Operation (currently) not supported with ZGC. Print + // a warning and leave the list of live regions empty. + System.err.println("Warning: Operation not supported with ZGC"); + } + @Override public BitMapInterface createBitMap(long size) { // Ignores the size diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java index 831f6d33285..2a96a58a6aa 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -304,87 +304,48 @@ public class ObjectHeap { visitor.epilogue(); } - private void addLiveRegions(String name, List input, List output) { - for (Iterator itr = input.iterator(); itr.hasNext();) { - MemRegion reg = (MemRegion) itr.next(); + private static class LiveRegionsCollector implements LiveRegionsClosure { + LiveRegionsCollector(List
l) { + liveRegions = l; + } + + @Override + public void doLiveRegions(LiveRegionsProvider lrp) { + for (MemRegion reg : lrp.getLiveRegions()) { Address top = reg.end(); Address bottom = reg.start(); if (Assert.ASSERTS_ENABLED) { - Assert.that(top != null, "top address in a live region should not be null"); + Assert.that(top != null, "top address in a live region should not be null"); } if (Assert.ASSERTS_ENABLED) { - Assert.that(bottom != null, "bottom address in a live region should not be null"); + Assert.that(bottom != null, "bottom address in a live region should not be null"); } - output.add(top); - output.add(bottom); + liveRegions.add(top); + liveRegions.add(bottom); if (DEBUG) { - System.err.println("Live region: " + name + ": " + bottom + ", " + top); - } - } + System.err.println("Live region: " + lrp + ": " + bottom + ", " + top); + } + } } - private class LiveRegionsCollector implements SpaceClosure { - LiveRegionsCollector(List l) { - liveRegions = l; - } - - public void doSpace(Space s) { - addLiveRegions(s.toString(), s.getLiveRegions(), liveRegions); - } - private List liveRegions; + private List
liveRegions; } // Returns a List
where the addresses come in pairs. These // designate the live regions of the heap. - private List collectLiveRegions() { + private List
collectLiveRegions() { // We want to iterate through all live portions of the heap, but // do not want to abort the heap traversal prematurely if we find // a problem (like an allocated but uninitialized object at the // top of a generation). To do this we enumerate all generations' // bottom and top regions, and factor in TLABs if necessary. - // List
. Addresses come in pairs. - List liveRegions = new ArrayList(); + // Addresses come in pairs. + List
liveRegions = new ArrayList<>(); LiveRegionsCollector lrc = new LiveRegionsCollector(liveRegions); CollectedHeap heap = VM.getVM().getUniverse().heap(); - - if (heap instanceof GenCollectedHeap) { - GenCollectedHeap genHeap = (GenCollectedHeap) heap; - // Run through all generations, obtaining bottom-top pairs. - for (int i = 0; i < genHeap.nGens(); i++) { - Generation gen = genHeap.getGen(i); - gen.spaceIterate(lrc, true); - } - } else if (heap instanceof ParallelScavengeHeap) { - ParallelScavengeHeap psh = (ParallelScavengeHeap) heap; - PSYoungGen youngGen = psh.youngGen(); - // Add eden space - addLiveRegions("eden", youngGen.edenSpace().getLiveRegions(), liveRegions); - // Add from-space but not to-space - addLiveRegions("from", youngGen.fromSpace().getLiveRegions(), liveRegions); - PSOldGen oldGen = psh.oldGen(); - addLiveRegions("old ", oldGen.objectSpace().getLiveRegions(), liveRegions); - } else if (heap instanceof G1CollectedHeap) { - G1CollectedHeap g1h = (G1CollectedHeap) heap; - g1h.heapRegionIterate(lrc); - } else if (heap instanceof ShenandoahHeap) { - // Operation (currently) not supported with Shenandoah GC. Print - // a warning and leave the list of live regions empty. - System.err.println("Warning: Operation not supported with Shenandoah GC"); - } else if (heap instanceof ZCollectedHeap) { - // Operation (currently) not supported with ZGC. Print - // a warning and leave the list of live regions empty. - System.err.println("Warning: Operation not supported with ZGC"); - } else if (heap instanceof EpsilonHeap) { - EpsilonHeap eh = (EpsilonHeap) heap; - liveRegions.add(eh.space().top()); - liveRegions.add(eh.space().bottom()); - } else { - if (Assert.ASSERTS_ENABLED) { - Assert.that(false, "Unexpected CollectedHeap type: " + heap.getClass().getName()); - } - } + heap.liveRegionsIterate(lrc); // If UseTLAB is enabled, snip out regions associated with TLABs' // dead regions. Note that TLABs can be present in any generation. @@ -440,11 +401,9 @@ public class ObjectHeap { return liveRegions; } - private void sortLiveRegions(List liveRegions) { - Collections.sort(liveRegions, new Comparator() { - public int compare(Object o1, Object o2) { - Address a1 = (Address) o1; - Address a2 = (Address) o2; + private void sortLiveRegions(List
liveRegions) { + Collections.sort(liveRegions, new Comparator
() { + public int compare(Address a1, Address a2) { if (AddressOps.lt(a1, a2)) { return -1; } else if (AddressOps.gt(a1, a2)) { From f7e7180ff4269600ba7fd08d0840d7d68688f6c7 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 19 Feb 2019 10:04:28 +0100 Subject: [PATCH 011/109] 8218922: SA: Enable best-effort implementation of live regions iteration for ZGC Reviewed-by: eosterlund, ysuenaga --- src/hotspot/share/gc/z/vmStructs_z.cpp | 3 +- src/hotspot/share/gc/z/vmStructs_z.hpp | 7 + src/hotspot/share/gc/z/zCollectedHeap.cpp | 6 +- src/hotspot/share/gc/z/zCollectedHeap.hpp | 4 +- src/hotspot/share/gc/z/zMark.cpp | 6 + .../sun/jvm/hotspot/gc/z/ZAddress.java | 4 +- .../gc/z/ZAddressRangeMapForPageTable.java | 31 +++- .../sun/jvm/hotspot/gc/z/ZCollectedHeap.java | 9 +- .../sun/jvm/hotspot/gc/z/ZExternalBitMap.java | 2 +- .../sun/jvm/hotspot/gc/z/ZGlobals.java | 8 +- .../hotspot/gc/z/ZGlobalsForVMStructs.java | 8 +- .../classes/sun/jvm/hotspot/gc/z/ZOop.java | 18 +-- .../classes/sun/jvm/hotspot/gc/z/ZPage.java | 140 +++++++++++++++++- .../sun/jvm/hotspot/gc/z/ZPageTable.java | 112 +++++++++++++- .../sun/jvm/hotspot/gc/z/ZPageTableEntry.java | 12 +- .../classes/sun/jvm/hotspot/gc/z/ZUtils.java | 43 ++++++ 16 files changed, 369 insertions(+), 44 deletions(-) create mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZUtils.java diff --git a/src/hotspot/share/gc/z/vmStructs_z.cpp b/src/hotspot/share/gc/z/vmStructs_z.cpp index 68b3880534b..12b2f364df1 100644 --- a/src/hotspot/share/gc/z/vmStructs_z.cpp +++ b/src/hotspot/share/gc/z/vmStructs_z.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -26,6 +26,7 @@ ZGlobalsForVMStructs::ZGlobalsForVMStructs() : _ZGlobalPhase(&ZGlobalPhase), + _ZGlobalSeqNum(&ZGlobalSeqNum), _ZAddressGoodMask(&ZAddressGoodMask), _ZAddressBadMask(&ZAddressBadMask), _ZAddressWeakBadMask(&ZAddressWeakBadMask), diff --git a/src/hotspot/share/gc/z/vmStructs_z.hpp b/src/hotspot/share/gc/z/vmStructs_z.hpp index 498ff173969..fb8fb8992a5 100644 --- a/src/hotspot/share/gc/z/vmStructs_z.hpp +++ b/src/hotspot/share/gc/z/vmStructs_z.hpp @@ -42,6 +42,8 @@ public: uint32_t* _ZGlobalPhase; + uint32_t* _ZGlobalSeqNum; + uintptr_t* _ZAddressGoodMask; uintptr_t* _ZAddressBadMask; uintptr_t* _ZAddressWeakBadMask; @@ -55,6 +57,7 @@ typedef ZAddressRangeMap ZAddressRangeMapFor #define VM_STRUCTS_ZGC(nonstatic_field, volatile_nonstatic_field, static_field) \ static_field(ZGlobalsForVMStructs, _instance_p, ZGlobalsForVMStructs*) \ nonstatic_field(ZGlobalsForVMStructs, _ZGlobalPhase, uint32_t*) \ + nonstatic_field(ZGlobalsForVMStructs, _ZGlobalSeqNum, uint32_t*) \ nonstatic_field(ZGlobalsForVMStructs, _ZAddressGoodMask, uintptr_t*) \ nonstatic_field(ZGlobalsForVMStructs, _ZAddressBadMask, uintptr_t*) \ nonstatic_field(ZGlobalsForVMStructs, _ZAddressWeakBadMask, uintptr_t*) \ @@ -67,7 +70,10 @@ typedef ZAddressRangeMap ZAddressRangeMapFor nonstatic_field(ZHeap, _pagetable, ZPageTable) \ \ nonstatic_field(ZPage, _type, const uint8_t) \ + nonstatic_field(ZPage, _seqnum, uint32_t) \ nonstatic_field(ZPage, _virtual, const ZVirtualMemory) \ + volatile_nonstatic_field(ZPage, _top, uintptr_t) \ + volatile_nonstatic_field(ZPage, _refcount, uint32_t) \ nonstatic_field(ZPage, _forwarding, ZForwardingTable) \ \ nonstatic_field(ZPageAllocator, _physical, ZPhysicalMemoryManager) \ @@ -101,6 +107,7 @@ typedef ZAddressRangeMap ZAddressRangeMapFor declare_constant(ZAddressOffsetShift) \ declare_constant(ZAddressOffsetBits) \ declare_constant(ZAddressOffsetMask) \ + declare_constant(ZAddressOffsetMax) \ declare_constant(ZAddressSpaceStart) #define VM_TYPES_ZGC(declare_type, declare_toplevel_type, declare_integer_type) \ diff --git a/src/hotspot/share/gc/z/zCollectedHeap.cpp b/src/hotspot/share/gc/z/zCollectedHeap.cpp index 5f1277387a9..8457ca53a14 100644 --- a/src/hotspot/share/gc/z/zCollectedHeap.cpp +++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, 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 @@ -118,10 +118,6 @@ bool ZCollectedHeap::is_in_closed_subset(const void* p) const { return is_in(p); } -void ZCollectedHeap::fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap) { - // Does nothing, not a parsable heap -} - HeapWord* ZCollectedHeap::allocate_new_tlab(size_t min_size, size_t requested_size, size_t* actual_size) { const size_t size_in_bytes = ZUtils::words_to_bytes(align_object_size(requested_size)); const uintptr_t addr = _heap.alloc_tlab(size_in_bytes); diff --git a/src/hotspot/share/gc/z/zCollectedHeap.hpp b/src/hotspot/share/gc/z/zCollectedHeap.hpp index 0ada2f32ac0..02dd3d309a0 100644 --- a/src/hotspot/share/gc/z/zCollectedHeap.hpp +++ b/src/hotspot/share/gc/z/zCollectedHeap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, 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,8 +75,6 @@ public: virtual bool is_in(const void* p) const; virtual bool is_in_closed_subset(const void* p) const; - virtual void fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap); - virtual HeapWord* mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded); virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data, size_t size, diff --git a/src/hotspot/share/gc/z/zMark.cpp b/src/hotspot/share/gc/z/zMark.cpp index 101fdc65681..861e74608c3 100644 --- a/src/hotspot/share/gc/z/zMark.cpp +++ b/src/hotspot/share/gc/z/zMark.cpp @@ -119,6 +119,11 @@ void ZMark::prepare_mark() { } class ZMarkRootsIteratorClosure : public ZRootsIteratorClosure { +private: + static void fixup_address(HeapWord** p) { + *p = (HeapWord*)ZAddress::good_or_null((uintptr_t)*p); + } + public: ZMarkRootsIteratorClosure() { ZStatTLAB::reset(); @@ -136,6 +141,7 @@ public: // Retire TLAB if (UseTLAB && thread->is_Java_thread()) { + thread->tlab().addresses_do(fixup_address); thread->tlab().retire(ZStatTLAB::get()); thread->tlab().resize(); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddress.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddress.java index b9ff2a1301e..31e158b0dd5 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddress.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -61,7 +61,7 @@ class ZAddress { value |= ZGlobals.ZAddressSpaceStart; } - return ZOop.to_address(value); + return ZUtils.longToAddress(value); } static Address good(Address value) { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddressRangeMapForPageTable.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddressRangeMapForPageTable.java index 3d2d2c90869..62224d641c2 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddressRangeMapForPageTable.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZAddressRangeMapForPageTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -54,15 +54,38 @@ public class ZAddressRangeMapForPageTable extends VMObject { return mapField.getValue(addr); } + public long size() { + return ZGlobals.ZAddressOffsetMax >> AddressRangeShift; + } + private long index_for_addr(Address addr) { long index = ZAddress.offset(addr) >> AddressRangeShift; return index; } - Address get(Address addr) { - long index = index_for_addr(addr); - + Address at(long index) { return map().getAddressAt(index * VM.getVM().getBytesPerLong()); } + + Address get(Address addr) { + long index = index_for_addr(addr); + return at(index); + } + + public class Iterator { + private long next = 0; + + boolean hasNext() { + return next < size(); + } + + Address next() { + if (next >= size()) { + throw new RuntimeException("OOIBE"); + } + + return at(next++); + } + } } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java index 61d1a0a19f4..e54da112312 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZCollectedHeap.java @@ -25,6 +25,7 @@ package sun.jvm.hotspot.gc.z; import java.io.PrintStream; +import java.util.Iterator; import sun.jvm.hotspot.debugger.Address; import sun.jvm.hotspot.debugger.OopHandle; @@ -121,9 +122,11 @@ public class ZCollectedHeap extends CollectedHeap { @Override public void liveRegionsIterate(LiveRegionsClosure closure) { - // Operation (currently) not supported with ZGC. Print - // a warning and leave the list of live regions empty. - System.err.println("Warning: Operation not supported with ZGC"); + Iterator iter = heap().pageTable().activePagesIterator(); + while (iter.hasNext()) { + ZPage page = iter.next(); + closure.doLiveRegions(page); + } } @Override diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZExternalBitMap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZExternalBitMap.java index c0d11d86958..842221b80e0 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZExternalBitMap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZExternalBitMap.java @@ -47,7 +47,7 @@ public class ZExternalBitMap implements BitMapInterface { throw new RuntimeException("Not a Z offset: " + zOffset); } - ZPage page = pageTable.get(ZOop.to_address(zOffset)); + ZPage page = pageTable.get(ZUtils.longToAddress(zOffset)); if (page == null) { throw new RuntimeException("Address not in pageTable: " + zOffset); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobals.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobals.java index 174e7a62553..86ffb5f91c0 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobals.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobals.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -54,6 +54,7 @@ public class ZGlobals { // Pointer part of address public static long ZAddressOffsetBits; public static long ZAddressOffsetMask; + public static long ZAddressOffsetMax; // Address space start/end/size public static long ZAddressSpaceStart; @@ -84,6 +85,7 @@ public class ZGlobals { ZAddressOffsetBits = db.lookupLongConstant("ZAddressOffsetBits").longValue(); ZAddressOffsetMask = db.lookupLongConstant("ZAddressOffsetMask").longValue(); + ZAddressOffsetMax = db.lookupLongConstant("ZAddressOffsetMax").longValue(); ZAddressSpaceStart = db.lookupLongConstant("ZAddressSpaceStart").longValue(); } @@ -96,6 +98,10 @@ public class ZGlobals { return instance().ZGlobalPhase(); } + public static int ZGlobalSeqNum() { + return instance().ZGlobalSeqNum(); + } + public static long ZAddressGoodMask() { return instance().ZAddressGoodMask(); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobalsForVMStructs.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobalsForVMStructs.java index a6bfb3a33c2..a8cb54a1aa9 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobalsForVMStructs.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZGlobalsForVMStructs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -33,6 +33,7 @@ import sun.jvm.hotspot.types.TypeDataBase; class ZGlobalsForVMStructs extends VMObject { private static AddressField ZGlobalPhaseField; + private static AddressField ZGlobalSeqNumField; private static AddressField ZAddressGoodMaskField; private static AddressField ZAddressBadMaskField; private static AddressField ZAddressWeakBadMaskField; @@ -47,6 +48,7 @@ class ZGlobalsForVMStructs extends VMObject { Type type = db.lookupType("ZGlobalsForVMStructs"); ZGlobalPhaseField = type.getAddressField("_ZGlobalPhase"); + ZGlobalSeqNumField = type.getAddressField("_ZGlobalSeqNum"); ZAddressGoodMaskField = type.getAddressField("_ZAddressGoodMask"); ZAddressBadMaskField = type.getAddressField("_ZAddressBadMask"); ZAddressWeakBadMaskField = type.getAddressField("_ZAddressWeakBadMask"); @@ -62,6 +64,10 @@ class ZGlobalsForVMStructs extends VMObject { return ZGlobalPhaseField.getValue(addr).getJIntAt(0); } + int ZGlobalSeqNum() { + return ZGlobalSeqNumField.getValue(addr).getJIntAt(0); + } + long ZAddressGoodMask() { return ZAddressGoodMaskField.getValue(addr).getJLongAt(0); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZOop.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZOop.java index 20d8e0decbc..3c922d953d9 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZOop.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZOop.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -26,23 +26,9 @@ package sun.jvm.hotspot.gc.z; import sun.jvm.hotspot.debugger.Address; import sun.jvm.hotspot.debugger.OopHandle; -import sun.jvm.hotspot.runtime.VM; class ZOop { - private static final long MSB = ~0L ^ (~0L >>> 1); - - private static Address msbAddress() { - return VM.getVM().getUniverse().heap().start().orWithMask(MSB).andWithMask(MSB); - } - - static Address to_address(long value) { - // If the value of an Address becomes 0, null is returned instead of an Address. - // Start with a one-bit address and as a last step, remove that bit. - Address oneAddress = msbAddress(); - return oneAddress.orWithMask(value).xorWithMask(ZAddress.as_long(oneAddress)); - } - static Address to_address(OopHandle oop) { - return to_address(ZAddress.as_long(oop)); + return ZUtils.longToAddress(ZAddress.as_long(oop)); } } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPage.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPage.java index 82ef313ca3e..79f48aeef5b 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPage.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPage.java @@ -24,17 +24,29 @@ package sun.jvm.hotspot.gc.z; +import java.util.ArrayList; +import java.util.List; + import sun.jvm.hotspot.debugger.Address; +import sun.jvm.hotspot.debugger.OopHandle; +import sun.jvm.hotspot.gc.shared.LiveRegionsProvider; +import sun.jvm.hotspot.memory.MemRegion; +import sun.jvm.hotspot.oops.Oop; +import sun.jvm.hotspot.oops.UnknownOopException; import sun.jvm.hotspot.runtime.VM; import sun.jvm.hotspot.runtime.VMObject; import sun.jvm.hotspot.runtime.VMObjectFactory; +import sun.jvm.hotspot.types.AddressField; import sun.jvm.hotspot.types.CIntegerField; import sun.jvm.hotspot.types.Type; import sun.jvm.hotspot.types.TypeDataBase; -public class ZPage extends VMObject { +public class ZPage extends VMObject implements LiveRegionsProvider { private static CIntegerField typeField; + private static CIntegerField seqnumField; private static long virtualFieldOffset; + private static AddressField topField; + private static CIntegerField refcountField; private static long forwardingFieldOffset; static { @@ -45,7 +57,10 @@ public class ZPage extends VMObject { Type type = db.lookupType("ZPage"); typeField = type.getCIntegerField("_type"); + seqnumField = type.getCIntegerField("_seqnum"); virtualFieldOffset = type.getField("_virtual").getOffset(); + topField = type.getAddressField("_top"); + refcountField = type.getCIntegerField("_refcount"); forwardingFieldOffset = type.getField("_forwarding").getOffset(); } @@ -57,12 +72,40 @@ public class ZPage extends VMObject { return typeField.getJByte(addr); } + private int seqnum() { + return seqnumField.getJInt(addr); + } + private ZVirtualMemory virtual() { - return (ZVirtualMemory)VMObjectFactory.newObject(ZVirtualMemory.class, addr.addOffsetTo(virtualFieldOffset)); + return VMObjectFactory.newObject(ZVirtualMemory.class, addr.addOffsetTo(virtualFieldOffset)); + } + + private Address top() { + return topField.getValue(addr); + } + + private int refcount() { + // refcount is uint32_t so need to be cautious when using this field. + return refcountField.getJInt(addr); } private ZForwardingTable forwarding() { - return (ZForwardingTable)VMObjectFactory.newObject(ZForwardingTable.class, addr.addOffsetTo(forwardingFieldOffset)); + return VMObjectFactory.newObject(ZForwardingTable.class, addr.addOffsetTo(forwardingFieldOffset)); + } + + private boolean is_forwarding() { + return forwarding().table() != null; + } + + private boolean is_relocatable() { + return is_active() && seqnum() < ZGlobals.ZGlobalSeqNum(); + } + + private boolean isPageRelocating() { + assert(is_active()); + // is_forwarding(): Has a (relocation) forwarding table + // is_relocatable(): Has not been freed yet + return is_forwarding() && is_relocatable(); } long start() { @@ -98,7 +141,6 @@ public class ZPage extends VMObject { return ZAddress.good(from); } - long object_alignment_shift() { if (type() == ZGlobals.ZPageTypeSmall) { return ZGlobals.ZObjectAlignmentSmallShift(); @@ -109,4 +151,94 @@ public class ZPage extends VMObject { return ZGlobals.ZObjectAlignmentLargeShift; } } + + long objectAlignmentSize() { + return 1 << object_alignment_shift(); + } + + public boolean is_active() { + return refcount() != 0; + } + + private long getObjectSize(Address good) { + OopHandle handle = good.addOffsetToAsOopHandle(0); + Oop obj = null; + + try { + obj = VM.getVM().getObjectHeap().newOop(handle); + } catch (UnknownOopException exp) { + throw new RuntimeException(" UnknownOopException " + exp); + } + + return VM.getVM().alignUp(obj.getObjectSize(), objectAlignmentSize()); + } + + private void addNotRelocatedRegions(List regions) { + MemRegion mr = null; + + // Some objects have already been forwarded to new locations. + long topValue = top().asLongValue(); + for (long offsetValue = start(); offsetValue < topValue;) { + Address from = ZAddress.good(ZUtils.longToAddress(offsetValue)); + + Address to = relocate_object(from); + + long byteSize; + try { + byteSize = getObjectSize(to); + } catch (Exception e) { + // Parsing the ZHeap is inherently unsafe + // when classes have been unloaded. Dead objects + // might have stale Klass pointers, and there's + // no way to get the size of the dead object. + // + // If possible, run with -XX:-ClassUnloading + // to ensure that all Klasses are kept alive. + System.err.println("Unparsable regions found. Skipping: " + + from + + " " + + from.addOffsetTo(topValue - offsetValue)); + + // Can't proceed further. Just return the collected regions. + return; + } + + if (from.equals(to)) { + // Not relocated - add region + if (mr == null) { + mr = new MemRegion(from, 0 /* wordSize */); + regions.add(mr); + } + + long wordSize = byteSize / VM.getVM().getBytesPerWord(); + mr.setWordSize(mr.wordSize() + wordSize); + } else { + // Forwarded somewhere else, split region. + mr = null; + } + + offsetValue += byteSize; + } + } + + public List getLiveRegions() { + List res = new ArrayList<>(); + + if (isPageRelocating()) { + addNotRelocatedRegions(res); + } else { + Address start = ZAddress.good(ZUtils.longToAddress(start())); + + // Can't convert top() to a "good" address because it might + // be at the top of the "offset" range, and therefore also + // looks like one of the color bits. Instead use the "good" + // address and add the size. + long size = top().asLongValue() - start(); + Address end = start.addOffsetTo(size); + + res.add(new MemRegion(start, end)); + } + + return res; + } } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTable.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTable.java index 128f03d63db..ae11742093e 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTable.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,6 +24,8 @@ package sun.jvm.hotspot.gc.z; +import java.util.Iterator; + import sun.jvm.hotspot.debugger.Address; import sun.jvm.hotspot.runtime.VM; import sun.jvm.hotspot.runtime.VMObject; @@ -63,4 +65,112 @@ public class ZPageTable extends VMObject { boolean is_relocating(Address o) { return getEntry(o).relocating(); } + + private class ZPagesIterator implements Iterator { + private ZAddressRangeMapForPageTable.Iterator mapIter; + private ZPage next; + + ZPagesIterator() { + mapIter = map().new Iterator(); + positionToNext(); + } + + private ZPage positionToNext() { + ZPage current = next; + + // Find next + ZPage found = null; + while (mapIter.hasNext()) { + ZPageTableEntry entry = new ZPageTableEntry(mapIter.next()); + if (!entry.isEmpty()) { + ZPage page = entry.page(); + // Medium pages have repeated entries for all covered slots, + // therefore we need to compare against the current page. + if (page != null && !page.equals(current)) { + found = page; + break; + } + } + } + + next = found; + + return current; + } + + @Override + public boolean hasNext() { + return next != null; + } + + @Override + public ZPage next() { + return positionToNext(); + } + + @Override + public void remove() { + /* not supported */ + } + } + + abstract class ZPageFilter { + public abstract boolean accept(ZPage page); + } + + class ZPagesFilteredIterator implements Iterator { + private ZPage next; + private ZPagesIterator iter = new ZPagesIterator(); + private ZPageFilter filter; + + ZPagesFilteredIterator(ZPageFilter filter) { + this.filter = filter; + positionToNext(); + } + + public ZPage positionToNext() { + ZPage current = next; + + // Find next + ZPage found = null; + while (iter.hasNext()) { + ZPage page = iter.next(); + if (filter.accept(page)) { + found = page; + break; + } + } + + next = found; + + return current; + } + + @Override + public boolean hasNext() { + return next != null; + } + + @Override + public ZPage next() { + return positionToNext(); + } + + @Override + public void remove() { + /* not supported */ + } + } + + public Iterator iterator() { + return new ZPagesIterator(); + } + + public Iterator activePagesIterator() { + return new ZPagesFilteredIterator(new ZPageFilter() { + public boolean accept(ZPage page) { + return page.is_active(); + } + }); + } } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTableEntry.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTableEntry.java index 8b7af88213f..bad4e999ae3 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTableEntry.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZPageTableEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,10 +35,18 @@ class ZPageTableEntry { } ZPage page() { - return (ZPage)VMObjectFactory.newObject(ZPage.class, entry.andWithMask(~1L)); + return (ZPage)VMObjectFactory.newObject(ZPage.class, zPageBits()); + } + + private Address zPageBits() { + return entry.andWithMask(~1L); } boolean relocating() { return (entry.asLongValue() & 1) == 1; } + + boolean isEmpty() { + return entry == null || zPageBits() == null; + } } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZUtils.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZUtils.java new file mode 100644 index 00000000000..64916bc74d5 --- /dev/null +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/z/ZUtils.java @@ -0,0 +1,43 @@ +/* + * 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. + * + */ + +package sun.jvm.hotspot.gc.z; + +import sun.jvm.hotspot.debugger.Address; +import sun.jvm.hotspot.runtime.VM; + +class ZUtils { + private static final long MSB = ~0L ^ (~0L >>> 1); + + private static Address msbAddress() { + return VM.getVM().getUniverse().heap().start().orWithMask(MSB).andWithMask(MSB); + } + + static Address longToAddress(long value) { + // If the value of an Address becomes 0, null is returned instead of an Address. + // Start with a one-bit address and as a last step, remove that bit. + Address oneAddress = msbAddress(); + return oneAddress.orWithMask(value).xorWithMask(ZAddress.as_long(oneAddress)); + } +} From e9af7c1561307e15965619d2f440cbf82075c2e5 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 19 Feb 2019 10:04:44 +0100 Subject: [PATCH 012/109] 8218970: SA: Enable HeapHprofBinWriter for ZGC Reviewed-by: eosterlund, ysuenaga --- .../classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java index 1c41dc40ff6..6864be53ab2 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java @@ -390,9 +390,6 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter { public synchronized void write(String fileName) throws IOException { VM vm = VM.getVM(); - if (vm.getUniverse().heap() instanceof ZCollectedHeap) { - throw new RuntimeException("This operation is not supported with ZGC."); - } // open file stream and create buffered data output stream fos = new FileOutputStream(fileName); From bbbcf986ead77356c2f826ac6e8318a752bbaa2d Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 19 Feb 2019 10:04:53 +0100 Subject: [PATCH 013/109] 8218978: SA: Enable more ZGC testing Reviewed-by: eosterlund, ysuenaga --- .../jtreg/serviceability/sa/ClhsdbJhisto.java | 1 - .../sa/TestHeapDumpForInvokeDynamic.java | 1 - .../sa/TestHeapDumpForLargeArray.java | 1 - .../jtreg/serviceability/sa/TestJmapCore.java | 15 ++------------- 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbJhisto.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbJhisto.java index 6b4b6917096..51e582e92f6 100644 --- a/test/hotspot/jtreg/serviceability/sa/ClhsdbJhisto.java +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbJhisto.java @@ -36,7 +36,6 @@ import jtreg.SkippedException; * @summary Test clhsdb jhisto command * @requires vm.hasSA * @requires vm.gc != "Shenandoah" - * @requires vm.gc != "Z" * @library /test/lib * @run main/othervm ClhsdbJhisto */ diff --git a/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java b/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java index c31638eeded..134975ead10 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java +++ b/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForInvokeDynamic.java @@ -50,7 +50,6 @@ import jdk.test.lib.hprof.model.Snapshot; * @test * @library /test/lib * @requires vm.hasSAandCanAttach & os.family != "mac" - * @requires vm.gc != "Z" * @modules java.base/jdk.internal.misc * jdk.hotspot.agent/sun.jvm.hotspot * jdk.hotspot.agent/sun.jvm.hotspot.utilities diff --git a/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForLargeArray.java b/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForLargeArray.java index d1aa3c61558..8691854557b 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForLargeArray.java +++ b/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForLargeArray.java @@ -48,7 +48,6 @@ import jdk.test.lib.Asserts; * @bug 8171084 * @requires vm.hasSAandCanAttach & (vm.bits == "64" & os.maxMemory > 8g) * @requires vm.gc != "Shenandoah" - * @requires vm.gc != "Z" * @modules java.base/jdk.internal.misc * jdk.hotspot.agent/sun.jvm.hotspot * jdk.hotspot.agent/sun.jvm.hotspot.utilities diff --git a/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java b/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java index c1aa70668c5..8821d0b7371 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java +++ b/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java @@ -138,19 +138,8 @@ public class TestJmapCore { if (dumpFile.exists() && dumpFile.isFile()) { HprofParser.parse(dumpFile); } else { - boolean ZGCUsed = false; - - for (String opt: Utils.getFilteredTestJavaOpts()) { - if (opt.contains("+UseZGC")) { - ZGCUsed = true; - break; - } - } - - if (!ZGCUsed) { - throw new RuntimeException( - "Could not find dump file " + dumpFile.getAbsolutePath()); - } + throw new RuntimeException( + "Could not find dump file " + dumpFile.getAbsolutePath()); } System.out.println("PASSED"); From a3b6a825bc08853bbbfe498ba3623b8358d91d18 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Tue, 19 Feb 2019 12:56:00 +0100 Subject: [PATCH 014/109] 8218672: AOT code root scanning shows in the wrong position in the logs Reviewed-by: lkorinth, kbarrett --- src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp | 15 ++++++--------- src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp | 6 +++--- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp index 14b18a1d213..a3d254693bf 100644 --- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp +++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp @@ -60,6 +60,9 @@ G1GCPhaseTimes::G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads) : _gc_par_phases[SystemDictionaryRoots] = new WorkerDataArray(max_gc_threads, "SystemDictionary Roots (ms):"); _gc_par_phases[CLDGRoots] = new WorkerDataArray(max_gc_threads, "CLDG Roots (ms):"); _gc_par_phases[JVMTIRoots] = new WorkerDataArray(max_gc_threads, "JVMTI Roots (ms):"); +#if INCLUDE_AOT + _gc_par_phases[AOTCodeRoots] = new WorkerDataArray(max_gc_threads, "AOT Root Scan (ms):"); +#endif _gc_par_phases[CMRefRoots] = new WorkerDataArray(max_gc_threads, "CM RefProcessor Roots (ms):"); _gc_par_phases[WaitForStrongCLD] = new WorkerDataArray(max_gc_threads, "Wait For Strong CLD (ms):"); _gc_par_phases[WeakCLDRoots] = new WorkerDataArray(max_gc_threads, "Weak CLD Roots (ms):"); @@ -74,9 +77,6 @@ G1GCPhaseTimes::G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads) : _gc_par_phases[ScanRS] = new WorkerDataArray(max_gc_threads, "Scan RS (ms):"); _gc_par_phases[OptScanRS] = new WorkerDataArray(max_gc_threads, "Optional Scan RS (ms):"); _gc_par_phases[CodeRoots] = new WorkerDataArray(max_gc_threads, "Code Root Scanning (ms):"); -#if INCLUDE_AOT - _gc_par_phases[AOTCodeRoots] = new WorkerDataArray(max_gc_threads, "AOT Root Scanning (ms):"); -#endif _gc_par_phases[ObjCopy] = new WorkerDataArray(max_gc_threads, "Object Copy (ms):"); _gc_par_phases[OptObjCopy] = new WorkerDataArray(max_gc_threads, "Optional Object Copy (ms):"); _gc_par_phases[Termination] = new WorkerDataArray(max_gc_threads, "Termination (ms):"); @@ -389,9 +389,6 @@ double G1GCPhaseTimes::print_evacuate_collection_set() const { } debug_phase(_gc_par_phases[ScanRS]); debug_phase(_gc_par_phases[CodeRoots]); -#if INCLUDE_AOT - debug_phase(_gc_par_phases[AOTCodeRoots]); -#endif debug_phase(_gc_par_phases[ObjCopy]); debug_phase(_gc_par_phases[Termination]); debug_phase(_gc_par_phases[Other]); @@ -503,6 +500,9 @@ const char* G1GCPhaseTimes::phase_name(GCParPhases phase) { "SystemDictionaryRoots", "CLDGRoots", "JVMTIRoots", +#if INCLUDE_AOT + "AOTCodeRoots", +#endif "CMRefRoots", "WaitForStrongCLD", "WeakCLDRoots", @@ -512,9 +512,6 @@ const char* G1GCPhaseTimes::phase_name(GCParPhases phase) { "ScanRS", "OptScanRS", "CodeRoots", -#if INCLUDE_AOT - "AOTCodeRoots", -#endif "ObjCopy", "OptObjCopy", "Termination", diff --git a/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp b/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp index eabc64c14e0..1f3fcd529ac 100644 --- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp +++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp @@ -55,6 +55,9 @@ class G1GCPhaseTimes : public CHeapObj { SystemDictionaryRoots, CLDGRoots, JVMTIRoots, +#if INCLUDE_AOT + AOTCodeRoots, +#endif CMRefRoots, WaitForStrongCLD, WeakCLDRoots, @@ -64,9 +67,6 @@ class G1GCPhaseTimes : public CHeapObj { ScanRS, OptScanRS, CodeRoots, -#if INCLUDE_AOT - AOTCodeRoots, -#endif ObjCopy, OptObjCopy, Termination, From 8b5d08be9ff8f73ad21b3b54154d32da0bcb5b91 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Tue, 19 Feb 2019 12:56:02 +0100 Subject: [PATCH 015/109] 8218920: Scan HCC should be on the same level as Update RS etc. in the log Reviewed-by: lkorinth, kbarrett --- src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp | 4 ++-- test/hotspot/jtreg/gc/g1/TestGCLogMessages.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp index a3d254693bf..b469d1cf2e8 100644 --- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp +++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp @@ -383,10 +383,10 @@ double G1GCPhaseTimes::print_evacuate_collection_set() const { for (int i = ThreadRoots; i <= SATBFiltering; i++) { trace_phase(_gc_par_phases[i]); } - debug_phase(_gc_par_phases[UpdateRS]); if (G1HotCardCache::default_use_cache()) { - trace_phase(_gc_par_phases[ScanHCC]); + debug_phase(_gc_par_phases[ScanHCC]); } + debug_phase(_gc_par_phases[UpdateRS]); debug_phase(_gc_par_phases[ScanRS]); debug_phase(_gc_par_phases[CodeRoots]); debug_phase(_gc_par_phases[ObjCopy]); diff --git a/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java b/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java index d1e22154629..8c0a2baff50 100644 --- a/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java +++ b/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java @@ -100,7 +100,7 @@ public class TestGCLogMessages { new LogMessageWithLevel("Processed Buffers", Level.DEBUG), new LogMessageWithLevel("Scanned Cards", Level.DEBUG), new LogMessageWithLevel("Skipped Cards", Level.DEBUG), - new LogMessageWithLevel("Scan HCC", Level.TRACE), + new LogMessageWithLevel("Scan HCC", Level.DEBUG), // Scan RS new LogMessageWithLevel("Scan RS", Level.DEBUG), new LogMessageWithLevel("Scanned Cards", Level.DEBUG), From 9e563f9a0823ae8cb7c4fb1a481c76cbc9ef5e58 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Tue, 19 Feb 2019 12:56:02 +0100 Subject: [PATCH 016/109] 8219097: Move comment about using weak code blobs closure for code root scanning to correct place Reviewed-by: kbarrett --- src/hotspot/share/gc/g1/g1CollectedHeap.cpp | 4 ---- src/hotspot/share/gc/g1/g1RemSet.cpp | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp index 562c8bc10c4..39670c99870 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp @@ -3282,10 +3282,6 @@ public: _root_processor->evacuate_roots(pss, worker_id); - // We pass a weak code blobs closure to the remembered set scanning because we want to avoid - // treating the nmethods visited to act as roots for concurrent marking. - // We only want to make sure that the oops in the nmethods are adjusted with regard to the - // objects copied by the current evacuation. _g1h->g1_rem_set()->oops_into_collection_set_do(pss, worker_id); double strong_roots_sec = os::elapsedTime() - start_strong_roots_sec; diff --git a/src/hotspot/share/gc/g1/g1RemSet.cpp b/src/hotspot/share/gc/g1/g1RemSet.cpp index 336b05d4ae3..cdc2cc1536e 100644 --- a/src/hotspot/share/gc/g1/g1RemSet.cpp +++ b/src/hotspot/share/gc/g1/g1RemSet.cpp @@ -409,6 +409,10 @@ void G1ScanRSForRegionClosure::scan_rem_set_roots(HeapRegion* r) { void G1ScanRSForRegionClosure::scan_strong_code_roots(HeapRegion* r) { EventGCPhaseParallel event; + // We pass a weak code blobs closure to the remembered set scanning because we want to avoid + // treating the nmethods visited to act as roots for concurrent marking. + // We only want to make sure that the oops in the nmethods are adjusted with regard to the + // objects copied by the current evacuation. r->strong_code_roots_do(_pss->closures()->weak_codeblobs()); event.commit(GCId::current(), _worker_i, G1GCPhaseTimes::phase_name(G1GCPhaseTimes::CodeRoots)); } From 7252ba2762f56b962d8371e7d1962c6b96650b52 Mon Sep 17 00:00:00 2001 From: Arno Zeller Date: Mon, 18 Feb 2019 12:52:55 +0100 Subject: [PATCH 017/109] 8219228: java/util/Base64/TestEncodingDecodingLength.java failing on 8GB test machine Reviewed-by: clanger, rriggs, nishjain, mbaesken --- test/jdk/java/util/Base64/TestEncodingDecodingLength.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jdk/java/util/Base64/TestEncodingDecodingLength.java b/test/jdk/java/util/Base64/TestEncodingDecodingLength.java index 3bac2781ac5..8e6033addb1 100644 --- a/test/jdk/java/util/Base64/TestEncodingDecodingLength.java +++ b/test/jdk/java/util/Base64/TestEncodingDecodingLength.java @@ -30,7 +30,7 @@ import java.util.Base64; * @bug 8210583 8217969 8218265 * @summary Tests Base64.Encoder.encode and Base64.Decoder.decode * with the large size of input array/buffer - * @requires os.maxMemory >= 8g + * @requires os.maxMemory >= 10g * @run main/othervm -Xms6g -Xmx8g TestEncodingDecodingLength * */ From 145c79b8c96c833ef1d5715ee37d98591a953415 Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Tue, 19 Feb 2019 09:06:44 -0800 Subject: [PATCH 018/109] 4887513: Typo in RMIFailureHandler interface doc page Co-authored-by: Andrey Turbanov Reviewed-by: dfuchs --- .../java/rmi/server/RMIFailureHandler.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/java.rmi/share/classes/java/rmi/server/RMIFailureHandler.java b/src/java.rmi/share/classes/java/rmi/server/RMIFailureHandler.java index d25f22a04d2..d7b7dcc6fbb 100644 --- a/src/java.rmi/share/classes/java/rmi/server/RMIFailureHandler.java +++ b/src/java.rmi/share/classes/java/rmi/server/RMIFailureHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2019, 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 @@ -26,13 +26,13 @@ package java.rmi.server; /** - * An RMIFailureHandler can be registered via the - * RMISocketFactory.setFailureHandler call. The - * failure method of the handler is invoked when the RMI - * runtime is unable to create a ServerSocket to listen - * for incoming calls. The failure method returns a boolean + * An {@code RMIFailureHandler} can be registered via the + * {@code RMISocketFactory.setFailureHandler} call. The + * {@code failure} method of the handler is invoked when the RMI + * runtime is unable to create a {@code ServerSocket} to listen + * for incoming calls. The {@code failure} method returns a boolean * indicating whether the runtime should attempt to re-create the - * ServerSocket. + * {@code ServerSocket}. * * @author Ann Wollrath * @since 1.1 @@ -40,18 +40,18 @@ package java.rmi.server; public interface RMIFailureHandler { /** - * The failure callback is invoked when the RMI - * runtime is unable to create a ServerSocket via the - * RMISocketFactory. An RMIFailureHandler + * The {@code failure} callback is invoked when the RMI + * runtime is unable to create a {@code ServerSocket} via the + * {@code RMISocketFactory}. An {@code RMIFailureHandler} * is registered via a call to - * RMISocketFacotry.setFailureHandler. If no failure + * {@code RMISocketFactory.setFailureHandler}. If no failure * handler is installed, the default behavior is to attempt to * re-create the ServerSocket. * - * @param ex the exception that occurred during ServerSocket + * @param ex the exception that occurred during {@code ServerSocket} * creation * @return if true, the RMI runtime attempts to retry - * ServerSocket creation + * {@code ServerSocket} creation * @see java.rmi.server.RMISocketFactory#setFailureHandler(RMIFailureHandler) * @since 1.1 */ From 87e7f97d7d1fccad4bfa1ec4cec14c44136ff534 Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Tue, 19 Feb 2019 12:50:09 -0500 Subject: [PATCH 019/109] 8219368: Quarantine runtime/NMT/CheckForProperDetailStackTrace.java test Reviewed-by: dcubed --- test/hotspot/jtreg/ProblemList.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 6d099da8a7e..172aef141bd 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -81,6 +81,7 @@ gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java 8193639 solaris-all # :hotspot_runtime runtime/handshake/HandshakeWalkSuspendExitTest.java 8214174 generic-all +runtime/NMT/CheckForProperDetailStackTrace.java 8218458 generic-all runtime/SharedArchiveFile/SASymbolTableTest.java 8193639 solaris-all ############################################################################# From c296f4ae0d1b6ff2a62f09a6708daaa5a89fc1d4 Mon Sep 17 00:00:00 2001 From: Chris Plummer Date: Tue, 19 Feb 2019 12:05:43 -0800 Subject: [PATCH 020/109] 8218947: jdb threads command should print threadID in decimal, not hex Print objectIDs in decimal. Reviewed-by: sspitsyn, dholmes, jcbeyler --- .../com/sun/tools/example/debug/tty/Env.java | 50 ++----------------- .../tools/example/debug/tty/TTYResources.java | 2 +- .../interrupt/interrupt001/interrupt001.java | 10 +++- 3 files changed, 12 insertions(+), 50 deletions(-) diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Env.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Env.java index 5df60491983..e5d513f75a7 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Env.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Env.java @@ -211,58 +211,14 @@ class Env { ReferenceType clazz = ref.referenceType(); long id = ref.uniqueID(); if (clazz == null) { - return toHex(id); + return Long.toString(id); } else { - return MessageOutput.format("object description and hex id", + return MessageOutput.format("object description and id", new Object [] {clazz.name(), - toHex(id)}); + Long.toString(id)}); } } - /** Convert a long to a hexadecimal string. */ - static String toHex(long n) { - char s1[] = new char[16]; - char s2[] = new char[18]; - - /* Store digits in reverse order. */ - int i = 0; - do { - long d = n & 0xf; - s1[i++] = (char)((d < 10) ? ('0' + d) : ('a' + d - 10)); - } while ((n >>>= 4) > 0); - - /* Now reverse the array. */ - s2[0] = '0'; - s2[1] = 'x'; - int j = 2; - while (--i >= 0) { - s2[j++] = s1[i]; - } - return new String(s2, 0, j); - } - - /** Convert hexadecimal strings to longs. */ - static long fromHex(String hexStr) { - String str = hexStr.startsWith("0x") ? - hexStr.substring(2).toLowerCase() : hexStr.toLowerCase(); - if (hexStr.length() == 0) { - throw new NumberFormatException(); - } - - long ret = 0; - for (int i = 0; i < str.length(); i++) { - int c = str.charAt(i); - if (c >= '0' && c <= '9') { - ret = (ret * 16) + (c - '0'); - } else if (c >= 'a' && c <= 'f') { - ret = (ret * 16) + (c - 'a' + 10); - } else { - throw new NumberFormatException(); - } - } - return ret; - } - static ReferenceType getReferenceTypeFromToken(String idToken) { ReferenceType cls = null; if (Character.isDigit(idToken.charAt(0))) { diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java index f1be94db510..6fbc1e7f7f1 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java @@ -235,7 +235,7 @@ public class TTYResources extends java.util.ListResourceBundle { {"Not owned", " Not owned"}, {"Not waiting for a monitor", " Not waiting for a monitor"}, {"Nothing suspended.", "Nothing suspended."}, - {"object description and hex id", "({0}){1}"}, + {"object description and id", "({0}){1}"}, {"Operation is not supported on the target VM", "Operation is not supported on the target VM"}, {"operation not yet supported", "operation not yet supported"}, {"Owned by:", " Owned by: {0}, entry count: {1,number,integer}"}, diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001.java index a1ebd49253f..37263dad6eb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2019, 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 @@ -94,7 +94,13 @@ public class interrupt001 extends JdbTest { static int numThreads = nsk.jdb.interrupt.interrupt001.interrupt001a.numThreads; - private static Pattern tidPattern = Pattern.compile("(0x[0-9a-f]+)"); + /* + * Pattern for finding the thread ID in a line like the following: + * (nsk.jdb.interrupt.interrupt001.interrupt001a$MyThread)651 Thread-0 cond. waiting + * Note we can't match on DEBUGGEE_THREAD because it includes a $, which Pattern + * uses to match the end of a line. + */ + private static Pattern tidPattern = Pattern.compile("\\(.+" + MYTHREAD + "\\)(\\S+)"); protected void runCases() { String[] reply; From 4281bf2e38df26808b968127fc7f21f44a3f20cf Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Tue, 19 Feb 2019 12:40:44 -0800 Subject: [PATCH 021/109] 8219129: Allow overriding of license files in legal dir Reviewed-by: ihse --- make/copy/CopyCommon.gmk | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/make/copy/CopyCommon.gmk b/make/copy/CopyCommon.gmk index 1bf4dad34d0..656d21d5241 100644 --- a/make/copy/CopyCommon.gmk +++ b/make/copy/CopyCommon.gmk @@ -66,6 +66,8 @@ endif # Setup make rules for copying legal files. This is only needed if the files # need to be filtered due to optional components being enabled/disabled. # Otherwise CreateJmods.gmk will find the legal files in the original src dirs. +# If multiple license files with the same name are found, only the first one +# found will get copied. # # Parameter 1 is the name of the rule. # @@ -75,10 +77,12 @@ SetupCopyLegalFiles = $(NamedParamsMacroTemplate) define SetupCopyLegalFilesBody $$(foreach f, $$(filter-out $$(addprefix %/, $$($1_EXCLUDES)), \ $$(wildcard $$(addsuffix /*, $$(call FindModuleLegalSrcDirs, $$(MODULE))))), \ - $$(eval $$(call SetupCopyFiles, $1_$$(notdir $$f), \ - DEST := $$(LEGAL_DST_DIR), \ - FILES := $$f, \ - )) \ - $$(eval $1 += $$($1_$$(notdir $$f))) \ + $$(if $$(filter $$($1_$$(notdir $$f)), $$($1)), , \ + $$(eval $$(call SetupCopyFiles, $1_$$(notdir $$f), \ + DEST := $$(LEGAL_DST_DIR), \ + FILES := $$f, \ + )) \ + $$(eval $1 += $$($1_$$(notdir $$f))) \ + ) \ ) endef From 0a976502a75f064bbde84f33928f63b29f5792d6 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Tue, 19 Feb 2019 12:43:10 -0800 Subject: [PATCH 022/109] 8211016: make images does not update jdk/lib/src.zip with latest changes Reviewed-by: ihse --- make/common/MakeBase.gmk | 3 ++- make/common/ZipArchive.gmk | 17 +++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index 201695600f3..8288474bd9f 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -392,9 +392,10 @@ ifneq ($(DISABLE_CACHE_FIND), true) # # Param 1 - Dirs to find in # Param 2 - (optional) specialization. Normally "-a \( ... \)" expression. + # Param 3 - (optional) options to find. define CacheFind $(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \ - $(if $(wildcard $1), $(shell $(FIND) $(wildcard $1) \( -type f -o -type l \) $2 \ + $(if $(wildcard $1), $(shell $(FIND) $3 $(wildcard $1) \( -type f -o -type l \) $2 \ | $(TR) ' ' '?')), \ $(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE))) endef diff --git a/make/common/ZipArchive.gmk b/make/common/ZipArchive.gmk index 64b995dbdf0..e8dd56f791b 100644 --- a/make/common/ZipArchive.gmk +++ b/make/common/ZipArchive.gmk @@ -62,8 +62,9 @@ define SetupZipArchiveBody $1_FIND_LIST := $$($1_SRC) endif - # Find all files in the source tree. - $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST))) + # Find all files in the source tree. Follow symlinks in this find since that is + # what zip does. + $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST), , -L)) # Filter on suffixes if set ifneq ($$($1_SUFFIXES),) @@ -126,10 +127,14 @@ define SetupZipArchiveBody $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS) $$(call LogWarn, Updating $$($1_NAME)) $$(call MakeTargetDir) - $$(foreach s,$$($1_SRC),(cd $$s && $(ZIPEXE) -qru $$($1_ZIP_OPTIONS) $$@ . \ - $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* \ - $$($1_ZIP_EXCLUDES_$$s) \ - || test "$$$$?" = "12" )$$(NEWLINE)) true + $$(foreach s,$$($1_SRC), $$(call ExecuteWithLog, \ + $$(SUPPORT_OUTPUTDIR)/zip/$$(patsubst $$(OUTPUTDIR)/%,%, $$@), \ + (cd $$s && $(ZIPEXE) -qru $$($1_ZIP_OPTIONS) $$@ . \ + $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* \ + $$($1_ZIP_EXCLUDES_$$s) \ + || test "$$$$?" = "12" \ + ))$$(NEWLINE) \ + ) true \ $(TOUCH) $$@ # Add zip to target list From 4f45b5f9739e5a5e7d1c4f80da9c42e0d77dd0bf Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Tue, 19 Feb 2019 12:44:56 -0800 Subject: [PATCH 023/109] 8217032: Check pandoc capabilities in configure Reviewed-by: mikael, ihse --- make/autoconf/basics.m4 | 37 ++++++++++++++++++++++++++------- make/autoconf/spec.gmk.in | 1 + make/common/ProcessMarkdown.gmk | 3 ++- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/make/autoconf/basics.m4 b/make/autoconf/basics.m4 index f35de8faf3f..9bc0d0c337e 100644 --- a/make/autoconf/basics.m4 +++ b/make/autoconf/basics.m4 @@ -618,14 +618,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS], BASIC_PATH_PROGS(CPIO, [cpio bsdcpio]) BASIC_PATH_PROGS(NICE, nice) - BASIC_PATH_PROGS(PANDOC, pandoc) - if test -n "$PANDOC"; then - ENABLE_PANDOC="true" - else - ENABLE_PANDOC="false" - fi - AC_SUBST(ENABLE_PANDOC) - BASIC_PATH_PROGS(LSB_RELEASE, lsb_release) BASIC_PATH_PROGS(CMD, [cmd.exe /mnt/c/Windows/System32/cmd.exe]) ]) @@ -1193,6 +1185,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS], BASIC_CHECK_FIND_DELETE BASIC_CHECK_TAR BASIC_CHECK_GREP + BASIC_SETUP_PANDOC # These tools might not be installed by default, # need hint on how to install them. @@ -1377,6 +1370,34 @@ AC_DEFUN_ONCE([BASIC_CHECK_BASH_OPTIONS], AC_SUBST(BASH_ARGS) ]) +################################################################################ +# +# Setup Pandoc +# +AC_DEFUN_ONCE([BASIC_SETUP_PANDOC], +[ + BASIC_PATH_PROGS(PANDOC, pandoc) + + PANDOC_MARKDOWN_FLAG="markdown" + if test -n "$PANDOC"; then + AC_MSG_CHECKING(if the pandoc smart extension needs to be disabled for markdown) + if $PANDOC --list-extensions | $GREP -q '\+smart'; then + AC_MSG_RESULT([yes]) + PANDOC_MARKDOWN_FLAG="markdown-smart" + else + AC_MSG_RESULT([no]) + fi + fi + + if test -n "$PANDOC"; then + ENABLE_PANDOC="true" + else + ENABLE_PANDOC="false" + fi + AC_SUBST(ENABLE_PANDOC) + AC_SUBST(PANDOC_MARKDOWN_FLAG) +]) + ################################################################################ # # Default make target diff --git a/make/autoconf/spec.gmk.in b/make/autoconf/spec.gmk.in index 1ac80135b50..a8f80a8d2c0 100644 --- a/make/autoconf/spec.gmk.in +++ b/make/autoconf/spec.gmk.in @@ -774,6 +774,7 @@ MSVCP_DLL:=@MSVCP_DLL@ UCRT_DLL_DIR:=@UCRT_DLL_DIR@ STLPORT_LIB:=@STLPORT_LIB@ ENABLE_PANDOC:=@ENABLE_PANDOC@ +PANDOC_MARKDOWN_FLAG:=@PANDOC_MARKDOWN_FLAG@ #################################################### # diff --git a/make/common/ProcessMarkdown.gmk b/make/common/ProcessMarkdown.gmk index c2797e2d8c1..52589a3046e 100644 --- a/make/common/ProcessMarkdown.gmk +++ b/make/common/ProcessMarkdown.gmk @@ -80,7 +80,8 @@ define ProcessMarkdown $$(call LogInfo, Converting $2 to $$($1_FORMAT)) $$(call MakeDir, $$(SUPPORT_OUTPUTDIR)/markdown $$(dir $$($1_$2_PANDOC_OUTPUT))) $$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \ - $$(PANDOC) $$($1_OPTIONS) -f markdown-smart -t $$($1_FORMAT) --standalone \ + $$(PANDOC) $$($1_OPTIONS) -f $$(PANDOC_MARKDOWN_FLAG) \ + -t $$($1_FORMAT) --standalone \ $$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS) '$$($1_$2_PANDOC_INPUT)' \ -o '$$($1_$2_PANDOC_OUTPUT)') ifneq ($$(findstring $$(LOG_LEVEL), debug trace),) From 67df8f228c6846a6d1579c1b68e5360fd59e7d20 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Tue, 19 Feb 2019 12:46:22 -0800 Subject: [PATCH 024/109] 8218135: Redo: Add ppc64le and s390x profiles to jib-profiles.js Reviewed-by: ihse --- make/conf/jib-profiles.js | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index e2103344086..335b91c2e89 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -241,7 +241,7 @@ var getJibProfilesCommon = function (input, data) { common.main_profile_names = [ "linux-x64", "linux-x86", "macosx-x64", "solaris-x64", "solaris-sparcv9", "windows-x64", "windows-x86", - "linux-aarch64", "linux-arm32" + "linux-aarch64", "linux-arm32", "linux-ppc64le", "linux-s390x" ]; // These are the base setttings for all the main build profiles. @@ -464,6 +464,28 @@ var getJibProfilesProfiles = function (input, common, data) { "--with-abi-profile=arm-vfp-hflt", "--disable-warnings-as-errors" ], }, + + "linux-ppc64le": { + target_os: "linux", + target_cpu: "ppc64le", + build_cpu: "x64", + dependencies: ["devkit", "build_devkit", "cups"], + configure_args: [ + "--openjdk-target=ppc64le-linux-gnu", "--with-freetype=bundled", + "--disable-warnings-as-errors" + ], + }, + + "linux-s390x": { + target_os: "linux", + target_cpu: "s390x", + build_cpu: "x64", + dependencies: ["devkit", "build_devkit", "cups"], + configure_args: [ + "--openjdk-target=s390x-linux-gnu", "--with-freetype=bundled", + "--disable-warnings-as-errors" + ], + }, }; // Add the base settings to all the main profiles @@ -626,6 +648,12 @@ var getJibProfilesProfiles = function (input, common, data) { }, "linux-arm32": { platform: "linux-arm32", + }, + "linux-ppc64le": { + platform: "linux-ppc64le", + }, + "linux-s390x": { + platform: "linux-s390x", } } // Generate common artifacts for all main profiles @@ -870,7 +898,9 @@ var getJibProfilesDependencies = function (input, common) { solaris_sparcv9: "SS12u6-Solaris11u3+1.0", windows_x64: "VS2017-15.5.5+1.0", linux_aarch64: "gcc7.3.0-Fedora27+1.2", - linux_arm: "gcc7.3.0-Fedora27+1.2" + linux_arm: "gcc7.3.0-Fedora27+1.2", + linux_ppc64le: "gcc7.3.0-Fedora27+1.0", + linux_s390x: "gcc7.3.0-Fedora27+1.0" }; var devkit_platform = (input.target_cpu == "x86" From 47ccdad73532a1d2106429780e68322e8a6e5665 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Tue, 19 Feb 2019 13:05:16 -0800 Subject: [PATCH 025/109] 8065262: (bf spec) CharBuffer.chars() should make it clearer that the sequence starts from the buffer position Reviewed-by: alanb, darcy, rriggs --- src/java.base/share/classes/java/nio/X-Buffer.java.template | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/java.base/share/classes/java/nio/X-Buffer.java.template b/src/java.base/share/classes/java/nio/X-Buffer.java.template index 231c994e20d..8e0465a570e 100644 --- a/src/java.base/share/classes/java/nio/X-Buffer.java.template +++ b/src/java.base/share/classes/java/nio/X-Buffer.java.template @@ -209,6 +209,8 @@ import jdk.internal.util.ArraysSupport; *

This class implements the {@link CharSequence} interface so that * character buffers may be used wherever character sequences are accepted, for * example in the regular-expression package {@link java.util.regex}. + * The methods defined by {@code CharSequence} operate relative to the current + * position of the buffer when they are invoked. *

* #end[char] From 272869390eb69623fa638d61bb1c6fa5e61a04d5 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Tue, 19 Feb 2019 13:51:11 -0800 Subject: [PATCH 026/109] 8219391: extend gcov support to llvm/clang Reviewed-by: erikj --- make/autoconf/jdk-options.m4 | 39 +++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index 62ea13c20e5..5ee34aeeeee 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2019, 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 @@ -372,23 +372,26 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE], [enable native compilation with code coverage data@<:@disabled@:>@])]) GCOV_ENABLED="false" if test "x$enable_native_coverage" = "xyes"; then - if test "x$TOOLCHAIN_TYPE" = "xgcc"; then - AC_MSG_CHECKING([if native coverage is enabled]) - AC_MSG_RESULT([yes]) - GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline" - GCOV_LDFLAGS="-fprofile-arcs" - JVM_CFLAGS="$JVM_CFLAGS $GCOV_CFLAGS" - JVM_LDFLAGS="$JVM_LDFLAGS $GCOV_LDFLAGS" - CFLAGS_JDKLIB="$CFLAGS_JDKLIB $GCOV_CFLAGS" - CFLAGS_JDKEXE="$CFLAGS_JDKEXE $GCOV_CFLAGS" - CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $GCOV_CFLAGS" - CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS" - LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS" - LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS" - GCOV_ENABLED="true" - else - AC_MSG_ERROR([--enable-native-coverage only works with toolchain type gcc]) - fi + case $TOOLCHAIN_TYPE in + gcc | clang) + AC_MSG_CHECKING([if native coverage is enabled]) + AC_MSG_RESULT([yes]) + GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline" + GCOV_LDFLAGS="-fprofile-arcs" + JVM_CFLAGS="$JVM_CFLAGS $GCOV_CFLAGS" + JVM_LDFLAGS="$JVM_LDFLAGS $GCOV_LDFLAGS" + CFLAGS_JDKLIB="$CFLAGS_JDKLIB $GCOV_CFLAGS" + CFLAGS_JDKEXE="$CFLAGS_JDKEXE $GCOV_CFLAGS" + CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $GCOV_CFLAGS" + CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS" + LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS" + LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS" + GCOV_ENABLED="true" + ;; + *) + AC_MSG_ERROR([--enable-native-coverage only works with toolchain type gcc or clang]) + ;; + esac elif test "x$enable_native_coverage" = "xno"; then AC_MSG_CHECKING([if native coverage is enabled]) AC_MSG_RESULT([no]) From 67c2e382d35734ea85c69bd5d01a03e272727672 Mon Sep 17 00:00:00 2001 From: Jorn Vernee Date: Tue, 19 Feb 2019 23:02:41 +0100 Subject: [PATCH 027/109] 8219393: Add native library support for microbenchmarks Reviewed-by: erikj --- make/RunTests.gmk | 2 ++ make/test/BuildMicrobenchmark.gmk | 27 +++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/make/RunTests.gmk b/make/RunTests.gmk index 37a21829947..b42c27faa36 100644 --- a/make/RunTests.gmk +++ b/make/RunTests.gmk @@ -658,6 +658,8 @@ define SetupRunMicroTestBody # Current tests needs to open java.io $1_MICRO_JAVA_OPTIONS += --add-opens=java.base/java.io=ALL-UNNAMED + # Set library path for native dependencies + $1_MICRO_JAVA_OPTIONS += -Djava.library.path=$$(TEST_IMAGE_DIR)/micro/native # Save output as JSON or CSV file ifneq ($$(MICRO_RESULTS_FORMAT), ) diff --git a/make/test/BuildMicrobenchmark.gmk b/make/test/BuildMicrobenchmark.gmk index cebf444cafe..d12f67fa460 100644 --- a/make/test/BuildMicrobenchmark.gmk +++ b/make/test/BuildMicrobenchmark.gmk @@ -30,6 +30,7 @@ include $(SPEC) include MakeBase.gmk include JavaCompilation.gmk include SetupJavaCompilers.gmk +include TestFilesCompilation.gmk ifeq ($(JMH_CORE_JAR), ) $(info Error: JMH is missing. Please use configure --with-jmh.) @@ -39,7 +40,8 @@ endif #### Variables MICROBENCHMARK_SRC := $(TOPDIR)/test/micro -MICROBENCHMARK_JAR := $(IMAGES_OUTPUTDIR)/test/micro/benchmarks.jar +MICROBENCHMARK_IMAGE_DIR := $(TEST_IMAGE_DIR)/micro +MICROBENCHMARK_JAR := $(MICROBENCHMARK_IMAGE_DIR)/benchmarks.jar MICROBENCHMARK_OUTPUT := $(SUPPORT_OUTPUTDIR)/test/micro MICROBENCHMARK_CLASSES := $(MICROBENCHMARK_OUTPUT)/classes @@ -54,6 +56,11 @@ JMH_RUNTIME_JARS := $(JMH_CORE_JAR) $(JMH_COMMONS_MATH_JAR) $(JMH_JOPT_SIMPLE_JA MICROBENCHMARK_CLASSPATH := $(call PathList, $(JMH_COMPILE_JARS)) +# Native dependencies +MICROBENCHMARK_NATIVE_SRC_DIRS := $(MICROBENCHMARK_SRC) +MICROBENCHMARK_NATIVE_OUTPUT := $(MICROBENCHMARK_OUTPUT)/native +MICROBENCHMARK_NATIVE_EXCLUDE := + ### # Need double \n to get new lines and no trailing spaces @@ -108,6 +115,22 @@ $(eval $(call SetupJarArchive, BUILD_JDK_JAR, \ JAR := $(MICROBENCHMARK_JAR), \ )) -all: $(MICROBENCHMARK_JAR) +# Setup compilation of native library dependencies +$(eval $(call SetupTestFilesCompilation, BUILD_MICROBENCHMARK_LIBRARIES, \ + TYPE := LIBRARY, \ + SOURCE_DIRS := $(MICROBENCHMARK_NATIVE_SRC_DIRS), \ + OUTPUT_DIR := $(MICROBENCHMARK_NATIVE_OUTPUT), \ + EXCLUDE := $(MICROBENCHMARK_NATIVE_EXCLUDE), \ +)) + +# Setup copy of native dependencies to image output dir +$(eval $(call SetupCopyFiles, COPY_MICROBENCHMARK_NATIVE, \ + SRC := $(MICROBENCHMARK_NATIVE_OUTPUT), \ + DEST := $(MICROBENCHMARK_IMAGE_DIR)/native, \ + FILES := $(BUILD_MICROBENCHMARK_LIBRARIES), \ + FLATTEN := true, \ +)) + +all: $(MICROBENCHMARK_JAR) $(BUILD_MICROBENCHMARK_LIBRARIES) $(COPY_MICROBENCHMARK_NATIVE) .PHONY: all From 22fe6edc6c18e621cd76c08bfb6e047c709d41ee Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Tue, 19 Feb 2019 14:25:52 -0800 Subject: [PATCH 028/109] 8219394: Missing FIXPATH in microbenchmark test runner Reviewed-by: redestad --- make/RunTests.gmk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/make/RunTests.gmk b/make/RunTests.gmk index b42c27faa36..3fccf3cd5b2 100644 --- a/make/RunTests.gmk +++ b/make/RunTests.gmk @@ -692,7 +692,8 @@ define SetupRunMicroTestBody $$(call LogWarn, Running test '$$($1_TEST)') $$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR)) $$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/micro, \ - $$($1_MICRO_TEST_JDK)/bin/java $$($1_MICRO_JAVA_OPTIONS) -jar $$($1_MICRO_BENCHMARKS_JAR) \ + $$(FIXPATH) $$($1_MICRO_TEST_JDK)/bin/java $$($1_MICRO_JAVA_OPTIONS) \ + -jar $$($1_MICRO_BENCHMARKS_JAR) \ $$($1_MICRO_ITER) $$($1_MICRO_FORK) $$($1_MICRO_TIME) \ $$($1_MICRO_WARMUP_ITER) $$($1_MICRO_WARMUP_TIME) \ $$($1_MICRO_VM_OPTIONS) $$($1_MICRO_BASIC_OPTIONS) $$(MICRO_OPTIONS) \ From 8679b085ce82d07f3d3a4ee43f4cdcfa18a94ea1 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Tue, 19 Feb 2019 19:27:08 -0800 Subject: [PATCH 029/109] 8219132: switch to jtreg4.2-b14 Reviewed-by: erikj --- make/conf/jib-profiles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index 335b91c2e89..aea5f6a7ba0 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -960,7 +960,7 @@ var getJibProfilesDependencies = function (input, common) { jtreg: { server: "javare", revision: "4.2", - build_number: "b13", + build_number: "b14", checksum_file: "MD5_VALUES", file: "jtreg_bin-4.2.zip", environment_name: "JT_HOME", From d9463e629ed4375475c27c3d07c5e9bb36d6886a Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Tue, 19 Feb 2019 09:02:28 +0100 Subject: [PATCH 030/109] 8218965: aix: support xlclang++ in the compiler detection Reviewed-by: ihse, mdoerr --- make/autoconf/flags-cflags.m4 | 6 ++++- make/autoconf/toolchain.m4 | 22 +++++++++++++++++++ .../harfbuzz/hb-atomic-private.hh | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index 40021632ed2..9594ec51ed4 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -121,7 +121,11 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS], # -g0 enables debug symbols without disabling inlining. CFLAGS_DEBUG_SYMBOLS="-g0 -xs" elif test "x$TOOLCHAIN_TYPE" = xxlc; then - CFLAGS_DEBUG_SYMBOLS="-g" + if test "x$XLC_USES_CLANG" = xtrue; then + CFLAGS_DEBUG_SYMBOLS="-g1" + else + CFLAGS_DEBUG_SYMBOLS="-g" + fi elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then CFLAGS_DEBUG_SYMBOLS="-Z7 -d2Zi+" fi diff --git a/make/autoconf/toolchain.m4 b/make/autoconf/toolchain.m4 index fa21f5813a0..c67e9909e68 100644 --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -276,6 +276,20 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE], fi AC_SUBST(TOOLCHAIN_TYPE) + # on AIX, check for xlclang++ on the PATH and TOOLCHAIN_PATH and use it if it is available + if test "x$OPENJDK_TARGET_OS" = xaix; then + if test "x$TOOLCHAIN_PATH" != x; then + XLC_TEST_PATH=${TOOLCHAIN_PATH}/ + fi + + XLCLANG_VERSION_OUTPUT=`${XLC_TEST_PATH}xlclang++ -qversion 2>&1 | $HEAD -n 1` + $ECHO "$XLCLANG_VERSION_OUTPUT" | $GREP "IBM XL C/C++ for AIX" > /dev/null + if test $? -eq 0; then + AC_MSG_NOTICE([xlclang++ output: $XLCLANG_VERSION_OUTPUT]) + XLC_USES_CLANG=true + fi + fi + TOOLCHAIN_CC_BINARY_clang="clang" TOOLCHAIN_CC_BINARY_gcc="gcc" TOOLCHAIN_CC_BINARY_microsoft="cl$EXE_SUFFIX" @@ -288,6 +302,14 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE], TOOLCHAIN_CXX_BINARY_solstudio="CC" TOOLCHAIN_CXX_BINARY_xlc="xlC_r" + if test "x$OPENJDK_TARGET_OS" = xaix; then + if test "x$XLC_USES_CLANG" = xtrue; then + AC_MSG_NOTICE([xlclang++ detected, using it]) + TOOLCHAIN_CC_BINARY_xlc="xlclang" + TOOLCHAIN_CXX_BINARY_xlc="xlclang++" + fi + fi + # Use indirect variable referencing toolchain_var_name=TOOLCHAIN_DESCRIPTION_$TOOLCHAIN_TYPE TOOLCHAIN_DESCRIPTION=${!toolchain_var_name} diff --git a/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-atomic-private.hh b/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-atomic-private.hh index 73d7f005e8c..32e0377181b 100644 --- a/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-atomic-private.hh +++ b/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-atomic-private.hh @@ -115,7 +115,7 @@ typedef int32_t hb_atomic_int_impl_t; #endif -#elif !defined(HB_NO_MT) && defined(_AIX) && defined(__IBMCPP__) +#elif !defined(HB_NO_MT) && defined(_AIX) && (defined(__IBMCPP__) || defined(__ibmxl__)) #include From 9dae227e4f0e44bd75a30e55bc54ea68f6cbc841 Mon Sep 17 00:00:00 2001 From: Sandhya Viswanathan Date: Tue, 19 Feb 2019 08:25:11 -0800 Subject: [PATCH 031/109] 8219151: Illegal instruction exception on JDK 12 due to incorrect CPU feature bits Fix wrong CPU feature bits set Reviewed-by: kvn, neliasso --- src/hotspot/cpu/x86/vm_version_x86.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/cpu/x86/vm_version_x86.hpp b/src/hotspot/cpu/x86/vm_version_x86.hpp index e435ea53be6..4cd945d72e8 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.hpp +++ b/src/hotspot/cpu/x86/vm_version_x86.hpp @@ -336,7 +336,7 @@ protected: #define CPU_AVX512_VPOPCNTDQ ((uint64_t)UCONST64(0x2000000000)) // Vector popcount #define CPU_VPCLMULQDQ ((uint64_t)UCONST64(0x4000000000)) //Vector carryless multiplication #define CPU_VAES ((uint64_t)UCONST64(0x8000000000)) // Vector AES instructions -#define CPU_VNNI ((uint64_t)UCONST64(0x16000000000)) // Vector Neural Network Instructions +#define CPU_VNNI ((uint64_t)UCONST64(0x10000000000)) // Vector Neural Network Instructions enum Extended_Family { // AMD From dbdfbb518ffec4dff09fbb059a70b39597b7c3c7 Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Wed, 20 Feb 2019 09:53:28 +0100 Subject: [PATCH 032/109] 8219229: Make ConstantPool::tag_at and release_tag_at_put inlineable Reviewed-by: dholmes, coleenp --- src/hotspot/share/ci/ciReplay.cpp | 1 + src/hotspot/share/classfile/stackMapTable.cpp | 1 + .../share/interpreter/linkResolver.cpp | 1 + src/hotspot/share/interpreter/rewriter.cpp | 1 + .../jfrEventClassTransformer.cpp | 1 + src/hotspot/share/oops/array.hpp | 5 ++- src/hotspot/share/oops/array.inline.hpp | 37 ------------------- src/hotspot/share/oops/constantPool.cpp | 6 +-- src/hotspot/share/oops/constantPool.hpp | 4 +- src/hotspot/share/oops/generateOopMap.cpp | 1 + src/hotspot/share/oops/instanceKlass.cpp | 1 + src/hotspot/share/oops/method.cpp | 1 + .../reflectionAccessorImplKlassHelper.cpp | 1 + src/hotspot/share/prims/jvm.cpp | 1 + .../share/prims/jvmtiRedefineClasses.cpp | 1 + src/hotspot/share/runtime/deoptimization.cpp | 1 + src/hotspot/share/runtime/fieldDescriptor.cpp | 1 + 17 files changed, 19 insertions(+), 46 deletions(-) delete mode 100644 src/hotspot/share/oops/array.inline.hpp diff --git a/src/hotspot/share/ci/ciReplay.cpp b/src/hotspot/share/ci/ciReplay.cpp index 206fd374dfb..02bf28f7040 100644 --- a/src/hotspot/share/ci/ciReplay.cpp +++ b/src/hotspot/share/ci/ciReplay.cpp @@ -33,6 +33,7 @@ #include "memory/allocation.inline.hpp" #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" +#include "oops/constantPool.hpp" #include "oops/method.inline.hpp" #include "oops/oop.inline.hpp" #include "runtime/fieldDescriptor.inline.hpp" diff --git a/src/hotspot/share/classfile/stackMapTable.cpp b/src/hotspot/share/classfile/stackMapTable.cpp index 7c9a2a1564f..95e79c169f5 100644 --- a/src/hotspot/share/classfile/stackMapTable.cpp +++ b/src/hotspot/share/classfile/stackMapTable.cpp @@ -26,6 +26,7 @@ #include "classfile/stackMapTable.hpp" #include "classfile/verifier.hpp" #include "memory/resourceArea.hpp" +#include "oops/constantPool.hpp" #include "oops/oop.inline.hpp" #include "runtime/fieldType.hpp" #include "runtime/handles.inline.hpp" diff --git a/src/hotspot/share/interpreter/linkResolver.cpp b/src/hotspot/share/interpreter/linkResolver.cpp index 5e6395a2cf6..69f90b4a3d7 100644 --- a/src/hotspot/share/interpreter/linkResolver.cpp +++ b/src/hotspot/share/interpreter/linkResolver.cpp @@ -39,6 +39,7 @@ #include "logging/logStream.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "oops/constantPool.hpp" #include "oops/cpCache.inline.hpp" #include "oops/instanceKlass.hpp" #include "oops/method.hpp" diff --git a/src/hotspot/share/interpreter/rewriter.cpp b/src/hotspot/share/interpreter/rewriter.cpp index 70cf6f8d2ea..c5994844066 100644 --- a/src/hotspot/share/interpreter/rewriter.cpp +++ b/src/hotspot/share/interpreter/rewriter.cpp @@ -28,6 +28,7 @@ #include "interpreter/rewriter.hpp" #include "memory/metadataFactory.hpp" #include "memory/resourceArea.hpp" +#include "oops/constantPool.hpp" #include "oops/generateOopMap.hpp" #include "prims/methodHandles.hpp" #include "runtime/fieldDescriptor.inline.hpp" diff --git a/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp index 8c581208035..24a19c60225 100644 --- a/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp +++ b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp @@ -43,6 +43,7 @@ #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "oops/array.hpp" +#include "oops/constantPool.hpp" #include "oops/instanceKlass.hpp" #include "oops/method.hpp" #include "prims/jvmtiRedefineClasses.hpp" diff --git a/src/hotspot/share/oops/array.hpp b/src/hotspot/share/oops/array.hpp index 4e400e11810..1f0b2bcec35 100644 --- a/src/hotspot/share/oops/array.hpp +++ b/src/hotspot/share/oops/array.hpp @@ -27,6 +27,7 @@ #include "memory/allocation.hpp" #include "memory/metaspace.hpp" +#include "runtime/orderAccess.hpp" #include "utilities/align.hpp" // Array for metadata allocation @@ -121,8 +122,8 @@ protected: T* adr_at(const int i) { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); return &_data[i]; } int find(const T& x) { return index_of(x); } - T at_acquire(const int which); - void release_at_put(int which, T contents); + T at_acquire(const int i) { return OrderAccess::load_acquire(adr_at(i)); } + void release_at_put(int i, T x) { OrderAccess::release_store(adr_at(i), x); } static int size(int length) { size_t bytes = align_up(byte_sizeof(length), BytesPerWord); diff --git a/src/hotspot/share/oops/array.inline.hpp b/src/hotspot/share/oops/array.inline.hpp deleted file mode 100644 index 2260b7496fa..00000000000 --- a/src/hotspot/share/oops/array.inline.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#ifndef SHARE_OOPS_ARRAY_INLINE_HPP -#define SHARE_OOPS_ARRAY_INLINE_HPP - -#include "oops/array.hpp" -#include "runtime/orderAccess.hpp" - -template -inline T Array::at_acquire(const int which) { return OrderAccess::load_acquire(adr_at(which)); } - -template -inline void Array::release_at_put(int which, T contents) { OrderAccess::release_store(adr_at(which), contents); } - -#endif // SHARE_OOPS_ARRAY_INLINE_HPP diff --git a/src/hotspot/share/oops/constantPool.cpp b/src/hotspot/share/oops/constantPool.cpp index 296e26b7bae..3bf8df05b3b 100644 --- a/src/hotspot/share/oops/constantPool.cpp +++ b/src/hotspot/share/oops/constantPool.cpp @@ -39,7 +39,7 @@ #include "memory/metaspaceShared.hpp" #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" -#include "oops/array.inline.hpp" +#include "oops/array.hpp" #include "oops/constantPool.inline.hpp" #include "oops/cpCache.inline.hpp" #include "oops/instanceKlass.hpp" @@ -56,10 +56,6 @@ #include "runtime/vframe.inline.hpp" #include "utilities/copy.hpp" -constantTag ConstantPool::tag_at(int which) const { return (constantTag)tags()->at_acquire(which); } - -void ConstantPool::release_tag_at_put(int which, jbyte t) { tags()->release_at_put(which, t); } - ConstantPool* ConstantPool::allocate(ClassLoaderData* loader_data, int length, TRAPS) { Array* tags = MetadataFactory::new_array(loader_data, length, 0, CHECK_NULL); int size = ConstantPool::size(length); diff --git a/src/hotspot/share/oops/constantPool.hpp b/src/hotspot/share/oops/constantPool.hpp index 5f436a89636..116f10eb40c 100644 --- a/src/hotspot/share/oops/constantPool.hpp +++ b/src/hotspot/share/oops/constantPool.hpp @@ -131,7 +131,7 @@ class ConstantPool : public Metadata { void set_tags(Array* tags) { _tags = tags; } void tag_at_put(int which, jbyte t) { tags()->at_put(which, t); } - void release_tag_at_put(int which, jbyte t); + void release_tag_at_put(int which, jbyte t) { tags()->release_at_put(which, t); } u1* tag_addr_at(int which) const { return tags()->adr_at(which); } @@ -379,7 +379,7 @@ class ConstantPool : public Metadata { // Tag query - constantTag tag_at(int which) const; + constantTag tag_at(int which) const { return (constantTag)tags()->at_acquire(which); } // Fetching constants diff --git a/src/hotspot/share/oops/generateOopMap.cpp b/src/hotspot/share/oops/generateOopMap.cpp index edb9c106d42..3fa07c3df5c 100644 --- a/src/hotspot/share/oops/generateOopMap.cpp +++ b/src/hotspot/share/oops/generateOopMap.cpp @@ -27,6 +27,7 @@ #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/allocation.inline.hpp" +#include "oops/constantPool.hpp" #include "oops/generateOopMap.hpp" #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index b329a257688..05ff886e958 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -53,6 +53,7 @@ #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "oops/fieldStreams.hpp" +#include "oops/constantPool.hpp" #include "oops/instanceClassLoaderKlass.hpp" #include "oops/instanceKlass.inline.hpp" #include "oops/instanceMirrorKlass.hpp" diff --git a/src/hotspot/share/oops/method.cpp b/src/hotspot/share/oops/method.cpp index 4af5d06cbb7..c60e36787fa 100644 --- a/src/hotspot/share/oops/method.cpp +++ b/src/hotspot/share/oops/method.cpp @@ -42,6 +42,7 @@ #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "oops/constMethod.hpp" +#include "oops/constantPool.hpp" #include "oops/method.inline.hpp" #include "oops/methodData.hpp" #include "oops/objArrayOop.inline.hpp" diff --git a/src/hotspot/share/oops/reflectionAccessorImplKlassHelper.cpp b/src/hotspot/share/oops/reflectionAccessorImplKlassHelper.cpp index 8470f8b3a4c..144f0b6b197 100644 --- a/src/hotspot/share/oops/reflectionAccessorImplKlassHelper.cpp +++ b/src/hotspot/share/oops/reflectionAccessorImplKlassHelper.cpp @@ -26,6 +26,7 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "memory/resourceArea.hpp" +#include "oops/constantPool.hpp" #include "oops/reflectionAccessorImplKlassHelper.hpp" #include "utilities/constantTag.hpp" #include "utilities/debug.hpp" diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp index 7446202fb03..7f0065c9641 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -45,6 +45,7 @@ #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/access.inline.hpp" +#include "oops/constantPool.hpp" #include "oops/fieldStreams.hpp" #include "oops/instanceKlass.hpp" #include "oops/method.hpp" diff --git a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp index 0dc83c8d61e..8002f4bd8dc 100644 --- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp +++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp @@ -39,6 +39,7 @@ #include "memory/metaspaceShared.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "oops/constantPool.hpp" #include "oops/fieldStreams.hpp" #include "oops/klassVtable.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/runtime/deoptimization.cpp b/src/hotspot/share/runtime/deoptimization.cpp index 0d96a7d5cbc..287af4fb0be 100644 --- a/src/hotspot/share/runtime/deoptimization.cpp +++ b/src/hotspot/share/runtime/deoptimization.cpp @@ -36,6 +36,7 @@ #include "memory/allocation.inline.hpp" #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" +#include "oops/constantPool.hpp" #include "oops/method.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/runtime/fieldDescriptor.cpp b/src/hotspot/share/runtime/fieldDescriptor.cpp index edf0ed996e1..9bfaa7e9612 100644 --- a/src/hotspot/share/runtime/fieldDescriptor.cpp +++ b/src/hotspot/share/runtime/fieldDescriptor.cpp @@ -28,6 +28,7 @@ #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/annotations.hpp" +#include "oops/constantPool.hpp" #include "oops/instanceKlass.hpp" #include "oops/oop.inline.hpp" #include "oops/fieldStreams.hpp" From 708b339eb4b4ddd51fba6d9f88aa5196318ee475 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Wed, 20 Feb 2019 10:48:36 +0100 Subject: [PATCH 033/109] 8219098: Make output of region strings more regular in error messages Error messages should use the HR_PARAMS/HR_FORMAT_PARAMS macros to print information about HeapRegions. Reviewed-by: kbarrett, lkorinth --- .../share/gc/g1/g1FullGCOopClosures.cpp | 23 +++++-------- src/hotspot/share/gc/g1/heapRegion.cpp | 32 ++++++++++--------- 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp b/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp index 0c94c3e332c..d17c004a0a8 100644 --- a/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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,26 +71,19 @@ template void G1VerifyOopClosure::do_oop_work(T* p) { } if (!_g1h->is_in_closed_subset(obj)) { HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); - yy.print_cr("Field " PTR_FORMAT - " of live obj " PTR_FORMAT " in region " - "[" PTR_FORMAT ", " PTR_FORMAT ")", - p2i(p), p2i(_containing_obj), - p2i(from->bottom()), p2i(from->end())); + yy.print_cr("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT, + p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from)); print_object(&yy, _containing_obj); yy.print_cr("points to obj " PTR_FORMAT " not in the heap", - p2i(obj)); + p2i(obj)); } else { HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj); - yy.print_cr("Field " PTR_FORMAT - " of live obj " PTR_FORMAT " in region " - "[" PTR_FORMAT ", " PTR_FORMAT ")", - p2i(p), p2i(_containing_obj), - p2i(from->bottom()), p2i(from->end())); + yy.print_cr("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT, + p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from)); print_object(&yy, _containing_obj); - yy.print_cr("points to dead obj " PTR_FORMAT " in region " - "[" PTR_FORMAT ", " PTR_FORMAT ")", - p2i(obj), p2i(to->bottom()), p2i(to->end())); + yy.print_cr("points to dead obj " PTR_FORMAT " in region " HR_FORMAT, + p2i(obj), HR_FORMAT_PARAMS(to)); print_object(&yy, obj); } yy.print_cr("----------"); diff --git a/src/hotspot/share/gc/g1/heapRegion.cpp b/src/hotspot/share/gc/g1/heapRegion.cpp index ff2cf2465af..2dfe1d03e87 100644 --- a/src/hotspot/share/gc/g1/heapRegion.cpp +++ b/src/hotspot/share/gc/g1/heapRegion.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -336,8 +336,8 @@ class VerifyStrongCodeRootOopClosure: public OopClosure { // Object is in the region. Check that its less than top if (_hr->top() <= (HeapWord*)obj) { // Object is above top - log_error(gc, verify)("Object " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ") is above top " PTR_FORMAT, - p2i(obj), p2i(_hr->bottom()), p2i(_hr->end()), p2i(_hr->top())); + log_error(gc, verify)("Object " PTR_FORMAT " in region " HR_FORMAT " is above top ", + p2i(obj), HR_FORMAT_PARAMS(_hr)); _failures = true; return; } @@ -415,8 +415,8 @@ void HeapRegion::verify_strong_code_roots(VerifyOption vo, bool* failures) const // on its strong code root list if (is_empty()) { if (strong_code_roots_length > 0) { - log_error(gc, verify)("region [" PTR_FORMAT "," PTR_FORMAT "] is empty but has " SIZE_FORMAT " code root entries", - p2i(bottom()), p2i(end()), strong_code_roots_length); + log_error(gc, verify)("region " HR_FORMAT " is empty but has " SIZE_FORMAT " code root entries", + HR_FORMAT_PARAMS(this), strong_code_roots_length); *failures = true; } return; @@ -524,21 +524,22 @@ public: ResourceMark rm; if (!_g1h->is_in_closed_subset(obj)) { HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); - log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ")", - p2i(p), p2i(_containing_obj), p2i(from->bottom()), p2i(from->end())); + log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT, + p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from)); LogStream ls(log.error()); print_object(&ls, _containing_obj); HeapRegion* const to = _g1h->heap_region_containing(obj); - log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT " remset %s", p2i(obj), HR_FORMAT_PARAMS(to), to->rem_set()->get_state_str()); + log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT " remset %s", + p2i(obj), HR_FORMAT_PARAMS(to), to->rem_set()->get_state_str()); } else { HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj); - log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ")", - p2i(p), p2i(_containing_obj), p2i(from->bottom()), p2i(from->end())); + log.error("Field " PTR_FORMAT " of live obj " PTR_FORMAT " in region " HR_FORMAT, + p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from)); LogStream ls(log.error()); print_object(&ls, _containing_obj); - log.error("points to dead obj " PTR_FORMAT " in region [" PTR_FORMAT ", " PTR_FORMAT ")", - p2i(obj), p2i(to->bottom()), p2i(to->end())); + log.error("points to dead obj " PTR_FORMAT " in region " HR_FORMAT, + p2i(obj), HR_FORMAT_PARAMS(to)); print_object(&ls, obj); } log.error("----------"); @@ -593,12 +594,13 @@ public: log.error("----------"); } log.error("Missing rem set entry:"); - log.error("Field " PTR_FORMAT " of obj " PTR_FORMAT ", in region " HR_FORMAT, - p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from)); + log.error("Field " PTR_FORMAT " of obj " PTR_FORMAT " in region " HR_FORMAT, + p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from)); ResourceMark rm; LogStream ls(log.error()); _containing_obj->print_on(&ls); - log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT " remset %s", p2i(obj), HR_FORMAT_PARAMS(to), to->rem_set()->get_state_str()); + log.error("points to obj " PTR_FORMAT " in region " HR_FORMAT " remset %s", + p2i(obj), HR_FORMAT_PARAMS(to), to->rem_set()->get_state_str()); if (oopDesc::is_oop(obj)) { obj->print_on(&ls); } From 7f0669764449f99a8eddca00984ebf16a23bb5d4 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Wed, 20 Feb 2019 11:11:38 +0100 Subject: [PATCH 034/109] 8218287: jshell tool: input behavior unstable after 12-ea+24 on Windows Ensure correct wrapping of input on Windows. Reviewed-by: rfield --- .../impl/AbstractWindowsTerminal.java | 2 +- .../internal/org/jline/utils/NonBlocking.java | 4 +- .../windows/native/lible/Kernel32.cpp | 2 +- .../jline/AbstractWindowsTerminalTest.java | 93 +++++++++++++++++++ 4 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 test/jdk/jdk/internal/jline/AbstractWindowsTerminalTest.java diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractWindowsTerminal.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractWindowsTerminal.java index 3de71574ae1..80807463802 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractWindowsTerminal.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractWindowsTerminal.java @@ -86,8 +86,8 @@ public abstract class AbstractWindowsTerminal extends AbstractTerminal { super(name, type, selectCharset(encoding, codepage), signalHandler); NonBlockingPumpReader reader = NonBlocking.nonBlockingPumpReader(); this.slaveInputPipe = reader.getWriter(); - this.reader = reader; this.input = inputStreamWrapper.apply(NonBlocking.nonBlockingStream(reader, encoding())); + this.reader = NonBlocking.nonBlocking(name, input, encoding()); this.writer = new PrintWriter(writer); this.output = new WriterOutputStream(writer, encoding()); parseInfoCmp(); diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/NonBlocking.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/NonBlocking.java index ce68619527a..9fbee17b665 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/NonBlocking.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/NonBlocking.java @@ -123,9 +123,9 @@ public class NonBlocking { } if (bytes.hasRemaining()) { if (isPeek) { - return bytes.get(bytes.position()); + return Byte.toUnsignedInt(bytes.get(bytes.position())); } else { - return bytes.get(); + return Byte.toUnsignedInt(bytes.get()); } } else { return READ_EXPIRED; diff --git a/src/jdk.internal.le/windows/native/lible/Kernel32.cpp b/src/jdk.internal.le/windows/native/lible/Kernel32.cpp index 0293191197a..89fcc0acbda 100644 --- a/src/jdk.internal.le/windows/native/lible/Kernel32.cpp +++ b/src/jdk.internal.le/windows/native/lible/Kernel32.cpp @@ -460,7 +460,7 @@ JNIEXPORT void JNICALL Java_jdk_internal_org_jline_terminal_impl_jna_win_Kernel3 HANDLE h = GetStdHandle((jint) env->GetLongField(in_hConsoleOutput, pointerValue)); INPUT_RECORD *buffer = new INPUT_RECORD[in_nLength]; DWORD numberOfEventsRead; - if (!ReadConsoleInput(h, buffer, in_nLength, &numberOfEventsRead)) { + if (!ReadConsoleInputW(h, buffer, in_nLength, &numberOfEventsRead)) { delete buffer; DWORD error = GetLastError(); jobject exc = env->NewObject(lastErrorExceptionClass, diff --git a/test/jdk/jdk/internal/jline/AbstractWindowsTerminalTest.java b/test/jdk/jdk/internal/jline/AbstractWindowsTerminalTest.java new file mode 100644 index 00000000000..500ea5d2548 --- /dev/null +++ b/test/jdk/jdk/internal/jline/AbstractWindowsTerminalTest.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2019, 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 8218287 + * @summary Verify the wrapper input stream is used when using Terminal.reader() + * @modules jdk.internal.le/jdk.internal.org.jline.terminal + * jdk.internal.le/jdk.internal.org.jline.terminal.impl + * jdk.internal.le/jdk.internal.org.jline.utils + */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Function; + +import jdk.internal.org.jline.terminal.Size; +import jdk.internal.org.jline.terminal.Terminal.SignalHandler; +import jdk.internal.org.jline.terminal.impl.AbstractWindowsTerminal; + + +public class AbstractWindowsTerminalTest { + public static void main(String... args) throws IOException { + new AbstractWindowsTerminalTest().run(); + } + + void run() throws IOException { + var out = new StringWriter(); + AtomicBoolean called = new AtomicBoolean(); + Function isWrapper = is -> new InputStream() { + @Override + public int read() throws IOException { + called.set(true); + return is.read(); + } + }; + var t = new AbstractWindowsTerminal(out, "test", "vt100", null, -1, false, SignalHandler.SIG_DFL, isWrapper) { + @Override + protected int getConsoleOutputCP() { + throw new UnsupportedOperationException("unexpected."); + } + + @Override + protected int getConsoleMode() { + return -1; + } + + @Override + protected void setConsoleMode(int mode) { + throw new UnsupportedOperationException("unexpected."); + } + + @Override + protected boolean processConsoleInput() throws IOException { + throw new UnsupportedOperationException("unexpected."); + } + + @Override + public Size getSize() { + throw new UnsupportedOperationException("unexpected."); + } + }; + t.processInputChar(' '); + if (t.reader().read() != ' ') { + throw new AssertionError("Unexpected input!"); + } + if (!called.get()) { + throw new AssertionError("The wrapper was not called!"); + } + } +} From 28590e9343753f97ec5762aca15371877b4fdb68 Mon Sep 17 00:00:00 2001 From: Roman Kennke Date: Wed, 20 Feb 2019 13:01:57 +0100 Subject: [PATCH 035/109] 8217909: Make unused r12 register (without compressed oops) available to regalloc in C2 Reviewed-by: adinn, dlong, neliasso --- src/hotspot/cpu/x86/c2_init_x86.cpp | 3 + src/hotspot/cpu/x86/x86_64.ad | 484 +++++++++++----------------- src/hotspot/share/adlc/formsopt.hpp | 3 - 3 files changed, 190 insertions(+), 300 deletions(-) diff --git a/src/hotspot/cpu/x86/c2_init_x86.cpp b/src/hotspot/cpu/x86/c2_init_x86.cpp index 522af0038ae..81f1e4e50c3 100644 --- a/src/hotspot/cpu/x86/c2_init_x86.cpp +++ b/src/hotspot/cpu/x86/c2_init_x86.cpp @@ -29,6 +29,8 @@ // processor dependent initialization for i486 +extern void reg_mask_init(); + void Compile::pd_compiler2_init() { guarantee(CodeEntryAlignment >= InteriorEntryAlignment, "" ); // QQQ presumably all 64bit cpu's support this. Seems like the ifdef could @@ -58,4 +60,5 @@ void Compile::pd_compiler2_init() { OptoReg::invalidate(i); } } + reg_mask_init(); } diff --git a/src/hotspot/cpu/x86/x86_64.ad b/src/hotspot/cpu/x86/x86_64.ad index 663e2efb5fc..c167012f120 100644 --- a/src/hotspot/cpu/x86/x86_64.ad +++ b/src/hotspot/cpu/x86/x86_64.ad @@ -169,135 +169,94 @@ alloc_class chunk0(R10, R10_H, // Empty register class. reg_class no_reg(); -// Class for all pointer registers (including RSP and RBP) -reg_class any_reg_with_rbp(RAX, RAX_H, - RDX, RDX_H, - RBP, RBP_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - RSP, RSP_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R12, R12_H, - R13, R13_H, - R14, R14_H, - R15, R15_H); +// Class for all pointer/long registers +reg_class all_reg(RAX, RAX_H, + RDX, RDX_H, + RBP, RBP_H, + RDI, RDI_H, + RSI, RSI_H, + RCX, RCX_H, + RBX, RBX_H, + RSP, RSP_H, + R8, R8_H, + R9, R9_H, + R10, R10_H, + R11, R11_H, + R12, R12_H, + R13, R13_H, + R14, R14_H, + R15, R15_H); -// Class for all pointer registers (including RSP, but excluding RBP) -reg_class any_reg_no_rbp(RAX, RAX_H, - RDX, RDX_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - RSP, RSP_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R12, R12_H, - R13, R13_H, - R14, R14_H, - R15, R15_H); +// Class for all int registers +reg_class all_int_reg(RAX + RDX, + RBP, + RDI, + RSI, + RCX, + RBX, + R8, + R9, + R10, + R11, + R12, + R13, + R14); -// Dynamic register class that selects at runtime between register classes -// any_reg_no_rbp and any_reg_with_rbp (depending on the value of the flag PreserveFramePointer). -// Equivalent to: return PreserveFramePointer ? any_reg_no_rbp : any_reg_with_rbp; -reg_class_dynamic any_reg(any_reg_no_rbp, any_reg_with_rbp, %{ PreserveFramePointer %}); +// Class for all pointer registers +reg_class any_reg %{ + return _ANY_REG_mask; +%} // Class for all pointer registers (excluding RSP) -reg_class ptr_reg_with_rbp(RAX, RAX_H, - RDX, RDX_H, - RBP, RBP_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); +reg_class ptr_reg %{ + return _PTR_REG_mask; +%} // Class for all pointer registers (excluding RSP and RBP) -reg_class ptr_reg_no_rbp(RAX, RAX_H, - RDX, RDX_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Dynamic register class that selects between ptr_reg_no_rbp and ptr_reg_with_rbp. -reg_class_dynamic ptr_reg(ptr_reg_no_rbp, ptr_reg_with_rbp, %{ PreserveFramePointer %}); +reg_class ptr_reg_no_rbp %{ + return _PTR_REG_NO_RBP_mask; +%} // Class for all pointer registers (excluding RAX and RSP) -reg_class ptr_no_rax_reg_with_rbp(RDX, RDX_H, - RBP, RBP_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Class for all pointer registers (excluding RAX, RSP, and RBP) -reg_class ptr_no_rax_reg_no_rbp(RDX, RDX_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Dynamic register class that selects between ptr_no_rax_reg_no_rbp and ptr_no_rax_reg_with_rbp. -reg_class_dynamic ptr_no_rax_reg(ptr_no_rax_reg_no_rbp, ptr_no_rax_reg_with_rbp, %{ PreserveFramePointer %}); +reg_class ptr_no_rax_reg %{ + return _PTR_NO_RAX_REG_mask; +%} // Class for all pointer registers (excluding RAX, RBX, and RSP) -reg_class ptr_no_rax_rbx_reg_with_rbp(RDX, RDX_H, - RBP, RBP_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); +reg_class ptr_no_rax_rbx_reg %{ + return _PTR_NO_RAX_RBX_REG_mask; +%} -// Class for all pointer registers (excluding RAX, RBX, RSP, and RBP) -reg_class ptr_no_rax_rbx_reg_no_rbp(RDX, RDX_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); +// Class for all long registers (excluding RSP) +reg_class long_reg %{ + return _LONG_REG_mask; +%} -// Dynamic register class that selects between ptr_no_rax_rbx_reg_no_rbp and ptr_no_rax_rbx_reg_with_rbp. -reg_class_dynamic ptr_no_rax_rbx_reg(ptr_no_rax_rbx_reg_no_rbp, ptr_no_rax_rbx_reg_with_rbp, %{ PreserveFramePointer %}); +// Class for all long registers (excluding RAX, RDX and RSP) +reg_class long_no_rax_rdx_reg %{ + return _LONG_NO_RAX_RDX_REG_mask; +%} + +// Class for all long registers (excluding RCX and RSP) +reg_class long_no_rcx_reg %{ + return _LONG_NO_RCX_REG_mask; +%} + +// Class for all int registers (excluding RSP) +reg_class int_reg %{ + return _INT_REG_mask; +%} + +// Class for all int registers (excluding RAX, RDX, and RSP) +reg_class int_no_rax_rdx_reg %{ + return _INT_NO_RAX_RDX_REG_mask; +%} + +// Class for all int registers (excluding RCX and RSP) +reg_class int_no_rcx_reg %{ + return _INT_NO_RCX_REG_mask; +%} // Singleton class for RAX pointer register reg_class ptr_rax_reg(RAX, RAX_H); @@ -317,96 +276,6 @@ reg_class ptr_rsp_reg(RSP, RSP_H); // Singleton class for TLS pointer reg_class ptr_r15_reg(R15, R15_H); -// Class for all long registers (excluding RSP) -reg_class long_reg_with_rbp(RAX, RAX_H, - RDX, RDX_H, - RBP, RBP_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Class for all long registers (excluding RSP and RBP) -reg_class long_reg_no_rbp(RAX, RAX_H, - RDX, RDX_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Dynamic register class that selects between long_reg_no_rbp and long_reg_with_rbp. -reg_class_dynamic long_reg(long_reg_no_rbp, long_reg_with_rbp, %{ PreserveFramePointer %}); - -// Class for all long registers (excluding RAX, RDX and RSP) -reg_class long_no_rax_rdx_reg_with_rbp(RBP, RBP_H, - RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Class for all long registers (excluding RAX, RDX, RSP, and RBP) -reg_class long_no_rax_rdx_reg_no_rbp(RDI, RDI_H, - RSI, RSI_H, - RCX, RCX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Dynamic register class that selects between long_no_rax_rdx_reg_no_rbp and long_no_rax_rdx_reg_with_rbp. -reg_class_dynamic long_no_rax_rdx_reg(long_no_rax_rdx_reg_no_rbp, long_no_rax_rdx_reg_with_rbp, %{ PreserveFramePointer %}); - -// Class for all long registers (excluding RCX and RSP) -reg_class long_no_rcx_reg_with_rbp(RBP, RBP_H, - RDI, RDI_H, - RSI, RSI_H, - RAX, RAX_H, - RDX, RDX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Class for all long registers (excluding RCX, RSP, and RBP) -reg_class long_no_rcx_reg_no_rbp(RDI, RDI_H, - RSI, RSI_H, - RAX, RAX_H, - RDX, RDX_H, - RBX, RBX_H, - R8, R8_H, - R9, R9_H, - R10, R10_H, - R11, R11_H, - R13, R13_H, - R14, R14_H); - -// Dynamic register class that selects between long_no_rcx_reg_no_rbp and long_no_rcx_reg_with_rbp. -reg_class_dynamic long_no_rcx_reg(long_no_rcx_reg_no_rbp, long_no_rcx_reg_with_rbp, %{ PreserveFramePointer %}); - // Singleton class for RAX long register reg_class long_rax_reg(RAX, RAX_H); @@ -416,96 +285,6 @@ reg_class long_rcx_reg(RCX, RCX_H); // Singleton class for RDX long register reg_class long_rdx_reg(RDX, RDX_H); -// Class for all int registers (excluding RSP) -reg_class int_reg_with_rbp(RAX, - RDX, - RBP, - RDI, - RSI, - RCX, - RBX, - R8, - R9, - R10, - R11, - R13, - R14); - -// Class for all int registers (excluding RSP and RBP) -reg_class int_reg_no_rbp(RAX, - RDX, - RDI, - RSI, - RCX, - RBX, - R8, - R9, - R10, - R11, - R13, - R14); - -// Dynamic register class that selects between int_reg_no_rbp and int_reg_with_rbp. -reg_class_dynamic int_reg(int_reg_no_rbp, int_reg_with_rbp, %{ PreserveFramePointer %}); - -// Class for all int registers (excluding RCX and RSP) -reg_class int_no_rcx_reg_with_rbp(RAX, - RDX, - RBP, - RDI, - RSI, - RBX, - R8, - R9, - R10, - R11, - R13, - R14); - -// Class for all int registers (excluding RCX, RSP, and RBP) -reg_class int_no_rcx_reg_no_rbp(RAX, - RDX, - RDI, - RSI, - RBX, - R8, - R9, - R10, - R11, - R13, - R14); - -// Dynamic register class that selects between int_no_rcx_reg_no_rbp and int_no_rcx_reg_with_rbp. -reg_class_dynamic int_no_rcx_reg(int_no_rcx_reg_no_rbp, int_no_rcx_reg_with_rbp, %{ PreserveFramePointer %}); - -// Class for all int registers (excluding RAX, RDX, and RSP) -reg_class int_no_rax_rdx_reg_with_rbp(RBP, - RDI, - RSI, - RCX, - RBX, - R8, - R9, - R10, - R11, - R13, - R14); - -// Class for all int registers (excluding RAX, RDX, RSP, and RBP) -reg_class int_no_rax_rdx_reg_no_rbp(RDI, - RSI, - RCX, - RBX, - R8, - R9, - R10, - R11, - R13, - R14); - -// Dynamic register class that selects between int_no_rax_rdx_reg_no_rbp and int_no_rax_rdx_reg_with_rbp. -reg_class_dynamic int_no_rax_rdx_reg(int_no_rax_rdx_reg_no_rbp, int_no_rax_rdx_reg_with_rbp, %{ PreserveFramePointer %}); - // Singleton class for RAX int register reg_class int_rax_reg(RAX); @@ -529,12 +308,123 @@ reg_class int_rdi_reg(RDI); //----------SOURCE BLOCK------------------------------------------------------- // This is a block of C++ code which provides values, functions, and // definitions necessary in the rest of the architecture description +source_hpp %{ + +extern RegMask _ANY_REG_mask; +extern RegMask _PTR_REG_mask; +extern RegMask _PTR_REG_NO_RBP_mask; +extern RegMask _PTR_NO_RAX_REG_mask; +extern RegMask _PTR_NO_RAX_RBX_REG_mask; +extern RegMask _LONG_REG_mask; +extern RegMask _LONG_NO_RAX_RDX_REG_mask; +extern RegMask _LONG_NO_RCX_REG_mask; +extern RegMask _INT_REG_mask; +extern RegMask _INT_NO_RAX_RDX_REG_mask; +extern RegMask _INT_NO_RCX_REG_mask; + +extern RegMask _STACK_OR_PTR_REG_mask; +extern RegMask _STACK_OR_LONG_REG_mask; +extern RegMask _STACK_OR_INT_REG_mask; + +inline const RegMask& STACK_OR_PTR_REG_mask() { return _STACK_OR_PTR_REG_mask; } +inline const RegMask& STACK_OR_LONG_REG_mask() { return _STACK_OR_LONG_REG_mask; } +inline const RegMask& STACK_OR_INT_REG_mask() { return _STACK_OR_INT_REG_mask; } + +%} + source %{ #define RELOC_IMM64 Assembler::imm_operand #define RELOC_DISP32 Assembler::disp32_operand #define __ _masm. +RegMask _ANY_REG_mask; +RegMask _PTR_REG_mask; +RegMask _PTR_REG_NO_RBP_mask; +RegMask _PTR_NO_RAX_REG_mask; +RegMask _PTR_NO_RAX_RBX_REG_mask; +RegMask _LONG_REG_mask; +RegMask _LONG_NO_RAX_RDX_REG_mask; +RegMask _LONG_NO_RCX_REG_mask; +RegMask _INT_REG_mask; +RegMask _INT_NO_RAX_RDX_REG_mask; +RegMask _INT_NO_RCX_REG_mask; +RegMask _STACK_OR_PTR_REG_mask; +RegMask _STACK_OR_LONG_REG_mask; +RegMask _STACK_OR_INT_REG_mask; + +static bool need_r12_heapbase() { + return UseCompressedOops || UseCompressedClassPointers || UseZGC; +} + +void reg_mask_init() { + // _ALL_REG_mask is generated by adlc from the all_reg register class below. + // We derive a number of subsets from it. + _ANY_REG_mask = _ALL_REG_mask; + + if (PreserveFramePointer) { + _ANY_REG_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg())); + _ANY_REG_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg()->next())); + } + if (need_r12_heapbase()) { + _ANY_REG_mask.Remove(OptoReg::as_OptoReg(r12->as_VMReg())); + _ANY_REG_mask.Remove(OptoReg::as_OptoReg(r12->as_VMReg()->next())); + } + + _PTR_REG_mask = _ANY_REG_mask; + _PTR_REG_mask.Remove(OptoReg::as_OptoReg(rsp->as_VMReg())); + _PTR_REG_mask.Remove(OptoReg::as_OptoReg(rsp->as_VMReg()->next())); + _PTR_REG_mask.Remove(OptoReg::as_OptoReg(r15->as_VMReg())); + _PTR_REG_mask.Remove(OptoReg::as_OptoReg(r15->as_VMReg()->next())); + + _STACK_OR_PTR_REG_mask = _PTR_REG_mask; + _STACK_OR_PTR_REG_mask.OR(STACK_OR_STACK_SLOTS_mask()); + + _PTR_REG_NO_RBP_mask = _PTR_REG_mask; + _PTR_REG_NO_RBP_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg())); + _PTR_REG_NO_RBP_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg()->next())); + + _PTR_NO_RAX_REG_mask = _PTR_REG_mask; + _PTR_NO_RAX_REG_mask.Remove(OptoReg::as_OptoReg(rax->as_VMReg())); + _PTR_NO_RAX_REG_mask.Remove(OptoReg::as_OptoReg(rax->as_VMReg()->next())); + + _PTR_NO_RAX_RBX_REG_mask = _PTR_NO_RAX_REG_mask; + _PTR_NO_RAX_RBX_REG_mask.Remove(OptoReg::as_OptoReg(rbx->as_VMReg())); + _PTR_NO_RAX_RBX_REG_mask.Remove(OptoReg::as_OptoReg(rbx->as_VMReg()->next())); + + _LONG_REG_mask = _PTR_REG_mask; + _STACK_OR_LONG_REG_mask = _LONG_REG_mask; + _STACK_OR_LONG_REG_mask.OR(STACK_OR_STACK_SLOTS_mask()); + + _LONG_NO_RAX_RDX_REG_mask = _LONG_REG_mask; + _LONG_NO_RAX_RDX_REG_mask.Remove(OptoReg::as_OptoReg(rax->as_VMReg())); + _LONG_NO_RAX_RDX_REG_mask.Remove(OptoReg::as_OptoReg(rax->as_VMReg()->next())); + _LONG_NO_RAX_RDX_REG_mask.Remove(OptoReg::as_OptoReg(rdx->as_VMReg())); + _LONG_NO_RAX_RDX_REG_mask.Remove(OptoReg::as_OptoReg(rdx->as_VMReg()->next())); + + _LONG_NO_RCX_REG_mask = _LONG_REG_mask; + _LONG_NO_RCX_REG_mask.Remove(OptoReg::as_OptoReg(rcx->as_VMReg())); + _LONG_NO_RCX_REG_mask.Remove(OptoReg::as_OptoReg(rcx->as_VMReg()->next())); + + _INT_REG_mask = _ALL_INT_REG_mask; + if (PreserveFramePointer) { + _INT_REG_mask.Remove(OptoReg::as_OptoReg(rbp->as_VMReg())); + } + if (need_r12_heapbase()) { + _INT_REG_mask.Remove(OptoReg::as_OptoReg(r12->as_VMReg())); + } + + _STACK_OR_INT_REG_mask = _INT_REG_mask; + _STACK_OR_INT_REG_mask.OR(STACK_OR_STACK_SLOTS_mask()); + + _INT_NO_RAX_RDX_REG_mask = _INT_REG_mask; + _INT_NO_RAX_RDX_REG_mask.Remove(OptoReg::as_OptoReg(rax->as_VMReg())); + _INT_NO_RAX_RDX_REG_mask.Remove(OptoReg::as_OptoReg(rdx->as_VMReg())); + + _INT_NO_RCX_REG_mask = _INT_REG_mask; + _INT_NO_RCX_REG_mask.Remove(OptoReg::as_OptoReg(rcx->as_VMReg())); +} + static bool generate_vzeroupper(Compile* C) { return (VM_Version::supports_vzeroupper() && (C->max_vector_size() > 16 || C->clear_upper_avx() == true)) ? true: false; // Generate vzeroupper } diff --git a/src/hotspot/share/adlc/formsopt.hpp b/src/hotspot/share/adlc/formsopt.hpp index 113489696a5..4ea99bf1d17 100644 --- a/src/hotspot/share/adlc/formsopt.hpp +++ b/src/hotspot/share/adlc/formsopt.hpp @@ -242,9 +242,6 @@ public: char* code_snippet() { return _code_snippet; } - void set_stack_version(bool flag) { - assert(false, "User defined register classes are not allowed to spill to the stack."); - } void declare_register_masks(FILE* fp); void build_register_masks(FILE* fp) { // We do not need to generate register masks because we select at runtime From 92f19f92bb79f922a3d8e61c10d81b7d0c75760d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Lid=C3=A9n?= Date: Wed, 20 Feb 2019 13:43:01 +0100 Subject: [PATCH 036/109] 8219331: ZGC: Unify TLAB retire/remap handling Reviewed-by: stefank --- src/hotspot/share/gc/z/zInitialize.cpp | 6 +-- src/hotspot/share/gc/z/zMark.cpp | 19 +++----- src/hotspot/share/gc/z/zRelocate.cpp | 12 ++--- ...atTLAB.cpp => zThreadLocalAllocBuffer.cpp} | 45 ++++++++++++------- ...atTLAB.hpp => zThreadLocalAllocBuffer.hpp} | 19 ++++---- 5 files changed, 52 insertions(+), 49 deletions(-) rename src/hotspot/share/gc/z/{zStatTLAB.cpp => zThreadLocalAllocBuffer.cpp} (59%) rename src/hotspot/share/gc/z/{zStatTLAB.hpp => zThreadLocalAllocBuffer.hpp} (73%) diff --git a/src/hotspot/share/gc/z/zInitialize.cpp b/src/hotspot/share/gc/z/zInitialize.cpp index b2656f1a11c..55e55db34ef 100644 --- a/src/hotspot/share/gc/z/zInitialize.cpp +++ b/src/hotspot/share/gc/z/zInitialize.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, 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,7 +30,7 @@ #include "gc/z/zLargePages.hpp" #include "gc/z/zNUMA.hpp" #include "gc/z/zStat.hpp" -#include "gc/z/zStatTLAB.hpp" +#include "gc/z/zThreadLocalAllocBuffer.hpp" #include "gc/z/zTracer.hpp" #include "logging/log.hpp" #include "runtime/vm_version.hpp" @@ -46,7 +46,7 @@ ZInitialize::ZInitialize(ZBarrierSet* barrier_set) { ZNUMA::initialize(); ZCPU::initialize(); ZStatValue::initialize(); - ZStatTLAB::initialize(); + ZThreadLocalAllocBuffer::initialize(); ZTracer::initialize(); ZLargePages::initialize(); ZBarrierSet::set_barrier_set(barrier_set); diff --git a/src/hotspot/share/gc/z/zMark.cpp b/src/hotspot/share/gc/z/zMark.cpp index 861e74608c3..0bcb701aea7 100644 --- a/src/hotspot/share/gc/z/zMark.cpp +++ b/src/hotspot/share/gc/z/zMark.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, 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 @@ -32,9 +32,9 @@ #include "gc/z/zPageTable.inline.hpp" #include "gc/z/zRootsIterator.hpp" #include "gc/z/zStat.hpp" -#include "gc/z/zStatTLAB.hpp" #include "gc/z/zTask.hpp" #include "gc/z/zThread.hpp" +#include "gc/z/zThreadLocalAllocBuffer.hpp" #include "gc/z/zUtils.inline.hpp" #include "gc/z/zWorkers.inline.hpp" #include "logging/log.hpp" @@ -119,18 +119,13 @@ void ZMark::prepare_mark() { } class ZMarkRootsIteratorClosure : public ZRootsIteratorClosure { -private: - static void fixup_address(HeapWord** p) { - *p = (HeapWord*)ZAddress::good_or_null((uintptr_t)*p); - } - public: ZMarkRootsIteratorClosure() { - ZStatTLAB::reset(); + ZThreadLocalAllocBuffer::reset_statistics(); } ~ZMarkRootsIteratorClosure() { - ZStatTLAB::publish(); + ZThreadLocalAllocBuffer::publish_statistics(); } virtual void do_thread(Thread* thread) { @@ -140,11 +135,7 @@ public: ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask); // Retire TLAB - if (UseTLAB && thread->is_Java_thread()) { - thread->tlab().addresses_do(fixup_address); - thread->tlab().retire(ZStatTLAB::get()); - thread->tlab().resize(); - } + ZThreadLocalAllocBuffer::retire(thread); } virtual void do_oop(oop* p) { diff --git a/src/hotspot/share/gc/z/zRelocate.cpp b/src/hotspot/share/gc/z/zRelocate.cpp index 9fbe1c873f5..82ffb780896 100644 --- a/src/hotspot/share/gc/z/zRelocate.cpp +++ b/src/hotspot/share/gc/z/zRelocate.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, 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 @@ -31,17 +31,13 @@ #include "gc/z/zRelocationSet.inline.hpp" #include "gc/z/zRootsIterator.hpp" #include "gc/z/zTask.hpp" +#include "gc/z/zThreadLocalAllocBuffer.hpp" #include "gc/z/zWorkers.hpp" ZRelocate::ZRelocate(ZWorkers* workers) : _workers(workers) {} class ZRelocateRootsIteratorClosure : public ZRootsIteratorClosure { -private: - static void remap_address(HeapWord** p) { - *p = (HeapWord*)ZAddress::good_or_null((uintptr_t)*p); - } - public: virtual void do_thread(Thread* thread) { ZRootsIteratorClosure::do_thread(thread); @@ -50,9 +46,7 @@ public: ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask); // Remap TLAB - if (UseTLAB && thread->is_Java_thread()) { - thread->tlab().addresses_do(remap_address); - } + ZThreadLocalAllocBuffer::remap(thread); } virtual void do_oop(oop* p) { diff --git a/src/hotspot/share/gc/z/zStatTLAB.cpp b/src/hotspot/share/gc/z/zThreadLocalAllocBuffer.cpp similarity index 59% rename from src/hotspot/share/gc/z/zStatTLAB.cpp rename to src/hotspot/share/gc/z/zThreadLocalAllocBuffer.cpp index 4ca29962e34..1e13cdec983 100644 --- a/src/hotspot/share/gc/z/zStatTLAB.cpp +++ b/src/hotspot/share/gc/z/zThreadLocalAllocBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,19 +21,23 @@ * questions. */ -#include "gc/z/zStatTLAB.hpp" +#include "precompiled.hpp" +#include "gc/z/zAddress.inline.hpp" +#include "gc/z/zThreadLocalAllocBuffer.hpp" +#include "runtime/globals.hpp" +#include "runtime/thread.hpp" -ZPerWorker* ZStatTLAB::_stats = NULL; +ZPerWorker* ZThreadLocalAllocBuffer::_stats = NULL; -void ZStatTLAB::initialize() { +void ZThreadLocalAllocBuffer::initialize() { if (UseTLAB) { assert(_stats == NULL, "Already initialized"); _stats = new ZPerWorker(); - reset(); + reset_statistics(); } } -void ZStatTLAB::reset() { +void ZThreadLocalAllocBuffer::reset_statistics() { if (UseTLAB) { ZPerWorkerIterator iter(_stats); for (ThreadLocalAllocStats* stats; iter.next(&stats);) { @@ -42,15 +46,7 @@ void ZStatTLAB::reset() { } } -ThreadLocalAllocStats* ZStatTLAB::get() { - if (UseTLAB) { - return _stats->addr(); - } - - return NULL; -} - -void ZStatTLAB::publish() { +void ZThreadLocalAllocBuffer::publish_statistics() { if (UseTLAB) { ThreadLocalAllocStats total; @@ -62,3 +58,22 @@ void ZStatTLAB::publish() { total.publish(); } } + +static void fixup_address(HeapWord** p) { + *p = (HeapWord*)ZAddress::good_or_null((uintptr_t)*p); +} + +void ZThreadLocalAllocBuffer::retire(Thread* thread) { + if (UseTLAB && thread->is_Java_thread()) { + ThreadLocalAllocStats* const stats = _stats->addr(); + thread->tlab().addresses_do(fixup_address); + thread->tlab().retire(stats); + thread->tlab().resize(); + } +} + +void ZThreadLocalAllocBuffer::remap(Thread* thread) { + if (UseTLAB && thread->is_Java_thread()) { + thread->tlab().addresses_do(fixup_address); + } +} diff --git a/src/hotspot/share/gc/z/zStatTLAB.hpp b/src/hotspot/share/gc/z/zThreadLocalAllocBuffer.hpp similarity index 73% rename from src/hotspot/share/gc/z/zStatTLAB.hpp rename to src/hotspot/share/gc/z/zThreadLocalAllocBuffer.hpp index efbd3db4a65..cc708164822 100644 --- a/src/hotspot/share/gc/z/zStatTLAB.hpp +++ b/src/hotspot/share/gc/z/zThreadLocalAllocBuffer.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,22 +21,25 @@ * questions. */ -#ifndef SHARE_GC_Z_ZSTATTLAB_HPP -#define SHARE_GC_Z_ZSTATTLAB_HPP +#ifndef SHARE_GC_Z_ZTHREADLOCALALLOCBUFFER_HPP +#define SHARE_GC_Z_ZTHREADLOCALALLOCBUFFER_HPP #include "gc/shared/threadLocalAllocBuffer.hpp" #include "gc/z/zValue.hpp" #include "memory/allocation.hpp" -class ZStatTLAB : public AllStatic { +class ZThreadLocalAllocBuffer : public AllStatic { private: static ZPerWorker* _stats; public: static void initialize(); - static void reset(); - static ThreadLocalAllocStats* get(); - static void publish(); + + static void reset_statistics(); + static void publish_statistics(); + + static void retire(Thread* thread); + static void remap(Thread* thread); }; -#endif // SHARE_GC_Z_ZSTATTLAB_HPP +#endif // SHARE_GC_Z_ZTHREADLOCALALLOCBUFFER_HPP From 3df5e4fabbda7dfc4c43d8402b58614945774081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Lid=C3=A9n?= Date: Wed, 20 Feb 2019 13:43:02 +0100 Subject: [PATCH 037/109] 8219332: ZGC: Improve ZRootsIteratorClosure abstraction Reviewed-by: stefank --- src/hotspot/share/gc/z/zMark.cpp | 2 -- src/hotspot/share/gc/z/zRelocate.cpp | 2 -- src/hotspot/share/gc/z/zRootsIterator.cpp | 32 +++++++++++++++-------- src/hotspot/share/gc/z/zRootsIterator.hpp | 4 +-- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/hotspot/share/gc/z/zMark.cpp b/src/hotspot/share/gc/z/zMark.cpp index 0bcb701aea7..09249e53b38 100644 --- a/src/hotspot/share/gc/z/zMark.cpp +++ b/src/hotspot/share/gc/z/zMark.cpp @@ -129,8 +129,6 @@ public: } virtual void do_thread(Thread* thread) { - ZRootsIteratorClosure::do_thread(thread); - // Update thread local address bad mask ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask); diff --git a/src/hotspot/share/gc/z/zRelocate.cpp b/src/hotspot/share/gc/z/zRelocate.cpp index 82ffb780896..cc76e263c88 100644 --- a/src/hotspot/share/gc/z/zRelocate.cpp +++ b/src/hotspot/share/gc/z/zRelocate.cpp @@ -40,8 +40,6 @@ ZRelocate::ZRelocate(ZWorkers* workers) : class ZRelocateRootsIteratorClosure : public ZRootsIteratorClosure { public: virtual void do_thread(Thread* thread) { - ZRootsIteratorClosure::do_thread(thread); - // Update thread local address bad mask ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask); diff --git a/src/hotspot/share/gc/z/zRootsIterator.cpp b/src/hotspot/share/gc/z/zRootsIterator.cpp index 654d53a6fe6..2658da70df0 100644 --- a/src/hotspot/share/gc/z/zRootsIterator.cpp +++ b/src/hotspot/share/gc/z/zRootsIterator.cpp @@ -135,29 +135,38 @@ void ZParallelWeakOopsDo::weak_oops_do(BoolObjectClosure* is_alive, ZRoots } } -class ZCodeBlobClosure : public CodeBlobToOopClosure { +class ZRootsIteratorCodeBlobClosure : public CodeBlobToOopClosure { private: BarrierSetNMethod* _bs; public: - ZCodeBlobClosure(OopClosure* cl) : + ZRootsIteratorCodeBlobClosure(OopClosure* cl) : CodeBlobToOopClosure(cl, true /* fix_relocations */), _bs(BarrierSet::barrier_set()->barrier_set_nmethod()) {} virtual void do_code_blob(CodeBlob* cb) { nmethod* const nm = cb->as_nmethod_or_null(); - if (nm == NULL || nm->test_set_oops_do_mark()) { - return; + if (nm != NULL && !nm->test_set_oops_do_mark()) { + CodeBlobToOopClosure::do_code_blob(cb); + _bs->disarm(nm); } - CodeBlobToOopClosure::do_code_blob(cb); - _bs->disarm(nm); } }; -void ZRootsIteratorClosure::do_thread(Thread* thread) { - ZCodeBlobClosure code_cl(this); - thread->oops_do(this, ClassUnloading ? &code_cl : NULL); -} +class ZRootsIteratorThreadClosure : public ThreadClosure { +private: + ZRootsIteratorClosure* _cl; + +public: + ZRootsIteratorThreadClosure(ZRootsIteratorClosure* cl) : + _cl(cl) {} + + virtual void do_thread(Thread* thread) { + ZRootsIteratorCodeBlobClosure code_cl(_cl); + thread->oops_do(_cl, ClassUnloading ? &code_cl : NULL); + _cl->do_thread(thread); + } +}; ZRootsIterator::ZRootsIterator() : _universe(this), @@ -227,7 +236,8 @@ void ZRootsIterator::do_system_dictionary(ZRootsIteratorClosure* cl) { void ZRootsIterator::do_threads(ZRootsIteratorClosure* cl) { ZStatTimer timer(ZSubPhasePauseRootsThreads); ResourceMark rm; - Threads::possibly_parallel_threads_do(true, cl); + ZRootsIteratorThreadClosure thread_cl(cl); + Threads::possibly_parallel_threads_do(true, &thread_cl); } void ZRootsIterator::do_code_cache(ZRootsIteratorClosure* cl) { diff --git a/src/hotspot/share/gc/z/zRootsIterator.hpp b/src/hotspot/share/gc/z/zRootsIterator.hpp index 0cd6dd1db55..d5146397747 100644 --- a/src/hotspot/share/gc/z/zRootsIterator.hpp +++ b/src/hotspot/share/gc/z/zRootsIterator.hpp @@ -31,9 +31,9 @@ #include "runtime/thread.hpp" #include "utilities/globalDefinitions.hpp" -class ZRootsIteratorClosure : public OopClosure, public ThreadClosure { +class ZRootsIteratorClosure : public OopClosure { public: - virtual void do_thread(Thread* thread); + virtual void do_thread(Thread* thread) {} }; typedef OopStorage::ParState ZOopStorageIterator; From 865c33112c3be23e126e3c51259c2881e9088271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Lid=C3=A9n?= Date: Wed, 20 Feb 2019 13:43:28 +0100 Subject: [PATCH 038/109] 8218767: ZGC: Do not assume that r12 is a special register in C2 Reviewed-by: eosterlund, rkennke --- src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp | 2 +- src/hotspot/cpu/x86/gc/z/z_x86_64.ad | 3 +-- src/hotspot/cpu/x86/x86_64.ad | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp index c51519fa746..114d76372b3 100644 --- a/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp @@ -359,7 +359,7 @@ void ZBarrierSetAssembler::generate_c1_load_barrier_runtime_stub(StubAssembler* // ZBarrierSetRuntime::load_barrier_on_weak_oop_field_preloaded(). static address generate_load_barrier_stub(StubCodeGenerator* cgen, Register raddr, DecoratorSet decorators) { // Don't generate stub for invalid registers - if (raddr == rsp || raddr == r12 || raddr == r15) { + if (raddr == rsp || raddr == r15) { return NULL; } diff --git a/src/hotspot/cpu/x86/gc/z/z_x86_64.ad b/src/hotspot/cpu/x86/gc/z/z_x86_64.ad index d3d6d32b20f..e92d24696e0 100644 --- a/src/hotspot/cpu/x86/gc/z/z_x86_64.ad +++ b/src/hotspot/cpu/x86/gc/z/z_x86_64.ad @@ -26,9 +26,8 @@ source %{ #include "gc/z/zBarrierSetAssembler.hpp" static void z_load_barrier_slow_reg(MacroAssembler& _masm, Register dst, Address src, bool weak) { - assert(dst != r12, "Invalid register"); - assert(dst != r15, "Invalid register"); assert(dst != rsp, "Invalid register"); + assert(dst != r15, "Invalid register"); const address stub = weak ? ZBarrierSet::assembler()->load_barrier_weak_slow_stub(dst) : ZBarrierSet::assembler()->load_barrier_slow_stub(dst); diff --git a/src/hotspot/cpu/x86/x86_64.ad b/src/hotspot/cpu/x86/x86_64.ad index c167012f120..20f435d5c28 100644 --- a/src/hotspot/cpu/x86/x86_64.ad +++ b/src/hotspot/cpu/x86/x86_64.ad @@ -354,7 +354,7 @@ RegMask _STACK_OR_LONG_REG_mask; RegMask _STACK_OR_INT_REG_mask; static bool need_r12_heapbase() { - return UseCompressedOops || UseCompressedClassPointers || UseZGC; + return UseCompressedOops || UseCompressedClassPointers; } void reg_mask_init() { From f4ac0a2e0f6327a9b43f987b501b31ac878d6bfb Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Wed, 20 Feb 2019 08:10:40 -0500 Subject: [PATCH 039/109] 8167548: [TESTBUG] Logging tests put log files in source tree Create log files in temp directory, instead of cwd. Reviewed-by: coleenp, dholmes --- src/hotspot/share/logging/logFileOutput.cpp | 9 +++++++ src/hotspot/share/logging/logFileOutput.hpp | 1 + test/hotspot/gtest/logging/logTestFixture.cpp | 13 +++++----- .../gtest/logging/logTestUtils.inline.hpp | 26 ++++++++++++++++++- .../gtest/logging/test_logConfiguration.cpp | 15 +++++------ .../gtest/logging/test_logFileOutput.cpp | 20 ++++++-------- .../logging/test_logTagSetDescriptions.cpp | 5 ++-- 7 files changed, 60 insertions(+), 29 deletions(-) diff --git a/src/hotspot/share/logging/logFileOutput.cpp b/src/hotspot/share/logging/logFileOutput.cpp index de3e4ddb93d..81a42822b45 100644 --- a/src/hotspot/share/logging/logFileOutput.cpp +++ b/src/hotspot/share/logging/logFileOutput.cpp @@ -51,6 +51,14 @@ LogFileOutput::LogFileOutput(const char* name) _file_name = make_file_name(name + strlen(Prefix), _pid_str, _vm_start_time_str); } +const char* LogFileOutput::cur_log_file_name() { + if (strlen(_archive_name) == 0) { + return _file_name; + } else { + return _archive_name; + } +} + void LogFileOutput::set_file_name_parameters(jlong vm_start_time) { int res = jio_snprintf(_pid_str, sizeof(_pid_str), "%d", os::current_process_id()); assert(res > 0, "PID buffer too small"); @@ -234,6 +242,7 @@ bool LogFileOutput::initialize(const char* options, outputStream* errstream) { _file_count_max_digits = number_of_digits(_file_count - 1); _archive_name_len = 2 + strlen(_file_name) + _file_count_max_digits; _archive_name = NEW_C_HEAP_ARRAY(char, _archive_name_len, mtLogging); + _archive_name[0] = 0; } log_trace(logging)("Initializing logging to file '%s' (filecount: %u" diff --git a/src/hotspot/share/logging/logFileOutput.hpp b/src/hotspot/share/logging/logFileOutput.hpp index b8d366cb288..5301816313d 100644 --- a/src/hotspot/share/logging/logFileOutput.hpp +++ b/src/hotspot/share/logging/logFileOutput.hpp @@ -92,6 +92,7 @@ class LogFileOutput : public LogFileStreamOutput { return _name; } + const char* cur_log_file_name(); static const char* const Prefix; static void set_file_name_parameters(jlong start_time); }; diff --git a/test/hotspot/gtest/logging/logTestFixture.cpp b/test/hotspot/gtest/logging/logTestFixture.cpp index 5c0bd00c2bb..bc153b76fb9 100644 --- a/test/hotspot/gtest/logging/logTestFixture.cpp +++ b/test/hotspot/gtest/logging/logTestFixture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, 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 @@ -33,11 +33,12 @@ #include "utilities/ostream.hpp" LogTestFixture::LogTestFixture() : _n_snapshots(0), _configuration_snapshot(NULL) { - // Set up TestLogFileName to include PID, testcase name and test name - int ret = jio_snprintf(_filename, sizeof(_filename), "testlog.pid%d.%s.%s.log", - os::current_process_id(), - ::testing::UnitTest::GetInstance()->current_test_info()->test_case_name(), - ::testing::UnitTest::GetInstance()->current_test_info()->name()); + + // Set up TestLogFileName to include temp_dir, PID, testcase name and test name. + const testing::TestInfo* test_info = ::testing::UnitTest::GetInstance()->current_test_info(); + int ret = jio_snprintf(_filename, sizeof(_filename), "%s%stestlog.pid%d.%s.%s.log", + os::get_temp_directory(), os::file_separator(), os::current_process_id(), + test_info->test_case_name(), test_info->name()); EXPECT_GT(ret, 0) << "_filename buffer issue"; TestLogFileName = _filename; diff --git a/test/hotspot/gtest/logging/logTestUtils.inline.hpp b/test/hotspot/gtest/logging/logTestUtils.inline.hpp index 5e97882b975..c1bc288a38d 100644 --- a/test/hotspot/gtest/logging/logTestUtils.inline.hpp +++ b/test/hotspot/gtest/logging/logTestUtils.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, 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 @@ -88,6 +88,30 @@ static inline void init_log_file(const char* filename, const char* options = "") guarantee(success, "Failed to disable logging to file '%s'", filename); } +static const char* tmp_dir = os::get_temp_directory(); +static const char* file_sep = os::file_separator(); + +// Prepend filename with the temp directory and pid and return the result as a +// resource allocated string. +static inline char* prepend_temp_dir(const char* filename) { + size_t temp_file_len = strlen(tmp_dir) + strlen(file_sep) + strlen(filename) + 28; + char* temp_file = NEW_RESOURCE_ARRAY(char, temp_file_len); + int ret = jio_snprintf(temp_file, temp_file_len, "%s%spid%d.%s", + tmp_dir, file_sep, + os::current_process_id(), filename); + return temp_file; +} + +// Prepend filename with specified prefix and the temp directory and return the +// result as a malloc allocated string. This is used by test_logFileOutput.cpp. +static inline char* prepend_prefix_temp_dir(const char* prefix, const char* filename) { + size_t temp_file_len = strlen(prefix) + strlen(tmp_dir) + strlen(file_sep) + strlen(filename) + 1; + char* temp_file = (char*)os::malloc(temp_file_len, mtLogging); + int ret = jio_snprintf(temp_file, temp_file_len, "%s%s%s%s", + prefix, tmp_dir, file_sep, filename); + return temp_file; +} + // Read a complete line from fp and return it as a resource allocated string. // Returns NULL on EOF. static inline char* read_line(FILE* fp) { diff --git a/test/hotspot/gtest/logging/test_logConfiguration.cpp b/test/hotspot/gtest/logging/test_logConfiguration.cpp index 4a9b311199a..cce867f43ec 100644 --- a/test/hotspot/gtest/logging/test_logConfiguration.cpp +++ b/test/hotspot/gtest/logging/test_logConfiguration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, 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 @@ -403,16 +403,15 @@ TEST_VM_F(LogConfigurationTest, output_name_normalization) { // Make sure prefixes are ignored when used within quotes // (this should create a log with "file=" in its filename) - int ret = jio_snprintf(buf, sizeof(buf), "\"file=%s\"", TestLogFileName); - ASSERT_NE(-1, ret); - set_log_config(buf, "logging=trace"); + // Note that the filename cannot contain directories because + // it is being prefixed with "file=". + const char* leafFileName = "\"file=leaf_file_name\""; + set_log_config(leafFileName, "logging=trace"); EXPECT_TRUE(is_described("#3: ")) << "prefix within quotes not ignored as it should be"; - set_log_config(buf, "all=off"); + set_log_config(leafFileName, "all=off"); // Remove the extra log file created - ret = jio_snprintf(buf, sizeof(buf), "file=%s", TestLogFileName); - ASSERT_NE(-1, ret); - delete_file(buf); + delete_file("file=leaf_file_name"); } static size_t count_occurrences(const char* haystack, const char* needle) { diff --git a/test/hotspot/gtest/logging/test_logFileOutput.cpp b/test/hotspot/gtest/logging/test_logFileOutput.cpp index 24cdf83c15d..20e3d07e894 100644 --- a/test/hotspot/gtest/logging/test_logFileOutput.cpp +++ b/test/hotspot/gtest/logging/test_logFileOutput.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, 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 @@ -31,7 +31,7 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/ostream.hpp" -static const char* name = "file=testlog.pid%p.%t.log"; +static const char* name = prepend_prefix_temp_dir("file=", "testlog.pid%p.%t.log"); // Test parsing a bunch of valid file output options TEST_VM(LogFileOutput, parse_valid) { @@ -46,11 +46,6 @@ TEST_VM(LogFileOutput, parse_valid) { // Override LogOutput's vm_start time to get predictable file name LogFileOutput::set_file_name_parameters(0); - char expected_filename[1 * K]; - int ret = jio_snprintf(expected_filename, sizeof(expected_filename), - "testlog.pid%d.1970-01-01_01-00-00.log", - os::current_process_id()); - ASSERT_GT(ret, 0) << "Buffer too small"; for (size_t i = 0; i < ARRAY_SIZE(valid_options); i++) { ResourceMark rm; @@ -60,8 +55,8 @@ TEST_VM(LogFileOutput, parse_valid) { EXPECT_STREQ(name, fo.name()); EXPECT_TRUE(fo.initialize(valid_options[i], &ss)) << "Did not accept valid option(s) '" << valid_options[i] << "': " << ss.as_string(); + remove(fo.cur_log_file_name()); } - remove(expected_filename); } } @@ -105,11 +100,11 @@ TEST_VM(LogFileOutput, filesize_overflow) { } TEST_VM(LogFileOutput, startup_rotation) { + ResourceMark rm; const size_t rotations = 5; - const char* filename = "start-rotate-test"; + const char* filename = prepend_temp_dir("start-rotate-test"); char* rotated_file[rotations]; - ResourceMark rm; for (size_t i = 0; i < rotations; i++) { size_t len = strlen(filename) + 3; rotated_file[i] = NEW_RESOURCE_ARRAY(char, len); @@ -142,8 +137,9 @@ TEST_VM(LogFileOutput, startup_rotation) { } TEST_VM(LogFileOutput, startup_truncation) { - const char* filename = "start-truncate-test"; - const char* archived_filename = "start-truncate-test.0"; + ResourceMark rm; + const char* filename = prepend_temp_dir("start-truncate-test"); + const char* archived_filename = prepend_temp_dir("start-truncate-test.0"); delete_file(filename); delete_file(archived_filename); diff --git a/test/hotspot/gtest/logging/test_logTagSetDescriptions.cpp b/test/hotspot/gtest/logging/test_logTagSetDescriptions.cpp index bc2d8232335..7cb37ff4349 100644 --- a/test/hotspot/gtest/logging/test_logTagSetDescriptions.cpp +++ b/test/hotspot/gtest/logging/test_logTagSetDescriptions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,7 +48,8 @@ TEST_VM(LogTagSetDescriptions, describe) { } TEST_VM(LogTagSetDescriptions, command_line_help) { - const char* filename = "logtagset_descriptions"; + ResourceMark rm; + const char* filename = prepend_temp_dir("logtagset_descriptions"); FILE* fp = fopen(filename, "w+"); ASSERT_NE((void*)NULL, fp); fileStream stream(fp); From eaab45a8b8235892cb280f9e5d3ee36fe51193d2 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Wed, 20 Feb 2019 14:30:33 +0100 Subject: [PATCH 040/109] 8219096: Merge print_termination_stats code with current logging Reviewed-by: lkorinth, kbarrett --- src/hotspot/share/gc/g1/g1Allocator.cpp | 20 +++++-- src/hotspot/share/gc/g1/g1Allocator.hpp | 3 +- src/hotspot/share/gc/g1/g1CollectedHeap.cpp | 52 ++++--------------- src/hotspot/share/gc/g1/g1CollectedHeap.hpp | 10 ---- src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp | 5 ++ src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp | 8 +++ .../share/gc/g1/g1ParScanThreadState.cpp | 10 ++-- .../share/gc/g1/g1ParScanThreadState.hpp | 5 +- .../jtreg/gc/g1/TestGCLogMessages.java | 4 ++ 9 files changed, 53 insertions(+), 64 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1Allocator.cpp b/src/hotspot/share/gc/g1/g1Allocator.cpp index 05fd6fbb841..00440f97217 100644 --- a/src/hotspot/share/gc/g1/g1Allocator.cpp +++ b/src/hotspot/share/gc/g1/g1Allocator.cpp @@ -321,16 +321,26 @@ void G1PLABAllocator::flush_and_retire_stats() { } } -void G1PLABAllocator::waste(size_t& wasted, size_t& undo_wasted) { - wasted = 0; - undo_wasted = 0; +size_t G1PLABAllocator::waste() const { + size_t result = 0; for (uint state = 0; state < InCSetState::Num; state++) { PLAB * const buf = _alloc_buffers[state]; if (buf != NULL) { - wasted += buf->waste(); - undo_wasted += buf->undo_waste(); + result += buf->waste(); } } + return result; +} + +size_t G1PLABAllocator::undo_waste() const { + size_t result = 0; + for (uint state = 0; state < InCSetState::Num; state++) { + PLAB * const buf = _alloc_buffers[state]; + if (buf != NULL) { + result += buf->undo_waste(); + } + } + return result; } bool G1ArchiveAllocator::_archive_check_enabled = false; diff --git a/src/hotspot/share/gc/g1/g1Allocator.hpp b/src/hotspot/share/gc/g1/g1Allocator.hpp index 25f0e2f9599..1d3c210d9e9 100644 --- a/src/hotspot/share/gc/g1/g1Allocator.hpp +++ b/src/hotspot/share/gc/g1/g1Allocator.hpp @@ -155,7 +155,8 @@ private: public: G1PLABAllocator(G1Allocator* allocator); - void waste(size_t& wasted, size_t& undo_wasted); + size_t waste() const; + size_t undo_waste() const; // Allocate word_sz words in dest, either directly into the regions or by // allocating a new PLAB. Returns the address of the allocated memory, NULL if diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp index 39670c99870..a715e597455 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp @@ -3299,27 +3299,22 @@ public: G1GCPhaseTimes* p = _g1h->g1_policy()->phase_times(); p->add_time_secs(G1GCPhaseTimes::ObjCopy, worker_id, elapsed_sec - term_sec); + + p->record_or_add_thread_work_item(G1GCPhaseTimes::ObjCopy, + worker_id, + pss->lab_waste_words() * HeapWordSize, + G1GCPhaseTimes::ObjCopyLABWaste); + p->record_or_add_thread_work_item(G1GCPhaseTimes::ObjCopy, + worker_id, + pss->lab_undo_waste_words() * HeapWordSize, + G1GCPhaseTimes::ObjCopyLABUndoWaste); + p->record_time_secs(G1GCPhaseTimes::Termination, worker_id, term_sec); p->record_thread_work_item(G1GCPhaseTimes::Termination, worker_id, evac_term_attempts); } assert(pss->queue_is_empty(), "should be empty"); - if (log_is_enabled(Debug, gc, task, stats)) { - MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); - size_t lab_waste; - size_t lab_undo_waste; - pss->waste(lab_waste, lab_undo_waste); - _g1h->print_termination_stats(worker_id, - (os::elapsedTime() - start_sec) * 1000.0, /* elapsed time */ - strong_roots_sec * 1000.0, /* strong roots time */ - term_sec * 1000.0, /* evac term time */ - evac_term_attempts, /* evac term attempts */ - lab_waste, /* alloc buffer waste */ - lab_undo_waste /* undo waste */ - ); - } - // Close the inner scope so that the ResourceMark and HandleMark // destructors are executed here and are included as part of the // "GC Worker Time". @@ -3328,31 +3323,6 @@ public: } }; -void G1CollectedHeap::print_termination_stats_hdr() { - log_debug(gc, task, stats)("GC Termination Stats"); - log_debug(gc, task, stats)(" elapsed --strong roots-- -------termination------- ------waste (KiB)------"); - log_debug(gc, task, stats)("thr ms ms %% ms %% attempts total alloc undo"); - log_debug(gc, task, stats)("--- --------- --------- ------ --------- ------ -------- ------- ------- -------"); -} - -void G1CollectedHeap::print_termination_stats(uint worker_id, - double elapsed_ms, - double strong_roots_ms, - double term_ms, - size_t term_attempts, - size_t alloc_buffer_waste, - size_t undo_waste) const { - log_debug(gc, task, stats) - ("%3d %9.2f %9.2f %6.2f " - "%9.2f %6.2f " SIZE_FORMAT_W(8) " " - SIZE_FORMAT_W(7) " " SIZE_FORMAT_W(7) " " SIZE_FORMAT_W(7), - worker_id, elapsed_ms, strong_roots_ms, strong_roots_ms * 100 / elapsed_ms, - term_ms, term_ms * 100 / elapsed_ms, term_attempts, - (alloc_buffer_waste + undo_waste) * HeapWordSize / K, - alloc_buffer_waste * HeapWordSize / K, - undo_waste * HeapWordSize / K); -} - void G1CollectedHeap::complete_cleaning(BoolObjectClosure* is_alive, bool class_unloading_occurred) { uint num_workers = workers()->active_workers(); @@ -3763,8 +3733,6 @@ void G1CollectedHeap::evacuate_collection_set(G1ParScanThreadStateSet* per_threa G1RootProcessor root_processor(this, n_workers); G1ParTask g1_par_task(this, per_thread_states, _task_queues, &root_processor, n_workers); - print_termination_stats_hdr(); - workers()->run_task(&g1_par_task); end_par_time_sec = os::elapsedTime(); diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp index 7e76807fc69..8f2e8203133 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp @@ -738,16 +738,6 @@ private: void pre_evacuate_collection_set(); void post_evacuate_collection_set(G1EvacuationInfo& evacuation_info, G1ParScanThreadStateSet* pss); - // Print the header for the per-thread termination statistics. - static void print_termination_stats_hdr(); - // Print actual per-thread termination statistics. - void print_termination_stats(uint worker_id, - double elapsed_ms, - double strong_roots_ms, - double term_ms, - size_t term_attempts, - size_t alloc_buffer_waste, - size_t undo_waste) const; // Update object copying statistics. void record_obj_copy_mem_stats(); diff --git a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp index b469d1cf2e8..4cc36acf5e1 100644 --- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp +++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp @@ -107,6 +107,11 @@ G1GCPhaseTimes::G1GCPhaseTimes(STWGCTimer* gc_timer, uint max_gc_threads) : _update_rs_skipped_cards = new WorkerDataArray(max_gc_threads, "Skipped Cards:"); _gc_par_phases[UpdateRS]->link_thread_work_items(_update_rs_skipped_cards, UpdateRSSkippedCards); + _obj_copy_lab_waste = new WorkerDataArray(max_gc_threads, "LAB Waste"); + _gc_par_phases[ObjCopy]->link_thread_work_items(_obj_copy_lab_waste, ObjCopyLABWaste); + _obj_copy_lab_undo_waste = new WorkerDataArray(max_gc_threads, "LAB Undo Waste"); + _gc_par_phases[ObjCopy]->link_thread_work_items(_obj_copy_lab_undo_waste, ObjCopyLABUndoWaste); + _termination_attempts = new WorkerDataArray(max_gc_threads, "Termination Attempts:"); _gc_par_phases[Termination]->link_thread_work_items(_termination_attempts); diff --git a/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp b/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp index 1f3fcd529ac..1b849403d60 100644 --- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp +++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp @@ -93,6 +93,11 @@ class G1GCPhaseTimes : public CHeapObj { UpdateRSSkippedCards }; + enum GCObjCopyWorkItems { + ObjCopyLABWaste, + ObjCopyLABUndoWaste + }; + enum GCOptCSetWorkItems { OptCSetScannedCards, OptCSetClaimedCards, @@ -114,6 +119,9 @@ class G1GCPhaseTimes : public CHeapObj { WorkerDataArray* _scan_rs_claimed_cards; WorkerDataArray* _scan_rs_skipped_cards; + WorkerDataArray* _obj_copy_lab_waste; + WorkerDataArray* _obj_copy_lab_undo_waste; + WorkerDataArray* _opt_cset_scanned_cards; WorkerDataArray* _opt_cset_claimed_cards; WorkerDataArray* _opt_cset_skipped_cards; diff --git a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp index 88b21177f10..bfdfd03bd23 100644 --- a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp +++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, 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 @@ -106,8 +106,12 @@ G1ParScanThreadState::~G1ParScanThreadState() { delete[] _oops_into_optional_regions; } -void G1ParScanThreadState::waste(size_t& wasted, size_t& undo_wasted) { - _plab_allocator->waste(wasted, undo_wasted); +size_t G1ParScanThreadState::lab_waste_words() const { + return _plab_allocator->waste(); +} + +size_t G1ParScanThreadState::lab_undo_waste_words() const { + return _plab_allocator->undo_waste(); } #ifdef ASSERT diff --git a/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp b/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp index cc1e2aa9b48..d850eb65b1f 100644 --- a/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp +++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp @@ -127,9 +127,8 @@ public: G1EvacuationRootClosures* closures() { return _closures; } uint worker_id() { return _worker_id; } - // Returns the current amount of waste due to alignment or not being able to fit - // objects within LABs and the undo waste. - virtual void waste(size_t& wasted, size_t& undo_wasted); + size_t lab_waste_words() const; + size_t lab_undo_waste_words() const; size_t* surviving_young_words() { // We add one to hide entry 0 which accumulates surviving words for diff --git a/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java b/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java index 8c0a2baff50..b1423e632f5 100644 --- a/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java +++ b/test/hotspot/jtreg/gc/g1/TestGCLogMessages.java @@ -106,6 +106,10 @@ public class TestGCLogMessages { new LogMessageWithLevel("Scanned Cards", Level.DEBUG), new LogMessageWithLevel("Claimed Cards", Level.DEBUG), new LogMessageWithLevel("Skipped Cards", Level.DEBUG), + // Object Copy + new LogMessageWithLevel("Object Copy", Level.DEBUG), + new LogMessageWithLevel("Scanned Cards", Level.DEBUG), + new LogMessageWithLevel("Claimed Cards", Level.DEBUG), // Ext Root Scan new LogMessageWithLevel("Thread Roots", Level.TRACE), new LogMessageWithLevel("Universe Roots", Level.TRACE), From 50316d71641107ad060d28afe3606711064d19ae Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Wed, 20 Feb 2019 08:31:40 -0500 Subject: [PATCH 041/109] 8219244: NMT: Change ThreadSafepointState's allocation type from mtInternal to mtThread Reviewed-by: coleenp, minqi --- src/hotspot/share/runtime/safepoint.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/runtime/safepoint.hpp b/src/hotspot/share/runtime/safepoint.hpp index 4d2bf520c63..2779395af9f 100644 --- a/src/hotspot/share/runtime/safepoint.hpp +++ b/src/hotspot/share/runtime/safepoint.hpp @@ -197,7 +197,7 @@ public: assert(!SafepointSynchronize::is_at_safepoint(), __VA_ARGS__) // State class for a thread suspended at a safepoint -class ThreadSafepointState: public CHeapObj { +class ThreadSafepointState: public CHeapObj { private: // At polling page safepoint (NOT a poll return safepoint): volatile bool _at_poll_safepoint; From 2e8fc8328a439c760e3bc7a7208ff6e0eda30525 Mon Sep 17 00:00:00 2001 From: Robbin Ehn Date: Wed, 20 Feb 2019 14:44:58 +0100 Subject: [PATCH 042/109] 8219441: test_logMessageTest missing static storage Reviewed-by: shade --- test/hotspot/gtest/logging/test_logMessageTest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/hotspot/gtest/logging/test_logMessageTest.cpp b/test/hotspot/gtest/logging/test_logMessageTest.cpp index 5540b6c5424..8aba848c9ab 100644 --- a/test/hotspot/gtest/logging/test_logMessageTest.cpp +++ b/test/hotspot/gtest/logging/test_logMessageTest.cpp @@ -39,6 +39,8 @@ protected: ~LogMessageTest(); }; +Log(logging) LogMessageTest::_log; + const char* LogMessageTest::_level_filename[] = { NULL, // LogLevel::Off #define LOG_LEVEL(name, printname) "multiline-" #printname ".log", From 2cc6f5951c7485ff8e7adf0647203dc6ec08e3f9 Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Wed, 20 Feb 2019 10:22:46 -0500 Subject: [PATCH 043/109] 8219370: NMT: Move synchronization primitives from mtInternal to mtSynchronizer Reviewed-by: dholmes, rehn --- src/hotspot/os/posix/os_posix.hpp | 6 +++--- src/hotspot/os/solaris/os_solaris.hpp | 6 +++--- src/hotspot/os/windows/os_windows.hpp | 6 +++--- src/hotspot/share/memory/allocation.hpp | 1 + src/hotspot/share/runtime/monitorChunk.cpp | 4 ++-- src/hotspot/share/runtime/monitorChunk.hpp | 2 +- src/hotspot/share/runtime/mutex.hpp | 2 +- src/hotspot/share/runtime/semaphore.hpp | 2 +- 8 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/hotspot/os/posix/os_posix.hpp b/src/hotspot/os/posix/os_posix.hpp index 40501fdf488..64f257e265e 100644 --- a/src/hotspot/os/posix/os_posix.hpp +++ b/src/hotspot/os/posix/os_posix.hpp @@ -177,7 +177,7 @@ private: * These event objects are type-stable and immortal - we never delete them. * Events are associated with a thread for the lifetime of the thread. */ -class PlatformEvent : public CHeapObj { +class PlatformEvent : public CHeapObj { private: double cachePad[4]; // Increase odds that _mutex is sole occupant of cache line volatile int _event; // Event count/permit: -1, 0 or 1 @@ -212,7 +212,7 @@ class PlatformEvent : public CHeapObj { // API updates of course). But Parker methods use fastpaths that break that // level of encapsulation - so combining the two remains a future project. -class PlatformParker : public CHeapObj { +class PlatformParker : public CHeapObj { protected: enum { REL_INDEX = 0, @@ -230,7 +230,7 @@ class PlatformParker : public CHeapObj { }; // Platform specific implementation that underpins VM Monitor/Mutex class -class PlatformMonitor : public CHeapObj { +class PlatformMonitor : public CHeapObj { private: pthread_mutex_t _mutex; // Native mutex for locking pthread_cond_t _cond; // Native condition variable for blocking diff --git a/src/hotspot/os/solaris/os_solaris.hpp b/src/hotspot/os/solaris/os_solaris.hpp index 84200b26a3e..a350d95185c 100644 --- a/src/hotspot/os/solaris/os_solaris.hpp +++ b/src/hotspot/os/solaris/os_solaris.hpp @@ -281,7 +281,7 @@ class Solaris { }; -class PlatformEvent : public CHeapObj { +class PlatformEvent : public CHeapObj { private: double CachePad[4]; // increase odds that _mutex is sole occupant of cache line volatile int _Event; @@ -317,7 +317,7 @@ class PlatformEvent : public CHeapObj { void unpark(); }; -class PlatformParker : public CHeapObj { +class PlatformParker : public CHeapObj { protected: mutex_t _mutex[1]; cond_t _cond[1]; @@ -336,7 +336,7 @@ class PlatformParker : public CHeapObj { }; // Platform specific implementation that underpins VM Monitor/Mutex class -class PlatformMonitor : public CHeapObj { +class PlatformMonitor : public CHeapObj { private: mutex_t _mutex; // Native mutex for locking cond_t _cond; // Native condition variable for blocking diff --git a/src/hotspot/os/windows/os_windows.hpp b/src/hotspot/os/windows/os_windows.hpp index b3dd578bb8d..a8d50a8bb5b 100644 --- a/src/hotspot/os/windows/os_windows.hpp +++ b/src/hotspot/os/windows/os_windows.hpp @@ -148,7 +148,7 @@ private: static volatile intptr_t _crash_mux; }; -class PlatformEvent : public CHeapObj { +class PlatformEvent : public CHeapObj { private: double CachePad [4] ; // increase odds that _Event is sole occupant of cache line volatile int _Event ; @@ -174,7 +174,7 @@ class PlatformEvent : public CHeapObj { -class PlatformParker : public CHeapObj { +class PlatformParker : public CHeapObj { protected: HANDLE _ParkEvent ; @@ -188,7 +188,7 @@ class PlatformParker : public CHeapObj { } ; // Platform specific implementation that underpins VM Monitor/Mutex class -class PlatformMonitor : public CHeapObj { +class PlatformMonitor : public CHeapObj { private: CRITICAL_SECTION _mutex; // Native mutex for locking CONDITION_VARIABLE _cond; // Native condition variable for blocking diff --git a/src/hotspot/share/memory/allocation.hpp b/src/hotspot/share/memory/allocation.hpp index 2906efce442..17273c08c7e 100644 --- a/src/hotspot/share/memory/allocation.hpp +++ b/src/hotspot/share/memory/allocation.hpp @@ -132,6 +132,7 @@ class AllocatedObj { f(mtArguments, "Arguments") \ f(mtModule, "Module") \ f(mtSafepoint, "Safepoint") \ + f(mtSynchronizer, "Synchronization") \ f(mtNone, "Unknown") \ //end diff --git a/src/hotspot/share/runtime/monitorChunk.cpp b/src/hotspot/share/runtime/monitorChunk.cpp index a7e0237d8ec..32c5069087e 100644 --- a/src/hotspot/share/runtime/monitorChunk.cpp +++ b/src/hotspot/share/runtime/monitorChunk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ MonitorChunk::MonitorChunk(int number_on_monitors) { _number_of_monitors = number_on_monitors; - _monitors = NEW_C_HEAP_ARRAY(BasicObjectLock, number_on_monitors, mtInternal); + _monitors = NEW_C_HEAP_ARRAY(BasicObjectLock, number_on_monitors, mtSynchronizer); _next = NULL; } diff --git a/src/hotspot/share/runtime/monitorChunk.hpp b/src/hotspot/share/runtime/monitorChunk.hpp index 9a59cf04353..0c2f2dfae02 100644 --- a/src/hotspot/share/runtime/monitorChunk.hpp +++ b/src/hotspot/share/runtime/monitorChunk.hpp @@ -30,7 +30,7 @@ // Data structure for holding monitors for one activation during // deoptimization. -class MonitorChunk: public CHeapObj { +class MonitorChunk: public CHeapObj { private: int _number_of_monitors; BasicObjectLock* _monitors; diff --git a/src/hotspot/share/runtime/mutex.hpp b/src/hotspot/share/runtime/mutex.hpp index 932249ec538..91751c6d212 100644 --- a/src/hotspot/share/runtime/mutex.hpp +++ b/src/hotspot/share/runtime/mutex.hpp @@ -39,7 +39,7 @@ // TODO: Check if _name[MONITOR_NAME_LEN] should better get replaced by const char*. static const int MONITOR_NAME_LEN = 64; -class Monitor : public CHeapObj { +class Monitor : public CHeapObj { public: // A special lock: Is a lock where you are guaranteed not to block while you are diff --git a/src/hotspot/share/runtime/semaphore.hpp b/src/hotspot/share/runtime/semaphore.hpp index 73e94587e49..f94a41cf12b 100644 --- a/src/hotspot/share/runtime/semaphore.hpp +++ b/src/hotspot/share/runtime/semaphore.hpp @@ -40,7 +40,7 @@ class JavaThread; // Implements the limited, platform independent Semaphore API. -class Semaphore : public CHeapObj { +class Semaphore : public CHeapObj { SemaphoreImpl _impl; // Prevent copying and assignment of Semaphore instances. From 96e4678510a8284dfd9e4b37db0dfefc110e75cd Mon Sep 17 00:00:00 2001 From: Roman Kennke Date: Wed, 20 Feb 2019 16:29:29 +0100 Subject: [PATCH 044/109] 8203232: Shenandoah: Resolve oops in SATB filter Reviewed-by: shade --- .../share/gc/shenandoah/shenandoahBarrierSet.cpp | 2 +- .../share/gc/shenandoah/shenandoahHeap.hpp | 1 + .../share/gc/shenandoah/shenandoahHeap.inline.hpp | 7 ++++++- .../gc/shenandoah/shenandoahSATBMarkQueueSet.cpp | 15 ++++++++------- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp index 25ded749c54..167961a3ccb 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp @@ -335,7 +335,7 @@ void ShenandoahBarrierSet::enqueue(oop obj) { // Filter marked objects before hitting the SATB queues. The same predicate would // be used by SATBMQ::filter to eliminate already marked objects downstream, but // filtering here helps to avoid wasteful SATB queueing work to begin with. - if (!_heap->requires_marking(obj)) return; + if (!_heap->requires_marking(obj)) return; Thread* thr = Thread::current(); if (thr->is_Java_thread()) { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp index aba966e0270..cf4edaa562e 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp @@ -676,6 +676,7 @@ public: void reset_mark_bitmap(); // SATB barriers hooks + template inline bool requires_marking(const void* entry) const; void force_satb_flush_all_threads(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp index 16f86beec53..fe5396393ad 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp @@ -316,8 +316,13 @@ inline oop ShenandoahHeap::evacuate_object(oop p, Thread* thread) { } } +template inline bool ShenandoahHeap::requires_marking(const void* entry) const { - return !_marking_context->is_marked(oop(entry)); + oop obj = oop(entry); + if (RESOLVE) { + obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); + } + return !_marking_context->is_marked(obj); } template diff --git a/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp b/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp index eb4fd1791c0..1f7d333d7fb 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.cpp @@ -49,12 +49,9 @@ SATBMarkQueue& ShenandoahSATBMarkQueueSet::satb_queue_for_thread(JavaThread* con return ShenandoahThreadLocalData::satb_mark_queue(t); } -static inline bool discard_entry(const void* entry, ShenandoahHeap* heap) { - return !heap->requires_marking(entry); -} - +template class ShenandoahSATBMarkQueueFilterFn { - ShenandoahHeap* _heap; + ShenandoahHeap* const _heap; public: ShenandoahSATBMarkQueueFilterFn(ShenandoahHeap* heap) : _heap(heap) {} @@ -62,13 +59,17 @@ public: // Return true if entry should be filtered out (removed), false if // it should be retained. bool operator()(const void* entry) const { - return discard_entry(entry, _heap); + return !_heap->requires_marking(entry); } }; void ShenandoahSATBMarkQueueSet::filter(SATBMarkQueue* queue) { assert(_heap != NULL, "SATB queue set not initialized"); - apply_filter(ShenandoahSATBMarkQueueFilterFn(_heap), queue); + if (_heap->has_forwarded_objects()) { + apply_filter(ShenandoahSATBMarkQueueFilterFn(_heap), queue); + } else { + apply_filter(ShenandoahSATBMarkQueueFilterFn(_heap), queue); + } } bool ShenandoahSATBMarkQueue::should_enqueue_buffer() { From ea42bbcd2483554f721090b5efb18f1fb25c8f6d Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Wed, 20 Feb 2019 09:43:01 -0800 Subject: [PATCH 045/109] 8219142: Remove unused JIMAGE_ResourcePath Reviewed-by: dholmes, alanb --- src/hotspot/share/classfile/classLoader.cpp | 3 - .../share/native/libjimage/imageFile.cpp | 61 +------------------ .../share/native/libjimage/imageFile.hpp | 5 +- .../share/native/libjimage/jimage.cpp | 28 +-------- .../share/native/libjimage/jimage.hpp | 19 +----- 5 files changed, 4 insertions(+), 112 deletions(-) diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index e511a834cf8..ed1dbdca4d8 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -101,7 +101,6 @@ static JImagePackageToModule_t JImagePackageToModule = NULL; static JImageFindResource_t JImageFindResource = NULL; static JImageGetResource_t JImageGetResource = NULL; static JImageResourceIterator_t JImageResourceIterator = NULL; -static JImage_ResourcePath_t JImageResourcePath = NULL; // Globals @@ -1094,8 +1093,6 @@ void ClassLoader::load_jimage_library() { guarantee(JImageGetResource != NULL, "function JIMAGE_GetResource not found"); JImageResourceIterator = CAST_TO_FN_PTR(JImageResourceIterator_t, os::dll_lookup(handle, "JIMAGE_ResourceIterator")); guarantee(JImageResourceIterator != NULL, "function JIMAGE_ResourceIterator not found"); - JImageResourcePath = CAST_TO_FN_PTR(JImage_ResourcePath_t, os::dll_lookup(handle, "JIMAGE_ResourcePath")); - guarantee(JImageResourcePath != NULL, "function JIMAGE_ResourcePath not found"); } jboolean ClassLoader::decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg) { diff --git a/src/java.base/share/native/libjimage/imageFile.cpp b/src/java.base/share/native/libjimage/imageFile.cpp index 90ca70d694f..95479894977 100644 --- a/src/java.base/share/native/libjimage/imageFile.cpp +++ b/src/java.base/share/native/libjimage/imageFile.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -481,65 +481,6 @@ u4 ImageFileReader::find_location_index(const char* path, u8 *size) const { return 0; // not found } -// Assemble the location path from the string fragments indicated in the location attributes. -void ImageFileReader::location_path(ImageLocation& location, char* path, size_t max) const { - // Manage the image string table. - ImageStrings strings(_string_bytes, _header.strings_size(_endian)); - // Position to first character of the path buffer. - char* next = path; - // Temp for string length. - size_t length; - // Get module string. - const char* module = location.get_attribute(ImageLocation::ATTRIBUTE_MODULE, strings); - // If module string is not empty string. - if (*module != '\0') { - // Get length of module name. - length = strlen(module); - // Make sure there is no buffer overflow. - assert(next - path + length + 2 < max && "buffer overflow"); - // Append '/module/'. - *next++ = '/'; - strncpy(next, module, length); next += length; - *next++ = '/'; - } - // Get parent (package) string. - const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings); - // If parent string is not empty string. - if (*parent != '\0') { - // Get length of module string. - length = strlen(parent); - // Make sure there is no buffer overflow. - assert(next - path + length + 1 < max && "buffer overflow"); - // Append 'patent/' . - strncpy(next, parent, length); next += length; - *next++ = '/'; - } - // Get base name string. - const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings); - // Get length of base name. - length = strlen(base); - // Make sure there is no buffer overflow. - assert(next - path + length < max && "buffer overflow"); - // Append base name. - strncpy(next, base, length); next += length; - // Get extension string. - const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings); - // If extension string is not empty string. - if (*extension != '\0') { - // Get length of extension string. - length = strlen(extension); - // Make sure there is no buffer overflow. - assert(next - path + length + 1 < max && "buffer overflow"); - // Append '.extension' . - *next++ = '.'; - strncpy(next, extension, length); next += length; - } - // Make sure there is no buffer overflow. - assert((size_t)(next - path) < max && "buffer overflow"); - // Terminate string. - *next = '\0'; -} - // Verify that a found location matches the supplied path (without copying.) bool ImageFileReader::verify_location(ImageLocation& location, const char* path) const { // Manage the image string table. diff --git a/src/java.base/share/native/libjimage/imageFile.hpp b/src/java.base/share/native/libjimage/imageFile.hpp index 699f2fffe76..2e080295ca8 100644 --- a/src/java.base/share/native/libjimage/imageFile.hpp +++ b/src/java.base/share/native/libjimage/imageFile.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -564,9 +564,6 @@ public: // ImageFileReader::NOT_FOUND otherwise. u4 find_location_index(const char* path, u8 *size) const; - // Assemble the location path. - void location_path(ImageLocation& location, char* path, size_t max) const; - // Verify that a found location matches the supplied path. bool verify_location(ImageLocation& location, const char* path) const; diff --git a/src/java.base/share/native/libjimage/jimage.cpp b/src/java.base/share/native/libjimage/jimage.cpp index 2d8fc02c9d1..5c901944e79 100644 --- a/src/java.base/share/native/libjimage/jimage.cpp +++ b/src/java.base/share/native/libjimage/jimage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -215,29 +215,3 @@ JIMAGE_ResourceIterator(JImageFile* image, } } } - -/* - * JIMAGE_ResourcePath- Given an open image file, a location reference, a buffer - * and a maximum buffer size, copy the path of the resource into the buffer. - * Returns false if not a valid location reference. - * - * Ex. - * JImageLocationRef location = ... - * char path[JIMAGE_MAX_PATH]; - * (*JImageResourcePath)(image, location, path, JIMAGE_MAX_PATH); - */ -extern "C" JNIEXPORT bool -JIMAGE_ResourcePath(JImageFile* image, JImageLocationRef locationRef, - char* path, size_t max) { - ImageFileReader* imageFile = (ImageFileReader*) image; - - u4 offset = (u4) locationRef; - if (offset >= imageFile->locations_size()) { - return false; - } - - ImageLocation location(imageFile->get_location_offset_data(offset)); - imageFile->location_path(location, path, max); - - return true; -} diff --git a/src/java.base/share/native/libjimage/jimage.hpp b/src/java.base/share/native/libjimage/jimage.hpp index 37dfb5de344..31e47bd67fe 100644 --- a/src/java.base/share/native/libjimage/jimage.hpp +++ b/src/java.base/share/native/libjimage/jimage.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -191,20 +191,3 @@ JIMAGE_ResourceIterator(JImageFile* jimage, typedef void (*JImageResourceIterator_t)(JImageFile* jimage, JImageResourceVisitor_t visitor, void* arg); - -/* - * JIMAGE_ResourcePath- Given an open image file, a location reference, a buffer - * and a maximum buffer size, copy the path of the resource into the buffer. - * Returns false if not a valid location reference. - * - * Ex. - * JImageLocationRef location = ... - * char path[JIMAGE_MAX_PATH]; - * (*JImageResourcePath)(image, location, path, JIMAGE_MAX_PATH); - */ -extern "C" JNIEXPORT bool -JIMAGE_ResourcePath(JImageFile* image, JImageLocationRef locationRef, - char* path, size_t max); - -typedef bool (*JImage_ResourcePath_t)(JImageFile* jimage, JImageLocationRef location, - char* buffer, jlong size); From 1d7db01371bb28717acd4e79910b92dd9d2d8259 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Wed, 20 Feb 2019 10:20:48 -0800 Subject: [PATCH 046/109] 8219389: Delegated task created by SSLEngine throws BufferUnderflowException Reviewed-by: ascarpino --- .../share/classes/sun/security/ssl/ClientHello.java | 9 ++------- .../share/classes/sun/security/ssl/HandshakeContext.java | 8 +++++++- .../classes/sun/security/ssl/PostHandshakeContext.java | 8 +++++++- .../ssl/interop/ClientHelloBufferUnderflowException.java | 8 ++++++-- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/ClientHello.java b/src/java.base/share/classes/sun/security/ssl/ClientHello.java index de50313e511..53b74223bfb 100644 --- a/src/java.base/share/classes/sun/security/ssl/ClientHello.java +++ b/src/java.base/share/classes/sun/security/ssl/ClientHello.java @@ -803,13 +803,8 @@ final class ClientHello { shc.sslConfig.getEnabledExtensions( SSLHandshake.CLIENT_HELLO); - ClientHelloMessage chm; - try { - chm = new ClientHelloMessage(shc, message, enabledExtensions); - } catch (Exception e) { - throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE, - "ClientHelloMessage failure", e); - } + ClientHelloMessage chm = + new ClientHelloMessage(shc, message, enabledExtensions); if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { SSLLogger.fine("Consuming ClientHello handshake message", chm); } diff --git a/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java b/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java index a95c691b943..83f4fcee670 100644 --- a/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java +++ b/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -26,6 +26,8 @@ package sun.security.ssl; import java.io.IOException; +import java.nio.BufferOverflowException; +import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; import java.security.AlgorithmConstraints; import java.security.CryptoPrimitive; @@ -443,6 +445,10 @@ abstract class HandshakeContext implements ConnectionContext { throw conContext.fatal(Alert.UNEXPECTED_MESSAGE, "Unsupported handshake message: " + SSLHandshake.nameOf(handshakeType), unsoe); + } catch (BufferUnderflowException | BufferOverflowException be) { + throw conContext.fatal(Alert.DECODE_ERROR, + "Illegal handshake message: " + + SSLHandshake.nameOf(handshakeType), be); } // update handshake hash after handshake message consumption. diff --git a/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java b/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java index 3b4044d8a4c..a3dda5b87c1 100644 --- a/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java +++ b/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -26,6 +26,8 @@ package sun.security.ssl; import java.io.IOException; +import java.nio.BufferOverflowException; +import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -74,6 +76,10 @@ final class PostHandshakeContext extends HandshakeContext { throw conContext.fatal(Alert.UNEXPECTED_MESSAGE, "Unsupported post-handshake message: " + SSLHandshake.nameOf(handshakeType), unsoe); + } catch (BufferUnderflowException | BufferOverflowException be) { + throw conContext.fatal(Alert.DECODE_ERROR, + "Illegal handshake message: " + + SSLHandshake.nameOf(handshakeType), be); } } } diff --git a/test/jdk/javax/net/ssl/interop/ClientHelloBufferUnderflowException.java b/test/jdk/javax/net/ssl/interop/ClientHelloBufferUnderflowException.java index 70ef8ba57d7..69778aa0045 100644 --- a/test/jdk/javax/net/ssl/interop/ClientHelloBufferUnderflowException.java +++ b/test/jdk/javax/net/ssl/interop/ClientHelloBufferUnderflowException.java @@ -28,7 +28,7 @@ /* * @test - * @bug 8215790 + * @bug 8215790 8219389 * @summary Verify exception * @modules java.base/sun.security.util * @run main/othervm ClientHelloBufferUnderflowException @@ -45,12 +45,15 @@ public class ClientHelloBufferUnderflowException extends ClientHelloInterOp { try { (new ClientHelloBufferUnderflowException()).run(); } catch (SSLHandshakeException e) { - System.out.println("Correct exception thrown"); + System.out.println("Correct exception thrown: " + e); + return; } catch (Exception e) { System.out.println("Failed: Exception not SSLHandShakeException"); System.out.println(e.getMessage()); throw e; } + + throw new Exception("No expected exception"); } @Override @@ -76,6 +79,7 @@ public class ClientHelloBufferUnderflowException extends ClientHelloInterOp { } catch (Exception e) { // ignore } + return bytes; } } From dd7e50dc01df7fd8cd5e666bf43a7e96a533f3db Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Wed, 20 Feb 2019 13:21:36 -0500 Subject: [PATCH 047/109] 8214719: Deprecate -Xverify:none option Deprecate -Xverify:none and -noverify and remove them from tests Reviewed-by: dholmes, mikael --- src/hotspot/share/classfile/verifier.hpp | 2 +- src/hotspot/share/runtime/arguments.cpp | 3 +- .../com/sun/tools/example/debug/tty/TTY.java | 2 +- .../TestLinkageErrorInGenerateOopMap.java | 6 +- .../privateMethods/TestInvokeErrors.java | 4 +- .../jtreg/runtime/appcds/VerifierTest.java | 56 ++++++++++++++++--- .../clone/invokevirtual/HasLocalClone.jasm | 4 +- .../clone/invokevirtual/NoLocalClone.jasm | 4 +- .../invokevirtual/NoLocalCloneAbstr.jasm | 4 +- .../TestStaticandInstance.java | 6 +- .../ClassUnloadTest.sh | 4 +- .../tools/javac/lambda/MethodReference66.java | 4 +- 12 files changed, 70 insertions(+), 29 deletions(-) diff --git a/src/hotspot/share/classfile/verifier.hpp b/src/hotspot/share/classfile/verifier.hpp index 2f4fa513703..cf025345aee 100644 --- a/src/hotspot/share/classfile/verifier.hpp +++ b/src/hotspot/share/classfile/verifier.hpp @@ -49,7 +49,7 @@ class Verifier : AllStatic { // Return false if the class is loaded by the bootstrap loader, // or if defineClass was called requesting skipping verification - // -Xverify:all/none override this value + // -Xverify:all overrides this value static bool should_verify_for(oop class_loader, bool should_verify_class); // Relax certain access checks to enable some broken 1.1 apps to run on 1.2. diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index ec4443619f5..f88d51296ab 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -555,13 +555,13 @@ static SpecialFlag const special_jvm_flags[] = { { "UseImplicitStableValues", JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) }, #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS + // These entries will generate build errors. Their purpose is to test the macros. { "dep > obs", JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() }, { "dep > exp ", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(8) }, { "obs > exp ", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(8) }, { "not deprecated or obsolete", JDK_Version::undefined(), JDK_Version::undefined(), JDK_Version::jdk(9) }, { "dup option", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() }, { "dup option", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() }, - { "BytecodeVerificationRemote", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::undefined() }, #endif { NULL, JDK_Version(0), JDK_Version(0) } @@ -2749,6 +2749,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m if (FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, false) != JVMFlag::SUCCESS) { return JNI_EINVAL; } + warning("Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release."); } else if (is_bad_option(option, args->ignoreUnrecognized, "verification")) { return JNI_EINVAL; } diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java index 822d08bab64..6e15ba29c2e 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java @@ -931,7 +931,7 @@ public class TTY implements EventNotifier { // Old-style options (These should remain in place as long as // the standard VM accepts them) token.equals("-noasyncgc") || token.equals("-prof") || - token.equals("-verify") || token.equals("-noverify") || + token.equals("-verify") || token.equals("-verifyremote") || token.equals("-verbosegc") || token.startsWith("-ms") || token.startsWith("-mx") || diff --git a/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java b/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java index 52b523b612a..c79cf8aa8f0 100644 --- a/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java +++ b/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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,7 +42,9 @@ public class TestLinkageErrorInGenerateOopMap { public static void main(String args[]) throws Exception { if (args.length == 0) { // Spawn new VM instance to execute test - String[] flags = {"-noverify", "-XX:-TieredCompilation", + String[] flags = {"-XX:-BytecodeVerificationRemote", + "-XX:-BytecodeVerificationLocal", + "-XX:-TieredCompilation", "-XX:CompileCommand=dontinline,compiler/linkage/OSRWithBadOperandStack.m*", "compiler.linkage.TestLinkageErrorInGenerateOopMap", "run"}; ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flags); diff --git a/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java b/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java index 43cc0b635b0..9f422b14dba 100644 --- a/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java +++ b/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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 @@ -32,7 +32,7 @@ * MissingMethodWithSuper.jcod * MissingNestHost.jcod * @run main TestInvokeErrors true - * @run main/othervm -Xverify:none TestInvokeErrors false + * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal TestInvokeErrors false */ public class TestInvokeErrors { diff --git a/test/hotspot/jtreg/runtime/appcds/VerifierTest.java b/test/hotspot/jtreg/runtime/appcds/VerifierTest.java index 2898be97373..a796baceff2 100644 --- a/test/hotspot/jtreg/runtime/appcds/VerifierTest.java +++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, 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 @@ -38,7 +38,7 @@ public class VerifierTest implements Opcodes { // Test verification settings for dumping & runtime static final String VFY_ALL = "-Xverify:all"; static final String VFY_REMOTE = "-Xverify:remote"; // default - static final String VFY_NONE = "-Xverify:none"; + static final String VFY_NONE = "-XX:-BytecodeVerificationRemote, -XX:-BytecodeVerificationLocal"; static final String ERR = "ERROR: class VerifierTestC was loaded unexpectedly"; @@ -140,7 +140,7 @@ public class VerifierTest implements Opcodes { {"app", VFY_ALL, VFY_REMOTE, VFY_ERR }, {"app", VFY_ALL, VFY_ALL, VFY_ERR }, {"app", VFY_ALL, VFY_NONE, ERR }, - // Dump app/ext with -Xverify:none + // Dump app/ext with verifier turned off {"app", VFY_NONE, VFY_REMOTE, VFY_ERR}, {"app", VFY_NONE, VFY_ALL, MAP_FAIL}, {"app", VFY_NONE, VFY_NONE, ERR }, @@ -152,7 +152,7 @@ public class VerifierTest implements Opcodes { {"noApp", VFY_ALL, VFY_REMOTE, VFY_ERR}, {"noApp", VFY_ALL, VFY_ALL, VFY_ERR}, {"noApp", VFY_ALL, VFY_NONE, ERR}, - // Dump sys only with -Xverify:none + // Dump sys only with verifier turned off {"noApp", VFY_NONE, VFY_REMOTE, VFY_ERR}, {"noApp", VFY_NONE, VFY_ALL, VFY_ERR}, {"noApp", VFY_NONE, VFY_NONE, ERR}, @@ -186,8 +186,19 @@ public class VerifierTest implements Opcodes { " with " + dump_setting + ", run with " + runtime_setting); if (!dump_setting.equals(prev_dump_setting)) { + String dump_arg1; + String dump_arg2; + // Need to break this into two separate arguments. + if (dump_setting.equals(VFY_NONE)) { + dump_arg1 = "-XX:-BytecodeVerificationRemote"; + dump_arg2 = "-XX:-BytecodeVerificationLocal"; + } else { + // Redundant args should be harmless. + dump_arg1 = dump_arg2 = dump_setting; + } + OutputAnalyzer dumpOutput = TestCommon.dump( - jar, dump_list, dump_setting, + jar, dump_list, dump_arg1, dump_arg2, CDS_LOGGING, // FIXME: the following options are for working around a GC // issue - assert failure when dumping archive with the -Xverify:all @@ -198,8 +209,17 @@ public class VerifierTest implements Opcodes { dumpOutput.shouldContain(VFY_INFO_MESSAGE); } } + String runtime_arg1; + String runtime_arg2; + if (runtime_setting.equals(VFY_NONE)) { + runtime_arg1 = "-XX:-BytecodeVerificationRemote"; + runtime_arg2 = "-XX:-BytecodeVerificationLocal"; + } else { + // Redundant args should be harmless. + runtime_arg1 = runtime_arg2 = runtime_setting; + } TestCommon.run("-cp", jar, - runtime_setting, + runtime_arg1, runtime_arg2, "VerifierTest0") .ifNoMappingFailure(output -> checkRuntimeOutput(output, expected_output_str)); prev_dump_setting = dump_setting; @@ -229,7 +249,7 @@ public class VerifierTest implements Opcodes { {"app", VFY_ALL, VFY_REMOTE, PASS_RESULT }, {"app", VFY_ALL, VFY_ALL, PASS_RESULT }, {"app", VFY_ALL, VFY_NONE, PASS_RESULT }, - // Dump app/ext with -Xverify:none + // Dump app/ext with verifier turned off {"app", VFY_NONE, VFY_REMOTE, PASS_RESULT}, {"app", VFY_NONE, VFY_ALL, MAP_FAIL}, {"app", VFY_NONE, VFY_NONE, PASS_RESULT }, @@ -244,8 +264,17 @@ public class VerifierTest implements Opcodes { " with " + dump_setting + ", run with " + runtime_setting); if (!dump_setting.equals(prev_dump_setting)) { + String dump_arg1; + String dump_arg2; + if (dump_setting.equals(VFY_NONE)) { + dump_arg1 = "-XX:-BytecodeVerificationRemote"; + dump_arg2 = "-XX:-BytecodeVerificationLocal"; + } else { + // Redundant args should be harmless. + dump_arg1 = dump_arg2 = dump_setting; + } OutputAnalyzer dumpOutput = TestCommon.dump( - jar, appClasses, dump_setting, + jar, appClasses, dump_arg1, dump_arg2, CDS_LOGGING, // FIXME: the following options are for working around a GC // issue - assert failure when dumping archive with the -Xverify:all @@ -256,8 +285,17 @@ public class VerifierTest implements Opcodes { dumpOutput.shouldContain(VFY_INFO_MESSAGE); } } + String runtime_arg1; + String runtime_arg2; + if (runtime_setting.equals(VFY_NONE)) { + runtime_arg1 = "-XX:-BytecodeVerificationRemote"; + runtime_arg2 = "-XX:-BytecodeVerificationLocal"; + } else { + // Redundant args should be harmless. + runtime_arg1 = runtime_arg2 = runtime_setting; + } TestCommon.run("-cp", jar, - runtime_setting, + runtime_arg1, runtime_arg2, "Hi") .ifNoMappingFailure(output -> checkRuntimeOutput(output, expected_output_str)); prev_dump_setting = dump_setting; diff --git a/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm b/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm index 7c86e318c1a..f744343d59d 100644 --- a/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm +++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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 @@ -28,7 +28,7 @@ * @summary Check that invokevirtual of clone() finds the clone() method that * is local to the calling class. * @compile DefMethClone.jasm SuperClass.jasm I1.java HasLocalClone.jasm - * @run main/othervm -noverify HasLocalClone + * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal HasLocalClone */ // The below .jasm code implements the following java code: diff --git a/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm index 990790c3d47..a815904007f 100644 --- a/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm +++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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 @@ -28,7 +28,7 @@ * @summary Check that invokevirtual of clone() calls java.lang.Object.clone() * even if a superinterface has a default method named clone(). * @compile DefMethClone.jasm SuperClass.jasm I1.java NoLocalClone.jasm - * @run main/othervm -noverify NoLocalClone + * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal NoLocalClone */ // The below .jasm code implements the following java code: diff --git a/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm index b8dab0ccbca..8eff46e9dc9 100644 --- a/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm +++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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 @@ -28,7 +28,7 @@ * @summary Check that invokevirtual of clone() calls java.lang.Object.clone() * even if a superinterface has an abstract method named clone(). * @compile DefMethClone.jasm SuperClass.jasm I1Abstr.java NoLocalCloneAbstr.jasm - * @run main/othervm -noverify NoLocalCloneAbstr + * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal NoLocalCloneAbstr */ // The below .jasm code implements the following java code: diff --git a/test/hotspot/jtreg/runtime/lambda-features/TestStaticandInstance.java b/test/hotspot/jtreg/runtime/lambda-features/TestStaticandInstance.java index 0bb42e8013b..b69a2916897 100644 --- a/test/hotspot/jtreg/runtime/lambda-features/TestStaticandInstance.java +++ b/test/hotspot/jtreg/runtime/lambda-features/TestStaticandInstance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, 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 @@ -26,7 +26,7 @@ * @bug 8087342 * @summary Test linkresolver search static, instance and overpass duplicates * @modules java.base/jdk.internal.org.objectweb.asm - * @run main/othervm -Xverify:none TestStaticandInstance + * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal TestStaticandInstance */ @@ -94,7 +94,7 @@ interface I { default int q() { return 3; } // trigger defmeth processing: C gets AME overpass } -// C gets static, private and AME overpass m()I with -Xverify:none +// C gets static, private and AME overpass m()I with the verifier turned off class C implements I { static int m() { return 1;} // javac with "n()" and patch to "m()" private int m() { return 2;} // javac with public and patch to private diff --git a/test/jdk/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh b/test/jdk/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh index b428a59bb28..71923152da4 100644 --- a/test/jdk/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh +++ b/test/jdk/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2019, 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 @@ -80,5 +80,5 @@ $JAR ${TESTTOOLVMOPTS} -cfm "${TESTCLASSES}"/ClassUnloadTest.jar "${MANIFEST}" \ # Finally we run the test (cd "${TESTCLASSES}"; \ - $JAVA ${TESTVMOPTS} -Xverify:none -Xlog:class+unload \ + $JAVA ${TESTVMOPTS} -Xlog:class+unload \ -javaagent:ClassUnloadTest.jar ClassUnloadTest "${OTHERDIR}" Bar.jar) diff --git a/test/langtools/tools/javac/lambda/MethodReference66.java b/test/langtools/tools/javac/lambda/MethodReference66.java index 6f4b80c92ef..d0e4974f365 100644 --- a/test/langtools/tools/javac/lambda/MethodReference66.java +++ b/test/langtools/tools/javac/lambda/MethodReference66.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, 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,7 +25,7 @@ * @test * @bug 8009299 * @summary Javac crashes when compiling method reference to static interface method - * @run main/othervm -Xverify:none MethodReference66 + * @run main/othervm MethodReference66 */ public class MethodReference66 { From 315b7d03999e420d496a5bc269c4c779adf8417c Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Wed, 20 Feb 2019 10:57:22 -0800 Subject: [PATCH 048/109] 5029431: (bf) Add absolute bulk put and get methods Reviewed-by: alanb, darcy, chegar, rriggs --- .../java/nio/Direct-X-Buffer.java.template | 73 ++++++- .../java/nio/Heap-X-Buffer.java.template | 22 ++- .../classes/java/nio/X-Buffer.java.template | 186 +++++++++++++++++- .../jdk/java/nio/Buffer/Basic-X.java.template | 68 ++++++- test/jdk/java/nio/Buffer/Basic.java | 8 +- test/jdk/java/nio/Buffer/BasicByte.java | 68 ++++++- test/jdk/java/nio/Buffer/BasicChar.java | 68 ++++++- test/jdk/java/nio/Buffer/BasicDouble.java | 68 ++++++- test/jdk/java/nio/Buffer/BasicFloat.java | 68 ++++++- test/jdk/java/nio/Buffer/BasicInt.java | 68 ++++++- test/jdk/java/nio/Buffer/BasicLong.java | 68 ++++++- test/jdk/java/nio/Buffer/BasicShort.java | 68 ++++++- 12 files changed, 804 insertions(+), 29 deletions(-) diff --git a/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template b/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template index a756e7d87e9..d7bf85a6e4b 100644 --- a/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template +++ b/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ package java.nio; import java.io.FileDescriptor; import java.lang.ref.Reference; +import java.util.Objects; import jdk.internal.misc.VM; import jdk.internal.ref.Cleaner; import sun.nio.ch.DirectBuffer; @@ -325,6 +326,40 @@ class Direct$Type$Buffer$RW$$BO$ #end[rw] } + public $Type$Buffer get(int index, $type$[] dst, int offset, int length) { +#if[rw] + if (((long)length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) { + Objects.checkFromIndexSize(index, length, limit()); + Objects.checkFromIndexSize(offset, length, dst.length); + + long dstOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$); + try { +#if[!byte] + if (order() != ByteOrder.nativeOrder()) + UNSAFE.copySwapMemory(null, + ix(index), + dst, + dstOffset, + (long)length << $LG_BYTES_PER_VALUE$, + (long)1 << $LG_BYTES_PER_VALUE$); + else +#end[!byte] + UNSAFE.copyMemory(null, + ix(index), + dst, + dstOffset, + (long)length << $LG_BYTES_PER_VALUE$); + } finally { + Reference.reachabilityFence(this); + } + } else { + super.get(index, dst, offset, length); + } + return this; +#else[rw] + throw new ReadOnlyBufferException(); +#end[rw] + } #end[rw] public $Type$Buffer put($type$ x) { @@ -440,6 +475,42 @@ class Direct$Type$Buffer$RW$$BO$ #end[rw] } + public $Type$Buffer put(int index, $type$[] src, int offset, int length) { +#if[rw] + if (((long)length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_FROM_ARRAY_THRESHOLD) { + Objects.checkFromIndexSize(index, length, limit()); + Objects.checkFromIndexSize(offset, length, src.length); + + + long srcOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$); + try { +#if[!byte] + if (order() != ByteOrder.nativeOrder()) + UNSAFE.copySwapMemory(src, + srcOffset, + null, + ix(index), + (long)length << $LG_BYTES_PER_VALUE$, + (long)1 << $LG_BYTES_PER_VALUE$); + else +#end[!byte] + UNSAFE.copyMemory(src, + srcOffset, + null, + ix(index), + (long)length << $LG_BYTES_PER_VALUE$); + } finally { + Reference.reachabilityFence(this); + } + } else { + super.put(index, src, offset, length); + } + return this; +#else[rw] + throw new ReadOnlyBufferException(); +#end[rw] + } + public $Type$Buffer compact() { #if[rw] int pos = position(); diff --git a/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template b/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template index 7f2a2597ba3..8875e535feb 100644 --- a/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template +++ b/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -38,6 +38,8 @@ package java.nio; #end[rw] */ +import java.util.Objects; + class Heap$Type$Buffer$RW$ extends {#if[ro]?Heap}$Type$Buffer { @@ -181,6 +183,13 @@ class Heap$Type$Buffer$RW$ return this; } + public $Type$Buffer get(int index, $type$[] dst, int offset, int length) { + Objects.checkFromIndexSize(index, length, limit()); + Objects.checkFromIndexSize(offset, length, dst.length); + System.arraycopy(hb, ix(index), dst, offset, length); + return this; + } + public boolean isDirect() { return false; } @@ -250,6 +259,17 @@ class Heap$Type$Buffer$RW$ #end[rw] } + public $Type$Buffer put(int index, $type$[] src, int offset, int length) { +#if[rw] + Objects.checkFromIndexSize(index, length, limit()); + Objects.checkFromIndexSize(offset, length, src.length); + System.arraycopy(src, offset, hb, ix(index), length); + return this; +#else[rw] + throw new ReadOnlyBufferException(); +#end[rw] + } + public $Type$Buffer compact() { #if[rw] System.arraycopy(hb, ix(position()), hb, ix(0), remaining()); diff --git a/src/java.base/share/classes/java/nio/X-Buffer.java.template b/src/java.base/share/classes/java/nio/X-Buffer.java.template index 8e0465a570e..e130450da73 100644 --- a/src/java.base/share/classes/java/nio/X-Buffer.java.template +++ b/src/java.base/share/classes/java/nio/X-Buffer.java.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -36,6 +36,7 @@ import java.util.stream.StreamSupport; import java.util.stream.$Streamtype$Stream; #end[streamableType] +import java.util.Objects; import jdk.internal.util.ArraysSupport; /** @@ -50,11 +51,11 @@ import jdk.internal.util.ArraysSupport; * {@link #put($type$) put} methods that read and write * single $type$s;

* - *
  • Relative {@link #get($type$[]) bulk get} + *

  • Absolute and relative {@link #get($type$[]) bulk get} * methods that transfer contiguous sequences of $type$s from this buffer * into an array; {#if[!byte]?and}

  • * - *
  • Relative {@link #put($type$[]) bulk put} + *

  • Absolute and relative {@link #put($type$[]) bulk put} * methods that transfer contiguous sequences of $type$s from $a$ * $type$ array{#if[char]?, a string,} or some other $type$ * buffer into this buffer;{#if[!byte]? and}

  • @@ -436,7 +437,6 @@ public abstract class $Type$Buffer * @return The number of characters added to the buffer, or * -1 if this source of characters is at its end * @throws IOException if an I/O error occurs - * @throws NullPointerException if target is null * @throws ReadOnlyBufferException if target is a read only buffer * @since 1.5 */ @@ -764,6 +764,89 @@ public abstract class $Type$Buffer return get(dst, 0, dst.length); } + /** + * Absolute bulk get method. + * + *

    This method transfers {@code length} $type$s from this + * buffer into the given array, starting at the given index in this + * buffer and at the given offset in the array. The position of this + * buffer is unchanged. + * + *

    An invocation of this method of the form + * src.get(index, dst, offset, length) + * has exactly the same effect as the following loop except that it first + * checks the consistency of the supplied parameters and it is potentially + * much more efficient: + * + *

    {@code
    +     *     for (int i = offset, j = index; i < offset + length; i++, j++)
    +     *         dst[i] = src.get(j);
    +     * }
    + * + * @param index + * The index in this buffer from which the first $type$ will be + * read; must be non-negative and less than {@code limit()} + * + * @param dst + * The destination array + * + * @param offset + * The offset within the array of the first $type$ to be + * written; must be non-negative and less than + * {@code dst.length} + * + * @param length + * The number of $type$s to be written to the given array; + * must be non-negative and no larger than the smaller of + * {@code limit() - index} and {@code dst.length - offset} + * + * @return This buffer + * + * @throws IndexOutOfBoundsException + * If the preconditions on the {@code index}, {@code offset}, and + * {@code length} parameters do not hold + * + * @since 13 + */ + public $Type$Buffer get(int index, $type$[] dst, int offset, int length) { + Objects.checkFromIndexSize(index, length, limit()); + Objects.checkFromIndexSize(offset, length, dst.length); + int end = offset + length; + for (int i = offset, j = index; i < end; i++, j++) + dst[i] = get(j); + return this; + } + + /** + * Absolute bulk get method. + * + *

    This method transfers $type$s from this buffer into the given + * destination array. The position of this buffer is unchanged. An + * invocation of this method of the form + * src.get(index, dst) behaves in exactly the same + * way as the invocation: + * + *

    +     *     src.get(index, dst, 0, dst.length) 
    + * + * @param index + * The index in this buffer from which the first $type$ will be + * read; must be non-negative and less than {@code limit()} + * + * @param dst + * The destination array + * + * @return This buffer + * + * @throws IndexOutOfBoundsException + * If {@code index} is negative, not smaller than {@code limit()}, + * or {@code limit() - index < dst.length} + * + * @since 13 + */ + public $Type$Buffer get(int index, $type$[] dst) { + return get(index, dst, 0, dst.length); + } // -- Bulk put operations -- @@ -842,7 +925,7 @@ public abstract class $Type$Buffer * *
    {@code
          *     for (int i = off; i < off + len; i++)
    -     *         dst.put(a[i]);
    +     *         dst.put(src[i]);
          * }
    * * except that it first checks that there is sufficient space in this @@ -853,12 +936,12 @@ public abstract class $Type$Buffer * * @param offset * The offset within the array of the first $type$ to be read; - * must be non-negative and no larger than {@code array.length} + * must be non-negative and no larger than {@code src.length} * * @param length * The number of $type$s to be read from the given array; * must be non-negative and no larger than - * {@code array.length - offset} + * {@code src.length - offset} * * @return This buffer * @@ -908,6 +991,95 @@ public abstract class $Type$Buffer return put(src, 0, src.length); } + /** + * Absolute bulk put method  (optional operation). + * + *

    This method transfers {@code length} $type$s from the given + * array, starting at the given offset in the array and at the given index + * in this buffer. The position of this buffer is unchanged. + * + *

    An invocation of this method of the form + * dst.put(index, src, offset, length) + * has exactly the same effect as the following loop except that it first + * checks the consistency of the supplied parameters and it is potentially + * much more efficient: + * + *

    {@code
    +     *     for (int i = offset, j = index; i < offset + length; i++, j++)
    +     *         dst.put(j, src[i]);
    +     * }
    + * + * @param index + * The index in this buffer at which the first $type$ will be + * written; must be non-negative and less than {@code limit()} + * + * @param src + * The array from which $type$s are to be read + * + * @param offset + * The offset within the array of the first $type$ to be read; + * must be non-negative and less than {@code src.length} + * + * @param length + * The number of $type$s to be read from the given array; + * must be non-negative and no larger than the smaller of + * {@code limit() - index} and {@code src.length - offset} + * + * @return This buffer + * + * @throws IndexOutOfBoundsException + * If the preconditions on the {@code index}, {@code offset}, and + * {@code length} parameters do not hold + * + * @throws ReadOnlyBufferException + * If this buffer is read-only + * + * @since 13 + */ + public $Type$Buffer put(int index, $type$[] src, int offset, int length) { + if (isReadOnly()) + throw new ReadOnlyBufferException(); + Objects.checkFromIndexSize(index, length, limit()); + Objects.checkFromIndexSize(offset, length, src.length); + int end = offset + length; + for (int i = offset, j = index; i < end; i++, j++) + this.put(j, src[i]); + return this; + } + + /** + * Absolute bulk put method  (optional operation). + * + *

    This method copies $type$s into this buffer from the given source + * array. The position of this buffer is unchanged. An invocation of this + * method of the form dst.put(index, src) + * behaves in exactly the same way as the invocation: + * + *

    +     *     dst.put(index, src, 0, src.length); 
    + * + * @param index + * The index in this buffer at which the first $type$ will be + * written; must be non-negative and less than {@code limit()} + * + * @param src + * The array from which $type$s are to be read + * + * @return This buffer + * + * @throws IndexOutOfBoundsException + * If {@code index} is negative, not smaller than {@code limit()}, + * or {@code limit() - index < src.length} + * + * @throws ReadOnlyBufferException + * If this buffer is read-only + * + * @since 13 + */ + public $Type$Buffer put(int index, $type$[] src) { + return put(index, src, 0, src.length); + } + #if[char] /** diff --git a/test/jdk/java/nio/Buffer/Basic-X.java.template b/test/jdk/java/nio/Buffer/Basic-X.java.template index d578b1366d3..bfbb8dda097 100644 --- a/test/jdk/java/nio/Buffer/Basic-X.java.template +++ b/test/jdk/java/nio/Buffer/Basic-X.java.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -87,6 +87,18 @@ public class Basic$Type$ } } + private static void absBulkGet($Type$Buffer b) { + int n = b.capacity(); + int len = n - 7*2; + $type$[] a = new $type$[n + 7]; + b.position(42); + b.get(7, a, 7, len); + ck(b, b.position() == 42); + for (int i = 0; i < len; i++) { + ck(b, (long)a[i + 7], (long)(($type$)ic(i))); + } + } + private static void relPut($Type$Buffer b) { int n = b.capacity(); b.clear(); @@ -136,6 +148,20 @@ public class Basic$Type$ } } + private static void absBulkPutArray($Type$Buffer b) { + int n = b.capacity(); + b.clear(); + int lim = n - 7; + int len = lim - 7; + b.limit(lim); + $type$[] a = new $type$[len + 7]; + for (int i = 0; i < len; i++) + a[i + 7] = ($type$)ic(i); + b.position(42); + b.put(7, a, 7, len); + ck(b, b.position() == 42); + } + //6231529 private static void callReset($Type$Buffer b) { b.position(0); @@ -452,6 +478,10 @@ public class Basic$Type$ fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); } + private static void catchNullArgument(Buffer b, Runnable thunk) { + tryCatch(b, NullPointerException.class, thunk); + } + private static void catchIllegalArgument(Buffer b, Runnable thunk) { tryCatch(b, IllegalArgumentException.class, thunk); } @@ -476,7 +506,10 @@ public class Basic$Type$ if (ex.isAssignableFrom(x.getClass())) { caught = true; } else { - fail(x.getMessage() + " not expected"); + String s = x.getMessage(); + if (s == null) + s = x.getClass().getName(); + fail(s + " not expected"); } } if (!caught) { @@ -513,6 +546,9 @@ public class Basic$Type$ bulkPutBuffer(b); relGet(b); + absBulkPutArray(b); + absBulkGet(b); + #if[char] bulkPutString(b); @@ -612,6 +648,26 @@ public class Basic$Type$ } } + // Exceptions in absolute bulk operations + + catchNullArgument(b, () -> b.get(7, null, 0, 42)); + catchNullArgument(b, () -> b.put(7, ($type$[])null, 0, 42)); + + $type$[] tmpa = new $type$[42]; + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42)); + + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42)); + // Values b.clear(); @@ -819,6 +875,7 @@ public class Basic$Type$ catchReadOnlyBuffer(b, () -> absPut(rb)); catchReadOnlyBuffer(b, () -> bulkPutArray(rb)); catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb)); + catchReadOnlyBuffer(b, () -> absBulkPutArray(rb)); // put($Type$Buffer) should not change source position final $Type$Buffer src = $Type$Buffer.allocate(1); @@ -903,6 +960,13 @@ public class Basic$Type$ b.position(6); ck(b, b.subSequence(0,3).toString().equals("ghi")); + // absolute bulk get + char[] c = new char[end + 1 - (start - 1) + 1]; // [start - 1, end + 1] + b.limit(end + 2); + b.get(start - 1, c, 0, c.length); + for (int i = 0; i < c.length; i++) + ck(b, c[i], s.charAt(start - 1 + i)); + // The index, relative to the position, must be non-negative and // smaller than remaining(). catchIndexOutOfBounds(b, () -> b.charAt(-1)); diff --git a/test/jdk/java/nio/Buffer/Basic.java b/test/jdk/java/nio/Buffer/Basic.java index 7d5f85e532d..92d8a6042d3 100644 --- a/test/jdk/java/nio/Buffer/Basic.java +++ b/test/jdk/java/nio/Buffer/Basic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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,9 +24,9 @@ /* @test * @summary Unit test for buffers * @bug 4413135 4414911 4416536 4416562 4418782 4471053 4472779 4490253 4523725 - * 4526177 4463011 4660660 4661219 4663521 4782970 4804304 4938424 6231529 - * 6221101 6234263 6535542 6591971 6593946 6795561 7190219 7199551 8065556 - * 8149469 + * 4526177 4463011 4660660 4661219 4663521 4782970 4804304 4938424 5029431 + * 6231529 6221101 6234263 6535542 6591971 6593946 6795561 7190219 7199551 + * 8065556 8149469 * @modules java.base/java.nio:open * java.base/jdk.internal.misc * @author Mark Reinhold diff --git a/test/jdk/java/nio/Buffer/BasicByte.java b/test/jdk/java/nio/Buffer/BasicByte.java index 039dde39eb0..a2ea7d02cb4 100644 --- a/test/jdk/java/nio/Buffer/BasicByte.java +++ b/test/jdk/java/nio/Buffer/BasicByte.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -87,6 +87,18 @@ public class BasicByte } } + private static void absBulkGet(ByteBuffer b) { + int n = b.capacity(); + int len = n - 7*2; + byte[] a = new byte[n + 7]; + b.position(42); + b.get(7, a, 7, len); + ck(b, b.position() == 42); + for (int i = 0; i < len; i++) { + ck(b, (long)a[i + 7], (long)((byte)ic(i))); + } + } + private static void relPut(ByteBuffer b) { int n = b.capacity(); b.clear(); @@ -136,6 +148,20 @@ public class BasicByte } } + private static void absBulkPutArray(ByteBuffer b) { + int n = b.capacity(); + b.clear(); + int lim = n - 7; + int len = lim - 7; + b.limit(lim); + byte[] a = new byte[len + 7]; + for (int i = 0; i < len; i++) + a[i + 7] = (byte)ic(i); + b.position(42); + b.put(7, a, 7, len); + ck(b, b.position() == 42); + } + //6231529 private static void callReset(ByteBuffer b) { b.position(0); @@ -452,6 +478,10 @@ public class BasicByte fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); } + private static void catchNullArgument(Buffer b, Runnable thunk) { + tryCatch(b, NullPointerException.class, thunk); + } + private static void catchIllegalArgument(Buffer b, Runnable thunk) { tryCatch(b, IllegalArgumentException.class, thunk); } @@ -476,7 +506,10 @@ public class BasicByte if (ex.isAssignableFrom(x.getClass())) { caught = true; } else { - fail(x.getMessage() + " not expected"); + String s = x.getMessage(); + if (s == null) + s = x.getClass().getName(); + fail(s + " not expected"); } } if (!caught) { @@ -513,6 +546,9 @@ public class BasicByte bulkPutBuffer(b); relGet(b); + absBulkPutArray(b); + absBulkGet(b); + @@ -612,6 +648,26 @@ public class BasicByte } } + // Exceptions in absolute bulk operations + + catchNullArgument(b, () -> b.get(7, null, 0, 42)); + catchNullArgument(b, () -> b.put(7, (byte[])null, 0, 42)); + + byte[] tmpa = new byte[42]; + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42)); + + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42)); + // Values b.clear(); @@ -819,6 +875,7 @@ public class BasicByte catchReadOnlyBuffer(b, () -> absPut(rb)); catchReadOnlyBuffer(b, () -> bulkPutArray(rb)); catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb)); + catchReadOnlyBuffer(b, () -> absBulkPutArray(rb)); // put(ByteBuffer) should not change source position final ByteBuffer src = ByteBuffer.allocate(1); @@ -920,6 +977,13 @@ public class BasicByte + + + + + + + diff --git a/test/jdk/java/nio/Buffer/BasicChar.java b/test/jdk/java/nio/Buffer/BasicChar.java index a059aa9c3bb..91d43ce8881 100644 --- a/test/jdk/java/nio/Buffer/BasicChar.java +++ b/test/jdk/java/nio/Buffer/BasicChar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -87,6 +87,18 @@ public class BasicChar } } + private static void absBulkGet(CharBuffer b) { + int n = b.capacity(); + int len = n - 7*2; + char[] a = new char[n + 7]; + b.position(42); + b.get(7, a, 7, len); + ck(b, b.position() == 42); + for (int i = 0; i < len; i++) { + ck(b, (long)a[i + 7], (long)((char)ic(i))); + } + } + private static void relPut(CharBuffer b) { int n = b.capacity(); b.clear(); @@ -136,6 +148,20 @@ public class BasicChar } } + private static void absBulkPutArray(CharBuffer b) { + int n = b.capacity(); + b.clear(); + int lim = n - 7; + int len = lim - 7; + b.limit(lim); + char[] a = new char[len + 7]; + for (int i = 0; i < len; i++) + a[i + 7] = (char)ic(i); + b.position(42); + b.put(7, a, 7, len); + ck(b, b.position() == 42); + } + //6231529 private static void callReset(CharBuffer b) { b.position(0); @@ -452,6 +478,10 @@ public class BasicChar fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); } + private static void catchNullArgument(Buffer b, Runnable thunk) { + tryCatch(b, NullPointerException.class, thunk); + } + private static void catchIllegalArgument(Buffer b, Runnable thunk) { tryCatch(b, IllegalArgumentException.class, thunk); } @@ -476,7 +506,10 @@ public class BasicChar if (ex.isAssignableFrom(x.getClass())) { caught = true; } else { - fail(x.getMessage() + " not expected"); + String s = x.getMessage(); + if (s == null) + s = x.getClass().getName(); + fail(s + " not expected"); } } if (!caught) { @@ -513,6 +546,9 @@ public class BasicChar bulkPutBuffer(b); relGet(b); + absBulkPutArray(b); + absBulkGet(b); + bulkPutString(b); @@ -612,6 +648,26 @@ public class BasicChar } } + // Exceptions in absolute bulk operations + + catchNullArgument(b, () -> b.get(7, null, 0, 42)); + catchNullArgument(b, () -> b.put(7, (char[])null, 0, 42)); + + char[] tmpa = new char[42]; + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42)); + + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42)); + // Values b.clear(); @@ -819,6 +875,7 @@ public class BasicChar catchReadOnlyBuffer(b, () -> absPut(rb)); catchReadOnlyBuffer(b, () -> bulkPutArray(rb)); catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb)); + catchReadOnlyBuffer(b, () -> absBulkPutArray(rb)); // put(CharBuffer) should not change source position final CharBuffer src = CharBuffer.allocate(1); @@ -903,6 +960,13 @@ public class BasicChar b.position(6); ck(b, b.subSequence(0,3).toString().equals("ghi")); + // absolute bulk get + char[] c = new char[end + 1 - (start - 1) + 1]; // [start - 1, end + 1] + b.limit(end + 2); + b.get(start - 1, c, 0, c.length); + for (int i = 0; i < c.length; i++) + ck(b, c[i], s.charAt(start - 1 + i)); + // The index, relative to the position, must be non-negative and // smaller than remaining(). catchIndexOutOfBounds(b, () -> b.charAt(-1)); diff --git a/test/jdk/java/nio/Buffer/BasicDouble.java b/test/jdk/java/nio/Buffer/BasicDouble.java index 41dc5379057..570130902ed 100644 --- a/test/jdk/java/nio/Buffer/BasicDouble.java +++ b/test/jdk/java/nio/Buffer/BasicDouble.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -87,6 +87,18 @@ public class BasicDouble } } + private static void absBulkGet(DoubleBuffer b) { + int n = b.capacity(); + int len = n - 7*2; + double[] a = new double[n + 7]; + b.position(42); + b.get(7, a, 7, len); + ck(b, b.position() == 42); + for (int i = 0; i < len; i++) { + ck(b, (long)a[i + 7], (long)((double)ic(i))); + } + } + private static void relPut(DoubleBuffer b) { int n = b.capacity(); b.clear(); @@ -136,6 +148,20 @@ public class BasicDouble } } + private static void absBulkPutArray(DoubleBuffer b) { + int n = b.capacity(); + b.clear(); + int lim = n - 7; + int len = lim - 7; + b.limit(lim); + double[] a = new double[len + 7]; + for (int i = 0; i < len; i++) + a[i + 7] = (double)ic(i); + b.position(42); + b.put(7, a, 7, len); + ck(b, b.position() == 42); + } + //6231529 private static void callReset(DoubleBuffer b) { b.position(0); @@ -452,6 +478,10 @@ public class BasicDouble fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); } + private static void catchNullArgument(Buffer b, Runnable thunk) { + tryCatch(b, NullPointerException.class, thunk); + } + private static void catchIllegalArgument(Buffer b, Runnable thunk) { tryCatch(b, IllegalArgumentException.class, thunk); } @@ -476,7 +506,10 @@ public class BasicDouble if (ex.isAssignableFrom(x.getClass())) { caught = true; } else { - fail(x.getMessage() + " not expected"); + String s = x.getMessage(); + if (s == null) + s = x.getClass().getName(); + fail(s + " not expected"); } } if (!caught) { @@ -513,6 +546,9 @@ public class BasicDouble bulkPutBuffer(b); relGet(b); + absBulkPutArray(b); + absBulkGet(b); + @@ -612,6 +648,26 @@ public class BasicDouble } } + // Exceptions in absolute bulk operations + + catchNullArgument(b, () -> b.get(7, null, 0, 42)); + catchNullArgument(b, () -> b.put(7, (double[])null, 0, 42)); + + double[] tmpa = new double[42]; + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42)); + + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42)); + // Values b.clear(); @@ -819,6 +875,7 @@ public class BasicDouble catchReadOnlyBuffer(b, () -> absPut(rb)); catchReadOnlyBuffer(b, () -> bulkPutArray(rb)); catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb)); + catchReadOnlyBuffer(b, () -> absBulkPutArray(rb)); // put(DoubleBuffer) should not change source position final DoubleBuffer src = DoubleBuffer.allocate(1); @@ -920,6 +977,13 @@ public class BasicDouble + + + + + + + diff --git a/test/jdk/java/nio/Buffer/BasicFloat.java b/test/jdk/java/nio/Buffer/BasicFloat.java index 8f1d950d19c..4abe3381884 100644 --- a/test/jdk/java/nio/Buffer/BasicFloat.java +++ b/test/jdk/java/nio/Buffer/BasicFloat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -87,6 +87,18 @@ public class BasicFloat } } + private static void absBulkGet(FloatBuffer b) { + int n = b.capacity(); + int len = n - 7*2; + float[] a = new float[n + 7]; + b.position(42); + b.get(7, a, 7, len); + ck(b, b.position() == 42); + for (int i = 0; i < len; i++) { + ck(b, (long)a[i + 7], (long)((float)ic(i))); + } + } + private static void relPut(FloatBuffer b) { int n = b.capacity(); b.clear(); @@ -136,6 +148,20 @@ public class BasicFloat } } + private static void absBulkPutArray(FloatBuffer b) { + int n = b.capacity(); + b.clear(); + int lim = n - 7; + int len = lim - 7; + b.limit(lim); + float[] a = new float[len + 7]; + for (int i = 0; i < len; i++) + a[i + 7] = (float)ic(i); + b.position(42); + b.put(7, a, 7, len); + ck(b, b.position() == 42); + } + //6231529 private static void callReset(FloatBuffer b) { b.position(0); @@ -452,6 +478,10 @@ public class BasicFloat fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); } + private static void catchNullArgument(Buffer b, Runnable thunk) { + tryCatch(b, NullPointerException.class, thunk); + } + private static void catchIllegalArgument(Buffer b, Runnable thunk) { tryCatch(b, IllegalArgumentException.class, thunk); } @@ -476,7 +506,10 @@ public class BasicFloat if (ex.isAssignableFrom(x.getClass())) { caught = true; } else { - fail(x.getMessage() + " not expected"); + String s = x.getMessage(); + if (s == null) + s = x.getClass().getName(); + fail(s + " not expected"); } } if (!caught) { @@ -513,6 +546,9 @@ public class BasicFloat bulkPutBuffer(b); relGet(b); + absBulkPutArray(b); + absBulkGet(b); + @@ -612,6 +648,26 @@ public class BasicFloat } } + // Exceptions in absolute bulk operations + + catchNullArgument(b, () -> b.get(7, null, 0, 42)); + catchNullArgument(b, () -> b.put(7, (float[])null, 0, 42)); + + float[] tmpa = new float[42]; + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42)); + + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42)); + // Values b.clear(); @@ -819,6 +875,7 @@ public class BasicFloat catchReadOnlyBuffer(b, () -> absPut(rb)); catchReadOnlyBuffer(b, () -> bulkPutArray(rb)); catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb)); + catchReadOnlyBuffer(b, () -> absBulkPutArray(rb)); // put(FloatBuffer) should not change source position final FloatBuffer src = FloatBuffer.allocate(1); @@ -920,6 +977,13 @@ public class BasicFloat + + + + + + + diff --git a/test/jdk/java/nio/Buffer/BasicInt.java b/test/jdk/java/nio/Buffer/BasicInt.java index 71632f407ef..fc53901b5a0 100644 --- a/test/jdk/java/nio/Buffer/BasicInt.java +++ b/test/jdk/java/nio/Buffer/BasicInt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -87,6 +87,18 @@ public class BasicInt } } + private static void absBulkGet(IntBuffer b) { + int n = b.capacity(); + int len = n - 7*2; + int[] a = new int[n + 7]; + b.position(42); + b.get(7, a, 7, len); + ck(b, b.position() == 42); + for (int i = 0; i < len; i++) { + ck(b, (long)a[i + 7], (long)((int)ic(i))); + } + } + private static void relPut(IntBuffer b) { int n = b.capacity(); b.clear(); @@ -136,6 +148,20 @@ public class BasicInt } } + private static void absBulkPutArray(IntBuffer b) { + int n = b.capacity(); + b.clear(); + int lim = n - 7; + int len = lim - 7; + b.limit(lim); + int[] a = new int[len + 7]; + for (int i = 0; i < len; i++) + a[i + 7] = (int)ic(i); + b.position(42); + b.put(7, a, 7, len); + ck(b, b.position() == 42); + } + //6231529 private static void callReset(IntBuffer b) { b.position(0); @@ -452,6 +478,10 @@ public class BasicInt fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); } + private static void catchNullArgument(Buffer b, Runnable thunk) { + tryCatch(b, NullPointerException.class, thunk); + } + private static void catchIllegalArgument(Buffer b, Runnable thunk) { tryCatch(b, IllegalArgumentException.class, thunk); } @@ -476,7 +506,10 @@ public class BasicInt if (ex.isAssignableFrom(x.getClass())) { caught = true; } else { - fail(x.getMessage() + " not expected"); + String s = x.getMessage(); + if (s == null) + s = x.getClass().getName(); + fail(s + " not expected"); } } if (!caught) { @@ -513,6 +546,9 @@ public class BasicInt bulkPutBuffer(b); relGet(b); + absBulkPutArray(b); + absBulkGet(b); + @@ -612,6 +648,26 @@ public class BasicInt } } + // Exceptions in absolute bulk operations + + catchNullArgument(b, () -> b.get(7, null, 0, 42)); + catchNullArgument(b, () -> b.put(7, (int[])null, 0, 42)); + + int[] tmpa = new int[42]; + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42)); + + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42)); + // Values b.clear(); @@ -819,6 +875,7 @@ public class BasicInt catchReadOnlyBuffer(b, () -> absPut(rb)); catchReadOnlyBuffer(b, () -> bulkPutArray(rb)); catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb)); + catchReadOnlyBuffer(b, () -> absBulkPutArray(rb)); // put(IntBuffer) should not change source position final IntBuffer src = IntBuffer.allocate(1); @@ -920,6 +977,13 @@ public class BasicInt + + + + + + + diff --git a/test/jdk/java/nio/Buffer/BasicLong.java b/test/jdk/java/nio/Buffer/BasicLong.java index a7310c3c66d..5feb0d3cfce 100644 --- a/test/jdk/java/nio/Buffer/BasicLong.java +++ b/test/jdk/java/nio/Buffer/BasicLong.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -87,6 +87,18 @@ public class BasicLong } } + private static void absBulkGet(LongBuffer b) { + int n = b.capacity(); + int len = n - 7*2; + long[] a = new long[n + 7]; + b.position(42); + b.get(7, a, 7, len); + ck(b, b.position() == 42); + for (int i = 0; i < len; i++) { + ck(b, (long)a[i + 7], (long)((long)ic(i))); + } + } + private static void relPut(LongBuffer b) { int n = b.capacity(); b.clear(); @@ -136,6 +148,20 @@ public class BasicLong } } + private static void absBulkPutArray(LongBuffer b) { + int n = b.capacity(); + b.clear(); + int lim = n - 7; + int len = lim - 7; + b.limit(lim); + long[] a = new long[len + 7]; + for (int i = 0; i < len; i++) + a[i + 7] = (long)ic(i); + b.position(42); + b.put(7, a, 7, len); + ck(b, b.position() == 42); + } + //6231529 private static void callReset(LongBuffer b) { b.position(0); @@ -452,6 +478,10 @@ public class BasicLong fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); } + private static void catchNullArgument(Buffer b, Runnable thunk) { + tryCatch(b, NullPointerException.class, thunk); + } + private static void catchIllegalArgument(Buffer b, Runnable thunk) { tryCatch(b, IllegalArgumentException.class, thunk); } @@ -476,7 +506,10 @@ public class BasicLong if (ex.isAssignableFrom(x.getClass())) { caught = true; } else { - fail(x.getMessage() + " not expected"); + String s = x.getMessage(); + if (s == null) + s = x.getClass().getName(); + fail(s + " not expected"); } } if (!caught) { @@ -513,6 +546,9 @@ public class BasicLong bulkPutBuffer(b); relGet(b); + absBulkPutArray(b); + absBulkGet(b); + @@ -612,6 +648,26 @@ public class BasicLong } } + // Exceptions in absolute bulk operations + + catchNullArgument(b, () -> b.get(7, null, 0, 42)); + catchNullArgument(b, () -> b.put(7, (long[])null, 0, 42)); + + long[] tmpa = new long[42]; + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42)); + + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42)); + // Values b.clear(); @@ -819,6 +875,7 @@ public class BasicLong catchReadOnlyBuffer(b, () -> absPut(rb)); catchReadOnlyBuffer(b, () -> bulkPutArray(rb)); catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb)); + catchReadOnlyBuffer(b, () -> absBulkPutArray(rb)); // put(LongBuffer) should not change source position final LongBuffer src = LongBuffer.allocate(1); @@ -920,6 +977,13 @@ public class BasicLong + + + + + + + diff --git a/test/jdk/java/nio/Buffer/BasicShort.java b/test/jdk/java/nio/Buffer/BasicShort.java index 5d94bf2b15f..846bcb97a4d 100644 --- a/test/jdk/java/nio/Buffer/BasicShort.java +++ b/test/jdk/java/nio/Buffer/BasicShort.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -87,6 +87,18 @@ public class BasicShort } } + private static void absBulkGet(ShortBuffer b) { + int n = b.capacity(); + int len = n - 7*2; + short[] a = new short[n + 7]; + b.position(42); + b.get(7, a, 7, len); + ck(b, b.position() == 42); + for (int i = 0; i < len; i++) { + ck(b, (long)a[i + 7], (long)((short)ic(i))); + } + } + private static void relPut(ShortBuffer b) { int n = b.capacity(); b.clear(); @@ -136,6 +148,20 @@ public class BasicShort } } + private static void absBulkPutArray(ShortBuffer b) { + int n = b.capacity(); + b.clear(); + int lim = n - 7; + int len = lim - 7; + b.limit(lim); + short[] a = new short[len + 7]; + for (int i = 0; i < len; i++) + a[i + 7] = (short)ic(i); + b.position(42); + b.put(7, a, 7, len); + ck(b, b.position() == 42); + } + //6231529 private static void callReset(ShortBuffer b) { b.position(0); @@ -452,6 +478,10 @@ public class BasicShort fail(problem + String.format(": x=%s y=%s", x, y), xb, yb); } + private static void catchNullArgument(Buffer b, Runnable thunk) { + tryCatch(b, NullPointerException.class, thunk); + } + private static void catchIllegalArgument(Buffer b, Runnable thunk) { tryCatch(b, IllegalArgumentException.class, thunk); } @@ -476,7 +506,10 @@ public class BasicShort if (ex.isAssignableFrom(x.getClass())) { caught = true; } else { - fail(x.getMessage() + " not expected"); + String s = x.getMessage(); + if (s == null) + s = x.getClass().getName(); + fail(s + " not expected"); } } if (!caught) { @@ -513,6 +546,9 @@ public class BasicShort bulkPutBuffer(b); relGet(b); + absBulkPutArray(b); + absBulkGet(b); + @@ -612,6 +648,26 @@ public class BasicShort } } + // Exceptions in absolute bulk operations + + catchNullArgument(b, () -> b.get(7, null, 0, 42)); + catchNullArgument(b, () -> b.put(7, (short[])null, 0, 42)); + + short[] tmpa = new short[42]; + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42)); + + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1)); + catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1)); + catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1)); + catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42)); + // Values b.clear(); @@ -819,6 +875,7 @@ public class BasicShort catchReadOnlyBuffer(b, () -> absPut(rb)); catchReadOnlyBuffer(b, () -> bulkPutArray(rb)); catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb)); + catchReadOnlyBuffer(b, () -> absBulkPutArray(rb)); // put(ShortBuffer) should not change source position final ShortBuffer src = ShortBuffer.allocate(1); @@ -920,6 +977,13 @@ public class BasicShort + + + + + + + From 9d263d4bc10311599b7c81aebada64bcc18a95ab Mon Sep 17 00:00:00 2001 From: Valerie Peng Date: Wed, 20 Feb 2019 19:16:45 +0000 Subject: [PATCH 049/109] 8216597: SIGBUS in Java_sun_security_pkcs11_wrapper_PKCS11_getNativeKeyInfo after JDK-6913047 Changed variable declaration type to byte* from long* to fix SIGBUS error Reviewed-by: ascarpino --- .../classes/sun/security/pkcs11/P11Key.java | 4 +-- .../share/native/libj2pkcs11/p11_keymgmt.c | 29 ++++++++++--------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java index ba0ede3878e..57f93a1e505 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -106,7 +106,7 @@ abstract class P11Key implements Key, Length { static { PrivilegedAction getKeyExtractionProp = () -> System.getProperty( - "sun.security.pkcs11.disableKeyExtraction", "true"); + "sun.security.pkcs11.disableKeyExtraction", "false"); String disableKeyExtraction = AccessController.doPrivileged(getKeyExtractionProp); DISABLE_NATIVE_KEYS_EXTRACTION = diff --git a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c index aef5de2921a..d41b8176005 100644 --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -151,14 +151,14 @@ Java_sun_security_pkcs11_wrapper_PKCS11_getNativeKeyInfo unsigned int i = 0U; unsigned long totalDataSize = 0UL, attributesCount = 0UL; unsigned long totalCkAttributesSize = 0UL, totalNativeKeyInfoArraySize = 0UL; - unsigned long* wrappedKeySizePtr = NULL; + jbyte* wrappedKeySizePtr = NULL; jbyte* nativeKeyInfoArrayRawCkAttributes = NULL; jbyte* nativeKeyInfoArrayRawCkAttributesPtr = NULL; jbyte* nativeKeyInfoArrayRawDataPtr = NULL; CK_MECHANISM ckMechanism; char iv[16] = {0x0}; CK_ULONG ckWrappedKeyLength = 0U; - unsigned long* wrappedKeySizeWrappedKeyArrayPtr = NULL; + jbyte* wrappedKeySizeWrappedKeyArrayPtr = NULL; CK_BYTE_PTR wrappedKeyBufferPtr = NULL; CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj); CK_OBJECT_CLASS class; @@ -234,7 +234,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_getNativeKeyInfo // * sizes are expressed in bytes and data type is unsigned long totalCkAttributesSize = attributesCount * sizeof(CK_ATTRIBUTE); TRACE1("DEBUG: GetNativeKeyInfo attributesCount = %lu\n", attributesCount); - TRACE1("DEBUG: GetNativeKeyInfo sizeof CK_ATTRIBUTE = %lu\n", sizeof(CK_ATTRIBUTE)); + TRACE1("DEBUG: GetNativeKeyInfo sizeof CK_ATTRIBUTE = %zu\n", sizeof(CK_ATTRIBUTE)); TRACE1("DEBUG: GetNativeKeyInfo totalCkAttributesSize = %lu\n", totalCkAttributesSize); TRACE1("DEBUG: GetNativeKeyInfo totalDataSize = %lu\n", totalDataSize); @@ -254,8 +254,8 @@ Java_sun_security_pkcs11_wrapper_PKCS11_getNativeKeyInfo goto cleanup; } - wrappedKeySizePtr = (unsigned long*)(nativeKeyInfoArrayRaw + - sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize); + wrappedKeySizePtr = nativeKeyInfoArrayRaw + + sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize; memcpy(nativeKeyInfoArrayRaw, &totalCkAttributesSize, sizeof(unsigned long)); memcpy(nativeKeyInfoArrayRaw + sizeof(unsigned long) + totalCkAttributesSize, @@ -330,15 +330,15 @@ Java_sun_security_pkcs11_wrapper_PKCS11_getNativeKeyInfo memcpy(nativeKeyInfoWrappedKeyArrayRaw, nativeKeyInfoArrayRaw, totalNativeKeyInfoArraySize); wrappedKeySizeWrappedKeyArrayPtr = - (unsigned long*)(nativeKeyInfoWrappedKeyArrayRaw + + nativeKeyInfoWrappedKeyArrayRaw + sizeof(unsigned long)*2 + totalCkAttributesSize + - totalDataSize); + totalDataSize; memcpy(wrappedKeySizeWrappedKeyArrayPtr, &ckWrappedKeyLength, sizeof(unsigned long)); TRACE1("DEBUG: GetNativeKeyInfo 1st C_WrapKey wrappedKeyLength = %lu\n", ckWrappedKeyLength); wrappedKeyBufferPtr = - (unsigned char*)wrappedKeySizeWrappedKeyArrayPtr + - sizeof(unsigned long); + (CK_BYTE_PTR) (wrappedKeySizeWrappedKeyArrayPtr + + sizeof(unsigned long)); rv = (*ckpFunctions->C_WrapKey)(ckSessionHandle, &ckMechanism, jLongToCKULong(jWrappingKeyHandle),ckObjectHandle, wrappedKeyBufferPtr, &ckWrappedKeyLength); @@ -414,7 +414,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_createNativeKey jbyte* nativeKeyInfoArrayRawCkAttributesPtr = NULL; jbyte* nativeKeyInfoArrayRawDataPtr = NULL; unsigned long totalDataSize = 0UL; - unsigned long* wrappedKeySizePtr = NULL; + jbyte* wrappedKeySizePtr = NULL; unsigned int i = 0U; CK_MECHANISM ckMechanism; char iv[16] = {0x0}; @@ -443,8 +443,8 @@ Java_sun_security_pkcs11_wrapper_PKCS11_createNativeKey sizeof(unsigned long)); TRACE1("DEBUG: createNativeKey totalDataSize = %lu\n", totalDataSize); - wrappedKeySizePtr = (unsigned long*)(nativeKeyInfoArrayRaw + - sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize); + wrappedKeySizePtr = nativeKeyInfoArrayRaw + + sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize; memcpy(&ckWrappedKeyLength, wrappedKeySizePtr, sizeof(unsigned long)); TRACE1("DEBUG: createNativeKey wrappedKeyLength = %lu\n", ckWrappedKeyLength); @@ -470,7 +470,8 @@ Java_sun_security_pkcs11_wrapper_PKCS11_createNativeKey jMechanismToCKMechanism(env, jWrappingMech, &ckMechanism); rv = (*ckpFunctions->C_UnwrapKey)(ckSessionHandle, &ckMechanism, jLongToCKULong(jWrappingKeyHandle), - (CK_BYTE_PTR)(wrappedKeySizePtr + 1), ckWrappedKeyLength, + (CK_BYTE_PTR)(wrappedKeySizePtr + sizeof(unsigned long)), + ckWrappedKeyLength, (CK_ATTRIBUTE_PTR)nativeKeyInfoArrayRawCkAttributes, jLongToCKULong(nativeKeyInfoCkAttributesCount), &ckObjectHandle); From 6559dfbda0cc7a1360d4d90423e0bcfb8e4e7643 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Wed, 20 Feb 2019 11:32:53 -0800 Subject: [PATCH 050/109] 8219395: integrate gcov w/ run-test Reviewed-by: erikj --- make/RunTests.gmk | 18 ++++++++++--- make/autoconf/jdk-options.m4 | 2 +- make/conf/jib-profiles.js | 49 +++++++++++++++++++++++++++++++++++- 3 files changed, 63 insertions(+), 6 deletions(-) diff --git a/make/RunTests.gmk b/make/RunTests.gmk index 3fccf3cd5b2..d9409e546d5 100644 --- a/make/RunTests.gmk +++ b/make/RunTests.gmk @@ -112,6 +112,9 @@ GTEST_LAUNCHER_DIRS := $(patsubst %/gtestLauncher, %, \ GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, \ $(GTEST_LAUNCHER_DIRS))) +COV_ENVIRONMENT := +JTREG_COV_OPTIONS := + ifeq ($(TEST_OPTS_JCOV), true) JCOV_OUTPUT_DIR := $(TEST_RESULTS_DIR)/jcov-output JCOV_GRABBER_LOG := $(JCOV_OUTPUT_DIR)/grabber.log @@ -122,12 +125,18 @@ ifeq ($(TEST_OPTS_JCOV), true) # Replace our normal test JDK with the JCov image. JDK_UNDER_TEST := $(JCOV_IMAGE_DIR) - JCOV_ENVIRONMENT := JAVA_TOOL_OPTIONS="$(JCOV_MEM_OPTIONS)" \ + COV_ENVIRONMENT += JAVA_TOOL_OPTIONS="$(JCOV_MEM_OPTIONS)" \ _JAVA_OPTIONS="$(JCOV_MEM_OPTIONS)" - JTREG_JCOV_OPTIONS := -e:JAVA_TOOL_OPTIONS='$(JCOV_MEM_OPTIONS)' \ + JTREG_COV_OPTIONS += -e:JAVA_TOOL_OPTIONS='$(JCOV_MEM_OPTIONS)' \ -e:_JAVA_OPTIONS='$(JCOV_MEM_OPTIONS)' endif +ifeq ($(GCOV_ENABLED), true) + GCOV_OUTPUT_DIR := $(TEST_RESULTS_DIR)/gcov-output + COV_ENVIRONMENT += GCOV_PREFIX="$(GCOV_OUTPUT_DIR)" + JTREG_COV_OPTIONS += -e:GCOV_PREFIX="$(GCOV_OUTPUT_DIR)" +endif + ################################################################################ # Optionally create AOT libraries for specified modules before running tests. # Note, this could not be done during JDK build time. @@ -170,6 +179,7 @@ define SetupAotModuleBody $$(call LogWarn, Generating $$(patsubst $$(OUTPUTDIR)/%, %, $$@)) $$(call MakeTargetDir) $$(call ExecuteWithLog, $$@, \ + $((COV_ENVIRONMENT) \ $$(FIXPATH) $$(JDK_UNDER_TEST)/bin/jaotc \ $$($1_JAOTC_OPTS) --output $$@ --module $$($1_MODULE) \ ) @@ -907,7 +917,7 @@ define SetupRunJtregTestBody $$(call LogWarn, Running test '$$($1_TEST)') $$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR)) $$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/jtreg, \ - $$(JCOV_ENVIRONMENT) \ + $$(COV_ENVIRONMENT) \ $$(JAVA) $$($1_JTREG_LAUNCHER_OPTIONS) \ -Dprogram=jtreg -jar $$(JT_HOME)/lib/jtreg.jar \ $$($1_JTREG_BASIC_OPTIONS) \ @@ -917,7 +927,7 @@ define SetupRunJtregTestBody -workDir:$$($1_TEST_SUPPORT_DIR) \ $$(JTREG_OPTIONS) \ $$(JTREG_FAILURE_HANDLER_OPTIONS) \ - $$(JTREG_JCOV_OPTIONS) \ + $$(JTREG_COV_OPTIONS) \ $$($1_TEST_NAME) \ && $$(ECHO) $$$$? > $$($1_EXITCODE) \ || $$(ECHO) $$$$? > $$($1_EXITCODE) \ diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index 5ee34aeeeee..ec410c86cc0 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -364,7 +364,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS], ################################################################################ # -# Gcov coverage data for hotspot +# Native and Java code coverage # AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE], [ diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index aea5f6a7ba0..a880c36ddd6 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -521,6 +521,15 @@ var getJibProfilesProfiles = function (input, common, data) { profiles[maketestName].default_make_targets = [ "test-make" ]; }); + // Generate -gcov profiles + [ "linux-x64", "macosx-x64" ].forEach(function (name) { + var gcovName = name + "-gcov"; + profiles[gcovName] = clone(profiles[name]); + profiles[gcovName].default_make_targets = ["product-bundles", "test-bundles"]; + profiles[gcovName].configure_args = concat(profiles[gcovName].configure_args, + ["--enable-native-coverage", "--disable-warnings-as-errors"]); + }); + // Profiles for building the zero jvm variant. These are used for verification. var zeroProfiles = { "linux-x64-zero": { @@ -772,6 +781,40 @@ var getJibProfilesProfiles = function (input, common, data) { }; }); + // Artifacts of gcov (native-code-coverage) profiles + [ "linux-x64", "macosx-x64" ].forEach(function (name) { + var o = artifactData[name] + var pf = o.platform + var jdk_subdir = (o.jdk_subdir != null ? o.jdk_subdir : "jdk-" + data.version); + var jdk_suffix = (o.jdk_suffix != null ? o.jdk_suffix : "tar.gz"); + var gcovName = name + "-gcov"; + profiles[gcovName].artifacts = { + jdk: { + local: "bundles/\\(jdk.*bin." + jdk_suffix + "\\)", + remote: [ + "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov." + jdk_suffix, + ], + subdir: jdk_subdir, + exploded: "images/jdk", + }, + test: { + local: "bundles/\\(jdk.*bin-tests.tar.gz\\)", + remote: [ + "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov-tests.tar.gz", + ], + exploded: "images/test" + }, + jdk_symbols: { + local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)", + remote: [ + "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov-symbols.tar.gz", + ], + subdir: jdk_subdir, + exploded: "images/jdk" + }, + }; + }); + // Profiles used to run tests. var testOnlyProfiles = { "run-test": { @@ -798,6 +841,10 @@ var getJibProfilesProfiles = function (input, common, data) { } else { testedProfileTest = testedProfile + ".test"; } + var testOnlyMake = [ "run-test-prebuilt", "LOG_CMDLINES=true", "JTREG_VERBOSE=fail,error,time" ]; + if (testedProfile.endsWith("-gcov")) { + testOnlyMake = concat(testOnlyMake, "GCOV_ENABLED=true") + } var testOnlyProfilesPrebuilt = { "run-test-prebuilt": { target_os: input.build_os, @@ -807,7 +854,7 @@ var getJibProfilesProfiles = function (input, common, data) { testedProfileTest ], src: "src.conf", - make_args: [ "run-test-prebuilt", "LOG_CMDLINES=true", "JTREG_VERBOSE=fail,error,time" ], + make_args: testOnlyMake, environment: { "BOOT_JDK": common.boot_jdk_home, "JDK_IMAGE_DIR": input.get(testedProfileJDK, "home_path"), From 6f5c0097560118a51786cd7f22a3e9e88e07ec38 Mon Sep 17 00:00:00 2001 From: Lin Zang Date: Wed, 20 Feb 2019 11:36:02 -0800 Subject: [PATCH 051/109] =?UTF-8?q?8215622:=20Add=20dump=20to=20file=20sup?= =?UTF-8?q?port=20for=20jmap=20=E2=80=93histo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add "file=" to jmap "histo" jmap, Hotspot support in attachListener.cpp:heap_inspection. Reviewed-by: phh, sspitsyn --- src/hotspot/share/services/attachListener.cpp | 37 ++++++++-- src/hotspot/share/services/attachListener.hpp | 2 +- .../sun/tools/attach/VirtualMachineImpl.java | 6 +- .../sun/tools/attach/VirtualMachineImpl.java | 6 +- .../sun/tools/attach/VirtualMachineImpl.java | 6 +- .../sun/tools/attach/VirtualMachineImpl.java | 4 +- .../sun/tools/attach/VirtualMachineImpl.java | 4 +- .../share/classes/sun/tools/jmap/JMap.java | 74 +++++++++++++------ .../util/logging/TestLoggerWeakRefLeak.java | 6 +- test/jdk/sun/tools/jmap/BasicJMapTest.java | 72 +++++++++++++++++- 10 files changed, 166 insertions(+), 51 deletions(-) diff --git a/src/hotspot/share/services/attachListener.cpp b/src/hotspot/share/services/attachListener.cpp index 81b0fa19c54..fe296b22d04 100644 --- a/src/hotspot/share/services/attachListener.cpp +++ b/src/hotspot/share/services/attachListener.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2019, 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 @@ -257,19 +257,40 @@ jint dump_heap(AttachOperation* op, outputStream* out) { // See also: ClassHistogramDCmd class // // Input arguments :- -// arg0: "-live" or "-all" +// arg0: Name of the dump file or NULL +// arg1: "-live" or "-all" static jint heap_inspection(AttachOperation* op, outputStream* out) { bool live_objects_only = true; // default is true to retain the behavior before this change is made - const char* arg0 = op->arg(0); - if (arg0 != NULL && (strlen(arg0) > 0)) { - if (strcmp(arg0, "-all") != 0 && strcmp(arg0, "-live") != 0) { - out->print_cr("Invalid argument to inspectheap operation: %s", arg0); + outputStream* os = out; // if path not specified or path is NULL, use out + fileStream* fs = NULL; + const char* path = op->arg(0); + if (path != NULL) { + if (path[0] == '\0') { + out->print_cr("No dump file specified"); + } else { + // create file + fs = new (ResourceObj::C_HEAP, mtInternal) fileStream(path); + if (fs == NULL) { + out->print_cr("Failed to allocate space for file: %s", path); + return JNI_ERR; + } + os = fs; + } + } + const char* arg1 = op->arg(1); + if (arg1 != NULL && (strlen(arg1) > 0)) { + if (strcmp(arg1, "-all") != 0 && strcmp(arg1, "-live") != 0) { + out->print_cr("Invalid argument to inspectheap operation: %s", arg1); return JNI_ERR; } - live_objects_only = strcmp(arg0, "-live") == 0; + live_objects_only = strcmp(arg1, "-live") == 0; } - VM_GC_HeapInspection heapop(out, live_objects_only /* request full gc */); + VM_GC_HeapInspection heapop(os, live_objects_only /* request full gc */); VMThread::execute(&heapop); + if (os != NULL && os != out) { + out->print_cr("Heap inspection file created: %s", path); + delete fs; + } return JNI_OK; } diff --git a/src/hotspot/share/services/attachListener.hpp b/src/hotspot/share/services/attachListener.hpp index c59ac76981b..2b653639689 100644 --- a/src/hotspot/share/services/attachListener.hpp +++ b/src/hotspot/share/services/attachListener.hpp @@ -106,7 +106,7 @@ class AttachOperation: public CHeapObj { enum { name_length_max = 16, // maximum length of name arg_length_max = 1024, // maximum length of argument - arg_count_max = 3 // maximum number of arguments + arg_count_max = 4 // maximum number of arguments }; // name of special operation that can be enqueued when all diff --git a/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java b/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java index 8d2edb831f8..8541bf88186 100644 --- a/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java +++ b/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2018, SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -138,7 +138,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { * Execute the given command in the target VM. */ InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException { - assert args.length <= 3; // includes null + assert args.length <= 4; // includes null // did we detach? synchronized (this) { @@ -166,7 +166,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { writeString(s, PROTOCOL_VERSION); writeString(s, cmd); - for (int i=0; i<3; i++) { + for (int i = 0; i < 4; i++) { if (i < args.length && args[i] != null) { writeString(s, (String)args[i]); } else { diff --git a/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java b/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java index debfef00a34..0966f182dfd 100644 --- a/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java +++ b/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2019, 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 @@ -143,7 +143,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { * Execute the given command in the target VM. */ InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException { - assert args.length <= 3; // includes null + assert args.length <= 4; // includes null // did we detach? synchronized (this) { @@ -171,7 +171,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { writeString(s, PROTOCOL_VERSION); writeString(s, cmd); - for (int i=0; i<3; i++) { + for (int i = 0; i < 4; i++) { if (i < args.length && args[i] != null) { writeString(s, (String)args[i]); } else { diff --git a/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java b/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java index 0ca39214e4d..64beabcba64 100644 --- a/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java +++ b/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2019, 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 @@ -139,7 +139,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { * Execute the given command in the target VM. */ InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException { - assert args.length <= 3; // includes null + assert args.length <= 4; // includes null // did we detach? synchronized (this) { @@ -167,7 +167,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { writeString(s, PROTOCOL_VERSION); writeString(s, cmd); - for (int i=0; i<3; i++) { + for (int i = 0; i < 4; i++) { if (i < args.length && args[i] != null) { writeString(s, (String)args[i]); } else { diff --git a/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java b/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java index 269fbc7ad0a..6948a969504 100644 --- a/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java +++ b/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2019, 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 @@ -126,7 +126,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { * Execute the given command in the target VM. */ InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException { - assert args.length <= 3; // includes null + assert args.length <= 4; // includes null // first check that we are still attached int door; diff --git a/src/jdk.attach/windows/classes/sun/tools/attach/VirtualMachineImpl.java b/src/jdk.attach/windows/classes/sun/tools/attach/VirtualMachineImpl.java index a6f2279ecfc..7e839a7a64a 100644 --- a/src/jdk.attach/windows/classes/sun/tools/attach/VirtualMachineImpl.java +++ b/src/jdk.attach/windows/classes/sun/tools/attach/VirtualMachineImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2019, 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 @@ -77,7 +77,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException { - assert args.length <= 3; // includes null + assert args.length <= 4; // includes null // create a pipe using a random name Random rnd = new Random(); diff --git a/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java b/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java index 393834c2414..8611a335506 100644 --- a/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java +++ b/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2019, 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 @@ -145,22 +145,52 @@ public class JMap { vm.detach(); } + private static String parseFileName(String opt) { + // opt starts with "file=" + if (opt.length() > 5) { + // pass whole "file=" string + String filename = opt.substring(5); + try { + // Get the canonical path - important to avoid just + // passing a "heap.bin" and having the dump created + // in the target VM working directory rather than the + // directory where jmap is executed. + return new File(filename).getCanonicalPath(); + } catch (IOException ioe) { + return null; + } + } + // no filename + return null; + } + private static void histo(String pid, String options) throws AttachNotSupportedException, IOException, UnsupportedEncodingException { String liveopt = "-all"; - if (options.isEmpty() || options.equals("all")) { - // pass - } - else if (options.equals("live")) { - liveopt = "-live"; - } - else { - usage(1); + String filename = null; + String subopts[] = options.split(","); + + for (int i = 0; i < subopts.length; i++) { + String subopt = subopts[i]; + if (subopt.equals("") || subopt.equals("all")) { + // pass + } else if (subopt.equals("live")) { + liveopt = "-live"; + } else if (subopt.startsWith("file=")) { + filename = parseFileName(subopt); + if (filename == null) { + usage(1); // invalid options or no filename + } + } else { + usage(1); + } } + System.out.flush(); + // inspectHeap is not the same as jcmd GC.class_histogram - executeCommandForPid(pid, "inspectheap", liveopt); + executeCommandForPid(pid, "inspectheap", filename, liveopt); } private static void dump(String pid, String options) @@ -176,10 +206,7 @@ public class JMap { if (subopt.equals("live")) { liveopt = "-live"; } else if (subopt.startsWith("file=")) { - // file= - check that is specified - if (subopt.length() > 5) { - filename = subopt.substring(5); - } + filename = parseFileName(subopt); } } @@ -187,11 +214,6 @@ public class JMap { usage(1); // invalid options or no filename } - // get the canonical path - important to avoid just passing - // a "heap.bin" and having the dump created in the target VM - // working directory rather than the directory where jmap - // is executed. - filename = new File(filename).getCanonicalPath(); // dumpHeap is not the same as jcmd GC.heap_dump executeCommandForPid(pid, "dumpheap", filename, liveopt); } @@ -246,21 +268,27 @@ public class JMap { System.err.println(" to connect to running process and print class loader statistics"); System.err.println(" jmap -finalizerinfo "); System.err.println(" to connect to running process and print information on objects awaiting finalization"); - System.err.println(" jmap -histo[:live] "); + System.err.println(" jmap -histo[:[]] "); System.err.println(" to connect to running process and print histogram of java object heap"); - System.err.println(" if the \"live\" suboption is specified, only count live objects"); System.err.println(" jmap -dump: "); System.err.println(" to connect to running process and dump java heap"); System.err.println(" jmap -? -h --help"); System.err.println(" to print this help message"); System.err.println(""); System.err.println(" dump-options:"); - System.err.println(" live dump only live objects; if not specified,"); - System.err.println(" all objects in the heap are dumped."); + System.err.println(" live dump only live objects"); + System.err.println(" all dump all objects in the heap (default if one of \"live\" or \"all\" is not specified"); System.err.println(" format=b binary format"); System.err.println(" file= dump heap to "); System.err.println(""); System.err.println(" Example: jmap -dump:live,format=b,file=heap.bin "); + System.err.println(""); + System.err.println(" histo-options:"); + System.err.println(" live count only live objects"); + System.err.println(" all count all objects in the heap (default if one of \"live\" or \"all\" is not specified)"); + System.err.println(" file= dump data to "); + System.err.println(""); + System.err.println(" Example: jmap -histo:live,file=/tmp/histo.data "); System.exit(exit); } } diff --git a/test/jdk/java/util/logging/TestLoggerWeakRefLeak.java b/test/jdk/java/util/logging/TestLoggerWeakRefLeak.java index d33b6d32429..0929b5341ff 100644 --- a/test/jdk/java/util/logging/TestLoggerWeakRefLeak.java +++ b/test/jdk/java/util/logging/TestLoggerWeakRefLeak.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019, 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 @@ -123,7 +123,7 @@ public class TestLoggerWeakRefLeak { } /** - * 'vm.heapHisto("-live")' will request a full GC + * 'vm.heapHisto("", "-live")' will request a full GC */ private static int getInstanceCountFromHeapHisto() throws AttachNotSupportedException, Exception { int instanceCount = 0; @@ -131,7 +131,7 @@ public class TestLoggerWeakRefLeak { HotSpotVirtualMachine vm = (HotSpotVirtualMachine) VirtualMachine .attach(Long.toString(ProcessTools.getProcessId())); try { - try (InputStream heapHistoStream = vm.heapHisto("-live"); + try (InputStream heapHistoStream = vm.heapHisto("", "-live"); BufferedReader in = new BufferedReader(new InputStreamReader(heapHistoStream))) { String inputLine; while ((inputLine = in.readLine()) != null) { diff --git a/test/jdk/sun/tools/jmap/BasicJMapTest.java b/test/jdk/sun/tools/jmap/BasicJMapTest.java index d1982248893..88d95164087 100644 --- a/test/jdk/sun/tools/jmap/BasicJMapTest.java +++ b/test/jdk/sun/tools/jmap/BasicJMapTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2019, 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,15 +50,22 @@ public class BasicJMapTest { public static void main(String[] args) throws Exception { testHisto(); testHistoLive(); + testHistoAll(); + testHistoToFile(); + testHistoLiveToFile(); + testHistoAllToFile(); testFinalizerInfo(); testClstats(); testDump(); testDumpLive(); + testDumpAll(); } private static void testHisto() throws Exception { - OutputAnalyzer output = jmap("-histo"); + OutputAnalyzer output = jmap("-histo:"); output.shouldHaveExitValue(0); + OutputAnalyzer output1 = jmap("-histo"); + output1.shouldHaveExitValue(0); } private static void testHistoLive() throws Exception { @@ -66,6 +73,50 @@ public class BasicJMapTest { output.shouldHaveExitValue(0); } + private static void testHistoAll() throws Exception { + OutputAnalyzer output = jmap("-histo:all"); + output.shouldHaveExitValue(0); + } + + private static void testHistoToFile() throws Exception { + histoToFile(false); + } + + private static void testHistoLiveToFile() throws Exception { + histoToFile(true); + } + + private static void testHistoAllToFile() throws Exception { + boolean explicitAll = true; + histoToFile(false, explicitAll); + } + + private static void histoToFile(boolean live) throws Exception { + boolean explicitAll = false; + histoToFile(live, explicitAll); + } + + private static void histoToFile(boolean live, boolean explicitAll) throws Exception { + if (live == true && explicitAll == true) { + fail("Illegal argument setting for jmap -histo"); + } + File file = new File("jmap.histo.file" + System.currentTimeMillis() + ".histo"); + if (file.exists()) { + file.delete(); + } + OutputAnalyzer output; + if (live) { + output = jmap("-histo:live,file=" + file.getName()); + } else if (explicitAll == true) { + output = jmap("-histo:all,file=" + file.getName()); + } else { + output = jmap("-histo:file=" + file.getName()); + } + output.shouldHaveExitValue(0); + output.shouldContain("Heap inspection file created"); + file.delete(); + } + private static void testFinalizerInfo() throws Exception { OutputAnalyzer output = jmap("-finalizerinfo"); output.shouldHaveExitValue(0); @@ -84,7 +135,20 @@ public class BasicJMapTest { dump(true); } + private static void testDumpAll() throws Exception { + boolean explicitAll = true; + dump(false, explicitAll); + } + private static void dump(boolean live) throws Exception { + boolean explicitAll = false; + dump(live, explicitAll); + } + + private static void dump(boolean live, boolean explicitAll) throws Exception { + if (live == true && explicitAll == true) { + fail("Illegal argument setting for jmap -dump"); + } File dump = new File("jmap.dump." + System.currentTimeMillis() + ".hprof"); if (dump.exists()) { dump.delete(); @@ -92,6 +156,8 @@ public class BasicJMapTest { OutputAnalyzer output; if (live) { output = jmap("-dump:live,format=b,file=" + dump.getName()); + } else if (explicitAll == true) { + output = jmap("-dump:all,format=b,file=" + dump.getName()); } else { output = jmap("-dump:format=b,file=" + dump.getName()); } @@ -121,7 +187,7 @@ public class BasicJMapTest { launcher.addToolArg(Long.toString(ProcessTools.getProcessId())); processBuilder.command(launcher.getCommand()); - System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", "")); + System.out.println(Arrays.toString(processBuilder.command().toArray())); OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); System.out.println(output.getOutput()); From 4128d632878dbc59c62f2e20dafb7a5c79510b62 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Wed, 20 Feb 2019 11:51:23 -0800 Subject: [PATCH 052/109] 8219476: cleanup hotspot ProblemList Reviewed-by: jwilhelm --- test/hotspot/jtreg/ProblemList-graal.txt | 2 +- test/hotspot/jtreg/ProblemList.txt | 6 +++--- test/jdk/ProblemList-Xcomp.txt | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/test/hotspot/jtreg/ProblemList-graal.txt b/test/hotspot/jtreg/ProblemList-graal.txt index 8ac75093329..57ff1c1d6cc 100644 --- a/test/hotspot/jtreg/ProblemList-graal.txt +++ b/test/hotspot/jtreg/ProblemList-graal.txt @@ -226,4 +226,4 @@ org.graalvm.compiler.core.test.deopt.CompiledMethodTest 8202955 org.graalvm.compiler.hotspot.test.ReservedStackAccessTest 8213567 windows-all -org.graalvm.compiler.hotspot.test.CheckGraalIntrinsics 8218698 +org.graalvm.compiler.hotspot.test.CheckGraalIntrinsics 8218074 diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 172aef141bd..2056fb7206b 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -57,9 +57,9 @@ compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java 8190680 generic-all compiler/runtime/Test8168712.java 8211769,8211771 generic-ppc64,generic-ppc64le,linux-s390x -applications/ctw/modules/java_desktop.java 8189604 windows-all -applications/ctw/modules/java_desktop_2.java 8189604 windows-all -applications/ctw/modules/jdk_jconsole.java 8189604 windows-all +applications/ctw/modules/java_desktop.java 8205016 windows-all +applications/ctw/modules/java_desktop_2.java 8205016 windows-all +applications/ctw/modules/jdk_jconsole.java 8205016 windows-all ############################################################################# diff --git a/test/jdk/ProblemList-Xcomp.txt b/test/jdk/ProblemList-Xcomp.txt index 71061225523..3345c52ee97 100644 --- a/test/jdk/ProblemList-Xcomp.txt +++ b/test/jdk/ProblemList-Xcomp.txt @@ -28,5 +28,4 @@ ############################################################################# java/lang/invoke/MethodHandles/CatchExceptionTest.java 8146623 generic-all -java/util/concurrent/CountDownLatch/Basic.java 8195057 generic-all java/util/stream/test/org/openjdk/tests/java/util/stream/StreamLinkTest.java 8216317 solaris-all From 16e097968079a2c4f6b7aa96f43fc3d13636076a Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Wed, 20 Feb 2019 16:20:53 -0500 Subject: [PATCH 053/109] 8218995: Deprecate the -XX:FailOverToOldVerifier option Deprecate the option and change affected tests so that they no longer need the option. Reviewed-by: dholmes, lfoltan --- src/hotspot/share/runtime/arguments.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index f88d51296ab..27985cb64d8 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -529,6 +529,7 @@ static SpecialFlag const special_jvm_flags[] = { { "InitialRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, { "UseMembar", JDK_Version::jdk(10), JDK_Version::jdk(12), JDK_Version::undefined() }, { "CompilationPolicyChoice", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::undefined() }, + { "FailOverToOldVerifier", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::undefined() }, // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in: { "DefaultMaxRAMFraction", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() }, From b578cf83c9d1e2e2e4547dd24a59844152cfc508 Mon Sep 17 00:00:00 2001 From: Jesper Wilhelmsson Date: Thu, 21 Feb 2019 01:06:53 +0100 Subject: [PATCH 054/109] Added tag jdk-13+9 for changeset c081f3ea6b93 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index ca498024215..f502fc81248 100644 --- a/.hgtags +++ b/.hgtags @@ -544,3 +544,4 @@ b5f05fe4a6f8b3996a000c20078b356d991ca8ec jdk-13+6 b5f7bb57de2f797be34f6c75d45c3245ad37ab97 jdk-12+31 a535ba736cabc6886acdff36de3a096c46e5ddc5 jdk-13+8 4ce47bc1fb92cf94c6e3d1f49d582f02dcb851ab jdk-12+32 +c081f3ea6b9300265a4a34e38f970b1e3ddaae9f jdk-13+9 From 431b49663a60676d79dd0a951e03f499795b8caa Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Wed, 20 Feb 2019 16:15:02 -0800 Subject: [PATCH 055/109] 8218998: Add metadata to generated API documentation files Reviewed-by: hannesw --- .../html/AbstractModuleIndexWriter.java | 26 +- .../html/AbstractPackageIndexWriter.java | 14 +- .../formats/html/AllClassesFrameWriter.java | 5 +- .../formats/html/AllClassesIndexWriter.java | 4 +- .../formats/html/AllPackagesIndexWriter.java | 4 +- .../html/AnnotationTypeWriterImpl.java | 7 +- .../doclets/formats/html/ClassUseWriter.java | 6 +- .../doclets/formats/html/ClassWriterImpl.java | 7 +- .../html/ConstantsSummaryWriterImpl.java | 4 +- .../formats/html/DeprecatedListWriter.java | 5 +- .../formats/html/DocFilesHandlerImpl.java | 4 +- .../formats/html/FrameOutputWriter.java | 4 +- .../doclets/formats/html/HelpWriter.java | 4 +- .../formats/html/HtmlDocletWriter.java | 77 +++- .../formats/html/IndexRedirectWriter.java | 2 + .../formats/html/ModuleFrameWriter.java | 8 +- .../formats/html/ModuleIndexFrameWriter.java | 4 +- .../formats/html/ModuleIndexWriter.java | 4 +- .../html/ModulePackageIndexFrameWriter.java | 7 +- .../formats/html/ModuleWriterImpl.java | 3 +- .../formats/html/PackageFrameWriter.java | 9 +- .../formats/html/PackageIndexFrameWriter.java | 7 +- .../formats/html/PackageIndexWriter.java | 4 +- .../formats/html/PackageTreeWriter.java | 4 +- .../formats/html/PackageUseWriter.java | 7 +- .../formats/html/PackageWriterImpl.java | 7 +- .../html/SerializedFormWriterImpl.java | 4 +- .../formats/html/SingleIndexWriter.java | 4 +- .../formats/html/SourceToHTMLConverter.java | 8 +- .../formats/html/SplitIndexWriter.java | 5 +- .../doclets/formats/html/TreeWriter.java | 4 +- .../doclets/formats/html/markup/Head.java | 28 +- .../doclet/testMetadata/TestMetadata.java | 357 ++++++++++++++++++ 33 files changed, 565 insertions(+), 82 deletions(-) create mode 100644 test/langtools/jdk/javadoc/doclet/testMetadata/TestMetadata.java diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java index c996e489bf0..794d7ceb5f4 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, 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 @@ -33,7 +33,6 @@ import java.util.SortedMap; import javax.lang.model.element.ModuleElement; import javax.lang.model.element.PackageElement; -import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; @@ -124,11 +123,13 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter { * methods from the sub-class in order to generate Frame or Non * Frame format. * - * @param title the title of the window. + * @param title the title of the window + * @param description the content for the description META tag * @param includeScript boolean set true if windowtitle script is to be included * @throws DocFileIOException if there is a problem building the module index file */ - protected void buildModuleIndexFile(String title, boolean includeScript) throws DocFileIOException { + protected void buildModuleIndexFile(String title, String description, boolean includeScript) + throws DocFileIOException { String windowOverview = resources.getText(title); Content body = getBody(includeScript, getWindowTitle(windowOverview)); Content header = HtmlTree.HEADER(); @@ -142,8 +143,11 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter { body.addContent(header); body.addContent(main); body.addContent(footer); - printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title, - configuration.doctitle), includeScript, body); + printHtmlDocument( + configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle), + description, + includeScript, + body); } /** @@ -152,11 +156,12 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter { * Frame format. * * @param title the title of the window. + * @param description the content for the description META tag * @param includeScript boolean set true if windowtitle script is to be included * @param mdle the name of the module being documented * @throws DocFileIOException if there is an exception building the module packages index file */ - protected void buildModulePackagesIndexFile(String title, + protected void buildModulePackagesIndexFile(String title, String description, boolean includeScript, ModuleElement mdle) throws DocFileIOException { String windowOverview = resources.getText(title); Content body = getBody(includeScript, getWindowTitle(windowOverview)); @@ -171,8 +176,11 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter { body.addContent(header); body.addContent(main); body.addContent(footer); - printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title, - configuration.doctitle), includeScript, body); + printHtmlDocument( + configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle), + description, + includeScript, + body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java index 783eaa5c3a8..7ffd97c38dc 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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,6 @@ import java.util.*; import javax.lang.model.element.PackageElement; -import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; @@ -109,11 +108,13 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter { * methods from the sub-class in order to generate Frame or Non * Frame format. * - * @param title the title of the window. + * @param title the title of the window + * @param description the content for the description META tag * @param includeScript boolean set true if windowtitle script is to be included * @throws DocFileIOException if there is a problem building the package index file */ - protected void buildPackageIndexFile(String title, boolean includeScript) throws DocFileIOException { + protected void buildPackageIndexFile(String title, String description, boolean includeScript) + throws DocFileIOException { String windowOverview = resources.getText(title); Content body = getBody(includeScript, getWindowTitle(windowOverview)); Content header = HtmlTree.HEADER(); @@ -127,8 +128,9 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter { body.addContent(header); body.addContent(main); body.addContent(footer); - printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title, - configuration.doctitle), includeScript, body); + printHtmlDocument( + configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle), + description, includeScript, body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java index 973b97e358e..2f4a3914448 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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,6 @@ package jdk.javadoc.internal.doclets.formats.html; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; -import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; @@ -122,7 +121,7 @@ public class AllClassesFrameWriter extends HtmlDocletWriter { HtmlTree div = HtmlTree.DIV(HtmlStyle.indexContainer, ul); htmlTree.addContent(div); body.addContent(htmlTree); - printHtmlDocument(null, false, body); + printHtmlDocument(null, "all classes (frame)", false, body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java index be90f49cfc6..3d5ba0dbbc0 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -117,7 +117,7 @@ public class AllClassesIndexWriter extends HtmlDocletWriter { footer.addContent(navBar.getContent(false)); addBottom(footer); bodyTree.addContent(footer); - printHtmlDocument(null, true, bodyTree); + printHtmlDocument(null, "class index", true, bodyTree); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java index dc0f9ed6cac..d07013c6d2d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -105,7 +105,7 @@ public class AllPackagesIndexWriter extends HtmlDocletWriter { footer.addContent(navBar.getContent(false)); addBottom(footer); bodyTree.addContent(footer); - printHtmlDocument(null, true, bodyTree); + printHtmlDocument(null, "package index", true, bodyTree); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java index 632c5ad7ddf..5baa77fae64 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -152,8 +152,11 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter */ @Override public void printDocument(Content contentTree) throws DocFileIOException { + String description = getDescription("declaration", annotationType); printHtmlDocument(configuration.metakeywords.getMetaKeywords(annotationType), - true, contentTree); + description, + true, + contentTree); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java index 55b74b70d0f..42624d22891 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ package jdk.javadoc.internal.doclets.formats.html; import jdk.javadoc.internal.doclets.formats.html.markup.Table; -import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -241,7 +240,8 @@ public class ClassUseWriter extends SubWriterHolderWriter { footer.addContent(navBar.getContent(false)); addBottom(footer); body.addContent(footer); - printHtmlDocument(null, true, body); + String description = getDescription("use", typeElement); + printHtmlDocument(null, description, true, body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java index 771291276b6..bfa9b0820db 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -177,8 +177,11 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite */ @Override public void printDocument(Content contentTree) throws DocFileIOException { + String description = getDescription("declaration", typeElement); printHtmlDocument(configuration.metakeywords.getMetaKeywords(typeElement), - true, contentTree); + description, + true, + contentTree); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java index cc9c6de6b0a..b0c08ee17f8 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -328,6 +328,6 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons */ @Override public void printDocument(Content contentTree) throws DocFileIOException { - printHtmlDocument(null, true, contentTree); + printHtmlDocument(null, "summary of constants", true, contentTree); } } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java index 987c69f103e..14ad271c9b3 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -308,7 +308,8 @@ public class DeprecatedListWriter extends SubWriterHolderWriter { htmlTree.addContent(navBar.getContent(false)); addBottom(htmlTree); body.addContent(htmlTree); - printHtmlDocument(null, true, body); + String description = "deprecated elements"; + printHtmlDocument(null, description, true, body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java index 192425bf705..dae6d154f27 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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 @@ -197,7 +197,7 @@ public class DocFilesHandlerImpl implements DocFilesHandler { footer.addContent(navBar.getContent(false)); docletWriter.addBottom(footer); htmlContent.addContent(footer); - docletWriter.printHtmlDocument(Collections.emptyList(), false, localTagsContent, htmlContent); + docletWriter.printHtmlDocument(Collections.emptyList(), null, false, localTagsContent, htmlContent); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java index 89b15451b3d..0e52298c46e 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FrameOutputWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -128,6 +128,8 @@ public class FrameOutputWriter extends HtmlDocletWriter { Head head = new Head(path, configuration.docletVersion) .setTimestamp(!configuration.notimestamp) .setTitle(title) + .setDescription("frames") + .setGenerator(getGenerator(getClass())) .setCharset(configuration.charset) .setStylesheets(configuration.getMainStylesheet(), configuration.getAdditionalStylesheets()) .addDefaultScript(false) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java index fab5fe64847..9ce70ff5d13 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -100,7 +100,7 @@ public class HelpWriter extends HtmlDocletWriter { htmlTree.addContent(navBar.getContent(false)); addBottom(htmlTree); body.addContent(htmlTree); - printHtmlDocument(null, true, body); + printHtmlDocument(null, "help", true, body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java index 3311cfa5b0b..df8b211b05c 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -41,6 +41,7 @@ import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.ModuleElement; import javax.lang.model.element.Name; import javax.lang.model.element.PackageElement; +import javax.lang.model.element.QualifiedNameable; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import javax.lang.model.type.DeclaredType; @@ -421,14 +422,18 @@ public class HtmlDocletWriter { * @param metakeywords Array of String keywords for META tag. Each element * of the array is assigned to a separate META tag. * Pass in null for no array + * @param description the content for the description META tag. * @param includeScript true if printing windowtitle script * false for files that appear in the left-hand frames * @param body the body htmltree to be included in the document * @throws DocFileIOException if there is a problem writing the file */ - public void printHtmlDocument(List metakeywords, boolean includeScript, - Content body) throws DocFileIOException { - printHtmlDocument(metakeywords, includeScript, new ContentBuilder(), body); + public void printHtmlDocument(List metakeywords, + String description, + boolean includeScript, + Content body) + throws DocFileIOException { + printHtmlDocument(metakeywords, description, includeScript, new ContentBuilder(), body); } /** @@ -437,24 +442,31 @@ public class HtmlDocletWriter { * @param metakeywords Array of String keywords for META tag. Each element * of the array is assigned to a separate META tag. * Pass in null for no array + * @param description the content for the description META tag. * @param includeScript true if printing windowtitle script * false for files that appear in the left-hand frames - * @param extraContent any additional content to be included in the HEAD element + * @param extraHeadContent any additional content to be included in the HEAD element * @param body the body htmltree to be included in the document * @throws DocFileIOException if there is a problem writing the file */ - public void printHtmlDocument(List metakeywords, boolean includeScript, Content extraContent, - Content body) throws DocFileIOException { + public void printHtmlDocument(List metakeywords, + String description, + boolean includeScript, + Content extraHeadContent, + Content body) + throws DocFileIOException { Content htmlComment = contents.newPage; Head head = new Head(path, configuration.docletVersion) .setTimestamp(!configuration.notimestamp) + .setDescription(description) + .setGenerator(getGenerator(getClass())) .setTitle(winTitle) .setCharset(configuration.charset) .addKeywords(metakeywords) .setStylesheets(configuration.getMainStylesheet(), configuration.getAdditionalStylesheets()) .setUseModuleDirectories(configuration.useModuleDirectories) .setIndex(configuration.createindex, mainBodyScript) - .addContent(extraContent); + .addContent(extraHeadContent); Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head.toContent(), body); HtmlDocument htmlDocument = new HtmlDocument(htmlComment, htmlTree); @@ -2110,6 +2122,55 @@ public class HtmlDocletWriter { return new TableHeader(contents.packageLabel, contents.descriptionLabel); } + /** + * Generates a string for use in a description meta element, + * based on an element and its enclosing elements + * @param prefix a prefix for the string + * @param elem the element + * @return the description + */ + static String getDescription(String prefix, Element elem) { + LinkedList chain = new LinkedList<>(); + for (Element e = elem; e != null; e = e.getEnclosingElement()) { + // ignore unnamed enclosing elements + if (e.getSimpleName().length() == 0 && e != elem) { + break; + } + chain.addFirst(e); + } + StringBuilder sb = new StringBuilder(); + for (Element e: chain) { + CharSequence name; + switch (e.getKind()) { + case MODULE: + case PACKAGE: + name = ((QualifiedNameable) e).getQualifiedName(); + if (name.length() == 0) { + name = ""; + } + break; + + default: + name = e.getSimpleName(); + break; + } + + if (sb.length() == 0) { + sb.append(prefix).append(": "); + } else { + sb.append(", "); + } + sb.append(e.getKind().toString().toLowerCase(Locale.US).replace("_", " ")) + .append(": ") + .append(name); + } + return sb.toString(); + } + + static String getGenerator(Class clazz) { + return "javadoc/" + clazz.getSimpleName(); + } + /** * Returns an HtmlTree for the SCRIPT tag. * diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java index fccaf03e5f8..c4724ecdb44 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java @@ -79,6 +79,8 @@ public class IndexRedirectWriter extends HtmlDocletWriter { Content htmlComment = contents.newPage; Head head = new Head(path, configuration.docletVersion) .setTimestamp(true) + .setDescription("index redirect") + .setGenerator(getGenerator(getClass())) .setStylesheets(configuration.getMainStylesheet(), Collections.emptyList()) // avoid reference to default stylesheet .addDefaultScript(false); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java index 345264ce7fb..bc6cb06bea1 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, 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 @@ -36,7 +36,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; -import jdk.javadoc.internal.doclets.formats.html.markup.Links; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; @@ -111,7 +110,10 @@ public class ModuleFrameWriter extends HtmlDocletWriter { htmlTree.addContent(div); body.addContent(htmlTree); mdlgen.printHtmlDocument( - configuration.metakeywords.getMetaKeywordsForModule(moduleElement), false, body); + configuration.metakeywords.getMetaKeywordsForModule(moduleElement), + "module summary (frame)", + false, + body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java index b6a2e8ff2e3..f096330fd4a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, 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 @@ -77,7 +77,7 @@ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter { public static void generate(HtmlConfiguration configuration) throws DocFileIOException { DocPath filename = DocPaths.MODULE_OVERVIEW_FRAME; ModuleIndexFrameWriter modulegen = new ModuleIndexFrameWriter(configuration, filename); - modulegen.buildModuleIndexFile("doclet.Window_Overview", false); + modulegen.buildModuleIndexFile("doclet.Window_Overview", "module overview (frame)", false); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java index 8d10365aad6..e7caabe3804 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, 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 @@ -74,7 +74,7 @@ public class ModuleIndexWriter extends AbstractModuleIndexWriter { public static void generate(HtmlConfiguration configuration) throws DocFileIOException { DocPath filename = DocPaths.overviewSummary(configuration.frames); ModuleIndexWriter mdlgen = new ModuleIndexWriter(configuration, filename); - mdlgen.buildModuleIndexFile("doclet.Window_Overview_Summary", true); + mdlgen.buildModuleIndexFile("doclet.Window_Overview_Summary", "module index", true); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java index 28cf5ea110c..be5eb67c346 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, 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 @@ -77,7 +77,10 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter { public static void generate(HtmlConfiguration configuration, ModuleElement mdle) throws DocFileIOException { DocPath filename = configuration.docPaths.moduleFrame(mdle); ModulePackageIndexFrameWriter modpackgen = new ModulePackageIndexFrameWriter(configuration, filename); - modpackgen.buildModulePackagesIndexFile("doclet.Window_Overview", false, mdle); + modpackgen.buildModulePackagesIndexFile("doclet.Window_Overview", + getDescription("module package index", mdle) + " (frame)", + false, + mdle); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java index e167ba87b66..9f5e8a4e083 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, 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 @@ -915,6 +915,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW @Override public void printDocument(Content contentTree) throws DocFileIOException { printHtmlDocument(configuration.metakeywords.getMetaKeywordsForModule(mdle), + getDescription("declaration", mdle), true, contentTree); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java index 4cfadf5b129..ac1269a70c7 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -89,7 +89,7 @@ public class PackageFrameWriter extends HtmlDocletWriter { /** * Generate a package summary page for the left-hand bottom frame. Construct - * the PackageFrameWriter object and then uses it generate the file. + * the PackageFrameWriter object and then use it generate the file. * * @param configuration the current configuration of the doclet. * @param packageElement The package for which "pacakge-frame.html" is to be generated. @@ -111,7 +111,10 @@ public class PackageFrameWriter extends HtmlDocletWriter { htmlTree.addContent(div); body.addContent(htmlTree); packgen.printHtmlDocument( - configuration.metakeywords.getMetaKeywords(packageElement), false, body); + configuration.metakeywords.getMetaKeywords(packageElement), + getDescription("package summary (frame)", packageElement), + false, + body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java index 8005d435451..ecbf34fd4e3 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -31,7 +31,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; -import jdk.javadoc.internal.doclets.formats.html.markup.Links; import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.toolkit.Content; @@ -70,7 +69,9 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter { public static void generate(HtmlConfiguration configuration) throws DocFileIOException { DocPath filename = DocPaths.OVERVIEW_FRAME; PackageIndexFrameWriter packgen = new PackageIndexFrameWriter(configuration, filename); - packgen.buildPackageIndexFile("doclet.Window_Overview", false); + packgen.buildPackageIndexFile("doclet.Window_Overview", + "package index (frame)", + false); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java index 7e36de51c20..793bcdba7c9 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -78,7 +78,7 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter { public static void generate(HtmlConfiguration configuration) throws DocFileIOException { DocPath filename = DocPaths.overviewSummary(configuration.frames); PackageIndexWriter packgen = new PackageIndexWriter(configuration, filename); - packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", true); + packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", "package index", true); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java index 02dd11e6bc7..359a8bb953a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -121,7 +121,7 @@ public class PackageTreeWriter extends AbstractTreeWriter { footer.addContent(navBar.getContent(false)); addBottom(footer); body.addContent(footer); - printHtmlDocument(null, true, body); + printHtmlDocument(null, getDescription("tree", packageElement), true, body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java index 3d370e8262b..6bdb9472fc2 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -141,7 +141,10 @@ public class PackageUseWriter extends SubWriterHolderWriter { footer.addContent(navBar.getContent(false)); addBottom(footer); body.addContent(footer); - printHtmlDocument(null, true, body); + printHtmlDocument(null, + getDescription("use", packageElement), + true, + body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java index cd139a3c060..f651592dbd7 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -316,7 +316,10 @@ public class PackageWriterImpl extends HtmlDocletWriter */ @Override public void printDocument(Content contentTree) throws DocFileIOException { + String description = getDescription("declaration", packageElement); printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageElement), - true, contentTree); + description, + true, + contentTree); } } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java index 4a93f1fd9af..b11367ef32f 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -255,7 +255,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter */ @Override public void printDocument(Content serializedTree) throws DocFileIOException { - printHtmlDocument(null, true, serializedTree); + printHtmlDocument(null, "serialized forms", true, serializedTree); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java index cc16512350f..c2361d3710a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -121,7 +121,7 @@ public class SingleIndexWriter extends AbstractIndexWriter { addBottom(htmlTree); body.addContent(htmlTree); createSearchIndexFiles(); - printHtmlDocument(null, true, body); + printHtmlDocument(null, "index", true, body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java index 4369b457918..0720a2802b4 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -196,7 +196,7 @@ public class SourceToHTMLConverter { addBlankLines(pre); Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre); body.addContent(HtmlTree.MAIN(div)); - writeToFile(body, outputdir.resolve(configuration.docPaths.forClass(te))); + writeToFile(body, outputdir.resolve(configuration.docPaths.forClass(te)), te); } catch (IOException e) { String message = resources.getText("doclet.exception.read.file", fo.getName()); throw new SimpleDocletException(message, e); @@ -209,11 +209,13 @@ public class SourceToHTMLConverter { * @param body the documentation content to be written to the file. * @param path the path for the file. */ - private void writeToFile(Content body, DocPath path) throws DocFileIOException { + private void writeToFile(Content body, DocPath path, TypeElement te) throws DocFileIOException { Head head = new Head(path, configuration.docletVersion) // .setTimestamp(!configuration.notimestamp) // temporary: compatibility! .setTitle(resources.getText("doclet.Window_Source_title")) // .setCharset(configuration.charset) // temporary: compatibility! + .setDescription(HtmlDocletWriter.getDescription("source", te)) + .setGenerator(HtmlDocletWriter.getGenerator(getClass())) .addDefaultScript(false) .setStylesheets(configuration.getMainStylesheet(), configuration.getAdditionalStylesheets()); Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java index 0bdc62f2607..b03b9018e5e 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -144,7 +144,8 @@ public class SplitIndexWriter extends AbstractIndexWriter { footer.addContent(navBar.getContent(false)); addBottom(footer); body.addContent(footer); - printHtmlDocument(null, true, body); + String description = "index: " + unicode; + printHtmlDocument(null, description, true, body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java index f0158355fa4..b5d3b026e38 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -127,7 +127,7 @@ public class TreeWriter extends AbstractTreeWriter { htmlTree.addContent(navBar.getContent(false)); addBottom(htmlTree); body.addContent(htmlTree); - printHtmlDocument(null, true, body); + printHtmlDocument(null, "class tree", true, body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java index b86a6c6d834..08b657b79ad 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -56,6 +56,8 @@ public class Head { private String title; private String charset; private final List keywords; + private String description; + private String generator; private boolean showTimestamp; private boolean useModuleDirectories; private DocFile mainStylesheetFile; @@ -110,6 +112,22 @@ public class Head { return this; } + /** + * Sets the content for the description META element. + */ + public Head setDescription(String description) { + this.description = description; + return this; + } + + /** + * Sets the content for the generator META element. + */ + public Head setGenerator(String generator) { + this.generator = generator; + return this; + } + /** * Adds a list of keywords to appear in META [@code keywords} elements. * @@ -245,6 +263,14 @@ public class Head { tree.addContent(HtmlTree.META("dc.created", dateFormat.format(now))); } + if (description != null) { + tree.addContent(HtmlTree.META("description", description)); + } + + if (generator != null) { + tree.addContent(HtmlTree.META("generator", generator)); + } + for (String k : keywords) { tree.addContent(HtmlTree.META("keywords", k)); } diff --git a/test/langtools/jdk/javadoc/doclet/testMetadata/TestMetadata.java b/test/langtools/jdk/javadoc/doclet/testMetadata/TestMetadata.java new file mode 100644 index 00000000000..865a210e77f --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/testMetadata/TestMetadata.java @@ -0,0 +1,357 @@ +/* + * Copyright (c) 2019, 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 8218998 + * @summary Add metadata to generated API documentation files + * @library /tools/lib ../../lib + * @modules jdk.javadoc/jdk.javadoc.internal.tool + * @modules jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * jdk.javadoc/jdk.javadoc.internal.api + * jdk.javadoc/jdk.javadoc.internal.tool + * @build toolbox.ToolBox toolbox.JavacTask javadoc.tester.* + * @run main TestMetadata + */ + +import java.io.IOException; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import toolbox.ModuleBuilder; +import toolbox.ToolBox; + +import javadoc.tester.JavadocTester; + +public class TestMetadata extends JavadocTester { + public static void main(String... args) throws Exception { + TestMetadata tester = new TestMetadata(); + tester.runTests(); + } + + enum Frames { NO_FRAMES, FRAMES }; + enum Index { SINGLE, SPLIT }; + enum Source { PACKAGES, MODULES }; + + final ToolBox tb = new ToolBox(); + final Set allGeneratorsFound = new HashSet<>(); + + public void runTests() throws Exception { + for (Source s : Source.values()) { + Path src = genSource(s); + for (Frames f : Frames.values()) { + for (Index i : Index.values()) { + List args = new ArrayList<>(); + args.add("-d"); + args.add(String.format("out-%s-%s-%s", s, f, i)); + args.add("-use"); + if (s != Source.MODULES) { + args.add("-linksource"); // broken, with modules: JDK-8219060 + } + args.add(f == Frames.NO_FRAMES ? "--no-frames" : "--frames"); + if (i == Index.SPLIT) { + args.add("-splitIndex"); + } + if (s == Source.PACKAGES) { + args.add("-sourcepath"); + args.add(src.toString()); + args.add("pA"); + args.add("pB"); + } else { + args.add("--module-source-path"); + args.add(src.toString()); + args.add("--module"); + args.add("mA,mB"); + } + javadoc(args.toArray(new String[args.size()])); + checkExit(Exit.OK); + checkMetadata(); + + // spot check the descriptions for declarations + switch (s) { + case PACKAGES: + checkOutput("pA/package-summary.html", true, + ""); + checkOutput("pA/CA.html", true, + ""); + break; + + case MODULES: + checkOutput("mA/module-summary.html", true, + ""); + checkOutput("mA/pA/package-summary.html", true, + ""); + checkOutput("mA/pA/CA.html", true, + ""); + break; + } + } + } + } + + checking ("all generators"); + if (allGeneratorsFound.equals(allGenerators)) { + passed("all generators found"); + } else { + Set notFound = new TreeSet<>(allGenerators); + notFound.removeAll(allGeneratorsFound); + failed("not found: " + notFound); + } + + printSummary(); + } + + final Pattern nl = Pattern.compile("[\\r\\n]+"); + final Pattern contentPattern = Pattern.compile("content=\"([^\"]+)\">"); + final Pattern generatorPattern = Pattern.compile("content=\"javadoc/([^\"]+)\">"); + final Set allGenerators = Set.of( + "AllClassesFrameWriter", + "AllClassesIndexWriter", + "AllPackagesIndexWriter", + "AnnotationTypeWriterImpl", + "ClassUseWriter", + "ClassWriterImpl", + "ConstantsSummaryWriterImpl", + "DeprecatedListWriter", + "DocFileWriter", + "FrameOutputWriter", + "HelpWriter", + "IndexRedirectWriter", + "ModuleFrameWriter", + "ModuleIndexFrameWriter", + "ModuleIndexWriter", + "ModulePackageIndexFrameWriter", + "ModuleWriterImpl", + "PackageFrameWriter", + "PackageIndexFrameWriter", + "PackageIndexWriter", + "PackageTreeWriter", + "PackageUseWriter", + "PackageWriterImpl", + "SerializedFormWriterImpl", + "SingleIndexWriter", + "SourceToHTMLConverter", + "SplitIndexWriter", + "TreeWriter" + ); + + void checkMetadata() throws IOException { + Path outputDirPath = outputDir.toPath(); + for (Path p : tb.findFiles(".html", outputDirPath)) { + checkMetadata(outputDirPath.relativize(p)); + } + } + + void checkMetadata(Path p) { + checking("Check generator: " + p); + + List generators = nl.splitAsStream(readOutputFile(p.toString())) + .filter(s -> s.contains(" descriptions = nl.splitAsStream(readOutputFile(p.toString())) + .filter(s -> s.contains("\nExtra"); + break; + + case MODULES: + new ModuleBuilder(tb, "mA") + .exports("pA") + .classes("/** Package mA/pA. */ package pA;") + .classes("/** Class mA/pA.CA. */ package pA; public class CA { }") + .write(src); + new ModuleBuilder(tb, "mB") + .exports("pB") + .classes("/** Package mB/pB. */ package pB;") + .classes("/** Class mB/pB.CB. */ package pB; public class CB { }") + .write(src); + break; + } + + return src; + } +} + From e2054e3c5d25bdd3766d178922528d8fc0c7e6b0 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Wed, 20 Feb 2019 19:41:43 -0500 Subject: [PATCH 056/109] 8217765: Internal Error (javaCalls.cpp:61) guarantee(thread->can_call_java()) failed Reviewed-by: rehn, redestad, coleenp --- src/hotspot/share/oops/instanceKlass.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index 05ff886e958..5ad8b9116db 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -183,8 +183,14 @@ bool InstanceKlass::has_nest_member(InstanceKlass* k, TRAPS) const { if (name == k->name()) { log_trace(class, nestmates)("- Found it at nest_members[%d] => cp[%d]", i, cp_index); - // names match so check actual klass - this may trigger class loading if - // it doesn't match (but that should be impossible) + // Names match so check actual klass - this may trigger class loading if + // it doesn't match (though that should be impossible). But to be safe we + // have to check for a compiler thread executing here. + if (!THREAD->can_call_java() && !_constants->tag_at(cp_index).is_klass()) { + log_trace(class, nestmates)("- validation required resolution in an unsuitable thread"); + return false; + } + Klass* k2 = _constants->klass_at(cp_index, CHECK_false); if (k2 == k) { log_trace(class, nestmates)("- class is listed as a nest member"); @@ -296,7 +302,7 @@ InstanceKlass* InstanceKlass::nest_host(Symbol* validationException, TRAPS) { error); } - if (validationException != NULL) { + if (validationException != NULL && THREAD->can_call_java()) { ResourceMark rm(THREAD); Exceptions::fthrow(THREAD_AND_LOCATION, validationException, From e6f6863cbcf5e913c1035a7834907689f5889747 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Wed, 20 Feb 2019 18:46:30 -0800 Subject: [PATCH 057/109] 8168069: X509TrustManagerImpl causes ClassLoader leaks with unparseable extensions Reviewed-by: mullan --- .../sun/security/ssl/SSLContextImpl.java | 49 ++++++++++++++----- .../security/x509/CertificateExtensions.java | 9 ++-- .../ssl/SSLContextImpl/BadKSProvider.java | 18 ++++--- .../ssl/SSLContextImpl/BadTSProvider.java | 16 ++---- 4 files changed, 56 insertions(+), 36 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java b/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java index f7b1095ace2..0572079d8d2 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java @@ -921,29 +921,45 @@ public abstract class SSLContextImpl extends SSLContextSpi { static { Exception reserved = null; - TrustManager[] tmMediator; + TrustManager[] tmMediator = null; try { tmMediator = getTrustManagers(); } catch (Exception e) { reserved = e; - tmMediator = new TrustManager[0]; + if (SSLLogger.isOn && SSLLogger.isOn("ssl,defaultctx")) { + SSLLogger.warning( + "Failed to load default trust managers", e); + } } - trustManagers = tmMediator; + KeyManager[] kmMediator = null; if (reserved == null) { - KeyManager[] kmMediator; try { kmMediator = getKeyManagers(); } catch (Exception e) { reserved = e; - kmMediator = new KeyManager[0]; + if (SSLLogger.isOn && SSLLogger.isOn("ssl,defaultctx")) { + SSLLogger.warning( + "Failed to load default key managers", e); + } } - keyManagers = kmMediator; - } else { - keyManagers = new KeyManager[0]; } - reservedException = reserved; + if (reserved != null) { + trustManagers = new TrustManager[0]; + keyManagers = new KeyManager[0]; + + // Important note: please don't reserve the original exception + // object, which may be not garbage collection friendly as + // 'reservedException' is a static filed. + reservedException = + new KeyManagementException(reserved.getMessage()); + } else { + trustManagers = tmMediator; + keyManagers = kmMediator; + + reservedException = null; + } } private static TrustManager[] getTrustManagers() throws Exception { @@ -1071,21 +1087,30 @@ public abstract class SSLContextImpl extends SSLContextSpi { private static final class DefaultSSLContextHolder { private static final SSLContextImpl sslContext; - static Exception reservedException = null; + private static final Exception reservedException; static { + Exception reserved = null; SSLContextImpl mediator = null; if (DefaultManagersHolder.reservedException != null) { - reservedException = DefaultManagersHolder.reservedException; + reserved = DefaultManagersHolder.reservedException; } else { try { mediator = new DefaultSSLContext(); } catch (Exception e) { - reservedException = e; + // Important note: please don't reserve the original + // exception object, which may be not garbage collection + // friendly as 'reservedException' is a static filed. + reserved = new KeyManagementException(e.getMessage()); + if (SSLLogger.isOn && SSLLogger.isOn("ssl,defaultctx")) { + SSLLogger.warning( + "Failed to load default SSLContext", e); + } } } sslContext = mediator; + reservedException = reserved; } } diff --git a/src/java.base/share/classes/sun/security/x509/CertificateExtensions.java b/src/java.base/share/classes/sun/security/x509/CertificateExtensions.java index e76a8b331f3..1ccf0267888 100644 --- a/src/java.base/share/classes/sun/security/x509/CertificateExtensions.java +++ b/src/java.base/share/classes/sun/security/x509/CertificateExtensions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -355,7 +355,7 @@ public class CertificateExtensions implements CertAttrSet { class UnparseableExtension extends Extension { private String name; - private Throwable why; + private String exceptionDescription; public UnparseableExtension(Extension ext, Throwable why) { super(ext); @@ -371,12 +371,13 @@ class UnparseableExtension extends Extension { // If we cannot find the name, just ignore it } - this.why = why; + this.exceptionDescription = why.toString(); } @Override public String toString() { return super.toString() + - "Unparseable " + name + "extension due to\n" + why + "\n\n" + + "Unparseable " + name + "extension due to\n" + + exceptionDescription + "\n\n" + new HexDumpEncoder().encodeBuffer(getExtensionValue()); } } diff --git a/test/jdk/sun/security/ssl/SSLContextImpl/BadKSProvider.java b/test/jdk/sun/security/ssl/SSLContextImpl/BadKSProvider.java index 9fdc0797f94..74bf432dc5e 100644 --- a/test/jdk/sun/security/ssl/SSLContextImpl/BadKSProvider.java +++ b/test/jdk/sun/security/ssl/SSLContextImpl/BadKSProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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,14 +21,16 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test - * @bug 4919147 + * @bug 4919147 8168069 * @summary Support for token-based KeyStores * @run main/othervm BadKSProvider - * - * SunJSSE does not support dynamic system properties, no way to re-use - * system properties in samevm/agentvm mode. */ import java.io.*; @@ -176,16 +178,16 @@ public class BadKSProvider { // catching the exception is ok, // but let's try to confirm it is the right exception. // - // XXX this test must be updated if the exception message changes + // Note: this test must be updated if the exception message changes Throwable cause = se.getCause(); - if (cause instanceof java.security.NoSuchAlgorithmException == false) { + if (!(cause instanceof java.security.NoSuchAlgorithmException)) { se.printStackTrace(); throw new Exception("Unexpected exception" + se); } cause = cause.getCause(); - if (cause instanceof java.security.NoSuchProviderException == false) { + if (!(cause instanceof java.security.KeyManagementException)) { se.printStackTrace(); throw new Exception("Unexpected exception" + se); } diff --git a/test/jdk/sun/security/ssl/SSLContextImpl/BadTSProvider.java b/test/jdk/sun/security/ssl/SSLContextImpl/BadTSProvider.java index 28d13157431..0e0b8772fd7 100644 --- a/test/jdk/sun/security/ssl/SSLContextImpl/BadTSProvider.java +++ b/test/jdk/sun/security/ssl/SSLContextImpl/BadTSProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -28,7 +28,7 @@ /* * @test - * @bug 4919147 + * @bug 4919147 8168069 * @summary Support for token-based KeyStores * @run main/othervm BadTSProvider */ @@ -175,12 +175,10 @@ public class BadTSProvider { new BadTSProvider(); throw new SecurityException("expected no-such-provider exception"); } catch (SocketException se) { - // catching the exception is ok, // but let's try to confirm it is the right exception. // - // XXX this test must be updated if the exception message changes - + // Note: this test must be updated if the exception message changes Throwable cause = se.getCause(); if (!(cause instanceof NoSuchAlgorithmException)) { se.printStackTrace(); @@ -188,13 +186,7 @@ public class BadTSProvider { } cause = cause.getCause(); - if (!(cause instanceof KeyStoreException)) { - se.printStackTrace(); - throw new Exception("Unexpected exception" + se); - } - - cause = cause.getCause(); - if (!(cause instanceof NoSuchProviderException)) { + if (!(cause instanceof KeyManagementException)) { se.printStackTrace(); throw new Exception("Unexpected exception" + se); } From dcf38e3cfed2df3f58b6c46abdb10246f8382d30 Mon Sep 17 00:00:00 2001 From: Priya Lakshmi Muthuswamy Date: Thu, 21 Feb 2019 11:26:39 +0530 Subject: [PATCH 058/109] 8213354: Support package-specific stylesheets Reviewed-by: jjg --- .../html/AnnotationTypeWriterImpl.java | 6 +- .../doclets/formats/html/ClassWriterImpl.java | 6 +- .../formats/html/DocFilesHandlerImpl.java | 11 ++- .../formats/html/HtmlConfiguration.java | 2 + .../formats/html/HtmlDocletWriter.java | 17 ++++ .../formats/html/PackageWriterImpl.java | 5 +- .../doclets/toolkit/DocFilesHandler.java | 4 + .../TestPackageSpecificStylesheet.java | 96 +++++++++++++++++++ 8 files changed, 137 insertions(+), 10 deletions(-) create mode 100644 test/langtools/jdk/javadoc/doclet/testPackageSpecificStylesheet/TestPackageSpecificStylesheet.java diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java index 5baa77fae64..c69d76d5f23 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java @@ -153,10 +153,10 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter @Override public void printDocument(Content contentTree) throws DocFileIOException { String description = getDescription("declaration", annotationType); + PackageElement pkg = utils.containingPackage(this.annotationType); + Content stylesheetContent = getLocalStylesheetContent(pkg); printHtmlDocument(configuration.metakeywords.getMetaKeywords(annotationType), - description, - true, - contentTree); + description, true, stylesheetContent, contentTree); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java index bfa9b0820db..917d96a1815 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java @@ -178,10 +178,10 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite @Override public void printDocument(Content contentTree) throws DocFileIOException { String description = getDescription("declaration", typeElement); + PackageElement pkg = utils.containingPackage(typeElement); + Content stylesheetContent = getLocalStylesheetContent(pkg); printHtmlDocument(configuration.metakeywords.getMetaKeywords(typeElement), - description, - true, - contentTree); + description, true, stylesheetContent, contentTree); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java index dae6d154f27..a012f0f5a42 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java @@ -31,7 +31,6 @@ import com.sun.source.doctree.StartElementTree; import com.sun.source.doctree.TextTree; import com.sun.source.util.DocTreeFactory; import com.sun.tools.doclint.HtmlTag; -import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; import jdk.javadoc.internal.doclets.toolkit.Content; @@ -125,6 +124,16 @@ public class DocFilesHandlerImpl implements DocFilesHandler { } } + public List getStylesheets() throws DocFileIOException { + List stylesheets = new ArrayList(); + for (DocFile srcdir : DocFile.list(configuration, location, source)) { + for (DocFile srcFile : srcdir.list()) { + if (srcFile.getName().endsWith(".css")) + stylesheets.add(DocPaths.DOC_FILES.resolve(srcFile.getName())); + } + } + return stylesheets; + } private void copyDirectory(DocFile srcdir, final DocPath dstDocPath, boolean first) throws DocFileIOException { diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java index 932fc97e7bc..d034d99461d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java @@ -240,6 +240,8 @@ public class HtmlConfiguration extends BaseConfiguration { public DocPaths docPaths; + public Map> localStylesheetMap = new HashMap<>(); + /** * Creates an object to hold the configuration for a doclet. * diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java index df8b211b05c..39f04b2a88d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java @@ -2219,4 +2219,21 @@ public class HtmlDocletWriter { Script getMainBodyScript() { return mainBodyScript; } + + Content getLocalStylesheetContent(Element element) throws DocFileIOException { + Content stylesheetContent = new ContentBuilder(); + List localStylesheets = configuration.localStylesheetMap.get(element); + if (localStylesheets == null) { + DocFilesHandlerImpl docFilesHandler = (DocFilesHandlerImpl)configuration + .getWriterFactory().getDocFilesHandler(element); + localStylesheets = docFilesHandler.getStylesheets(); + configuration.localStylesheetMap.put(element, localStylesheets); + } + for (DocPath stylesheet : localStylesheets) { + stylesheetContent.addContent(HtmlTree.LINK("stylesheet", + "text/css", stylesheet.getPath(), "Style")); + } + return stylesheetContent; + } + } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java index f651592dbd7..bcf2aebdfc5 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java @@ -317,9 +317,8 @@ public class PackageWriterImpl extends HtmlDocletWriter @Override public void printDocument(Content contentTree) throws DocFileIOException { String description = getDescription("declaration", packageElement); + Content stylesheetContent = getLocalStylesheetContent(packageElement); printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageElement), - description, - true, - contentTree); + description, true, stylesheetContent, contentTree); } } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/DocFilesHandler.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/DocFilesHandler.java index 181d856710a..92788ebda12 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/DocFilesHandler.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/DocFilesHandler.java @@ -26,6 +26,9 @@ package jdk.javadoc.internal.doclets.toolkit; +import java.util.List; + +import jdk.javadoc.internal.doclets.toolkit.util.DocPath; /** * The interface for copying doc-files to the output. * @@ -37,4 +40,5 @@ package jdk.javadoc.internal.doclets.toolkit; public interface DocFilesHandler { void copyDocFiles() throws DocletException; + List getStylesheets() throws DocletException; } diff --git a/test/langtools/jdk/javadoc/doclet/testPackageSpecificStylesheet/TestPackageSpecificStylesheet.java b/test/langtools/jdk/javadoc/doclet/testPackageSpecificStylesheet/TestPackageSpecificStylesheet.java new file mode 100644 index 00000000000..7cecf1b5323 --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/testPackageSpecificStylesheet/TestPackageSpecificStylesheet.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2019, 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 8213354 + * @summary Support package-specific stylesheets + * @library /tools/lib ../../lib + * @modules jdk.javadoc/jdk.javadoc.internal.tool + * @build javadoc.tester.* toolbox.ToolBox builder.ClassBuilder + * @run main TestPackageSpecificStylesheet + */ + + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; + +import builder.ClassBuilder; +import toolbox.ToolBox; + +import javadoc.tester.JavadocTester; + +public class TestPackageSpecificStylesheet extends JavadocTester { + + final ToolBox tb; + + public static void main(String... args) throws Exception { + TestPackageSpecificStylesheet tester = new TestPackageSpecificStylesheet(); + tester.runTests(m -> new Object[]{Paths.get(m.getName())}); + } + + TestPackageSpecificStylesheet() { + tb = new ToolBox(); + } + + @Test + public void test(Path base) throws Exception { + Path srcDir = base.resolve("src"); + Path outDir = base.resolve("out"); + + new ClassBuilder(tb, "pkg.A") + .setComments("test span style") + .setModifiers("public", "class") + .write(srcDir); + + Path docFilesDir = Files.createDirectories(srcDir.resolve("pkg").resolve("doc-files")); + Path stylesheet = docFilesDir.resolve("spanstyle.css"); + Files.createFile(stylesheet); + Files.write(stylesheet, List.of("span{ color:blue; }")); + + new ClassBuilder(tb, "pkg2.B") + .setModifiers("public", "class") + .write(srcDir); + + javadoc("-d", outDir.toString(), + "-sourcepath", srcDir.toString(), + "pkg", "pkg2"); + + checkExit(Exit.OK); + + checkOutput("pkg/A.html", true, + ""); + + checkOutput("pkg/package-summary.html", true, + ""); + + checkOutput("pkg2/B.html", false, + ""); + + } +} From 4f60b8d9e26b602e05a994729e5d4dd33d66637a Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Wed, 20 Feb 2019 17:29:30 +0100 Subject: [PATCH 059/109] 8219460: ppc: adjust NativeGeneralJump::insert_unconditional to stack allocated MacroAssembler Reviewed-by: mdoerr --- src/hotspot/cpu/ppc/nativeInst_ppc.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hotspot/cpu/ppc/nativeInst_ppc.cpp b/src/hotspot/cpu/ppc/nativeInst_ppc.cpp index 626167281e0..052ca1ba77e 100644 --- a/src/hotspot/cpu/ppc/nativeInst_ppc.cpp +++ b/src/hotspot/cpu/ppc/nativeInst_ppc.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 SAP SE. All rights reserved. + * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, SAP SE. 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 @@ -362,8 +362,8 @@ void NativeJump::verify() { void NativeGeneralJump::insert_unconditional(address code_pos, address entry) { CodeBuffer cb(code_pos, BytesPerInstWord + 1); - MacroAssembler* a = new MacroAssembler(&cb); - a->b(entry); + MacroAssembler a(&cb); + a.b(entry); ICache::ppc64_flush_icache_bytes(code_pos, NativeGeneralJump::instruction_size); } From 6f24f8aad6834e6b5c6a6930978c405632aa64e2 Mon Sep 17 00:00:00 2001 From: Jesper Wilhelmsson Date: Thu, 21 Feb 2019 01:04:46 +0100 Subject: [PATCH 060/109] Added tag jdk-12+33 for changeset b67884871b5f --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 0deec91eab8..c130ac5425b 100644 --- a/.hgtags +++ b/.hgtags @@ -535,3 +535,4 @@ f15d443f97318e9b40e6f451e327ff69ed4ec361 jdk-12+27 6c377af36a5c4203f16aed8a5e4c2ecc08fcd8bd jdk-12+30 b5f7bb57de2f797be34f6c75d45c3245ad37ab97 jdk-12+31 4ce47bc1fb92cf94c6e3d1f49d582f02dcb851ab jdk-12+32 +b67884871b5fff79c5ef3eb8ac74dd48d71ea9b1 jdk-12+33 From 55f23fea5c285ef1c8cd2d34f4f1ac5329076824 Mon Sep 17 00:00:00 2001 From: Roman Kennke Date: Thu, 21 Feb 2019 09:48:07 +0100 Subject: [PATCH 061/109] 8219486: Missing reg_mask_init() breaks x86_32 build Reviewed-by: vlivanov, dlong --- src/hotspot/cpu/x86/c2_init_x86.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/x86/c2_init_x86.cpp b/src/hotspot/cpu/x86/c2_init_x86.cpp index 81f1e4e50c3..3cf187bceb6 100644 --- a/src/hotspot/cpu/x86/c2_init_x86.cpp +++ b/src/hotspot/cpu/x86/c2_init_x86.cpp @@ -29,7 +29,7 @@ // processor dependent initialization for i486 -extern void reg_mask_init(); +LP64_ONLY(extern void reg_mask_init();) void Compile::pd_compiler2_init() { guarantee(CodeEntryAlignment >= InteriorEntryAlignment, "" ); @@ -60,5 +60,5 @@ void Compile::pd_compiler2_init() { OptoReg::invalidate(i); } } - reg_mask_init(); + LP64_ONLY(reg_mask_init();) } From 4aac63bb93adc4fce5447055360586edd3bb466a Mon Sep 17 00:00:00 2001 From: Gary Adams Date: Thu, 21 Feb 2019 05:06:41 -0500 Subject: [PATCH 062/109] 8219388: Misleading log message "issuspended002a debuggee launched" Reviewed-by: cjplummer, phh --- .../nsk/jdi/ClassType/invokeMethod/invokemethod001.java | 4 ++-- .../nsk/jdi/ClassType/newInstance/newinstance001.java | 4 ++-- .../nsk/jdi/ClassType/newInstance/newinstance002.java | 4 ++-- .../vmTestbase/nsk/jdi/ClassType/setValue/setvalue001.java | 4 ++-- .../vmTestbase/nsk/jdi/ClassType/setValue/setvalue002.java | 4 ++-- .../vmTestbase/nsk/jdi/ClassType/setValue/setvalue003.java | 4 ++-- .../vmTestbase/nsk/jdi/ClassType/setValue/setvalue004.java | 4 ++-- .../vmTestbase/nsk/jdi/ClassType/setValue/setvalue005.java | 4 ++-- .../nsk/jdi/LocalVariable/isVisible/isvisible001.java | 4 ++-- .../vmTestbase/nsk/jdi/Locatable/location/location001.java | 4 ++-- .../vmTestbase/nsk/jdi/Locatable/location/location004.java | 4 ++-- .../vmTestbase/nsk/jdi/Locatable/location/location005.java | 4 ++-- .../vmTestbase/nsk/jdi/Location/codeIndex/codeindex001.java | 4 ++-- .../nsk/jdi/Location/declaringType/declaringtype001.java | 4 ++-- .../jtreg/vmTestbase/nsk/jdi/Location/equals/equals001.java | 4 ++-- .../vmTestbase/nsk/jdi/Location/hashCode/hashcode001.java | 4 ++-- .../vmTestbase/nsk/jdi/Location/lineNumber/linenumber001.java | 4 ++-- .../nsk/jdi/Location/lineNumber_s/linenumber_s001.java | 4 ++-- .../vmTestbase/nsk/jdi/Location/sourceName/sourcename001.java | 4 ++-- .../nsk/jdi/Location/sourceName_s/sourcename_s001.java | 4 ++-- .../vmTestbase/nsk/jdi/Location/sourcePath/sourcepath001.java | 4 ++-- .../nsk/jdi/Location/sourcePath_s/sourcepath_s001.java | 4 ++-- .../nsk/jdi/Method/allLineLocations/alllinelocations001.java | 4 ++-- .../nsk/jdi/Method/allLineLocations/alllinelocations002.java | 4 ++-- .../Method/allLineLocations_ss/alllinelocations_ss001.java | 4 ++-- .../Method/locationOfCodeIndex/locationofcodeindex001.java | 4 ++-- .../nsk/jdi/Method/locationsOfLine/locationsofline001.java | 4 ++-- .../Method/locationsOfLine_ssi/locationsofline_ssi001.java | 4 ++-- .../jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001.java | 4 ++-- .../nsk/jdi/Mirror/virtualMachine/virtualmachine001.java | 4 ++-- .../disableCollection/disablecollection001.java | 4 ++-- .../nsk/jdi/ObjectReference/entryCount/entrycount001.java | 4 ++-- .../vmTestbase/nsk/jdi/ObjectReference/equals/equals001.java | 4 ++-- .../nsk/jdi/ObjectReference/getValue/getvalue001.java | 4 ++-- .../nsk/jdi/ObjectReference/getValue/getvalue002.java | 4 ++-- .../nsk/jdi/ObjectReference/getValue/getvalue003.java | 4 ++-- .../nsk/jdi/ObjectReference/getValue/getvalue004.java | 4 ++-- .../nsk/jdi/ObjectReference/getValues/getvalues001.java | 4 ++-- .../nsk/jdi/ObjectReference/getValues/getvalues002.java | 4 ++-- .../nsk/jdi/ObjectReference/getValues/getvalues003.java | 4 ++-- .../nsk/jdi/ObjectReference/hashCode/hashcode001.java | 4 ++-- .../nsk/jdi/ObjectReference/invokeMethod/invokemethod001.java | 4 ++-- .../nsk/jdi/ObjectReference/isCollected/iscollected001.java | 4 ++-- .../nsk/jdi/ObjectReference/owningThread/owningthread001.java | 4 ++-- .../jdi/ObjectReference/referenceType/referencetype001.java | 4 ++-- .../jdi/ObjectReference/referenceType/referencetype002.java | 4 ++-- .../jdi/ObjectReference/referenceType/referencetype003.java | 4 ++-- .../jdi/ObjectReference/referenceType/referencetype004.java | 4 ++-- .../jdi/ObjectReference/referenceType/referencetype005.java | 4 ++-- .../jdi/ObjectReference/referenceType/referencetype006.java | 4 ++-- .../jdi/ObjectReference/referenceType/referencetype007.java | 4 ++-- .../nsk/jdi/ObjectReference/setValue/setvalue001.java | 4 ++-- .../nsk/jdi/ObjectReference/uniqueID/uniqueid001.java | 4 ++-- .../baseDirectory/directory001.java | 4 ++-- .../bootClassPath/bootpath001.java | 4 ++-- .../nsk/jdi/PrimitiveValue/doubleValue/doublevalue002.java | 4 ++-- .../ReferenceType/allLineLocations/alllinelocations001.java | 4 ++-- .../allLineLocations_ss/alllinelocations_ss001.java | 4 ++-- .../jdi/ReferenceType/availableStrata/availablestrata001.java | 4 ++-- .../jdi/ReferenceType/defaultStratum/defaultstratum001.java | 4 ++-- .../ReferenceType/locationsOfLine_i/locationsofline_i001.java | 4 ++-- .../locationsOfLine_ssi/locationsofline_ssi001.java | 4 ++-- .../nsk/jdi/ReferenceType/sourceNames/sourcenames001.java | 4 ++-- .../nsk/jdi/ReferenceType/sourcePaths/sourcepaths001.java | 4 ++-- .../vmTestbase/nsk/jdi/StackFrame/location/location001.java | 4 ++-- .../nsk/jdi/StackFrame/setValue/setvalue003/setvalue003.java | 4 ++-- .../nsk/jdi/StackFrame/thisObject/thisobject001.java | 4 ++-- .../nsk/jdi/StackFrame/thisObject/thisobject002.java | 4 ++-- .../jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001.java | 4 ++-- .../StackFrame/visibleVariableByName/visiblevarbyname001.java | 4 ++-- .../StackFrame/visibleVariableByName/visiblevarbyname002.java | 4 ++-- .../jdi/StackFrame/visibleVariables/visiblevariables001.java | 4 ++-- .../jdi/StackFrame/visibleVariables/visiblevariables002.java | 4 ++-- .../vmTestbase/nsk/jdi/ThreadGroupReference/name/name001.java | 4 ++-- .../nsk/jdi/ThreadGroupReference/parent/parent001.java | 4 ++-- .../nsk/jdi/ThreadGroupReference/resume/resume001.java | 4 ++-- .../nsk/jdi/ThreadGroupReference/suspend/suspend001.java | 4 ++-- .../ThreadGroupReference/threadGroups/threadgroups001.java | 4 ++-- .../nsk/jdi/ThreadGroupReference/threads/threads001.java | 4 ++-- .../ThreadReference/currentContendedMonitor/currentcm001.java | 4 ++-- .../vmTestbase/nsk/jdi/ThreadReference/frame/frame001.java | 4 ++-- .../nsk/jdi/ThreadReference/frameCount/framecount001.java | 4 ++-- .../vmTestbase/nsk/jdi/ThreadReference/frames/frames001.java | 4 ++-- .../nsk/jdi/ThreadReference/frames_ii/frames_ii001.java | 4 ++-- .../nsk/jdi/ThreadReference/frames_ii/frames_ii002.java | 4 ++-- .../nsk/jdi/ThreadReference/interrupt/interrupt001.java | 2 +- .../jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001.java | 4 ++-- .../nsk/jdi/ThreadReference/isSuspended/issuspended002.java | 4 ++-- .../vmTestbase/nsk/jdi/ThreadReference/name/name001.java | 4 ++-- .../vmTestbase/nsk/jdi/ThreadReference/resume/resume001.java | 4 ++-- .../vmTestbase/nsk/jdi/ThreadReference/stop/stop001.java | 4 ++-- .../nsk/jdi/ThreadReference/suspend/suspend001.java | 4 ++-- .../nsk/jdi/ThreadReference/suspendCount/suspendcount001.java | 4 ++-- .../nsk/jdi/ThreadReference/threadGroup/threadgroup001.java | 4 ++-- .../jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001.java | 4 ++-- .../jtreg/vmTestbase/nsk/jdi/Value/type/type002/type002.java | 4 ++-- .../nsk/jdi/VirtualMachine/allThreads/allthreads001.java | 4 ++-- .../VirtualMachine/canGetBytecodes/cangetbytecodes001.java | 4 ++-- .../canGetCurrentContendedMonitor/cangccm001.java | 4 ++-- .../canGetMonitorInfo/cangetmonitorinfo001.java | 4 ++-- .../VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001.java | 4 ++-- .../canGetSourceDebugExtension/cangetsde001.java | 4 ++-- .../canGetSyntheticAttribute/cangetattr001.java | 4 ++-- .../nsk/jdi/VirtualMachine/description/description001.java | 4 ++-- .../vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose001.java | 4 ++-- .../vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose002.java | 4 ++-- .../vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003.java | 4 ++-- .../vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose004.java | 4 ++-- .../vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose005.java | 2 +- .../nsk/jdi/VirtualMachine/eventQueue/eventqueue001.java | 4 ++-- .../VirtualMachine/eventRequestManager/eventrmanager001.java | 4 ++-- .../jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit001.java | 4 ++-- .../jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002.java | 4 ++-- .../getDefaultStratum/getdefaultstratum001.java | 4 ++-- .../jtreg/vmTestbase/nsk/jdi/VirtualMachine/name/name001.java | 4 ++-- .../vmTestbase/nsk/jdi/VirtualMachine/process/process001.java | 4 ++-- .../setDefaultStratum/setdefaultstratum001.java | 4 ++-- .../vmTestbase/nsk/jdi/VirtualMachine/suspend/suspend001.java | 4 ++-- .../topLevelThreadGroups/toplevelgroups001.java | 4 ++-- .../vmTestbase/nsk/jdi/VirtualMachine/version/version001.java | 4 ++-- .../connectedVirtualMachines/convm001.java | 4 ++-- .../connectedVirtualMachines/convm002.java | 4 ++-- .../connectedVirtualMachines/convm003.java | 4 ++-- .../nsk/jdi/VoidValue/equals/equals001/equals001.java | 4 ++-- .../nsk/jdi/VoidValue/hashCode/hashcode001/hashcode001.java | 4 ++-- 125 files changed, 248 insertions(+), 248 deletions(-) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001.java index 4b5023c92b5..d5d6e844430 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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,7 +159,7 @@ public class invokemethod001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("location001a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001.java index 7121131fb20..daa9a055515 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -170,7 +170,7 @@ public class newinstance001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002.java index fa9a0ee42e9..4e1816553fa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -167,7 +167,7 @@ public class newinstance002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue001.java index 50b922da99a..c106fb9b8f9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -139,7 +139,7 @@ public class setvalue001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue002.java index 53cf83cc054..dcc542e9757 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -150,7 +150,7 @@ public class setvalue002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue003.java index 359b2f6c288..d590f664d7e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -143,7 +143,7 @@ public class setvalue003 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue004.java index d1f713b35f8..5e14fb6fa4b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -135,7 +135,7 @@ public class setvalue004 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue005.java index 4049cf5f30d..2a3d6ae46a7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue005.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/setValue/setvalue005.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -132,7 +132,7 @@ public class setvalue005 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001.java index a9c33447685..9d5dba92c75 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/isVisible/isvisible001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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,7 +159,7 @@ public class isvisible001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("setvalue003a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location001.java index eb866638863..5ccf4daf10a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -133,7 +133,7 @@ public class location001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("location001a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location004.java index 2244b482bdf..cd13257cde0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -148,7 +148,7 @@ public class location004 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("setvalue003a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location005.java index 8026a291753..c41331ea2ec 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location005.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location005.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -148,7 +148,7 @@ public class location005 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("setvalue003a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/codeIndex/codeindex001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/codeIndex/codeindex001.java index 45496e2d35e..f71934c0468 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/codeIndex/codeindex001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/codeIndex/codeindex001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -131,7 +131,7 @@ public class codeindex001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/declaringType/declaringtype001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/declaringType/declaringtype001.java index 814e721038f..484644e9773 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/declaringType/declaringtype001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/declaringType/declaringtype001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -137,7 +137,7 @@ public class declaringtype001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/equals/equals001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/equals/equals001.java index e6b9a29f461..7c91c74a667 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/equals/equals001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/equals/equals001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -136,7 +136,7 @@ public class equals001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/hashCode/hashcode001.java index a27efc606da..6ce0d7d1444 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/hashCode/hashcode001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/hashCode/hashcode001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -136,7 +136,7 @@ public class hashcode001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber/linenumber001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber/linenumber001.java index f032c1b612e..c3effdf6ca5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber/linenumber001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber/linenumber001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -129,7 +129,7 @@ public class linenumber001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber_s/linenumber_s001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber_s/linenumber_s001.java index ede865ba146..eca38d521b9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber_s/linenumber_s001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/lineNumber_s/linenumber_s001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -124,7 +124,7 @@ public class linenumber_s001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName/sourcename001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName/sourcename001.java index 0918f7e2ad6..8b8f08e3d56 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName/sourcename001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName/sourcename001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -135,7 +135,7 @@ public class sourcename001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName_s/sourcename_s001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName_s/sourcename_s001.java index 0146c1608fd..2770989b0f2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName_s/sourcename_s001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourceName_s/sourcename_s001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -130,7 +130,7 @@ public class sourcename_s001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath/sourcepath001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath/sourcepath001.java index 4244bfb03bb..a50fa645ca7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath/sourcepath001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath/sourcepath001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -128,7 +128,7 @@ public class sourcepath001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath_s/sourcepath_s001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath_s/sourcepath_s001.java index c118d88e325..b2201c2bd53 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath_s/sourcepath_s001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Location/sourcePath_s/sourcepath_s001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -128,7 +128,7 @@ public class sourcepath_s001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations001.java index fb414a818c1..f20181e8381 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -125,7 +125,7 @@ public class alllinelocations001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations002.java index 4c930d67b87..982b25b12ef 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations/alllinelocations002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -127,7 +127,7 @@ public class alllinelocations002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001.java index fb1704acf15..0970bdfab26 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/allLineLocations_ss/alllinelocations_ss001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -127,7 +127,7 @@ public class alllinelocations_ss001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001.java index 94a9e7f4c57..932c9db718b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationOfCodeIndex/locationofcodeindex001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -139,7 +139,7 @@ public class locationofcodeindex001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine/locationsofline001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine/locationsofline001.java index 7b068c0537d..a186fe08397 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine/locationsofline001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine/locationsofline001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -132,7 +132,7 @@ public class locationsofline001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001.java index 96d54ca02d3..23f8e7fb7ed 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsofline_ssi001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -130,7 +130,7 @@ public class locationsofline_ssi001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001.java index d30aa02dcc0..34430a1d25e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/toString/tostring001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -133,7 +133,7 @@ public class tostring001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/virtualMachine/virtualmachine001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/virtualMachine/virtualmachine001.java index d87f3b49a49..9a9d48139bb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/virtualMachine/virtualmachine001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Mirror/virtualMachine/virtualmachine001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -133,7 +133,7 @@ public class virtualmachine001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection001.java index 6b39a826dc7..4b3d05c0ba2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/disableCollection/disablecollection001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -133,7 +133,7 @@ public class disablecollection001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount001.java index d0611900c49..e5ebcdf1947 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -134,7 +134,7 @@ public class entrycount001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/equals/equals001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/equals/equals001.java index 17114974c6b..be7a3bd8bf2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/equals/equals001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/equals/equals001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -142,7 +142,7 @@ public class equals001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001.java index 78e1025d742..99ba34ca25b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -154,7 +154,7 @@ public class getvalue001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002.java index 1b2823d67af..dfab92cd3c5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -158,7 +158,7 @@ public class getvalue002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue003.java index a7b5c7b76d6..07ea746db4f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -135,7 +135,7 @@ public class getvalue003 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue004.java index 5738559236a..e0ee7ba4b99 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -135,7 +135,7 @@ public class getvalue004 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues001.java index 6ce38a9093f..7a942a4bfed 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -139,7 +139,7 @@ public class getvalues001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues002.java index 66ad17e7cfd..20519e40824 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -139,7 +139,7 @@ public class getvalues002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues003.java index b3570ee878f..07599022a17 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValues/getvalues003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -142,7 +142,7 @@ public class getvalues003{ IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/hashCode/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/hashCode/hashcode001.java index 4c11d1c4fd4..44b424ce012 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/hashCode/hashcode001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/hashCode/hashcode001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -142,7 +142,7 @@ public class hashcode001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001.java index 3d7deae4328..381703f5983 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -162,7 +162,7 @@ public class invokemethod001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/isCollected/iscollected001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/isCollected/iscollected001.java index 2463fbfa27f..0d4c20dcbad 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/isCollected/iscollected001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/isCollected/iscollected001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -132,7 +132,7 @@ public class iscollected001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread001.java index ea173534720..6f1260d23a8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -136,7 +136,7 @@ public class owningthread001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001.java index 7ce032b664d..fe644433874 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -139,7 +139,7 @@ public class referencetype001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype002.java index 4ef42b72d1e..1cb532f088f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -137,7 +137,7 @@ public class referencetype002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype003.java index 93b6c27b15c..92755a1f9a2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -137,7 +137,7 @@ public class referencetype003 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype004.java index 57c93a4d16f..1c6e4508745 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -138,7 +138,7 @@ public class referencetype004 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype005.java index 812493427dd..dfcc40188a2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype005.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype005.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -139,7 +139,7 @@ public class referencetype005 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype006.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype006.java index afced747cf2..f47a33c3122 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype006.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype006.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -139,7 +139,7 @@ public class referencetype006 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype007.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype007.java index b7a5604ff15..fac06204a2e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype007.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype007.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -138,7 +138,7 @@ public class referencetype007 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue001.java index a8d975b14b6..9abde1197a1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -130,7 +130,7 @@ public class setvalue001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/uniqueID/uniqueid001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/uniqueID/uniqueid001.java index 22d6546ed11..ad5e91ed09f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/uniqueID/uniqueid001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/uniqueID/uniqueid001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -131,7 +131,7 @@ public class uniqueid001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001.java index e9f45a67b32..52bed498021 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/baseDirectory/directory001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -124,7 +124,7 @@ public class directory001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/bootClassPath/bootpath001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/bootClassPath/bootpath001.java index 26c826a51f7..7c63fc918c5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/bootClassPath/bootpath001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PathSearchingVirtualMachine/bootClassPath/bootpath001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -125,7 +125,7 @@ public class bootpath001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue002.java index e134c9316fc..4b5faa73119 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/PrimitiveValue/doubleValue/doublevalue002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -139,7 +139,7 @@ public class doublevalue002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations001.java index f38a6b23fdd..5664a332d8b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -125,7 +125,7 @@ public class alllinelocations001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001.java index 9672ba1f813..d5dc58b9432 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -124,7 +124,7 @@ public class alllinelocations_ss001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availablestrata001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availablestrata001.java index ff5c08b2614..deffb640805 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availablestrata001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/availableStrata/availablestrata001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -131,7 +131,7 @@ public class availablestrata001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultstratum001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultstratum001.java index 68be4efc6d7..0fc565751fb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultstratum001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultstratum001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -128,7 +128,7 @@ public class defaultstratum001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001.java index 356d1c0ee5b..bbec3a46158 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -127,7 +127,7 @@ public class locationsofline_i001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001.java index 849b6d50777..9816e45900c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -128,7 +128,7 @@ public class locationsofline_ssi001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames001.java index 2871d7134c5..0163b4fed15 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -130,7 +130,7 @@ public class sourcenames001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths001.java index 7961d33699e..b7b2b5922b9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -131,7 +131,7 @@ public class sourcepaths001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001.java index 10da14bfd46..62251b89c9e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -160,7 +160,7 @@ public class location001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("location001a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003.java index cced0e3b6e6..cd1a7fc14be 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -247,7 +247,7 @@ public class setvalue003 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("setvalue003a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001.java index 88bbe8ade80..fd27c4297c5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -156,7 +156,7 @@ public class thisobject001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("setvalue003a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002.java index c6429cd6d1d..054e273cede 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -155,7 +155,7 @@ public class thisobject002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("setvalue003a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001.java index 1c0389e6042..616048d618a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -153,7 +153,7 @@ public class thread001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("location001a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001.java index eb53cb45ee4..33af470b981 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -158,7 +158,7 @@ public class visiblevarbyname001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("setvalue003a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002.java index d4390327881..25e5f9d452a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -149,7 +149,7 @@ public class visiblevarbyname002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("setvalue003a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001.java index 2cf89f29d51..471a213b86f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -153,7 +153,7 @@ public class visiblevariables001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("setvalue003a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002.java index 2a9693baa3a..16feb11b013 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -150,7 +150,7 @@ public class visiblevariables002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("setvalue003a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/name/name001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/name/name001.java index ea71477890e..0d928783ead 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/name/name001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/name/name001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -154,7 +154,7 @@ public class name001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/parent/parent001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/parent/parent001.java index 88029ff011f..02deb3031bf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/parent/parent001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/parent/parent001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -156,7 +156,7 @@ public class parent001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/resume/resume001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/resume/resume001.java index 98e93f6d4c5..348c5c9447f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/resume/resume001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/resume/resume001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -153,7 +153,7 @@ public class resume001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/suspend/suspend001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/suspend/suspend001.java index f837b6273e6..637aedccc44 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/suspend/suspend001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/suspend/suspend001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -152,7 +152,7 @@ public class suspend001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threadGroups/threadgroups001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threadGroups/threadgroups001.java index fff2e4452bc..d66d8f500b4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threadGroups/threadgroups001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threadGroups/threadgroups001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -151,7 +151,7 @@ public class threadgroups001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threads/threads001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threads/threads001.java index f9c6ef75346..872fe114925 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threads/threads001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadGroupReference/threads/threads001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -151,7 +151,7 @@ public class threads001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001.java index 6033e10f9bf..b1d2c5b00fa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -144,7 +144,7 @@ public class currentcm001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001.java index d2ca672840e..337b38e28fe 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -170,7 +170,7 @@ public class frame001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001.java index 421f4d1d5be..fe36b643e45 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -161,7 +161,7 @@ public class framecount001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001.java index 371259bf661..cc75403caf6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -175,7 +175,7 @@ public class frames001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001.java index f6545c2900a..7196e9b464c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -176,7 +176,7 @@ public class frames_ii001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002.java index fccd88a299e..1a7a28f86c5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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,7 +159,7 @@ public class frames_ii002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001.java index a24d0c75c64..8598df31f67 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001.java @@ -153,7 +153,7 @@ public class interrupt001 { pipe = debuggee.createIOPipe(); debuggee.redirectStderr(out); - log2("interrupt002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); try { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001.java index 99491e0ac97..61b7b7e5207 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -153,7 +153,7 @@ public class isatbreakpoint001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002.java index 7265b49891b..bc9e860a053 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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,7 +159,7 @@ public class issuspended002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001.java index b493b04fa40..bd1b2b3f32f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -148,7 +148,7 @@ public class name001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001.java index 58ab1a1c4c2..df7e338b186 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -153,7 +153,7 @@ public class resume001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001.java index 4b911b9c9d2..5dafaecb743 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -154,7 +154,7 @@ public class stop001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001.java index ff6038e7f8d..ec85df6b8b3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -152,7 +152,7 @@ public class suspend001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001.java index b9e1babdef2..b3678efb96a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -152,7 +152,7 @@ public class suspendcount001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/threadGroup/threadgroup001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/threadGroup/threadgroup001.java index 1e28a71b542..d6443894715 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/threadGroup/threadgroup001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/threadGroup/threadgroup001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -161,7 +161,7 @@ public class threadgroup001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001.java index 10b56b0b9bd..22a70e3e047 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/_itself_/value001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -146,7 +146,7 @@ public class value001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type002/type002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type002/type002.java index eef6e254b6f..d3c6ce7e77c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type002/type002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Value/type/type002/type002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -196,7 +196,7 @@ public class type002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("setvalue003a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allThreads/allthreads001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allThreads/allthreads001.java index 160c167857a..c150bb2c897 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allThreads/allthreads001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/allThreads/allthreads001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -155,7 +155,7 @@ public class allthreads001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("location001a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001.java index 28150c40e6c..136a7bc6a9c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -140,7 +140,7 @@ public class cangetbytecodes001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001.java index ef952d40baf..ba7adb4306d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -151,7 +151,7 @@ public class cangccm001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetMonitorInfo/cangetmonitorinfo001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetMonitorInfo/cangetmonitorinfo001.java index 0ed84379297..e6df399d448 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetMonitorInfo/cangetmonitorinfo001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetMonitorInfo/cangetmonitorinfo001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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,7 +159,7 @@ public class cangetmonitorinfo001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001.java index f5f0ddafe2a..36d09e2c1c4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -151,7 +151,7 @@ public class cangetinfo001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSourceDebugExtension/cangetsde001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSourceDebugExtension/cangetsde001.java index c066b52031e..3409b9f4a57 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSourceDebugExtension/cangetsde001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSourceDebugExtension/cangetsde001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -123,7 +123,7 @@ public class cangetsde001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSyntheticAttribute/cangetattr001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSyntheticAttribute/cangetattr001.java index a84bea5e342..0b9d413e64b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSyntheticAttribute/cangetattr001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetSyntheticAttribute/cangetattr001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -140,7 +140,7 @@ public class cangetattr001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/description/description001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/description/description001.java index 44cb99fd423..f64a028a2ee 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/description/description001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/description/description001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -124,7 +124,7 @@ public class description001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose001.java index f2c6030b188..cfb22e400ac 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -134,7 +134,7 @@ public class dispose001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose002.java index f0350242bc4..90f9651c999 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -150,7 +150,7 @@ public class dispose002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003.java index 2dfa63c8466..855ea9634e1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -143,7 +143,7 @@ public class dispose003 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose004.java index 9b061269a7d..3604a0ee822 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -144,7 +144,7 @@ public class dispose004 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose005.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose005.java index 1ad0414ca8c..ed4dfd1a815 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose005.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/dispose/dispose005.java @@ -192,7 +192,7 @@ public class dispose005 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventQueue/eventqueue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventQueue/eventqueue001.java index a7b0863989a..7ad965372d1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventQueue/eventqueue001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventQueue/eventqueue001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -133,7 +133,7 @@ public class eventqueue001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventRequestManager/eventrmanager001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventRequestManager/eventrmanager001.java index da3484d5e55..804485f3c7b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventRequestManager/eventrmanager001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/eventRequestManager/eventrmanager001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -134,7 +134,7 @@ public class eventrmanager001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit001.java index 79ad6f2e42e..95309fa0284 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -136,7 +136,7 @@ public class exit001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002.java index d63b13519da..f848ad89afe 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -135,7 +135,7 @@ public class exit002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001.java index a36f5eee74a..d13cf01f8e3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -128,7 +128,7 @@ public class getdefaultstratum001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/name/name001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/name/name001.java index 148ada355ef..ba373bd76db 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/name/name001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/name/name001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -124,7 +124,7 @@ public class name001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/process/process001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/process/process001.java index a744c49f6af..1e9efa792b0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/process/process001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/process/process001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -128,7 +128,7 @@ public class process001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001.java index 99263fb0695..3bb646db69d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -128,7 +128,7 @@ public class setdefaultstratum001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/suspend/suspend001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/suspend/suspend001.java index c263333bce0..b03b8b89fb5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/suspend/suspend001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/suspend/suspend001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -155,7 +155,7 @@ public class suspend001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/topLevelThreadGroups/toplevelgroups001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/topLevelThreadGroups/toplevelgroups001.java index 022cd43cb70..25abf9badc8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/topLevelThreadGroups/toplevelgroups001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/topLevelThreadGroups/toplevelgroups001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -128,7 +128,7 @@ public class toplevelgroups001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/version/version001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/version/version001.java index cbd1220561a..55553e64857 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/version/version001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/version/version001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -124,7 +124,7 @@ public class version001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001.java index a1ab73fefa4..82e71b3796b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -143,7 +143,7 @@ public class convm001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm002.java index 841bb370eaa..5ba9cb19f53 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -145,7 +145,7 @@ public class convm002 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003.java index 4b53a61d03e..ca4700b54c0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -142,7 +142,7 @@ public class convm003 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("issuspended002a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals001/equals001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals001/equals001.java index 97b07c7383d..281bdfa30c0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals001/equals001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/equals/equals001/equals001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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,7 +204,7 @@ public class equals001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("setvalue003a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/hashCode/hashcode001/hashcode001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/hashCode/hashcode001/hashcode001.java index 213c8cb37b4..4d6b5f4cf25 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/hashCode/hashcode001/hashcode001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VoidValue/hashCode/hashcode001/hashcode001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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,7 +204,7 @@ public class hashcode001 { IOPipe pipe = new IOPipe(debuggee); debuggee.redirectStderr(out); - log2("setvalue003a debuggee launched"); + log2(debuggeeName + " debuggee launched"); debuggee.resume(); String line = pipe.readln(); From a38277e67bc65532e89f5abaaec38f8321f0b906 Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Thu, 21 Feb 2019 21:02:39 +0900 Subject: [PATCH 063/109] 8219414: SA: jhsdb jsnap throws UnmappedAddressException with core generated by gcore Reviewed-by: cjplummer, jgeorge --- src/hotspot/os/linux/globals_linux.hpp | 7 ++++++- src/hotspot/os/linux/os_linux.cpp | 15 ++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/hotspot/os/linux/globals_linux.hpp b/src/hotspot/os/linux/globals_linux.hpp index cef31620f3b..8a30e25f855 100644 --- a/src/hotspot/os/linux/globals_linux.hpp +++ b/src/hotspot/os/linux/globals_linux.hpp @@ -70,7 +70,12 @@ diagnostic(bool, DumpPrivateMappingsInCore, true, \ "If true, sets bit 2 of /proc/PID/coredump_filter, thus " \ "resulting in file-backed private mappings of the process to "\ - "be dumped into the corefile, if UseSharedSpaces is true.") \ + "be dumped into the corefile.") \ + \ + diagnostic(bool, DumpSharedMappingsInCore, true, \ + "If true, sets bit 3 of /proc/PID/coredump_filter, thus " \ + "resulting in file-backed shared mappings of the process to " \ + "be dumped into the corefile.") \ \ diagnostic(bool, UseCpuAllocPath, false, \ "Use CPU_ALLOC code path in os::active_processor_count ") diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 9244cbbae6c..1a485a94f75 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -131,6 +131,7 @@ enum CoredumpFilterBit { FILE_BACKED_PVT_BIT = 1 << 2, + FILE_BACKED_SHARED_BIT = 1 << 3, LARGEPAGES_BIT = 1 << 6, DAX_SHARED_BIT = 1 << 8 }; @@ -1357,8 +1358,8 @@ void os::shutdown() { void os::abort(bool dump_core, void* siginfo, const void* context) { os::shutdown(); if (dump_core) { -#if INCLUDE_CDS - if (UseSharedSpaces && DumpPrivateMappingsInCore) { +#ifndef ZERO + if (DumpPrivateMappingsInCore) { ClassLoader::close_jrt_image(); } #endif @@ -3432,8 +3433,6 @@ bool os::Linux::hugetlbfs_sanity_check(bool warn, size_t page_size) { return result; } -// Set the coredump_filter bits to include largepages in core dump (bit 6) -// // From the coredump_filter documentation: // // - (bit 0) anonymous private memory @@ -5131,11 +5130,13 @@ jint os::init_2(void) { set_coredump_filter(DAX_SHARED_BIT); } -#if INCLUDE_CDS - if (UseSharedSpaces && DumpPrivateMappingsInCore) { + if (DumpPrivateMappingsInCore) { set_coredump_filter(FILE_BACKED_PVT_BIT); } -#endif + + if (DumpSharedMappingsInCore) { + set_coredump_filter(FILE_BACKED_SHARED_BIT); + } return JNI_OK; } From ace0b7a8039c0a7fcf499335be4f388e3915393e Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Thu, 21 Feb 2019 15:52:42 +0100 Subject: [PATCH 064/109] 8219524: Shenandoah misreports "committed" size in MemoryMXBean Reviewed-by: rkennke, zgu --- src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp | 4 ++++ src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp | 1 + src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp | 8 +++++++- .../jtreg/gc/shenandoah/mxbeans/TestMemoryMXBeans.java | 6 ++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index 2161eebb715..d594503d51f 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -2639,6 +2639,10 @@ GrowableArray ShenandoahHeap::memory_pools() { return memory_pools; } +MemoryUsage ShenandoahHeap::memory_usage() { + return _memory_pool->get_memory_usage(); +} + void ShenandoahHeap::enter_evacuation() { _oom_evac_handler.enter_evacuation(); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp index cf4edaa562e..56ce8b5d213 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp @@ -511,6 +511,7 @@ public: GrowableArray memory_managers(); GrowableArray memory_pools(); + MemoryUsage memory_usage(); GCTracer* tracer(); GCTimer* gc_timer() const; CollectorPolicy* collector_policy() const; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp index 36071ef6d40..135459e5718 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp @@ -26,7 +26,7 @@ ShenandoahMemoryPool::ShenandoahMemoryPool(ShenandoahHeap* heap) : CollectedMemoryPool("Shenandoah", - heap->capacity(), + heap->initial_capacity(), heap->max_capacity(), true /* support_usage_threshold */), _heap(heap) {} @@ -37,9 +37,15 @@ MemoryUsage ShenandoahMemoryPool::get_memory_usage() { size_t used = used_in_bytes(); size_t committed = _heap->committed(); + // These asserts can never fail: max is stable, and all updates to other values never overflow max. assert(initial <= max, "initial: " SIZE_FORMAT ", max: " SIZE_FORMAT, initial, max); assert(used <= max, "used: " SIZE_FORMAT ", max: " SIZE_FORMAT, used, max); assert(committed <= max, "committed: " SIZE_FORMAT ", max: " SIZE_FORMAT, committed, max); + + // Committed and used are updated concurrently and independently. They can momentarily break + // the assert below, which would also fail in downstream code. To avoid that, adjust values + // to make sense under the race. See JDK-8207200. + committed = MAX2(used, committed); assert(used <= committed, "used: " SIZE_FORMAT ", committed: " SIZE_FORMAT, used, committed); return MemoryUsage(initial, used, committed, max); diff --git a/test/hotspot/jtreg/gc/shenandoah/mxbeans/TestMemoryMXBeans.java b/test/hotspot/jtreg/gc/shenandoah/mxbeans/TestMemoryMXBeans.java index 0d6647eeec5..d27d57cacd9 100644 --- a/test/hotspot/jtreg/gc/shenandoah/mxbeans/TestMemoryMXBeans.java +++ b/test/hotspot/jtreg/gc/shenandoah/mxbeans/TestMemoryMXBeans.java @@ -52,8 +52,10 @@ public class TestMemoryMXBeans { public static void testMemoryBean(long initSize, long maxSize) { MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean(); long heapInit = memoryMXBean.getHeapMemoryUsage().getInit(); + long heapCommitted = memoryMXBean.getHeapMemoryUsage().getCommitted(); long heapMax = memoryMXBean.getHeapMemoryUsage().getMax(); long nonHeapInit = memoryMXBean.getNonHeapMemoryUsage().getInit(); + long nonHeapCommitted = memoryMXBean.getNonHeapMemoryUsage().getCommitted(); long nonHeapMax = memoryMXBean.getNonHeapMemoryUsage().getMax(); if (initSize > 0 && heapInit != initSize) { @@ -62,5 +64,9 @@ public class TestMemoryMXBeans { if (maxSize > 0 && heapMax != maxSize) { throw new IllegalStateException("Max heap size is wrong: " + heapMax + " vs " + maxSize); } + if (initSize > 0 && maxSize > 0 && initSize != maxSize && heapCommitted == heapMax) { + throw new IllegalStateException("Init committed heap size is wrong: " + heapCommitted + + " (init: " + initSize + ", max: " + maxSize + ")"); + } } } From e84f0388f59dd1a24481d766191e1e365eae693f Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Thu, 21 Feb 2019 09:21:21 -0500 Subject: [PATCH 065/109] 8153413: Exceptions::_throw always logs exceptions, penalizing performance Construct exception string into Event message directly add if (log_is_enabled) for logging. Reviewed-by: ysuenaga, dholmes --- src/hotspot/share/utilities/events.cpp | 21 +++++++++++++++++++-- src/hotspot/share/utilities/events.hpp | 17 ++++++++++++++++- src/hotspot/share/utilities/exceptions.cpp | 10 ++++------ 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/src/hotspot/share/utilities/events.cpp b/src/hotspot/share/utilities/events.cpp index bdd0a7ae29d..e4b80ac65ef 100644 --- a/src/hotspot/share/utilities/events.cpp +++ b/src/hotspot/share/utilities/events.cpp @@ -36,7 +36,7 @@ EventLog* Events::_logs = NULL; StringEventLog* Events::_messages = NULL; -ExtendedStringEventLog* Events::_exceptions = NULL; +ExceptionsEventLog* Events::_exceptions = NULL; StringEventLog* Events::_redefinitions = NULL; UnloadingEventLog* Events::_class_unloading = NULL; StringEventLog* Events::_deopt_messages = NULL; @@ -67,7 +67,7 @@ void Events::print() { void Events::init() { if (LogEvents) { _messages = new StringEventLog("Events"); - _exceptions = new ExtendedStringEventLog("Internal exceptions"); + _exceptions = new ExceptionsEventLog("Internal exceptions"); _redefinitions = new StringEventLog("Classes redefined"); _class_unloading = new UnloadingEventLog("Classes unloaded"); _deopt_messages = new StringEventLog("Deoptimization events"); @@ -112,3 +112,20 @@ void UnloadingEventLog::log(Thread* thread, InstanceKlass* ik) { st.print("Unloading class " INTPTR_FORMAT " ", p2i(ik)); ik->name()->print_value_on(&st); } + +void ExceptionsEventLog::log(Thread* thread, Handle h_exception, const char* message, const char* file, int line) { + if (!should_log()) return; + + double timestamp = fetch_timestamp(); + MutexLockerEx ml(&_mutex, Mutex::_no_safepoint_check_flag); + int index = compute_log_index(); + _records[index].thread = thread; + _records[index].timestamp = timestamp; + stringStream st = _records[index].data.stream(); + st.print("Exception <"); + h_exception->print_value_on(&st); + st.print("%s%s> (" INTPTR_FORMAT ") \n" + "thrown [%s, line %d]\nfor thread " INTPTR_FORMAT, + message ? ": " : "", message ? message : "", + p2i(h_exception()), file, line, p2i(thread)); +} diff --git a/src/hotspot/share/utilities/events.hpp b/src/hotspot/share/utilities/events.hpp index e32b410f23e..14a5833d73f 100644 --- a/src/hotspot/share/utilities/events.hpp +++ b/src/hotspot/share/utilities/events.hpp @@ -183,6 +183,14 @@ class UnloadingEventLog : public EventLogBase { void log(Thread* thread, InstanceKlass* ik); }; +// Event log for exceptions +class ExceptionsEventLog : public ExtendedStringEventLog { + public: + ExceptionsEventLog(const char* name, int count = LogEventsBufferEntries) : ExtendedStringEventLog(name, count) {} + + void log(Thread* thread, Handle h_exception, const char* message, const char* file, int line); +}; + class Events : AllStatic { friend class EventLog; @@ -195,7 +203,7 @@ class Events : AllStatic { // A log for internal exception related messages, like internal // throws and implicit exceptions. - static ExtendedStringEventLog* _exceptions; + static ExceptionsEventLog* _exceptions; // Deoptization related messages static StringEventLog* _deopt_messages; @@ -216,6 +224,7 @@ class Events : AllStatic { // Log exception related message static void log_exception(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + static void log_exception(Thread* thread, Handle h_exception, const char* message, const char* file, int line); static void log_redefinition(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); @@ -245,6 +254,12 @@ inline void Events::log_exception(Thread* thread, const char* format, ...) { } } +inline void Events::log_exception(Thread* thread, Handle h_exception, const char* message, const char* file, int line) { + if (LogEvents) { + _exceptions->log(thread, h_exception, message, file, line); + } +} + inline void Events::log_redefinition(Thread* thread, const char* format, ...) { if (LogEvents) { va_list ap; diff --git a/src/hotspot/share/utilities/exceptions.cpp b/src/hotspot/share/utilities/exceptions.cpp index 95e1cd6a2c0..99f3acc72ab 100644 --- a/src/hotspot/share/utilities/exceptions.cpp +++ b/src/hotspot/share/utilities/exceptions.cpp @@ -131,15 +131,17 @@ void Exceptions::_throw_oop(Thread* thread, const char* file, int line, oop exce } void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exception, const char* message) { - ResourceMark rm; + ResourceMark rm(thread); assert(h_exception() != NULL, "exception should not be NULL"); // tracing (do this up front - so it works during boot strapping) + // Note, the print_value_string() argument is not called unless logging is enabled! log_info(exceptions)("Exception <%s%s%s> (" INTPTR_FORMAT ") \n" "thrown [%s, line %d]\nfor thread " INTPTR_FORMAT, h_exception->print_value_string(), message ? ": " : "", message ? message : "", p2i(h_exception()), file, line, p2i(thread)); + // for AbortVMOnException flag Exceptions::debug_check_abort(h_exception, message); @@ -162,11 +164,7 @@ void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exc thread->set_pending_exception(h_exception(), file, line); // vm log - if (LogEvents){ - Events::log_exception(thread, "Exception <%s%s%s> (" INTPTR_FORMAT ") thrown at [%s, line %d]", - h_exception->print_value_string(), message ? ": " : "", message ? message : "", - p2i(h_exception()), file, line); - } + Events::log_exception(thread, h_exception, message, file, line); } From 7fd7a118da90a88e883465512f9ee24ea6a04332 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Mon, 18 Feb 2019 17:41:31 +0100 Subject: [PATCH 066/109] 8219335: "failed: unexpected type" assert failure in ConnectionGraph::split_unique_types() with unsafe accesses Reviewed-by: thartmann, kvn --- src/hotspot/share/opto/escape.cpp | 12 +++ .../MaybeOffHeapUnsafeAccessToNewObject.java | 74 +++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 test/hotspot/jtreg/compiler/unsafe/MaybeOffHeapUnsafeAccessToNewObject.java diff --git a/src/hotspot/share/opto/escape.cpp b/src/hotspot/share/opto/escape.cpp index 4be774f0e4d..483fe63e7da 100644 --- a/src/hotspot/share/opto/escape.cpp +++ b/src/hotspot/share/opto/escape.cpp @@ -1726,6 +1726,18 @@ void ConnectionGraph::adjust_scalar_replaceable_state(JavaObjectNode* jobj) { // access its field since the field value is unknown after it. // Node* n = field->ideal_node(); + + // Test for an unsafe access that was parsed as maybe off heap + // (with a CheckCastPP to raw memory). + assert(n->is_AddP(), "expect an address computation"); + if (n->in(AddPNode::Base)->is_top() && + n->in(AddPNode::Address)->Opcode() == Op_CheckCastPP) { + assert(n->in(AddPNode::Address)->bottom_type()->isa_rawptr(), "raw address so raw cast expected"); + assert(_igvn->type(n->in(AddPNode::Address)->in(1))->isa_oopptr(), "cast pattern at unsafe access expected"); + jobj->set_scalar_replaceable(false); + return; + } + for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { Node* u = n->fast_out(i); if (u->is_LoadStore() || (u->is_Mem() && u->as_Mem()->is_mismatched_access())) { diff --git a/test/hotspot/jtreg/compiler/unsafe/MaybeOffHeapUnsafeAccessToNewObject.java b/test/hotspot/jtreg/compiler/unsafe/MaybeOffHeapUnsafeAccessToNewObject.java new file mode 100644 index 00000000000..a866bdf0e5d --- /dev/null +++ b/test/hotspot/jtreg/compiler/unsafe/MaybeOffHeapUnsafeAccessToNewObject.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2019, Red Hat, Inc. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8219335 + * @summary "failed: unexpected type" assert failure in ConnectionGraph::split_unique_types() with unsafe accesses + * + * @modules java.base/jdk.internal.misc + * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:-TieredCompilation -Xcomp -XX:CompileOnly=MaybeOffHeapUnsafeAccessToNewObject::test1 -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline MaybeOffHeapUnsafeAccessToNewObject + */ + +import java.lang.reflect.Field; +import jdk.internal.misc.Unsafe; + +public class MaybeOffHeapUnsafeAccessToNewObject { + public volatile int f_int = -1; + + + public static Unsafe unsafe = Unsafe.getUnsafe(); + public static final long f_int_off; + + static { + Field f_int_field = null; + try { + f_int_field = MaybeOffHeapUnsafeAccessToNewObject.class.getField("f_int"); + } catch (Exception e) { + System.out.println("reflection failed " + e); + e.printStackTrace(); + } + f_int_off = unsafe.objectFieldOffset(f_int_field); + } + + static public void main(String[] args) { + MaybeOffHeapUnsafeAccessToNewObject o = new MaybeOffHeapUnsafeAccessToNewObject(); + test1(); + } + + static Object test1_helper1(Object t) { + return t; + } + + static long test1_helper2(long off) { + return off; + } + + static int test1() { + MaybeOffHeapUnsafeAccessToNewObject t = new MaybeOffHeapUnsafeAccessToNewObject(); + Object o = test1_helper1(t); + long off = test1_helper2(f_int_off); + return unsafe.getInt(o, off); + } + +} From e58a4da301c6a7216fbefff7836f9837019e26dc Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Thu, 21 Feb 2019 16:57:47 +0000 Subject: [PATCH 067/109] 8216363: NullPointerException in java.util.logging.Handler#isLoggable The implementation is changed to match the spec: isLoggable(null) returns false. Reviewed-by: mchung, lancea --- .../classes/java/util/logging/Handler.java | 5 +- .../java/util/logging/MemoryHandler.java | 4 +- .../java/util/logging/StreamHandler.java | 4 +- .../util/logging/IsLoggableHandlerTest.java | 96 +++++++++++++++++++ 4 files changed, 103 insertions(+), 6 deletions(-) create mode 100644 test/jdk/java/util/logging/IsLoggableHandlerTest.java diff --git a/src/java.logging/share/classes/java/util/logging/Handler.java b/src/java.logging/share/classes/java/util/logging/Handler.java index 635bcf01fd2..9a4a595dbef 100644 --- a/src/java.logging/share/classes/java/util/logging/Handler.java +++ b/src/java.logging/share/classes/java/util/logging/Handler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -329,12 +329,13 @@ public abstract class Handler { * handler from logging the {@code LogRecord}. It will return false if * the {@code LogRecord} is null. * - * @param record a {@code LogRecord} + * @param record a {@code LogRecord} (may be null). * @return true if the {@code LogRecord} would be logged. * */ public boolean isLoggable(LogRecord record) { final int levelValue = getLevel().intValue(); + if (record == null) return false; if (record.getLevel().intValue() < levelValue || levelValue == offValue) { return false; } diff --git a/src/java.logging/share/classes/java/util/logging/MemoryHandler.java b/src/java.logging/share/classes/java/util/logging/MemoryHandler.java index 34053937630..9807fd87c91 100644 --- a/src/java.logging/share/classes/java/util/logging/MemoryHandler.java +++ b/src/java.logging/share/classes/java/util/logging/MemoryHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -270,7 +270,7 @@ public class MemoryHandler extends Handler { * check whether the {@code LogRecord} would result in a "push" of the * buffer contents. It will return false if the {@code LogRecord} is null. * - * @param record a {@code LogRecord} + * @param record a {@code LogRecord} (may be null). * @return true if the {@code LogRecord} would be logged. * */ diff --git a/src/java.logging/share/classes/java/util/logging/StreamHandler.java b/src/java.logging/share/classes/java/util/logging/StreamHandler.java index 954231472b1..4c730c97c6f 100644 --- a/src/java.logging/share/classes/java/util/logging/StreamHandler.java +++ b/src/java.logging/share/classes/java/util/logging/StreamHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -225,7 +225,7 @@ public class StreamHandler extends Handler { * whether it satisfies any {@code Filter}. It will also return false if * no output stream has been assigned yet or the LogRecord is null. * - * @param record a {@code LogRecord} + * @param record a {@code LogRecord} (may be null). * @return true if the {@code LogRecord} would be logged. * */ diff --git a/test/jdk/java/util/logging/IsLoggableHandlerTest.java b/test/jdk/java/util/logging/IsLoggableHandlerTest.java new file mode 100644 index 00000000000..167cfdae189 --- /dev/null +++ b/test/jdk/java/util/logging/IsLoggableHandlerTest.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2019, 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 8216363 + * @summary Test that Handler.isLoggable(null) returns false + * @run main/othervm IsLoggableHandlerTest + */ +import java.io.File; +import java.io.IOException; +import java.util.UUID; +import java.util.logging.ConsoleHandler; +import java.util.logging.FileHandler; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.MemoryHandler; +import java.util.logging.StreamHandler; +import java.util.stream.Stream; + +public class IsLoggableHandlerTest { + + + public static void main(String... args) throws IOException { + String userDir = System.getProperty("user.dir", "."); + File logfile = new File(userDir, "IsLoggableHandlerTest_" + UUID.randomUUID() + ".log"); + try { + System.out.println("Dummy logfile: " + logfile.getAbsolutePath()); + Handler h = new CustomHandler(); + testIsLoggable(h); + testIsLoggable(new MemoryHandler(h, 1, Level.ALL)); + testIsLoggable(new StreamHandler(System.out, new java.util.logging.SimpleFormatter())); + testIsLoggable(new FileHandler(logfile.getAbsolutePath())); + testIsLoggable(new ConsoleHandler()); + } finally { + if (logfile.canRead()) { + try { + System.out.println("Deleting dummy logfile: " + logfile.getAbsolutePath()); + logfile.delete(); + } catch (Throwable t) { + System.out.println("Warning: failed to delete dummy logfile: " + t); + t.printStackTrace(); + } + } + } + } + + public static void testIsLoggable(Handler h) { + System.out.println("Testing " + h.getClass().getName()); + // should not throw NPE but return false + if (h.isLoggable(null)) { + throw new AssertionError(h.getClass().getName() + + ": null record should not be loggable"); + } + h.setLevel(Level.ALL); + // should still not throw NPE but return false + if (h.isLoggable(null)) { + throw new AssertionError(h.getClass().getName() + + ": null record should not be loggable"); + } + // should not throw NPE + h.publish(null); + } + + public static final class CustomHandler extends Handler { + @Override + public void publish(LogRecord record) { } + @Override + public void flush() { } + @Override + public void close() throws SecurityException { } + } + + +} From 86e513bd4820f7be196808232378554e9fc21039 Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Thu, 21 Feb 2019 10:26:56 -0800 Subject: [PATCH 068/109] 8218960: CONFIG level logging statements printed in CLDRCalendarDataProviderImpl.java even when default log Level is INFO Reviewed-by: nishjain, rriggs --- .../cldr/CLDRCalendarDataProviderImpl.java | 5 +- .../locale/provider/CalendarDataUtility.java | 6 +- .../provider/LocaleServiceProviderPool.java | 6 +- .../CheckLoggingFromLocaleProvider.java | 63 +++++++++++++++++++ 4 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 test/jdk/sun/util/locale/provider/CheckLoggingFromLocaleProvider.java diff --git a/src/java.base/share/classes/sun/util/cldr/CLDRCalendarDataProviderImpl.java b/src/java.base/share/classes/sun/util/cldr/CLDRCalendarDataProviderImpl.java index 472767f9879..388af637e54 100644 --- a/src/java.base/share/classes/sun/util/cldr/CLDRCalendarDataProviderImpl.java +++ b/src/java.base/share/classes/sun/util/cldr/CLDRCalendarDataProviderImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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 @@ -80,7 +80,8 @@ public class CLDRCalendarDataProviderImpl extends CalendarDataProviderImpl { String region = locale.getCountry(); if (region.isEmpty()) { - return 0; + // Use "US" as default + region = "US"; } Integer val = map.get(region); diff --git a/src/java.base/share/classes/sun/util/locale/provider/CalendarDataUtility.java b/src/java.base/share/classes/sun/util/locale/provider/CalendarDataUtility.java index e9c73f9192b..41b9ba3e9a7 100644 --- a/src/java.base/share/classes/sun/util/locale/provider/CalendarDataUtility.java +++ b/src/java.base/share/classes/sun/util/locale/provider/CalendarDataUtility.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, 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 @@ -256,7 +256,9 @@ public class CalendarDataUtility { default: throw new InternalError("invalid requestID: " + requestID); } - return (value != 0) ? value : null; + + assert value != 0; + return value; } } } diff --git a/src/java.base/share/classes/sun/util/locale/provider/LocaleServiceProviderPool.java b/src/java.base/share/classes/sun/util/locale/provider/LocaleServiceProviderPool.java index 3a0409b3c06..3a19f36afae 100644 --- a/src/java.base/share/classes/sun/util/locale/provider/LocaleServiceProviderPool.java +++ b/src/java.base/share/classes/sun/util/locale/provider/LocaleServiceProviderPool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2019, 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 @@ -283,8 +283,8 @@ public final class LocaleServiceProviderPool { return providersObj; } else if (isObjectProvider) { config(LocaleServiceProviderPool.class, - "A locale sensitive service provider returned null for a localized objects, which should not happen. provider: " - + lsp + " locale: " + locale); + "A locale sensitive service object provider returned null, " + + "which should not happen. Provider: " + lsp + " Locale: " + locale); } } } diff --git a/test/jdk/sun/util/locale/provider/CheckLoggingFromLocaleProvider.java b/test/jdk/sun/util/locale/provider/CheckLoggingFromLocaleProvider.java new file mode 100644 index 00000000000..cd6620557de --- /dev/null +++ b/test/jdk/sun/util/locale/provider/CheckLoggingFromLocaleProvider.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2019, 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 8218960 + * @modules java.base/sun.util.locale.provider + * @modules java.logging + * @summary Check that no CONFIG messages are logged on instantiating + * SimpleDateFormat with the language-only locale. + * @run main CheckLoggingFromLocaleProvider + */ +import java.text.*; +import java.util.*; +import java.util.logging.*; +import sun.util.locale.provider.*; + +public class CheckLoggingFromLocaleProvider extends StreamHandler { + + @Override + public boolean isLoggable(LogRecord lr) { + if (lr.getLevel() == Level.CONFIG && + lr.getLoggerName().equals( + LocaleServiceProviderPool.class.getCanonicalName())) { + throw new RuntimeException("CONFIG message was logged in " + + lr.getLoggerName() + ". Message: " + lr.getMessage()); + } + return false; + } + + public CheckLoggingFromLocaleProvider() { + setLevel(Level.CONFIG); + Logger l = LogManager.getLogManager().getLogger(""); + l.setLevel(Level.CONFIG); + l.addHandler(this); + + new SimpleDateFormat("", Locale.ENGLISH); + } + + public static void main(String[] args) { + new CheckLoggingFromLocaleProvider(); + } +} From bf2d27c5a4743091aa76569ef7b6743fa072282e Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 21 Feb 2019 10:29:16 -0800 Subject: [PATCH 069/109] 8219254: Update explicit uses of latest source/target in langtools tests to a property 8219256: Update javac diags tests to use properties Co-authored-by: Jonathan Gibbons Reviewed-by: jjg, jlahoda, darcy, iignatyev --- test/langtools/TEST.ROOT | 2 +- .../tools/javac/6330997/T6330997.java | 6 +-- .../tools/javac/ConditionalWithVoid.java | 2 +- test/langtools/tools/javac/diags/Example.java | 49 ++++++++++++++++++- .../diags/examples/BreakAmbiguousTarget.java | 4 +- .../diags/examples/BreakExprNotImmediate.java | 4 +- .../diags/examples/BreakMissingValue.java | 4 +- .../BreakOutsideSwitchExpression.java | 4 +- .../ContinueOutsideSwitchExpression.java | 4 +- .../IncompatibleTypesInSwitchExpression.java | 4 +- .../diags/examples/MultipleCaseLabels.java | 4 +- .../javac/diags/examples/NotExhaustive.java | 4 +- .../diags/examples/PreviewFeatureUse.java | 4 +- .../javac/diags/examples/PreviewFilename.java | 4 +- .../examples/PreviewFilenameAdditional.java | 4 +- .../examples/PreviewPlural/PreviewPlural.java | 4 +- .../ReturnOutsideSwitchExpression.java | 4 +- .../diags/examples/RuleCompletesNormally.java | 4 +- .../SwitchCaseUnexpectedStatement.java | 4 +- .../SwitchExpressionCompletesNormally.java | 4 +- .../diags/examples/SwitchExpressionEmpty.java | 4 +- .../SwitchExpressionTargetCantBeVoid.java | 4 +- .../diags/examples/SwitchExpressions.java | 4 +- .../diags/examples/SwitchMixingCaseTypes.java | 4 +- .../javac/diags/examples/SwitchRules.java | 4 +- .../javac/expswitch/ExpSwitchNestingTest.java | 5 +- .../lambda/BadSwitchExpressionLambda.java | 2 +- .../tools/javac/parser/JavacParserTest.java | 10 ++-- .../javac/preview/classReaderTest/Client.java | 4 +- .../javac/switchexpr/BlockExpression.java | 4 +- .../switchexpr/BooleanNumericNonNumeric.java | 2 +- .../tools/javac/switchexpr/BreakTest.java | 5 +- .../langtools/tools/javac/switchexpr/CRT.java | 6 ++- .../javac/switchexpr/DefiniteAssignment1.java | 4 +- .../javac/switchexpr/DefiniteAssignment2.java | 2 +- .../tools/javac/switchexpr/EmptySwitch.java | 4 +- .../switchexpr/ExhaustiveEnumSwitch.java | 4 +- .../javac/switchexpr/ExpressionSwitch.java | 2 +- .../switchexpr/ExpressionSwitchBreaks1.java | 4 +- .../switchexpr/ExpressionSwitchBreaks2.java | 2 +- .../switchexpr/ExpressionSwitchBugs.java | 4 +- .../switchexpr/ExpressionSwitchBugsInGen.java | 4 +- .../ExpressionSwitchCodeFromJLS.java | 4 +- .../javac/switchexpr/ExpressionSwitchDA.java | 4 +- .../switchexpr/ExpressionSwitchEmbedding.java | 4 +- .../ExpressionSwitchFallThrough.java | 4 +- .../ExpressionSwitchFallThrough1.java | 4 +- .../switchexpr/ExpressionSwitchFlow.java | 2 +- .../ExpressionSwitchInExpressionSwitch.java | 2 +- .../switchexpr/ExpressionSwitchInfer.java | 2 +- .../ExpressionSwitchIntersectionTypes.java | 4 +- .../ExpressionSwitchNotExhaustive.java | 2 +- .../ExpressionSwitchUnreachable.java | 2 +- .../javac/switchexpr/ParseIncomplete.java | 5 +- .../javac/switchexpr/ParserRecovery.java | 2 +- .../SwitchExpressionIsNotAConstant.java | 4 +- .../SwitchExpressionScopesIsolated.java | 2 +- .../SwitchExpressionSimpleVisitorTest.java | 4 +- .../tools/javac/switchexpr/TryCatch.java | 4 +- .../tools/javac/switchextra/CaseTest.java | 25 +++++----- .../switchextra/MultipleLabelsExpression.java | 2 +- .../switchextra/MultipleLabelsStatement.java | 2 +- .../javac/switchextra/RuleParsingTest.java | 9 ++-- .../SwitchArrowBrokenConstant.java | 2 +- .../switchextra/SwitchStatementArrow.java | 2 +- .../switchextra/SwitchStatementBroken.java | 2 +- .../switchextra/SwitchStatementBroken2.java | 2 +- .../SwitchStatementScopesIsolated.java | 2 +- 68 files changed, 183 insertions(+), 131 deletions(-) diff --git a/test/langtools/TEST.ROOT b/test/langtools/TEST.ROOT index f9dcfd9e360..db2d21f0b07 100644 --- a/test/langtools/TEST.ROOT +++ b/test/langtools/TEST.ROOT @@ -15,7 +15,7 @@ keys=intermittent randomness groups=TEST.groups # Minimum jtreg version -requiredVersion=4.2 b13 +requiredVersion=4.2 b14 # Use new module options useNewOptions=true diff --git a/test/langtools/tools/javac/6330997/T6330997.java b/test/langtools/tools/javac/6330997/T6330997.java index 297d448c24e..8ddf40e4557 100644 --- a/test/langtools/tools/javac/6330997/T6330997.java +++ b/test/langtools/tools/javac/6330997/T6330997.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2019, 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 @@ -32,8 +32,8 @@ * jdk.compiler/com.sun.tools.javac.main * jdk.compiler/com.sun.tools.javac.util * @clean T1 T2 - * @compile -source 12 -target 13 T1.java - * @compile -source 12 -target 13 T2.java + * @compile T1.java + * @compile T2.java * @run main/othervm T6330997 */ diff --git a/test/langtools/tools/javac/ConditionalWithVoid.java b/test/langtools/tools/javac/ConditionalWithVoid.java index 93a918d1c1c..710f2753c64 100644 --- a/test/langtools/tools/javac/ConditionalWithVoid.java +++ b/test/langtools/tools/javac/ConditionalWithVoid.java @@ -4,7 +4,7 @@ * @summary The compiler was allowing void types in its parsing of conditional expressions. * @author tball * - * @compile/fail/ref=ConditionalWithVoid.out --enable-preview -source 13 -XDrawDiagnostics ConditionalWithVoid.java + * @compile/fail/ref=ConditionalWithVoid.out --enable-preview -source ${jdk.version} -XDrawDiagnostics ConditionalWithVoid.java */ public class ConditionalWithVoid { public void test(Object o, String s) { diff --git a/test/langtools/tools/javac/diags/Example.java b/test/langtools/tools/javac/diags/Example.java index 8cadd96a4c3..14cfa488141 100644 --- a/test/langtools/tools/javac/diags/Example.java +++ b/test/langtools/tools/javac/diags/Example.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019, 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 @@ -288,7 +288,7 @@ class Example implements Comparable { opts.add("-d"); opts.add(classesDir.getPath()); if (options != null) - opts.addAll(options); + opts.addAll(evalProperties(options)); if (procFiles.size() > 0) { List pOpts = new ArrayList<>(Arrays.asList("-d", classesDir.getPath())); @@ -355,6 +355,51 @@ class Example implements Comparable { } } + private static List evalProperties(List args) { + boolean fast = true; + for (String arg : args) { + fast = fast && (arg.indexOf("${") == -1); + } + if (fast) { + return args; + } + List newArgs = new ArrayList<>(); + for (String arg : args) { + newArgs.add(evalProperties(arg)); + } + return newArgs; + } + + private static final Pattern namePattern = Pattern.compile("\\$\\{([A-Za-z0-9._]+)\\}"); + private static final String jdkVersion = Integer.toString(Runtime.version().feature()); + + private static String evalProperties(String arg) { + Matcher m = namePattern.matcher(arg); + StringBuilder sb = null; + while (m.find()) { + if (sb == null) { + sb = new StringBuilder(); + } + String propName = m.group(1); + String propValue; + switch (propName) { + case "jdk.version": + propValue = jdkVersion; + break; + default: + propValue = System.getProperty(propName); + break; + } + m.appendReplacement(sb, propValue != null ? propValue : m.group(0).replace("$", "\\$")); + } + if (sb == null) { + return arg; + } else { + m.appendTail(sb); + return sb.toString(); + } + } + void createAnnotationServicesFile(File dir, List procFiles) throws IOException { File servicesDir = new File(new File(dir, "META-INF"), "services"); servicesDir.mkdirs(); diff --git a/test/langtools/tools/javac/diags/examples/BreakAmbiguousTarget.java b/test/langtools/tools/javac/diags/examples/BreakAmbiguousTarget.java index c28960a8fbb..1eb668e126c 100644 --- a/test/langtools/tools/javac/diags/examples/BreakAmbiguousTarget.java +++ b/test/langtools/tools/javac/diags/examples/BreakAmbiguousTarget.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.err.break.ambiguous.target // key: compiler.note.preview.filename // key: compiler.note.preview.recompile -// options: --enable-preview -source 13 +// options: --enable-preview -source ${jdk.version} class BreakAmbiguousTarget { void m(int i, int j) { diff --git a/test/langtools/tools/javac/diags/examples/BreakExprNotImmediate.java b/test/langtools/tools/javac/diags/examples/BreakExprNotImmediate.java index 0eb1ab3799e..4296521fa93 100644 --- a/test/langtools/tools/javac/diags/examples/BreakExprNotImmediate.java +++ b/test/langtools/tools/javac/diags/examples/BreakExprNotImmediate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -33,7 +33,7 @@ // key: compiler.note.preview.filename // key: compiler.note.preview.recompile // key: compiler.note.note -// options: --enable-preview -source 13 +// options: --enable-preview -source ${jdk.version} // run: backdoor class BreakExprNotImmediate { diff --git a/test/langtools/tools/javac/diags/examples/BreakMissingValue.java b/test/langtools/tools/javac/diags/examples/BreakMissingValue.java index 0ea668ba305..ecc9f68e960 100644 --- a/test/langtools/tools/javac/diags/examples/BreakMissingValue.java +++ b/test/langtools/tools/javac/diags/examples/BreakMissingValue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.err.break.missing.value // key: compiler.note.preview.filename // key: compiler.note.preview.recompile -// options: --enable-preview -source 13 +// options: --enable-preview -source ${jdk.version} class BreakMissingValue { int t(int i) { diff --git a/test/langtools/tools/javac/diags/examples/BreakOutsideSwitchExpression.java b/test/langtools/tools/javac/diags/examples/BreakOutsideSwitchExpression.java index f980c5e4720..aa7d7d2fcd4 100644 --- a/test/langtools/tools/javac/diags/examples/BreakOutsideSwitchExpression.java +++ b/test/langtools/tools/javac/diags/examples/BreakOutsideSwitchExpression.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.err.break.outside.switch.expression // key: compiler.note.preview.filename // key: compiler.note.preview.recompile -// options: --enable-preview -source 13 +// options: --enable-preview -source ${jdk.version} class BreakOutsideSwitchExpression { int t(int i) { diff --git a/test/langtools/tools/javac/diags/examples/ContinueOutsideSwitchExpression.java b/test/langtools/tools/javac/diags/examples/ContinueOutsideSwitchExpression.java index f5d1d278dcc..c7ae16d6a89 100644 --- a/test/langtools/tools/javac/diags/examples/ContinueOutsideSwitchExpression.java +++ b/test/langtools/tools/javac/diags/examples/ContinueOutsideSwitchExpression.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.err.continue.outside.switch.expression // key: compiler.note.preview.filename // key: compiler.note.preview.recompile -// options: --enable-preview -source 13 +// options: --enable-preview -source ${jdk.version} class ContinueOutsideSwitchExpression { int t(int i) { diff --git a/test/langtools/tools/javac/diags/examples/IncompatibleTypesInSwitchExpression.java b/test/langtools/tools/javac/diags/examples/IncompatibleTypesInSwitchExpression.java index bba166c3eb1..56e3d32eb75 100644 --- a/test/langtools/tools/javac/diags/examples/IncompatibleTypesInSwitchExpression.java +++ b/test/langtools/tools/javac/diags/examples/IncompatibleTypesInSwitchExpression.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, 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 @@ -26,7 +26,7 @@ // key: compiler.misc.inconvertible.types // key: compiler.note.preview.filename // key: compiler.note.preview.recompile -// options: --enable-preview -source 13 +// options: --enable-preview -source ${jdk.version} class IncompatibleTypesInSwitchExpression { diff --git a/test/langtools/tools/javac/diags/examples/MultipleCaseLabels.java b/test/langtools/tools/javac/diags/examples/MultipleCaseLabels.java index 0db0884115c..57be2f20126 100644 --- a/test/langtools/tools/javac/diags/examples/MultipleCaseLabels.java +++ b/test/langtools/tools/javac/diags/examples/MultipleCaseLabels.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.misc.feature.multiple.case.labels // key: compiler.warn.preview.feature.use.plural -// options: --enable-preview -source 13 -Xlint:preview +// options: --enable-preview -source ${jdk.version} -Xlint:preview class MultipleCaseLabels { void m(int i) { diff --git a/test/langtools/tools/javac/diags/examples/NotExhaustive.java b/test/langtools/tools/javac/diags/examples/NotExhaustive.java index 846bc9cdeb5..8f4e2be47bf 100644 --- a/test/langtools/tools/javac/diags/examples/NotExhaustive.java +++ b/test/langtools/tools/javac/diags/examples/NotExhaustive.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.err.not.exhaustive // key: compiler.note.preview.filename // key: compiler.note.preview.recompile -// options: --enable-preview -source 13 +// options: --enable-preview -source ${jdk.version} class NotExhaustive { int t(int i) { diff --git a/test/langtools/tools/javac/diags/examples/PreviewFeatureUse.java b/test/langtools/tools/javac/diags/examples/PreviewFeatureUse.java index 3dbb2270c4e..99a7596cb0e 100644 --- a/test/langtools/tools/javac/diags/examples/PreviewFeatureUse.java +++ b/test/langtools/tools/javac/diags/examples/PreviewFeatureUse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,7 +25,7 @@ //key: compiler.warn.preview.feature.use.plural //key: compiler.misc.feature.diamond //key: compiler.misc.feature.lambda -//options: -Xlint:preview -XDforcePreview -source 13 --enable-preview +//options: -Xlint:preview -XDforcePreview -source ${jdk.version} --enable-preview import java.util.ArrayList; diff --git a/test/langtools/tools/javac/diags/examples/PreviewFilename.java b/test/langtools/tools/javac/diags/examples/PreviewFilename.java index 04edcdf8715..b424851311a 100644 --- a/test/langtools/tools/javac/diags/examples/PreviewFilename.java +++ b/test/langtools/tools/javac/diags/examples/PreviewFilename.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.note.preview.filename // key: compiler.note.preview.recompile -// options: -XDforcePreview -source 13 --enable-preview +// options: -XDforcePreview -source ${jdk.version} --enable-preview import java.util.ArrayList; import java.util.List; diff --git a/test/langtools/tools/javac/diags/examples/PreviewFilenameAdditional.java b/test/langtools/tools/javac/diags/examples/PreviewFilenameAdditional.java index 3d5430de389..60ee874a8c5 100644 --- a/test/langtools/tools/javac/diags/examples/PreviewFilenameAdditional.java +++ b/test/langtools/tools/javac/diags/examples/PreviewFilenameAdditional.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.note.preview.filename.additional // key: compiler.warn.preview.feature.use // key: compiler.misc.feature.diamond -// options: -Xlint:preview -Xmaxwarns 1 -XDforcePreview -source 13 --enable-preview +// options: -Xlint:preview -Xmaxwarns 1 -XDforcePreview -source ${jdk.version} --enable-preview import java.util.ArrayList; diff --git a/test/langtools/tools/javac/diags/examples/PreviewPlural/PreviewPlural.java b/test/langtools/tools/javac/diags/examples/PreviewPlural/PreviewPlural.java index e9b92af8ded..abd93b5e3ce 100644 --- a/test/langtools/tools/javac/diags/examples/PreviewPlural/PreviewPlural.java +++ b/test/langtools/tools/javac/diags/examples/PreviewPlural/PreviewPlural.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.note.preview.plural // key: compiler.note.preview.recompile -// options: -XDforcePreview -source 13 --enable-preview +// options: -XDforcePreview -source ${jdk.version} --enable-preview import java.util.ArrayList; diff --git a/test/langtools/tools/javac/diags/examples/ReturnOutsideSwitchExpression.java b/test/langtools/tools/javac/diags/examples/ReturnOutsideSwitchExpression.java index 9811287efc9..4db3dcdfa5a 100644 --- a/test/langtools/tools/javac/diags/examples/ReturnOutsideSwitchExpression.java +++ b/test/langtools/tools/javac/diags/examples/ReturnOutsideSwitchExpression.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.err.return.outside.switch.expression // key: compiler.note.preview.filename // key: compiler.note.preview.recompile -// options: --enable-preview -source 13 +// options: --enable-preview -source ${jdk.version} class ReturnOutsideSwitchExpression { int t(int i) { diff --git a/test/langtools/tools/javac/diags/examples/RuleCompletesNormally.java b/test/langtools/tools/javac/diags/examples/RuleCompletesNormally.java index bb876ac9de2..69fe3325061 100644 --- a/test/langtools/tools/javac/diags/examples/RuleCompletesNormally.java +++ b/test/langtools/tools/javac/diags/examples/RuleCompletesNormally.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.err.rule.completes.normally // key: compiler.note.preview.filename // key: compiler.note.preview.recompile -// options: --enable-preview -source 13 +// options: --enable-preview -source ${jdk.version} class RuleCompletesNormally { public String convert(int i) { diff --git a/test/langtools/tools/javac/diags/examples/SwitchCaseUnexpectedStatement.java b/test/langtools/tools/javac/diags/examples/SwitchCaseUnexpectedStatement.java index d3509b0756b..025343b385a 100644 --- a/test/langtools/tools/javac/diags/examples/SwitchCaseUnexpectedStatement.java +++ b/test/langtools/tools/javac/diags/examples/SwitchCaseUnexpectedStatement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.err.switch.case.unexpected.statement // key: compiler.note.preview.filename // key: compiler.note.preview.recompile -// options: --enable-preview -source 13 +// options: --enable-preview -source ${jdk.version} class ReturnOutsideSwitchExpression { void t(int i) { diff --git a/test/langtools/tools/javac/diags/examples/SwitchExpressionCompletesNormally.java b/test/langtools/tools/javac/diags/examples/SwitchExpressionCompletesNormally.java index f3fef28165a..49daf1f1011 100644 --- a/test/langtools/tools/javac/diags/examples/SwitchExpressionCompletesNormally.java +++ b/test/langtools/tools/javac/diags/examples/SwitchExpressionCompletesNormally.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.err.switch.expression.completes.normally // key: compiler.note.preview.filename // key: compiler.note.preview.recompile -// options: --enable-preview -source 13 +// options: --enable-preview -source ${jdk.version} class SwitchExpressionCompletesNormally { public String convert(int i) { diff --git a/test/langtools/tools/javac/diags/examples/SwitchExpressionEmpty.java b/test/langtools/tools/javac/diags/examples/SwitchExpressionEmpty.java index 61c1d43cc04..8998ef0244f 100644 --- a/test/langtools/tools/javac/diags/examples/SwitchExpressionEmpty.java +++ b/test/langtools/tools/javac/diags/examples/SwitchExpressionEmpty.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.err.switch.expression.empty // key: compiler.note.preview.filename // key: compiler.note.preview.recompile -// options: --enable-preview -source 13 +// options: --enable-preview -source ${jdk.version} class BreakOutsideSwitchExpression { String t(E e) { diff --git a/test/langtools/tools/javac/diags/examples/SwitchExpressionTargetCantBeVoid.java b/test/langtools/tools/javac/diags/examples/SwitchExpressionTargetCantBeVoid.java index 96a52cdcf87..26d7cbd3aff 100644 --- a/test/langtools/tools/javac/diags/examples/SwitchExpressionTargetCantBeVoid.java +++ b/test/langtools/tools/javac/diags/examples/SwitchExpressionTargetCantBeVoid.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -26,7 +26,7 @@ // key: compiler.misc.switch.expression.target.cant.be.void // key: compiler.note.preview.filename // key: compiler.note.preview.recompile -// options: --enable-preview -source 13 +// options: --enable-preview -source ${jdk.version} class SwitchExpressionTargetCantBeVoid { diff --git a/test/langtools/tools/javac/diags/examples/SwitchExpressions.java b/test/langtools/tools/javac/diags/examples/SwitchExpressions.java index e386b651bd0..596814bfd64 100644 --- a/test/langtools/tools/javac/diags/examples/SwitchExpressions.java +++ b/test/langtools/tools/javac/diags/examples/SwitchExpressions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.misc.feature.switch.expressions // key: compiler.warn.preview.feature.use.plural -// options: --enable-preview -source 13 -Xlint:preview +// options: --enable-preview -source ${jdk.version} -Xlint:preview class SwitchExpressions { int m(int i) { diff --git a/test/langtools/tools/javac/diags/examples/SwitchMixingCaseTypes.java b/test/langtools/tools/javac/diags/examples/SwitchMixingCaseTypes.java index dcfcbbf0fc4..1c9747af7b5 100644 --- a/test/langtools/tools/javac/diags/examples/SwitchMixingCaseTypes.java +++ b/test/langtools/tools/javac/diags/examples/SwitchMixingCaseTypes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.err.switch.mixing.case.types // key: compiler.note.preview.filename // key: compiler.note.preview.recompile -// options: --enable-preview -source 13 +// options: --enable-preview -source ${jdk.version} class SwitchMixingCaseTypes { diff --git a/test/langtools/tools/javac/diags/examples/SwitchRules.java b/test/langtools/tools/javac/diags/examples/SwitchRules.java index fe99b8366bd..5604cf4e821 100644 --- a/test/langtools/tools/javac/diags/examples/SwitchRules.java +++ b/test/langtools/tools/javac/diags/examples/SwitchRules.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ // key: compiler.misc.feature.switch.rules // key: compiler.warn.preview.feature.use.plural -// options: --enable-preview -source 13 -Xlint:preview +// options: --enable-preview -source ${jdk.version} -Xlint:preview class SwitchExpressions { void m(int i) { diff --git a/test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java b/test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java index 84270313db0..9e65902c455 100644 --- a/test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java +++ b/test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,8 @@ public class ExpSwitchNestingTest extends JavacTemplateTestBase { } } - private static String[] PREVIEW_OPTIONS = {"--enable-preview", "-source", "13"}; + private static String[] PREVIEW_OPTIONS = {"--enable-preview", "-source", + Integer.toString(Runtime.version().feature())}; private void program(String... constructs) { String s = "class C { static boolean cond = false; static int x = 0; void m() { # } }"; diff --git a/test/langtools/tools/javac/lambda/BadSwitchExpressionLambda.java b/test/langtools/tools/javac/lambda/BadSwitchExpressionLambda.java index 14fe01726d7..9ad491c37d1 100644 --- a/test/langtools/tools/javac/lambda/BadSwitchExpressionLambda.java +++ b/test/langtools/tools/javac/lambda/BadSwitchExpressionLambda.java @@ -2,7 +2,7 @@ * @test /nodynamiccopyright/ * @bug 8206986 * @summary Adding switch expressions - * @compile/fail/ref=BadSwitchExpressionLambda.out -XDrawDiagnostics --enable-preview -source 13 BadSwitchExpressionLambda.java + * @compile/fail/ref=BadSwitchExpressionLambda.out -XDrawDiagnostics --enable-preview -source ${jdk.version} BadSwitchExpressionLambda.java */ class BadSwitchExpressionLambda { diff --git a/test/langtools/tools/javac/parser/JavacParserTest.java b/test/langtools/tools/javac/parser/JavacParserTest.java index 6844282258f..20e8f745efb 100644 --- a/test/langtools/tools/javac/parser/JavacParserTest.java +++ b/test/langtools/tools/javac/parser/JavacParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2019, 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 @@ -88,14 +88,14 @@ import com.sun.source.util.TreePathScanner; public class JavacParserTest extends TestCase { static final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); static final JavaFileManager fm = tool.getStandardFileManager(null, null, null); + public static final String SOURCE_VERSION = + Integer.toString(Runtime.version().feature()); private JavacParserTest(){} public static void main(String... args) throws Exception { - try { + try (fm) { new JavacParserTest().run(args); - } finally { - fm.close(); } } @@ -1096,7 +1096,7 @@ public class JavacParserTest extends TestCase { String expectedErrors = "Test.java:1:178: compiler.err.switch.case.unexpected.statement\n"; StringWriter out = new StringWriter(); JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(out, fm, null, - Arrays.asList("-XDrawDiagnostics", "--enable-preview", "-source", "13"), + Arrays.asList("-XDrawDiagnostics", "--enable-preview", "-source", SOURCE_VERSION), null, Arrays.asList(new MyFileObject(code))); CompilationUnitTree cut = ct.parse().iterator().next(); diff --git a/test/langtools/tools/javac/preview/classReaderTest/Client.java b/test/langtools/tools/javac/preview/classReaderTest/Client.java index 4c122887033..74bb99327d6 100644 --- a/test/langtools/tools/javac/preview/classReaderTest/Client.java +++ b/test/langtools/tools/javac/preview/classReaderTest/Client.java @@ -2,9 +2,9 @@ * @test /nodynamiccopyright/ * @bug 8199194 * @summary smoke test for --enabled-preview classreader support - * @compile -XDforcePreview --enable-preview -source 13 Bar.java + * @compile -XDforcePreview --enable-preview -source ${jdk.version} Bar.java * @compile/fail/ref=Client.nopreview.out -Xlint:preview -XDrawDiagnostics Client.java - * @compile/fail/ref=Client.preview.out -Werror -Xlint:preview -XDrawDiagnostics --enable-preview -source 13 Client.java + * @compile/fail/ref=Client.preview.out -Werror -Xlint:preview -XDrawDiagnostics --enable-preview -source ${jdk.version} Client.java */ public class Client { diff --git a/test/langtools/tools/javac/switchexpr/BlockExpression.java b/test/langtools/tools/javac/switchexpr/BlockExpression.java index 0534ccb180c..3411a01d3d6 100644 --- a/test/langtools/tools/javac/switchexpr/BlockExpression.java +++ b/test/langtools/tools/javac/switchexpr/BlockExpression.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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,7 +25,7 @@ * @test * @bug 8206986 * @summary Verify rule cases with expression statements and throw statements work. - * @compile --enable-preview -source 13 BlockExpression.java + * @compile --enable-preview -source ${jdk.version} BlockExpression.java * @run main/othervm --enable-preview BlockExpression */ diff --git a/test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.java b/test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.java index 2f5aac13fce..76f757fce4c 100644 --- a/test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.java +++ b/test/langtools/tools/javac/switchexpr/BooleanNumericNonNumeric.java @@ -2,7 +2,7 @@ * @test /nodynamiccopyright/ * @bug 8206986 * @summary Verify the type of a conditional expression with nested switch expression is computed properly - * @compile/fail/ref=BooleanNumericNonNumeric.out -XDrawDiagnostics --enable-preview -source 13 BooleanNumericNonNumeric.java + * @compile/fail/ref=BooleanNumericNonNumeric.out -XDrawDiagnostics --enable-preview -source ${jdk.version} BooleanNumericNonNumeric.java */ public class BooleanNumericNonNumeric { diff --git a/test/langtools/tools/javac/switchexpr/BreakTest.java b/test/langtools/tools/javac/switchexpr/BreakTest.java index ea8b22580e5..92676c58c87 100644 --- a/test/langtools/tools/javac/switchexpr/BreakTest.java +++ b/test/langtools/tools/javac/switchexpr/BreakTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -61,12 +61,13 @@ public class BreakTest { public static void main(String[] args) throws Exception { final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); + String sourceVersion = Integer.toString(Runtime.version().feature()); assert tool != null; DiagnosticListener noErrors = d -> {}; StringWriter out = new StringWriter(); JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors, - List.of("-XDdev", "--enable-preview", "-source", "13"), null, + List.of("-XDdev", "--enable-preview", "-source", sourceVersion), null, Arrays.asList(new MyFileObject(CODE))); List labels = new ArrayList<>(); new TreePathScanner() { diff --git a/test/langtools/tools/javac/switchexpr/CRT.java b/test/langtools/tools/javac/switchexpr/CRT.java index efaf656d822..b16b2265250 100644 --- a/test/langtools/tools/javac/switchexpr/CRT.java +++ b/test/langtools/tools/javac/switchexpr/CRT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,6 +48,8 @@ public class CRT { new CRT().run(); } + private static final String SOURCE_VERSION = Integer.toString(Runtime.version().feature()); + private ToolBox tb = new ToolBox(); private void run() throws Exception { @@ -151,7 +153,7 @@ public class CRT { new JavacTask(tb) .options("-Xjcov", "--enable-preview", - "-source", "13") + "-source", SOURCE_VERSION) .outdir(classes) .sources("public class Test {\n" + code + diff --git a/test/langtools/tools/javac/switchexpr/DefiniteAssignment1.java b/test/langtools/tools/javac/switchexpr/DefiniteAssignment1.java index d58c23bbb59..6e12f39f1bc 100644 --- a/test/langtools/tools/javac/switchexpr/DefiniteAssignment1.java +++ b/test/langtools/tools/javac/switchexpr/DefiniteAssignment1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,7 +25,7 @@ * @test * @bug 8214031 * @summary Verify that definite assignment when true works (legal code) - * @compile --enable-preview --source 13 DefiniteAssignment1.java + * @compile --enable-preview --source ${jdk.version} DefiniteAssignment1.java * @run main/othervm --enable-preview DefiniteAssignment1 */ public class DefiniteAssignment1 { diff --git a/test/langtools/tools/javac/switchexpr/DefiniteAssignment2.java b/test/langtools/tools/javac/switchexpr/DefiniteAssignment2.java index 706b83d5ab8..bfd358f8c1a 100644 --- a/test/langtools/tools/javac/switchexpr/DefiniteAssignment2.java +++ b/test/langtools/tools/javac/switchexpr/DefiniteAssignment2.java @@ -2,7 +2,7 @@ * @test /nodynamiccopyright/ * @bug 8214031 * @summary Verify that definite assignment when true works (illegal code) - * @compile/fail/ref=DefiniteAssignment2.out --enable-preview --source 13 -XDrawDiagnostics DefiniteAssignment2.java + * @compile/fail/ref=DefiniteAssignment2.out --enable-preview --source ${jdk.version} -XDrawDiagnostics DefiniteAssignment2.java */ public class DefiniteAssignment2 { diff --git a/test/langtools/tools/javac/switchexpr/EmptySwitch.java b/test/langtools/tools/javac/switchexpr/EmptySwitch.java index bf26578ea1b..553d9031024 100644 --- a/test/langtools/tools/javac/switchexpr/EmptySwitch.java +++ b/test/langtools/tools/javac/switchexpr/EmptySwitch.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,7 +25,7 @@ * @test * @bug 8206986 * @summary Verify than an empty switch expression is rejected. - * @compile/fail/ref=EmptySwitch.out --enable-preview -source 13 -XDrawDiagnostics EmptySwitch.java + * @compile/fail/ref=EmptySwitch.out --enable-preview -source ${jdk.version} -XDrawDiagnostics EmptySwitch.java */ public class EmptySwitch { diff --git a/test/langtools/tools/javac/switchexpr/ExhaustiveEnumSwitch.java b/test/langtools/tools/javac/switchexpr/ExhaustiveEnumSwitch.java index bbe728a5300..7b38e291a6b 100644 --- a/test/langtools/tools/javac/switchexpr/ExhaustiveEnumSwitch.java +++ b/test/langtools/tools/javac/switchexpr/ExhaustiveEnumSwitch.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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,7 +25,7 @@ * @test * @bug 8206986 * @summary Verify that an switch expression over enum can be exhaustive without default. - * @compile --enable-preview -source 13 ExhaustiveEnumSwitch.java + * @compile --enable-preview -source ${jdk.version} ExhaustiveEnumSwitch.java * @compile ExhaustiveEnumSwitchExtra.java * @run main/othervm --enable-preview ExhaustiveEnumSwitch */ diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java index 67c0fbb61d7..8acb340a9ab 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitch.java @@ -3,7 +3,7 @@ * @bug 8206986 * @summary Check expression switch works. * @compile/fail/ref=ExpressionSwitch-old.out -source 9 -Xlint:-options -XDrawDiagnostics ExpressionSwitch.java - * @compile --enable-preview -source 13 ExpressionSwitch.java + * @compile --enable-preview -source ${jdk.version} ExpressionSwitch.java * @run main/othervm --enable-preview ExpressionSwitch */ diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks1.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks1.java index 198350e8862..f17b845a804 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks1.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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,7 +25,7 @@ * @test * @bug 8206986 * @summary Verify behavior of various kinds of breaks. - * @compile --enable-preview -source 13 ExpressionSwitchBreaks1.java + * @compile --enable-preview -source ${jdk.version} ExpressionSwitchBreaks1.java * @run main/othervm --enable-preview ExpressionSwitchBreaks1 */ diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks2.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks2.java index 66e9023b4ef..c9a5ba8fdd5 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks2.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBreaks2.java @@ -2,7 +2,7 @@ * @test /nodynamiccopyright/ * @bug 8206986 * @summary Check behavior for invalid breaks. - * @compile/fail/ref=ExpressionSwitchBreaks2.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchBreaks2.java + * @compile/fail/ref=ExpressionSwitchBreaks2.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchBreaks2.java */ public class ExpressionSwitchBreaks2 { diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugs.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugs.java index 873f9d1b59a..e26957e79b9 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugs.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,7 +25,7 @@ * @test * @bug 8206986 8214114 8214529 * @summary Verify various corner cases with nested switch expressions. - * @compile --enable-preview -source 13 ExpressionSwitchBugs.java + * @compile --enable-preview -source ${jdk.version} ExpressionSwitchBugs.java * @run main/othervm --enable-preview ExpressionSwitchBugs */ diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugsInGen.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugsInGen.java index 9dd0c5e4b63..731a7d05441 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugsInGen.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchBugsInGen.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,7 +25,7 @@ * @test * @bug 8214031 * @summary Verify various corner cases with nested switch expressions. - * @compile --enable-preview -source 13 ExpressionSwitchBugsInGen.java + * @compile --enable-preview -source ${jdk.version} ExpressionSwitchBugsInGen.java * @run main/othervm --enable-preview ExpressionSwitchBugsInGen */ diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitchCodeFromJLS.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitchCodeFromJLS.java index f9564bafc86..b6547c2eb2e 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchCodeFromJLS.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchCodeFromJLS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,7 +25,7 @@ * @test * @bug 8206986 * @summary Check switch expressions - * @compile --enable-preview -source 13 ExpressionSwitchCodeFromJLS.java + * @compile --enable-preview -source ${jdk.version} ExpressionSwitchCodeFromJLS.java * @run main/othervm --enable-preview ExpressionSwitchCodeFromJLS */ diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitchDA.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitchDA.java index 9815b27dd48..d54780c691e 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchDA.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchDA.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,7 +25,7 @@ * @test * @bug 8206986 * @summary Check definite (un)assignment for in switch expressions. - * @compile --enable-preview -source 13 ExpressionSwitchDA.java + * @compile --enable-preview -source ${jdk.version} ExpressionSwitchDA.java * @run main/othervm --enable-preview ExpressionSwitchDA */ diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitchEmbedding.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitchEmbedding.java index 997b69ce927..f868e58ea36 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchEmbedding.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchEmbedding.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,7 +25,7 @@ * @test * @bug 8214031 8214114 * @summary Verify switch expressions embedded in various statements work properly. - * @compile --enable-preview -source 13 ExpressionSwitchEmbedding.java + * @compile --enable-preview -source ${jdk.version} ExpressionSwitchEmbedding.java * @run main/othervm --enable-preview ExpressionSwitchEmbedding */ diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough.java index f51e51ad9a0..e4d9fa37397 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,7 +25,7 @@ * @test * @bug 8206986 * @summary Check fall through in switch expressions. - * @compile --enable-preview -source 13 ExpressionSwitchFallThrough.java + * @compile --enable-preview -source ${jdk.version} ExpressionSwitchFallThrough.java * @run main/othervm --enable-preview ExpressionSwitchFallThrough */ diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough1.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough1.java index 2f60e88c7e5..e4db669707a 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough1.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFallThrough1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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,7 +25,7 @@ * @test * @bug 8206986 * @summary Check fall through in switch expressions. - * @compile --enable-preview -source 13 ExpressionSwitchFallThrough1.java + * @compile --enable-preview -source ${jdk.version} ExpressionSwitchFallThrough1.java * @run main/othervm --enable-preview ExpressionSwitchFallThrough1 */ diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFlow.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFlow.java index f5cd71af5cb..9125b23e08d 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchFlow.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchFlow.java @@ -2,7 +2,7 @@ * @test /nodynamiccopyright/ * @bug 8212982 * @summary Verify a compile-time error is produced if switch expression does not provide a value - * @compile/fail/ref=ExpressionSwitchFlow.out --enable-preview -source 13 -XDrawDiagnostics ExpressionSwitchFlow.java + * @compile/fail/ref=ExpressionSwitchFlow.out --enable-preview -source ${jdk.version} -XDrawDiagnostics ExpressionSwitchFlow.java */ public class ExpressionSwitchFlow { diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitchInExpressionSwitch.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitchInExpressionSwitch.java index 6d57ffa16ea..76c262dc19b 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchInExpressionSwitch.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchInExpressionSwitch.java @@ -25,7 +25,7 @@ * @test * @bug 8206986 * @summary Check switch expressions embedded in switch expressions. - * @compile --enable-preview -source 13 ExpressionSwitchInExpressionSwitch.java + * @compile --enable-preview -source ${jdk.version} ExpressionSwitchInExpressionSwitch.java * @run main/othervm --enable-preview ExpressionSwitchInExpressionSwitch */ diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.java index 8b6d32535eb..72bd01f7e3c 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchInfer.java @@ -2,7 +2,7 @@ * @test /nodynamiccopyright/ * @bug 8206986 * @summary Check types inferred for switch expressions. - * @compile/fail/ref=ExpressionSwitchInfer.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchInfer.java + * @compile/fail/ref=ExpressionSwitchInfer.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchInfer.java */ import java.util.ArrayList; diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitchIntersectionTypes.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitchIntersectionTypes.java index a1f13b83d76..f02853cee56 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchIntersectionTypes.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchIntersectionTypes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,7 +25,7 @@ * @test * @bug 8206986 * @summary Verify behavior when an intersection type is inferred for switch expression. - * @compile --enable-preview -source 13 ExpressionSwitchIntersectionTypes.java + * @compile --enable-preview -source ${jdk.version} ExpressionSwitchIntersectionTypes.java * @run main/othervm --enable-preview ExpressionSwitchIntersectionTypes */ diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.java index 8f4ea2e80c6..0f611e0e2ff 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchNotExhaustive.java @@ -2,7 +2,7 @@ * @test /nodynamiccopyright/ * @bug 8206986 * @summary Verify behavior of not exhaustive switch expressions. - * @compile/fail/ref=ExpressionSwitchNotExhaustive.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchNotExhaustive.java + * @compile/fail/ref=ExpressionSwitchNotExhaustive.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchNotExhaustive.java */ public class ExpressionSwitchNotExhaustive { diff --git a/test/langtools/tools/javac/switchexpr/ExpressionSwitchUnreachable.java b/test/langtools/tools/javac/switchexpr/ExpressionSwitchUnreachable.java index 978e49e1088..88c6dfe031c 100644 --- a/test/langtools/tools/javac/switchexpr/ExpressionSwitchUnreachable.java +++ b/test/langtools/tools/javac/switchexpr/ExpressionSwitchUnreachable.java @@ -2,7 +2,7 @@ * @test /nodynamiccopyright/ * @bug 8206986 * @summary Verify reachability in switch expressions. - * @compile/fail/ref=ExpressionSwitchUnreachable.out -XDrawDiagnostics --enable-preview -source 13 ExpressionSwitchUnreachable.java + * @compile/fail/ref=ExpressionSwitchUnreachable.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ExpressionSwitchUnreachable.java */ public class ExpressionSwitchUnreachable { diff --git a/test/langtools/tools/javac/switchexpr/ParseIncomplete.java b/test/langtools/tools/javac/switchexpr/ParseIncomplete.java index 159ba634d96..b5b886f2cb9 100644 --- a/test/langtools/tools/javac/switchexpr/ParseIncomplete.java +++ b/test/langtools/tools/javac/switchexpr/ParseIncomplete.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -61,13 +61,14 @@ public class ParseIncomplete { final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); assert tool != null; DiagnosticListener noErrors = d -> {}; + String sourceVersion = Integer.toString(Runtime.version().feature()); for (int i = 0; i < CODE.length(); i++) { String code = CODE.substring(0, i + 1); StringWriter out = new StringWriter(); try { JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors, - List.of("-XDdev", "--enable-preview", "-source", "13"), null, + List.of("-XDdev", "--enable-preview", "-source", sourceVersion), null, Arrays.asList(new MyFileObject(code))); ct.parse().iterator().next(); } catch (Throwable t) { diff --git a/test/langtools/tools/javac/switchexpr/ParserRecovery.java b/test/langtools/tools/javac/switchexpr/ParserRecovery.java index 7c197c288b8..f3f657a5006 100644 --- a/test/langtools/tools/javac/switchexpr/ParserRecovery.java +++ b/test/langtools/tools/javac/switchexpr/ParserRecovery.java @@ -2,7 +2,7 @@ * @test /nodynamiccopyright/ * @bug 8206986 * @summary Verify the parser handles broken input gracefully. - * @compile/fail/ref=ParserRecovery.out -XDrawDiagnostics --enable-preview -source 13 ParserRecovery.java + * @compile/fail/ref=ParserRecovery.out -XDrawDiagnostics --enable-preview -source ${jdk.version} ParserRecovery.java */ public class ParserRecovery { diff --git a/test/langtools/tools/javac/switchexpr/SwitchExpressionIsNotAConstant.java b/test/langtools/tools/javac/switchexpr/SwitchExpressionIsNotAConstant.java index 1cae5e7ade9..b2ec637ba42 100644 --- a/test/langtools/tools/javac/switchexpr/SwitchExpressionIsNotAConstant.java +++ b/test/langtools/tools/javac/switchexpr/SwitchExpressionIsNotAConstant.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -26,7 +26,7 @@ * @bug 8214113 * @summary Verify the switch expression's type does not have a constant attached, * and so the switch expression is not elided. - * @compile --enable-preview --source 13 SwitchExpressionIsNotAConstant.java + * @compile --enable-preview --source ${jdk.version} SwitchExpressionIsNotAConstant.java * @run main/othervm --enable-preview SwitchExpressionIsNotAConstant */ public class SwitchExpressionIsNotAConstant { diff --git a/test/langtools/tools/javac/switchexpr/SwitchExpressionScopesIsolated.java b/test/langtools/tools/javac/switchexpr/SwitchExpressionScopesIsolated.java index 295a1dc9119..66d842e3f6e 100644 --- a/test/langtools/tools/javac/switchexpr/SwitchExpressionScopesIsolated.java +++ b/test/langtools/tools/javac/switchexpr/SwitchExpressionScopesIsolated.java @@ -2,7 +2,7 @@ * @test /nodynamiccopyright/ * @bug 8206986 * @summary Verify that scopes in rule cases are isolated. - * @compile/fail/ref=SwitchExpressionScopesIsolated.out -XDrawDiagnostics --enable-preview -source 13 SwitchExpressionScopesIsolated.java + * @compile/fail/ref=SwitchExpressionScopesIsolated.out -XDrawDiagnostics --enable-preview -source ${jdk.version} SwitchExpressionScopesIsolated.java */ public class SwitchExpressionScopesIsolated { diff --git a/test/langtools/tools/javac/switchexpr/SwitchExpressionSimpleVisitorTest.java b/test/langtools/tools/javac/switchexpr/SwitchExpressionSimpleVisitorTest.java index 4df450874c6..116c59297bb 100644 --- a/test/langtools/tools/javac/switchexpr/SwitchExpressionSimpleVisitorTest.java +++ b/test/langtools/tools/javac/switchexpr/SwitchExpressionSimpleVisitorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -89,7 +89,7 @@ public class SwitchExpressionSimpleVisitorTest { StringWriter out = new StringWriter(); JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors, - List.of("--enable-preview", "-source", "13"), null, + List.of("--enable-preview", "-source", Integer.toString(Runtime.version().feature())), null, Arrays.asList(new MyFileObject(code))); return ct.parse().iterator().next(); } diff --git a/test/langtools/tools/javac/switchexpr/TryCatch.java b/test/langtools/tools/javac/switchexpr/TryCatch.java index 768292b3b5d..cc8aadf5998 100644 --- a/test/langtools/tools/javac/switchexpr/TryCatch.java +++ b/test/langtools/tools/javac/switchexpr/TryCatch.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,7 +25,7 @@ * @test * @bug 8214114 * @summary Verify try-catch inside a switch expression works properly. - * @compile --enable-preview -source 13 TryCatch.java + * @compile --enable-preview -source ${jdk.version} TryCatch.java * @run main/othervm --enable-preview TryCatch */ public class TryCatch { diff --git a/test/langtools/tools/javac/switchextra/CaseTest.java b/test/langtools/tools/javac/switchextra/CaseTest.java index 99315e79213..b678582c25d 100644 --- a/test/langtools/tools/javac/switchextra/CaseTest.java +++ b/test/langtools/tools/javac/switchextra/CaseTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,12 +47,13 @@ import com.sun.source.util.TreePathScanner; public class CaseTest { public static void main(String[] args) throws Exception { - new CaseTest().testLabels(); - new CaseTest().testStatement(); - new CaseTest().testRule(); + String sourceVersion = Integer.toString(Runtime.version().feature()); + new CaseTest().testLabels(sourceVersion); + new CaseTest().testStatement(sourceVersion); + new CaseTest().testRule(sourceVersion); } - void testLabels() throws Exception { + void testLabels(String sourceVersion) throws Exception { String code = "class Test {\n" + " void t(int i) {\n" + " switch(i) {\n" + @@ -72,7 +73,7 @@ public class CaseTest { .collect(Collectors.joining(",", "[", "]"))); return super.visitCase(node, p); } - }.scan(parse(code), null); + }.scan(parse(code, sourceVersion), null); List expected = Arrays.asList("0", "[0]", "1", "[1,2]", "null", "[]"); @@ -81,7 +82,7 @@ public class CaseTest { } } - void testStatement() throws Exception { + void testStatement(String sourceVersion) throws Exception { String code = "class Test {\n" + " void t(int i) {\n" + " switch(i) {\n" + @@ -102,10 +103,10 @@ public class CaseTest { } return super.visitCase(node, p); } - }.scan(parse(code), null); + }.scan(parse(code, sourceVersion), null); } - void testRule() throws Exception { + void testRule(String sourceVersion) throws Exception { String code = "class Test {\n" + " void t(int i) {\n" + " switch(i) {\n" + @@ -126,17 +127,17 @@ public class CaseTest { } return super.visitCase(node, p); } - }.scan(parse(code), null); + }.scan(parse(code, sourceVersion), null); } - private CompilationUnitTree parse(String code) throws IOException { + private CompilationUnitTree parse(String code, String sourceVersion) throws IOException { final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); assert tool != null; DiagnosticListener noErrors = d -> {}; StringWriter out = new StringWriter(); JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors, - List.of("-XDdev", "--enable-preview", "-source", "13"), null, + List.of("-XDdev", "--enable-preview", "-source", sourceVersion), null, Arrays.asList(new MyFileObject(code))); return ct.parse().iterator().next(); } diff --git a/test/langtools/tools/javac/switchextra/MultipleLabelsExpression.java b/test/langtools/tools/javac/switchextra/MultipleLabelsExpression.java index 170da1b3375..9a57143c10d 100644 --- a/test/langtools/tools/javac/switchextra/MultipleLabelsExpression.java +++ b/test/langtools/tools/javac/switchextra/MultipleLabelsExpression.java @@ -3,7 +3,7 @@ * @bug 8206986 * @summary Verify cases with multiple labels work properly. * @compile/fail/ref=MultipleLabelsExpression-old.out -source 9 -Xlint:-options -XDrawDiagnostics MultipleLabelsExpression.java - * @compile --enable-preview -source 13 MultipleLabelsExpression.java + * @compile --enable-preview -source ${jdk.version} MultipleLabelsExpression.java * @run main/othervm --enable-preview MultipleLabelsExpression */ diff --git a/test/langtools/tools/javac/switchextra/MultipleLabelsStatement.java b/test/langtools/tools/javac/switchextra/MultipleLabelsStatement.java index b674e92b960..9477baa7579 100644 --- a/test/langtools/tools/javac/switchextra/MultipleLabelsStatement.java +++ b/test/langtools/tools/javac/switchextra/MultipleLabelsStatement.java @@ -3,7 +3,7 @@ * @bug 8206986 * @summary Verify cases with multiple labels work properly. * @compile/fail/ref=MultipleLabelsStatement-old.out -source 9 -Xlint:-options -XDrawDiagnostics MultipleLabelsStatement.java - * @compile --enable-preview -source 13 MultipleLabelsStatement.java + * @compile --enable-preview -source ${jdk.version} MultipleLabelsStatement.java * @run main/othervm --enable-preview MultipleLabelsStatement */ diff --git a/test/langtools/tools/javac/switchextra/RuleParsingTest.java b/test/langtools/tools/javac/switchextra/RuleParsingTest.java index afdaa929edc..affda29ba04 100644 --- a/test/langtools/tools/javac/switchextra/RuleParsingTest.java +++ b/test/langtools/tools/javac/switchextra/RuleParsingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,10 +48,11 @@ import com.sun.source.util.Trees; public class RuleParsingTest { public static void main(String[] args) throws Exception { - new RuleParsingTest().testParseComplexExpressions(); + String sourceVersion = Integer.toString(Runtime.version().feature()); + new RuleParsingTest().testParseComplexExpressions(sourceVersion); } - void testParseComplexExpressions() throws Exception { + void testParseComplexExpressions(String sourceVersion) throws Exception { String[] expressions = { "(a)", "a", @@ -94,7 +95,7 @@ public class RuleParsingTest { StringWriter out = new StringWriter(); JavacTask ct = (JavacTask) tool.getTask(out, null, noErrors, - List.of("--enable-preview", "-source", "13"), null, + List.of("--enable-preview", "-source", sourceVersion), null, Arrays.asList(new MyFileObject(code.toString()))); CompilationUnitTree cut = ct.parse().iterator().next(); Trees trees = Trees.instance(ct); diff --git a/test/langtools/tools/javac/switchextra/SwitchArrowBrokenConstant.java b/test/langtools/tools/javac/switchextra/SwitchArrowBrokenConstant.java index e1cec5ac34d..c8beda59080 100644 --- a/test/langtools/tools/javac/switchextra/SwitchArrowBrokenConstant.java +++ b/test/langtools/tools/javac/switchextra/SwitchArrowBrokenConstant.java @@ -3,7 +3,7 @@ * @bug 8206986 * @summary Verify reasonable errors are produced when neither ':' nor '->' * is found are the expression of a case - * @compile/fail/ref=SwitchArrowBrokenConstant.out -source 13 --enable-preview -Xlint:-preview -XDrawDiagnostics SwitchArrowBrokenConstant.java + * @compile/fail/ref=SwitchArrowBrokenConstant.out -source ${jdk.version} --enable-preview -Xlint:-preview -XDrawDiagnostics SwitchArrowBrokenConstant.java */ public class SwitchArrowBrokenConstant { diff --git a/test/langtools/tools/javac/switchextra/SwitchStatementArrow.java b/test/langtools/tools/javac/switchextra/SwitchStatementArrow.java index 599adacc97f..f8fd3092ab1 100644 --- a/test/langtools/tools/javac/switchextra/SwitchStatementArrow.java +++ b/test/langtools/tools/javac/switchextra/SwitchStatementArrow.java @@ -3,7 +3,7 @@ * @bug 8206986 * @summary Verify rule cases work properly. * @compile/fail/ref=SwitchStatementArrow-old.out -source 9 -Xlint:-options -XDrawDiagnostics SwitchStatementArrow.java - * @compile --enable-preview -source 13 SwitchStatementArrow.java + * @compile --enable-preview -source ${jdk.version} SwitchStatementArrow.java * @run main/othervm --enable-preview SwitchStatementArrow */ diff --git a/test/langtools/tools/javac/switchextra/SwitchStatementBroken.java b/test/langtools/tools/javac/switchextra/SwitchStatementBroken.java index 6882c2d0e1e..d9ef86150e8 100644 --- a/test/langtools/tools/javac/switchextra/SwitchStatementBroken.java +++ b/test/langtools/tools/javac/switchextra/SwitchStatementBroken.java @@ -2,7 +2,7 @@ * @test /nodynamiccopyright/ * @bug 8206986 * @summary Verify that rule and ordinary cases cannot be mixed. - * @compile/fail/ref=SwitchStatementBroken.out -XDrawDiagnostics --enable-preview -source 13 SwitchStatementBroken.java + * @compile/fail/ref=SwitchStatementBroken.out -XDrawDiagnostics --enable-preview -source ${jdk.version} SwitchStatementBroken.java */ public class SwitchStatementBroken { diff --git a/test/langtools/tools/javac/switchextra/SwitchStatementBroken2.java b/test/langtools/tools/javac/switchextra/SwitchStatementBroken2.java index 8bb6bc018ef..2af02092254 100644 --- a/test/langtools/tools/javac/switchextra/SwitchStatementBroken2.java +++ b/test/langtools/tools/javac/switchextra/SwitchStatementBroken2.java @@ -2,7 +2,7 @@ * @test /nodynamiccopyright/ * @bug 8206986 * @summary Verify that not allowed types of statements cannot be used in rule case. - * @compile/fail/ref=SwitchStatementBroken2.out -XDrawDiagnostics --enable-preview -source 13 SwitchStatementBroken2.java + * @compile/fail/ref=SwitchStatementBroken2.out -XDrawDiagnostics --enable-preview -source ${jdk.version} SwitchStatementBroken2.java */ public class SwitchStatementBroken2 { diff --git a/test/langtools/tools/javac/switchextra/SwitchStatementScopesIsolated.java b/test/langtools/tools/javac/switchextra/SwitchStatementScopesIsolated.java index 896a4d9ca3b..88036c524d4 100644 --- a/test/langtools/tools/javac/switchextra/SwitchStatementScopesIsolated.java +++ b/test/langtools/tools/javac/switchextra/SwitchStatementScopesIsolated.java @@ -2,7 +2,7 @@ * @test /nodynamiccopyright/ * @bug 8206986 * @summary Verify that scopes in rule cases are isolated. - * @compile/fail/ref=SwitchStatementScopesIsolated.out -XDrawDiagnostics --enable-preview -source 13 SwitchStatementScopesIsolated.java + * @compile/fail/ref=SwitchStatementScopesIsolated.out -XDrawDiagnostics --enable-preview -source ${jdk.version} SwitchStatementScopesIsolated.java */ public class SwitchStatementScopesIsolated { From fa0093dc2c050d370889e83835e9ba20907307fb Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Thu, 21 Feb 2019 14:03:57 -0800 Subject: [PATCH 070/109] 8215307: Pages do not have

    Reviewed-by: hannesw --- .../formats/html/AbstractIndexWriter.java | 6 +- .../formats/html/AbstractMemberWriter.java | 16 +-- .../html/AbstractModuleIndexWriter.java | 5 +- .../html/AbstractPackageIndexWriter.java | 3 +- .../formats/html/AbstractTreeWriter.java | 5 +- .../formats/html/AllClassesFrameWriter.java | 3 +- .../formats/html/AllClassesIndexWriter.java | 3 +- .../formats/html/AllPackagesIndexWriter.java | 3 +- .../html/AnnotationTypeFieldWriterImpl.java | 13 +- ...nnotationTypeOptionalMemberWriterImpl.java | 8 +- ...nnotationTypeRequiredMemberWriterImpl.java | 14 +- .../html/AnnotationTypeWriterImpl.java | 7 +- .../doclets/formats/html/ClassUseWriter.java | 5 +- .../doclets/formats/html/ClassWriterImpl.java | 7 +- .../html/ConstantsSummaryWriterImpl.java | 7 +- .../formats/html/ConstructorWriterImpl.java | 13 +- .../formats/html/DeprecatedListWriter.java | 5 +- .../formats/html/EnumConstantWriterImpl.java | 14 +- .../doclets/formats/html/FieldWriterImpl.java | 16 +-- .../doclets/formats/html/Headings.java | 134 ++++++++++++++++++ .../doclets/formats/html/HelpWriter.java | 31 ++-- .../formats/html/HtmlConfiguration.java | 11 +- .../formats/html/HtmlSerialFieldWriter.java | 10 +- .../formats/html/HtmlSerialMethodWriter.java | 10 +- ...HtmlConstants.java => MarkerComments.java} | 116 ++++----------- .../formats/html/MethodWriterImpl.java | 15 +- .../formats/html/ModuleFrameWriter.java | 5 +- .../formats/html/ModuleIndexFrameWriter.java | 25 ++-- .../html/ModulePackageIndexFrameWriter.java | 27 ++-- .../formats/html/ModuleWriterImpl.java | 13 +- .../formats/html/NestedClassWriterImpl.java | 11 +- .../formats/html/PackageFrameWriter.java | 5 +- .../formats/html/PackageIndexFrameWriter.java | 5 +- .../formats/html/PackageTreeWriter.java | 3 +- .../formats/html/PackageUseWriter.java | 3 +- .../formats/html/PackageWriterImpl.java | 3 +- .../formats/html/PropertyWriterImpl.java | 15 +- .../html/SerializedFormWriterImpl.java | 10 +- .../doclets/formats/html/TreeWriter.java | 3 +- .../formats/html/markup/Navigation.java | 7 +- .../builders/SerializedFormBuilder.java | 6 +- .../doclets/toolkit/resources/stylesheet.css | 22 ++- .../TestAnnotationTypes.java | 8 +- .../doclet/testHeadings/TestHeadings.java | 21 +-- .../doclet/testHiddenTag/TestHiddenTag.java | 4 +- .../jdk/javadoc/doclet/testHref/TestHref.java | 2 +- .../TestHtmlLandmarkRegions.java | 12 +- .../testHtmlVersion/TestHtmlVersion.java | 84 +++++------ .../testIndexTaglet/TestIndexTaglet.java | 6 +- .../doclet/testInterface/TestInterface.java | 8 +- .../javadoc/doclet/testJavaFX/TestJavaFX.java | 32 ++--- .../testModules/TestModuleServices.java | 14 +- .../doclet/testModules/TestModules.java | 2 +- .../TestNewLanguageFeatures.java | 6 +- .../doclet/testOptions/TestOptions.java | 4 +- .../doclet/testOrdering/TestOrdering.java | 90 ++++++------ .../TestBadOverride.java | 4 +- .../TestSerializedForm.java | 12 +- .../TestSummaryHeading.java | 4 +- .../doclet/testSummaryTag/TestSummaryTag.java | 2 +- .../TestSystemPropertyTaglet.java | 6 +- .../lib/javadoc/tester/JavadocTester.java | 79 ++++++++--- .../lib/javadoc/tester/ShowHeadings.java | 102 +++++++++++++ 63 files changed, 660 insertions(+), 485 deletions(-) create mode 100644 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Headings.java rename src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/{markup/HtmlConstants.java => MarkerComments.java} (62%) create mode 100644 test/langtools/jdk/javadoc/lib/javadoc/tester/ShowHeadings.java diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java index 56e6c83aa3e..4af3df20a79 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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,7 +30,6 @@ import java.util.*; import java.util.zip.*; import javax.lang.model.element.Element; -import javax.lang.model.element.ElementKind; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.ModuleElement; import javax.lang.model.element.PackageElement; @@ -38,7 +37,6 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.util.SimpleElementVisitor9; import com.sun.source.doctree.DocTree; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -170,7 +168,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter { String unicode = uc.toString(); contentTree.addContent(getMarkerAnchorForIndex(unicode)); Content headContent = new StringContent(unicode); - Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, false, + Content heading = HtmlTree.HEADING(Headings.CONTENT_HEADING, false, HtmlStyle.title, headContent); contentTree.addContent(heading); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java index c57408a5fdd..2d0025ee808 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,12 +40,10 @@ import javax.lang.model.type.TypeMirror; import com.sun.source.doctree.DocTree; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; import jdk.javadoc.internal.doclets.formats.html.markup.Links; -import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter; import jdk.javadoc.internal.doclets.toolkit.Resources; @@ -375,18 +373,6 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter { return utils.getSimpleName(member); } - /** - * Get the header for the section. - * - * @param member the member being documented. - * @return a header content for the section. - */ - protected Content getHead(Element member) { - Content memberContent = new StringContent(name(member)); - Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, memberContent); - return heading; - } - /** * Return true if the given ProgramElement is inherited * by the class that is being documented. diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java index 794d7ceb5f4..7927c4805ed 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java @@ -33,7 +33,6 @@ import java.util.SortedMap; import javax.lang.model.element.ModuleElement; import javax.lang.model.element.PackageElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -224,7 +223,7 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter { * @param modules the modules to be documented * @param text string which will be used as the heading * @param tableSummary summary for the table - * @param header the document tree to which the navgational links will be added + * @param header the document tree to which the navigational links will be added * @param main the document tree to which the modules list will be added */ protected void addIndexContents(Collection modules, String text, @@ -270,7 +269,7 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter { protected void addConfigurationTitle(Content body) { if (configuration.doctitle.length() > 0) { Content title = new RawHtml(configuration.doctitle); - Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, HtmlStyle.title, title); Content div = HtmlTree.DIV(HtmlStyle.header, heading); body.addContent(div); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java index 7ffd97c38dc..cc254f57c3c 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java @@ -29,7 +29,6 @@ import java.util.*; import javax.lang.model.element.PackageElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -180,7 +179,7 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter { protected void addConfigurationTitle(Content body) { if (configuration.doctitle.length() > 0) { Content title = new RawHtml(configuration.doctitle); - Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, HtmlStyle.title, title); Content div = HtmlTree.DIV(HtmlStyle.header, heading); body.addContent(div); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java index fd310241a10..82009fea847 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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,6 @@ import java.util.*; import javax.lang.model.element.TypeElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -117,7 +116,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter { if (!sset.isEmpty()) { TypeElement firstTypeElement = sset.first(); Content headingContent = contents.getContent(heading); - Content sectionHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true, + Content sectionHeading = HtmlTree.HEADING(Headings.CONTENT_HEADING, true, headingContent); HtmlTree htmlTree = HtmlTree.SECTION(sectionHeading); addLevelInfo(!utils.isInterface(firstTypeElement) ? firstTypeElement : null, diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java index 2f4a3914448..86931ef0010 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java @@ -29,7 +29,6 @@ package jdk.javadoc.internal.doclets.formats.html; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -112,7 +111,7 @@ public class AllClassesFrameWriter extends HtmlDocletWriter { String label = resources.getText("doclet.All_Classes"); Content body = getBody(false, getWindowTitle(label)); Content htmlTree = HtmlTree.MAIN(); - Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, HtmlStyle.bar, contents.allClassesLabel); htmlTree.addContent(heading); Content ul = new HtmlTree(HtmlTag.UL); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java index 3d5ba0dbbc0..906073e7e95 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java @@ -32,7 +32,6 @@ import javax.lang.model.element.TypeElement; import com.sun.source.doctree.DocTree; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -148,7 +147,7 @@ public class AllClassesIndexWriter extends HtmlDocletWriter { } } Content titleContent = contents.allClassesLabel; - Content pHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, + Content pHeading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, HtmlStyle.title, titleContent); Content headerDiv = HtmlTree.DIV(HtmlStyle.header, pHeading); content.addContent(headerDiv); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java index d07013c6d2d..545dd7475b4 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java @@ -27,7 +27,6 @@ package jdk.javadoc.internal.doclets.formats.html; import javax.lang.model.element.PackageElement; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -94,7 +93,7 @@ public class AllPackagesIndexWriter extends HtmlDocletWriter { div.setStyle(HtmlStyle.allPackagesContainer); addPackages(div); Content titleContent = contents.allPackagesLabel; - Content pHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, + Content pHeading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, HtmlStyle.title, titleContent); Content headerDiv = HtmlTree.DIV(HtmlStyle.header, pHeading); mainTree.addContent(headerDiv); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java index db13176dd3a..4a219105603 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, 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 @@ -33,7 +33,6 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeMirror; import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -72,7 +71,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { memberSummaryTree.addContent( - HtmlConstants.START_OF_ANNOTATION_TYPE_FIELD_SUMMARY); + MarkerComments.START_OF_ANNOTATION_TYPE_FIELD_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -96,7 +95,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter * {@inheritDoc} */ public void addAnnotationFieldDetailsMarker(Content memberDetails) { - memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_FIELD_DETAILS); + memberDetails.addContent(MarkerComments.START_OF_ANNOTATION_TYPE_FIELD_DETAILS); } /** @@ -107,7 +106,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter if (!writer.printedAnnotationFieldHeading) { memberDetailsTree.addContent(links.createAnchor( SectionName.ANNOTATION_TYPE_FIELD_DETAIL)); - Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, + Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, contents.fieldDetailsLabel); memberDetailsTree.addContent(heading); writer.printedAnnotationFieldHeading = true; @@ -121,7 +120,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter Content annotationDetailsTree) { annotationDetailsTree.addContent(links.createAnchor(name(member))); Content annotationDocTree = writer.getMemberTreeHeader(); - Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); + Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); heading.addContent(name(member)); annotationDocTree.addContent(heading); return annotationDocTree; @@ -188,7 +187,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter * {@inheritDoc} */ public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, contents.fieldSummaryLabel); memberTree.addContent(label); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java index a324361b0df..a91f0fbc32f 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -33,9 +33,7 @@ import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; -import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeOptionalMemberWriter; import jdk.javadoc.internal.doclets.toolkit.Content; @@ -75,7 +73,7 @@ public class AnnotationTypeOptionalMemberWriterImpl extends public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { memberSummaryTree.addContent( - HtmlConstants.START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY); + MarkerComments.START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -112,7 +110,7 @@ public class AnnotationTypeOptionalMemberWriterImpl extends */ @Override public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, contents.annotateTypeOptionalMemberSummaryLabel); memberTree.addContent(label); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java index dc0955391cd..2c23eba047e 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -33,11 +33,9 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeMirror; import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; -import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeRequiredMemberWriter; import jdk.javadoc.internal.doclets.toolkit.Content; @@ -75,7 +73,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { memberSummaryTree.addContent( - HtmlConstants.START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY); + MarkerComments.START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -99,7 +97,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter * {@inheritDoc} */ public void addAnnotationDetailsMarker(Content memberDetails) { - memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_DETAILS); + memberDetails.addContent(MarkerComments.START_OF_ANNOTATION_TYPE_DETAILS); } /** @@ -110,7 +108,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter if (!writer.printedAnnotationHeading) { memberDetailsTree.addContent(links.createAnchor( SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL)); - Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, + Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, contents.annotationTypeDetailsLabel); memberDetailsTree.addContent(heading); writer.printedAnnotationHeading = true; @@ -126,7 +124,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter annotationDetailsTree.addContent(links.createAnchor( simpleName + utils.signature((ExecutableElement) member))); Content annotationDocTree = writer.getMemberTreeHeader(); - Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); + Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); heading.addContent(simpleName); annotationDocTree.addContent(heading); return annotationDocTree; @@ -193,7 +191,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter * {@inheritDoc} */ public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, contents.annotateTypeRequiredMemberSummaryLabel); memberTree.addContent(label); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java index c69d76d5f23..ef68b8b194b 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java @@ -32,7 +32,6 @@ import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import com.sun.source.doctree.DocTree; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -95,7 +94,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter navBar.setUserHeader(getUserHeaderFooter(true)); htmlTree.addContent(navBar.getContent(true)); bodyTree.addContent(htmlTree); - bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA); + bodyTree.addContent(MarkerComments.START_OF_CLASS_DATA); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.setStyle(HtmlStyle.header); if (configuration.showModules) { @@ -118,7 +117,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_HEADER, annotationType); Content headerContent = new StringContent(header); - Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true, + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, HtmlStyle.title, headerContent); heading.addContent(getTypeParameterLinks(linkInfo)); div.addContent(heading); @@ -139,7 +138,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter */ @Override public void addFooter(Content contentTree) { - contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA); + contentTree.addContent(MarkerComments.END_OF_CLASS_DATA); Content htmlTree = HtmlTree.FOOTER(); navBar.setUserFooter(getUserHeaderFooter(false)); htmlTree.addContent(navBar.getContent(false)); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java index 42624d22891..655edfe5167 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java @@ -42,7 +42,6 @@ import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -325,7 +324,7 @@ public class ClassUseWriter extends SubWriterHolderWriter { getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement)), getPackageLink(pkg, utils.getPackageName(pkg))); - Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link); + Content heading = HtmlTree.HEADING(Headings.TypeUse.SUMMARY_HEADING, link); htmlTree.addContent(heading); addClassUse(pkg, htmlTree); ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree)); @@ -452,7 +451,7 @@ public class ClassUseWriter extends SubWriterHolderWriter { headContent.addContent(contents.getContent("doclet.ClassUse_Title", cltype)); headContent.addContent(new HtmlTree(HtmlTag.BR)); headContent.addContent(clname); - Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, HtmlStyle.title, headContent); Content div = HtmlTree.DIV(HtmlStyle.header, heading); mainTree.addContent(div); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java index 917d96a1815..3ed401ae47a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java @@ -36,7 +36,6 @@ import javax.lang.model.type.TypeMirror; import javax.lang.model.util.SimpleElementVisitor8; import com.sun.source.doctree.DocTree; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -116,7 +115,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite navBar.setUserHeader(getUserHeaderFooter(true)); htmlTree.addContent(navBar.getContent(true)); bodyTree.addContent(htmlTree); - bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA); + bodyTree.addContent(MarkerComments.START_OF_CLASS_DATA); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.setStyle(HtmlStyle.header); if (configuration.showModules) { @@ -143,7 +142,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite //Let's not link to ourselves in the header. linkInfo.linkToSelf = false; Content headerContent = new StringContent(header); - Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true, + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, HtmlStyle.title, headerContent); heading.addContent(getTypeParameterLinks(linkInfo)); div.addContent(heading); @@ -164,7 +163,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite */ @Override public void addFooter(Content contentTree) { - contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA); + contentTree.addContent(MarkerComments.END_OF_CLASS_DATA); Content htmlTree = HtmlTree.FOOTER(); navBar.setUserFooter(getUserHeaderFooter(false)); htmlTree.addContent(navBar.getContent(false)); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java index b0c08ee17f8..3c381de5f5d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java @@ -36,7 +36,6 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -152,11 +151,11 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons @Override public void addContentsList(Content contentTree, Content contentListTree) { Content titleContent = contents.constantsSummaryTitle; - Content pHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, + Content pHeading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, HtmlStyle.title, titleContent); Content div = HtmlTree.DIV(HtmlStyle.header, pHeading); Content headingContent = contents.contentsHeading; - Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true, + Content heading = HtmlTree.HEADING(Headings.CONTENT_HEADING, true, headingContent); HtmlTree section = HtmlTree.SECTION(heading); section.addContent(contentListTree); @@ -192,7 +191,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons pkgNameContent = getPackageLabel(parsedPackageName); } Content headingContent = new StringContent(".*"); - Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, + Content heading = HtmlTree.HEADING(Headings.ConstantsSummary.PACKAGE_HEADING, true, pkgNameContent); heading.addContent(headingContent); summaryTree = HtmlTree.SECTION(heading); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java index de70a890dec..f55d78b2acc 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -34,7 +34,6 @@ import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -98,7 +97,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter @Override public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { - memberSummaryTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_SUMMARY); + memberSummaryTree.addContent(MarkerComments.START_OF_CONSTRUCTOR_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -118,11 +117,11 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter @Override public Content getConstructorDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) { - memberDetailsTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_DETAILS); + memberDetailsTree.addContent(MarkerComments.START_OF_CONSTRUCTOR_DETAILS); Content constructorDetailsTree = writer.getMemberTreeHeader(); constructorDetailsTree.addContent(links.createAnchor( SectionName.CONSTRUCTOR_DETAIL)); - Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, + Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, contents.constructorDetailsLabel); constructorDetailsTree.addContent(heading); return constructorDetailsTree; @@ -140,7 +139,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter } constructorDetailsTree.addContent(links.createAnchor(writer.getAnchor(constructor))); Content constructorDocTree = writer.getMemberTreeHeader(); - Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); + Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); heading.addContent(name(constructor)); constructorDocTree.addContent(heading); return constructorDocTree; @@ -223,7 +222,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter */ @Override public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, contents.constructorSummaryLabel); memberTree.addContent(label); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java index 14ad271c9b3..e951fcd3961 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java @@ -38,7 +38,6 @@ import javax.lang.model.element.PackageElement; import com.sun.source.doctree.DocTree; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -336,11 +335,11 @@ public class DeprecatedListWriter extends SubWriterHolderWriter { */ public Content getContentsList(DeprecatedAPIListBuilder deprapi) { Content headContent = contents.deprecatedAPI; - Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, HtmlStyle.title, headContent); Content div = HtmlTree.DIV(HtmlStyle.header, heading); Content headingContent = contents.contentsHeading; - div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true, + div.addContent(HtmlTree.HEADING(Headings.CONTENT_HEADING, true, headingContent)); Content ul = new HtmlTree(HtmlTag.UL); for (DeprElementKind kind : DeprElementKind.values()) { diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java index 0993f81e512..2affe50e362 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -33,11 +33,9 @@ import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; -import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.EnumConstantWriter; @@ -71,7 +69,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter @Override public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { - memberSummaryTree.addContent(HtmlConstants.START_OF_ENUM_CONSTANT_SUMMARY); + memberSummaryTree.addContent(MarkerComments.START_OF_ENUM_CONSTANT_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -91,11 +89,11 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter @Override public Content getEnumConstantsDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) { - memberDetailsTree.addContent(HtmlConstants.START_OF_ENUM_CONSTANT_DETAILS); + memberDetailsTree.addContent(MarkerComments.START_OF_ENUM_CONSTANT_DETAILS); Content enumConstantsDetailsTree = writer.getMemberTreeHeader(); enumConstantsDetailsTree.addContent(links.createAnchor( SectionName.ENUM_CONSTANT_DETAIL)); - Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, + Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, contents.enumConstantDetailLabel); enumConstantsDetailsTree.addContent(heading); return enumConstantsDetailsTree; @@ -109,7 +107,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter Content enumConstantsDetailsTree) { enumConstantsDetailsTree.addContent(links.createAnchor(name(enumConstant))); Content enumConstantsTree = writer.getMemberTreeHeader(); - Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); + Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); heading.addContent(name(enumConstant)); enumConstantsTree.addContent(heading); return enumConstantsTree; @@ -182,7 +180,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter */ @Override public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, contents.enumConstantSummary); memberTree.addContent(label); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java index 36f777c7854..c6e337d7f62 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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,11 +35,9 @@ import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; -import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.FieldWriter; @@ -75,7 +73,7 @@ public class FieldWriterImpl extends AbstractMemberWriter @Override public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { - memberSummaryTree.addContent(HtmlConstants.START_OF_FIELD_SUMMARY); + memberSummaryTree.addContent(MarkerComments.START_OF_FIELD_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -94,11 +92,11 @@ public class FieldWriterImpl extends AbstractMemberWriter */ @Override public Content getFieldDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) { - memberDetailsTree.addContent(HtmlConstants.START_OF_FIELD_DETAILS); + memberDetailsTree.addContent(MarkerComments.START_OF_FIELD_DETAILS); Content fieldDetailsTree = writer.getMemberTreeHeader(); fieldDetailsTree.addContent(links.createAnchor( SectionName.FIELD_DETAIL)); - Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, + Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, contents.fieldDetailsLabel); fieldDetailsTree.addContent(heading); return fieldDetailsTree; @@ -111,7 +109,7 @@ public class FieldWriterImpl extends AbstractMemberWriter public Content getFieldDocTreeHeader(VariableElement field, Content fieldDetailsTree) { fieldDetailsTree.addContent(links.createAnchor(name(field))); Content fieldTree = writer.getMemberTreeHeader(); - Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); + Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); heading.addContent(name(field)); fieldTree.addContent(heading); return fieldTree; @@ -186,7 +184,7 @@ public class FieldWriterImpl extends AbstractMemberWriter */ @Override public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, contents.fieldSummaryLabel); memberTree.addContent(label); } @@ -247,7 +245,7 @@ public class FieldWriterImpl extends AbstractMemberWriter ? resources.getText("doclet.Fields_Inherited_From_Class") : resources.getText("doclet.Fields_Inherited_From_Interface")); } - Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING, + Content labelHeading = HtmlTree.HEADING(Headings.TypeDeclaration.INHERITED_SUMMARY_HEADING, label); labelHeading.addContent(Contents.SPACE); labelHeading.addContent(classLink); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Headings.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Headings.java new file mode 100644 index 00000000000..8190ca47b26 --- /dev/null +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Headings.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 1998, 2019, 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 jdk.javadoc.internal.doclets.formats.html; + +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; + +/** + * Aliases for HTML heading tags (H1..H6) for different kinds of pages. + * + *

    This is NOT part of any supported API. + * If you write code that depends on this, you do so at your own risk. + * This code and its internal interfaces are subject to change or + * deletion without notice. + */ +class Headings { + /** + * Standard top-level heading for the page title for all pages. + */ + static final HtmlTag PAGE_TITLE_HEADING = HtmlTag.H1; + + /** + * Standard second-level heading for sundry pages that do + * not have their own page group. + */ + static final HtmlTag CONTENT_HEADING = HtmlTag.H2; + + /** + * Headings for the page for a module declaration. + */ + static class ModuleDeclaration { + static final HtmlTag SUMMARY_HEADING = HtmlTag.H2; + } + + /** + * Headings for the page for a type declaration. + * This includes classes, interfaces, enums and annotation types. + */ + static class TypeDeclaration { + /** + * Heading for the different summary lists: + * Field Summary, Constructor Summary, Method Summary, etc. + */ + static final HtmlTag SUMMARY_HEADING = HtmlTag.H2; + + /** + * Subheading within a summary for the inherited elements: + * inherited methods, etc + */ + static final HtmlTag INHERITED_SUMMARY_HEADING = HtmlTag.H3; + + /** + * Heading for the different detail lists: + * Field Details, Constructor Details, Method Details, etc. + */ + static final HtmlTag DETAILS_HEADING = HtmlTag.H2; + + /** + * Subheading with a Details list for an individual element. + */ + static final HtmlTag MEMBER_HEADING = HtmlTag.H3; + } + + /** + * Headings for the Constants Summary page. + */ + static class ConstantsSummary { + static final HtmlTag PACKAGE_HEADING = HtmlTag.H2; + } + + /** + * Headings for the Serialized Form page. + */ + static class SerializedForm { + /** + * Heading for the package name, preceding a list of types. + */ + static final HtmlTag PACKAGE_HEADING = HtmlTag.H2; + + /** + * Heading for a type name within a package. + */ + static final HtmlTag CLASS_HEADING = HtmlTag.H3; + + /** + * Subheading for info within a type. + */ + static final HtmlTag CLASS_SUBHEADING = HtmlTag.H4; + + /** + * Heading for an individual member element within a type. + */ + static final HtmlTag MEMBER_HEADING = HtmlTag.H5; + } + + /** + * Headings for a type Use page. + */ + static class TypeUse { + static final HtmlTag SUMMARY_HEADING = HtmlTag.H2; + } + + /** + * Headings for index frames pages. + */ + static class IndexFrames { + /** Heading for a list of module names in an index frame. */ + static final HtmlTag MODULE_HEADING = HtmlTag.H2; + /** Heading for a list of package names in an index frame. */ + static final HtmlTag PACKAGE_HEADING = HtmlTag.H2; + } +} diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java index 9ce70ff5d13..07c43f13540 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java @@ -25,7 +25,6 @@ package jdk.javadoc.internal.doclets.formats.html; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -113,7 +112,7 @@ public class HelpWriter extends HtmlDocletWriter { */ protected void addHelpFileContents(Content contentTree) { // Heading - Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false, HtmlStyle.title, + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, false, HtmlStyle.title, contents.getContent("doclet.help.main_heading")); Content div = HtmlTree.DIV(HtmlStyle.header, heading); Content intro = HtmlTree.DIV(HtmlStyle.subTitle, @@ -126,7 +125,7 @@ public class HelpWriter extends HtmlDocletWriter { // Overview if (configuration.createoverview) { - Content overviewHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + Content overviewHeading = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.overviewLabel); htmlTree = HtmlTree.SECTION(overviewHeading); String overviewKey = configuration.showModules @@ -143,7 +142,7 @@ public class HelpWriter extends HtmlDocletWriter { // Module if (configuration.showModules) { - Content moduleHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + Content moduleHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.moduleLabel); htmlTree = HtmlTree.SECTION(moduleHead); Content moduleIntro = contents.getContent("doclet.help.module.intro"); @@ -158,7 +157,7 @@ public class HelpWriter extends HtmlDocletWriter { } // Package - Content packageHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + Content packageHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.packageLabel); htmlTree = HtmlTree.SECTION(packageHead); Content packageIntro = contents.getContent("doclet.help.package.intro"); @@ -175,7 +174,7 @@ public class HelpWriter extends HtmlDocletWriter { ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree)); // Class/interface - Content classHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + Content classHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.getContent("doclet.help.class_interface.head")); htmlTree = HtmlTree.SECTION(classHead); Content classIntro = contents.getContent("doclet.help.class_interface.intro"); @@ -210,7 +209,7 @@ public class HelpWriter extends HtmlDocletWriter { ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree)); // Annotation Types - Content aHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + Content aHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.annotationType); htmlTree = HtmlTree.SECTION(aHead); Content aIntro = contents.getContent("doclet.help.annotation_type.intro"); @@ -226,7 +225,7 @@ public class HelpWriter extends HtmlDocletWriter { ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree)); // Enums - Content enumHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, contents.enum_); + Content enumHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.enum_); htmlTree = HtmlTree.SECTION(enumHead); Content eIntro = contents.getContent("doclet.help.enum.intro"); Content enumPara = HtmlTree.P(eIntro); @@ -241,7 +240,7 @@ public class HelpWriter extends HtmlDocletWriter { // Class Use if (configuration.classuse) { - Content useHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + Content useHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.getContent("doclet.help.use.head")); htmlTree = HtmlTree.SECTION(useHead); Content useBody = contents.getContent("doclet.help.use.body"); @@ -252,7 +251,7 @@ public class HelpWriter extends HtmlDocletWriter { // Tree if (configuration.createtree) { - Content treeHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + Content treeHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.getContent("doclet.help.tree.head")); htmlTree = HtmlTree.SECTION(treeHead); Content treeIntro = contents.getContent("doclet.help.tree.intro", @@ -270,7 +269,7 @@ public class HelpWriter extends HtmlDocletWriter { // Deprecated if (!(configuration.nodeprecatedlist || configuration.nodeprecated)) { - Content dHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + Content dHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.deprecatedAPI); htmlTree = HtmlTree.SECTION(dHead); Content deprBody = contents.getContent("doclet.help.deprecated.body", @@ -291,7 +290,7 @@ public class HelpWriter extends HtmlDocletWriter { indexlink = links.createLink(DocPaths.INDEX_ALL, resources.getText("doclet.Index")); } - Content indexHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + Content indexHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.getContent("doclet.help.index.head")); htmlTree = HtmlTree.SECTION(indexHead); Content indexBody = contents.getContent("doclet.help.index.body", indexlink); @@ -302,7 +301,7 @@ public class HelpWriter extends HtmlDocletWriter { // Frames if (configuration.frames) { - Content frameHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + Content frameHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.getContent("doclet.help.frames.head")); htmlTree = HtmlTree.SECTION(frameHead); Content framesBody = contents.getContent("doclet.help.frames.body"); @@ -313,7 +312,7 @@ public class HelpWriter extends HtmlDocletWriter { } // Serialized Form - Content sHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + Content sHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.serializedForm); htmlTree = HtmlTree.SECTION(sHead); Content serialBody = contents.getContent("doclet.help.serial_form.body"); @@ -322,7 +321,7 @@ public class HelpWriter extends HtmlDocletWriter { ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree)); // Constant Field Values - Content constHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + Content constHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.constantsSummaryTitle); htmlTree = HtmlTree.SECTION(constHead); Content constantsBody = contents.getContent("doclet.help.constants.body", @@ -333,7 +332,7 @@ public class HelpWriter extends HtmlDocletWriter { ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree)); // Search - Content searchHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + Content searchHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.getContent("doclet.help.search.head")); htmlTree = HtmlTree.SECTION(searchHead); Content searchBody = contents.getContent("doclet.help.search.body"); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java index d034d99461d..c8ae3447213 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -41,11 +41,9 @@ import com.sun.tools.doclint.DocLint; import jdk.javadoc.doclet.Doclet; import jdk.javadoc.doclet.DocletEnvironment; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlVersion; import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; -import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.DocletException; import jdk.javadoc.internal.doclets.toolkit.Messages; import jdk.javadoc.internal.doclets.toolkit.Resources; @@ -82,6 +80,11 @@ import static javax.tools.Diagnostic.Kind.*; */ public class HtmlConfiguration extends BaseConfiguration { + /** + * Default charset for HTML. + */ + public static final String HTML_DEFAULT_CHARSET = "utf-8"; + /** * Argument for command line option "-header". */ @@ -762,7 +765,7 @@ public class HtmlConfiguration extends BaseConfiguration { protected boolean finishOptionSettings0() throws DocletException { if (docencoding == null) { if (charset == null) { - docencoding = charset = (encoding == null) ? HtmlConstants.HTML_DEFAULT_CHARSET : encoding; + docencoding = charset = (encoding == null) ? HTML_DEFAULT_CHARSET : encoding; } else { docencoding = charset; } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialFieldWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialFieldWriter.java index 10688190640..65a320359c0 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialFieldWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialFieldWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -34,7 +34,6 @@ import javax.lang.model.type.TypeMirror; import com.sun.source.doctree.DocTree; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -108,8 +107,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl li.setStyle(HtmlStyle.blockList); if (serializableFieldsTree.isValid()) { Content headingContent = new StringContent(heading); - Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, - headingContent); + Content serialHeading = HtmlTree.HEADING(Headings.SerializedForm.CLASS_SUBHEADING, headingContent); li.addContent(serialHeading); li.addContent(serializableFieldsTree); } @@ -120,7 +118,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl public void addMemberHeader(TypeElement fieldType, String fieldTypeStr, String fieldDimensions, String fieldName, Content contentTree) { Content nameContent = new StringContent(fieldName); - Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, nameContent); + Content heading = HtmlTree.HEADING(Headings.SerializedForm.MEMBER_HEADING, nameContent); contentTree.addContent(heading); Content pre = new HtmlTree(HtmlTag.PRE); if (fieldType == null) { @@ -138,7 +136,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl @Override public void addMemberHeader(TypeMirror fieldType, String fieldName, Content contentTree) { Content nameContent = new StringContent(fieldName); - Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, nameContent); + Content heading = HtmlTree.HEADING(HtmlTag.H5, nameContent); contentTree.addContent(heading); Content pre = new HtmlTree(HtmlTag.PRE); Content fieldContent = writer.getLink(new LinkInfoImpl( diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialMethodWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialMethodWriter.java index 070bb7f83bc..e16f853c6a4 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialMethodWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialMethodWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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,6 @@ import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -95,8 +94,7 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements */ public Content getSerializableMethods(String heading, Content serializableMethodContent) { Content headingContent = new StringContent(heading); - Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, - headingContent); + Content serialHeading = HtmlTree.HEADING(Headings.SerializedForm.CLASS_SUBHEADING, headingContent); Content li = HtmlTree.LI(HtmlStyle.blockList, serialHeading); li.addContent(serializableMethodContent); return li; @@ -120,7 +118,9 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements * @param methodsContentTree the content tree to which the member header will be added */ public void addMemberHeader(ExecutableElement member, Content methodsContentTree) { - methodsContentTree.addContent(getHead(member)); + Content memberContent = new StringContent(name(member)); + Content heading = HtmlTree.HEADING(Headings.SerializedForm.MEMBER_HEADING, memberContent); + methodsContentTree.addContent(heading); methodsContentTree.addContent(getSignature(member)); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlConstants.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MarkerComments.java similarity index 62% rename from src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlConstants.java rename to src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MarkerComments.java index 32383d1b288..8131fc54ae6 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlConstants.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MarkerComments.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019, 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,12 +23,12 @@ * questions. */ -package jdk.javadoc.internal.doclets.formats.html.markup; +package jdk.javadoc.internal.doclets.formats.html; -import jdk.javadoc.internal.doclets.toolkit.Content; +import jdk.javadoc.internal.doclets.formats.html.markup.Comment; /** - * Stores constants for Html Doclet. + * Marker comments to identify regions in the generated files. * *

    This is NOT part of any supported API. * If you write code that depends on this, you do so at your own risk. @@ -37,216 +37,162 @@ import jdk.javadoc.internal.doclets.toolkit.Content; * * @author Bhavesh Patel */ -public class HtmlConstants { +public class MarkerComments { /** * Marker to identify start of top navigation bar. */ - public static final Content START_OF_TOP_NAVBAR = + public static final Comment START_OF_TOP_NAVBAR = new Comment("========= START OF TOP NAVBAR ======="); /** * Marker to identify start of bottom navigation bar. */ - public static final Content START_OF_BOTTOM_NAVBAR = + public static final Comment START_OF_BOTTOM_NAVBAR = new Comment("======= START OF BOTTOM NAVBAR ======"); /** * Marker to identify end of top navigation bar. */ - public static final Content END_OF_TOP_NAVBAR = + public static final Comment END_OF_TOP_NAVBAR = new Comment("========= END OF TOP NAVBAR ========="); /** * Marker to identify end of bottom navigation bar. */ - public static final Content END_OF_BOTTOM_NAVBAR = + public static final Comment END_OF_BOTTOM_NAVBAR = new Comment("======== END OF BOTTOM NAVBAR ======="); /** * Marker to identify start of module description. */ - public static final Content START_OF_MODULE_DESCRIPTION = + public static final Comment START_OF_MODULE_DESCRIPTION = new Comment("============ MODULE DESCRIPTION ==========="); /** * Marker to identify start of modules summary. */ - public static final Content START_OF_MODULES_SUMMARY = + public static final Comment START_OF_MODULES_SUMMARY = new Comment("============ MODULES SUMMARY ==========="); /** * Marker to identify start of packages summary. */ - public static final Content START_OF_PACKAGES_SUMMARY = + public static final Comment START_OF_PACKAGES_SUMMARY = new Comment("============ PACKAGES SUMMARY ==========="); /** * Marker to identify start of services summary. */ - public static final Content START_OF_SERVICES_SUMMARY = + public static final Comment START_OF_SERVICES_SUMMARY = new Comment("============ SERVICES SUMMARY ==========="); /** * Marker to identify start of class data. */ - public static final Content START_OF_CLASS_DATA = + public static final Comment START_OF_CLASS_DATA = new Comment("======== START OF CLASS DATA ========"); /** * Marker to identify end of class data. */ - public static final Content END_OF_CLASS_DATA = + public static final Comment END_OF_CLASS_DATA = new Comment("========= END OF CLASS DATA ========="); /** * Marker to identify start of nested class summary. */ - public static final Content START_OF_NESTED_CLASS_SUMMARY = + public static final Comment START_OF_NESTED_CLASS_SUMMARY = new Comment("======== NESTED CLASS SUMMARY ========"); /** * Marker to identify start of annotation type optional member summary. */ - public static final Content START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY = + public static final Comment START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY = new Comment("=========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY ==========="); /** * Marker to identify start of annotation type required member summary. */ - public static final Content START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY = + public static final Comment START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY = new Comment("=========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY ==========="); /** * Marker to identify start of annotation type required member summary. */ - public static final Content START_OF_ANNOTATION_TYPE_FIELD_SUMMARY = + public static final Comment START_OF_ANNOTATION_TYPE_FIELD_SUMMARY = new Comment("=========== ANNOTATION TYPE FIELD SUMMARY ==========="); /** * Marker to identify start of constructor summary. */ - public static final Content START_OF_CONSTRUCTOR_SUMMARY = + public static final Comment START_OF_CONSTRUCTOR_SUMMARY = new Comment("======== CONSTRUCTOR SUMMARY ========"); /** * Marker to identify start of enum constants summary. */ - public static final Content START_OF_ENUM_CONSTANT_SUMMARY = + public static final Comment START_OF_ENUM_CONSTANT_SUMMARY = new Comment("=========== ENUM CONSTANT SUMMARY ==========="); /** * Marker to identify start of field summary. */ - public static final Content START_OF_FIELD_SUMMARY = + public static final Comment START_OF_FIELD_SUMMARY = new Comment("=========== FIELD SUMMARY ==========="); /** * Marker to identify start of properties summary. */ - public static final Content START_OF_PROPERTY_SUMMARY = + public static final Comment START_OF_PROPERTY_SUMMARY = new Comment("=========== PROPERTY SUMMARY ==========="); /** * Marker to identify start of method summary. */ - public static final Content START_OF_METHOD_SUMMARY = + public static final Comment START_OF_METHOD_SUMMARY = new Comment("========== METHOD SUMMARY ==========="); /** * Marker to identify start of annotation type details. */ - public static final Content START_OF_ANNOTATION_TYPE_DETAILS = + public static final Comment START_OF_ANNOTATION_TYPE_DETAILS = new Comment("============ ANNOTATION TYPE MEMBER DETAIL ==========="); /** * Marker to identify start of annotation type field details. */ - public static final Content START_OF_ANNOTATION_TYPE_FIELD_DETAILS = + public static final Comment START_OF_ANNOTATION_TYPE_FIELD_DETAILS = new Comment("============ ANNOTATION TYPE FIELD DETAIL ==========="); /** * Marker to identify start of method details. */ - public static final Content START_OF_METHOD_DETAILS = + public static final Comment START_OF_METHOD_DETAILS = new Comment("============ METHOD DETAIL =========="); /** * Marker to identify start of field details. */ - public static final Content START_OF_FIELD_DETAILS = + public static final Comment START_OF_FIELD_DETAILS = new Comment("============ FIELD DETAIL ==========="); /** * Marker to identify start of property details. */ - public static final Content START_OF_PROPERTY_DETAILS = + public static final Comment START_OF_PROPERTY_DETAILS = new Comment("============ PROPERTY DETAIL ==========="); /** * Marker to identify start of constructor details. */ - public static final Content START_OF_CONSTRUCTOR_DETAILS = + public static final Comment START_OF_CONSTRUCTOR_DETAILS = new Comment("========= CONSTRUCTOR DETAIL ========"); /** * Marker to identify start of enum constants details. */ - public static final Content START_OF_ENUM_CONSTANT_DETAILS = + public static final Comment START_OF_ENUM_CONSTANT_DETAILS = new Comment("============ ENUM CONSTANT DETAIL ==========="); - /** - * Html tag for the page title heading. - */ - public static final HtmlTag TITLE_HEADING = HtmlTag.H1; - - /** - * Html tag for the class page title heading. - */ - public static final HtmlTag CLASS_PAGE_HEADING = HtmlTag.H2; - - /** - * Html tag for the content heading. - */ - public static final HtmlTag CONTENT_HEADING = HtmlTag.H2; - - /** - * Html tag for the package name heading. - */ - public static final HtmlTag PACKAGE_HEADING = HtmlTag.H2; - - /** - * Html tag for the module name heading. - */ - public static final HtmlTag MODULE_HEADING = HtmlTag.H2; - - /** - * Html tag for the member summary heading. - */ - public static final HtmlTag SUMMARY_HEADING = HtmlTag.H3; - - /** - * Html tag for the inherited member summary heading. - */ - public static final HtmlTag INHERITED_SUMMARY_HEADING = HtmlTag.H3; - - /** - * Html tag for the member details heading. - */ - public static final HtmlTag DETAILS_HEADING = HtmlTag.H3; - - /** - * Html tag for the serialized member heading. - */ - public static final HtmlTag SERIALIZED_MEMBER_HEADING = HtmlTag.H3; - - /** - * Html tag for the member heading. - */ - public static final HtmlTag MEMBER_HEADING = HtmlTag.H4; - - /** - * Default charset for HTML. - */ - public static final String HTML_DEFAULT_CHARSET = "utf-8"; } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java index 34f24698463..5c3735bc6fb 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -36,7 +36,6 @@ import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeMirror; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -87,7 +86,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter */ @Override public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { - memberSummaryTree.addContent(HtmlConstants.START_OF_METHOD_SUMMARY); + memberSummaryTree.addContent(MarkerComments.START_OF_METHOD_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -106,10 +105,10 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter */ @Override public Content getMethodDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) { - memberDetailsTree.addContent(HtmlConstants.START_OF_METHOD_DETAILS); + memberDetailsTree.addContent(MarkerComments.START_OF_METHOD_DETAILS); Content methodDetailsTree = writer.getMemberTreeHeader(); methodDetailsTree.addContent(links.createAnchor(SectionName.METHOD_DETAIL)); - Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, + Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, contents.methodDetailLabel); methodDetailsTree.addContent(heading); return methodDetailsTree; @@ -126,7 +125,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter } methodDetailsTree.addContent(links.createAnchor(writer.getAnchor(method))); Content methodDocTree = writer.getMemberTreeHeader(); - Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); + Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); heading.addContent(name(method)); methodDocTree.addContent(heading); return methodDocTree; @@ -229,7 +228,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter */ @Override public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, contents.methodSummary); memberTree.addContent(label); } @@ -295,7 +294,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter ? resources.getText("doclet.Methods_Inherited_From_Class") : resources.getText("doclet.Methods_Inherited_From_Interface")); } - Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING, + Content labelHeading = HtmlTree.HEADING(Headings.TypeDeclaration.INHERITED_SUMMARY_HEADING, label); labelHeading.addContent(Contents.SPACE); labelHeading.addContent(classLink); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java index bc6cb06bea1..1e328498978 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java @@ -32,7 +32,6 @@ import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import javax.lang.model.util.ElementFilter; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -101,7 +100,7 @@ public class ModuleFrameWriter extends HtmlDocletWriter { DocPath moduleSummary = configuration.useModuleDirectories ? DocPaths.DOT_DOT.resolve(configuration.docPaths.moduleSummary(moduleElement)) : configuration.docPaths.moduleSummary(moduleElement); - Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, HtmlStyle.bar, mdlgen.links.createLink(moduleSummary, mdlLabel, "", "classFrame")); htmlTree.addContent(heading); HtmlTree div = new HtmlTree(HtmlTag.DIV); @@ -172,7 +171,7 @@ public class ModuleFrameWriter extends HtmlDocletWriter { continue; } if (!printedHeader) { - Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + Content heading = HtmlTree.HEADING(Headings.CONTENT_HEADING, true, labelContent); htmlTree.addContent(heading); printedHeader = true; diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java index f096330fd4a..bcc04b7bcf2 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java @@ -32,7 +32,6 @@ import javax.lang.model.element.ModuleElement; import javax.lang.model.element.PackageElement; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -57,6 +56,12 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; * @author Bhavesh Patel */ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter { + /** + * The heading (h1 or h2) to use for the module list, + * set by addNavigationBarHeader depending on whether or not there + * is an additional initial heading. + */ + private HtmlTag moduleListHeading; /** * Construct the ModuleIndexFrameWriter object. @@ -83,8 +88,9 @@ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter { /** * {@inheritDoc} */ + @Override protected void addModulesList(Content main) { - Content heading = HtmlTree.HEADING(HtmlConstants.MODULE_HEADING, true, + Content heading = HtmlTree.HEADING(moduleListHeading, true, contents.modulesLabel); HtmlTree htmlTree = HtmlTree.DIV(HtmlStyle.indexContainer, heading); HtmlTree ul = new HtmlTree(HtmlTag.UL); @@ -125,15 +131,16 @@ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter { * {@inheritDoc} */ protected void addNavigationBarHeader(Content header) { - Content headerContent; - if (configuration.packagesheader.length() > 0) { - headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader)); + String headerContent = !configuration.packagesheader.isEmpty() ? configuration.packagesheader + : configuration.header; + if (!headerContent.isEmpty()) { + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, + HtmlStyle.bar, new RawHtml(replaceDocRootDir(headerContent))); + header.addContent(heading); + moduleListHeading = Headings.IndexFrames.MODULE_HEADING; } else { - headerContent = new RawHtml(replaceDocRootDir(configuration.header)); + moduleListHeading = Headings.PAGE_TITLE_HEADING; } - Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, - HtmlStyle.bar, headerContent); - header.addContent(heading); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java index be5eb67c346..23de9557290 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java @@ -33,7 +33,6 @@ import java.util.Set; import javax.lang.model.element.ModuleElement; import javax.lang.model.element.PackageElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -57,6 +56,12 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; * @author Bhavesh Patel */ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter { + /** + * The heading (h1 or h2) to use for the module packages list, + * set by addNavigationBarHeader depending on whether or not there + * is an additional initial heading. + */ + private HtmlTag modulePackagesListHeading; /** * Construct the ModulePackageIndexFrameWriter object. @@ -89,7 +94,7 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter { protected void addModulePackagesList(Map> modules, String text, String tableSummary, Content main, ModuleElement mdle) { Content profNameContent = new StringContent(mdle.getQualifiedName().toString()); - Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, + Content heading = HtmlTree.HEADING(modulePackagesListHeading, true, getTargetModuleLink("classFrame", profNameContent, mdle)); heading.addContent(Contents.SPACE); heading.addContent(contents.packagesLabel); @@ -112,7 +117,7 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter { protected void addModulePackagesList(Set modules, String text, String tableSummary, Content body, ModuleElement mdle) { Content moduleNameContent = new StringContent(mdle.getQualifiedName().toString()); - Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, + Content heading = HtmlTree.HEADING(modulePackagesListHeading, true, getTargetModuleLink("classFrame", moduleNameContent, mdle)); heading.addContent(Contents.SPACE); heading.addContent(contents.packagesLabel); @@ -157,15 +162,16 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter { * {@inheritDoc} */ protected void addNavigationBarHeader(Content header) { - Content headerContent; - if (configuration.packagesheader.length() > 0) { - headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader)); + String headerContent = !configuration.packagesheader.isEmpty() ? configuration.packagesheader + : configuration.header; + if (!headerContent.isEmpty()) { + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, + HtmlStyle.bar, new RawHtml(replaceDocRootDir(headerContent))); + header.addContent(heading); + modulePackagesListHeading = Headings.IndexFrames.PACKAGE_HEADING; } else { - headerContent = new RawHtml(replaceDocRootDir(configuration.header)); + modulePackagesListHeading = Headings.PAGE_TITLE_HEADING; } - Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, - HtmlStyle.bar, headerContent); - header.addContent(heading); } /** @@ -177,6 +183,7 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter { /** * Do nothing as there is no modules list on this page. */ + @Override protected void addModulesList(Content body) { } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java index 9f5e8a4e083..1098e3f1891 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java @@ -46,7 +46,6 @@ import javax.lang.model.util.ElementFilter; import com.sun.source.doctree.DocTree; import jdk.javadoc.doclet.DocletEnvironment.ModuleMode; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -213,7 +212,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW div.addContent(annotationContent); Content label = mdle.isOpen() && (configuration.docEnv.getModuleMode() == ModuleMode.ALL) ? contents.openModuleLabel : contents.moduleLabel; - Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, + Content tHeading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, HtmlStyle.title, label); tHeading.addContent(Contents.SPACE); Content moduleHead = new RawHtml(heading); @@ -461,7 +460,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW Content htmltree) { htmltree.addContent(startMarker); htmltree.addContent(links.createAnchor(markerAnchor)); - htmltree.addContent(HtmlTree.HEADING(HtmlTag.H3, heading)); + htmltree.addContent(HtmlTree.HEADING(Headings.ModuleDeclaration.SUMMARY_HEADING, heading)); } /** @@ -509,7 +508,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW contents.descriptionLabel); HtmlTree li = new HtmlTree(HtmlTag.LI); li.setStyle(HtmlStyle.blockList); - addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES, + addSummaryHeader(MarkerComments.START_OF_MODULES_SUMMARY, SectionName.MODULES, contents.navModules, li); if (display(requires)) { String text = resources.getText("doclet.Requires_Summary"); @@ -561,7 +560,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW || display(indirectPackages) || display(indirectOpenPackages)) { HtmlTree li = new HtmlTree(HtmlTag.LI); li.setStyle(HtmlStyle.blockList); - addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES, + addSummaryHeader(MarkerComments.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES, contents.navPackages, li); if (display(packages)) { addPackageSummary(li); @@ -740,7 +739,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW if (haveProvides || haveUses) { HtmlTree li = new HtmlTree(HtmlTag.LI); li.setStyle(HtmlStyle.blockList); - addSummaryHeader(HtmlConstants.START_OF_SERVICES_SUMMARY, SectionName.SERVICES, + addSummaryHeader(MarkerComments.START_OF_SERVICES_SUMMARY, SectionName.SERVICES, contents.navServices, li); TableHeader usesProvidesTableHeader = new TableHeader(contents.typeLabel, contents.descriptionLabel); @@ -869,7 +868,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW if (!utils.getFullBody(mdle).isEmpty()) { Content tree = HtmlTree.SECTION(); addDeprecationInfo(tree); - tree.addContent(HtmlConstants.START_OF_MODULE_DESCRIPTION); + tree.addContent(MarkerComments.START_OF_MODULE_DESCRIPTION); tree.addContent(links.createAnchor(SectionName.MODULE_DESCRIPTION)); addInlineComment(mdle, tree); moduleContentTree.addContent(tree); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java index 3eab7599a49..bbb0fa15a7d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -34,10 +34,8 @@ import java.util.List; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; -import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter; @@ -72,7 +70,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter @Override public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { - memberSummaryTree.addContent(HtmlConstants.START_OF_NESTED_CLASS_SUMMARY); + memberSummaryTree.addContent(MarkerComments.START_OF_NESTED_CLASS_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -91,7 +89,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter */ @Override public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, contents.nestedClassSummary); memberTree.addContent(label); } @@ -155,8 +153,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter ? resources.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Interface") : resources.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class")); } - Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING, - label); + Content labelHeading = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, label); labelHeading.addContent(Contents.SPACE); labelHeading.addContent(classLink); inheritedTree.addContent(labelHeading); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java index ac1269a70c7..7a0857b9fab 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java @@ -30,7 +30,6 @@ import java.util.*; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -102,7 +101,7 @@ public class PackageFrameWriter extends HtmlDocletWriter { HtmlTree body = packgen.getBody(false, packgen.getWindowTitle(pkgName)); Content pkgNameContent = new StringContent(pkgName); HtmlTree htmlTree = HtmlTree.MAIN(); - Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, HtmlStyle.bar, packgen.getTargetPackageLink(packageElement, "classFrame", pkgNameContent)); htmlTree.addContent(heading); HtmlTree div = new HtmlTree(HtmlTag.DIV); @@ -178,7 +177,7 @@ public class PackageFrameWriter extends HtmlDocletWriter { continue; } if (!printedHeader) { - Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, + Content heading = HtmlTree.HEADING(Headings.CONTENT_HEADING, true, labelContent); htmlTree.addContent(heading); printedHeader = true; diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java index ecbf34fd4e3..6860d4d4cf9 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java @@ -27,7 +27,6 @@ package jdk.javadoc.internal.doclets.formats.html; import javax.lang.model.element.PackageElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -79,7 +78,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter { */ @Override protected void addPackagesList(Content main) { - Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, + Content heading = HtmlTree.HEADING(Headings.IndexFrames.PACKAGE_HEADING, true, contents.packagesLabel); HtmlTree htmlTree = HtmlTree.DIV(HtmlStyle.indexContainer, heading); HtmlTree ul = new HtmlTree(HtmlTag.UL); @@ -130,7 +129,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter { } else { headerContent = new RawHtml(replaceDocRootDir(configuration.header)); } - Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, HtmlStyle.bar, headerContent); header.addContent(heading); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java index 359a8bb953a..98de33e8acb 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java @@ -27,7 +27,6 @@ package jdk.javadoc.internal.doclets.formats.html; import javax.lang.model.element.PackageElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -101,7 +100,7 @@ public class PackageTreeWriter extends AbstractTreeWriter { HtmlTree mainTree = HtmlTree.MAIN(); Content headContent = contents.getContent("doclet.Hierarchy_For_Package", utils.getPackageName(packageElement)); - Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false, + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, false, HtmlStyle.title, headContent); Content div = HtmlTree.DIV(HtmlStyle.header, heading); if (configuration.packages.size() > 1) { diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java index 6bdb9472fc2..a0f17d28277 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java @@ -34,7 +34,6 @@ import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -252,7 +251,7 @@ public class PackageUseWriter extends SubWriterHolderWriter { headContent.addContent(contents.getContent("doclet.ClassUse_Title", packageText)); headContent.addContent(new HtmlTree(HtmlTag.BR)); headContent.addContent(name); - Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, HtmlStyle.title, headContent); Content div = HtmlTree.DIV(HtmlStyle.header, heading); mainTree.addContent(div); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java index bcf2aebdfc5..2a85edae038 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java @@ -36,7 +36,6 @@ import javax.lang.model.element.TypeElement; import com.sun.source.doctree.DocTree; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -129,7 +128,7 @@ public class PackageWriterImpl extends HtmlDocletWriter Content annotationContent = new HtmlTree(HtmlTag.P); addAnnotationInfo(packageElement, annotationContent); div.addContent(annotationContent); - Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, + Content tHeading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, HtmlStyle.title, contents.packageLabel); tHeading.addContent(Contents.SPACE); Content packageHead = new StringContent(heading); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java index d34be75791e..9a256f8763e 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -33,7 +33,6 @@ import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -68,7 +67,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter */ @Override public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { - memberSummaryTree.addContent(HtmlConstants.START_OF_PROPERTY_SUMMARY); + memberSummaryTree.addContent(MarkerComments.START_OF_PROPERTY_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -88,10 +87,10 @@ public class PropertyWriterImpl extends AbstractMemberWriter @Override public Content getPropertyDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) { - memberDetailsTree.addContent(HtmlConstants.START_OF_PROPERTY_DETAILS); + memberDetailsTree.addContent(MarkerComments.START_OF_PROPERTY_DETAILS); Content propertyDetailsTree = writer.getMemberTreeHeader(); propertyDetailsTree.addContent(links.createAnchor(SectionName.PROPERTY_DETAIL)); - Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, + Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, contents.propertyDetailsLabel); propertyDetailsTree.addContent(heading); return propertyDetailsTree; @@ -105,7 +104,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter Content propertyDetailsTree) { propertyDetailsTree.addContent(links.createAnchor(name(property))); Content propertyDocTree = writer.getMemberTreeHeader(); - Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); + Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); heading.addContent(utils.getPropertyLabel(name(property))); propertyDocTree.addContent(heading); return propertyDocTree; @@ -200,7 +199,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter */ @Override public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, contents.propertySummaryLabel); memberTree.addContent(label); } @@ -261,7 +260,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter ? resources.getText("doclet.Properties_Inherited_From_Class") : resources.getText("doclet.Properties_Inherited_From_Interface")); } - Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING, + Content labelHeading = HtmlTree.HEADING(Headings.TypeDeclaration.INHERITED_SUMMARY_HEADING, label); labelHeading.addContent(Contents.SPACE); labelHeading.addContent(classLink); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java index b11367ef32f..986e3618c3a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java @@ -29,7 +29,6 @@ import java.util.*; import javax.lang.model.element.TypeElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -42,7 +41,7 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; /** - * Generate the Serialized Form Information Page. + * Generates the Serialized Form Information Page, serialized-form.html. * *

    This is NOT part of any supported API. * If you write code that depends on this, you do so at your own risk. @@ -86,7 +85,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter htmlTree.addContent(navBar.getContent(true)); bodyTree.addContent(htmlTree); Content h1Content = new StringContent(header); - Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, HtmlStyle.title, h1Content); Content div = HtmlTree.DIV(HtmlStyle.header, heading); mainTree.addContent(div); @@ -120,7 +119,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter * @return a content tree for the package header */ public Content getPackageHeader(String packageName) { - Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, + Content heading = HtmlTree.HEADING(Headings.SerializedForm.PACKAGE_HEADING, true, contents.packageLabel); heading.addContent(Contents.SPACE); heading.addContent(packageName); @@ -173,8 +172,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter contents.getContent( "doclet.Class_0_extends_implements_serializable", classLink, superClassLink); - li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, - className)); + li.addContent(HtmlTree.HEADING(Headings.SerializedForm.CLASS_HEADING, className)); return li; } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java index b5d3b026e38..50b27b73b2d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java @@ -29,7 +29,6 @@ import java.util.SortedSet; import javax.lang.model.element.PackageElement; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -108,7 +107,7 @@ public class TreeWriter extends AbstractTreeWriter { public void generateTreeFile() throws DocFileIOException { HtmlTree body = getTreeHeader(); Content headContent = contents.hierarchyForAllPackages; - Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false, + Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, false, HtmlStyle.title, headContent); Content div = HtmlTree.DIV(HtmlStyle.header, heading); addPackageTreeLinks(div); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java index 56a2e16c446..f2139dfd1ad 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ import javax.lang.model.element.TypeElement; import jdk.javadoc.internal.doclets.formats.html.AbstractMemberWriter; import jdk.javadoc.internal.doclets.formats.html.Contents; import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration; +import jdk.javadoc.internal.doclets.formats.html.MarkerComments; import jdk.javadoc.internal.doclets.formats.html.SectionName; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder; @@ -106,8 +107,8 @@ public class Navigation { } enum Position { - BOTTOM(HtmlConstants.START_OF_BOTTOM_NAVBAR, HtmlConstants.END_OF_BOTTOM_NAVBAR), - TOP(HtmlConstants.START_OF_TOP_NAVBAR, HtmlConstants.END_OF_TOP_NAVBAR); + BOTTOM(MarkerComments.START_OF_BOTTOM_NAVBAR, MarkerComments.END_OF_BOTTOM_NAVBAR), + TOP(MarkerComments.START_OF_TOP_NAVBAR, MarkerComments.END_OF_TOP_NAVBAR); final Content startOfNav; final Content endOfNav; diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java index 96f1d1d2aeb..ecaa514939c 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -304,8 +304,8 @@ public class SerializedFormBuilder extends AbstractBuilder { Content noCustomizationMsg = methodWriter.getNoCustomizationMsg( resources.getText("doclet.Serializable_no_customization")); classContentTree.addContent(methodWriter.getSerializableMethods( - resources.getText("doclet.Serialized_Form_methods"), - noCustomizationMsg)); + resources.getText("doclet.Serialized_Form_methods"), + noCustomizationMsg)); } } } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css index e46e2825f36..287dde6433d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css @@ -296,25 +296,32 @@ ul.subNavList li { /* * Styles for headings. */ -div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { +div.details ul.blockList ul.blockList ul.blockList li.blockList h3, +div.details ul.blockList ul.blockList ul.blockListLast li.blockList h3, +div.serializedFormContainer ul.blockList ul.blockList ul.blockList li.blockList h4 { background-color:#dee3e9; border:1px solid #d0d9e0; margin:0 0 6px -8px; padding:7px 5px; } -ul.blockList ul.blockList ul.blockList li.blockList h3 { +div.details h2, +div.summary h2 { + font-style: italic; +} +div.details h3, +div.summary h3 { + font-style: normal; +} +ul.blockList ul.blockList ul.blockList li.blockList h2 { background-color:#dee3e9; border:1px solid #d0d9e0; margin:0 0 6px -8px; padding:7px 5px; } -ul.blockList ul.blockList li.blockList h3 { +ul.blockList ul.blockList li.blockList h2 { padding:0; margin:15px 0; } -ul.blockList li.blockList h2 { - padding:0px 0 20px 0; -} /* * Styles for page layout containers. */ @@ -597,7 +604,8 @@ th.colDeprecatedItemName a:link, th.colDeprecatedItemName a:visited, .docSummary { padding:0; } -ul.blockList ul.blockList ul.blockList li.blockList h3 { +ul.blockList ul.blockList ul.blockList li.blockList h3, +ul.blockList ul.blockList ul.blockListLast li.blockList h3 { font-style:normal; } div.block { diff --git a/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java b/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java index d9af68abce3..3664f73395f 100644 --- a/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java +++ b/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java @@ -57,11 +57,11 @@ public class TestAnnotationTypes extends JavadocTester { + "

  • Field | 
  • ", "", - "

    Field Summary

    ", + "

    Field Summary

    ", "DEFAULT_NAME" + "", "", - "

    DEFAULT_NAME

    \n" + "

    DEFAULT_NAME

    \n" + "
    static final java."
                     + "lang.String DEFAULT_NAME
    "); @@ -77,13 +77,13 @@ public class TestAnnotationTypes extends JavadocTester { "
  • ", "", "", - "

    Element Detail

    ", + "

    Element Detail

    ", "", "", "", "
      ", "
    • ", - "

      value

      ", + "

      value

      ", "
      int value
      " ); checkOutput("pkg/AnnotationType.html", false, diff --git a/test/langtools/jdk/javadoc/doclet/testHeadings/TestHeadings.java b/test/langtools/jdk/javadoc/doclet/testHeadings/TestHeadings.java index 1336f1b6afd..0d301c86e0e 100644 --- a/test/langtools/jdk/javadoc/doclet/testHeadings/TestHeadings.java +++ b/test/langtools/jdk/javadoc/doclet/testHeadings/TestHeadings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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,23 +37,6 @@ import javadoc.tester.JavadocTester; public class TestHeadings extends JavadocTester { - private static final String[][] TEST = { - - { - }, - { "serialized-form.html" - }, - { "serialized-form.html" - }, - - { - }, - { "overview-frame.html" - }, - { - } - }; - public static void main(String... args) throws Exception { TestHeadings tester = new TestHeadings(); tester.runTests(); @@ -108,7 +91,7 @@ public class TestHeadings extends JavadocTester { "

      Package pkg1

      ", "

      Class " + "pkg1.C1 extends java.lang.Object implements Serializable

      ", - "

      Serialized Fields

      "); + "

      Serialized Fields

      "); // Overview Frame checkOutput("overview-frame.html", true, diff --git a/test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java b/test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java index e968a156d5d..846736046e4 100644 --- a/test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java +++ b/test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java @@ -67,8 +67,8 @@ public class TestHiddenTag extends JavadocTester { checkOutput("pkg1/A.VisibleInner.html", true, "visibleField", "visibleMethod", - "

      Nested classes/interfaces inherited from class pkg1." + - "A

      \n" + + "

      Nested classes/interfaces inherited from class pkg1." + + "A

      \n" + "" + "A.VisibleInner, A.VisibleInnerExtendsInvisibleInner
    • \n" + diff --git a/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java b/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java index 7bf5eeb18a3..506bf946773 100644 --- a/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java +++ b/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java @@ -75,7 +75,7 @@ public class TestHref extends JavadocTester { checkOutput("pkg/C4.html", true, //Header does not link to the page itself. - "Class C4<E extends C4<E>>
  • ", + "Class C4<E extends C4<E>>", //Signature does not link to the page itself. "public abstract class C4<E extends C4<E>>" ); diff --git a/test/langtools/jdk/javadoc/doclet/testHtmlLandmarkRegions/TestHtmlLandmarkRegions.java b/test/langtools/jdk/javadoc/doclet/testHtmlLandmarkRegions/TestHtmlLandmarkRegions.java index 882976201d4..d18687a1616 100644 --- a/test/langtools/jdk/javadoc/doclet/testHtmlLandmarkRegions/TestHtmlLandmarkRegions.java +++ b/test/langtools/jdk/javadoc/doclet/testHtmlLandmarkRegions/TestHtmlLandmarkRegions.java @@ -109,7 +109,7 @@ public class TestHtmlLandmarkRegions extends JavadocTester { Path srcDir = base.resolve("src"); createPackages(srcDir); - Path outDir = base.resolve("out3"); + Path outDir = base.resolve("out"); javadoc("-d", outDir.toString(), "-doctitle", "Document Title", "-header", "Test Header", @@ -153,7 +153,7 @@ public class TestHtmlLandmarkRegions extends JavadocTester { + " \n" + "")); - Path outDir = base.resolve("out5"); + Path outDir = base.resolve("out"); javadoc("-d", outDir.toString(), "-sourcepath", srcDir.toString(), "pkg1", "pkg2"); @@ -171,12 +171,12 @@ public class TestHtmlLandmarkRegions extends JavadocTester { void createModules(Path srcDir) throws Exception { new ModuleBuilder(tb, "m1") - .classes("package p1; public class a{}") - .classes("package p2; public class b{}") + .classes("package p1; public class a { }") + .classes("package p2; public class b { }") .write(srcDir); new ModuleBuilder(tb, "m2") - .classes("package p3; public class c{}") - .classes("package p4; public class d{}") + .classes("package p3; public class c { }") + .classes("package p4; public class d { }") .write(srcDir); } diff --git a/test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java b/test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java index afe5a6a9568..d5277d1a803 100644 --- a/test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java +++ b/test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java @@ -349,46 +349,46 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Nested Class Summary

    \n" + + "

    Nested Class Summary

    \n" + "
    \n", "
    \n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Field Summary

      \n" + + "

      Field Summary

      \n" + "
      \n
    ", "
    \n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Constructor Summary

      \n" + + "

      Constructor Summary

      \n" + "
      \n
    ", "
    \n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Method Summary

      ", + + "

      Method Summary

      ", "
      \n" + "
        \n" + "
      • \n" + "\n" + "\n" - + "

        Field Detail

        ", + + "

        Field Detail

        ", "
        \n" + "
          \n" + "
        • \n" + "\n" + "\n" - + "

          Constructor Detail

          ", + + "

          Constructor Detail

          ", "
          \n" + "
            \n" + "
          • \n" + "\n" + "\n" - + "

            Method Detail

            ", + + "

            Method Detail

            ", "
            \n" + "
    \n", "
    \n" @@ -419,7 +419,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Method Summary

    \n" + + "

    Method Summary

    \n" + "
    \n", "
  • ", "
    \n" @@ -427,13 +427,13 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Enum Constant Detail

    ", + + "

    Enum Constant Detail

    ", "
    \n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Method Detail

      ", + + "

      Method Detail

      ", "
      \n" + "
  • \n", "
    \n" @@ -464,7 +464,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Method Detail

    ", + + "

    Method Detail

    ", "
    \n" + "
  • ", "
    \n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Optional Element Summary

      \n" + + "

      Optional Element Summary

      \n" + "
      \n
    ", "
    \n" + "
    ", "
    \n" + "
    ", "\n" @@ -831,7 +831,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Field Summary

    \n" + + "

    Field Summary

    \n" + "
    \n" + "
  • ", "\n" @@ -839,7 +839,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Constructor Summary

    \n" + + "

    Constructor Summary

    \n" + "
    \n" + "
  • ", "\n" @@ -847,7 +847,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Method Summary

    \n" + + "

    Method Summary

    \n" + "
    \n" + "
  • ", "\n" @@ -855,19 +855,19 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Field Detail

    ", + + "

    Field Detail

    ", "\n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Constructor Detail

      ", + + "

      Constructor Detail

      ", "\n" + "
        \n" + "
      • \n" + "\n" + "\n" - + "

        Method Detail

        "); + + "

        Method Detail

        "); // Negated test for enum page checkOutput("pkg/AnotherClass.ModalExclusionType.html", false, @@ -883,7 +883,7 @@ public class TestHtmlVersion extends JavadocTester { + "
      • \n" + "\n" + "\n" - + "

        Enum Constant Summary

        \n" + + "

        Enum Constant Summary

        \n" + "
        \n" + "
  • ", "\n" @@ -891,7 +891,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Method Summary

    \n" + + "

    Method Summary

    \n" + "
    \n" + "
  • ", "\n" @@ -899,13 +899,13 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Enum Constant Detail

    ", + + "

    Enum Constant Detail

    ", "\n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Method Detail

      "); + + "

      Method Detail

      "); // Negated test for interface page checkOutput("pkg2/Interface.html", false, @@ -921,7 +921,7 @@ public class TestHtmlVersion extends JavadocTester { + "
    • \n" + "\n" + "\n" - + "

      Method Summary

      \n" + + "

      Method Summary

      \n" + "
      \n" + "
  • ", "\n" @@ -929,7 +929,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Method Detail

    "); + + "

    Method Detail

    "); // Negated test for error page checkOutput("pkg/TestError.html", false, @@ -945,13 +945,13 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Constructor Summary

    ", + + "

    Constructor Summary

    ", "\n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Constructor Detail

      "); + + "

      Constructor Detail

      "); // Negated test for exception page checkOutput("pkg/TestException.html", false, @@ -967,13 +967,13 @@ public class TestHtmlVersion extends JavadocTester { + "
    • \n" + "\n" + "\n" - + "

      Constructor Summary

      ", + + "

      Constructor Summary

      ", "\n" + "
        \n" + "
      • \n" + "\n" + "\n" - + "

        Constructor Detail

        "); + + "

        Constructor Detail

        "); // Negated test for annotation page checkOutput("pkg2/TestAnnotationType.html", false, @@ -989,7 +989,7 @@ public class TestHtmlVersion extends JavadocTester { + "
      • \n" + "\n" + "\n" - + "

        Required Element Summary

        \n" + + "

        Required Element Summary

        \n" + "
        \n" + "
  • ", "\n" @@ -997,7 +997,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Optional Element Summary

    \n" + + "

    Optional Element Summary

    \n" + "
    \n" + "
  • ", "\n" @@ -1005,7 +1005,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Element Detail

    "); + + "

    Element Detail

    "); // Negated test for class use page checkOutput("pkg1/class-use/RegClass.html", false, @@ -1027,7 +1027,7 @@ public class TestHtmlVersion extends JavadocTester { "
  • \n" + "\n" + "\n" - + "

    Uses of RegClass in pkg

    \n" + + "

    Uses of RegClass in pkg

    \n" + "
    \n
  • "); // Negated test for main index page diff --git a/test/langtools/jdk/javadoc/doclet/testIndexTaglet/TestIndexTaglet.java b/test/langtools/jdk/javadoc/doclet/testIndexTaglet/TestIndexTaglet.java index fe7eb3b2f1f..4276f526cee 100644 --- a/test/langtools/jdk/javadoc/doclet/testIndexTaglet/TestIndexTaglet.java +++ b/test/langtools/jdk/javadoc/doclet/testIndexTaglet/TestIndexTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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,12 +75,12 @@ public class TestIndexTaglet extends JavadocTester { checkExit(Exit.OK); checkOrder("pkg/A.html", - "

    Method Detail

    \n", + "

    Method Detail

    \n", "
    test description with search_phrase_a
    "); checkOrder("pkg/A.html", - "

    Method Summary

    \n", + "

    Method Summary

    \n", "
    test description with search_phrase_a
    "); } diff --git a/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java b/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java index 6842dcaabbd..fd7f2d46b2d 100644 --- a/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java +++ b/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java @@ -131,7 +131,7 @@ public class TestInterface extends JavadocTester { "
    Specified by:
    \n"); checkOutput("pkg/ClassWithStaticMembers.html", true, - "

    f

    \n" + "

    f

    \n" + "
    public static int f
    \n" + "
    A hider field
    ", @@ -142,7 +142,7 @@ public class TestInterface extends JavadocTester { + "
    A hider method
    \n" + "\n", - "

    staticMethod

    \n" + "

    staticMethod

    \n" + "
    public static void staticMethod()
    \n" + "
    " + "Description copied from interface: " @@ -183,8 +183,8 @@ public class TestInterface extends JavadocTester { checkOutput("pkg2/Spliterator.OfDouble.html", true, // Ensure the correct type parameters are displayed correctly - "

    Nested classes/interfaces inherited from interface pkg2." - + "Spliterator

    \n" + "

    Nested classes/interfaces inherited from interface pkg2." + + "Spliterator

    \n" + "" + "Spliterator.OfDouble, Spliterator.OfInt<" diff --git a/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java b/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java index 87fb4b62d12..c91f74e7d73 100644 --- a/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java +++ b/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java @@ -86,14 +86,14 @@ public class TestJavaFX extends JavadocTester { + "paused
    \n" + "
    \n" + "
    Defines if paused.
    ", - "

    paused

    \n" + "

    paused

    \n" + "
    public final C.BooleanProperty pausedProperty
    \n" + "
    Defines if paused. The second line.
    ", - "

    isPaused

    \n" + "

    isPaused

    \n" + "
    public final double isPaused()
    \n" + "
    Gets the value of the property paused.
    ", - "

    setPaused

    \n" + "

    setPaused

    \n" + "
    public final void setPaused​(boolean value)
    \n" + "
    Sets the value of the property paused.
    \n" + "
    \n" @@ -101,7 +101,7 @@ public class TestJavaFX extends JavadocTester { + "
    Defines if paused. The second line.
    \n" + "
    Default value:
    \n" + "
    false
    ", - "

    isPaused

    \n" + "

    isPaused

    \n" + "
    public final double isPaused()
    \n" + "
    Gets the value of the property paused.
    \n" + "
    \n" @@ -109,13 +109,13 @@ public class TestJavaFX extends JavadocTester { + "
    Defines if paused. The second line.
    \n" + "
    Default value:
    \n" + "
    false
    ", - "

    rate

    \n" + "

    rate

    \n" + "
    public final C.DoubleProperty rateProperty
    \n" + "
    Defines the direction/speed at which the " + "Timeline is expected to\n" + " be played. This is the second line.
    ", - "

    setRate

    \n" + "

    setRate

    \n" + "
    public final void setRate​(double value)
    \n" + "
    Sets the value of the property rate.
    \n" + "
    \n" @@ -126,7 +126,7 @@ public class TestJavaFX extends JavadocTester { + "
    11
    \n" + "
    Since:
    \n" + "
    JavaFX 8.0
    ", - "

    getRate

    \n" + "

    getRate

    \n" + "
    public final double getRate()
    \n" + "
    Gets the value of the property rate.
    \n" + "
    \n" @@ -137,7 +137,7 @@ public class TestJavaFX extends JavadocTester { + "
    11
    \n" + "
    Since:
    \n" + "
    JavaFX 8.0
    ", - "

    Property Summary

    \n" + "

    Property Summary

    \n" + "
    \n\n" + "", "\n" @@ -147,7 +147,7 @@ public class TestJavaFX extends JavadocTester { checkOutput("pkg1/C.html", false, "A()", - "

    Property Summary

    \n" + "

    Property Summary

    \n" + "
    \n" + "
    Properties 
    \n" + ""); checkOutput("pkg2/Test.html", false, - "

    Property Summary

    \n" + "

    Property Summary

    \n" + "
    \n" + "
    \n" + "\n" diff --git a/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java b/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java index 264df25715b..3c5fdee8898 100644 --- a/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java +++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java @@ -173,7 +173,7 @@ public class TestModuleServices extends JavadocTester { checkExit(Exit.OK); checkOutput("m/module-summary.html", false, - "

    Services

    "); + "

    Services

    "); } @Test @@ -194,7 +194,7 @@ public class TestModuleServices extends JavadocTester { checkExit(Exit.OK); checkOutput("m/module-summary.html", true, - "

    Services

    "); + "

    Services

    "); checkOutput("m/module-summary.html", true, "
    \n
    Properties 
    Modifier and TypeMethod
    \n" + @@ -235,7 +235,7 @@ public class TestModuleServices extends JavadocTester { checkExit(Exit.OK); checkOutput("m/module-summary.html", true, - "

    Services

    "); + "

    Services

    "); checkOutput("m/module-summary.html", true, "
    \n
    \n" + @@ -276,7 +276,7 @@ public class TestModuleServices extends JavadocTester { checkExit(Exit.OK); checkOutput("m/module-summary.html", false, - "

    Services

    "); + "

    Services

    "); } @Test @@ -302,7 +302,7 @@ public class TestModuleServices extends JavadocTester { checkExit(Exit.OK); checkOutput("m/module-summary.html", true, - "

    Services

    "); + "

    Services

    "); checkOutput("m/module-summary.html", true, "
    \n
    \n" + @@ -346,7 +346,7 @@ public class TestModuleServices extends JavadocTester { checkExit(Exit.OK); checkOutput("m/module-summary.html", true, - "

    Services

    "); + "

    Services

    "); checkOutput("m/module-summary.html", true, "
    \n
    \n" + @@ -389,7 +389,7 @@ public class TestModuleServices extends JavadocTester { checkExit(Exit.OK); checkOutput("m/module-summary.html", true, - "

    Services

    "); + "

    Services

    "); checkOutput("m/module-summary.html", true, "
    \n
    \n" + diff --git a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java index e46f1c18401..d1cc0af7679 100644 --- a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java +++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java @@ -1261,7 +1261,7 @@ public class TestModules extends JavadocTester { + "
    This is a test description for the test.moduleFullName.
    \n" + ""); checkOutput("module-overview-frame.html", found, - "

    Modules

    \n" + "

    Modules

    \n" + "
      \n" + "
    • moduleB
    • \n" + "
    • test.moduleFullName
    • \n" diff --git a/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java b/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java index aaa9ee3e0dc..c04f0c1b5cb 100644 --- a/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java +++ b/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java @@ -24,7 +24,7 @@ /* * @test * @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633 8026567 8162363 - * 8175200 8186332 8182765 8196202 8187288 8173730 + * 8175200 8186332 8182765 8196202 8187288 8173730 8215307 * @summary Run Javadoc on a set of source files that demonstrate new * language features. Check the output to ensure that the new * language features are properly documented. @@ -66,7 +66,7 @@ public class TestNewLanguageFeatures extends JavadocTester { void checkEnums() { checkOutput("pkg/Coin.html", true, // Make sure enum header is correct. - "Enum Coin", + "Enum Coin", // Make sure enum signature is correct. "
      public enum "
                       + "Coin\n"
      @@ -110,7 +110,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
           void checkTypeParameters() {
               checkOutput("pkg/TypeParameters.html", true,
                       // Make sure the header is correct.
      -                "Class TypeParameters<E>",
      +                "Class TypeParameters<E>",
                       // Check class type parameters section.
                       "
      Type Parameters:
      \n" + "
      E - " diff --git a/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java b/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java index 572929f3f15..93b0e21fb7e 100644 --- a/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java +++ b/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java @@ -193,10 +193,10 @@ public class TestOptions extends JavadocTester { "
      @Documented\npublic @interface "
                       + "AnnotationTypeField
      ", - "

      DEFAULT_NAME

      \n
      static final java.lang.String "
      +                "

      DEFAULT_NAME

      \n
      static final java.lang.String "
                       + ""
                       + "DEFAULT_NAME
      ", - "

      name

      \n
      java.lang.String name\n
      java.lang.String name
      "); checkOutput("src-html/linksource/AnnotationTypeField.html", true, diff --git a/test/langtools/jdk/javadoc/doclet/testOrdering/TestOrdering.java b/test/langtools/jdk/javadoc/doclet/testOrdering/TestOrdering.java index f9038e72bb2..4e73dfdca84 100644 --- a/test/langtools/jdk/javadoc/doclet/testOrdering/TestOrdering.java +++ b/test/langtools/jdk/javadoc/doclet/testOrdering/TestOrdering.java @@ -551,107 +551,107 @@ public class TestOrdering extends JavadocTester { checkExit(Exit.OK); checkOrder("pkg5/AnnoFieldTest.html", - "

      Field Detail

      ", + "

      Field Detail

      ", "
      static final int one
      ", "
      static final int two
      ", "
      static final int three
      ", "
      static final int four
      "); checkOrder("pkg5/AnnoOptionalTest.html", - "

      Optional Element Summary

      ", + "

      Optional Element Summary

      ", "four", "one", "three", "two", - "

      Element Detail

      ", - "

      one

      ", - "

      two

      ", - "

      three

      ", - "

      four

      "); + "

      Element Detail

      ", + "

      one

      ", + "

      two

      ", + "

      three

      ", + "

      four

      "); checkOrder("pkg5/AnnoRequiredTest.html", - "

      Required Element Summary

      ", + "

      Required Element Summary

      ", "four", "one", "three", "two", - "

      Element Detail

      ", - "

      one

      ", - "

      two

      ", - "

      three

      ", - "

      four

      "); + "

      Element Detail

      ", + "

      one

      ", + "

      two

      ", + "

      three

      ", + "

      four

      "); checkOrder("pkg5/CtorTest.html", - "

      Constructor Summary

      ", + "

      Constructor Summary

      ", "Constructor Detail", + "

      Constructor Detail

      ", "
      ", "", "", ""); checkOrder("pkg5/EnumTest.html", - "

      Enum Constant Summary

      ", + "

      Enum Constant Summary

      ", "
      FOUR", "ONE", "THREE", "TWO", - "

      Enum Constant Detail

      ", - "

      ONE

      ", - "

      TWO

      ", - "

      THREE

      ", - "

      FOUR

      "); + "

      Enum Constant Detail

      ", + "

      ONE

      ", + "

      TWO

      ", + "

      THREE

      ", + "

      FOUR

      "); checkOrder("pkg5/FieldTest.html", - "

      Field Summary

      ", + "

      Field Summary

      ", "four", "one", "three", "two", - "

      Field Detail

      ", - "

      one

      ", - "

      two

      ", - "

      three

      ", - "

      four

      "); + "

      Field Detail

      ", + "

      one

      ", + "

      two

      ", + "

      three

      ", + "

      four

      "); checkOrder("pkg5/IntfTest.html", - "

      Method Summary

      ", + "

      Method Summary

      ", "four", "one", "three", "two", - "

      Method Detail

      ", - "

      one

      ", - "

      two

      ", - "

      three

      ", - "

      four

      "); + "

      Method Detail

      ", + "

      one

      ", + "

      two

      ", + "

      three

      ", + "

      four

      "); checkOrder("pkg5/MethodTest.html", - "

      Method Summary

      ", + "

      Method Summary

      ", "four", "one", "three", "two", - "

      Method Detail

      ", - "

      one

      ", - "

      two

      ", - "

      three

      ", - "

      four

      "); + "

      Method Detail

      ", + "

      one

      ", + "

      two

      ", + "

      three

      ", + "

      four

      "); checkOrder("pkg5/PropertyTest.html", - "

      Property Summary

      ", + "

      Property Summary

      ", "four", "one", "three", "two", - "

      Property Detail

      ", - "

      oneProperty

      ", - "

      twoProperty

      ", - "

      threeProperty

      ", - "

      fourProperty

      "); + "

      Property Detail

      ", + "

      oneProperty

      ", + "

      twoProperty

      ", + "

      threeProperty

      ", + "

      fourProperty

      "); } } diff --git a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestBadOverride.java b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestBadOverride.java index b46c2c3342b..d7c346bfa77 100644 --- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestBadOverride.java +++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestBadOverride.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ public class TestBadOverride extends JavadocTester { checkOutput("pkg4/Foo.html", true, "
    • \n" - + "

      toString

      \n" + + "

      toString

      \n" + "
      public void toString()
      \n" + "
      Why can't I do this ?
      \n" + "
    • "); diff --git a/test/langtools/jdk/javadoc/doclet/testSerializedForm/TestSerializedForm.java b/test/langtools/jdk/javadoc/doclet/testSerializedForm/TestSerializedForm.java index 6ffbe096119..46499236cf7 100644 --- a/test/langtools/jdk/javadoc/doclet/testSerializedForm/TestSerializedForm.java +++ b/test/langtools/jdk/javadoc/doclet/testSerializedForm/TestSerializedForm.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 4341304 4485668 4966728 8032066 8071982 8192933 + * @bug 4341304 4485668 4966728 8032066 8071982 8192933 8215307 * @summary Test that methods readResolve and writeReplace show * up in serialized-form.html the same way that readObject and writeObject do. * If the doclet includes readResolve and writeReplace in the serialized-form @@ -109,6 +109,8 @@ public class TestSerializedForm extends JavadocTester { testSrc("SerializedForm.java"), testSrc("ExternalizedForm.java"), "pkg1"); checkExit(Exit.OK); + showHeadings("serialized-form.html"); + checkOutput("serialized-form.html", true, "

      Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass " @@ -130,15 +132,15 @@ public class TestSerializedForm extends JavadocTester { + "extends java.lang.Object implements Serializable

      "); checkOutput("serialized-form.html", true, - "

      Serialized Fields

      \n" + + "

      Serialized Fields

      \n" + "
        \n" + "
      • \n" + - "

        longs

        \n" + + "
        longs
        \n" + "
        Long[] longs
        \n" + "
        the longs
        \n" + "
      • \n" + "
      • \n" + - "

        name

        \n" + + "
        name
        \n" + "
        java.lang.String name
        \n" + "
        a test
        "); } diff --git a/test/langtools/jdk/javadoc/doclet/testSummaryHeading/TestSummaryHeading.java b/test/langtools/jdk/javadoc/doclet/testSummaryHeading/TestSummaryHeading.java index 828bff1ad51..4a03c499b5a 100644 --- a/test/langtools/jdk/javadoc/doclet/testSummaryHeading/TestSummaryHeading.java +++ b/test/langtools/jdk/javadoc/doclet/testSummaryHeading/TestSummaryHeading.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -51,6 +51,6 @@ public class TestSummaryHeading extends JavadocTester { checkExit(Exit.OK); checkOutput("C.html", true, - "

        Method Summary

        "); + "

        Method Summary

        "); } } diff --git a/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java b/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java index 7c1f5da9a13..76d99202311 100644 --- a/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java +++ b/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java @@ -86,7 +86,7 @@ public class TestSummaryTag extends JavadocTester { // make sure the second @summary's content is displayed correctly checkOutput("p1/A.html", true, "
      • \n" - + "

        m3

        \n" + + "

        m3

        \n" + "
        public void m3()
        \n" + "
        First sentence some text maybe second sentence.
        \n" + "
      • \n" diff --git a/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/TestSystemPropertyTaglet.java b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/TestSystemPropertyTaglet.java index 551ea5c61f6..e14c348a679 100644 --- a/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/TestSystemPropertyTaglet.java +++ b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/TestSystemPropertyTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -76,9 +76,9 @@ public class TestSystemPropertyTaglet extends JavadocTester { checkExit(Exit.OK); checkOrder("pkg/A.html", - "

        Class A

        ", + "

        Class A

        ", "test with user.name", - "

        Method Detail

        ", + "

        Method Detail

        ", "test with java.version"); checkOrder("index-all.html", diff --git a/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java b/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java index c1b2868376d..2a99ab3f7ff 100644 --- a/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java +++ b/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java @@ -232,7 +232,7 @@ public abstract class JavadocTester { private DirectoryCheck outputDirectoryCheck = DirectoryCheck.EMPTY; - private boolean automaticCheckAccessibility = false; + private boolean automaticCheckAccessibility = true; private boolean automaticCheckLinks = true; /** The current subtest number. Incremented when checking(...) is called. */ @@ -261,7 +261,7 @@ public abstract class JavadocTester { } /** - * Run all methods annotated with @Test, followed by printSummary. + * Runs all methods annotated with @Test, followed by printSummary. * Typically called on a tester object in main() * @param f a function which will be used to provide arguments to each * invoked method @@ -285,7 +285,7 @@ public abstract class JavadocTester { } /** - * Run javadoc. + * Runs javadoc. * The output directory used by this call and the final exit code * will be saved for later use. * To aid the reader, it is recommended that calls to this method @@ -391,7 +391,7 @@ public abstract class JavadocTester { } /** - * Set the kind of check for the initial contents of the output directory + * Sets the kind of check for the initial contents of the output directory * before javadoc is run. * The filter should return true for files that should not appear. * @param c the kind of check to perform @@ -401,7 +401,14 @@ public abstract class JavadocTester { } /** - * Set whether or not to perform an automatic call of checkLinks. + * Sets whether or not to perform an automatic call of checkAccessibility. + */ + public void setAutomaticCheckAccessibility(boolean b) { + automaticCheckAccessibility = b; + } + + /** + * Sets whether or not to perform an automatic call of checkLinks. */ public void setAutomaticCheckLinks(boolean b) { automaticCheckLinks = b; @@ -431,7 +438,7 @@ public abstract class JavadocTester { } /** - * Check the exit code of the most recent call of javadoc. + * Checks the exit code of the most recent call of javadoc. * * @param expected the exit code that is required for the test * to pass. @@ -446,7 +453,7 @@ public abstract class JavadocTester { } /** - * Check for content in (or not in) the generated output. + * Checks for content in (or not in) the generated output. * Within the search strings, the newline character \n * will be translated to the platform newline character sequence. * @param path a path within the most recent output directory @@ -465,7 +472,7 @@ public abstract class JavadocTester { } /** - * Check for content in (or not in) the generated output. + * Checks for content in (or not in) the generated output. * Within the search strings, the newline character \n * will be translated to the platform newline character sequence. * @param path a path within the most recent output directory, identifying @@ -487,7 +494,7 @@ public abstract class JavadocTester { } /** - * Check for content in (or not in) the one of the output streams written by + * Checks for content in (or not in) the one of the output streams written by * javadoc. Within the search strings, the newline character \n * will be translated to the platform newline character sequence. * @param output the output stream to check @@ -519,6 +526,11 @@ public abstract class JavadocTester { } } + /** + * Performs some structural accessibility checks on the files generated by the most + * recent run of javadoc. + * The checks can be run automatically by calling {@link #setAutomaticCheckAccessibility}. + */ public void checkAccessibility() { checking("Check accessibility"); A11yChecker c = new A11yChecker(out, this::readFile); @@ -536,6 +548,11 @@ public abstract class JavadocTester { } } + /** + * Checks all the links within the files generated by the most + * recent run of javadoc. + * The checks can be run automatically by calling {@link #setAutomaticCheckLinks}. + */ public void checkLinks() { checking("Check links"); LinkChecker c = new LinkChecker(out, this::readFile); @@ -554,7 +571,27 @@ public abstract class JavadocTester { } /** - * Get the content of the one of the output streams written by javadoc. + * Shows the heading structure for each of the specified files. + * The structure is is printed in plain text to the main output stream. + * No errors are reported (unless there is a problem reading a file) + * but missing headings are noted within the output. + * @params the files + */ + public void showHeadings(String... paths) { + ShowHeadings s = new ShowHeadings(out, this::readFile); + for (String p : paths) { + try { + File f = new File(outputDir, p); + s.checkFiles(List.of(f.toPath()), false, Collections.emptySet()); + } catch (IOException e) { + checking("Read file"); + failed("Error reading file: " + e); + } + } + } + + /** + * Gets the content of the one of the output streams written by javadoc. * @param output the name of the output stream * @return the content of the output stream */ @@ -563,7 +600,7 @@ public abstract class JavadocTester { } /** - * Get the content of the one of the output streams written by javadoc. + * Gets the content of the one of the output streams written by javadoc. * @param output the name of the output stream * @return the content of the output stream, as a line of lines */ @@ -573,7 +610,7 @@ public abstract class JavadocTester { } /** - * Check for files in (or not in) the generated output. + * Checks for files in (or not in) the generated output. * @param expectedFound true if all of the files are expected * to be found, or false if all of the files are expected to be * not found @@ -584,7 +621,7 @@ public abstract class JavadocTester { } /** - * Check for files in (or not in) the generated output. + * Checks for files in (or not in) the generated output. * @param expectedFound true if all of the files are expected * to be found, or false if all of the files are expected to be * not found @@ -605,7 +642,7 @@ public abstract class JavadocTester { } /** - * Check that a series of strings are found in order in a file in + * Checks that a series of strings are found in order in a file in * the generated output. * @param path the file to check * @param strings the strings whose order to check @@ -658,7 +695,7 @@ public abstract class JavadocTester { } /** - * Compare a set of files in each of two directories. + * Compares a set of files in each of two directories. * * @param baseDir1 the directory containing the first set of files * @param baseDir2 the directory containing the second set of files @@ -673,7 +710,7 @@ public abstract class JavadocTester { } /** - * A utility to copy a directory from one place to another. + * Copies a directory from one place to another. * * @param targetDir the directory to copy. * @param destDir the destination to copy the directory to. @@ -707,7 +744,7 @@ public abstract class JavadocTester { } /** - * Copy source file to destination file. + * Copies a file. * * @param destfile the destination file * @param srcfile the source file @@ -749,7 +786,7 @@ public abstract class JavadocTester { } /** - * Read the file and return it as a string. + * Reads the file and return it as a string. * * @param baseDir the directory in which to locate the file * @param fileName the name of the file to read @@ -825,7 +862,7 @@ public abstract class JavadocTester { } /** - * Print a summary of the test results. + * Prints a summary of the test results. */ protected void printSummary() { String javadocRuns = (javadocRunNum <= 1) ? "" @@ -845,7 +882,7 @@ public abstract class JavadocTester { } /** - * Search for the string in the given file and return true + * Searches for the string in the given file and return true * if the string was found. * * @param fileString the contents of the file to search through @@ -861,7 +898,7 @@ public abstract class JavadocTester { } /** - * Compare the two given files. + * Compares the two given files. * * @param baseDir1 the directory in which to locate the first file * @param baseDir2 the directory in which to locate the second file diff --git a/test/langtools/jdk/javadoc/lib/javadoc/tester/ShowHeadings.java b/test/langtools/jdk/javadoc/lib/javadoc/tester/ShowHeadings.java new file mode 100644 index 00000000000..c18186d06d3 --- /dev/null +++ b/test/langtools/jdk/javadoc/lib/javadoc/tester/ShowHeadings.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2019, 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 javadoc.tester; + +import java.io.PrintStream; +import java.nio.file.Path; +import java.util.Map; +import java.util.function.Function; + +public class ShowHeadings extends HtmlChecker { + + private int currLevel; + + private boolean copyContent; + + ShowHeadings(PrintStream out, Function fileReader) { + super(out, fileReader); + } + + @Override + public void report() { + } + + @Override + public void startFile(Path path) { + out.println("Headings: " + path); + currLevel = 0; + } + + @Override + public void endFile() { + } + + @Override + public void docType(String doctype) { + } + + @Override + public void startElement(String name, Map attrs, boolean selfClosing) { + switch (name) { + case "h1": case "h2": case "h3": case "h4": case "h5": case "h6": + startHeading(name); + break; + } + } + + @Override + public void endElement(String name) { + switch (name) { + case "h1": case "h2": case "h3": case "h4": case "h5": case "h6": + out.println(); + copyContent = false; + break; + } + + } + + private void startHeading(String h) { + int level = Character.digit(h.charAt(1), 10); + while (level > currLevel + 1) { + currLevel++; + out.println("* ".repeat(currLevel - 1) + "H" + currLevel + ": *** MISSING ***"); + } + currLevel = level; + out.print("* ".repeat(currLevel - 1) + "H" + currLevel + ": "); + copyContent = true; + } + + @Override + public void content(String s) { + if (copyContent) { + out.print(s.replace(" ", " ") + .replace("<", "<") + .replace(">", ">") + .replace("&", "&") + .replaceAll("\\s+", " ") + ); + } + } +} + From 4aafd7b06ebbe297b2a67be5615c0dd151d54924 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Thu, 21 Feb 2019 15:05:47 -0800 Subject: [PATCH 071/109] 8219497: Unused parameter in HtmlDocletWriter::printHtmlDocument Reviewed-by: hannesw --- .../doclets/formats/html/AbstractModuleIndexWriter.java | 2 -- .../doclets/formats/html/AbstractPackageIndexWriter.java | 2 +- .../doclets/formats/html/AllClassesFrameWriter.java | 2 +- .../doclets/formats/html/AllClassesIndexWriter.java | 2 +- .../doclets/formats/html/AllPackagesIndexWriter.java | 2 +- .../doclets/formats/html/AnnotationTypeWriterImpl.java | 2 +- .../internal/doclets/formats/html/ClassUseWriter.java | 2 +- .../internal/doclets/formats/html/ClassWriterImpl.java | 2 +- .../doclets/formats/html/ConstantsSummaryWriterImpl.java | 2 +- .../doclets/formats/html/DeprecatedListWriter.java | 2 +- .../doclets/formats/html/DocFilesHandlerImpl.java | 2 +- .../javadoc/internal/doclets/formats/html/HelpWriter.java | 2 +- .../internal/doclets/formats/html/HtmlDocletWriter.java | 8 +------- .../internal/doclets/formats/html/ModuleFrameWriter.java | 1 - .../internal/doclets/formats/html/ModuleWriterImpl.java | 2 +- .../internal/doclets/formats/html/PackageFrameWriter.java | 1 - .../internal/doclets/formats/html/PackageTreeWriter.java | 2 +- .../internal/doclets/formats/html/PackageUseWriter.java | 1 - .../internal/doclets/formats/html/PackageWriterImpl.java | 2 +- .../doclets/formats/html/SerializedFormWriterImpl.java | 2 +- .../internal/doclets/formats/html/SingleIndexWriter.java | 2 +- .../internal/doclets/formats/html/SplitIndexWriter.java | 2 +- .../javadoc/internal/doclets/formats/html/TreeWriter.java | 2 +- 23 files changed, 19 insertions(+), 30 deletions(-) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java index 7927c4805ed..547f8ccd4f0 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java @@ -145,7 +145,6 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter { printHtmlDocument( configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle), description, - includeScript, body); } @@ -178,7 +177,6 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter { printHtmlDocument( configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle), description, - includeScript, body); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java index cc254f57c3c..e1554fbeffb 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java @@ -129,7 +129,7 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter { body.addContent(footer); printHtmlDocument( configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle), - description, includeScript, body); + description, body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java index 86931ef0010..e73d48a28a3 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java @@ -120,7 +120,7 @@ public class AllClassesFrameWriter extends HtmlDocletWriter { HtmlTree div = HtmlTree.DIV(HtmlStyle.indexContainer, ul); htmlTree.addContent(div); body.addContent(htmlTree); - printHtmlDocument(null, "all classes (frame)", false, body); + printHtmlDocument(null, "all classes (frame)", body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java index 906073e7e95..95e6dae4aa9 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java @@ -116,7 +116,7 @@ public class AllClassesIndexWriter extends HtmlDocletWriter { footer.addContent(navBar.getContent(false)); addBottom(footer); bodyTree.addContent(footer); - printHtmlDocument(null, "class index", true, bodyTree); + printHtmlDocument(null, "class index", bodyTree); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java index 545dd7475b4..136075acb04 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java @@ -104,7 +104,7 @@ public class AllPackagesIndexWriter extends HtmlDocletWriter { footer.addContent(navBar.getContent(false)); addBottom(footer); bodyTree.addContent(footer); - printHtmlDocument(null, "package index", true, bodyTree); + printHtmlDocument(null, "package index", bodyTree); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java index ef68b8b194b..f672ff781d1 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java @@ -155,7 +155,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter PackageElement pkg = utils.containingPackage(this.annotationType); Content stylesheetContent = getLocalStylesheetContent(pkg); printHtmlDocument(configuration.metakeywords.getMetaKeywords(annotationType), - description, true, stylesheetContent, contentTree); + description, stylesheetContent, contentTree); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java index 655edfe5167..06decfb3f7a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java @@ -240,7 +240,7 @@ public class ClassUseWriter extends SubWriterHolderWriter { addBottom(footer); body.addContent(footer); String description = getDescription("use", typeElement); - printHtmlDocument(null, description, true, body); + printHtmlDocument(null, description, body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java index 3ed401ae47a..e1393e5e54c 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java @@ -180,7 +180,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite PackageElement pkg = utils.containingPackage(typeElement); Content stylesheetContent = getLocalStylesheetContent(pkg); printHtmlDocument(configuration.metakeywords.getMetaKeywords(typeElement), - description, true, stylesheetContent, contentTree); + description, stylesheetContent, contentTree); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java index 3c381de5f5d..292ce447de5 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java @@ -327,6 +327,6 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons */ @Override public void printDocument(Content contentTree) throws DocFileIOException { - printHtmlDocument(null, "summary of constants", true, contentTree); + printHtmlDocument(null, "summary of constants", contentTree); } } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java index e951fcd3961..973001b6a96 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java @@ -308,7 +308,7 @@ public class DeprecatedListWriter extends SubWriterHolderWriter { addBottom(htmlTree); body.addContent(htmlTree); String description = "deprecated elements"; - printHtmlDocument(null, description, true, body); + printHtmlDocument(null, description, body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java index a012f0f5a42..54654e62038 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java @@ -206,7 +206,7 @@ public class DocFilesHandlerImpl implements DocFilesHandler { footer.addContent(navBar.getContent(false)); docletWriter.addBottom(footer); htmlContent.addContent(footer); - docletWriter.printHtmlDocument(Collections.emptyList(), null, false, localTagsContent, htmlContent); + docletWriter.printHtmlDocument(Collections.emptyList(), null, localTagsContent, htmlContent); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java index 07c43f13540..18c96954dd9 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java @@ -99,7 +99,7 @@ public class HelpWriter extends HtmlDocletWriter { htmlTree.addContent(navBar.getContent(false)); addBottom(htmlTree); body.addContent(htmlTree); - printHtmlDocument(null, "help", true, body); + printHtmlDocument(null, "help", body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java index 39f04b2a88d..5590ccd6d2d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java @@ -423,17 +423,14 @@ public class HtmlDocletWriter { * of the array is assigned to a separate META tag. * Pass in null for no array * @param description the content for the description META tag. - * @param includeScript true if printing windowtitle script - * false for files that appear in the left-hand frames * @param body the body htmltree to be included in the document * @throws DocFileIOException if there is a problem writing the file */ public void printHtmlDocument(List metakeywords, String description, - boolean includeScript, Content body) throws DocFileIOException { - printHtmlDocument(metakeywords, description, includeScript, new ContentBuilder(), body); + printHtmlDocument(metakeywords, description, new ContentBuilder(), body); } /** @@ -443,15 +440,12 @@ public class HtmlDocletWriter { * of the array is assigned to a separate META tag. * Pass in null for no array * @param description the content for the description META tag. - * @param includeScript true if printing windowtitle script - * false for files that appear in the left-hand frames * @param extraHeadContent any additional content to be included in the HEAD element * @param body the body htmltree to be included in the document * @throws DocFileIOException if there is a problem writing the file */ public void printHtmlDocument(List metakeywords, String description, - boolean includeScript, Content extraHeadContent, Content body) throws DocFileIOException { diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java index 1e328498978..3c87223b65a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java @@ -111,7 +111,6 @@ public class ModuleFrameWriter extends HtmlDocletWriter { mdlgen.printHtmlDocument( configuration.metakeywords.getMetaKeywordsForModule(moduleElement), "module summary (frame)", - false, body); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java index 1098e3f1891..419341181d7 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java @@ -915,7 +915,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW public void printDocument(Content contentTree) throws DocFileIOException { printHtmlDocument(configuration.metakeywords.getMetaKeywordsForModule(mdle), getDescription("declaration", mdle), - true, contentTree); + contentTree); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java index 7a0857b9fab..f6f96d354c6 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java @@ -112,7 +112,6 @@ public class PackageFrameWriter extends HtmlDocletWriter { packgen.printHtmlDocument( configuration.metakeywords.getMetaKeywords(packageElement), getDescription("package summary (frame)", packageElement), - false, body); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java index 98de33e8acb..c72d34f2d33 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java @@ -120,7 +120,7 @@ public class PackageTreeWriter extends AbstractTreeWriter { footer.addContent(navBar.getContent(false)); addBottom(footer); body.addContent(footer); - printHtmlDocument(null, getDescription("tree", packageElement), true, body); + printHtmlDocument(null, getDescription("tree", packageElement), body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java index a0f17d28277..ba6f2455d2a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java @@ -142,7 +142,6 @@ public class PackageUseWriter extends SubWriterHolderWriter { body.addContent(footer); printHtmlDocument(null, getDescription("use", packageElement), - true, body); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java index 2a85edae038..edf5d8f6532 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java @@ -318,6 +318,6 @@ public class PackageWriterImpl extends HtmlDocletWriter String description = getDescription("declaration", packageElement); Content stylesheetContent = getLocalStylesheetContent(packageElement); printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageElement), - description, true, stylesheetContent, contentTree); + description, stylesheetContent, contentTree); } } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java index 986e3618c3a..4bb1ca78071 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java @@ -253,7 +253,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter */ @Override public void printDocument(Content serializedTree) throws DocFileIOException { - printHtmlDocument(null, "serialized forms", true, serializedTree); + printHtmlDocument(null, "serialized forms", serializedTree); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java index c2361d3710a..b65b36a2124 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java @@ -121,7 +121,7 @@ public class SingleIndexWriter extends AbstractIndexWriter { addBottom(htmlTree); body.addContent(htmlTree); createSearchIndexFiles(); - printHtmlDocument(null, "index", true, body); + printHtmlDocument(null, "index", body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java index b03b9018e5e..2bfa1b2eea3 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java @@ -145,7 +145,7 @@ public class SplitIndexWriter extends AbstractIndexWriter { addBottom(footer); body.addContent(footer); String description = "index: " + unicode; - printHtmlDocument(null, description, true, body); + printHtmlDocument(null, description, body); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java index 50b27b73b2d..f38e624431c 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java @@ -126,7 +126,7 @@ public class TreeWriter extends AbstractTreeWriter { htmlTree.addContent(navBar.getContent(false)); addBottom(htmlTree); body.addContent(htmlTree); - printHtmlDocument(null, "class tree", true, body); + printHtmlDocument(null, "class tree", body); } /** From 46666a2d94db00d415d088f28f339c70123985a3 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Thu, 21 Feb 2019 15:17:42 -0800 Subject: [PATCH 072/109] 8216170: java.lang.IllegalArgumentException: directories not supported Reviewed-by: hannesw --- .../javadoc/internal/tool/JavadocTool.java | 17 +++- .../testJavaPackage/TestJavaPackage.java | 86 +++++++++++++++++++ 2 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 test/langtools/jdk/javadoc/doclet/testJavaPackage/TestJavaPackage.java diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java index f319a7affee..db41927ba81 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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,9 @@ package jdk.javadoc.internal.tool; - -import java.io.File; +import java.nio.file.Files; +import java.nio.file.InvalidPathException; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedHashSet; @@ -165,7 +166,7 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler { // Normally, the args should be a series of package names or file names. // Parse the files and collect the package names. for (String arg: javaNames) { - if (fm != null && arg.endsWith(".java") && new File(arg).exists()) { + if (fm != null && arg.endsWith(".java") && isRegularFile(arg)) { parse(fm.getJavaFileObjects(arg), classTrees, true); } else if (isValidPackageName(arg)) { packageNames.add(arg); @@ -247,6 +248,14 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler { return toolEnv.docEnv; } + private boolean isRegularFile(String s) { + try { + return Files.isRegularFile(Paths.get(s)); + } catch (InvalidPathException e) { + return false; + } + } + /** Is the given string a valid package name? */ boolean isValidPackageName(String s) { if (s.contains("/")) { diff --git a/test/langtools/jdk/javadoc/doclet/testJavaPackage/TestJavaPackage.java b/test/langtools/jdk/javadoc/doclet/testJavaPackage/TestJavaPackage.java new file mode 100644 index 00000000000..92cf4a91417 --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/testJavaPackage/TestJavaPackage.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2019, 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 8216170 + * @summary java.lang.IllegalArgumentException: directories not supported + * @library /tools/lib ../../lib + * @modules jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * jdk.javadoc/jdk.javadoc.internal.api + * jdk.javadoc/jdk.javadoc.internal.tool + * @build toolbox.ToolBox javadoc.tester.* + * @run main TestJavaPackage + */ + +import java.io.IOException; +import java.nio.file.Path; + +import toolbox.ModuleBuilder; +import toolbox.ToolBox; + +import javadoc.tester.JavadocTester; + +public class TestJavaPackage extends JavadocTester { + public static void main(String... args) throws Exception { + TestJavaPackage tester = new TestJavaPackage(); + tester.runTests(); + } + + private final ToolBox tb = new ToolBox(); + + @Test + public void testPackage() throws IOException { + Path src = Path.of("src"); + tb.writeJavaFiles(src, + "module com.example.java { exports com.example.java; }", + "package com.example.java; public class C { }"); + + // Disable the standard check that the output directory is empty. + // It is a significant part of the test case that the output directory + // is set to the current directory, which (in this case) also contains + // the src/ directory. + setOutputDirectoryCheck(DirectoryCheck.NONE); + + javadoc("-d", ".", // using "." is important for the test case + "-sourcepath", src.toString(), + "com.example.java"); + checkExit(Exit.OK); + checkFiles(true, + "com.example.java/com/example/java/C.html"); + + // repeat the call, to verify the package name "com.example.java" is not + // confused with the output directory for the "com.example.java" module, + // created by the first call + + javadoc("-d", ".", // using "." is important for the test case + "-sourcepath", src.toString(), + "com.example.java"); + checkExit(Exit.OK); + checkFiles(true, + "com.example.java/com/example/java/C.html"); + } +} + + From 15d554b3950fbd81e5a2d51af813802a27bb9ec4 Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Thu, 21 Feb 2019 16:56:06 -0800 Subject: [PATCH 073/109] 8214777: Avoid some GCC 8.X strncpy() errors in HotSpot Reviewed-by: kbarrett, rehn --- src/hotspot/os/aix/os_perf_aix.cpp | 8 ++------ src/hotspot/os/linux/os_perf_linux.cpp | 8 ++------ src/hotspot/os/posix/os_posix.cpp | 7 ++++--- src/hotspot/os/solaris/os_perf_solaris.cpp | 8 ++------ src/hotspot/os/windows/os_perf_windows.cpp | 11 ++--------- src/hotspot/os/windows/os_windows.cpp | 9 +++++---- .../share/classfile/classFileParser.cpp | 19 +++++++------------ .../share/classfile/classLoaderExt.cpp | 12 ++++++------ src/hotspot/share/classfile/verifier.cpp | 16 +++++++--------- src/hotspot/share/runtime/arguments.cpp | 12 +++++++++--- .../share/services/diagnosticArgument.cpp | 8 ++++---- src/hotspot/share/utilities/xmlstream.cpp | 14 +++++++++----- 12 files changed, 59 insertions(+), 73 deletions(-) diff --git a/src/hotspot/os/aix/os_perf_aix.cpp b/src/hotspot/os/aix/os_perf_aix.cpp index 6c296c5915a..033bf843095 100644 --- a/src/hotspot/os/aix/os_perf_aix.cpp +++ b/src/hotspot/os/aix/os_perf_aix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, 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 @@ -859,11 +859,7 @@ char* SystemProcessInterface::SystemProcesses::ProcessIterator::get_exe_path() { char* SystemProcessInterface::SystemProcesses::ProcessIterator::allocate_string(const char* str) const { if (str != NULL) { - size_t len = strlen(str); - char* tmp = NEW_C_HEAP_ARRAY(char, len+1, mtInternal); - strncpy(tmp, str, len); - tmp[len] = '\0'; - return tmp; + return os::strdup_check_oom(str, mtInternal); } return NULL; } diff --git a/src/hotspot/os/linux/os_perf_linux.cpp b/src/hotspot/os/linux/os_perf_linux.cpp index be204a7af6e..5008fb274c4 100644 --- a/src/hotspot/os/linux/os_perf_linux.cpp +++ b/src/hotspot/os/linux/os_perf_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, 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 @@ -861,11 +861,7 @@ char* SystemProcessInterface::SystemProcesses::ProcessIterator::get_exe_path() { char* SystemProcessInterface::SystemProcesses::ProcessIterator::allocate_string(const char* str) const { if (str != NULL) { - size_t len = strlen(str); - char* tmp = NEW_C_HEAP_ARRAY(char, len+1, mtInternal); - strncpy(tmp, str, len); - tmp[len] = '\0'; - return tmp; + return os::strdup_check_oom(str, mtInternal); } return NULL; } diff --git a/src/hotspot/os/posix/os_posix.cpp b/src/hotspot/os/posix/os_posix.cpp index b416bc2b266..77ee13b5a5d 100644 --- a/src/hotspot/os/posix/os_posix.cpp +++ b/src/hotspot/os/posix/os_posix.cpp @@ -180,13 +180,14 @@ int os::create_file_for_heap(const char* dir) { const char name_template[] = "/jvmheap.XXXXXX"; - char *fullname = (char*)os::malloc((strlen(dir) + strlen(name_template) + 1), mtInternal); + size_t fullname_len = strlen(dir) + strlen(name_template); + char *fullname = (char*)os::malloc(fullname_len + 1, mtInternal); if (fullname == NULL) { vm_exit_during_initialization(err_msg("Malloc failed during creation of backing file for heap (%s)", os::strerror(errno))); return -1; } - (void)strncpy(fullname, dir, strlen(dir)+1); - (void)strncat(fullname, name_template, strlen(name_template)); + int n = snprintf(fullname, fullname_len + 1, "%s%s", dir, name_template); + assert((size_t)n == fullname_len, "Unexpected number of characters in string"); os::native_path(fullname); diff --git a/src/hotspot/os/solaris/os_perf_solaris.cpp b/src/hotspot/os/solaris/os_perf_solaris.cpp index f2fc73b24a7..c67a9494fb1 100644 --- a/src/hotspot/os/solaris/os_perf_solaris.cpp +++ b/src/hotspot/os/solaris/os_perf_solaris.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, 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 @@ -544,11 +544,7 @@ bool SystemProcessInterface::SystemProcesses::ProcessIterator::is_valid_entry(st char* SystemProcessInterface::SystemProcesses::ProcessIterator::allocate_string(const char* str) const { if (str != NULL) { - size_t len = strlen(str); - char* tmp = NEW_C_HEAP_ARRAY(char, len+1, mtInternal); - strncpy(tmp, str, len); - tmp[len] = '\0'; - return tmp; + return os::strdup_check_oom(str, mtInternal); } return NULL; } diff --git a/src/hotspot/os/windows/os_perf_windows.cpp b/src/hotspot/os/windows/os_perf_windows.cpp index cdffca9ff48..7af7e0924f0 100644 --- a/src/hotspot/os/windows/os_perf_windows.cpp +++ b/src/hotspot/os/windows/os_perf_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, 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 @@ -1253,14 +1253,7 @@ int SystemProcessInterface::SystemProcesses::ProcessIterator::current(SystemProc char* SystemProcessInterface::SystemProcesses::ProcessIterator::allocate_string(const char* str) const { if (str != NULL) { - size_t len = strlen(str); - char* tmp = NEW_C_HEAP_ARRAY(char, len+1, mtInternal); - if (NULL == tmp) { - return NULL; - } - strncpy(tmp, str, len); - tmp[len] = '\0'; - return tmp; + return os::strdup_check_oom(str, mtInternal); } return NULL; } diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index abe2b2be714..7dc28ffd283 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -2970,14 +2970,15 @@ void os::large_page_init() { int os::create_file_for_heap(const char* dir) { const char name_template[] = "/jvmheap.XXXXXX"; - char *fullname = (char*)os::malloc((strlen(dir) + strlen(name_template) + 1), mtInternal); + + size_t fullname_len = strlen(dir) + strlen(name_template); + char *fullname = (char*)os::malloc(fullname_len + 1, mtInternal); if (fullname == NULL) { vm_exit_during_initialization(err_msg("Malloc failed during creation of backing file for heap (%s)", os::strerror(errno))); return -1; } - - (void)strncpy(fullname, dir, strlen(dir)+1); - (void)strncat(fullname, name_template, strlen(name_template)); + int n = snprintf(fullname, fullname_len + 1, "%s%s", dir, name_template); + assert((size_t)n == fullname_len, "Unexpected number of characters in string"); os::native_path(fullname); diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp index 8508e45b810..b2b776f724a 100644 --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -5743,16 +5743,13 @@ void ClassFileParser::prepend_host_package_name(const InstanceKlass* unsafe_anon ClassLoader::package_from_name(unsafe_anonymous_host->name()->as_C_string(), NULL); if (host_pkg_name != NULL) { - size_t host_pkg_len = strlen(host_pkg_name); + int host_pkg_len = (int)strlen(host_pkg_name); int class_name_len = _class_name->utf8_length(); - char* new_anon_name = - NEW_RESOURCE_ARRAY(char, host_pkg_len + 1 + class_name_len); - // Copy host package name and trailing /. - strncpy(new_anon_name, host_pkg_name, host_pkg_len); - new_anon_name[host_pkg_len] = '/'; - // Append unsafe anonymous class name. The unsafe anonymous class name can contain odd - // characters. So, do a strncpy instead of using sprintf("%s..."). - strncpy(new_anon_name + host_pkg_len + 1, (char *)_class_name->base(), class_name_len); + int symbol_len = host_pkg_len + 1 + class_name_len; + char* new_anon_name = NEW_RESOURCE_ARRAY(char, symbol_len + 1); + int n = snprintf(new_anon_name, symbol_len + 1, "%s/%.*s", + host_pkg_name, class_name_len, _class_name->base()); + assert(n == symbol_len, "Unexpected number of characters in string"); // Decrement old _class_name to avoid leaking. _class_name->decrement_refcount(); @@ -5761,9 +5758,7 @@ void ClassFileParser::prepend_host_package_name(const InstanceKlass* unsafe_anon // The new class name is created with a refcount of one. When installed into the InstanceKlass, // it'll be two and when the ClassFileParser destructor runs, it'll go back to one and get deleted // when the class is unloaded. - _class_name = SymbolTable::new_symbol(new_anon_name, - (int)host_pkg_len + 1 + class_name_len, - CHECK); + _class_name = SymbolTable::new_symbol(new_anon_name, symbol_len, CHECK); } } diff --git a/src/hotspot/share/classfile/classLoaderExt.cpp b/src/hotspot/share/classfile/classLoaderExt.cpp index de6e1923989..a1a5cc562a1 100644 --- a/src/hotspot/share/classfile/classLoaderExt.cpp +++ b/src/hotspot/share/classfile/classLoaderExt.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, 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 @@ -203,13 +203,13 @@ void ClassLoaderExt::process_jar_manifest(ClassPathEntry* entry, file_end = end; } - int name_len = (int)strlen(file_start); + size_t name_len = strlen(file_start); if (name_len > 0) { ResourceMark rm(THREAD); - char* libname = NEW_RESOURCE_ARRAY(char, dir_len + name_len + 1); - *libname = 0; - strncat(libname, dir_name, dir_len); - strncat(libname, file_start, name_len); + size_t libname_len = dir_len + name_len; + char* libname = NEW_RESOURCE_ARRAY(char, libname_len + 1); + int n = snprintf(libname, libname_len + 1, "%.*s%s", dir_len, dir_name, file_start); + assert((size_t)n == libname_len, "Unexpected number of characters in string"); trace_class_path("library = ", libname); ClassLoader::update_class_path_entry_list(libname, true, false); } diff --git a/src/hotspot/share/classfile/verifier.cpp b/src/hotspot/share/classfile/verifier.cpp index 97cf4e7ff50..8e301f9f20b 100644 --- a/src/hotspot/share/classfile/verifier.cpp +++ b/src/hotspot/share/classfile/verifier.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -2981,18 +2981,16 @@ void ClassVerifier::verify_anewarray( } // add one dimension to component length++; - arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length); - arr_sig_str[0] = '['; - strncpy(&arr_sig_str[1], component_name, length - 1); + arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length + 1); + int n = snprintf(arr_sig_str, length + 1, "[%s", component_name); + assert(n == length, "Unexpected number of characters in string"); } else { // it's an object or interface const char* component_name = component_type.name()->as_utf8(); // add one dimension to component with 'L' prepended and ';' postpended. length = (int)strlen(component_name) + 3; - arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length); - arr_sig_str[0] = '['; - arr_sig_str[1] = 'L'; - strncpy(&arr_sig_str[2], component_name, length - 2); - arr_sig_str[length - 1] = ';'; + arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length + 1); + int n = snprintf(arr_sig_str, length + 1, "[L%s;", component_name); + assert(n == length, "Unexpected number of characters in string"); } Symbol* arr_sig = create_temporary_symbol( arr_sig_str, length, CHECK_VERIFY(this)); diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 27985cb64d8..b3feb5155b9 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -2454,9 +2454,15 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m (is_absolute_path = match_option(option, "-agentpath:", &tail))) { if(tail != NULL) { const char* pos = strchr(tail, '='); - size_t len = (pos == NULL) ? strlen(tail) : pos - tail; - char* name = strncpy(NEW_C_HEAP_ARRAY(char, len + 1, mtArguments), tail, len); - name[len] = '\0'; + char* name; + if (pos == NULL) { + name = os::strdup_check_oom(tail, mtArguments); + } else { + size_t len = pos - tail; + name = NEW_C_HEAP_ARRAY(char, len + 1, mtArguments); + memcpy(name, tail, len); + name[len] = '\0'; + } char *options = NULL; if(pos != NULL) { diff --git a/src/hotspot/share/services/diagnosticArgument.cpp b/src/hotspot/share/services/diagnosticArgument.cpp index c3d6886bd9e..9dfe4786bac 100644 --- a/src/hotspot/share/services/diagnosticArgument.cpp +++ b/src/hotspot/share/services/diagnosticArgument.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2019, 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 @@ -179,9 +179,9 @@ template <> void DCmdArgument::parse_value(const char* str, if (str == NULL) { _value = NULL; } else { - _value = NEW_C_HEAP_ARRAY(char, len+1, mtInternal); - strncpy(_value, str, len); - _value[len] = 0; + _value = NEW_C_HEAP_ARRAY(char, len + 1, mtInternal); + int n = snprintf(_value, len + 1, "%.*s", (int)len, str); + assert((size_t)n <= len, "Unexpected number of characters in string"); } } diff --git a/src/hotspot/share/utilities/xmlstream.cpp b/src/hotspot/share/utilities/xmlstream.cpp index 904c45ce4f4..a7922fd478e 100644 --- a/src/hotspot/share/utilities/xmlstream.cpp +++ b/src/hotspot/share/utilities/xmlstream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2019, 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 @@ -353,11 +353,15 @@ void xmlStream::va_done(const char* format, va_list ap) { guarantee(format_len + 10 < sizeof(buffer), "bigger format buffer"); const char* kind = format; const char* kind_end = strchr(kind, ' '); - size_t kind_len = (kind_end != NULL) ? (kind_end - kind) : format_len; - strncpy(buffer, kind, kind_len); - strcpy(buffer + kind_len, "_done"); + size_t kind_len; if (kind_end != NULL) { - strncat(buffer, format + kind_len, sizeof(buffer) - (kind_len + 5 /* _done */) - 1); + kind_len = kind_end - kind; + int n = snprintf(buffer, sizeof(buffer), "%.*s_done", (int)kind_len, kind); + assert((size_t)n < sizeof(buffer), "Unexpected number of characters in string"); + } else { + kind_len = format_len; + int n = snprintf(buffer, sizeof(buffer), "%s_done%s", kind, kind + kind_len); + assert((size_t)n < sizeof(buffer), "Unexpected number of characters in string"); } // Output the trailing event with the timestamp. va_begin_elem(buffer, ap); From b7ed42eedd09fcf96c4fd2e2f7d974e14ad3de78 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Thu, 21 Feb 2019 17:50:27 -0800 Subject: [PATCH 074/109] 8219558: jdk/javadoc tests fail with missing headings: h1 Reviewed-by: darcy --- .../formats/html/AbstractIndexWriter.java | 6 +- .../formats/html/AbstractMemberWriter.java | 16 ++- .../html/AbstractModuleIndexWriter.java | 5 +- .../html/AbstractPackageIndexWriter.java | 3 +- .../formats/html/AbstractTreeWriter.java | 5 +- .../formats/html/AllClassesFrameWriter.java | 3 +- .../formats/html/AllClassesIndexWriter.java | 3 +- .../formats/html/AllPackagesIndexWriter.java | 3 +- .../html/AnnotationTypeFieldWriterImpl.java | 13 +- ...nnotationTypeOptionalMemberWriterImpl.java | 8 +- ...nnotationTypeRequiredMemberWriterImpl.java | 14 +- .../html/AnnotationTypeWriterImpl.java | 7 +- .../doclets/formats/html/ClassUseWriter.java | 5 +- .../doclets/formats/html/ClassWriterImpl.java | 7 +- .../html/ConstantsSummaryWriterImpl.java | 7 +- .../formats/html/ConstructorWriterImpl.java | 13 +- .../formats/html/DeprecatedListWriter.java | 5 +- .../formats/html/EnumConstantWriterImpl.java | 14 +- .../doclets/formats/html/FieldWriterImpl.java | 16 ++- .../doclets/formats/html/Headings.java | 134 ------------------ .../doclets/formats/html/HelpWriter.java | 31 ++-- .../formats/html/HtmlConfiguration.java | 11 +- .../formats/html/HtmlSerialFieldWriter.java | 10 +- .../formats/html/HtmlSerialMethodWriter.java | 10 +- .../formats/html/MethodWriterImpl.java | 15 +- .../formats/html/ModuleFrameWriter.java | 5 +- .../formats/html/ModuleIndexFrameWriter.java | 25 ++-- .../html/ModulePackageIndexFrameWriter.java | 27 ++-- .../formats/html/ModuleWriterImpl.java | 13 +- .../formats/html/NestedClassWriterImpl.java | 11 +- .../formats/html/PackageFrameWriter.java | 5 +- .../formats/html/PackageIndexFrameWriter.java | 5 +- .../formats/html/PackageTreeWriter.java | 3 +- .../formats/html/PackageUseWriter.java | 3 +- .../formats/html/PackageWriterImpl.java | 3 +- .../formats/html/PropertyWriterImpl.java | 15 +- .../html/SerializedFormWriterImpl.java | 10 +- .../doclets/formats/html/TreeWriter.java | 3 +- .../HtmlConstants.java} | 116 +++++++++++---- .../formats/html/markup/Navigation.java | 7 +- .../builders/SerializedFormBuilder.java | 6 +- .../doclets/toolkit/resources/stylesheet.css | 22 +-- .../TestAnnotationTypes.java | 8 +- .../doclet/testHeadings/TestHeadings.java | 21 ++- .../doclet/testHiddenTag/TestHiddenTag.java | 4 +- .../jdk/javadoc/doclet/testHref/TestHref.java | 2 +- .../TestHtmlLandmarkRegions.java | 12 +- .../testHtmlVersion/TestHtmlVersion.java | 84 +++++------ .../testIndexTaglet/TestIndexTaglet.java | 6 +- .../doclet/testInterface/TestInterface.java | 8 +- .../javadoc/doclet/testJavaFX/TestJavaFX.java | 32 ++--- .../testModules/TestModuleServices.java | 14 +- .../doclet/testModules/TestModules.java | 2 +- .../TestNewLanguageFeatures.java | 6 +- .../doclet/testOptions/TestOptions.java | 4 +- .../doclet/testOrdering/TestOrdering.java | 90 ++++++------ .../TestBadOverride.java | 4 +- .../TestSerializedForm.java | 12 +- .../TestSummaryHeading.java | 4 +- .../doclet/testSummaryTag/TestSummaryTag.java | 2 +- .../TestSystemPropertyTaglet.java | 6 +- .../lib/javadoc/tester/JavadocTester.java | 79 +++-------- .../lib/javadoc/tester/ShowHeadings.java | 102 ------------- 63 files changed, 485 insertions(+), 660 deletions(-) delete mode 100644 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Headings.java rename src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/{MarkerComments.java => markup/HtmlConstants.java} (62%) delete mode 100644 test/langtools/jdk/javadoc/lib/javadoc/tester/ShowHeadings.java diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java index 4af3df20a79..56e6c83aa3e 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019, 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 @@ -30,6 +30,7 @@ import java.util.*; import java.util.zip.*; import javax.lang.model.element.Element; +import javax.lang.model.element.ElementKind; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.ModuleElement; import javax.lang.model.element.PackageElement; @@ -37,6 +38,7 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.util.SimpleElementVisitor9; import com.sun.source.doctree.DocTree; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -168,7 +170,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter { String unicode = uc.toString(); contentTree.addContent(getMarkerAnchorForIndex(unicode)); Content headContent = new StringContent(unicode); - Content heading = HtmlTree.HEADING(Headings.CONTENT_HEADING, false, + Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, false, HtmlStyle.title, headContent); contentTree.addContent(heading); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java index 2d0025ee808..c57408a5fdd 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -40,10 +40,12 @@ import javax.lang.model.type.TypeMirror; import com.sun.source.doctree.DocTree; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; import jdk.javadoc.internal.doclets.formats.html.markup.Links; +import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter; import jdk.javadoc.internal.doclets.toolkit.Resources; @@ -373,6 +375,18 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter { return utils.getSimpleName(member); } + /** + * Get the header for the section. + * + * @param member the member being documented. + * @return a header content for the section. + */ + protected Content getHead(Element member) { + Content memberContent = new StringContent(name(member)); + Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, memberContent); + return heading; + } + /** * Return true if the given ProgramElement is inherited * by the class that is being documented. diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java index 547f8ccd4f0..61da535fbb3 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java @@ -33,6 +33,7 @@ import java.util.SortedMap; import javax.lang.model.element.ModuleElement; import javax.lang.model.element.PackageElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -221,7 +222,7 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter { * @param modules the modules to be documented * @param text string which will be used as the heading * @param tableSummary summary for the table - * @param header the document tree to which the navigational links will be added + * @param header the document tree to which the navgational links will be added * @param main the document tree to which the modules list will be added */ protected void addIndexContents(Collection modules, String text, @@ -267,7 +268,7 @@ public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter { protected void addConfigurationTitle(Content body) { if (configuration.doctitle.length() > 0) { Content title = new RawHtml(configuration.doctitle); - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.title, title); Content div = HtmlTree.DIV(HtmlStyle.header, heading); body.addContent(div); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java index e1554fbeffb..4189b8ba861 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java @@ -29,6 +29,7 @@ import java.util.*; import javax.lang.model.element.PackageElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -179,7 +180,7 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter { protected void addConfigurationTitle(Content body) { if (configuration.doctitle.length() > 0) { Content title = new RawHtml(configuration.doctitle); - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.title, title); Content div = HtmlTree.DIV(HtmlStyle.header, heading); body.addContent(div); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java index 82009fea847..fd310241a10 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -29,6 +29,7 @@ import java.util.*; import javax.lang.model.element.TypeElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -116,7 +117,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter { if (!sset.isEmpty()) { TypeElement firstTypeElement = sset.first(); Content headingContent = contents.getContent(heading); - Content sectionHeading = HtmlTree.HEADING(Headings.CONTENT_HEADING, true, + Content sectionHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true, headingContent); HtmlTree htmlTree = HtmlTree.SECTION(sectionHeading); addLevelInfo(!utils.isInterface(firstTypeElement) ? firstTypeElement : null, diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java index e73d48a28a3..d475ade3655 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java @@ -29,6 +29,7 @@ package jdk.javadoc.internal.doclets.formats.html; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -111,7 +112,7 @@ public class AllClassesFrameWriter extends HtmlDocletWriter { String label = resources.getText("doclet.All_Classes"); Content body = getBody(false, getWindowTitle(label)); Content htmlTree = HtmlTree.MAIN(); - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, contents.allClassesLabel); htmlTree.addContent(heading); Content ul = new HtmlTree(HtmlTag.UL); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java index 95e6dae4aa9..f9b8d22caef 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java @@ -32,6 +32,7 @@ import javax.lang.model.element.TypeElement; import com.sun.source.doctree.DocTree; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -147,7 +148,7 @@ public class AllClassesIndexWriter extends HtmlDocletWriter { } } Content titleContent = contents.allClassesLabel; - Content pHeading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, + Content pHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, HtmlStyle.title, titleContent); Content headerDiv = HtmlTree.DIV(HtmlStyle.header, pHeading); content.addContent(headerDiv); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java index 136075acb04..59b7ffee13f 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java @@ -27,6 +27,7 @@ package jdk.javadoc.internal.doclets.formats.html; import javax.lang.model.element.PackageElement; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -93,7 +94,7 @@ public class AllPackagesIndexWriter extends HtmlDocletWriter { div.setStyle(HtmlStyle.allPackagesContainer); addPackages(div); Content titleContent = contents.allPackagesLabel; - Content pHeading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, + Content pHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, HtmlStyle.title, titleContent); Content headerDiv = HtmlTree.DIV(HtmlStyle.header, pHeading); mainTree.addContent(headerDiv); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java index 4a219105603..db13176dd3a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, 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 @@ -33,6 +33,7 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeMirror; import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -71,7 +72,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { memberSummaryTree.addContent( - MarkerComments.START_OF_ANNOTATION_TYPE_FIELD_SUMMARY); + HtmlConstants.START_OF_ANNOTATION_TYPE_FIELD_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -95,7 +96,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter * {@inheritDoc} */ public void addAnnotationFieldDetailsMarker(Content memberDetails) { - memberDetails.addContent(MarkerComments.START_OF_ANNOTATION_TYPE_FIELD_DETAILS); + memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_FIELD_DETAILS); } /** @@ -106,7 +107,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter if (!writer.printedAnnotationFieldHeading) { memberDetailsTree.addContent(links.createAnchor( SectionName.ANNOTATION_TYPE_FIELD_DETAIL)); - Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, + Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, contents.fieldDetailsLabel); memberDetailsTree.addContent(heading); writer.printedAnnotationFieldHeading = true; @@ -120,7 +121,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter Content annotationDetailsTree) { annotationDetailsTree.addContent(links.createAnchor(name(member))); Content annotationDocTree = writer.getMemberTreeHeader(); - Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); + Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); heading.addContent(name(member)); annotationDocTree.addContent(heading); return annotationDocTree; @@ -187,7 +188,7 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter * {@inheritDoc} */ public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, contents.fieldSummaryLabel); memberTree.addContent(label); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java index a91f0fbc32f..a324361b0df 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, 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 @@ -33,7 +33,9 @@ import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; +import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeOptionalMemberWriter; import jdk.javadoc.internal.doclets.toolkit.Content; @@ -73,7 +75,7 @@ public class AnnotationTypeOptionalMemberWriterImpl extends public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { memberSummaryTree.addContent( - MarkerComments.START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY); + HtmlConstants.START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -110,7 +112,7 @@ public class AnnotationTypeOptionalMemberWriterImpl extends */ @Override public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, contents.annotateTypeOptionalMemberSummaryLabel); memberTree.addContent(label); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java index 2c23eba047e..dc0955391cd 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, 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 @@ -33,9 +33,11 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeMirror; import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; +import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeRequiredMemberWriter; import jdk.javadoc.internal.doclets.toolkit.Content; @@ -73,7 +75,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { memberSummaryTree.addContent( - MarkerComments.START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY); + HtmlConstants.START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -97,7 +99,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter * {@inheritDoc} */ public void addAnnotationDetailsMarker(Content memberDetails) { - memberDetails.addContent(MarkerComments.START_OF_ANNOTATION_TYPE_DETAILS); + memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_DETAILS); } /** @@ -108,7 +110,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter if (!writer.printedAnnotationHeading) { memberDetailsTree.addContent(links.createAnchor( SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL)); - Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, + Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, contents.annotationTypeDetailsLabel); memberDetailsTree.addContent(heading); writer.printedAnnotationHeading = true; @@ -124,7 +126,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter annotationDetailsTree.addContent(links.createAnchor( simpleName + utils.signature((ExecutableElement) member))); Content annotationDocTree = writer.getMemberTreeHeader(); - Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); + Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); heading.addContent(simpleName); annotationDocTree.addContent(heading); return annotationDocTree; @@ -191,7 +193,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter * {@inheritDoc} */ public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, contents.annotateTypeRequiredMemberSummaryLabel); memberTree.addContent(label); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java index f672ff781d1..cf1edeb4908 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java @@ -32,6 +32,7 @@ import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import com.sun.source.doctree.DocTree; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -94,7 +95,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter navBar.setUserHeader(getUserHeaderFooter(true)); htmlTree.addContent(navBar.getContent(true)); bodyTree.addContent(htmlTree); - bodyTree.addContent(MarkerComments.START_OF_CLASS_DATA); + bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.setStyle(HtmlStyle.header); if (configuration.showModules) { @@ -117,7 +118,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_HEADER, annotationType); Content headerContent = new StringContent(header); - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, + Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true, HtmlStyle.title, headerContent); heading.addContent(getTypeParameterLinks(linkInfo)); div.addContent(heading); @@ -138,7 +139,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter */ @Override public void addFooter(Content contentTree) { - contentTree.addContent(MarkerComments.END_OF_CLASS_DATA); + contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA); Content htmlTree = HtmlTree.FOOTER(); navBar.setUserFooter(getUserHeaderFooter(false)); htmlTree.addContent(navBar.getContent(false)); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java index 06decfb3f7a..8a351d929a5 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java @@ -42,6 +42,7 @@ import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -324,7 +325,7 @@ public class ClassUseWriter extends SubWriterHolderWriter { getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement)), getPackageLink(pkg, utils.getPackageName(pkg))); - Content heading = HtmlTree.HEADING(Headings.TypeUse.SUMMARY_HEADING, link); + Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link); htmlTree.addContent(heading); addClassUse(pkg, htmlTree); ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree)); @@ -451,7 +452,7 @@ public class ClassUseWriter extends SubWriterHolderWriter { headContent.addContent(contents.getContent("doclet.ClassUse_Title", cltype)); headContent.addContent(new HtmlTree(HtmlTag.BR)); headContent.addContent(clname); - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, + Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true, HtmlStyle.title, headContent); Content div = HtmlTree.DIV(HtmlStyle.header, heading); mainTree.addContent(div); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java index e1393e5e54c..4fd2a8b8108 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java @@ -36,6 +36,7 @@ import javax.lang.model.type.TypeMirror; import javax.lang.model.util.SimpleElementVisitor8; import com.sun.source.doctree.DocTree; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -115,7 +116,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite navBar.setUserHeader(getUserHeaderFooter(true)); htmlTree.addContent(navBar.getContent(true)); bodyTree.addContent(htmlTree); - bodyTree.addContent(MarkerComments.START_OF_CLASS_DATA); + bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.setStyle(HtmlStyle.header); if (configuration.showModules) { @@ -142,7 +143,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite //Let's not link to ourselves in the header. linkInfo.linkToSelf = false; Content headerContent = new StringContent(header); - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, + Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true, HtmlStyle.title, headerContent); heading.addContent(getTypeParameterLinks(linkInfo)); div.addContent(heading); @@ -163,7 +164,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite */ @Override public void addFooter(Content contentTree) { - contentTree.addContent(MarkerComments.END_OF_CLASS_DATA); + contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA); Content htmlTree = HtmlTree.FOOTER(); navBar.setUserFooter(getUserHeaderFooter(false)); htmlTree.addContent(navBar.getContent(false)); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java index 292ce447de5..5c7ff19ab1d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java @@ -36,6 +36,7 @@ import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -151,11 +152,11 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons @Override public void addContentsList(Content contentTree, Content contentListTree) { Content titleContent = contents.constantsSummaryTitle; - Content pHeading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, + Content pHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, HtmlStyle.title, titleContent); Content div = HtmlTree.DIV(HtmlStyle.header, pHeading); Content headingContent = contents.contentsHeading; - Content heading = HtmlTree.HEADING(Headings.CONTENT_HEADING, true, + Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true, headingContent); HtmlTree section = HtmlTree.SECTION(heading); section.addContent(contentListTree); @@ -191,7 +192,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons pkgNameContent = getPackageLabel(parsedPackageName); } Content headingContent = new StringContent(".*"); - Content heading = HtmlTree.HEADING(Headings.ConstantsSummary.PACKAGE_HEADING, true, + Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, pkgNameContent); heading.addContent(headingContent); summaryTree = HtmlTree.SECTION(heading); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java index f55d78b2acc..de70a890dec 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -34,6 +34,7 @@ import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -97,7 +98,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter @Override public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { - memberSummaryTree.addContent(MarkerComments.START_OF_CONSTRUCTOR_SUMMARY); + memberSummaryTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -117,11 +118,11 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter @Override public Content getConstructorDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) { - memberDetailsTree.addContent(MarkerComments.START_OF_CONSTRUCTOR_DETAILS); + memberDetailsTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_DETAILS); Content constructorDetailsTree = writer.getMemberTreeHeader(); constructorDetailsTree.addContent(links.createAnchor( SectionName.CONSTRUCTOR_DETAIL)); - Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, + Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, contents.constructorDetailsLabel); constructorDetailsTree.addContent(heading); return constructorDetailsTree; @@ -139,7 +140,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter } constructorDetailsTree.addContent(links.createAnchor(writer.getAnchor(constructor))); Content constructorDocTree = writer.getMemberTreeHeader(); - Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); + Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); heading.addContent(name(constructor)); constructorDocTree.addContent(heading); return constructorDocTree; @@ -222,7 +223,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter */ @Override public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, contents.constructorSummaryLabel); memberTree.addContent(label); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java index 973001b6a96..163b12da835 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java @@ -38,6 +38,7 @@ import javax.lang.model.element.PackageElement; import com.sun.source.doctree.DocTree; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -335,11 +336,11 @@ public class DeprecatedListWriter extends SubWriterHolderWriter { */ public Content getContentsList(DeprecatedAPIListBuilder deprapi) { Content headContent = contents.deprecatedAPI; - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, HtmlStyle.title, headContent); Content div = HtmlTree.DIV(HtmlStyle.header, heading); Content headingContent = contents.contentsHeading; - div.addContent(HtmlTree.HEADING(Headings.CONTENT_HEADING, true, + div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true, headingContent)); Content ul = new HtmlTree(HtmlTag.UL); for (DeprElementKind kind : DeprElementKind.values()) { diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java index 2affe50e362..0993f81e512 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, 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 @@ -33,9 +33,11 @@ import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; +import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.EnumConstantWriter; @@ -69,7 +71,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter @Override public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { - memberSummaryTree.addContent(MarkerComments.START_OF_ENUM_CONSTANT_SUMMARY); + memberSummaryTree.addContent(HtmlConstants.START_OF_ENUM_CONSTANT_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -89,11 +91,11 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter @Override public Content getEnumConstantsDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) { - memberDetailsTree.addContent(MarkerComments.START_OF_ENUM_CONSTANT_DETAILS); + memberDetailsTree.addContent(HtmlConstants.START_OF_ENUM_CONSTANT_DETAILS); Content enumConstantsDetailsTree = writer.getMemberTreeHeader(); enumConstantsDetailsTree.addContent(links.createAnchor( SectionName.ENUM_CONSTANT_DETAIL)); - Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, + Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, contents.enumConstantDetailLabel); enumConstantsDetailsTree.addContent(heading); return enumConstantsDetailsTree; @@ -107,7 +109,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter Content enumConstantsDetailsTree) { enumConstantsDetailsTree.addContent(links.createAnchor(name(enumConstant))); Content enumConstantsTree = writer.getMemberTreeHeader(); - Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); + Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); heading.addContent(name(enumConstant)); enumConstantsTree.addContent(heading); return enumConstantsTree; @@ -180,7 +182,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter */ @Override public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, contents.enumConstantSummary); memberTree.addContent(label); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java index c6e337d7f62..36f777c7854 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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,9 +35,11 @@ import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; +import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.FieldWriter; @@ -73,7 +75,7 @@ public class FieldWriterImpl extends AbstractMemberWriter @Override public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { - memberSummaryTree.addContent(MarkerComments.START_OF_FIELD_SUMMARY); + memberSummaryTree.addContent(HtmlConstants.START_OF_FIELD_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -92,11 +94,11 @@ public class FieldWriterImpl extends AbstractMemberWriter */ @Override public Content getFieldDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) { - memberDetailsTree.addContent(MarkerComments.START_OF_FIELD_DETAILS); + memberDetailsTree.addContent(HtmlConstants.START_OF_FIELD_DETAILS); Content fieldDetailsTree = writer.getMemberTreeHeader(); fieldDetailsTree.addContent(links.createAnchor( SectionName.FIELD_DETAIL)); - Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, + Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, contents.fieldDetailsLabel); fieldDetailsTree.addContent(heading); return fieldDetailsTree; @@ -109,7 +111,7 @@ public class FieldWriterImpl extends AbstractMemberWriter public Content getFieldDocTreeHeader(VariableElement field, Content fieldDetailsTree) { fieldDetailsTree.addContent(links.createAnchor(name(field))); Content fieldTree = writer.getMemberTreeHeader(); - Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); + Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); heading.addContent(name(field)); fieldTree.addContent(heading); return fieldTree; @@ -184,7 +186,7 @@ public class FieldWriterImpl extends AbstractMemberWriter */ @Override public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, contents.fieldSummaryLabel); memberTree.addContent(label); } @@ -245,7 +247,7 @@ public class FieldWriterImpl extends AbstractMemberWriter ? resources.getText("doclet.Fields_Inherited_From_Class") : resources.getText("doclet.Fields_Inherited_From_Interface")); } - Content labelHeading = HtmlTree.HEADING(Headings.TypeDeclaration.INHERITED_SUMMARY_HEADING, + Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING, label); labelHeading.addContent(Contents.SPACE); labelHeading.addContent(classLink); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Headings.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Headings.java deleted file mode 100644 index 8190ca47b26..00000000000 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Headings.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 1998, 2019, 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 jdk.javadoc.internal.doclets.formats.html; - -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; - -/** - * Aliases for HTML heading tags (H1..H6) for different kinds of pages. - * - *

        This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - */ -class Headings { - /** - * Standard top-level heading for the page title for all pages. - */ - static final HtmlTag PAGE_TITLE_HEADING = HtmlTag.H1; - - /** - * Standard second-level heading for sundry pages that do - * not have their own page group. - */ - static final HtmlTag CONTENT_HEADING = HtmlTag.H2; - - /** - * Headings for the page for a module declaration. - */ - static class ModuleDeclaration { - static final HtmlTag SUMMARY_HEADING = HtmlTag.H2; - } - - /** - * Headings for the page for a type declaration. - * This includes classes, interfaces, enums and annotation types. - */ - static class TypeDeclaration { - /** - * Heading for the different summary lists: - * Field Summary, Constructor Summary, Method Summary, etc. - */ - static final HtmlTag SUMMARY_HEADING = HtmlTag.H2; - - /** - * Subheading within a summary for the inherited elements: - * inherited methods, etc - */ - static final HtmlTag INHERITED_SUMMARY_HEADING = HtmlTag.H3; - - /** - * Heading for the different detail lists: - * Field Details, Constructor Details, Method Details, etc. - */ - static final HtmlTag DETAILS_HEADING = HtmlTag.H2; - - /** - * Subheading with a Details list for an individual element. - */ - static final HtmlTag MEMBER_HEADING = HtmlTag.H3; - } - - /** - * Headings for the Constants Summary page. - */ - static class ConstantsSummary { - static final HtmlTag PACKAGE_HEADING = HtmlTag.H2; - } - - /** - * Headings for the Serialized Form page. - */ - static class SerializedForm { - /** - * Heading for the package name, preceding a list of types. - */ - static final HtmlTag PACKAGE_HEADING = HtmlTag.H2; - - /** - * Heading for a type name within a package. - */ - static final HtmlTag CLASS_HEADING = HtmlTag.H3; - - /** - * Subheading for info within a type. - */ - static final HtmlTag CLASS_SUBHEADING = HtmlTag.H4; - - /** - * Heading for an individual member element within a type. - */ - static final HtmlTag MEMBER_HEADING = HtmlTag.H5; - } - - /** - * Headings for a type Use page. - */ - static class TypeUse { - static final HtmlTag SUMMARY_HEADING = HtmlTag.H2; - } - - /** - * Headings for index frames pages. - */ - static class IndexFrames { - /** Heading for a list of module names in an index frame. */ - static final HtmlTag MODULE_HEADING = HtmlTag.H2; - /** Heading for a list of package names in an index frame. */ - static final HtmlTag PACKAGE_HEADING = HtmlTag.H2; - } -} diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java index 18c96954dd9..5ccd4090704 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java @@ -25,6 +25,7 @@ package jdk.javadoc.internal.doclets.formats.html; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -112,7 +113,7 @@ public class HelpWriter extends HtmlDocletWriter { */ protected void addHelpFileContents(Content contentTree) { // Heading - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, false, HtmlStyle.title, + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false, HtmlStyle.title, contents.getContent("doclet.help.main_heading")); Content div = HtmlTree.DIV(HtmlStyle.header, heading); Content intro = HtmlTree.DIV(HtmlStyle.subTitle, @@ -125,7 +126,7 @@ public class HelpWriter extends HtmlDocletWriter { // Overview if (configuration.createoverview) { - Content overviewHeading = HtmlTree.HEADING(Headings.CONTENT_HEADING, + Content overviewHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, contents.overviewLabel); htmlTree = HtmlTree.SECTION(overviewHeading); String overviewKey = configuration.showModules @@ -142,7 +143,7 @@ public class HelpWriter extends HtmlDocletWriter { // Module if (configuration.showModules) { - Content moduleHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, + Content moduleHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, contents.moduleLabel); htmlTree = HtmlTree.SECTION(moduleHead); Content moduleIntro = contents.getContent("doclet.help.module.intro"); @@ -157,7 +158,7 @@ public class HelpWriter extends HtmlDocletWriter { } // Package - Content packageHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, + Content packageHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, contents.packageLabel); htmlTree = HtmlTree.SECTION(packageHead); Content packageIntro = contents.getContent("doclet.help.package.intro"); @@ -174,7 +175,7 @@ public class HelpWriter extends HtmlDocletWriter { ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree)); // Class/interface - Content classHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, + Content classHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, contents.getContent("doclet.help.class_interface.head")); htmlTree = HtmlTree.SECTION(classHead); Content classIntro = contents.getContent("doclet.help.class_interface.intro"); @@ -209,7 +210,7 @@ public class HelpWriter extends HtmlDocletWriter { ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree)); // Annotation Types - Content aHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, + Content aHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, contents.annotationType); htmlTree = HtmlTree.SECTION(aHead); Content aIntro = contents.getContent("doclet.help.annotation_type.intro"); @@ -225,7 +226,7 @@ public class HelpWriter extends HtmlDocletWriter { ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree)); // Enums - Content enumHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, contents.enum_); + Content enumHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, contents.enum_); htmlTree = HtmlTree.SECTION(enumHead); Content eIntro = contents.getContent("doclet.help.enum.intro"); Content enumPara = HtmlTree.P(eIntro); @@ -240,7 +241,7 @@ public class HelpWriter extends HtmlDocletWriter { // Class Use if (configuration.classuse) { - Content useHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, + Content useHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, contents.getContent("doclet.help.use.head")); htmlTree = HtmlTree.SECTION(useHead); Content useBody = contents.getContent("doclet.help.use.body"); @@ -251,7 +252,7 @@ public class HelpWriter extends HtmlDocletWriter { // Tree if (configuration.createtree) { - Content treeHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, + Content treeHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, contents.getContent("doclet.help.tree.head")); htmlTree = HtmlTree.SECTION(treeHead); Content treeIntro = contents.getContent("doclet.help.tree.intro", @@ -269,7 +270,7 @@ public class HelpWriter extends HtmlDocletWriter { // Deprecated if (!(configuration.nodeprecatedlist || configuration.nodeprecated)) { - Content dHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, + Content dHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, contents.deprecatedAPI); htmlTree = HtmlTree.SECTION(dHead); Content deprBody = contents.getContent("doclet.help.deprecated.body", @@ -290,7 +291,7 @@ public class HelpWriter extends HtmlDocletWriter { indexlink = links.createLink(DocPaths.INDEX_ALL, resources.getText("doclet.Index")); } - Content indexHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, + Content indexHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, contents.getContent("doclet.help.index.head")); htmlTree = HtmlTree.SECTION(indexHead); Content indexBody = contents.getContent("doclet.help.index.body", indexlink); @@ -301,7 +302,7 @@ public class HelpWriter extends HtmlDocletWriter { // Frames if (configuration.frames) { - Content frameHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, + Content frameHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, contents.getContent("doclet.help.frames.head")); htmlTree = HtmlTree.SECTION(frameHead); Content framesBody = contents.getContent("doclet.help.frames.body"); @@ -312,7 +313,7 @@ public class HelpWriter extends HtmlDocletWriter { } // Serialized Form - Content sHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, + Content sHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, contents.serializedForm); htmlTree = HtmlTree.SECTION(sHead); Content serialBody = contents.getContent("doclet.help.serial_form.body"); @@ -321,7 +322,7 @@ public class HelpWriter extends HtmlDocletWriter { ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree)); // Constant Field Values - Content constHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, + Content constHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, contents.constantsSummaryTitle); htmlTree = HtmlTree.SECTION(constHead); Content constantsBody = contents.getContent("doclet.help.constants.body", @@ -332,7 +333,7 @@ public class HelpWriter extends HtmlDocletWriter { ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree)); // Search - Content searchHead = HtmlTree.HEADING(Headings.CONTENT_HEADING, + Content searchHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, contents.getContent("doclet.help.search.head")); htmlTree = HtmlTree.SECTION(searchHead); Content searchBody = contents.getContent("doclet.help.search.body"); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java index c8ae3447213..d034d99461d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019, 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 @@ -41,9 +41,11 @@ import com.sun.tools.doclint.DocLint; import jdk.javadoc.doclet.Doclet; import jdk.javadoc.doclet.DocletEnvironment; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlVersion; import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; +import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.DocletException; import jdk.javadoc.internal.doclets.toolkit.Messages; import jdk.javadoc.internal.doclets.toolkit.Resources; @@ -80,11 +82,6 @@ import static javax.tools.Diagnostic.Kind.*; */ public class HtmlConfiguration extends BaseConfiguration { - /** - * Default charset for HTML. - */ - public static final String HTML_DEFAULT_CHARSET = "utf-8"; - /** * Argument for command line option "-header". */ @@ -765,7 +762,7 @@ public class HtmlConfiguration extends BaseConfiguration { protected boolean finishOptionSettings0() throws DocletException { if (docencoding == null) { if (charset == null) { - docencoding = charset = (encoding == null) ? HTML_DEFAULT_CHARSET : encoding; + docencoding = charset = (encoding == null) ? HtmlConstants.HTML_DEFAULT_CHARSET : encoding; } else { docencoding = charset; } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialFieldWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialFieldWriter.java index 65a320359c0..10688190640 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialFieldWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialFieldWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019, 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 @@ -34,6 +34,7 @@ import javax.lang.model.type.TypeMirror; import com.sun.source.doctree.DocTree; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -107,7 +108,8 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl li.setStyle(HtmlStyle.blockList); if (serializableFieldsTree.isValid()) { Content headingContent = new StringContent(heading); - Content serialHeading = HtmlTree.HEADING(Headings.SerializedForm.CLASS_SUBHEADING, headingContent); + Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, + headingContent); li.addContent(serialHeading); li.addContent(serializableFieldsTree); } @@ -118,7 +120,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl public void addMemberHeader(TypeElement fieldType, String fieldTypeStr, String fieldDimensions, String fieldName, Content contentTree) { Content nameContent = new StringContent(fieldName); - Content heading = HtmlTree.HEADING(Headings.SerializedForm.MEMBER_HEADING, nameContent); + Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, nameContent); contentTree.addContent(heading); Content pre = new HtmlTree(HtmlTag.PRE); if (fieldType == null) { @@ -136,7 +138,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl @Override public void addMemberHeader(TypeMirror fieldType, String fieldName, Content contentTree) { Content nameContent = new StringContent(fieldName); - Content heading = HtmlTree.HEADING(HtmlTag.H5, nameContent); + Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, nameContent); contentTree.addContent(heading); Content pre = new HtmlTree(HtmlTag.PRE); Content fieldContent = writer.getLink(new LinkInfoImpl( diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialMethodWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialMethodWriter.java index e16f853c6a4..070bb7f83bc 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialMethodWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlSerialMethodWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -29,6 +29,7 @@ import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -94,7 +95,8 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements */ public Content getSerializableMethods(String heading, Content serializableMethodContent) { Content headingContent = new StringContent(heading); - Content serialHeading = HtmlTree.HEADING(Headings.SerializedForm.CLASS_SUBHEADING, headingContent); + Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, + headingContent); Content li = HtmlTree.LI(HtmlStyle.blockList, serialHeading); li.addContent(serializableMethodContent); return li; @@ -118,9 +120,7 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements * @param methodsContentTree the content tree to which the member header will be added */ public void addMemberHeader(ExecutableElement member, Content methodsContentTree) { - Content memberContent = new StringContent(name(member)); - Content heading = HtmlTree.HEADING(Headings.SerializedForm.MEMBER_HEADING, memberContent); - methodsContentTree.addContent(heading); + methodsContentTree.addContent(getHead(member)); methodsContentTree.addContent(getSignature(member)); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java index 5c3735bc6fb..34f24698463 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -36,6 +36,7 @@ import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeMirror; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -86,7 +87,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter */ @Override public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { - memberSummaryTree.addContent(MarkerComments.START_OF_METHOD_SUMMARY); + memberSummaryTree.addContent(HtmlConstants.START_OF_METHOD_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -105,10 +106,10 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter */ @Override public Content getMethodDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) { - memberDetailsTree.addContent(MarkerComments.START_OF_METHOD_DETAILS); + memberDetailsTree.addContent(HtmlConstants.START_OF_METHOD_DETAILS); Content methodDetailsTree = writer.getMemberTreeHeader(); methodDetailsTree.addContent(links.createAnchor(SectionName.METHOD_DETAIL)); - Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, + Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, contents.methodDetailLabel); methodDetailsTree.addContent(heading); return methodDetailsTree; @@ -125,7 +126,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter } methodDetailsTree.addContent(links.createAnchor(writer.getAnchor(method))); Content methodDocTree = writer.getMemberTreeHeader(); - Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); + Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); heading.addContent(name(method)); methodDocTree.addContent(heading); return methodDocTree; @@ -228,7 +229,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter */ @Override public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, contents.methodSummary); memberTree.addContent(label); } @@ -294,7 +295,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter ? resources.getText("doclet.Methods_Inherited_From_Class") : resources.getText("doclet.Methods_Inherited_From_Interface")); } - Content labelHeading = HtmlTree.HEADING(Headings.TypeDeclaration.INHERITED_SUMMARY_HEADING, + Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING, label); labelHeading.addContent(Contents.SPACE); labelHeading.addContent(classLink); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java index 3c87223b65a..3523437d31d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java @@ -32,6 +32,7 @@ import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import javax.lang.model.util.ElementFilter; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -100,7 +101,7 @@ public class ModuleFrameWriter extends HtmlDocletWriter { DocPath moduleSummary = configuration.useModuleDirectories ? DocPaths.DOT_DOT.resolve(configuration.docPaths.moduleSummary(moduleElement)) : configuration.docPaths.moduleSummary(moduleElement); - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, HtmlStyle.bar, + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, mdlgen.links.createLink(moduleSummary, mdlLabel, "", "classFrame")); htmlTree.addContent(heading); HtmlTree div = new HtmlTree(HtmlTag.DIV); @@ -170,7 +171,7 @@ public class ModuleFrameWriter extends HtmlDocletWriter { continue; } if (!printedHeader) { - Content heading = HtmlTree.HEADING(Headings.CONTENT_HEADING, + Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true, labelContent); htmlTree.addContent(heading); printedHeader = true; diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java index bcc04b7bcf2..f096330fd4a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java @@ -32,6 +32,7 @@ import javax.lang.model.element.ModuleElement; import javax.lang.model.element.PackageElement; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -56,12 +57,6 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; * @author Bhavesh Patel */ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter { - /** - * The heading (h1 or h2) to use for the module list, - * set by addNavigationBarHeader depending on whether or not there - * is an additional initial heading. - */ - private HtmlTag moduleListHeading; /** * Construct the ModuleIndexFrameWriter object. @@ -88,9 +83,8 @@ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter { /** * {@inheritDoc} */ - @Override protected void addModulesList(Content main) { - Content heading = HtmlTree.HEADING(moduleListHeading, true, + Content heading = HtmlTree.HEADING(HtmlConstants.MODULE_HEADING, true, contents.modulesLabel); HtmlTree htmlTree = HtmlTree.DIV(HtmlStyle.indexContainer, heading); HtmlTree ul = new HtmlTree(HtmlTag.UL); @@ -131,16 +125,15 @@ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter { * {@inheritDoc} */ protected void addNavigationBarHeader(Content header) { - String headerContent = !configuration.packagesheader.isEmpty() ? configuration.packagesheader - : configuration.header; - if (!headerContent.isEmpty()) { - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, - HtmlStyle.bar, new RawHtml(replaceDocRootDir(headerContent))); - header.addContent(heading); - moduleListHeading = Headings.IndexFrames.MODULE_HEADING; + Content headerContent; + if (configuration.packagesheader.length() > 0) { + headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader)); } else { - moduleListHeading = Headings.PAGE_TITLE_HEADING; + headerContent = new RawHtml(replaceDocRootDir(configuration.header)); } + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, + HtmlStyle.bar, headerContent); + header.addContent(heading); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java index 23de9557290..be5eb67c346 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java @@ -33,6 +33,7 @@ import java.util.Set; import javax.lang.model.element.ModuleElement; import javax.lang.model.element.PackageElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -56,12 +57,6 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; * @author Bhavesh Patel */ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter { - /** - * The heading (h1 or h2) to use for the module packages list, - * set by addNavigationBarHeader depending on whether or not there - * is an additional initial heading. - */ - private HtmlTag modulePackagesListHeading; /** * Construct the ModulePackageIndexFrameWriter object. @@ -94,7 +89,7 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter { protected void addModulePackagesList(Map> modules, String text, String tableSummary, Content main, ModuleElement mdle) { Content profNameContent = new StringContent(mdle.getQualifiedName().toString()); - Content heading = HtmlTree.HEADING(modulePackagesListHeading, true, + Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, getTargetModuleLink("classFrame", profNameContent, mdle)); heading.addContent(Contents.SPACE); heading.addContent(contents.packagesLabel); @@ -117,7 +112,7 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter { protected void addModulePackagesList(Set modules, String text, String tableSummary, Content body, ModuleElement mdle) { Content moduleNameContent = new StringContent(mdle.getQualifiedName().toString()); - Content heading = HtmlTree.HEADING(modulePackagesListHeading, true, + Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, getTargetModuleLink("classFrame", moduleNameContent, mdle)); heading.addContent(Contents.SPACE); heading.addContent(contents.packagesLabel); @@ -162,16 +157,15 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter { * {@inheritDoc} */ protected void addNavigationBarHeader(Content header) { - String headerContent = !configuration.packagesheader.isEmpty() ? configuration.packagesheader - : configuration.header; - if (!headerContent.isEmpty()) { - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, - HtmlStyle.bar, new RawHtml(replaceDocRootDir(headerContent))); - header.addContent(heading); - modulePackagesListHeading = Headings.IndexFrames.PACKAGE_HEADING; + Content headerContent; + if (configuration.packagesheader.length() > 0) { + headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader)); } else { - modulePackagesListHeading = Headings.PAGE_TITLE_HEADING; + headerContent = new RawHtml(replaceDocRootDir(configuration.header)); } + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, + HtmlStyle.bar, headerContent); + header.addContent(heading); } /** @@ -183,7 +177,6 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter { /** * Do nothing as there is no modules list on this page. */ - @Override protected void addModulesList(Content body) { } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java index 419341181d7..1e53e29b83f 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java @@ -46,6 +46,7 @@ import javax.lang.model.util.ElementFilter; import com.sun.source.doctree.DocTree; import jdk.javadoc.doclet.DocletEnvironment.ModuleMode; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -212,7 +213,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW div.addContent(annotationContent); Content label = mdle.isOpen() && (configuration.docEnv.getModuleMode() == ModuleMode.ALL) ? contents.openModuleLabel : contents.moduleLabel; - Content tHeading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, + Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, HtmlStyle.title, label); tHeading.addContent(Contents.SPACE); Content moduleHead = new RawHtml(heading); @@ -460,7 +461,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW Content htmltree) { htmltree.addContent(startMarker); htmltree.addContent(links.createAnchor(markerAnchor)); - htmltree.addContent(HtmlTree.HEADING(Headings.ModuleDeclaration.SUMMARY_HEADING, heading)); + htmltree.addContent(HtmlTree.HEADING(HtmlTag.H3, heading)); } /** @@ -508,7 +509,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW contents.descriptionLabel); HtmlTree li = new HtmlTree(HtmlTag.LI); li.setStyle(HtmlStyle.blockList); - addSummaryHeader(MarkerComments.START_OF_MODULES_SUMMARY, SectionName.MODULES, + addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES, contents.navModules, li); if (display(requires)) { String text = resources.getText("doclet.Requires_Summary"); @@ -560,7 +561,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW || display(indirectPackages) || display(indirectOpenPackages)) { HtmlTree li = new HtmlTree(HtmlTag.LI); li.setStyle(HtmlStyle.blockList); - addSummaryHeader(MarkerComments.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES, + addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES, contents.navPackages, li); if (display(packages)) { addPackageSummary(li); @@ -739,7 +740,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW if (haveProvides || haveUses) { HtmlTree li = new HtmlTree(HtmlTag.LI); li.setStyle(HtmlStyle.blockList); - addSummaryHeader(MarkerComments.START_OF_SERVICES_SUMMARY, SectionName.SERVICES, + addSummaryHeader(HtmlConstants.START_OF_SERVICES_SUMMARY, SectionName.SERVICES, contents.navServices, li); TableHeader usesProvidesTableHeader = new TableHeader(contents.typeLabel, contents.descriptionLabel); @@ -868,7 +869,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW if (!utils.getFullBody(mdle).isEmpty()) { Content tree = HtmlTree.SECTION(); addDeprecationInfo(tree); - tree.addContent(MarkerComments.START_OF_MODULE_DESCRIPTION); + tree.addContent(HtmlConstants.START_OF_MODULE_DESCRIPTION); tree.addContent(links.createAnchor(SectionName.MODULE_DESCRIPTION)); addInlineComment(mdle, tree); moduleContentTree.addContent(tree); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java index bbb0fa15a7d..3eab7599a49 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -34,8 +34,10 @@ import java.util.List; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; +import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter; @@ -70,7 +72,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter @Override public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { - memberSummaryTree.addContent(MarkerComments.START_OF_NESTED_CLASS_SUMMARY); + memberSummaryTree.addContent(HtmlConstants.START_OF_NESTED_CLASS_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -89,7 +91,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter */ @Override public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, contents.nestedClassSummary); memberTree.addContent(label); } @@ -153,7 +155,8 @@ public class NestedClassWriterImpl extends AbstractMemberWriter ? resources.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Interface") : resources.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class")); } - Content labelHeading = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, label); + Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING, + label); labelHeading.addContent(Contents.SPACE); labelHeading.addContent(classLink); inheritedTree.addContent(labelHeading); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java index f6f96d354c6..460766b4f04 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java @@ -30,6 +30,7 @@ import java.util.*; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -101,7 +102,7 @@ public class PackageFrameWriter extends HtmlDocletWriter { HtmlTree body = packgen.getBody(false, packgen.getWindowTitle(pkgName)); Content pkgNameContent = new StringContent(pkgName); HtmlTree htmlTree = HtmlTree.MAIN(); - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, HtmlStyle.bar, + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, packgen.getTargetPackageLink(packageElement, "classFrame", pkgNameContent)); htmlTree.addContent(heading); HtmlTree div = new HtmlTree(HtmlTag.DIV); @@ -176,7 +177,7 @@ public class PackageFrameWriter extends HtmlDocletWriter { continue; } if (!printedHeader) { - Content heading = HtmlTree.HEADING(Headings.CONTENT_HEADING, + Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true, labelContent); htmlTree.addContent(heading); printedHeader = true; diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java index 6860d4d4cf9..ecbf34fd4e3 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java @@ -27,6 +27,7 @@ package jdk.javadoc.internal.doclets.formats.html; import javax.lang.model.element.PackageElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -78,7 +79,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter { */ @Override protected void addPackagesList(Content main) { - Content heading = HtmlTree.HEADING(Headings.IndexFrames.PACKAGE_HEADING, true, + Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, contents.packagesLabel); HtmlTree htmlTree = HtmlTree.DIV(HtmlStyle.indexContainer, heading); HtmlTree ul = new HtmlTree(HtmlTag.UL); @@ -129,7 +130,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter { } else { headerContent = new RawHtml(replaceDocRootDir(configuration.header)); } - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, HtmlStyle.bar, headerContent); header.addContent(heading); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java index c72d34f2d33..1e259180c7b 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java @@ -27,6 +27,7 @@ package jdk.javadoc.internal.doclets.formats.html; import javax.lang.model.element.PackageElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -100,7 +101,7 @@ public class PackageTreeWriter extends AbstractTreeWriter { HtmlTree mainTree = HtmlTree.MAIN(); Content headContent = contents.getContent("doclet.Hierarchy_For_Package", utils.getPackageName(packageElement)); - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, false, + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false, HtmlStyle.title, headContent); Content div = HtmlTree.DIV(HtmlStyle.header, heading); if (configuration.packages.size() > 1) { diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java index ba6f2455d2a..928705e37ab 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java @@ -34,6 +34,7 @@ import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -250,7 +251,7 @@ public class PackageUseWriter extends SubWriterHolderWriter { headContent.addContent(contents.getContent("doclet.ClassUse_Title", packageText)); headContent.addContent(new HtmlTree(HtmlTag.BR)); headContent.addContent(name); - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, HtmlStyle.title, headContent); Content div = HtmlTree.DIV(HtmlStyle.header, heading); mainTree.addContent(div); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java index edf5d8f6532..b0f7e25577e 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java @@ -36,6 +36,7 @@ import javax.lang.model.element.TypeElement; import com.sun.source.doctree.DocTree; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -128,7 +129,7 @@ public class PackageWriterImpl extends HtmlDocletWriter Content annotationContent = new HtmlTree(HtmlTag.P); addAnnotationInfo(packageElement, annotationContent); div.addContent(annotationContent); - Content tHeading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, + Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, HtmlStyle.title, contents.packageLabel); tHeading.addContent(Contents.SPACE); Content packageHead = new StringContent(heading); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java index 9a256f8763e..d34be75791e 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -33,6 +33,7 @@ import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -67,7 +68,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter */ @Override public Content getMemberSummaryHeader(TypeElement typeElement, Content memberSummaryTree) { - memberSummaryTree.addContent(MarkerComments.START_OF_PROPERTY_SUMMARY); + memberSummaryTree.addContent(HtmlConstants.START_OF_PROPERTY_SUMMARY); Content memberTree = writer.getMemberTreeHeader(); writer.addSummaryHeader(this, typeElement, memberTree); return memberTree; @@ -87,10 +88,10 @@ public class PropertyWriterImpl extends AbstractMemberWriter @Override public Content getPropertyDetailsTreeHeader(TypeElement typeElement, Content memberDetailsTree) { - memberDetailsTree.addContent(MarkerComments.START_OF_PROPERTY_DETAILS); + memberDetailsTree.addContent(HtmlConstants.START_OF_PROPERTY_DETAILS); Content propertyDetailsTree = writer.getMemberTreeHeader(); propertyDetailsTree.addContent(links.createAnchor(SectionName.PROPERTY_DETAIL)); - Content heading = HtmlTree.HEADING(Headings.TypeDeclaration.DETAILS_HEADING, + Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, contents.propertyDetailsLabel); propertyDetailsTree.addContent(heading); return propertyDetailsTree; @@ -104,7 +105,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter Content propertyDetailsTree) { propertyDetailsTree.addContent(links.createAnchor(name(property))); Content propertyDocTree = writer.getMemberTreeHeader(); - Content heading = new HtmlTree(Headings.TypeDeclaration.MEMBER_HEADING); + Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING); heading.addContent(utils.getPropertyLabel(name(property))); propertyDocTree.addContent(heading); return propertyDocTree; @@ -199,7 +200,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter */ @Override public void addSummaryLabel(Content memberTree) { - Content label = HtmlTree.HEADING(Headings.TypeDeclaration.SUMMARY_HEADING, + Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, contents.propertySummaryLabel); memberTree.addContent(label); } @@ -260,7 +261,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter ? resources.getText("doclet.Properties_Inherited_From_Class") : resources.getText("doclet.Properties_Inherited_From_Interface")); } - Content labelHeading = HtmlTree.HEADING(Headings.TypeDeclaration.INHERITED_SUMMARY_HEADING, + Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING, label); labelHeading.addContent(Contents.SPACE); labelHeading.addContent(classLink); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java index 4bb1ca78071..5e8130ddd0d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java @@ -29,6 +29,7 @@ import java.util.*; import javax.lang.model.element.TypeElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -41,7 +42,7 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; /** - * Generates the Serialized Form Information Page, serialized-form.html. + * Generate the Serialized Form Information Page. * *

        This is NOT part of any supported API. * If you write code that depends on this, you do so at your own risk. @@ -85,7 +86,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter htmlTree.addContent(navBar.getContent(true)); bodyTree.addContent(htmlTree); Content h1Content = new StringContent(header); - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true, + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, HtmlStyle.title, h1Content); Content div = HtmlTree.DIV(HtmlStyle.header, heading); mainTree.addContent(div); @@ -119,7 +120,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter * @return a content tree for the package header */ public Content getPackageHeader(String packageName) { - Content heading = HtmlTree.HEADING(Headings.SerializedForm.PACKAGE_HEADING, true, + Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, contents.packageLabel); heading.addContent(Contents.SPACE); heading.addContent(packageName); @@ -172,7 +173,8 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter contents.getContent( "doclet.Class_0_extends_implements_serializable", classLink, superClassLink); - li.addContent(HtmlTree.HEADING(Headings.SerializedForm.CLASS_HEADING, className)); + li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, + className)); return li; } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java index f38e624431c..110284f1122 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java @@ -29,6 +29,7 @@ import java.util.SortedSet; import javax.lang.model.element.PackageElement; +import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; @@ -107,7 +108,7 @@ public class TreeWriter extends AbstractTreeWriter { public void generateTreeFile() throws DocFileIOException { HtmlTree body = getTreeHeader(); Content headContent = contents.hierarchyForAllPackages; - Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, false, + Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false, HtmlStyle.title, headContent); Content div = HtmlTree.DIV(HtmlStyle.header, heading); addPackageTreeLinks(div); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MarkerComments.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlConstants.java similarity index 62% rename from src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MarkerComments.java rename to src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlConstants.java index 8131fc54ae6..32383d1b288 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MarkerComments.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2016, 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,12 +23,12 @@ * questions. */ -package jdk.javadoc.internal.doclets.formats.html; +package jdk.javadoc.internal.doclets.formats.html.markup; -import jdk.javadoc.internal.doclets.formats.html.markup.Comment; +import jdk.javadoc.internal.doclets.toolkit.Content; /** - * Marker comments to identify regions in the generated files. + * Stores constants for Html Doclet. * *

        This is NOT part of any supported API. * If you write code that depends on this, you do so at your own risk. @@ -37,162 +37,216 @@ import jdk.javadoc.internal.doclets.formats.html.markup.Comment; * * @author Bhavesh Patel */ -public class MarkerComments { +public class HtmlConstants { /** * Marker to identify start of top navigation bar. */ - public static final Comment START_OF_TOP_NAVBAR = + public static final Content START_OF_TOP_NAVBAR = new Comment("========= START OF TOP NAVBAR ======="); /** * Marker to identify start of bottom navigation bar. */ - public static final Comment START_OF_BOTTOM_NAVBAR = + public static final Content START_OF_BOTTOM_NAVBAR = new Comment("======= START OF BOTTOM NAVBAR ======"); /** * Marker to identify end of top navigation bar. */ - public static final Comment END_OF_TOP_NAVBAR = + public static final Content END_OF_TOP_NAVBAR = new Comment("========= END OF TOP NAVBAR ========="); /** * Marker to identify end of bottom navigation bar. */ - public static final Comment END_OF_BOTTOM_NAVBAR = + public static final Content END_OF_BOTTOM_NAVBAR = new Comment("======== END OF BOTTOM NAVBAR ======="); /** * Marker to identify start of module description. */ - public static final Comment START_OF_MODULE_DESCRIPTION = + public static final Content START_OF_MODULE_DESCRIPTION = new Comment("============ MODULE DESCRIPTION ==========="); /** * Marker to identify start of modules summary. */ - public static final Comment START_OF_MODULES_SUMMARY = + public static final Content START_OF_MODULES_SUMMARY = new Comment("============ MODULES SUMMARY ==========="); /** * Marker to identify start of packages summary. */ - public static final Comment START_OF_PACKAGES_SUMMARY = + public static final Content START_OF_PACKAGES_SUMMARY = new Comment("============ PACKAGES SUMMARY ==========="); /** * Marker to identify start of services summary. */ - public static final Comment START_OF_SERVICES_SUMMARY = + public static final Content START_OF_SERVICES_SUMMARY = new Comment("============ SERVICES SUMMARY ==========="); /** * Marker to identify start of class data. */ - public static final Comment START_OF_CLASS_DATA = + public static final Content START_OF_CLASS_DATA = new Comment("======== START OF CLASS DATA ========"); /** * Marker to identify end of class data. */ - public static final Comment END_OF_CLASS_DATA = + public static final Content END_OF_CLASS_DATA = new Comment("========= END OF CLASS DATA ========="); /** * Marker to identify start of nested class summary. */ - public static final Comment START_OF_NESTED_CLASS_SUMMARY = + public static final Content START_OF_NESTED_CLASS_SUMMARY = new Comment("======== NESTED CLASS SUMMARY ========"); /** * Marker to identify start of annotation type optional member summary. */ - public static final Comment START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY = + public static final Content START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY = new Comment("=========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY ==========="); /** * Marker to identify start of annotation type required member summary. */ - public static final Comment START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY = + public static final Content START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY = new Comment("=========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY ==========="); /** * Marker to identify start of annotation type required member summary. */ - public static final Comment START_OF_ANNOTATION_TYPE_FIELD_SUMMARY = + public static final Content START_OF_ANNOTATION_TYPE_FIELD_SUMMARY = new Comment("=========== ANNOTATION TYPE FIELD SUMMARY ==========="); /** * Marker to identify start of constructor summary. */ - public static final Comment START_OF_CONSTRUCTOR_SUMMARY = + public static final Content START_OF_CONSTRUCTOR_SUMMARY = new Comment("======== CONSTRUCTOR SUMMARY ========"); /** * Marker to identify start of enum constants summary. */ - public static final Comment START_OF_ENUM_CONSTANT_SUMMARY = + public static final Content START_OF_ENUM_CONSTANT_SUMMARY = new Comment("=========== ENUM CONSTANT SUMMARY ==========="); /** * Marker to identify start of field summary. */ - public static final Comment START_OF_FIELD_SUMMARY = + public static final Content START_OF_FIELD_SUMMARY = new Comment("=========== FIELD SUMMARY ==========="); /** * Marker to identify start of properties summary. */ - public static final Comment START_OF_PROPERTY_SUMMARY = + public static final Content START_OF_PROPERTY_SUMMARY = new Comment("=========== PROPERTY SUMMARY ==========="); /** * Marker to identify start of method summary. */ - public static final Comment START_OF_METHOD_SUMMARY = + public static final Content START_OF_METHOD_SUMMARY = new Comment("========== METHOD SUMMARY ==========="); /** * Marker to identify start of annotation type details. */ - public static final Comment START_OF_ANNOTATION_TYPE_DETAILS = + public static final Content START_OF_ANNOTATION_TYPE_DETAILS = new Comment("============ ANNOTATION TYPE MEMBER DETAIL ==========="); /** * Marker to identify start of annotation type field details. */ - public static final Comment START_OF_ANNOTATION_TYPE_FIELD_DETAILS = + public static final Content START_OF_ANNOTATION_TYPE_FIELD_DETAILS = new Comment("============ ANNOTATION TYPE FIELD DETAIL ==========="); /** * Marker to identify start of method details. */ - public static final Comment START_OF_METHOD_DETAILS = + public static final Content START_OF_METHOD_DETAILS = new Comment("============ METHOD DETAIL =========="); /** * Marker to identify start of field details. */ - public static final Comment START_OF_FIELD_DETAILS = + public static final Content START_OF_FIELD_DETAILS = new Comment("============ FIELD DETAIL ==========="); /** * Marker to identify start of property details. */ - public static final Comment START_OF_PROPERTY_DETAILS = + public static final Content START_OF_PROPERTY_DETAILS = new Comment("============ PROPERTY DETAIL ==========="); /** * Marker to identify start of constructor details. */ - public static final Comment START_OF_CONSTRUCTOR_DETAILS = + public static final Content START_OF_CONSTRUCTOR_DETAILS = new Comment("========= CONSTRUCTOR DETAIL ========"); /** * Marker to identify start of enum constants details. */ - public static final Comment START_OF_ENUM_CONSTANT_DETAILS = + public static final Content START_OF_ENUM_CONSTANT_DETAILS = new Comment("============ ENUM CONSTANT DETAIL ==========="); + /** + * Html tag for the page title heading. + */ + public static final HtmlTag TITLE_HEADING = HtmlTag.H1; + + /** + * Html tag for the class page title heading. + */ + public static final HtmlTag CLASS_PAGE_HEADING = HtmlTag.H2; + + /** + * Html tag for the content heading. + */ + public static final HtmlTag CONTENT_HEADING = HtmlTag.H2; + + /** + * Html tag for the package name heading. + */ + public static final HtmlTag PACKAGE_HEADING = HtmlTag.H2; + + /** + * Html tag for the module name heading. + */ + public static final HtmlTag MODULE_HEADING = HtmlTag.H2; + + /** + * Html tag for the member summary heading. + */ + public static final HtmlTag SUMMARY_HEADING = HtmlTag.H3; + + /** + * Html tag for the inherited member summary heading. + */ + public static final HtmlTag INHERITED_SUMMARY_HEADING = HtmlTag.H3; + + /** + * Html tag for the member details heading. + */ + public static final HtmlTag DETAILS_HEADING = HtmlTag.H3; + + /** + * Html tag for the serialized member heading. + */ + public static final HtmlTag SERIALIZED_MEMBER_HEADING = HtmlTag.H3; + + /** + * Html tag for the member heading. + */ + public static final HtmlTag MEMBER_HEADING = HtmlTag.H4; + + /** + * Default charset for HTML. + */ + public static final String HTML_DEFAULT_CHARSET = "utf-8"; } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java index f2139dfd1ad..56a2e16c446 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -42,7 +42,6 @@ import javax.lang.model.element.TypeElement; import jdk.javadoc.internal.doclets.formats.html.AbstractMemberWriter; import jdk.javadoc.internal.doclets.formats.html.Contents; import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration; -import jdk.javadoc.internal.doclets.formats.html.MarkerComments; import jdk.javadoc.internal.doclets.formats.html.SectionName; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder; @@ -107,8 +106,8 @@ public class Navigation { } enum Position { - BOTTOM(MarkerComments.START_OF_BOTTOM_NAVBAR, MarkerComments.END_OF_BOTTOM_NAVBAR), - TOP(MarkerComments.START_OF_TOP_NAVBAR, MarkerComments.END_OF_TOP_NAVBAR); + BOTTOM(HtmlConstants.START_OF_BOTTOM_NAVBAR, HtmlConstants.END_OF_BOTTOM_NAVBAR), + TOP(HtmlConstants.START_OF_TOP_NAVBAR, HtmlConstants.END_OF_TOP_NAVBAR); final Content startOfNav; final Content endOfNav; diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java index ecaa514939c..96f1d1d2aeb 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, 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 @@ -304,8 +304,8 @@ public class SerializedFormBuilder extends AbstractBuilder { Content noCustomizationMsg = methodWriter.getNoCustomizationMsg( resources.getText("doclet.Serializable_no_customization")); classContentTree.addContent(methodWriter.getSerializableMethods( - resources.getText("doclet.Serialized_Form_methods"), - noCustomizationMsg)); + resources.getText("doclet.Serialized_Form_methods"), + noCustomizationMsg)); } } } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css index 287dde6433d..e46e2825f36 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css @@ -296,32 +296,25 @@ ul.subNavList li { /* * Styles for headings. */ -div.details ul.blockList ul.blockList ul.blockList li.blockList h3, -div.details ul.blockList ul.blockList ul.blockListLast li.blockList h3, -div.serializedFormContainer ul.blockList ul.blockList ul.blockList li.blockList h4 { +div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { background-color:#dee3e9; border:1px solid #d0d9e0; margin:0 0 6px -8px; padding:7px 5px; } -div.details h2, -div.summary h2 { - font-style: italic; -} -div.details h3, -div.summary h3 { - font-style: normal; -} -ul.blockList ul.blockList ul.blockList li.blockList h2 { +ul.blockList ul.blockList ul.blockList li.blockList h3 { background-color:#dee3e9; border:1px solid #d0d9e0; margin:0 0 6px -8px; padding:7px 5px; } -ul.blockList ul.blockList li.blockList h2 { +ul.blockList ul.blockList li.blockList h3 { padding:0; margin:15px 0; } +ul.blockList li.blockList h2 { + padding:0px 0 20px 0; +} /* * Styles for page layout containers. */ @@ -604,8 +597,7 @@ th.colDeprecatedItemName a:link, th.colDeprecatedItemName a:visited, .docSummary { padding:0; } -ul.blockList ul.blockList ul.blockList li.blockList h3, -ul.blockList ul.blockList ul.blockListLast li.blockList h3 { +ul.blockList ul.blockList ul.blockList li.blockList h3 { font-style:normal; } div.block { diff --git a/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java b/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java index 3664f73395f..d9af68abce3 100644 --- a/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java +++ b/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java @@ -57,11 +57,11 @@ public class TestAnnotationTypes extends JavadocTester { + "

      • Field | 
      • ", "", - "

        Field Summary

        ", + "

        Field Summary

        ", "
    ", "", - "

    DEFAULT_NAME

    \n" + "

    DEFAULT_NAME

    \n" + "
    static final java."
                     + "lang.String DEFAULT_NAME
    "); @@ -77,13 +77,13 @@ public class TestAnnotationTypes extends JavadocTester { "
  • ", "", "", - "

    Element Detail

    ", + "

    Element Detail

    ", "", "", "", "
      ", "
    • ", - "

      value

      ", + "

      value

      ", "
      int value
      " ); checkOutput("pkg/AnnotationType.html", false, diff --git a/test/langtools/jdk/javadoc/doclet/testHeadings/TestHeadings.java b/test/langtools/jdk/javadoc/doclet/testHeadings/TestHeadings.java index 0d301c86e0e..1336f1b6afd 100644 --- a/test/langtools/jdk/javadoc/doclet/testHeadings/TestHeadings.java +++ b/test/langtools/jdk/javadoc/doclet/testHeadings/TestHeadings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, 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 @@ -37,6 +37,23 @@ import javadoc.tester.JavadocTester; public class TestHeadings extends JavadocTester { + private static final String[][] TEST = { + + { + }, + { "serialized-form.html" + }, + { "serialized-form.html" + }, + + { + }, + { "overview-frame.html" + }, + { + } + }; + public static void main(String... args) throws Exception { TestHeadings tester = new TestHeadings(); tester.runTests(); @@ -91,7 +108,7 @@ public class TestHeadings extends JavadocTester { "

      Package pkg1

      ", "

      Class " + "pkg1.C1 extends java.lang.Object implements Serializable

      ", - "

      Serialized Fields

      "); + "

      Serialized Fields

      "); // Overview Frame checkOutput("overview-frame.html", true, diff --git a/test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java b/test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java index 846736046e4..e968a156d5d 100644 --- a/test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java +++ b/test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java @@ -67,8 +67,8 @@ public class TestHiddenTag extends JavadocTester { checkOutput("pkg1/A.VisibleInner.html", true, "visibleField", "visibleMethod", - "

      Nested classes/interfaces inherited from class pkg1." + - "A

      \n" + + "

      Nested classes/interfaces inherited from class pkg1." + + "A

      \n" + "" + "A.VisibleInner, A.VisibleInnerExtendsInvisibleInner
    • \n" + diff --git a/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java b/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java index 506bf946773..7bf5eeb18a3 100644 --- a/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java +++ b/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java @@ -75,7 +75,7 @@ public class TestHref extends JavadocTester { checkOutput("pkg/C4.html", true, //Header does not link to the page itself. - "Class C4<E extends C4<E>>", + "Class C4<E extends C4<E>>", //Signature does not link to the page itself. "public abstract class C4<E extends C4<E>>" ); diff --git a/test/langtools/jdk/javadoc/doclet/testHtmlLandmarkRegions/TestHtmlLandmarkRegions.java b/test/langtools/jdk/javadoc/doclet/testHtmlLandmarkRegions/TestHtmlLandmarkRegions.java index d18687a1616..882976201d4 100644 --- a/test/langtools/jdk/javadoc/doclet/testHtmlLandmarkRegions/TestHtmlLandmarkRegions.java +++ b/test/langtools/jdk/javadoc/doclet/testHtmlLandmarkRegions/TestHtmlLandmarkRegions.java @@ -109,7 +109,7 @@ public class TestHtmlLandmarkRegions extends JavadocTester { Path srcDir = base.resolve("src"); createPackages(srcDir); - Path outDir = base.resolve("out"); + Path outDir = base.resolve("out3"); javadoc("-d", outDir.toString(), "-doctitle", "Document Title", "-header", "Test Header", @@ -153,7 +153,7 @@ public class TestHtmlLandmarkRegions extends JavadocTester { + " \n" + "")); - Path outDir = base.resolve("out"); + Path outDir = base.resolve("out5"); javadoc("-d", outDir.toString(), "-sourcepath", srcDir.toString(), "pkg1", "pkg2"); @@ -171,12 +171,12 @@ public class TestHtmlLandmarkRegions extends JavadocTester { void createModules(Path srcDir) throws Exception { new ModuleBuilder(tb, "m1") - .classes("package p1; public class a { }") - .classes("package p2; public class b { }") + .classes("package p1; public class a{}") + .classes("package p2; public class b{}") .write(srcDir); new ModuleBuilder(tb, "m2") - .classes("package p3; public class c { }") - .classes("package p4; public class d { }") + .classes("package p3; public class c{}") + .classes("package p4; public class d{}") .write(srcDir); } diff --git a/test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java b/test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java index d5277d1a803..afe5a6a9568 100644 --- a/test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java +++ b/test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java @@ -349,46 +349,46 @@ public class TestHtmlVersion extends JavadocTester { + "
    • \n" + "\n" + "\n" - + "

      Nested Class Summary

      \n" + + "

      Nested Class Summary

      \n" + "
      \n
  • DEFAULT_NAME" + "
    ", "
    \n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Field Summary

      \n" + + "

      Field Summary

      \n" + "
      \n
    ", "
    \n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Constructor Summary

      \n" + + "

      Constructor Summary

      \n" + "
      \n
    ", "
    \n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Method Summary

      ", + + "

      Method Summary

      ", "
      \n" + "
        \n" + "
      • \n" + "\n" + "\n" - + "

        Field Detail

        ", + + "

        Field Detail

        ", "
        \n" + "
          \n" + "
        • \n" + "\n" + "\n" - + "

          Constructor Detail

          ", + + "

          Constructor Detail

          ", "
          \n" + "
            \n" + "
          • \n" + "\n" + "\n" - + "

            Method Detail

            ", + + "

            Method Detail

            ", "
            \n" + "
    \n", "
    \n" @@ -419,7 +419,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Method Summary

    \n" + + "

    Method Summary

    \n" + "
    \n", "
  • ", "
    \n" @@ -427,13 +427,13 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Enum Constant Detail

    ", + + "

    Enum Constant Detail

    ", "
    \n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Method Detail

      ", + + "

      Method Detail

      ", "
      \n" + "
  • \n", "
    \n" @@ -464,7 +464,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Method Detail

    ", + + "

    Method Detail

    ", "
    \n" + "
  • ", "
    \n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Optional Element Summary

      \n" + + "

      Optional Element Summary

      \n" + "
      \n
    ", "
    \n" + "
    ", "
    \n" + "
    ", "\n" @@ -831,7 +831,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Field Summary

    \n" + + "

    Field Summary

    \n" + "
    \n" + "
  • ", "\n" @@ -839,7 +839,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Constructor Summary

    \n" + + "

    Constructor Summary

    \n" + "
    \n" + "
  • ", "\n" @@ -847,7 +847,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Method Summary

    \n" + + "

    Method Summary

    \n" + "
    \n" + "
  • ", "\n" @@ -855,19 +855,19 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Field Detail

    ", + + "

    Field Detail

    ", "\n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Constructor Detail

      ", + + "

      Constructor Detail

      ", "\n" + "
        \n" + "
      • \n" + "\n" + "\n" - + "

        Method Detail

        "); + + "

        Method Detail

        "); // Negated test for enum page checkOutput("pkg/AnotherClass.ModalExclusionType.html", false, @@ -883,7 +883,7 @@ public class TestHtmlVersion extends JavadocTester { + "
      • \n" + "\n" + "\n" - + "

        Enum Constant Summary

        \n" + + "

        Enum Constant Summary

        \n" + "
        \n" + "
  • ", "\n" @@ -891,7 +891,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Method Summary

    \n" + + "

    Method Summary

    \n" + "
    \n" + "
  • ", "\n" @@ -899,13 +899,13 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Enum Constant Detail

    ", + + "

    Enum Constant Detail

    ", "\n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Method Detail

      "); + + "

      Method Detail

      "); // Negated test for interface page checkOutput("pkg2/Interface.html", false, @@ -921,7 +921,7 @@ public class TestHtmlVersion extends JavadocTester { + "
    • \n" + "\n" + "\n" - + "

      Method Summary

      \n" + + "

      Method Summary

      \n" + "
      \n" + "
  • ", "\n" @@ -929,7 +929,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Method Detail

    "); + + "

    Method Detail

    "); // Negated test for error page checkOutput("pkg/TestError.html", false, @@ -945,13 +945,13 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Constructor Summary

    ", + + "

    Constructor Summary

    ", "\n" + "
      \n" + "
    • \n" + "\n" + "\n" - + "

      Constructor Detail

      "); + + "

      Constructor Detail

      "); // Negated test for exception page checkOutput("pkg/TestException.html", false, @@ -967,13 +967,13 @@ public class TestHtmlVersion extends JavadocTester { + "
    • \n" + "\n" + "\n" - + "

      Constructor Summary

      ", + + "

      Constructor Summary

      ", "\n" + "
        \n" + "
      • \n" + "\n" + "\n" - + "

        Constructor Detail

        "); + + "

        Constructor Detail

        "); // Negated test for annotation page checkOutput("pkg2/TestAnnotationType.html", false, @@ -989,7 +989,7 @@ public class TestHtmlVersion extends JavadocTester { + "
      • \n" + "\n" + "\n" - + "

        Required Element Summary

        \n" + + "

        Required Element Summary

        \n" + "
        \n" + "
  • ", "\n" @@ -997,7 +997,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Optional Element Summary

    \n" + + "

    Optional Element Summary

    \n" + "
    \n" + "
  • ", "\n" @@ -1005,7 +1005,7 @@ public class TestHtmlVersion extends JavadocTester { + "
  • \n" + "\n" + "\n" - + "

    Element Detail

    "); + + "

    Element Detail

    "); // Negated test for class use page checkOutput("pkg1/class-use/RegClass.html", false, @@ -1027,7 +1027,7 @@ public class TestHtmlVersion extends JavadocTester { "
  • \n" + "\n" + "\n" - + "

    Uses of RegClass in pkg

    \n" + + "

    Uses of RegClass in pkg

    \n" + "
    \n
  • "); // Negated test for main index page diff --git a/test/langtools/jdk/javadoc/doclet/testIndexTaglet/TestIndexTaglet.java b/test/langtools/jdk/javadoc/doclet/testIndexTaglet/TestIndexTaglet.java index 4276f526cee..fe7eb3b2f1f 100644 --- a/test/langtools/jdk/javadoc/doclet/testIndexTaglet/TestIndexTaglet.java +++ b/test/langtools/jdk/javadoc/doclet/testIndexTaglet/TestIndexTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -75,12 +75,12 @@ public class TestIndexTaglet extends JavadocTester { checkExit(Exit.OK); checkOrder("pkg/A.html", - "

    Method Detail

    \n", + "

    Method Detail

    \n", "
    test description with search_phrase_a
    "); checkOrder("pkg/A.html", - "

    Method Summary

    \n", + "

    Method Summary

    \n", "
    test description with search_phrase_a
    "); } diff --git a/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java b/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java index fd7f2d46b2d..6842dcaabbd 100644 --- a/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java +++ b/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java @@ -131,7 +131,7 @@ public class TestInterface extends JavadocTester { "
    Specified by:
    \n"); checkOutput("pkg/ClassWithStaticMembers.html", true, - "

    f

    \n" + "

    f

    \n" + "
    public static int f
    \n" + "
    A hider field
    ", @@ -142,7 +142,7 @@ public class TestInterface extends JavadocTester { + "
    A hider method
    \n" + "\n", - "

    staticMethod

    \n" + "

    staticMethod

    \n" + "
    public static void staticMethod()
    \n" + "
    " + "Description copied from interface: " @@ -183,8 +183,8 @@ public class TestInterface extends JavadocTester { checkOutput("pkg2/Spliterator.OfDouble.html", true, // Ensure the correct type parameters are displayed correctly - "

    Nested classes/interfaces inherited from interface pkg2." - + "Spliterator

    \n" + "

    Nested classes/interfaces inherited from interface pkg2." + + "Spliterator

    \n" + "" + "Spliterator.OfDouble, Spliterator.OfInt<" diff --git a/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java b/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java index c91f74e7d73..87fb4b62d12 100644 --- a/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java +++ b/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java @@ -86,14 +86,14 @@ public class TestJavaFX extends JavadocTester { + "paused
    \n" + "
    \n" + "
    Defines if paused.
    ", - "

    paused

    \n" + "

    paused

    \n" + "
    public final C.BooleanProperty pausedProperty
    \n" + "
    Defines if paused. The second line.
    ", - "

    isPaused

    \n" + "

    isPaused

    \n" + "
    public final double isPaused()
    \n" + "
    Gets the value of the property paused.
    ", - "

    setPaused

    \n" + "

    setPaused

    \n" + "
    public final void setPaused​(boolean value)
    \n" + "
    Sets the value of the property paused.
    \n" + "
    \n" @@ -101,7 +101,7 @@ public class TestJavaFX extends JavadocTester { + "
    Defines if paused. The second line.
    \n" + "
    Default value:
    \n" + "
    false
    ", - "

    isPaused

    \n" + "

    isPaused

    \n" + "
    public final double isPaused()
    \n" + "
    Gets the value of the property paused.
    \n" + "
    \n" @@ -109,13 +109,13 @@ public class TestJavaFX extends JavadocTester { + "
    Defines if paused. The second line.
    \n" + "
    Default value:
    \n" + "
    false
    ", - "

    rate

    \n" + "

    rate

    \n" + "
    public final C.DoubleProperty rateProperty
    \n" + "
    Defines the direction/speed at which the " + "Timeline is expected to\n" + " be played. This is the second line.
    ", - "

    setRate

    \n" + "

    setRate

    \n" + "
    public final void setRate​(double value)
    \n" + "
    Sets the value of the property rate.
    \n" + "
    \n" @@ -126,7 +126,7 @@ public class TestJavaFX extends JavadocTester { + "
    11
    \n" + "
    Since:
    \n" + "
    JavaFX 8.0
    ", - "

    getRate

    \n" + "

    getRate

    \n" + "
    public final double getRate()
    \n" + "
    Gets the value of the property rate.
    \n" + "
    \n" @@ -137,7 +137,7 @@ public class TestJavaFX extends JavadocTester { + "
    11
    \n" + "
    Since:
    \n" + "
    JavaFX 8.0
    ", - "

    Property Summary

    \n" + "

    Property Summary

    \n" + "
    \n\n" + "", "\n" @@ -147,7 +147,7 @@ public class TestJavaFX extends JavadocTester { checkOutput("pkg1/C.html", false, "A()", - "

    Property Summary

    \n" + "

    Property Summary

    \n" + "
    \n" + "
    Properties 
    \n" + ""); checkOutput("pkg2/Test.html", false, - "

    Property Summary

    \n" + "

    Property Summary

    \n" + "
    \n" + "
    \n" + "\n" diff --git a/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java b/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java index 3c5fdee8898..264df25715b 100644 --- a/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java +++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java @@ -173,7 +173,7 @@ public class TestModuleServices extends JavadocTester { checkExit(Exit.OK); checkOutput("m/module-summary.html", false, - "

    Services

    "); + "

    Services

    "); } @Test @@ -194,7 +194,7 @@ public class TestModuleServices extends JavadocTester { checkExit(Exit.OK); checkOutput("m/module-summary.html", true, - "

    Services

    "); + "

    Services

    "); checkOutput("m/module-summary.html", true, "
    \n
    Properties 
    Modifier and TypeMethod
    \n" + @@ -235,7 +235,7 @@ public class TestModuleServices extends JavadocTester { checkExit(Exit.OK); checkOutput("m/module-summary.html", true, - "

    Services

    "); + "

    Services

    "); checkOutput("m/module-summary.html", true, "
    \n
    \n" + @@ -276,7 +276,7 @@ public class TestModuleServices extends JavadocTester { checkExit(Exit.OK); checkOutput("m/module-summary.html", false, - "

    Services

    "); + "

    Services

    "); } @Test @@ -302,7 +302,7 @@ public class TestModuleServices extends JavadocTester { checkExit(Exit.OK); checkOutput("m/module-summary.html", true, - "

    Services

    "); + "

    Services

    "); checkOutput("m/module-summary.html", true, "
    \n
    \n" + @@ -346,7 +346,7 @@ public class TestModuleServices extends JavadocTester { checkExit(Exit.OK); checkOutput("m/module-summary.html", true, - "

    Services

    "); + "

    Services

    "); checkOutput("m/module-summary.html", true, "
    \n
    \n" + @@ -389,7 +389,7 @@ public class TestModuleServices extends JavadocTester { checkExit(Exit.OK); checkOutput("m/module-summary.html", true, - "

    Services

    "); + "

    Services

    "); checkOutput("m/module-summary.html", true, "
    \n
    \n" + diff --git a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java index d1cc0af7679..e46f1c18401 100644 --- a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java +++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java @@ -1261,7 +1261,7 @@ public class TestModules extends JavadocTester { + "
    This is a test description for the test.moduleFullName.
    \n" + ""); checkOutput("module-overview-frame.html", found, - "

    Modules

    \n" + "

    Modules

    \n" + "
      \n" + "
    • moduleB
    • \n" + "
    • test.moduleFullName
    • \n" diff --git a/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java b/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java index c04f0c1b5cb..aaa9ee3e0dc 100644 --- a/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java +++ b/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java @@ -24,7 +24,7 @@ /* * @test * @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633 8026567 8162363 - * 8175200 8186332 8182765 8196202 8187288 8173730 8215307 + * 8175200 8186332 8182765 8196202 8187288 8173730 * @summary Run Javadoc on a set of source files that demonstrate new * language features. Check the output to ensure that the new * language features are properly documented. @@ -66,7 +66,7 @@ public class TestNewLanguageFeatures extends JavadocTester { void checkEnums() { checkOutput("pkg/Coin.html", true, // Make sure enum header is correct. - "Enum Coin", + "Enum Coin", // Make sure enum signature is correct. "
      public enum "
                       + "Coin\n"
      @@ -110,7 +110,7 @@ public class TestNewLanguageFeatures extends JavadocTester {
           void checkTypeParameters() {
               checkOutput("pkg/TypeParameters.html", true,
                       // Make sure the header is correct.
      -                "Class TypeParameters<E>",
      +                "Class TypeParameters<E>",
                       // Check class type parameters section.
                       "
      Type Parameters:
      \n" + "
      E - " diff --git a/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java b/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java index 93b0e21fb7e..572929f3f15 100644 --- a/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java +++ b/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java @@ -193,10 +193,10 @@ public class TestOptions extends JavadocTester { "
      @Documented\npublic @interface "
                       + "AnnotationTypeField
      ", - "

      DEFAULT_NAME

      \n
      static final java.lang.String "
      +                "

      DEFAULT_NAME

      \n
      static final java.lang.String "
                       + ""
                       + "DEFAULT_NAME
      ", - "

      name

      \n
      java.lang.String name\n
      java.lang.String name
      "); checkOutput("src-html/linksource/AnnotationTypeField.html", true, diff --git a/test/langtools/jdk/javadoc/doclet/testOrdering/TestOrdering.java b/test/langtools/jdk/javadoc/doclet/testOrdering/TestOrdering.java index 4e73dfdca84..f9038e72bb2 100644 --- a/test/langtools/jdk/javadoc/doclet/testOrdering/TestOrdering.java +++ b/test/langtools/jdk/javadoc/doclet/testOrdering/TestOrdering.java @@ -551,107 +551,107 @@ public class TestOrdering extends JavadocTester { checkExit(Exit.OK); checkOrder("pkg5/AnnoFieldTest.html", - "

      Field Detail

      ", + "

      Field Detail

      ", "
      static final int one
      ", "
      static final int two
      ", "
      static final int three
      ", "
      static final int four
      "); checkOrder("pkg5/AnnoOptionalTest.html", - "

      Optional Element Summary

      ", + "

      Optional Element Summary

      ", "four", "one", "three", "two", - "

      Element Detail

      ", - "

      one

      ", - "

      two

      ", - "

      three

      ", - "

      four

      "); + "

      Element Detail

      ", + "

      one

      ", + "

      two

      ", + "

      three

      ", + "

      four

      "); checkOrder("pkg5/AnnoRequiredTest.html", - "

      Required Element Summary

      ", + "

      Required Element Summary

      ", "four", "one", "three", "two", - "

      Element Detail

      ", - "

      one

      ", - "

      two

      ", - "

      three

      ", - "

      four

      "); + "

      Element Detail

      ", + "

      one

      ", + "

      two

      ", + "

      three

      ", + "

      four

      "); checkOrder("pkg5/CtorTest.html", - "

      Constructor Summary

      ", + "

      Constructor Summary

      ", "Constructor Detail", + "

      Constructor Detail

      ", "
      ", "", "", ""); checkOrder("pkg5/EnumTest.html", - "

      Enum Constant Summary

      ", + "

      Enum Constant Summary

      ", "
      FOUR", "ONE", "THREE", "TWO", - "

      Enum Constant Detail

      ", - "

      ONE

      ", - "

      TWO

      ", - "

      THREE

      ", - "

      FOUR

      "); + "

      Enum Constant Detail

      ", + "

      ONE

      ", + "

      TWO

      ", + "

      THREE

      ", + "

      FOUR

      "); checkOrder("pkg5/FieldTest.html", - "

      Field Summary

      ", + "

      Field Summary

      ", "four", "one", "three", "two", - "

      Field Detail

      ", - "

      one

      ", - "

      two

      ", - "

      three

      ", - "

      four

      "); + "

      Field Detail

      ", + "

      one

      ", + "

      two

      ", + "

      three

      ", + "

      four

      "); checkOrder("pkg5/IntfTest.html", - "

      Method Summary

      ", + "

      Method Summary

      ", "four", "one", "three", "two", - "

      Method Detail

      ", - "

      one

      ", - "

      two

      ", - "

      three

      ", - "

      four

      "); + "

      Method Detail

      ", + "

      one

      ", + "

      two

      ", + "

      three

      ", + "

      four

      "); checkOrder("pkg5/MethodTest.html", - "

      Method Summary

      ", + "

      Method Summary

      ", "four", "one", "three", "two", - "

      Method Detail

      ", - "

      one

      ", - "

      two

      ", - "

      three

      ", - "

      four

      "); + "

      Method Detail

      ", + "

      one

      ", + "

      two

      ", + "

      three

      ", + "

      four

      "); checkOrder("pkg5/PropertyTest.html", - "

      Property Summary

      ", + "

      Property Summary

      ", "four", "one", "three", "two", - "

      Property Detail

      ", - "

      oneProperty

      ", - "

      twoProperty

      ", - "

      threeProperty

      ", - "

      fourProperty

      "); + "

      Property Detail

      ", + "

      oneProperty

      ", + "

      twoProperty

      ", + "

      threeProperty

      ", + "

      fourProperty

      "); } } diff --git a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestBadOverride.java b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestBadOverride.java index d7c346bfa77..b46c2c3342b 100644 --- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestBadOverride.java +++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestBadOverride.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019, 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 @@ -53,7 +53,7 @@ public class TestBadOverride extends JavadocTester { checkOutput("pkg4/Foo.html", true, "
    • \n" - + "

      toString

      \n" + + "

      toString

      \n" + "
      public void toString()
      \n" + "
      Why can't I do this ?
      \n" + "
    • "); diff --git a/test/langtools/jdk/javadoc/doclet/testSerializedForm/TestSerializedForm.java b/test/langtools/jdk/javadoc/doclet/testSerializedForm/TestSerializedForm.java index 46499236cf7..6ffbe096119 100644 --- a/test/langtools/jdk/javadoc/doclet/testSerializedForm/TestSerializedForm.java +++ b/test/langtools/jdk/javadoc/doclet/testSerializedForm/TestSerializedForm.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 4341304 4485668 4966728 8032066 8071982 8192933 8215307 + * @bug 4341304 4485668 4966728 8032066 8071982 8192933 * @summary Test that methods readResolve and writeReplace show * up in serialized-form.html the same way that readObject and writeObject do. * If the doclet includes readResolve and writeReplace in the serialized-form @@ -109,8 +109,6 @@ public class TestSerializedForm extends JavadocTester { testSrc("SerializedForm.java"), testSrc("ExternalizedForm.java"), "pkg1"); checkExit(Exit.OK); - showHeadings("serialized-form.html"); - checkOutput("serialized-form.html", true, "

      Class pkg1.NestedInnerClass.InnerClass.ProNestedInnerClass " @@ -132,15 +130,15 @@ public class TestSerializedForm extends JavadocTester { + "extends java.lang.Object implements Serializable

      "); checkOutput("serialized-form.html", true, - "

      Serialized Fields

      \n" + + "

      Serialized Fields

      \n" + "
        \n" + "
      • \n" + - "
        longs
        \n" + + "

        longs

        \n" + "
        Long[] longs
        \n" + "
        the longs
        \n" + "
      • \n" + "
      • \n" + - "
        name
        \n" + + "

        name

        \n" + "
        java.lang.String name
        \n" + "
        a test
        "); } diff --git a/test/langtools/jdk/javadoc/doclet/testSummaryHeading/TestSummaryHeading.java b/test/langtools/jdk/javadoc/doclet/testSummaryHeading/TestSummaryHeading.java index 4a03c499b5a..828bff1ad51 100644 --- a/test/langtools/jdk/javadoc/doclet/testSummaryHeading/TestSummaryHeading.java +++ b/test/langtools/jdk/javadoc/doclet/testSummaryHeading/TestSummaryHeading.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, 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 @@ -51,6 +51,6 @@ public class TestSummaryHeading extends JavadocTester { checkExit(Exit.OK); checkOutput("C.html", true, - "

        Method Summary

        "); + "

        Method Summary

        "); } } diff --git a/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java b/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java index 76d99202311..7c1f5da9a13 100644 --- a/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java +++ b/test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java @@ -86,7 +86,7 @@ public class TestSummaryTag extends JavadocTester { // make sure the second @summary's content is displayed correctly checkOutput("p1/A.html", true, "
      • \n" - + "

        m3

        \n" + + "

        m3

        \n" + "
        public void m3()
        \n" + "
        First sentence some text maybe second sentence.
        \n" + "
      • \n" diff --git a/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/TestSystemPropertyTaglet.java b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/TestSystemPropertyTaglet.java index e14c348a679..551ea5c61f6 100644 --- a/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/TestSystemPropertyTaglet.java +++ b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/TestSystemPropertyTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -76,9 +76,9 @@ public class TestSystemPropertyTaglet extends JavadocTester { checkExit(Exit.OK); checkOrder("pkg/A.html", - "

        Class A

        ", + "

        Class A

        ", "test with user.name", - "

        Method Detail

        ", + "

        Method Detail

        ", "test with java.version"); checkOrder("index-all.html", diff --git a/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java b/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java index 2a99ab3f7ff..c1b2868376d 100644 --- a/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java +++ b/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java @@ -232,7 +232,7 @@ public abstract class JavadocTester { private DirectoryCheck outputDirectoryCheck = DirectoryCheck.EMPTY; - private boolean automaticCheckAccessibility = true; + private boolean automaticCheckAccessibility = false; private boolean automaticCheckLinks = true; /** The current subtest number. Incremented when checking(...) is called. */ @@ -261,7 +261,7 @@ public abstract class JavadocTester { } /** - * Runs all methods annotated with @Test, followed by printSummary. + * Run all methods annotated with @Test, followed by printSummary. * Typically called on a tester object in main() * @param f a function which will be used to provide arguments to each * invoked method @@ -285,7 +285,7 @@ public abstract class JavadocTester { } /** - * Runs javadoc. + * Run javadoc. * The output directory used by this call and the final exit code * will be saved for later use. * To aid the reader, it is recommended that calls to this method @@ -391,7 +391,7 @@ public abstract class JavadocTester { } /** - * Sets the kind of check for the initial contents of the output directory + * Set the kind of check for the initial contents of the output directory * before javadoc is run. * The filter should return true for files that should not appear. * @param c the kind of check to perform @@ -401,14 +401,7 @@ public abstract class JavadocTester { } /** - * Sets whether or not to perform an automatic call of checkAccessibility. - */ - public void setAutomaticCheckAccessibility(boolean b) { - automaticCheckAccessibility = b; - } - - /** - * Sets whether or not to perform an automatic call of checkLinks. + * Set whether or not to perform an automatic call of checkLinks. */ public void setAutomaticCheckLinks(boolean b) { automaticCheckLinks = b; @@ -438,7 +431,7 @@ public abstract class JavadocTester { } /** - * Checks the exit code of the most recent call of javadoc. + * Check the exit code of the most recent call of javadoc. * * @param expected the exit code that is required for the test * to pass. @@ -453,7 +446,7 @@ public abstract class JavadocTester { } /** - * Checks for content in (or not in) the generated output. + * Check for content in (or not in) the generated output. * Within the search strings, the newline character \n * will be translated to the platform newline character sequence. * @param path a path within the most recent output directory @@ -472,7 +465,7 @@ public abstract class JavadocTester { } /** - * Checks for content in (or not in) the generated output. + * Check for content in (or not in) the generated output. * Within the search strings, the newline character \n * will be translated to the platform newline character sequence. * @param path a path within the most recent output directory, identifying @@ -494,7 +487,7 @@ public abstract class JavadocTester { } /** - * Checks for content in (or not in) the one of the output streams written by + * Check for content in (or not in) the one of the output streams written by * javadoc. Within the search strings, the newline character \n * will be translated to the platform newline character sequence. * @param output the output stream to check @@ -526,11 +519,6 @@ public abstract class JavadocTester { } } - /** - * Performs some structural accessibility checks on the files generated by the most - * recent run of javadoc. - * The checks can be run automatically by calling {@link #setAutomaticCheckAccessibility}. - */ public void checkAccessibility() { checking("Check accessibility"); A11yChecker c = new A11yChecker(out, this::readFile); @@ -548,11 +536,6 @@ public abstract class JavadocTester { } } - /** - * Checks all the links within the files generated by the most - * recent run of javadoc. - * The checks can be run automatically by calling {@link #setAutomaticCheckLinks}. - */ public void checkLinks() { checking("Check links"); LinkChecker c = new LinkChecker(out, this::readFile); @@ -571,27 +554,7 @@ public abstract class JavadocTester { } /** - * Shows the heading structure for each of the specified files. - * The structure is is printed in plain text to the main output stream. - * No errors are reported (unless there is a problem reading a file) - * but missing headings are noted within the output. - * @params the files - */ - public void showHeadings(String... paths) { - ShowHeadings s = new ShowHeadings(out, this::readFile); - for (String p : paths) { - try { - File f = new File(outputDir, p); - s.checkFiles(List.of(f.toPath()), false, Collections.emptySet()); - } catch (IOException e) { - checking("Read file"); - failed("Error reading file: " + e); - } - } - } - - /** - * Gets the content of the one of the output streams written by javadoc. + * Get the content of the one of the output streams written by javadoc. * @param output the name of the output stream * @return the content of the output stream */ @@ -600,7 +563,7 @@ public abstract class JavadocTester { } /** - * Gets the content of the one of the output streams written by javadoc. + * Get the content of the one of the output streams written by javadoc. * @param output the name of the output stream * @return the content of the output stream, as a line of lines */ @@ -610,7 +573,7 @@ public abstract class JavadocTester { } /** - * Checks for files in (or not in) the generated output. + * Check for files in (or not in) the generated output. * @param expectedFound true if all of the files are expected * to be found, or false if all of the files are expected to be * not found @@ -621,7 +584,7 @@ public abstract class JavadocTester { } /** - * Checks for files in (or not in) the generated output. + * Check for files in (or not in) the generated output. * @param expectedFound true if all of the files are expected * to be found, or false if all of the files are expected to be * not found @@ -642,7 +605,7 @@ public abstract class JavadocTester { } /** - * Checks that a series of strings are found in order in a file in + * Check that a series of strings are found in order in a file in * the generated output. * @param path the file to check * @param strings the strings whose order to check @@ -695,7 +658,7 @@ public abstract class JavadocTester { } /** - * Compares a set of files in each of two directories. + * Compare a set of files in each of two directories. * * @param baseDir1 the directory containing the first set of files * @param baseDir2 the directory containing the second set of files @@ -710,7 +673,7 @@ public abstract class JavadocTester { } /** - * Copies a directory from one place to another. + * A utility to copy a directory from one place to another. * * @param targetDir the directory to copy. * @param destDir the destination to copy the directory to. @@ -744,7 +707,7 @@ public abstract class JavadocTester { } /** - * Copies a file. + * Copy source file to destination file. * * @param destfile the destination file * @param srcfile the source file @@ -786,7 +749,7 @@ public abstract class JavadocTester { } /** - * Reads the file and return it as a string. + * Read the file and return it as a string. * * @param baseDir the directory in which to locate the file * @param fileName the name of the file to read @@ -862,7 +825,7 @@ public abstract class JavadocTester { } /** - * Prints a summary of the test results. + * Print a summary of the test results. */ protected void printSummary() { String javadocRuns = (javadocRunNum <= 1) ? "" @@ -882,7 +845,7 @@ public abstract class JavadocTester { } /** - * Searches for the string in the given file and return true + * Search for the string in the given file and return true * if the string was found. * * @param fileString the contents of the file to search through @@ -898,7 +861,7 @@ public abstract class JavadocTester { } /** - * Compares the two given files. + * Compare the two given files. * * @param baseDir1 the directory in which to locate the first file * @param baseDir2 the directory in which to locate the second file diff --git a/test/langtools/jdk/javadoc/lib/javadoc/tester/ShowHeadings.java b/test/langtools/jdk/javadoc/lib/javadoc/tester/ShowHeadings.java deleted file mode 100644 index c18186d06d3..00000000000 --- a/test/langtools/jdk/javadoc/lib/javadoc/tester/ShowHeadings.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2019, 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 javadoc.tester; - -import java.io.PrintStream; -import java.nio.file.Path; -import java.util.Map; -import java.util.function.Function; - -public class ShowHeadings extends HtmlChecker { - - private int currLevel; - - private boolean copyContent; - - ShowHeadings(PrintStream out, Function fileReader) { - super(out, fileReader); - } - - @Override - public void report() { - } - - @Override - public void startFile(Path path) { - out.println("Headings: " + path); - currLevel = 0; - } - - @Override - public void endFile() { - } - - @Override - public void docType(String doctype) { - } - - @Override - public void startElement(String name, Map attrs, boolean selfClosing) { - switch (name) { - case "h1": case "h2": case "h3": case "h4": case "h5": case "h6": - startHeading(name); - break; - } - } - - @Override - public void endElement(String name) { - switch (name) { - case "h1": case "h2": case "h3": case "h4": case "h5": case "h6": - out.println(); - copyContent = false; - break; - } - - } - - private void startHeading(String h) { - int level = Character.digit(h.charAt(1), 10); - while (level > currLevel + 1) { - currLevel++; - out.println("* ".repeat(currLevel - 1) + "H" + currLevel + ": *** MISSING ***"); - } - currLevel = level; - out.print("* ".repeat(currLevel - 1) + "H" + currLevel + ": "); - copyContent = true; - } - - @Override - public void content(String s) { - if (copyContent) { - out.print(s.replace(" ", " ") - .replace("<", "<") - .replace(">", ">") - .replace("&", "&") - .replaceAll("\\s+", " ") - ); - } - } -} - From d06f3e7e28bd1baf00b903a7c6b2f18965e73311 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Thu, 21 Feb 2019 17:07:35 -0800 Subject: [PATCH 075/109] 8218751: Do not store original classfiles inside the CDS archive Remove the OD shared region and decode classfiles on the fly Reviewed-by: jiangli, ccheung, sspitsyn, redestad --- src/hotspot/share/classfile/classLoader.hpp | 4 +- src/hotspot/share/classfile/klassFactory.cpp | 54 +++------------ src/hotspot/share/classfile/klassFactory.hpp | 4 +- .../share/classfile/systemDictionary.cpp | 8 ++- .../share/classfile/systemDictionary.hpp | 1 + .../classfile/systemDictionaryShared.cpp | 9 ++- .../classfile/systemDictionaryShared.hpp | 1 + src/hotspot/share/memory/filemap.cpp | 67 ++++++++++++++++++- src/hotspot/share/memory/filemap.hpp | 9 +++ src/hotspot/share/memory/metaspaceShared.cpp | 46 +++---------- src/hotspot/share/memory/metaspaceShared.hpp | 8 +-- src/hotspot/share/oops/instanceKlass.cpp | 25 +------ src/hotspot/share/oops/instanceKlass.hpp | 8 --- src/hotspot/share/runtime/mutexLocker.cpp | 6 ++ src/hotspot/share/runtime/mutexLocker.hpp | 3 + .../SpaceUtilizationCheck.java | 6 +- 16 files changed, 128 insertions(+), 131 deletions(-) diff --git a/src/hotspot/share/classfile/classLoader.hpp b/src/hotspot/share/classfile/classLoader.hpp index 4e556baeff6..60f6135a523 100644 --- a/src/hotspot/share/classfile/classLoader.hpp +++ b/src/hotspot/share/classfile/classLoader.hpp @@ -247,12 +247,12 @@ class ClassLoader: AllStatic { static void load_zip_library(); static void load_jimage_library(); + + public: static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st, bool throw_exception, bool is_boot_append, TRAPS); - public: - // If the package for the fully qualified class name is in the boot // loader's package entry table then add_package() sets the classpath_index // field so that get_system_package() will know to return a non-null value diff --git a/src/hotspot/share/classfile/klassFactory.cpp b/src/hotspot/share/classfile/klassFactory.cpp index e2c8aaa27c3..50a3d9d1b66 100644 --- a/src/hotspot/share/classfile/klassFactory.cpp +++ b/src/hotspot/share/classfile/klassFactory.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2015, 2019, 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,22 +46,22 @@ InstanceKlass* KlassFactory::check_shared_class_file_load_hook( InstanceKlass* ik, Symbol* class_name, Handle class_loader, - Handle protection_domain, TRAPS) { + Handle protection_domain, + const ClassFileStream *cfs, + TRAPS) { #if INCLUDE_CDS && INCLUDE_JVMTI assert(ik != NULL, "sanity"); assert(ik->is_shared(), "expecting a shared class"); - if (JvmtiExport::should_post_class_file_load_hook()) { assert(THREAD->is_Java_thread(), "must be JavaThread"); // Post the CFLH JvmtiCachedClassFileData* cached_class_file = NULL; - JvmtiCachedClassFileData* archived_class_data = ik->get_archived_class_data(); - assert(archived_class_data != NULL, "shared class has no archived class data"); - unsigned char* ptr = - VM_RedefineClasses::get_cached_class_file_bytes(archived_class_data); - unsigned char* end_ptr = - ptr + VM_RedefineClasses::get_cached_class_file_len(archived_class_data); + if (cfs == NULL) { + cfs = FileMapInfo::open_stream_for_jvmti(ik, CHECK_NULL); + } + unsigned char* ptr = (unsigned char*)cfs->buffer(); + unsigned char* end_ptr = ptr + cfs->length(); unsigned char* old_ptr = ptr; JvmtiExport::post_class_file_load_hook(class_name, class_loader, @@ -75,25 +75,9 @@ InstanceKlass* KlassFactory::check_shared_class_file_load_hook( ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader()); int path_index = ik->shared_classpath_index(); - const char* pathname; - if (path_index < 0) { - // shared classes loaded by user defined class loader - // do not have shared_classpath_index - ModuleEntry* mod_entry = ik->module(); - if (mod_entry != NULL && (mod_entry->location() != NULL)) { - ResourceMark rm; - pathname = (const char*)(mod_entry->location()->as_C_string()); - } else { - pathname = ""; - } - } else { - SharedClassPathEntry* ent = - (SharedClassPathEntry*)FileMapInfo::shared_path(path_index); - pathname = ent == NULL ? NULL : ent->name(); - } ClassFileStream* stream = new ClassFileStream(ptr, end_ptr - ptr, - pathname, + cfs->source(), ClassFileStream::verify); ClassFileParser parser(stream, class_name, @@ -236,24 +220,6 @@ InstanceKlass* KlassFactory::create_from_stream(ClassFileStream* stream, #if INCLUDE_CDS if (DumpSharedSpaces) { ClassLoader::record_result(result, stream, THREAD); -#if INCLUDE_JVMTI - assert(cached_class_file == NULL, "Sanity"); - // Archive the class stream data into the optional data section - JvmtiCachedClassFileData *p; - int len; - const unsigned char *bytes; - // event based tracing might set cached_class_file - if ((bytes = result->get_cached_class_file_bytes()) != NULL) { - len = result->get_cached_class_file_len(); - } else { - len = stream->length(); - bytes = stream->buffer(); - } - p = (JvmtiCachedClassFileData*)os::malloc(offset_of(JvmtiCachedClassFileData, data) + len, mtInternal); - p->length = len; - memcpy(p->data, bytes, len); - result->set_archived_class_data(p); -#endif // INCLUDE_JVMTI } #endif // INCLUDE_CDS diff --git a/src/hotspot/share/classfile/klassFactory.hpp b/src/hotspot/share/classfile/klassFactory.hpp index 11132eeb395..434fcd1faeb 100644 --- a/src/hotspot/share/classfile/klassFactory.hpp +++ b/src/hotspot/share/classfile/klassFactory.hpp @@ -80,7 +80,9 @@ class KlassFactory : AllStatic { InstanceKlass* ik, Symbol* class_name, Handle class_loader, - Handle protection_domain, TRAPS); + Handle protection_domain, + const ClassFileStream *cfs, + TRAPS); }; #endif // SHARE_CLASSFILE_KLASSFACTORY_HPP diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp index 505f5964b2a..caa76719769 100644 --- a/src/hotspot/share/classfile/systemDictionary.cpp +++ b/src/hotspot/share/classfile/systemDictionary.cpp @@ -1174,7 +1174,7 @@ InstanceKlass* SystemDictionary::load_shared_boot_class(Symbol* class_name, TRAPS) { InstanceKlass* ik = SystemDictionaryShared::find_builtin_class(class_name); if (ik != NULL && ik->is_shared_boot_class()) { - return load_shared_class(ik, Handle(), Handle(), THREAD); + return load_shared_class(ik, Handle(), Handle(), NULL, THREAD); } return NULL; } @@ -1274,7 +1274,9 @@ bool SystemDictionary::is_shared_class_visible(Symbol* class_name, InstanceKlass* SystemDictionary::load_shared_class(InstanceKlass* ik, Handle class_loader, - Handle protection_domain, TRAPS) { + Handle protection_domain, + const ClassFileStream *cfs, + TRAPS) { if (ik != NULL) { Symbol* class_name = ik->name(); @@ -1321,7 +1323,7 @@ InstanceKlass* SystemDictionary::load_shared_class(InstanceKlass* ik, } InstanceKlass* new_ik = KlassFactory::check_shared_class_file_load_hook( - ik, class_name, class_loader, protection_domain, CHECK_NULL); + ik, class_name, class_loader, protection_domain, cfs, CHECK_NULL); if (new_ik != NULL) { // The class is changed by CFLH. Return the new class. The shared class is // not used. diff --git a/src/hotspot/share/classfile/systemDictionary.hpp b/src/hotspot/share/classfile/systemDictionary.hpp index 87d1e6c57a9..a7206fadfa4 100644 --- a/src/hotspot/share/classfile/systemDictionary.hpp +++ b/src/hotspot/share/classfile/systemDictionary.hpp @@ -628,6 +628,7 @@ protected: static InstanceKlass* load_shared_class(InstanceKlass* ik, Handle class_loader, Handle protection_domain, + const ClassFileStream *cfs, TRAPS); static InstanceKlass* load_shared_boot_class(Symbol* class_name, TRAPS); diff --git a/src/hotspot/share/classfile/systemDictionaryShared.cpp b/src/hotspot/share/classfile/systemDictionaryShared.cpp index 91cfeee4e5c..1585be073df 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.cpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.cpp @@ -803,7 +803,7 @@ InstanceKlass* SystemDictionaryShared::load_shared_class_for_builtin_loader( SystemDictionary::is_platform_class_loader(class_loader()))) { Handle protection_domain = SystemDictionaryShared::init_security_info(class_loader, ik, CHECK_NULL); - return load_shared_class(ik, class_loader, protection_domain, THREAD); + return load_shared_class(ik, class_loader, protection_domain, NULL, THREAD); } } return NULL; @@ -873,13 +873,15 @@ InstanceKlass* SystemDictionaryShared::lookup_from_stream(Symbol* class_name, } return acquire_class_for_current_thread(record->_klass, class_loader, - protection_domain, THREAD); + protection_domain, cfs, + THREAD); } InstanceKlass* SystemDictionaryShared::acquire_class_for_current_thread( InstanceKlass *ik, Handle class_loader, Handle protection_domain, + const ClassFileStream *cfs, TRAPS) { ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader()); @@ -900,7 +902,8 @@ InstanceKlass* SystemDictionaryShared::acquire_class_for_current_thread( loader_data->add_class(ik); // Load and check super/interfaces, restore unsharable info - InstanceKlass* shared_klass = load_shared_class(ik, class_loader, protection_domain, THREAD); + InstanceKlass* shared_klass = load_shared_class(ik, class_loader, protection_domain, + cfs, THREAD); if (shared_klass == NULL || HAS_PENDING_EXCEPTION) { // TODO: clean up so it can be used again return NULL; diff --git a/src/hotspot/share/classfile/systemDictionaryShared.hpp b/src/hotspot/share/classfile/systemDictionaryShared.hpp index 378941e48e9..eda58447c32 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.hpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.hpp @@ -207,6 +207,7 @@ private: InstanceKlass *ik, Handle class_loader, Handle protection_domain, + const ClassFileStream* cfs, TRAPS); static DumpTimeSharedClassInfo* find_or_allocate_info_for(InstanceKlass* k); static void write_dictionary(RunTimeSharedDictionary* dictionary, bool is_builtin); diff --git a/src/hotspot/share/memory/filemap.cpp b/src/hotspot/share/memory/filemap.cpp index 440ca3c7aac..84e37f309de 100644 --- a/src/hotspot/share/memory/filemap.cpp +++ b/src/hotspot/share/memory/filemap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -45,6 +45,7 @@ #include "prims/jvmtiExport.hpp" #include "runtime/arguments.hpp" #include "runtime/java.hpp" +#include "runtime/mutexLocker.hpp" #include "runtime/os.inline.hpp" #include "runtime/vm_version.hpp" #include "services/memTracker.hpp" @@ -501,6 +502,16 @@ bool FileMapInfo::validate_shared_path_table() { } _validating_shared_path_table = false; + +#if INCLUDE_JVMTI + if (_classpath_entries_for_jvmti != NULL) { + os::free(_classpath_entries_for_jvmti); + } + size_t sz = sizeof(ClassPathEntry*) * _shared_path_table_size; + _classpath_entries_for_jvmti = (ClassPathEntry**)os::malloc(sz, mtClass); + memset(_classpath_entries_for_jvmti, 0, sz); +#endif + return true; } @@ -1440,3 +1451,57 @@ void FileMapInfo::stop_sharing_and_unmap(const char* msg) { fail_stop("%s", msg); } } + +#if INCLUDE_JVMTI +ClassPathEntry** FileMapInfo::_classpath_entries_for_jvmti = NULL; + +ClassPathEntry* FileMapInfo::get_classpath_entry_for_jvmti(int i, TRAPS) { + ClassPathEntry* ent = _classpath_entries_for_jvmti[i]; + if (ent == NULL) { + if (i == 0) { + ent = ClassLoader:: get_jrt_entry(); + assert(ent != NULL, "must be"); + } else { + SharedClassPathEntry* scpe = shared_path(i); + assert(scpe->is_jar(), "must be"); // other types of scpe will not produce archived classes + + const char* path = scpe->name(); + struct stat st; + if (os::stat(path, &st) != 0) { + char *msg = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, strlen(path) + 128); ; + jio_snprintf(msg, strlen(path) + 127, "error in opening JAR file %s", path); + THROW_MSG_(vmSymbols::java_io_IOException(), msg, NULL); + } else { + ent = ClassLoader::create_class_path_entry(path, &st, /*throw_exception=*/true, false, CHECK_NULL); + } + } + + MutexLocker mu(CDSClassFileStream_lock, THREAD); + if (_classpath_entries_for_jvmti[i] == NULL) { + _classpath_entries_for_jvmti[i] = ent; + } else { + // Another thread has beat me to creating this entry + delete ent; + ent = _classpath_entries_for_jvmti[i]; + } + } + + return ent; +} + +ClassFileStream* FileMapInfo::open_stream_for_jvmti(InstanceKlass* ik, TRAPS) { + int path_index = ik->shared_classpath_index(); + assert(path_index >= 0, "should be called for shared built-in classes only"); + assert(path_index < (int)_shared_path_table_size, "sanity"); + + ClassPathEntry* cpe = get_classpath_entry_for_jvmti(path_index, CHECK_NULL); + assert(cpe != NULL, "must be"); + + Symbol* name = ik->name(); + const char* const class_name = name->as_C_string(); + const char* const file_name = ClassLoader::file_name_for_class_name(class_name, + name->utf8_length()); + return cpe->open_stream(file_name, THREAD); +} + +#endif diff --git a/src/hotspot/share/memory/filemap.hpp b/src/hotspot/share/memory/filemap.hpp index ee28cd97c6e..8b535261a8c 100644 --- a/src/hotspot/share/memory/filemap.hpp +++ b/src/hotspot/share/memory/filemap.hpp @@ -302,6 +302,10 @@ public: bool validate_shared_path_table(); static void update_shared_classpath(ClassPathEntry *cpe, SharedClassPathEntry* ent, TRAPS); +#if INCLUDE_JVMTI + static ClassFileStream* open_stream_for_jvmti(InstanceKlass* ik, TRAPS); +#endif + static SharedClassPathEntry* shared_path(int index) { if (index < 0) { return NULL; @@ -348,6 +352,11 @@ public: } address decode_start_address(CDSFileMapRegion* spc, bool with_current_oop_encoding_mode); + +#if INCLUDE_JVMTI + static ClassPathEntry** _classpath_entries_for_jvmti; + static ClassPathEntry* get_classpath_entry_for_jvmti(int i, TRAPS); +#endif }; #endif // SHARE_MEMORY_FILEMAP_HPP diff --git a/src/hotspot/share/memory/metaspaceShared.cpp b/src/hotspot/share/memory/metaspaceShared.cpp index cd8c58a71f7..6ce300fcce3 100644 --- a/src/hotspot/share/memory/metaspaceShared.cpp +++ b/src/hotspot/share/memory/metaspaceShared.cpp @@ -207,7 +207,7 @@ public: }; -DumpRegion _mc_region("mc"), _ro_region("ro"), _rw_region("rw"), _md_region("md"), _od_region("od"); +DumpRegion _mc_region("mc"), _ro_region("ro"), _rw_region("rw"), _md_region("md"); size_t _total_closed_archive_region_size = 0, _total_open_archive_region_size = 0; char* MetaspaceShared::misc_code_space_alloc(size_t num_bytes) { @@ -598,23 +598,6 @@ static void rewrite_nofast_bytecodes_and_calculate_fingerprints() { } } -static void relocate_cached_class_file() { - for (int i = 0; i < _global_klass_objects->length(); i++) { - Klass* k = _global_klass_objects->at(i); - if (k->is_instance_klass()) { - InstanceKlass* ik = InstanceKlass::cast(k); - JvmtiCachedClassFileData* p = ik->get_archived_class_data(); - if (p != NULL) { - int size = offset_of(JvmtiCachedClassFileData, data) + p->length; - JvmtiCachedClassFileData* q = (JvmtiCachedClassFileData*)_od_region.allocate(size); - q->length = p->length; - memcpy(q->data, p->data, p->length); - ik->set_archived_class_data(q); - } - } - } -} - // Objects of the Metadata types (such as Klass and ConstantPool) have C++ vtables. // (In GCC this is the field ::_vptr, i.e., first word in the object.) // @@ -1438,15 +1421,11 @@ void VM_PopulateDumpSharedSpace::doit() { char* vtbl_list = _md_region.top(); MetaspaceShared::allocate_cpp_vtable_clones(); - _md_region.pack(&_od_region); + _md_region.pack(); - // Relocate the archived class file data into the od region - relocate_cached_class_file(); - _od_region.pack(); - - // The 5 core spaces are allocated consecutively mc->rw->ro->md->od, so there total size + // The 4 core spaces are allocated consecutively mc->rw->ro->md, so there total size // is just the spaces between the two ends. - size_t core_spaces_size = _od_region.end() - _mc_region.base(); + size_t core_spaces_size = _md_region.end() - _mc_region.base(); assert(core_spaces_size == (size_t)align_up(core_spaces_size, Metaspace::reserve_alignment()), "should already be aligned"); @@ -1488,7 +1467,6 @@ void VM_PopulateDumpSharedSpace::doit() { write_region(mapinfo, MetaspaceShared::rw, &_rw_region, /*read_only=*/false,/*allow_exec=*/false); write_region(mapinfo, MetaspaceShared::ro, &_ro_region, /*read_only=*/true, /*allow_exec=*/false); write_region(mapinfo, MetaspaceShared::md, &_md_region, /*read_only=*/false,/*allow_exec=*/false); - write_region(mapinfo, MetaspaceShared::od, &_od_region, /*read_only=*/true, /*allow_exec=*/false); _total_closed_archive_region_size = mapinfo->write_archive_heap_regions( _closed_archive_heap_regions, @@ -1535,12 +1513,10 @@ void VM_PopulateDumpSharedSpace::print_region_stats() { // Print statistics of all the regions const size_t total_reserved = _ro_region.reserved() + _rw_region.reserved() + _mc_region.reserved() + _md_region.reserved() + - _od_region.reserved() + _total_closed_archive_region_size + _total_open_archive_region_size; const size_t total_bytes = _ro_region.used() + _rw_region.used() + _mc_region.used() + _md_region.used() + - _od_region.used() + _total_closed_archive_region_size + _total_open_archive_region_size; const double total_u_perc = percent_of(total_bytes, total_reserved); @@ -1549,7 +1525,6 @@ void VM_PopulateDumpSharedSpace::print_region_stats() { _rw_region.print(total_reserved); _ro_region.print(total_reserved); _md_region.print(total_reserved); - _od_region.print(total_reserved); print_heap_region_stats(_closed_archive_heap_regions, "ca", total_reserved); print_heap_region_stats(_open_archive_heap_regions, "oa", total_reserved); @@ -1931,33 +1906,30 @@ bool MetaspaceShared::map_shared_spaces(FileMapInfo* mapinfo) { char* rw_base = NULL; char* rw_top; char* mc_base = NULL; char* mc_top; char* md_base = NULL; char* md_top; - char* od_base = NULL; char* od_top; // Map each shared region if ((mc_base = mapinfo->map_region(mc, &mc_top)) != NULL && (rw_base = mapinfo->map_region(rw, &rw_top)) != NULL && (ro_base = mapinfo->map_region(ro, &ro_top)) != NULL && (md_base = mapinfo->map_region(md, &md_top)) != NULL && - (od_base = mapinfo->map_region(od, &od_top)) != NULL && (image_alignment == (size_t)os::vm_allocation_granularity()) && mapinfo->validate_shared_path_table()) { // Success -- set up MetaspaceObj::_shared_metaspace_{base,top} for // fast checking in MetaspaceShared::is_in_shared_metaspace() and // MetaspaceObj::is_shared(). // - // We require that mc->rw->ro->md->od to be laid out consecutively, with no + // We require that mc->rw->ro->md to be laid out consecutively, with no // gaps between them. That way, we can ensure that the OS won't be able to // allocate any new memory spaces inside _shared_metaspace_{base,top}, which // would mess up the simple comparision in MetaspaceShared::is_in_shared_metaspace(). - assert(mc_base < ro_base && mc_base < rw_base && mc_base < md_base && mc_base < od_base, "must be"); - assert(od_top > ro_top && od_top > rw_top && od_top > md_top && od_top > mc_top , "must be"); + assert(mc_base < ro_base && mc_base < rw_base && mc_base < md_base, "must be"); + assert(md_top > ro_top && md_top > rw_top && md_top > mc_top , "must be"); assert(mc_top == rw_base, "must be"); assert(rw_top == ro_base, "must be"); assert(ro_top == md_base, "must be"); - assert(md_top == od_base, "must be"); _core_spaces_size = mapinfo->core_spaces_size(); - MetaspaceObj::set_shared_metaspace_range((void*)mc_base, (void*)od_top); + MetaspaceObj::set_shared_metaspace_range((void*)mc_base, (void*)md_top); return true; } else { // If there was a failure in mapping any of the spaces, unmap the ones @@ -1966,7 +1938,6 @@ bool MetaspaceShared::map_shared_spaces(FileMapInfo* mapinfo) { if (rw_base != NULL) mapinfo->unmap_region(rw); if (mc_base != NULL) mapinfo->unmap_region(mc); if (md_base != NULL) mapinfo->unmap_region(md); - if (od_base != NULL) mapinfo->unmap_region(od); #ifndef _WINDOWS // Release the entire mapped region shared_rs.release(); @@ -2049,7 +2020,6 @@ void MetaspaceShared::report_out_of_space(const char* name, size_t needed_bytes) _rw_region.print_out_of_space_msg(name, needed_bytes); _ro_region.print_out_of_space_msg(name, needed_bytes); _md_region.print_out_of_space_msg(name, needed_bytes); - _od_region.print_out_of_space_msg(name, needed_bytes); vm_exit_during_initialization(err_msg("Unable to allocate from '%s' region", name), "Please reduce the number of shared classes."); diff --git a/src/hotspot/share/memory/metaspaceShared.hpp b/src/hotspot/share/memory/metaspaceShared.hpp index b4f867299a2..09e38ada6e4 100644 --- a/src/hotspot/share/memory/metaspaceShared.hpp +++ b/src/hotspot/share/memory/metaspaceShared.hpp @@ -69,14 +69,10 @@ class MetaspaceShared : AllStatic { ro = 2, // read-only shared space in the heap md = 3, // miscellaneous data for initializing tables, etc. num_core_spaces = 4, // number of non-string regions - - // optional mapped spaces - // Currently it only contains class file data. - od = num_core_spaces, - num_non_heap_spaces = od + 1, + num_non_heap_spaces = 4, // mapped java heap regions - first_closed_archive_heap_region = od + 1, + first_closed_archive_heap_region = md + 1, max_closed_archive_heap_region = 2, last_closed_archive_heap_region = first_closed_archive_heap_region + max_closed_archive_heap_region - 1, first_open_archive_heap_region = last_closed_archive_heap_region + 1, diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index 5ad8b9116db..a101f507052 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -2353,6 +2353,7 @@ void InstanceKlass::remove_unshareable_info() { #if INCLUDE_JVMTI guarantee(_breakpoints == NULL, "must be"); guarantee(_previous_versions == NULL, "must be"); + _cached_class_file = NULL; #endif _init_thread = NULL; @@ -2509,7 +2510,7 @@ void InstanceKlass::release_C_heap_structures() { } // deallocate the cached class file - if (_cached_class_file != NULL && !MetaspaceShared::is_in_shared_metaspace(_cached_class_file)) { + if (_cached_class_file != NULL) { os::free(_cached_class_file); _cached_class_file = NULL; } @@ -3970,12 +3971,7 @@ Method* InstanceKlass::method_with_orig_idnum(int idnum, int version) { #if INCLUDE_JVMTI JvmtiCachedClassFileData* InstanceKlass::get_cached_class_file() { - if (MetaspaceShared::is_in_shared_metaspace(_cached_class_file)) { - // Ignore the archived class stream data - return NULL; - } else { - return _cached_class_file; - } + return _cached_class_file; } jint InstanceKlass::get_cached_class_file_len() { @@ -3985,19 +3981,4 @@ jint InstanceKlass::get_cached_class_file_len() { unsigned char * InstanceKlass::get_cached_class_file_bytes() { return VM_RedefineClasses::get_cached_class_file_bytes(_cached_class_file); } - -#if INCLUDE_CDS -JvmtiCachedClassFileData* InstanceKlass::get_archived_class_data() { - if (DumpSharedSpaces) { - return _cached_class_file; - } else { - assert(this->is_shared(), "class should be shared"); - if (MetaspaceShared::is_in_shared_metaspace(_cached_class_file)) { - return _cached_class_file; - } else { - return NULL; - } - } -} -#endif #endif diff --git a/src/hotspot/share/oops/instanceKlass.hpp b/src/hotspot/share/oops/instanceKlass.hpp index 3d4aafaf81f..7811c6c9650 100644 --- a/src/hotspot/share/oops/instanceKlass.hpp +++ b/src/hotspot/share/oops/instanceKlass.hpp @@ -847,14 +847,6 @@ public: JvmtiCachedClassFieldMap* jvmti_cached_class_field_map() const { return _jvmti_cached_class_field_map; } - -#if INCLUDE_CDS - void set_archived_class_data(JvmtiCachedClassFileData* data) { - _cached_class_file = data; - } - - JvmtiCachedClassFileData * get_archived_class_data(); -#endif // INCLUDE_CDS #else // INCLUDE_JVMTI static void purge_previous_versions(InstanceKlass* ik) { return; }; diff --git a/src/hotspot/share/runtime/mutexLocker.cpp b/src/hotspot/share/runtime/mutexLocker.cpp index f2a4174c71c..d6db77681e7 100644 --- a/src/hotspot/share/runtime/mutexLocker.cpp +++ b/src/hotspot/share/runtime/mutexLocker.cpp @@ -150,6 +150,9 @@ Mutex* DCmdFactory_lock = NULL; #if INCLUDE_NMT Mutex* NMTQuery_lock = NULL; #endif +#if INCLUDE_CDS && INCLUDE_JVMTI +Mutex* CDSClassFileStream_lock = NULL; +#endif #define MAX_NUM_MUTEX 128 static Monitor * _mutex_array[MAX_NUM_MUTEX]; @@ -339,6 +342,9 @@ void mutex_init() { #if INCLUDE_NMT def(NMTQuery_lock , PaddedMutex , max_nonleaf, false, Monitor::_safepoint_check_always); #endif +#if INCLUDE_CDS && INCLUDE_JVMTI + def(CDSClassFileStream_lock , PaddedMutex , max_nonleaf, false, Monitor::_safepoint_check_always); +#endif } GCMutexLocker::GCMutexLocker(Monitor * mutex) { diff --git a/src/hotspot/share/runtime/mutexLocker.hpp b/src/hotspot/share/runtime/mutexLocker.hpp index 4809f2cb1fc..fb055e84d90 100644 --- a/src/hotspot/share/runtime/mutexLocker.hpp +++ b/src/hotspot/share/runtime/mutexLocker.hpp @@ -133,6 +133,9 @@ extern Mutex* DCmdFactory_lock; // serialize access to DCmdFact #if INCLUDE_NMT extern Mutex* NMTQuery_lock; // serialize NMT Dcmd queries #endif +#if INCLUDE_CDS && INCLUDE_JVMTI +extern Mutex* CDSClassFileStream_lock; // FileMapInfo::open_stream_for_jvmti +#endif #if INCLUDE_JFR extern Mutex* JfrStacktrace_lock; // used to guard access to the JFR stacktrace table extern Monitor* JfrMsg_lock; // protects JFR messaging diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java index 2da23d2a841..cdfb130dea2 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, 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 @@ -102,8 +102,8 @@ public class SpaceUtilizationCheck { } } } - if (checked.size() != 5) { - throw new RuntimeException("Must have 5 consecutive, fully utilized regions"); + if (checked.size() != 4) { + throw new RuntimeException("Must have 4 consecutive, fully utilized regions"); } } } From 151e628a8e73b41ea7262b922cd5f4d9d919b3c4 Mon Sep 17 00:00:00 2001 From: Priya Lakshmi Muthuswamy Date: Fri, 22 Feb 2019 11:10:55 +0530 Subject: [PATCH 076/109] 8215584: Remove support for the "old" doclet API in com/sun/javadoc Reviewed-by: jjg, hannesw --- .../com/sun/javadoc/AnnotatedType.java | 59 - .../com/sun/javadoc/AnnotationDesc.java | 98 -- .../com/sun/javadoc/AnnotationTypeDoc.java | 51 - .../sun/javadoc/AnnotationTypeElementDoc.java | 51 - .../com/sun/javadoc/AnnotationValue.java | 66 - .../classes/com/sun/javadoc/ClassDoc.java | 362 ----- .../com/sun/javadoc/ConstructorDoc.java | 42 - .../share/classes/com/sun/javadoc/Doc.java | 286 ---- .../com/sun/javadoc/DocErrorReporter.java | 90 -- .../share/classes/com/sun/javadoc/Doclet.java | 122 -- .../com/sun/javadoc/ExecutableMemberDoc.java | 164 -- .../classes/com/sun/javadoc/FieldDoc.java | 92 -- .../com/sun/javadoc/LanguageVersion.java | 54 - .../classes/com/sun/javadoc/MemberDoc.java | 56 - .../classes/com/sun/javadoc/MethodDoc.java | 110 -- .../classes/com/sun/javadoc/PackageDoc.java | 137 -- .../classes/com/sun/javadoc/ParamTag.java | 73 - .../classes/com/sun/javadoc/Parameter.java | 87 -- .../com/sun/javadoc/ParameterizedType.java | 115 -- .../com/sun/javadoc/ProgramElementDoc.java | 148 -- .../classes/com/sun/javadoc/RootDoc.java | 116 -- .../share/classes/com/sun/javadoc/SeeTag.java | 145 -- .../com/sun/javadoc/SerialFieldTag.java | 101 -- .../com/sun/javadoc/SourcePosition.java | 70 - .../share/classes/com/sun/javadoc/Tag.java | 177 --- .../classes/com/sun/javadoc/ThrowsTag.java | 85 -- .../share/classes/com/sun/javadoc/Type.java | 183 --- .../classes/com/sun/javadoc/TypeVariable.java | 75 - .../classes/com/sun/javadoc/WildcardType.java | 68 - .../classes/com/sun/javadoc/package-info.java | 153 -- .../sun/tools/doclets/standard/Standard.java | 48 - .../tools/doclets/standard/package-info.java | 33 - .../classes/com/sun/tools/javadoc/Main.java | 205 --- .../tools/javadoc/main/AbstractTypeImpl.java | 117 -- .../tools/javadoc/main/AnnotatedTypeImpl.java | 127 -- .../javadoc/main/AnnotationDescImpl.java | 179 --- .../javadoc/main/AnnotationTypeDocImpl.java | 108 -- .../main/AnnotationTypeElementDocImpl.java | 92 -- .../javadoc/main/AnnotationValueImpl.java | 178 --- .../sun/tools/javadoc/main/ClassDocImpl.java | 1331 ----------------- .../com/sun/tools/javadoc/main/Comment.java | 462 ------ .../javadoc/main/ConstructorDocImpl.java | 105 -- .../com/sun/tools/javadoc/main/DocEnv.java | 881 ----------- .../com/sun/tools/javadoc/main/DocImpl.java | 455 ------ .../com/sun/tools/javadoc/main/DocLocale.java | 243 --- .../sun/tools/javadoc/main/DocletInvoker.java | 438 ------ .../javadoc/main/ExecutableMemberDocImpl.java | 290 ---- .../sun/tools/javadoc/main/FieldDocImpl.java | 281 ---- .../tools/javadoc/main/JavaScriptScanner.java | 1104 -------------- .../javadoc/main/JavadocClassFinder.java | 89 -- .../sun/tools/javadoc/main/JavadocEnter.java | 111 -- .../javadoc/main/JavadocMemberEnter.java | 207 --- .../sun/tools/javadoc/main/JavadocTodo.java | 63 - .../sun/tools/javadoc/main/JavadocTool.java | 440 ------ .../sun/tools/javadoc/main/MemberDocImpl.java | 69 - .../com/sun/tools/javadoc/main/Messager.java | 320 ---- .../sun/tools/javadoc/main/MethodDocImpl.java | 248 --- .../tools/javadoc/main/ModifierFilter.java | 127 -- .../tools/javadoc/main/PackageDocImpl.java | 391 ----- .../sun/tools/javadoc/main/ParamTagImpl.java | 121 -- .../sun/tools/javadoc/main/ParameterImpl.java | 111 -- .../javadoc/main/ParameterizedTypeImpl.java | 150 -- .../sun/tools/javadoc/main/PrimitiveType.java | 163 -- .../javadoc/main/ProgramElementDocImpl.java | 233 --- .../sun/tools/javadoc/main/RootDocImpl.java | 401 ----- .../sun/tools/javadoc/main/SeeTagImpl.java | 544 ------- .../javadoc/main/SerialFieldTagImpl.java | 269 ---- .../tools/javadoc/main/SerializedForm.java | 289 ---- .../javadoc/main/SourcePositionImpl.java | 124 -- .../com/sun/tools/javadoc/main/Start.java | 578 ------- .../com/sun/tools/javadoc/main/TagImpl.java | 190 --- .../sun/tools/javadoc/main/ThrowsTagImpl.java | 128 -- .../sun/tools/javadoc/main/ToolOption.java | 454 ------ .../com/sun/tools/javadoc/main/TypeMaker.java | 352 ----- .../tools/javadoc/main/TypeVariableImpl.java | 154 -- .../tools/javadoc/main/WildcardTypeImpl.java | 141 -- .../com/sun/tools/javadoc/package-info.java | 35 - .../javadoc/resources/javadoc.properties | 155 -- .../javadoc/resources/javadoc_ja.properties | 100 -- .../resources/javadoc_zh_CN.properties | 100 -- .../formats/html/HtmlDocletWriter.java | 2 +- .../jdk/javadoc/internal/package-info.java | 10 - .../jdk/javadoc/internal/tool/Start.java | 19 +- .../tool/resources/javadoc.properties | 9 +- .../share/classes/module-info.java | 3 - .../jdk/javadoc/tool/EncodingTest.java | 4 +- .../jdk/javadoc/tool/EnsureNewOldDoclet.java | 31 +- .../api/basic/GetTask_DocletClassTest.java | 163 -- .../tool/removeOldDoclet/OldDoclet.jasm | 28 + .../tool/removeOldDoclet/RemoveOldDoclet.java | 77 + .../tools/javadoc/6176978/T6176978.java | 81 - test/langtools/tools/javadoc/6176978/X.java | 31 - .../langtools/tools/javadoc/6227454/Test.java | 142 -- .../tools/javadoc/6942366/T6942366.java | 133 -- .../langtools/tools/javadoc/6942366/Test.java | 28 - .../tools/javadoc/6942366/p/Base.java | 30 - .../langtools/tools/javadoc/6958836/Test.java | 177 --- .../tools/javadoc/6964914/Error.java | 26 - .../tools/javadoc/6964914/JavacWarning.java | 26 - .../tools/javadoc/6964914/JavadocWarning.java | 27 - .../langtools/tools/javadoc/6964914/Test.java | 77 - .../tools/javadoc/6964914/TestStdDoclet.java | 104 -- .../tools/javadoc/6964914/TestUserDoclet.java | 103 -- .../langtools/tools/javadoc/8025693/Test.java | 92 -- .../tools/javadoc/8147801/T8147801.java | 181 --- .../javadoc/8147801/jarsrc/lib/Lib1.java | 28 - .../javadoc/8147801/jarsrc/lib/Lib2.java | 28 - .../tools/javadoc/8147801/p/Test.java | 29 - .../langtools/tools/javadoc/AddOpensTest.java | 77 - .../tools/javadoc/BadOptionsTest.java | 173 --- .../langtools/tools/javadoc/BooleanConst.java | 71 - .../tools/javadoc/BreakIteratorWarning.java | 66 - .../tools/javadoc/CheckResourceKeys.java | 248 --- .../tools/javadoc/CompletionError.java | 158 -- .../langtools/tools/javadoc/EncodingTest.java | 80 - .../tools/javadoc/FlagsTooEarly.java | 63 - .../tools/javadoc/InlineTagsWithBraces.java | 82 - test/langtools/tools/javadoc/LangVers.java | 74 - test/langtools/tools/javadoc/MaxWarns.java | 115 -- test/langtools/tools/javadoc/MethodLinks.java | 69 - test/langtools/tools/javadoc/NoStar.java | 62 - .../tools/javadoc/ReleaseOption.java | 69 - .../tools/javadoc/ReleaseOptionSource.java | 28 - .../tools/javadoc/T4994049/FileWithTabs.java | 26 - .../tools/javadoc/T4994049/T4994049.java | 100 -- test/langtools/tools/javadoc/T6968833.java | 64 - test/langtools/tools/javadoc/XWerror.java | 52 - .../annotateMethodsFields/Main.java | 80 - .../annotateMethodsFields/expected.out | 22 - .../annotateMethodsFields/pkg1/A.java | 32 - .../annotateMethodsFields/pkg1/B.java | 33 - .../annotateMethodsFields/pkg1/E.java | 29 - .../annotations/annotatePackage/Main.java | 67 - .../annotations/annotatePackage/expected.out | 21 - .../annotations/annotatePackage/pkg1/A.java | 31 - .../annotatePackage/pkg1/package-info.java | 35 - .../annotatePackage/pkg1/package.html | 19 - .../annotations/annotatePackage/pkg2/B.java | 30 - .../annotatePackage/pkg2/package.html | 11 - .../annotations/annotateParams/Main.java | 74 - .../annotations/annotateParams/expected.out | 17 - .../annotations/annotateParams/pkg1/A.java | 28 - .../annotations/annotateParams/pkg1/C.java | 35 - .../javadoc/annotations/badVals/Main.java | 54 - .../javadoc/annotations/badVals/pkg1/A.java | 46 - .../javadoc/annotations/defaults/Main.java | 69 - .../javadoc/annotations/defaults/expected.out | 55 - .../javadoc/annotations/defaults/pkg1/A.java | 36 - .../javadoc/annotations/defaults/pkg1/B.java | 34 - .../annotations/elementTypes/Main.java | 63 - .../annotations/elementTypes/expected.out | 17 - .../annotations/elementTypes/pkg1/A.java | 36 - .../annotations/elementTypes/pkg1/B.java | 36 - .../javadoc/annotations/missing/Main.java | 53 - .../somepackage/MissingAnnotationClass.java | 31 - .../javadoc/annotations/shortcuts/Main.java | 59 - .../annotations/shortcuts/expected.out | 6 - .../javadoc/annotations/shortcuts/pkg1/A.java | 30 - .../annotations/shortcuts/pkg1/Array.java | 28 - .../annotations/shortcuts/pkg1/Marker.java | 27 - .../annotations/shortcuts/pkg1/Value.java | 28 - .../tools/javadoc/api/basic/APITest.java | 250 ---- .../javadoc/api/basic/DocletPathTest.java | 114 -- .../basic/DocumentationToolLocationTest.java | 75 - .../api/basic/GetSourceVersionsTest.java | 63 - .../api/basic/GetTask_DiagListenerTest.java | 91 -- .../api/basic/GetTask_DocletClassTest.java | 161 -- .../api/basic/GetTask_FileManagerTest.java | 156 -- .../api/basic/GetTask_FileObjectsTest.java | 136 -- .../api/basic/GetTask_OptionsTest.java | 97 -- .../javadoc/api/basic/GetTask_WriterTest.java | 82 - .../javadoc/api/basic/Task_reuseTest.java | 96 -- .../tools/javadoc/api/basic/pkg/C.java | 27 - .../api/basic/taglets/UnderlineTaglet.java | 152 -- .../completionFailure/CompletionFailure.java | 52 - .../javadoc/completionFailure/pkg/A.java | 27 - .../javadoc/completionFailure/pkg/B.java | 27 - test/langtools/tools/javadoc/dupOk/DupOk.java | 62 - .../tools/javadoc/dupOk/sp1/p/A.java | 28 - .../tools/javadoc/dupOk/sp2/p/A.java | 26 - .../tools/javadoc/dupOk/sp2/p/B.java | 28 - .../tools/javadoc/enum/docComments/Main.java | 78 - .../enum/docComments/pkg1/Operation.java | 53 - .../tools/javadoc/enum/enumType/Main.java | 57 - .../tools/javadoc/enum/enumType/expected.out | 18 - .../enum/enumType/pkg1/QuotablePerson.java | 77 - .../javadoc/generics/genericClass/Main.java | 57 - .../generics/genericClass/expected.out | 16 - .../javadoc/generics/genericClass/pkg1/A.java | 34 - .../generics/genericInnerAndOuter/Main.java | 62 - .../genericInnerAndOuter/expected.out | 53 - .../generics/genericInnerAndOuter/pkg1/O.java | 30 - .../generics/genericInnerAndOuter/pkg1/X.java | 32 - .../generics/genericInterface/Main.java | 57 - .../generics/genericInterface/expected.out | 6 - .../generics/genericInterface/pkg1/A.java | 28 - .../javadoc/generics/genericMethod/Main.java | 60 - .../generics/genericMethod/expected.out | 20 - .../generics/genericMethod/pkg1/A.java | 30 - .../javadoc/generics/genericSuper/Main.java | 62 - .../generics/genericSuper/expected.out | 27 - .../javadoc/generics/genericSuper/pkg1/A.java | 33 - .../javadoc/generics/supertypes/Main.java | 80 - .../javadoc/generics/supertypes/expected.out | 16 - .../javadoc/generics/supertypes/pkg1/A.java | 29 - .../javadoc/generics/supertypes/pkg1/B.java | 29 - .../javadoc/generics/throwsGeneric/Main.java | 58 - .../generics/throwsGeneric/expected.out | 16 - .../generics/throwsGeneric/pkg1/A.java | 29 - .../javadoc/generics/tparamCycle/Main.java | 63 - .../generics/tparamCycle/pkg1/LikeEnum.java | 27 - .../generics/tparamTagOnMethod/Main.java | 59 - .../generics/tparamTagOnMethod/expected.out | 12 - .../generics/tparamTagOnMethod/pkg1/A.java | 34 - .../generics/tparamTagOnType/Main.java | 57 - .../generics/tparamTagOnType/expected.out | 5 - .../generics/tparamTagOnType/pkg1/A.java | 30 - .../javadoc/generics/wildcards/Main.java | 57 - .../javadoc/generics/wildcards/expected.out | 16 - .../javadoc/generics/wildcards/pkg1/A.java | 34 - test/langtools/tools/javadoc/imports/I.java | 29 - .../tools/javadoc/imports/MissingImport.java | 62 - .../tools/javadoc/lib/OldToolTester.java | 338 ----- .../tools/javadoc/lib/ToyDoclet.java | 78 - .../javadoc/nestedClass/NestedClass.java | 60 - .../javadoc/nestedClass/NestedClassB.java | 26 - .../tools/javadoc/nonConstExprs/Test.java | 62 - .../tools/javadoc/outputRedirect/Test.java | 33 - .../outputRedirect/p/OutputRedirect.java | 68 - .../javadoc/parser/7091528/T7091528.java | 86 -- .../tools/javadoc/parser/7091528/p/C1.java | 28 - .../tools/javadoc/parser/7091528/p/C3.java | 26 - .../tools/javadoc/parser/7091528/p/q/C2.java | 28 - .../tools/javadoc/sourceOnly/Test.java | 39 - .../tools/javadoc/sourceOnly/p/NonSource.jasm | 36 - .../javadoc/sourceOnly/p/SourceOnly.java | 45 - .../javadoc/sourceOption/SourceOption.java | 79 - .../sourceOption/p/LambdaConstructTest.java | 37 - .../subpackageIgnore/SubpackageIgnore.java | 55 - .../pkg1/not-subpkg/SomeJavaFile.java | 23 - .../langtools/tools/javadoc/varArgs/Main.java | 65 - .../tools/javadoc/varArgs/expected.out | 4 - .../tools/javadoc/varArgs/pkg1/A.java | 34 - 243 files changed, 114 insertions(+), 26126 deletions(-) delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotatedType.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationDesc.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeDoc.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeElementDoc.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationValue.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/ClassDoc.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/ConstructorDoc.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/Doc.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/DocErrorReporter.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/Doclet.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/ExecutableMemberDoc.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/FieldDoc.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/LanguageVersion.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/MemberDoc.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/MethodDoc.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/PackageDoc.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/ParamTag.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/Parameter.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/ParameterizedType.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/ProgramElementDoc.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/RootDoc.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/SeeTag.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/SerialFieldTag.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/SourcePosition.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/Tag.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/ThrowsTag.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/Type.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/TypeVariable.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/WildcardType.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/Standard.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/package-info.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Main.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AbstractTypeImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotatedTypeImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationDescImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeDocImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeElementDocImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationValueImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ConstructorDocImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocLocale.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocletInvoker.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ExecutableMemberDocImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/FieldDocImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavaScriptScanner.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocClassFinder.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocEnter.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocMemberEnter.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocTodo.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/JavadocTool.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/MemberDocImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Messager.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/MethodDocImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ModifierFilter.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PackageDocImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParamTagImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ParameterizedTypeImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/PrimitiveType.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ProgramElementDocImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/RootDocImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SeeTagImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SerialFieldTagImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SerializedForm.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/SourcePositionImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Start.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TagImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ThrowsTagImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ToolOption.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TypeMaker.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TypeVariableImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/WildcardTypeImpl.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/package-info.java delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/resources/javadoc.properties delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/resources/javadoc_ja.properties delete mode 100644 src/jdk.javadoc/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties delete mode 100644 test/langtools/jdk/javadoc/tool/api/basic/GetTask_DocletClassTest.java create mode 100644 test/langtools/jdk/javadoc/tool/removeOldDoclet/OldDoclet.jasm create mode 100644 test/langtools/jdk/javadoc/tool/removeOldDoclet/RemoveOldDoclet.java delete mode 100644 test/langtools/tools/javadoc/6176978/T6176978.java delete mode 100644 test/langtools/tools/javadoc/6176978/X.java delete mode 100644 test/langtools/tools/javadoc/6227454/Test.java delete mode 100644 test/langtools/tools/javadoc/6942366/T6942366.java delete mode 100644 test/langtools/tools/javadoc/6942366/Test.java delete mode 100644 test/langtools/tools/javadoc/6942366/p/Base.java delete mode 100644 test/langtools/tools/javadoc/6958836/Test.java delete mode 100644 test/langtools/tools/javadoc/6964914/Error.java delete mode 100644 test/langtools/tools/javadoc/6964914/JavacWarning.java delete mode 100644 test/langtools/tools/javadoc/6964914/JavadocWarning.java delete mode 100644 test/langtools/tools/javadoc/6964914/Test.java delete mode 100644 test/langtools/tools/javadoc/6964914/TestStdDoclet.java delete mode 100644 test/langtools/tools/javadoc/6964914/TestUserDoclet.java delete mode 100644 test/langtools/tools/javadoc/8025693/Test.java delete mode 100644 test/langtools/tools/javadoc/8147801/T8147801.java delete mode 100644 test/langtools/tools/javadoc/8147801/jarsrc/lib/Lib1.java delete mode 100644 test/langtools/tools/javadoc/8147801/jarsrc/lib/Lib2.java delete mode 100644 test/langtools/tools/javadoc/8147801/p/Test.java delete mode 100644 test/langtools/tools/javadoc/AddOpensTest.java delete mode 100644 test/langtools/tools/javadoc/BadOptionsTest.java delete mode 100644 test/langtools/tools/javadoc/BooleanConst.java delete mode 100644 test/langtools/tools/javadoc/BreakIteratorWarning.java delete mode 100644 test/langtools/tools/javadoc/CheckResourceKeys.java delete mode 100644 test/langtools/tools/javadoc/CompletionError.java delete mode 100644 test/langtools/tools/javadoc/EncodingTest.java delete mode 100644 test/langtools/tools/javadoc/FlagsTooEarly.java delete mode 100644 test/langtools/tools/javadoc/InlineTagsWithBraces.java delete mode 100644 test/langtools/tools/javadoc/LangVers.java delete mode 100644 test/langtools/tools/javadoc/MaxWarns.java delete mode 100644 test/langtools/tools/javadoc/MethodLinks.java delete mode 100644 test/langtools/tools/javadoc/NoStar.java delete mode 100644 test/langtools/tools/javadoc/ReleaseOption.java delete mode 100644 test/langtools/tools/javadoc/ReleaseOptionSource.java delete mode 100644 test/langtools/tools/javadoc/T4994049/FileWithTabs.java delete mode 100644 test/langtools/tools/javadoc/T4994049/T4994049.java delete mode 100644 test/langtools/tools/javadoc/T6968833.java delete mode 100644 test/langtools/tools/javadoc/XWerror.java delete mode 100644 test/langtools/tools/javadoc/annotations/annotateMethodsFields/Main.java delete mode 100644 test/langtools/tools/javadoc/annotations/annotateMethodsFields/expected.out delete mode 100644 test/langtools/tools/javadoc/annotations/annotateMethodsFields/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/annotations/annotateMethodsFields/pkg1/B.java delete mode 100644 test/langtools/tools/javadoc/annotations/annotateMethodsFields/pkg1/E.java delete mode 100644 test/langtools/tools/javadoc/annotations/annotatePackage/Main.java delete mode 100644 test/langtools/tools/javadoc/annotations/annotatePackage/expected.out delete mode 100644 test/langtools/tools/javadoc/annotations/annotatePackage/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/annotations/annotatePackage/pkg1/package-info.java delete mode 100644 test/langtools/tools/javadoc/annotations/annotatePackage/pkg1/package.html delete mode 100644 test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/B.java delete mode 100644 test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/package.html delete mode 100644 test/langtools/tools/javadoc/annotations/annotateParams/Main.java delete mode 100644 test/langtools/tools/javadoc/annotations/annotateParams/expected.out delete mode 100644 test/langtools/tools/javadoc/annotations/annotateParams/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/annotations/annotateParams/pkg1/C.java delete mode 100644 test/langtools/tools/javadoc/annotations/badVals/Main.java delete mode 100644 test/langtools/tools/javadoc/annotations/badVals/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/annotations/defaults/Main.java delete mode 100644 test/langtools/tools/javadoc/annotations/defaults/expected.out delete mode 100644 test/langtools/tools/javadoc/annotations/defaults/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/annotations/defaults/pkg1/B.java delete mode 100644 test/langtools/tools/javadoc/annotations/elementTypes/Main.java delete mode 100644 test/langtools/tools/javadoc/annotations/elementTypes/expected.out delete mode 100644 test/langtools/tools/javadoc/annotations/elementTypes/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/annotations/elementTypes/pkg1/B.java delete mode 100644 test/langtools/tools/javadoc/annotations/missing/Main.java delete mode 100644 test/langtools/tools/javadoc/annotations/missing/somepackage/MissingAnnotationClass.java delete mode 100644 test/langtools/tools/javadoc/annotations/shortcuts/Main.java delete mode 100644 test/langtools/tools/javadoc/annotations/shortcuts/expected.out delete mode 100644 test/langtools/tools/javadoc/annotations/shortcuts/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Array.java delete mode 100644 test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Marker.java delete mode 100644 test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Value.java delete mode 100644 test/langtools/tools/javadoc/api/basic/APITest.java delete mode 100644 test/langtools/tools/javadoc/api/basic/DocletPathTest.java delete mode 100644 test/langtools/tools/javadoc/api/basic/DocumentationToolLocationTest.java delete mode 100644 test/langtools/tools/javadoc/api/basic/GetSourceVersionsTest.java delete mode 100644 test/langtools/tools/javadoc/api/basic/GetTask_DiagListenerTest.java delete mode 100644 test/langtools/tools/javadoc/api/basic/GetTask_DocletClassTest.java delete mode 100644 test/langtools/tools/javadoc/api/basic/GetTask_FileManagerTest.java delete mode 100644 test/langtools/tools/javadoc/api/basic/GetTask_FileObjectsTest.java delete mode 100644 test/langtools/tools/javadoc/api/basic/GetTask_OptionsTest.java delete mode 100644 test/langtools/tools/javadoc/api/basic/GetTask_WriterTest.java delete mode 100644 test/langtools/tools/javadoc/api/basic/Task_reuseTest.java delete mode 100644 test/langtools/tools/javadoc/api/basic/pkg/C.java delete mode 100644 test/langtools/tools/javadoc/api/basic/taglets/UnderlineTaglet.java delete mode 100644 test/langtools/tools/javadoc/completionFailure/CompletionFailure.java delete mode 100644 test/langtools/tools/javadoc/completionFailure/pkg/A.java delete mode 100644 test/langtools/tools/javadoc/completionFailure/pkg/B.java delete mode 100644 test/langtools/tools/javadoc/dupOk/DupOk.java delete mode 100644 test/langtools/tools/javadoc/dupOk/sp1/p/A.java delete mode 100644 test/langtools/tools/javadoc/dupOk/sp2/p/A.java delete mode 100644 test/langtools/tools/javadoc/dupOk/sp2/p/B.java delete mode 100644 test/langtools/tools/javadoc/enum/docComments/Main.java delete mode 100644 test/langtools/tools/javadoc/enum/docComments/pkg1/Operation.java delete mode 100644 test/langtools/tools/javadoc/enum/enumType/Main.java delete mode 100644 test/langtools/tools/javadoc/enum/enumType/expected.out delete mode 100644 test/langtools/tools/javadoc/enum/enumType/pkg1/QuotablePerson.java delete mode 100644 test/langtools/tools/javadoc/generics/genericClass/Main.java delete mode 100644 test/langtools/tools/javadoc/generics/genericClass/expected.out delete mode 100644 test/langtools/tools/javadoc/generics/genericClass/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/generics/genericInnerAndOuter/Main.java delete mode 100644 test/langtools/tools/javadoc/generics/genericInnerAndOuter/expected.out delete mode 100644 test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/O.java delete mode 100644 test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/X.java delete mode 100644 test/langtools/tools/javadoc/generics/genericInterface/Main.java delete mode 100644 test/langtools/tools/javadoc/generics/genericInterface/expected.out delete mode 100644 test/langtools/tools/javadoc/generics/genericInterface/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/generics/genericMethod/Main.java delete mode 100644 test/langtools/tools/javadoc/generics/genericMethod/expected.out delete mode 100644 test/langtools/tools/javadoc/generics/genericMethod/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/generics/genericSuper/Main.java delete mode 100644 test/langtools/tools/javadoc/generics/genericSuper/expected.out delete mode 100644 test/langtools/tools/javadoc/generics/genericSuper/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/generics/supertypes/Main.java delete mode 100644 test/langtools/tools/javadoc/generics/supertypes/expected.out delete mode 100644 test/langtools/tools/javadoc/generics/supertypes/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/generics/supertypes/pkg1/B.java delete mode 100644 test/langtools/tools/javadoc/generics/throwsGeneric/Main.java delete mode 100644 test/langtools/tools/javadoc/generics/throwsGeneric/expected.out delete mode 100644 test/langtools/tools/javadoc/generics/throwsGeneric/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/generics/tparamCycle/Main.java delete mode 100644 test/langtools/tools/javadoc/generics/tparamCycle/pkg1/LikeEnum.java delete mode 100644 test/langtools/tools/javadoc/generics/tparamTagOnMethod/Main.java delete mode 100644 test/langtools/tools/javadoc/generics/tparamTagOnMethod/expected.out delete mode 100644 test/langtools/tools/javadoc/generics/tparamTagOnMethod/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/generics/tparamTagOnType/Main.java delete mode 100644 test/langtools/tools/javadoc/generics/tparamTagOnType/expected.out delete mode 100644 test/langtools/tools/javadoc/generics/tparamTagOnType/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/generics/wildcards/Main.java delete mode 100644 test/langtools/tools/javadoc/generics/wildcards/expected.out delete mode 100644 test/langtools/tools/javadoc/generics/wildcards/pkg1/A.java delete mode 100644 test/langtools/tools/javadoc/imports/I.java delete mode 100644 test/langtools/tools/javadoc/imports/MissingImport.java delete mode 100644 test/langtools/tools/javadoc/lib/OldToolTester.java delete mode 100644 test/langtools/tools/javadoc/lib/ToyDoclet.java delete mode 100644 test/langtools/tools/javadoc/nestedClass/NestedClass.java delete mode 100644 test/langtools/tools/javadoc/nestedClass/NestedClassB.java delete mode 100644 test/langtools/tools/javadoc/nonConstExprs/Test.java delete mode 100644 test/langtools/tools/javadoc/outputRedirect/Test.java delete mode 100644 test/langtools/tools/javadoc/outputRedirect/p/OutputRedirect.java delete mode 100644 test/langtools/tools/javadoc/parser/7091528/T7091528.java delete mode 100644 test/langtools/tools/javadoc/parser/7091528/p/C1.java delete mode 100644 test/langtools/tools/javadoc/parser/7091528/p/C3.java delete mode 100644 test/langtools/tools/javadoc/parser/7091528/p/q/C2.java delete mode 100644 test/langtools/tools/javadoc/sourceOnly/Test.java delete mode 100644 test/langtools/tools/javadoc/sourceOnly/p/NonSource.jasm delete mode 100644 test/langtools/tools/javadoc/sourceOnly/p/SourceOnly.java delete mode 100644 test/langtools/tools/javadoc/sourceOption/SourceOption.java delete mode 100644 test/langtools/tools/javadoc/sourceOption/p/LambdaConstructTest.java delete mode 100644 test/langtools/tools/javadoc/subpackageIgnore/SubpackageIgnore.java delete mode 100644 test/langtools/tools/javadoc/subpackageIgnore/pkg1/not-subpkg/SomeJavaFile.java delete mode 100644 test/langtools/tools/javadoc/varArgs/Main.java delete mode 100644 test/langtools/tools/javadoc/varArgs/expected.out delete mode 100644 test/langtools/tools/javadoc/varArgs/pkg1/A.java diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotatedType.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotatedType.java deleted file mode 100644 index adc028cc511..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotatedType.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - - -/** - * Represents an annotated type. - * For example: - *
        - *      {@code @NonNull String}
        - *      {@code @Positive int}
        - * 
        - * - * @author Mahmood Ali - * @since 1.8 - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface AnnotatedType extends Type { - - /** - * Returns the annotations associated with this type. - * @return the annotations associated with this type - */ - AnnotationDesc[] annotations(); - - /** - * Returns the underlying type. - * @return the underlying type - */ - Type underlyingType(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationDesc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationDesc.java deleted file mode 100644 index 4098d4c531a..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationDesc.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - - -/** - * Represents an annotation. - * An annotation associates a value with each element of an annotation type. - * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface AnnotationDesc { - - /** - * Returns the annotation type of this annotation. - * - * @return the annotation type of this annotation. - */ - AnnotationTypeDoc annotationType(); - - /** - * Returns this annotation's elements and their values. - * Only those explicitly present in the annotation are - * included, not those assuming their default values. - * Returns an empty array if there are none. - * - * @return this annotation's elements and their values. - */ - ElementValuePair[] elementValues(); - - /** - * Check for the synthesized bit on the annotation. - * - * @return true if the annotation is synthesized. - */ - boolean isSynthesized(); - - /** - * Represents an association between an annotation type element - * and one of its values. - * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ - @Deprecated(since="9", forRemoval=true) - public interface ElementValuePair { - - /** - * Returns the annotation type element. - * - * @return the annotation type element. - */ - AnnotationTypeElementDoc element(); - - /** - * Returns the value associated with the annotation type element. - * - * @return the value associated with the annotation type element. - */ - AnnotationValue value(); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeDoc.java deleted file mode 100644 index c2399f8e829..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeDoc.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - - -/** - * Represents an annotation type. - * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface AnnotationTypeDoc extends ClassDoc { - - /** - * Returns the elements of this annotation type. - * Returns an empty array if there are none. - * - * @return the elements of this annotation type. - */ - AnnotationTypeElementDoc[] elements(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeElementDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeElementDoc.java deleted file mode 100644 index 584446c2d80..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationTypeElementDoc.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - - -/** - * Represents an element of an annotation type. - * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface AnnotationTypeElementDoc extends MethodDoc { - - /** - * Returns the default value of this element. - * Returns null if this element has no default. - * - * @return the default value of this element. - */ - AnnotationValue defaultValue(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationValue.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationValue.java deleted file mode 100644 index 0a669b1db1f..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/AnnotationValue.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - - -/** - * Represents a value of an annotation type element. - * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface AnnotationValue { - - /** - * Returns the value. - * The type of the returned object is one of the following: - *
        • a wrapper class for a primitive type - *
        • {@code String} - *
        • {@code Type} (representing a class literal) - *
        • {@code FieldDoc} (representing an enum constant) - *
        • {@code AnnotationDesc} - *
        • {@code AnnotationValue[]} - *
        - * - * @return the value. - */ - Object value(); - - /** - * Returns a string representation of the value. - * - * @return the text of a Java language annotation value expression - * whose value is the value of this element. - */ - String toString(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/ClassDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/ClassDoc.java deleted file mode 100644 index 2550d2ac7ac..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ClassDoc.java +++ /dev/null @@ -1,362 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - - -/** - * Represents a java class or interface and provides access to - * information about the class, the class's comment and tags, and the - * members of the class. A ClassDoc only exists if it was - * processed in this run of javadoc. References to classes - * which may or may not have been processed in this run are - * referred to using Type (which can be converted to ClassDoc, - * if possible). - * - * @see Type - * - * @since 1.2 - * @author Kaiyang Liu (original) - * @author Robert Field (rewrite) - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface ClassDoc extends ProgramElementDoc, Type { - - /** - * Return true if this class is abstract. Return true - * for all interfaces. - * - * @return true if this class is abstract. Return true - * for all interfaces. - */ - boolean isAbstract(); - - /** - * Return true if this class implements or interface extends - * {@code java.io.Serializable}. - * - * Since {@code java.io.Externalizable} extends - * {@code java.io.Serializable}, - * Externalizable objects are also Serializable. - * - * @return true if this class implements or interface extends - * {@code java.io.Serializable}. - */ - boolean isSerializable(); - - /** - * Return true if this class implements or interface extends - * {@code java.io.Externalizable}. - * - * @return true if this class implements or interface extends - * {@code java.io.Externalizable}. - */ - boolean isExternalizable(); - - /** - * Return the serialization methods for this class or - * interface. - * - * @return an array of MethodDoc objects that represents - * the serialization methods for this class or interface. - */ - MethodDoc[] serializationMethods(); - - /** - * Return the Serializable fields of this class or interface. - *

        - * Return either a list of default fields documented by - * {@code serial} tag
        - * or return a single {@code FieldDoc} for - * {@code serialPersistentField} member. - * There should be a {@code serialField} tag for - * each Serializable field defined by an {@code ObjectStreamField} - * array component of {@code serialPersistentField}. - * - * @return an array of {@code FieldDoc} objects for the Serializable - * fields of this class or interface. - * - * @see #definesSerializableFields() - * @see SerialFieldTag - */ - FieldDoc[] serializableFields(); - - /** - * Return true if Serializable fields are explicitly defined with - * the special class member {@code serialPersistentFields}. - * - * @return true if Serializable fields are explicitly defined with - * the special class member {@code serialPersistentFields}. - * - * @see #serializableFields() - * @see SerialFieldTag - */ - boolean definesSerializableFields(); - - /** - * Return the superclass of this class. Return null if this is an - * interface. - * - *

        This method cannot accommodate certain generic type constructs. - * The {@code superclassType} method should be used instead. - * - * @return the ClassDoc for the superclass of this class, null if - * there is no superclass. - * @see #superclassType - */ - ClassDoc superclass(); - - /** - * Return the superclass of this class. Return null if this is an - * interface. A superclass is represented by either a - * {@code ClassDoc} or a {@code ParametrizedType}. - * - * @return the superclass of this class, or null if there is no superclass. - * @since 1.5 - */ - Type superclassType(); - - /** - * Test whether this class is a subclass of the specified class. - * If this is an interface, return false for all classes except - * {@code java.lang.Object} (we must keep this unexpected - * behavior for compatibility reasons). - * - * @param cd the candidate superclass. - * @return true if cd is a superclass of this class. - */ - boolean subclassOf(ClassDoc cd); - - /** - * Return interfaces implemented by this class or interfaces extended - * by this interface. Includes only directly-declared interfaces, not - * inherited interfaces. - * Return an empty array if there are no interfaces. - * - *

        This method cannot accommodate certain generic type constructs. - * The {@code interfaceTypes} method should be used instead. - * - * @return an array of ClassDoc objects representing the interfaces. - * @see #interfaceTypes - */ - ClassDoc[] interfaces(); - - /** - * Return interfaces implemented by this class or interfaces extended - * by this interface. Includes only directly-declared interfaces, not - * inherited interfaces. - * Return an empty array if there are no interfaces. - * - * @return an array of interfaces, each represented by a - * {@code ClassDoc} or a {@code ParametrizedType}. - * @since 1.5 - */ - Type[] interfaceTypes(); - - /** - * Return the formal type parameters of this class or interface. - * Return an empty array if there are none. - * - * @return the formal type parameters of this class or interface. - * @since 1.5 - */ - TypeVariable[] typeParameters(); - - /** - * Return the type parameter tags of this class or interface. - * Return an empty array if there are none. - * - * @return the type parameter tags of this class or interface. - * @since 1.5 - */ - ParamTag[] typeParamTags(); - - /** - * Return - * included - * fields in this class or interface. - * Excludes enum constants if this is an enum type. - * - * @return an array of FieldDoc objects representing the included - * fields in this class or interface. - */ - FieldDoc[] fields(); - - /** - * Return fields in this class or interface, filtered to the specified - * access - * modifier option. - * Excludes enum constants if this is an enum type. - * - * @param filter Specify true to filter according to the specified access - * modifier option. - * Specify false to include all fields regardless of - * access modifier option. - * @return an array of FieldDoc objects representing the included - * fields in this class or interface. - */ - FieldDoc[] fields(boolean filter); - - /** - * Return the enum constants if this is an enum type. - * Return an empty array if there are no enum constants, or if - * this is not an enum type. - * - * @return the enum constants if this is an enum type. - */ - FieldDoc[] enumConstants(); - - /** - * Return - * included - * methods in this class or interface. - * Same as {@code methods(true)}. - * - * @return an array of MethodDoc objects representing the included - * methods in this class or interface. Does not include - * constructors or annotation type elements. - */ - MethodDoc[] methods(); - - /** - * Return methods in this class or interface, filtered to the specified - * access - * modifier option. Does not include constructors or annotation - * type elements. - * - * @param filter Specify true to filter according to the specified access - * modifier option. - * Specify false to include all methods regardless of - * access modifier option. - * - * @return an array of MethodDoc objects representing the included - * methods in this class or interface. - */ - MethodDoc[] methods(boolean filter); - - /** - * Return - * included - * constructors in this class. An array containing the default - * no-arg constructor is returned if no other constructors exist. - * Return empty array if this is an interface. - * - * @return an array of ConstructorDoc objects representing the included - * constructors in this class. - */ - ConstructorDoc[] constructors(); - - /** - * Return constructors in this class, filtered to the specified - * access - * modifier option. Return an array containing the default - * no-arg constructor if no other constructors exist. - * - * @param filter Specify true to filter according to the specified access - * modifier option. - * Specify false to include all constructors regardless of - * access modifier option. - * @return an array of ConstructorDoc objects representing the included - * constructors in this class. - */ - ConstructorDoc[] constructors(boolean filter); - - - /** - * Return - * included - * nested classes and interfaces within this class or interface. - * This includes both static and non-static nested classes. - * (This method should have been named {@code nestedClasses()}, - * as inner classes are technically non-static.) Anonymous and local classes - * or interfaces are not included. - * - * @return an array of ClassDoc objects representing the included classes - * and interfaces defined in this class or interface. - */ - ClassDoc[] innerClasses(); - - /** - * Return nested classes and interfaces within this class or interface - * filtered to the specified - * access - * modifier option. - * This includes both static and non-static nested classes. - * Anonymous and local classes are not included. - * - * @param filter Specify true to filter according to the specified access - * modifier option. - * Specify false to include all nested classes regardless of - * access modifier option. - * @return a filtered array of ClassDoc objects representing the included - * classes and interfaces defined in this class or interface. - */ - ClassDoc[] innerClasses(boolean filter); - - /** - * Find the specified class or interface within the context of this class doc. - * Search order: 1) qualified name, 2) nested in this class or interface, - * 3) in this package, 4) in the class imports, 5) in the package imports. - * Return the ClassDoc if found, null if not found. - * @param className Specify the class name to find as a String. - * @return the ClassDoc if found, null if not found. - */ - ClassDoc findClass(String className); - - /** - * Get the list of classes and interfaces declared as imported. - * These are called "single-type-import declarations" in - * The Java™ Language Specification. - * - * @return an array of ClassDoc representing the imported classes. - * - * @deprecated Import declarations are implementation details that - * should not be exposed here. In addition, not all imported - * classes are imported through single-type-import declarations. - */ - @Deprecated(since="9", forRemoval=true) - ClassDoc[] importedClasses(); - - /** - * Get the list of packages declared as imported. - * These are called "type-import-on-demand declarations" in - * The Java™ Language Specification. - * - * @return an array of PackageDoc representing the imported packages. - * - * @deprecated Import declarations are implementation details that - * should not be exposed here. In addition, this method's - * return type does not allow for all type-import-on-demand - * declarations to be returned. - */ - @Deprecated(since="9", forRemoval=true) - PackageDoc[] importedPackages(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/ConstructorDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/ConstructorDoc.java deleted file mode 100644 index 8fc1c003b08..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ConstructorDoc.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -/** - * Represents a constructor of a java class. - * - * @since 1.2 - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface ConstructorDoc extends ExecutableMemberDoc { -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/Doc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/Doc.java deleted file mode 100644 index 34310015fba..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Doc.java +++ /dev/null @@ -1,286 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -import java.text.BreakIterator; -import java.util.Locale; - -/** - * Represents Java language constructs (package, class, constructor, - * method, field) which have comments and have been processed by this - * run of javadoc. All Doc objects are unique, that is, they - * are == comparable. - * - * @since 1.2 - * @author Robert Field - * @author Scott Seligman (generics, enums, annotations) - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface Doc extends Comparable { - - /** - * Return the text of the comment for this doc item. - * Tags have been removed. - * - * @return the text of the comment for this doc item. - */ - String commentText(); - - /** - * Return all tags in this Doc item. - * - * @return an array of {@link Tag} objects containing all tags on - * this Doc item. - */ - Tag[] tags(); - - /** - * Return tags of the specified {@linkplain Tag#kind() kind} in - * this Doc item. - * - * For example, if 'tagname' has value "@serial", all tags in - * this Doc item of kind "@serial" will be returned. - * - * @param tagname name of the tag kind to search for. - * @return an array of Tag containing all tags whose 'kind()' - * matches 'tagname'. - */ - Tag[] tags(String tagname); - - /** - * Return the see also tags in this Doc item. - * - * @return an array of SeeTag containing all @see tags. - */ - SeeTag[] seeTags(); - - /** - * Return comment as an array of tags. Includes inline tags - * (i.e. {@link reference} tags) but not - * block tags. - * Each section of plain text is represented as a {@link Tag} - * of {@linkplain Tag#kind() kind} "Text". - * Inline tags are represented as a {@link SeeTag} of kind "@see" - * and name "@link". - * - * @return an array of {@link Tag}s representing the comment - */ - Tag[] inlineTags(); - - /** - * Return the first sentence of the comment as an array of tags. - * Includes inline tags - * (i.e. {@link reference} tags) but not - * block tags. - * Each section of plain text is represented as a {@link Tag} - * of {@linkplain Tag#kind() kind} "Text". - * Inline tags are represented as a {@link SeeTag} of kind "@see" - * and name "@link". - *

        - * If the locale is English language, the first sentence is - * determined by the rules described in the Java Language - * Specification (first version): "This sentence ends - * at the first period that is followed by a blank, tab, or - * line terminator or at the first tagline.", in - * addition a line will be terminated by block - * HTML tags: <p> </p> <h1> - * <h2> <h3> <h4> <h5> <h6> - * <hr> <pre> or </pre>. - * If the locale is not English, the sentence end will be - * determined by - * {@link BreakIterator#getSentenceInstance(Locale)}. - - * @return an array of {@link Tag}s representing the - * first sentence of the comment - */ - Tag[] firstSentenceTags(); - - /** - * Return the full unprocessed text of the comment. Tags - * are included as text. Used mainly for store and retrieve - * operations like internalization. - * - * @return the full unprocessed text of the comment. - */ - String getRawCommentText(); - - /** - * Set the full unprocessed text of the comment. Tags - * are included as text. Used mainly for store and retrieve - * operations like internalization. - * - * @param rawDocumentation A String containing the full unprocessed text of the comment. - */ - void setRawCommentText(String rawDocumentation); - - /** - * Returns the non-qualified name of this Doc item. - * - * @return the name - */ - String name(); - - /** - * Compares this doc object with the specified object for order. Returns a - * negative integer, zero, or a positive integer as this doc object is less - * than, equal to, or greater than the given object. - *

        - * This method satisfies the {@link java.lang.Comparable} interface. - * - * @param obj the {@code Object} to be compared. - * @return a negative integer, zero, or a positive integer as this Object - * is less than, equal to, or greater than the given Object. - * @exception ClassCastException the specified Object's type prevents it - * from being compared to this Object. - */ - int compareTo(Object obj); - - /** - * Is this Doc item a field (but not an enum constant)? - * - * @return true if it represents a field - */ - boolean isField(); - - /** - * Is this Doc item an enum constant? - * - * @return true if it represents an enum constant - * @since 1.5 - */ - boolean isEnumConstant(); - - /** - * Is this Doc item a constructor? - * - * @return true if it represents a constructor - */ - boolean isConstructor(); - - /** - * Is this Doc item a method (but not a constructor or annotation - * type element)? - * - * @return true if it represents a method - */ - boolean isMethod(); - - /** - * Is this Doc item an annotation type element? - * - * @return true if it represents an annotation type element - * @since 1.5 - */ - boolean isAnnotationTypeElement(); - - /** - * Is this Doc item an interface (but not an annotation type)? - * - * @return true if it represents an interface - */ - boolean isInterface(); - - /** - * Is this Doc item an exception class? - * - * @return true if it represents an exception - */ - boolean isException(); - - /** - * Is this Doc item an error class? - * - * @return true if it represents a error - */ - boolean isError(); - - /** - * Is this Doc item an enum type? - * - * @return true if it represents an enum type - * @since 1.5 - */ - boolean isEnum(); - - /** - * Is this Doc item an annotation type? - * - * @return true if it represents an annotation type - * @since 1.5 - */ - boolean isAnnotationType(); - - /** - * Is this Doc item an - * ordinary - * class? - * (i.e. not an interface, annotation type, enum, exception, or error)? - * - * @return true if it represents an ordinary class - */ - boolean isOrdinaryClass(); - - /** - * Is this Doc item a - * class - * (and not an interface or annotation type)? - * This includes ordinary classes, enums, errors and exceptions. - * - * @return true if it represents a class - */ - boolean isClass(); - - /** - * Return true if this Doc item is - * included - * in the result set. - * - * @return true if this Doc item is - * included - * in the result set. - */ - boolean isIncluded(); - - /** - * Return the source position of the first line of the - * corresponding declaration, or null if - * no position is available. A default constructor returns - * null because it has no location in the source file. - * - * @since 1.4 - * @return the source positino of the first line of the - * corresponding declaration, or null if - * no position is available. A default constructor returns - * null because it has no location in the source file. - */ - SourcePosition position(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/DocErrorReporter.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/DocErrorReporter.java deleted file mode 100644 index 33167d8e191..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/DocErrorReporter.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -/** - * This interface provides error, warning and notice printing. - * - * @since 1.2 - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface DocErrorReporter { - - /** - * Print error message and increment error count. - * - * @param msg message to print - */ - void printError(String msg); - - /** - * Print an error message and increment error count. - * - * @param pos the position item where the error occurs - * @param msg message to print - * @since 1.4 - */ - void printError(SourcePosition pos, String msg); - - /** - * Print warning message and increment warning count. - * - * @param msg message to print - */ - void printWarning(String msg); - - /** - * Print warning message and increment warning count. - * - * @param pos the position item where the warning occurs - * @param msg message to print - * @since 1.4 - */ - void printWarning(SourcePosition pos, String msg); - - /** - * Print a message. - * - * @param msg message to print - */ - void printNotice(String msg); - - /** - * Print a message. - * - * @param pos the position item where the message occurs - * @param msg message to print - * @since 1.4 - */ - void printNotice(SourcePosition pos, String msg); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/Doclet.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/Doclet.java deleted file mode 100644 index 7b4dfc78a9f..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Doclet.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 1997, 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. 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 com.sun.javadoc; - -/** - * This is an example of a starting class for a doclet, - * showing the entry-point methods. A starting class must - * import com.sun.javadoc.* and implement the - * {@code start(RootDoc)} method, as described in the - * package - * description. If the doclet takes command line options, - * it must also implement {@code optionLength} and - * {@code validOptions}. - * - *

        A doclet supporting the language features added since 1.1 - * (such as generics and annotations) should indicate this - * by implementing {@code languageVersion}. In the absence of - * this the doclet should not invoke any of the Doclet API methods - * added since 1.5, and - * the results of several other methods are modified so as - * to conceal the new constructs (such as type parameters) from - * the doclet. - * - *

        To start the doclet, pass - * {@code -doclet} followed by the fully-qualified - * name of the starting class on the javadoc tool command line. - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public abstract class Doclet { - - /** - * Generate documentation here. - * This method is required for all doclets. - * - * @param root Supply the RootDoc to the method. - * @return true on success. - */ - public static boolean start(RootDoc root) { - return true; - } - - /** - * Check for doclet-added options. Returns the number of - * arguments you must specify on the command line for the - * given option. For example, "-d docs" would return 2. - *

        - * This method is required if the doclet contains any options. - * If this method is missing, Javadoc will print an invalid flag - * error for every option. - * - * @param option the option for which the number of arguements is returned. - * @return number of arguments on the command line for an option - * including the option name itself. Zero return means - * option not known. Negative value means error occurred. - */ - public static int optionLength(String option) { - return 0; // default is option unknown - } - - /** - * Check that options have the correct arguments. - *

        - * This method is not required, but is recommended, - * as every option will be considered valid if this method - * is not present. It will default gracefully (to true) - * if absent. - *

        - * Printing option related error messages (using the provided - * DocErrorReporter) is the responsibility of this method. - * - * @param options Supply valid options as an array of Strings. - * @param reporter The DocErrorReporter responsible for these options. - * @return true if the options are valid. - */ - public static boolean validOptions(String options[][], - DocErrorReporter reporter) { - return true; // default is options are valid - } - - /** - * Return the version of the Java Programming Language supported - * by this doclet. - *

        - * This method is required by any doclet supporting a language version - * newer than 1.1. - * - * @return the language version supported by this doclet. - * @since 1.5 - */ - public static LanguageVersion languageVersion() { - return LanguageVersion.JAVA_1_1; - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/ExecutableMemberDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/ExecutableMemberDoc.java deleted file mode 100644 index 71f0a3fce41..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ExecutableMemberDoc.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -/** - * Represents a method or constructor of a java class. - * - * @since 1.2 - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface ExecutableMemberDoc extends MemberDoc { - - /** - * Return exceptions this method or constructor throws. - * If the type of the exception is a type variable, return the - * {@code ClassDoc} of its erasure. - * - *

        The {@code thrownExceptions} method cannot - * accommodate certain generic type constructs. The - * {@code thrownExceptionTypes} method should be used - * instead. - * - * @return an array of ClassDoc[] representing the exceptions - * thrown by this method. - * @see #thrownExceptionTypes - */ - ClassDoc[] thrownExceptions(); - - /** - * Return exceptions this method or constructor throws. - * - * @return an array representing the exceptions thrown by this method. - * Each array element is either a {@code ClassDoc} or a - * {@code TypeVariable}. - * @since 1.5 - */ - Type[] thrownExceptionTypes(); - - /** - * Return true if this method is native - * - * @return true if this method is native - */ - boolean isNative(); - - /** - * Return true if this method is synchronized - * - * @return true if this method is synchronized - */ - boolean isSynchronized(); - - /** - * Return true if this method was declared to take a variable number - * of arguments. - * - * @since 1.5 - * @return true if this method was declared to take a variable number of arguments. - */ - public boolean isVarArgs(); - - /** - * Get argument information. - * - * @see Parameter - * - * @return an array of Parameter, one element per argument - * in the order the arguments are present. - */ - Parameter[] parameters(); - - /** - * Get the receiver type of this executable element. - * - * @return the receiver type of this executable element. - * @since 1.8 - */ - Type receiverType(); - - /** - * Return the throws tags in this method. - * - * @return an array of ThrowTag containing all {@code @exception} - * and {@code @throws} tags. - */ - ThrowsTag[] throwsTags(); - - /** - * Return the param tags in this method, excluding the type - * parameter tags. - * - * @return an array of ParamTag containing all {@code @param} tags - * corresponding to the parameters of this method. - */ - ParamTag[] paramTags(); - - /** - * Return the type parameter tags in this method. - * - * @return an array of ParamTag containing all {@code @param} tags - * corresponding to the type parameters of this method. - * @since 1.5 - */ - ParamTag[] typeParamTags(); - - /** - * Get the signature. It is the parameter list, type is qualified. - * For instance, for a method {@code mymethod(String x, int y)}, - * it will return {@code (java.lang.String,int)}. - * - * @return the parameter list where type is qualified. - */ - String signature(); - - /** - * get flat signature. all types are not qualified. - * return a String, which is the flat signiture of this member. - * It is the parameter list, type is not qualified. - * For instance, for a method {@code mymethod(String x, int y)}, - * it will return {@code (String, int)}. - * - * @return a String, which is the flat signiture of this member. - */ - String flatSignature(); - - /** - * Return the formal type parameters of this method or constructor. - * Return an empty array if this method or constructor is not generic. - * - * @return the formal type parameters of this method or constructor. - * @since 1.5 - */ - TypeVariable[] typeParameters(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/FieldDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/FieldDoc.java deleted file mode 100644 index 5e7f9270d6a..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/FieldDoc.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -/** - * Represents a field in a java class. - * - * @see MemberDoc - * - * @since 1.2 - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface FieldDoc extends MemberDoc { - - /** - * Get type of this field. - * - * @return the type of this field. - */ - Type type(); - - /** - * Return true if this field is transient - * - * @return true if this field is transient - */ - boolean isTransient(); - - /** - * Return true if this field is volatile - * - * @return true if this field is volatile - */ - boolean isVolatile(); - - /** - * Return the serialField tags in this FieldDoc item. - * - * @return an array of {@code SerialFieldTag} objects containing - * all {@code @serialField} tags. - */ - SerialFieldTag[] serialFieldTags(); - - /** - * Get the value of a constant field. - * - * @return the value of a constant field. The value is - * automatically wrapped in an object if it has a primitive type. - * If the field is not constant, returns null. - */ - Object constantValue(); - - /** - * Get the value of a constant field. - * - * @return the text of a Java language expression whose value - * is the value of the constant. The expression uses no identifiers - * other than primitive literals. If the field is - * not constant, returns null. - */ - String constantValueExpression(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/LanguageVersion.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/LanguageVersion.java deleted file mode 100644 index 83d338a61a6..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/LanguageVersion.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - - -/** - * Java Programming Language version. The constants of this enum - * identify the JDK and J2SE releases containing language changes - * relevant to doclets. - *

        - * All doclets support at least the 1.1 language version. - * The first release subsequent to this with language changes - * affecting doclets is 1.5. - * - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public enum LanguageVersion { - - /** 1.1 added nested classes and interfaces. */ - JAVA_1_1, - - /** 1.5 added generic types, annotations, enums, and varArgs. */ - JAVA_1_5 -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/MemberDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/MemberDoc.java deleted file mode 100644 index 97211fc9a24..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/MemberDoc.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -/** - * Represents a member of a java class: field, constructor, or method. - * This is an abstract class dealing with information common to - * method, constructor and field members. Class members of a class - * (innerclasses) are represented instead by ClassDoc. - * - * @see MethodDoc - * @see FieldDoc - * @see ClassDoc - * - * @author Kaiyang Liu (original) - * @author Robert Field (rewrite) - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface MemberDoc extends ProgramElementDoc { - - /** - * Returns true if this member was synthesized by the compiler. - * - * @return true if this member was synthesized by the compiler. - */ - boolean isSynthetic(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/MethodDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/MethodDoc.java deleted file mode 100644 index 0fb086227d8..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/MethodDoc.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -/** - * Represents a method of a java class. - * - * @since 1.2 - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface MethodDoc extends ExecutableMemberDoc { - - /** - * Return true if this method is abstract - * - * @return true if this method is abstract - */ - boolean isAbstract(); - - /** - * Return true if this method is default - * - * @return true if this method is default - */ - boolean isDefault(); - - /** - * Get return type. - * - * @return the return type of this method, null if it - * is a constructor. - */ - Type returnType(); - - /** - * Return the class containing the method that this method overrides. - * - *

        The {@code overriddenClass} method cannot - * accommodate certain generic type constructs. The - * {@code overriddenType} method should be used instead. - * - * @return a ClassDoc representing the superclass - * defining a method that this method overrides, or null if - * this method does not override. - */ - ClassDoc overriddenClass(); - - /** - * Return the type containing the method that this method overrides. - * It may be a {@code ClassDoc} or a {@code ParameterizedType}. - * - * @return the supertype whose method is overridden, or null if this - * method does not override another in a superclass - * @since 1.5 - */ - Type overriddenType(); - - /** - * Return the method that this method overrides. - * - * @return a MethodDoc representing a method definition - * in a superclass this method overrides, null if - * this method does not override. - */ - MethodDoc overriddenMethod(); - - /** - * Tests whether this method overrides another. - * The overridden method may be one declared in a superclass or - * a superinterface (unlike {@link #overriddenMethod()}). - * - *

        When a non-abstract method overrides an abstract one, it is - * also said to implement the other. - * - * @param meth the other method to examine - * @return {@code true} if this method overrides the other - * @since 1.5 - */ - boolean overrides(MethodDoc meth); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/PackageDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/PackageDoc.java deleted file mode 100644 index 24e0828d1c8..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/PackageDoc.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -/** - * Represents a java package. Provides access to information - * about the package, the package's comment and tags, and the - * classes in the package. - *

        - * Each method whose return type is an array will return an empty - * array (never null) when there are no objects in the result. - * - * @since 1.2 - * @author Kaiyang Liu (original) - * @author Robert Field (rewrite) - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface PackageDoc extends Doc { - - /** - * Get all classes and interfaces in the package, filtered to the specified - * access - * modifier option. - * - * @return filtered classes and interfaces in this package - * @param filter Specifying true filters according to the specified access - * modifier option. - * Specifying false includes all classes and interfaces - * regardless of access modifier option. - * @since 1.4 - */ - ClassDoc[] allClasses(boolean filter); - - /** - * Get all - * included - * classes and interfaces in the package. Same as allClasses(true). - * - * @return all included classes and interfaces in this package. - */ - ClassDoc[] allClasses(); - - /** - * Get included - * ordinary - * classes (that is, exclude exceptions, errors, enums, interfaces, and - * annotation types) - * in this package. - * - * @return included ordinary classes in this package. - */ - ClassDoc[] ordinaryClasses(); - - /** - * Get included Exception classes in this package. - * - * @return included Exceptions in this package. - */ - ClassDoc[] exceptions(); - - /** - * Get included Error classes in this package. - * - * @return included Errors in this package. - */ - ClassDoc[] errors(); - - /** - * Get included enum types in this package. - * - * @return included enum types in this package. - * @since 1.5 - */ - ClassDoc[] enums(); - - /** - * Get included interfaces in this package, omitting annotation types. - * - * @return included interfaces in this package. - */ - ClassDoc[] interfaces(); - - /** - * Get included annotation types in this package. - * - * @return included annotation types in this package. - * @since 1.5 - */ - AnnotationTypeDoc[] annotationTypes(); - - /** - * Get the annotations of this package. - * Return an empty array if there are none. - * - * @return the annotations of this package. - * @since 1.5 - */ - AnnotationDesc[] annotations(); - - /** - * Lookup a class or interface within this package. - * - * @param className A String containing the name of the class to look up. - * @return ClassDoc of found class or interface, - * or null if not found. - */ - ClassDoc findClass(String className); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/ParamTag.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/ParamTag.java deleted file mode 100644 index 66c82dba4c1..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ParamTag.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -/** - * Represents an @param documentation tag. - * Stores the name and comment parts of the parameter tag. - * An @param tag may represent either a method or constructor parameter, - * or a type parameter. - * - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface ParamTag extends Tag { - - /** - * Return the name of the parameter or type parameter - * associated with this {@code ParamTag}. - * The angle brackets delimiting a type parameter are not part of - * its name. - * - * @return the parameter name. - */ - String parameterName(); - - /** - * Return the parameter comment - * associated with this {@code ParamTag}. - * - * @return the parameter comment. - */ - String parameterComment(); - - /** - * Return true if this {@code ParamTag} corresponds to a type - * parameter. Return false if it corresponds to an ordinary parameter - * of a method or constructor. - * - * @return true if this {@code ParamTag} corresponds to a type - * parameter. - * @since 1.5 - */ - boolean isTypeParameter(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/Parameter.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/Parameter.java deleted file mode 100644 index aeeeeda6868..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Parameter.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -/** - * Parameter information. - * This includes a parameter type and parameter name. - * - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface Parameter { - - /** - * Get the type of this parameter. - * - * @return the type of this parameter. - */ - Type type(); - - /** - * Get local name of this parameter. - * For example if parameter is the short 'index', returns "index". - * - * @return the name of this parameter as a string. - */ - String name(); - - /** - * Get type name of this parameter. - * For example if parameter is the short 'index', returns "short". - *

        - * This method returns a complete string - * representation of the type, including the dimensions of arrays and - * the type arguments of parameterized types. Names are qualified. - * - * @return a complete string representation of the type. - */ - String typeName(); - - /** - * Returns a string representation of the parameter. - *

        - * For example if parameter is the short 'index', returns "short index". - * - * @return type and parameter name of this parameter. - */ - String toString(); - - /** - * Get the annotations of this parameter. - * Return an empty array if there are none. - * - * @return the annotations of this parameter. - * @since 1.5 - */ - AnnotationDesc[] annotations(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/ParameterizedType.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/ParameterizedType.java deleted file mode 100644 index 9c665271e47..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ParameterizedType.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - - -/** - * Represents an invocation of a generic class or interface. For example, - * given the generic interface {@code List}, possible invocations - * include: - *

        - *      {@code List}
        - *      {@code List}
        - *      {@code List}
        - * 
        - * A generic inner class {@code Outer.Inner} might be invoked as: - *
        - *      {@code Outer.Inner}
        - * 
        - * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface ParameterizedType extends Type { - - /** - * Return the generic class or interface that declared this type. - * - * @return the generic class or interface that declared this type. - */ - ClassDoc asClassDoc(); - - /** - * Return the actual type arguments of this type. - * For a generic type that is nested within some other generic type - * (such as {@code Outer.Inner}), - * only the type arguments of the innermost type are included. - * - * @return the actual type arguments of this type. - */ - Type[] typeArguments(); - - /** - * Return the class type that is a direct supertype of this one. - * This is the superclass of this type's declaring class, - * with type arguments substituted in. - * Return null if this is an interface type. - * - *

        For example, if this parameterized type is - * {@code java.util.ArrayList}, the result will be - * {@code java.util.AbstractList}. - * - * @return the class type that is a direct supertype of this one. - */ - Type superclassType(); - - /** - * Return the interface types directly implemented by or extended by this - * parameterized type. - * These are the interfaces directly implemented or extended - * by this type's declaring class or interface, - * with type arguments substituted in. - * Return an empty array if there are no interfaces. - * - *

        For example, the interface extended by - * {@code java.util.Set} is {@code java.util.Collection}. - * - * @return the interface types directly implemented by or extended by this - * parameterized type. - */ - Type[] interfaceTypes(); - - /** - * Return the type that contains this type as a member. - * Return null is this is a top-level type. - * - *

        For example, the containing type of - * {@code AnInterface.Nested} is the {@code ClassDoc} - * representing {@code AnInterface}, and the containing type of - * {@code Outer.Inner} is the - * {@code ParameterizedType} representing {@code Outer}. - * - * @return the type that contains this type as a member. - */ - Type containingType(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/ProgramElementDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/ProgramElementDoc.java deleted file mode 100644 index f720e3399a7..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ProgramElementDoc.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -/** - * Represents a java program element: class, interface, field, - * constructor, or method. - * This is an abstract class dealing with information common to - * these elements. - * - * @see MemberDoc - * @see ClassDoc - * - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface ProgramElementDoc extends Doc { - - /** - * Get the containing class or interface of this program element. - * - * @return a ClassDoc for this element's containing class or interface. - * If this is a top-level class or interface, return null. - */ - ClassDoc containingClass(); - - /** - * Get the package that this program element is contained in. - * - * @return a PackageDoc for this element containing package. - * If in the unnamed package, this PackageDoc will have the - * name "". - */ - PackageDoc containingPackage(); - - /** - * Get the fully qualified name of this program element. - * For example, for the class {@code java.util.Hashtable}, - * return "java.util.Hashtable". - *

        - * For the method {@code bar()} in class {@code Foo} - * in the unnamed package, return "Foo.bar". - * - * @return the qualified name of the program element as a String. - */ - String qualifiedName(); - - /** - * Get the modifier specifier integer. - * - * @see java.lang.reflect.Modifier - * - * @return Get the modifier specifier integer. - */ - int modifierSpecifier(); - - /** - * Get modifiers string. - * For example, for: - *

        -     *   public abstract int foo() { ... }
        -     * 
        - * return "public abstract". - * Annotations are not included. - * - * @return "public abstract". - */ - String modifiers(); - - /** - * Get the annotations of this program element. - * Return an empty array if there are none. - * - * @return the annotations of this program element. - * @since 1.5 - */ - AnnotationDesc[] annotations(); - - /** - * Return true if this program element is public. - * - * @return true if this program element is public. - */ - boolean isPublic(); - - /** - * Return true if this program element is protected. - * - * @return true if this program element is protected. - */ - boolean isProtected(); - - /** - * Return true if this program element is private. - * - * @return true if this program element is private. - */ - boolean isPrivate(); - - /** - * Return true if this program element is package private. - * - * @return true if this program element is package private. - */ - boolean isPackagePrivate(); - /** - * Return true if this program element is static. - * - * @return true if this program element is static. - */ - boolean isStatic(); - - /** - * Return true if this program element is final. - * - * @return true if this program element is final. - */ - boolean isFinal(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/RootDoc.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/RootDoc.java deleted file mode 100644 index 8403b8f190c..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/RootDoc.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -/** - * Represents the root of the program structure information - * for one run of javadoc. From this root all other program - * structure information can be extracted. - * Also represents the command line information -- the - * packages, classes and options specified by the user. - * - * @since 1.2 - * @author Robert Field - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface RootDoc extends Doc, DocErrorReporter { - - /** - * Command line options. - *

        - * For example, given: - *

        -     *     javadoc -foo this that -bar other ...
        - * - * this method will return: - *
        -     *      options()[0][0] = "-foo"
        -     *      options()[0][1] = "this"
        -     *      options()[0][2] = "that"
        -     *      options()[1][0] = "-bar"
        -     *      options()[1][1] = "other"
        - * - * @return an array of arrays of String. - */ - String[][] options(); - - /** - * Return the packages - * specified - * on the command line. - * If {@code -subpackages} and {@code -exclude} options - * are used, return all the non-excluded packages. - * - * @return packages specified on the command line. - */ - PackageDoc[] specifiedPackages(); - - /** - * Return the classes and interfaces - * specified - * as source file names on the command line. - * - * @return classes and interfaces specified on the command line. - */ - ClassDoc[] specifiedClasses(); - - /** - * Return the - * included - classes and interfaces in all packages. - * - * @return included classes and interfaces in all packages. - */ - ClassDoc[] classes(); - - /** - * Return a PackageDoc for the specified package name. - * - * @param name package name - * - * @return a PackageDoc holding the specified package, null if - * this package is not referenced. - */ - PackageDoc packageNamed(String name); - - /** - * Return a ClassDoc for the specified class or interface name. - * - * @param qualifiedName - * qualified - * class or package name - * - * @return a ClassDoc holding the specified class, null if - * this class is not referenced. - */ - ClassDoc classNamed(String qualifiedName); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/SeeTag.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/SeeTag.java deleted file mode 100644 index 07c3ba2d7ba..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/SeeTag.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -/** - * Represents a user-defined cross-reference to related documentation. - * The tag can reference a package, class or member, or can hold - * plain text. (The plain text might be a reference - * to something not online, such as a printed book, or be a hard-coded - * HTML link.) The reference can either be inline with the comment, - * using {@code {@link}}, or a separate block comment, - * using {@code @see}. - * Method {@code name()} returns "@link" (no curly braces) or - * "@see", depending on the tag. - * Method {@code kind()} returns "@see" for both tags. - * - * @author Kaiyang Liu (original) - * @author Robert Field (rewrite) - * @author Atul M Dambalkar - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface SeeTag extends Tag { - - /** - * Get the label of the {@code @see} tag. - * Return null if no label is present. - * For example, for: - *

        - *   {@code @see String#trim() the trim method} - *

        - * return "the trim method". - * - * @return "the trim method". - */ - String label(); - - /** - * Get the package doc when {@code @see} references only a package. - * Return null if the package cannot be found, or if - * {@code @see} references any other element (class, - * interface, field, constructor, method) or non-element. - * For example, for: - *

        - *   {@code @see java.lang} - *

        - * return the {@code PackageDoc} for {@code java.lang}. - * - * @return the {@code PackageDoc} for {@code java.lang}. - */ - public PackageDoc referencedPackage(); - - /** - * Get the class or interface name of the {@code @see} reference. - * The name is fully qualified if the name specified in the - * original {@code @see} tag was fully qualified, or if the class - * or interface can be found; otherwise it is unqualified. - * If {@code @see} references only a package name, then return - * the package name instead. - * For example, for: - *

        - *   {@code @see String#valueOf(java.lang.Object)} - *

        - * return "java.lang.String". - * For "{@code @see java.lang}", return "java.lang". - * Return null if {@code @see} references a non-element, such as - * {@code @see }. - * - * @return null if {@code @see} references a non-element, such as - * {@code @see }. - */ - String referencedClassName(); - - /** - * Get the class doc referenced by the class name part of @see. - * Return null if the class cannot be found. - * For example, for: - *

        - *   {@code @see String#valueOf(java.lang.Object)} - *

        - * return the {@code ClassDoc} for {@code java.lang.String}. - * - * @return the {@code ClassDoc} for {@code java.lang.String}. - */ - ClassDoc referencedClass(); - - /** - * Get the field, constructor or method substring of the {@code @see} - * reference. Return null if the reference is to any other - * element or to any non-element. - * References to member classes (nested classes) return null. - * For example, for: - *

        - *   {@code @see String#startsWith(String)} - *

        - * return "startsWith(String)". - * - * @return "startsWith(String)". - */ - String referencedMemberName(); - - /** - * Get the member doc for the field, constructor or method - * referenced by {@code @see}. Return null if the member cannot - * be found or if the reference is to any other element or to any - * non-element. - * References to member classes (nested classes) return null. - * For example, for: - *

        - *   {@code @see String#startsWith(java.lang.String)} - *

        - * return the {@code MethodDoc} for {@code startsWith}. - * - * @return the {@code MethodDoc} for {@code startsWith}. - */ - MemberDoc referencedMember(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/SerialFieldTag.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/SerialFieldTag.java deleted file mode 100644 index c8344982164..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/SerialFieldTag.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -/** - * Documents a Serializable field defined by an ObjectStreamField. - *
        - * The class parses and stores the three serialField tag parameters:
        - *
        - * - field name
        - * - field type name
        - *      (fully-qualified or visible from the current import context)
        - * - description of the valid values for the field
        -
        - * 
        - * This tag is only allowed in the javadoc for the special member - * serialPersistentFields. - * - * @author Joe Fialli - * - * @see java.io.ObjectStreamField - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface SerialFieldTag extends Tag, Comparable { - - /** - * Return the serializable field name. - * - * @return the serializable field name. - */ - public String fieldName(); - - /** - * Return the field type string. - * - * @return the field type string. - */ - public String fieldType(); - - /** - * Return the ClassDoc for field type. - * - * @return null if no ClassDoc for field type is visible from - * containingClass context. - */ - public ClassDoc fieldTypeDoc(); - - /** - * Return the field comment. If there is no serialField comment, return - * javadoc comment of corresponding FieldDoc. - * - * @return the field comment. If there is no serialField comment, return - * javadoc comment of corresponding FieldDoc. - */ - public String description(); - - /** - * Compares this Object with the specified Object for order. Returns a - * negative integer, zero, or a positive integer as this Object is less - * than, equal to, or greater than the given Object. - *

        - * Included to make SerialFieldTag items java.lang.Comparable. - * - * @param obj the {@code Object} to be compared. - * @return a negative integer, zero, or a positive integer as this Object - * is less than, equal to, or greater than the given Object. - * @exception ClassCastException the specified Object's type prevents it - * from being compared to this Object. - * @since 1.2 - */ - public int compareTo(Object obj); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/SourcePosition.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/SourcePosition.java deleted file mode 100644 index 5447feaeea8..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/SourcePosition.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -import java.io.File; - -/** - * This interface describes a source position: filename, line number, - * and column number. - * - * @since 1.4 - * @author Neal M Gafter - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface SourcePosition { - /** The source file. Returns null if no file information is - * available. - * - * @return the source file as a File. - */ - File file(); - - /** The line in the source file. The first line is numbered 1; - * 0 means no line number information is available. - * - * @return the line number in the source file as an integer. - */ - int line(); - - /** The column in the source file. The first column is - * numbered 1; 0 means no column information is available. - * Columns count characters in the input stream; a tab - * advances the column number to the next 8-column tab stop. - * - * @return the column on the source line as an integer. - */ - int column(); - - /** Convert the source position to the form "Filename:line". */ - String toString(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/Tag.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/Tag.java deleted file mode 100644 index 7b4eb4a3b96..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Tag.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -import java.text.BreakIterator; -import java.util.Locale; - -/** - * Represents a simple documentation tag, such as @since, @author, @version. - * Given a tag (e.g. "@since 1.2"), holds tag name (e.g. "@since") - * and tag text (e.g. "1.2"). Tags with structure or which require - * special processing are handled by subclasses such as ParamTag - * (for @param), SeeTag (for @see and {@link}), and ThrowsTag - * (for @throws). - * - * @author Robert Field - * @author Atul M Dambalkar - * @see SeeTag - * @see ParamTag - * @see ThrowsTag - * @see SerialFieldTag - * @see Doc#tags() - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface Tag { - - /** - * Return the name of this tag. The name is the string - * starting with "@" that is used in a doc comment, such as - * {@code @return}. For inline tags, such as - * {@code {@link}}, the curly brackets - * are not part of the name, so in this example the name - * would be simply {@code @link}. - * - * @return the name of this tag - */ - String name(); - - /** - * Return the containing {@link Doc} of this Tag element. - * - * @return the containing {@link Doc} of this Tag element - */ - Doc holder(); - - /** - * Return the kind of this tag. - * For most tags, - * {@code kind() == name()}; - * the following table lists those cases where there is more - * than one tag of a given kind: - * - *

    - * - * - * - * - * - *
    Related Tags
    {@code name() } {@code kind() } - *
    {@code @exception } {@code @throws } - *
    {@code @link } {@code @see } - *
    {@code @linkplain } {@code @see } - *
    {@code @see } {@code @see } - *
    {@code @serial } {@code @serial } - *
    {@code @serialData } {@code @serial } - *
    {@code @throws } {@code @throws } - *
    - * - * @return the kind of this tag. - */ - String kind(); - - /** - * Return the text of this tag, that is, the portion beyond tag name. - * - * @return the text of this tag - */ - String text(); - - /** - * Convert this object to a string. - */ - String toString(); - - /** - * For a documentation comment with embedded {@code {@link}} - * tags, return an array of {@code Tag} objects. The entire - * doc comment is broken down into strings separated by - * {@code {@link}} tags, where each successive element - * of the array represents either a string or - * {@code {@link}} tag, in order, from start to end. - * Each string is represented by a {@code Tag} object of - * name "Text", where {@link #text()} returns the string. Each - * {@code {@link}} tag is represented by a - * {@link SeeTag} of name "@link" and kind "@see". - * For example, given the following comment - * tag: - *

    - * {@code This is a {@link Doc commentlabel} example.} - *

    - * return an array of Tag objects: - *

      - *
    • tags[0] is a {@link Tag} with name "Text" and text consisting - * of "This is a " - *
    • tags[1] is a {@link SeeTag} with name "@link", referenced - * class {@code Doc} and label "commentlabel" - *
    • tags[2] is a {@link Tag} with name "Text" and text consisting - * of " example." - *
    - * - * @return Tag[] array of tags - * @see ParamTag - * @see ThrowsTag - */ - Tag[] inlineTags(); - - /** - * Return the first sentence of the comment as an array of tags. - * Includes inline tags - * (i.e. {@link reference} tags) but not - * block tags. - * Each section of plain text is represented as a {@link Tag} - * of kind "Text". - * Inline tags are represented as a {@link SeeTag} of kind "@link". - * If the locale is English language, the first sentence is - * determined by the rules described in the Java Language - * Specification (first version): "This sentence ends - * at the first period that is followed by a blank, tab, or - * line terminator or at the first tagline.", in - * addition a line will be terminated by paragraph and - * section terminating HTML tags: <p> </p> <h1> - * <h2> <h3> <h4> <h5> <h6> - * <hr> <pre> or </pre>. - * If the locale is not English, the sentence end will be - * determined by - * {@link BreakIterator#getSentenceInstance(Locale)}. - * - * @return an array of {@link Tag} objects representing the - * first sentence of the comment - */ - Tag[] firstSentenceTags(); - - /** - * Return the source position of this tag. - * @return the source position of this tag. - */ - public SourcePosition position(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/ThrowsTag.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/ThrowsTag.java deleted file mode 100644 index b92430877dc..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/ThrowsTag.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - -/** - * Represents a @throws or @exception documentation tag. - * Parses and holds the exception name and exception comment. - * Note: @exception is a backwards compatible synonymy for @throws. - * - * @author Robert Field - * @author Atul M Dambalkar - * @see ExecutableMemberDoc#throwsTags() - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface ThrowsTag extends Tag { - - /** - * Return the name of the exception - * associated with this {@code ThrowsTag}. - * - * @return name of the exception. - */ - String exceptionName(); - - /** - * Return the exception comment - * associated with this {@code ThrowsTag}. - * - * @return exception comment. - */ - String exceptionComment(); - - /** - * Return a {@code ClassDoc} that represents the exception. - * If the type of the exception is a type variable, return the - * {@code ClassDoc} of its erasure. - * - *

    This method cannot accommodate certain generic type - * constructs. The {@code exceptionType} method - * should be used instead. - * - * @return {@code ClassDoc} that represents the exception. - * @see #exceptionType - */ - ClassDoc exception(); - - /** - * Return the type of the exception - * associated with this {@code ThrowsTag}. - * This may be a {@code ClassDoc} or a {@code TypeVariable}. - * - * @return the type of the exception. - * @since 1.5 - */ - Type exceptionType(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/Type.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/Type.java deleted file mode 100644 index 48e8e7b2589..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/Type.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 1997, 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. 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 com.sun.javadoc; - -/** - * Represents a type. A type can be a class or interface, an - * invocation (like {@code List}) of a generic class or interface, - * a type variable, a wildcard type ("{@code ?}"), - * or a primitive data type (like {@code char}). - * - * @since 1.2 - * @author Kaiyang Liu (original) - * @author Robert Field (rewrite) - * @author Scott Seligman (generics) - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface Type { - - /** - * Return unqualified name of type excluding any dimension information. - *

    - * For example, a two dimensional array of String returns - * "{@code String}". - * @return unqualified name of type excluding any dimension information. - */ - String typeName(); - - /** - * Return qualified name of type excluding any dimension information. - *

    - * For example, a two dimensional array of String - * returns "{@code java.lang.String}". - * @return qualified name of this type excluding any dimension information. - */ - String qualifiedTypeName(); - - /** - * Return the simple name of this type excluding any dimension information. - * This is the unqualified name of the type, except that for nested types - * only the identifier of the innermost type is included. - *

    - * For example, the class {@code Outer.Inner} returns - * "{@code Inner}". - * - * @since 1.5 - * @return the simple name of this type excluding any dimension information. - */ - String simpleTypeName(); - - /** - * Return the type's dimension information, as a string. - *

    - * For example, a two dimensional array of String returns - * "{@code [][]}". - * @return the type's dimension information as a string. - */ - String dimension(); - - /** - * Return a string representation of the type. - * This includes any dimension information and type arguments. - *

    - * For example, a two dimensional array of String may return - * "{@code java.lang.String[][]}", - * and the parameterized type {@code List} may return - * "{@code java.util.List}". - * - * @return a string representation of the type. - */ - String toString(); - - /** - * Return true if this type represents a primitive type. - * - * @return true if this type represents a primitive type. - * @since 1.5 - */ - boolean isPrimitive(); - - /** - * Return this type as a {@code ClassDoc} if it represents a class - * or interface. Array dimensions are ignored. - * If this type is a {@code ParameterizedType}, - * {@code TypeVariable}, or {@code WildcardType}, return - * the {@code ClassDoc} of the type's erasure. If this is an - * {@code AnnotationTypeDoc}, return this as a {@code ClassDoc} - * (but see {@link #asAnnotationTypeDoc()}). - * If this is a primitive type, return null. - * - * @return the {@code ClassDoc} of this type, - * or null if it is a primitive type. - */ - ClassDoc asClassDoc(); - - /** - * Return this type as a {@code ParameterizedType} if it represents - * an invocation of a generic class or interface. Array dimensions - * are ignored. - * - * @return a {@code ParameterizedType} if the type is an - * invocation of a generic type, or null if it is not. - * @since 1.5 - */ - ParameterizedType asParameterizedType(); - - /** - * Return this type as a {@code TypeVariable} if it represents - * a type variable. Array dimensions are ignored. - * - * @return a {@code TypeVariable} if the type is a type variable, - * or null if it is not. - * @since 1.5 - */ - TypeVariable asTypeVariable(); - - /** - * Return this type as a {@code WildcardType} if it represents - * a wildcard type. - * - * @return a {@code WildcardType} if the type is a wildcard type, - * or null if it is not. - * @since 1.5 - */ - WildcardType asWildcardType(); - - /** - * Returns this type as a {@code AnnotatedType} if it represents - * an annotated type. - * - * @return a {@code AnnotatedType} if the type if an annotated type, - * or null if it is not - * @since 1.8 - */ - AnnotatedType asAnnotatedType(); - - /** - * Return this type as an {@code AnnotationTypeDoc} if it represents - * an annotation type. Array dimensions are ignored. - * - * @return an {@code AnnotationTypeDoc} if the type is an annotation - * type, or null if it is not. - * @since 1.5 - */ - AnnotationTypeDoc asAnnotationTypeDoc(); - - /** - * If this type is an array type, return the element type of the - * array. Otherwise, return null. - * - * @return a {@code Type} representing the element type or null. - * @since 1.8 - */ - Type getElementType(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/TypeVariable.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/TypeVariable.java deleted file mode 100644 index b66023f4568..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/TypeVariable.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - - -/** - * Represents a type variable. - * For example, the generic interface {@code List} has a single - * type variable {@code E}. - * A type variable may have explicit bounds, as in - * {@code C}. - * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface TypeVariable extends Type { - - /** - * Return the bounds of this type variable. - * These are the types given by the extends clause. - * Return an empty array if there are no explicit bounds. - * - * @return the bounds of this type variable. - */ - Type[] bounds(); - - /** - * Return the class, interface, method, or constructor within - * which this type variable is declared. - * - * @return the class, interface, method, or constructor within - * which this type variable is declared. - */ - ProgramElementDoc owner(); - - /** - * Get the annotations of this program element. - * Return an empty array if there are none. - * - * @return the annotations of this program element or - * an empty array if there are none. - */ - public AnnotationDesc[] annotations(); - -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/WildcardType.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/WildcardType.java deleted file mode 100644 index f40a418d77c..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/WildcardType.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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 - * 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 com.sun.javadoc; - - -/** - * Represents a wildcard type argument. - * Examples include:

    - * {@code }
    - * {@code }
    - * {@code }
    - * 
    - * A wildcard type can have explicit extends bounds - * or explicit super bounds or neither, but not both. - * - * @author Scott Seligman - * @since 1.5 - * - * @deprecated - * The declarations in this package have been superseded by those - * in the package {@code jdk.javadoc.doclet}. - * For more information, see the Migration Guide in the documentation for that package. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public interface WildcardType extends Type { - - /** - * Return the upper bounds of this wildcard type argument - * as given by the extends clause. - * Return an empty array if no such bounds are explicitly given. - * - * @return the extends bounds of this wildcard type argument - */ - Type[] extendsBounds(); - - /** - * Return the lower bounds of this wildcard type argument - * as given by the super clause. - * Return an empty array if no such bounds are explicitly given. - * - * @return the super bounds of this wildcard type argument - */ - Type[] superBounds(); -} diff --git a/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java b/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java deleted file mode 100644 index ac2883abe23..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/javadoc/package-info.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 1998, 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. 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. - */ - -/** -

    -Note: The declarations in this package have been superseded by those -in the package {@link jdk.javadoc.doclet}. -For more information, see the Migration Guide in the documentation for that package. -

    - -The Doclet API (also called the Javadoc API) provides a mechanism -for clients to inspect the source-level structure of programs and -libraries, including javadoc comments embedded in the source. -This is useful for documentation, program checking, automatic -code generation and many other tools. -

    - -Doclets are invoked by javadoc and use this API to write out -program information to files. For example, the standard doclet is called -by default and writes out documentation to HTML files. -

    - -The invocation is defined by the abstract {@link com.sun.javadoc.Doclet} class --- the entry point is the {@link com.sun.javadoc.Doclet#start(RootDoc) start} method: -

    -    public static boolean start(RootDoc root)
    -
    -The {@link com.sun.javadoc.RootDoc} instance holds the root of the program structure -information. From this root all other program structure -information can be extracted. -

    - - -

    Terminology

    - - -When calling javadoc, you pass in package names and source file names -- -these are called the specified packages and classes. -You also pass in Javadoc options; the access control Javadoc options -({@code -public}, {@code -protected}, {@code -package}, -and {@code -private}) filter program elements, producing a -result set, called the included set, or "documented" set. -(The unfiltered set is also available through -{@link com.sun.javadoc.PackageDoc#allClasses(boolean) allClasses(false)}.) -

    - - -Throughout this API, the term class is normally a -shorthand for "class or interface", as in: {@link com.sun.javadoc.ClassDoc}, -{@link com.sun.javadoc.PackageDoc#allClasses() allClasses()}, and -{@link com.sun.javadoc.PackageDoc#findClass(String) findClass(String)}. -In only a couple of other places, it means "class, as opposed to interface", -as in: {@link com.sun.javadoc.Doc#isClass()}. -In the second sense, this API calls out four kinds of classes: -{@linkplain com.sun.javadoc.Doc#isOrdinaryClass() ordinary classes}, -{@linkplain com.sun.javadoc.Doc#isEnum() enums}, -{@linkplain com.sun.javadoc.Doc#isError() errors} and -{@linkplain com.sun.javadoc.Doc#isException() exceptions}. -Throughout the API, the detailed description of each program element -describes explicitly which meaning is being used. -

    - - -A qualified class or interface name is one that has its package -name prepended to it, such as {@code java.lang.String}. A non-qualified -name has no package name, such as {@code String}. -

    - - -

    Example

    - -The following is an example doclet that -displays information in the {@code @param} tags of the processed -classes: -
    -import com.sun.javadoc.*;
    -
    -public class ListParams extends Doclet {
    -
    -    public static boolean start(RootDoc root) {
    -        ClassDoc[] classes = root.classes();
    -        for (int i = 0; i < classes.length; ++i) {
    -            ClassDoc cd = classes[i];
    -            printMembers(cd.constructors());
    -            printMembers(cd.methods());
    -        }
    -        return true;
    -    }
    -
    -    static void printMembers(ExecutableMemberDoc[] mems) {
    -        for (int i = 0; i < mems.length; ++i) {
    -            ParamTag[] params = mems[i].paramTags();
    -            System.out.println(mems[i].qualifiedName());
    -            for (int j = 0; j < params.length; ++j) {
    -                System.out.println("   " + params[j].parameterName()
    -                    + " - " + params[j].parameterComment());
    -            }
    -        }
    -    }
    -}
    -
    -Interfaces and methods from the Javadoc API are marked in -red. -{@link com.sun.javadoc.Doclet Doclet} is an abstract class that specifies -the invocation interface for doclets, -{@link com.sun.javadoc.Doclet Doclet} holds class or interface information, -{@link com.sun.javadoc.ExecutableMemberDoc} is a -superinterface of {@link com.sun.javadoc.MethodDoc} and -{@link com.sun.javadoc.ConstructorDoc}, -and {@link com.sun.javadoc.ParamTag} holds information -from "{@code @param}" tags. -

    -This doclet when invoked with a command line like: -

    -    javadoc -doclet ListParams -sourcepath <source-location> java.util
    -
    -producing output like: -
    -    ...
    -    java.util.ArrayList.add
    -       index - index at which the specified element is to be inserted.
    -       element - element to be inserted.
    -    java.util.ArrayList.remove
    -       index - the index of the element to removed.
    -    ...
    -
    -
    -@see com.sun.javadoc.Doclet -@see com.sun.javadoc.RootDoc -*/ -package com.sun.javadoc; diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/Standard.java b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/Standard.java deleted file mode 100644 index e14fadc8f55..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/Standard.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 - * 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 com.sun.tools.doclets.standard; - -import com.sun.javadoc.RootDoc; - -/** - * This is not the doclet you are looking for. - * @deprecated The doclet has been superseded by its replacement, - * {@link jdk.javadoc.doclet.StandardDoclet}. - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") - -public class Standard { - - public static boolean start(RootDoc root) { - root.printNotice("Notice: " + "This is not the Standard Doclet"); - return true; - } - - public static int optionLength(String option) { - return 0; // all options are unsupported - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/package-info.java b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/package-info.java deleted file mode 100644 index 860dd11c2c3..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/standard/package-info.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2003, 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. 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. - */ - -/** -

    -Note: The declarations in this package have been replaced by those -in the new package {@link jdk.javadoc.doclet}. -

    -*/ - -package com.sun.tools.doclets.standard; diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Main.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Main.java deleted file mode 100644 index 2c2da152650..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Main.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * 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 - * 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 com.sun.tools.javadoc; - -import java.io.PrintWriter; - -import com.sun.tools.javadoc.main.Start; - -/** - * Provides external entry points (tool and programmatic) - * for the javadoc program. - * - *

    This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @deprecated - * This class is now deprecated and may be removed in a future release. - * See - * {@code javax.tools.ToolProvider::getSystemDocumentationTool} - * and - * {@code javax.tools.DocumentationTool} - * for replacement functionality. - * - * @since 1.4 - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class Main { - - /** - * Constructor should never be called. - */ - private Main() { - } - - /** - * Command line interface. - * @param args The command line parameters. - */ - public static void main(String... args) { - System.exit(execute(args)); - } - - /** - * Programmatic interface. - * @param args The command line parameters. - * @return The return code. - */ - public static int execute(String... args) { - Start jdoc = new Start(); - return jdoc.begin(args); - } - - /** - * Programmatic interface. - * @param args The command line parameters. - * @param docletParentClassLoader The parent class loader used when - * creating the doclet classloader. If null, the class loader used - * to instantiate doclets will be created without specifying a parent - * class loader. - * @return The return code. - * @since 1.7 - */ - public static int execute(ClassLoader docletParentClassLoader, String... args) { - Start jdoc = new Start(docletParentClassLoader); - return jdoc.begin(args); - } - - /** - * Programmatic interface. - * @param programName Name of the program (for error messages). - * @param args The command line parameters. - * @return The return code. - */ - public static int execute(String programName, String... args) { - Start jdoc = new Start(programName); - return jdoc.begin(args); - } - - /** - * Programmatic interface. - * @param programName Name of the program (for error messages). - * @param args The command line parameters. - * @param docletParentClassLoader The parent class loader used when - * creating the doclet classloader. If null, the class loader used - * to instantiate doclets will be created without specifying a parent - * class loader. - * @return The return code. - * @since 1.7 - */ - public static int execute(String programName, ClassLoader docletParentClassLoader, String... args) { - Start jdoc = new Start(programName, docletParentClassLoader); - return jdoc.begin(args); - } - - /** - * Programmatic interface. - * @param programName Name of the program (for error messages). - * @param defaultDocletClassName Fully qualified class name. - * @param args The command line parameters. - * @return The return code. - */ - public static int execute(String programName, - String defaultDocletClassName, - String... args) { - Start jdoc = new Start(programName, defaultDocletClassName); - return jdoc.begin(args); - } - - /** - * Programmatic interface. - * @param programName Name of the program (for error messages). - * @param defaultDocletClassName Fully qualified class name. - * @param docletParentClassLoader The parent class loader used when - * creating the doclet classloader. If null, the class loader used - * to instantiate doclets will be created without specifying a parent - * class loader. - * @param args The command line parameters. - * @return The return code. - * @since 1.7 - */ - public static int execute(String programName, - String defaultDocletClassName, - ClassLoader docletParentClassLoader, - String... args) { - Start jdoc = new Start(programName, defaultDocletClassName, docletParentClassLoader); - return jdoc.begin(args); - } - - /** - * Programmatic interface. - * @param programName Name of the program (for error messages). - * @param errWriter PrintWriter to receive error messages. - * @param warnWriter PrintWriter to receive error messages. - * @param noticeWriter PrintWriter to receive error messages. - * @param defaultDocletClassName Fully qualified class name. - * @param args The command line parameters. - * @return The return code. - */ - public static int execute(String programName, - PrintWriter errWriter, - PrintWriter warnWriter, - PrintWriter noticeWriter, - String defaultDocletClassName, - String... args) { - Start jdoc = new Start(programName, - errWriter, warnWriter, noticeWriter, - defaultDocletClassName); - return jdoc.begin(args); - } - - /** - * Programmatic interface. - * @param programName Name of the program (for error messages). - * @param errWriter PrintWriter to receive error messages. - * @param warnWriter PrintWriter to receive error messages. - * @param noticeWriter PrintWriter to receive error messages. - * @param defaultDocletClassName Fully qualified class name. - * @param docletParentClassLoader The parent class loader used when - * creating the doclet classloader. If null, the class loader used - * to instantiate doclets will be created without specifying a parent - * class loader. - * @param args The command line parameters. - * @return The return code. - * @since 1.7 - */ - public static int execute(String programName, - PrintWriter errWriter, - PrintWriter warnWriter, - PrintWriter noticeWriter, - String defaultDocletClassName, - ClassLoader docletParentClassLoader, - String... args) { - Start jdoc = new Start(programName, - errWriter, warnWriter, noticeWriter, - defaultDocletClassName, - docletParentClassLoader); - return jdoc.begin(args); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AbstractTypeImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AbstractTypeImpl.java deleted file mode 100644 index f8b4d06be75..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AbstractTypeImpl.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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 - * 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 com.sun.tools.javadoc.main; - -import com.sun.javadoc.*; - -import com.sun.tools.javac.code.Type; - - -/** - * Abstract implementation of Type, with useful - * defaults for the methods in Type (and a couple from - * ProgramElementDoc). - * - *

    This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @author Scott Seligman - * @since 1.5 - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -abstract class AbstractTypeImpl implements com.sun.javadoc.Type { - - protected final DocEnv env; - protected final Type type; - - protected AbstractTypeImpl(DocEnv env, Type type) { - this.env = env; - this.type = type; - } - - public String typeName() { - return type.tsym.name.toString(); - } - - public String qualifiedTypeName() { - return type.tsym.getQualifiedName().toString(); - } - - public com.sun.javadoc.Type getElementType() { - return null; - } - - public String simpleTypeName() { - return type.tsym.name.toString(); - } - - public String name() { - return typeName(); - } - - public String qualifiedName() { - return qualifiedTypeName(); - } - - public String toString() { - return qualifiedTypeName(); - } - - public String dimension() { - return ""; - } - - public boolean isPrimitive() { - return false; - } - - public ClassDoc asClassDoc() { - return null; - } - - public TypeVariable asTypeVariable() { - return null; - } - - public WildcardType asWildcardType() { - return null; - } - - public ParameterizedType asParameterizedType() { - return null; - } - - public AnnotationTypeDoc asAnnotationTypeDoc() { - return null; - } - - public AnnotatedType asAnnotatedType() { - return null; - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotatedTypeImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotatedTypeImpl.java deleted file mode 100644 index 89c496ac022..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotatedTypeImpl.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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 - * 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 com.sun.tools.javadoc.main; - -import com.sun.javadoc.*; -import com.sun.tools.javac.code.Attribute; -import com.sun.tools.javac.code.Attribute.TypeCompound; -import com.sun.tools.javac.util.List; - -/** - * Implementation of AnnotatedType, which - * represents an annotated type. - * - * @author Mahmood Ali - * @since 1.8 - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class AnnotatedTypeImpl - extends AbstractTypeImpl implements AnnotatedType { - - AnnotatedTypeImpl(DocEnv env, com.sun.tools.javac.code.Type type) { - super(env, type); - } - - /** - * Get the annotations of this program element. - * Return an empty array if there are none. - */ - @Override - public AnnotationDesc[] annotations() { - List tas = type.getAnnotationMirrors(); - if (tas == null || - tas.isEmpty()) { - return new AnnotationDesc[0]; - } - AnnotationDesc res[] = new AnnotationDesc[tas.length()]; - int i = 0; - for (Attribute.Compound a : tas) { - res[i++] = new AnnotationDescImpl(env, a); - } - return res; - } - - @Override - public com.sun.javadoc.Type underlyingType() { - return TypeMaker.getType(env, type, true, false); - } - - @Override - public AnnotatedType asAnnotatedType() { - return this; - } - - @Override - public String toString() { - return typeName(); - } - - @Override - public String typeName() { - return this.underlyingType().typeName(); - } - - @Override - public String qualifiedTypeName() { - return this.underlyingType().qualifiedTypeName(); - } - - @Override - public String simpleTypeName() { - return this.underlyingType().simpleTypeName(); - } - - @Override - public String dimension() { - return this.underlyingType().dimension(); - } - - @Override - public boolean isPrimitive() { - return this.underlyingType().isPrimitive(); - } - - @Override - public ClassDoc asClassDoc() { - return this.underlyingType().asClassDoc(); - } - - @Override - public TypeVariable asTypeVariable() { - return this.underlyingType().asTypeVariable(); - } - - @Override - public WildcardType asWildcardType() { - return this.underlyingType().asWildcardType(); - } - - @Override - public ParameterizedType asParameterizedType() { - return this.underlyingType().asParameterizedType(); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationDescImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationDescImpl.java deleted file mode 100644 index 96b7cb5f712..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationDescImpl.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * 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 - * 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 com.sun.tools.javadoc.main; - -import com.sun.javadoc.*; - -import com.sun.tools.javac.code.Attribute; -import com.sun.tools.javac.code.Symbol.*; -import com.sun.tools.javac.util.List; -import com.sun.tools.javac.util.Pair; - - -/** - * Represents an annotation. - * An annotation associates a value with each element of an annotation type. - * Sure it ought to be called "Annotation", but that clashes with - * java.lang.annotation.Annotation. - * - *

    This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @author Scott Seligman - * @since 1.5 - */ - -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class AnnotationDescImpl implements AnnotationDesc { - - private final DocEnv env; - private final Attribute.Compound annotation; - - - AnnotationDescImpl(DocEnv env, Attribute.Compound annotation) { - this.env = env; - this.annotation = annotation; - } - - /** - * Returns the annotation type of this annotation. - */ - public AnnotationTypeDoc annotationType() { - ClassSymbol atsym = (ClassSymbol)annotation.type.tsym; - if (annotation.type.isErroneous()) { - env.warning(null, "javadoc.class_not_found", annotation.type.toString()); - return new AnnotationTypeDocImpl(env, atsym); - } else { - return (AnnotationTypeDoc)env.getClassDoc(atsym); - } - } - - /** - * Returns this annotation's elements and their values. - * Only those explicitly present in the annotation are - * included, not those assuming their default values. - * Returns an empty array if there are none. - */ - public ElementValuePair[] elementValues() { - List> vals = annotation.values; - ElementValuePair res[] = new ElementValuePair[vals.length()]; - int i = 0; - for (Pair val : vals) { - res[i++] = new ElementValuePairImpl(env, val.fst, val.snd); - } - return res; - } - - /** - * Check for the synthesized bit on the annotation. - * - * @return true if the annotation is synthesized. - */ - public boolean isSynthesized() { - return annotation.isSynthesized(); - } - - /** - * Returns a string representation of this annotation. - * String is of one of the forms: - *

    -     *     {@code @com.example.foo(name1=val1, name2=val2)}
    -     *     {@code @com.example.foo(val)}
    -     *     {@code @com.example.foo}
    -     * 
    - * Omit parens for marker annotations, and omit "value=" when allowed. - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder("@"); - sb.append(annotation.type.tsym); - - ElementValuePair vals[] = elementValues(); - if (vals.length > 0) { // omit parens for marker annotation - sb.append('('); - boolean first = true; - for (ElementValuePair val : vals) { - if (!first) { - sb.append(", "); - } - first = false; - - String name = val.element().name(); - if (vals.length == 1 && name.equals("value")) { - sb.append(val.value()); - } else { - sb.append(val); - } - } - sb.append(')'); - } - return sb.toString(); - } - - - /** - * Represents an association between an annotation type element - * and one of its values. - */ - public static class ElementValuePairImpl implements ElementValuePair { - - private final DocEnv env; - private final MethodSymbol meth; - private final Attribute value; - - ElementValuePairImpl(DocEnv env, MethodSymbol meth, Attribute value) { - this.env = env; - this.meth = meth; - this.value = value; - } - - /** - * Returns the annotation type element. - */ - public AnnotationTypeElementDoc element() { - return env.getAnnotationTypeElementDoc(meth); - } - - /** - * Returns the value associated with the annotation type element. - */ - public AnnotationValue value() { - return new AnnotationValueImpl(env, value); - } - - /** - * Returns a string representation of this pair - * of the form "name=value". - */ - @Override - public String toString() { - return meth.name + "=" + value(); - } - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeDocImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeDocImpl.java deleted file mode 100644 index 36b8c3296d6..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeDocImpl.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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 - * 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 com.sun.tools.javadoc.main; - -import com.sun.javadoc.*; - -import com.sun.source.util.TreePath; -import com.sun.tools.javac.code.Symbol; -import com.sun.tools.javac.code.Symbol.*; -import com.sun.tools.javac.util.List; - -import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE; - -import static com.sun.tools.javac.code.Kinds.Kind.*; - -/** - * Represents an annotation type. - * - *

    This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @author Scott Seligman - * @since 1.5 - */ - -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class AnnotationTypeDocImpl - extends ClassDocImpl implements AnnotationTypeDoc { - - public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym) { - this(env, sym, null); - } - - public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym, TreePath treePath) { - super(env, sym, treePath); - } - - /** - * Returns true, as this is an annotation type. - * (For legacy doclets, return false.) - */ - public boolean isAnnotationType() { - return !isInterface(); - } - - /** - * Returns false. Though technically an interface, an annotation - * type is not considered an interface for this purpose. - * (For legacy doclets, returns true.) - */ - public boolean isInterface() { - return env.legacyDoclet; - } - - /** - * Returns an empty array, as all methods are annotation type elements. - * (For legacy doclets, returns the elements.) - * @see #elements() - */ - public MethodDoc[] methods(boolean filter) { - return env.legacyDoclet - ? (MethodDoc[])elements() - : new MethodDoc[0]; - } - - /** - * Returns the elements of this annotation type. - * Returns an empty array if there are none. - * Elements are always public, so no need to filter them. - */ - public AnnotationTypeElementDoc[] elements() { - List elements = List.nil(); - for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) { - if (sym != null && sym.kind == MTH) { - MethodSymbol s = (MethodSymbol)sym; - elements = elements.prepend(env.getAnnotationTypeElementDoc(s)); - } - } - return - elements.toArray(new AnnotationTypeElementDoc[elements.length()]); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeElementDocImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeElementDocImpl.java deleted file mode 100644 index 67e65aa5b67..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationTypeElementDocImpl.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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 - * 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 com.sun.tools.javadoc.main; - -import com.sun.javadoc.*; - -import com.sun.source.util.TreePath; -import com.sun.tools.javac.code.Symbol.*; - -/** - * Represents an element of an annotation type. - * - *

    This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @author Scott Seligman - * @since 1.5 - */ - -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class AnnotationTypeElementDocImpl - extends MethodDocImpl implements AnnotationTypeElementDoc { - - public AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym) { - super(env, sym); - } - - public AnnotationTypeElementDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) { - super(env, sym, treePath); - } - - /** - * Returns true, as this is an annotation type element. - * (For legacy doclets, return false.) - */ - public boolean isAnnotationTypeElement() { - return !isMethod(); - } - - /** - * Returns false. Although this is technically a method, we don't - * consider it one for this purpose. - * (For legacy doclets, return true.) - */ - public boolean isMethod() { - return env.legacyDoclet; - } - - /** - * Returns false, even though this is indeed abstract. See - * MethodDocImpl.isAbstract() for the (il)logic behind this. - */ - public boolean isAbstract() { - return false; - } - - /** - * Returns the default value of this element. - * Returns null if this element has no default. - */ - public AnnotationValue defaultValue() { - return (sym.defaultValue == null) - ? null - : new AnnotationValueImpl(env, sym.defaultValue); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationValueImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationValueImpl.java deleted file mode 100644 index 32f1bfbde5c..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/AnnotationValueImpl.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * 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 - * 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 com.sun.tools.javadoc.main; - -import com.sun.javadoc.*; - -import com.sun.tools.javac.code.Attribute; - -import static com.sun.tools.javac.code.TypeTag.BOOLEAN; - -/** - * Represents a value of an annotation type element. - * - *

    This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @author Scott Seligman - * @since 1.5 - */ - -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class AnnotationValueImpl implements AnnotationValue { - - private final DocEnv env; - private final Attribute attr; - - - AnnotationValueImpl(DocEnv env, Attribute attr) { - this.env = env; - this.attr = attr; - } - - /** - * Returns the value. - * The type of the returned object is one of the following: - *

    • a wrapper class for a primitive type - *
    • String - *
    • Type (representing a class literal) - *
    • FieldDoc (representing an enum constant) - *
    • AnnotationDesc - *
    • AnnotationValue[] - *
    - */ - public Object value() { - ValueVisitor vv = new ValueVisitor(); - attr.accept(vv); - return vv.value; - } - - private class ValueVisitor implements Attribute.Visitor { - public Object value; - - public void visitConstant(Attribute.Constant c) { - if (c.type.hasTag(BOOLEAN)) { - // javac represents false and true as integers 0 and 1 - value = Boolean.valueOf( - ((Integer)c.value).intValue() != 0); - } else { - value = c.value; - } - } - - public void visitClass(Attribute.Class c) { - value = TypeMaker.getType(env, - env.types.erasure(c.classType)); - } - - public void visitEnum(Attribute.Enum e) { - value = env.getFieldDoc(e.value); - } - - public void visitCompound(Attribute.Compound c) { - value = new AnnotationDescImpl(env, c); - } - - public void visitArray(Attribute.Array a) { - AnnotationValue vals[] = new AnnotationValue[a.values.length]; - for (int i = 0; i < vals.length; i++) { - vals[i] = new AnnotationValueImpl(env, a.values[i]); - } - value = vals; - } - - public void visitError(Attribute.Error e) { - value = ""; - } - } - - /** - * Returns a string representation of the value. - * - * @return the text of a Java language annotation value expression - * whose value is the value of this annotation type element. - */ - @Override - public String toString() { - ToStringVisitor tv = new ToStringVisitor(); - attr.accept(tv); - return tv.toString(); - } - - private class ToStringVisitor implements Attribute.Visitor { - private final StringBuilder sb = new StringBuilder(); - - @Override - public String toString() { - return sb.toString(); - } - - public void visitConstant(Attribute.Constant c) { - if (c.type.hasTag(BOOLEAN)) { - // javac represents false and true as integers 0 and 1 - sb.append(((Integer)c.value).intValue() != 0); - } else { - sb.append(FieldDocImpl.constantValueExpression(c.value)); - } - } - - public void visitClass(Attribute.Class c) { - sb.append(c); - } - - public void visitEnum(Attribute.Enum e) { - sb.append(e); - } - - public void visitCompound(Attribute.Compound c) { - sb.append(new AnnotationDescImpl(env, c)); - } - - public void visitArray(Attribute.Array a) { - // Omit braces from singleton. - if (a.values.length != 1) sb.append('{'); - - boolean first = true; - for (Attribute elem : a.values) { - if (first) { - first = false; - } else { - sb.append(", "); - } - elem.accept(this); - } - // Omit braces from singleton. - if (a.values.length != 1) sb.append('}'); - } - - public void visitError(Attribute.Error e) { - sb.append(""); - } - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java deleted file mode 100644 index 6a9cc6ea1e9..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java +++ /dev/null @@ -1,1331 +0,0 @@ -/* - * Copyright (c) 1997, 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. 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 com.sun.tools.javadoc.main; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Modifier; -import java.net.URI; -import java.util.HashSet; -import java.util.Set; - -import javax.tools.FileObject; -import javax.tools.JavaFileManager.Location; -import javax.tools.StandardJavaFileManager; -import javax.tools.StandardLocation; - -import com.sun.javadoc.*; -import com.sun.source.util.TreePath; -import com.sun.tools.javac.code.Flags; -import com.sun.tools.javac.code.Kinds; -import com.sun.tools.javac.code.Kinds.KindSelector; -import com.sun.tools.javac.code.Scope; -import com.sun.tools.javac.code.Symbol; -import com.sun.tools.javac.code.Symbol.*; -import com.sun.tools.javac.code.Type; -import com.sun.tools.javac.code.Type.ClassType; -import com.sun.tools.javac.code.TypeTag; -import com.sun.tools.javac.comp.AttrContext; -import com.sun.tools.javac.comp.Env; -import com.sun.tools.javac.tree.JCTree; -import com.sun.tools.javac.tree.JCTree.JCFieldAccess; -import com.sun.tools.javac.tree.JCTree.JCImport; -import com.sun.tools.javac.tree.TreeInfo; -import com.sun.tools.javac.util.List; -import com.sun.tools.javac.util.ListBuffer; -import com.sun.tools.javac.util.Name; -import com.sun.tools.javac.util.Names; -import com.sun.tools.javac.util.Position; -import static com.sun.tools.javac.code.Kinds.Kind.*; -import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE; -import static com.sun.tools.javac.code.TypeTag.CLASS; -import static com.sun.tools.javac.tree.JCTree.Tag.*; - -/** - * Represents a java class and provides access to information - * about the class, the class' comment and tags, and the - * members of the class. A ClassDocImpl only exists if it was - * processed in this run of javadoc. References to classes - * which may or may not have been processed in this run are - * referred to using Type (which can be converted to ClassDocImpl, - * if possible). - * - *

    This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @see Type - * - * @since 1.2 - * @author Robert Field - * @author Neal Gafter (rewrite) - * @author Scott Seligman (generics, enums, annotations) - */ - -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc { - - public final ClassType type; // protected->public for debugging - public final ClassSymbol tsym; - - boolean isIncluded = false; // Set in RootDocImpl - - private SerializedForm serializedForm; - - /** - * Constructor - */ - public ClassDocImpl(DocEnv env, ClassSymbol sym) { - this(env, sym, null); - } - - /** - * Constructor - */ - public ClassDocImpl(DocEnv env, ClassSymbol sym, TreePath treePath) { - super(env, sym, treePath); - this.type = (ClassType)sym.type; - this.tsym = sym; - } - - public com.sun.javadoc.Type getElementType() { - return null; - } - - /** - * Returns the flags in terms of javac's flags - */ - protected long getFlags() { - return getFlags(tsym); - } - - /** - * Returns the flags of a ClassSymbol in terms of javac's flags - */ - static long getFlags(ClassSymbol clazz) { - try { - return clazz.flags(); - } catch (CompletionFailure ex) { - /* Quietly ignore completion failures and try again - the type - * for which the CompletionFailure was thrown shouldn't be completed - * again by the completer that threw the CompletionFailure. - */ - return getFlags(clazz); - } - } - - /** - * Is a ClassSymbol an annotation type? - */ - static boolean isAnnotationType(ClassSymbol clazz) { - return (getFlags(clazz) & Flags.ANNOTATION) != 0; - } - - /** - * Identify the containing class - */ - protected ClassSymbol getContainingClass() { - return tsym.owner.enclClass(); - } - - /** - * Return true if this is a class, not an interface. - */ - @Override - public boolean isClass() { - return !Modifier.isInterface(getModifiers()); - } - - /** - * Return true if this is a ordinary class, - * not an enumeration, exception, an error, or an interface. - */ - @Override - public boolean isOrdinaryClass() { - if (isEnum() || isInterface() || isAnnotationType()) { - return false; - } - for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) { - if (t.tsym == env.syms.errorType.tsym || - t.tsym == env.syms.exceptionType.tsym) { - return false; - } - } - return true; - } - - /** - * Return true if this is an enumeration. - * (For legacy doclets, return false.) - */ - @Override - public boolean isEnum() { - return (getFlags() & Flags.ENUM) != 0 - && - !env.legacyDoclet; - } - - /** - * Return true if this is an interface, but not an annotation type. - * Overridden by AnnotationTypeDocImpl. - */ - @Override - public boolean isInterface() { - return Modifier.isInterface(getModifiers()); - } - - /** - * Return true if this is an exception class - */ - @Override - public boolean isException() { - if (isEnum() || isInterface() || isAnnotationType()) { - return false; - } - for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) { - if (t.tsym == env.syms.exceptionType.tsym) { - return true; - } - } - return false; - } - - /** - * Return true if this is an error class - */ - @Override - public boolean isError() { - if (isEnum() || isInterface() || isAnnotationType()) { - return false; - } - for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) { - if (t.tsym == env.syms.errorType.tsym) { - return true; - } - } - return false; - } - - /** - * Return true if this is a throwable class - */ - public boolean isThrowable() { - if (isEnum() || isInterface() || isAnnotationType()) { - return false; - } - for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) { - if (t.tsym == env.syms.throwableType.tsym) { - return true; - } - } - return false; - } - - /** - * Return true if this class is abstract - */ - public boolean isAbstract() { - return Modifier.isAbstract(getModifiers()); - } - - /** - * Returns true if this class was synthesized by the compiler. - */ - public boolean isSynthetic() { - return (getFlags() & Flags.SYNTHETIC) != 0; - } - - /** - * Return true if this class is included in the active set. - * A ClassDoc is included iff either it is specified on the - * commandline, or if it's containing package is specified - * on the command line, or if it is a member class of an - * included class. - */ - - public boolean isIncluded() { - if (isIncluded) { - return true; - } - if (env.shouldDocument(tsym)) { - // Class is nameable from top-level and - // the class and all enclosing classes - // pass the modifier filter. - if (containingPackage().isIncluded()) { - return isIncluded=true; - } - ClassDoc outer = containingClass(); - if (outer != null && outer.isIncluded()) { - return isIncluded=true; - } - } - return false; - } - - /** - * Return the package that this class is contained in. - */ - @Override - public PackageDoc containingPackage() { - PackageDocImpl p = env.getPackageDoc(tsym.packge()); - if (p.setDocPath == false) { - FileObject docPath; - try { - Location location = env.fileManager.hasLocation(StandardLocation.SOURCE_PATH) - ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH; - - docPath = env.fileManager.getFileForInput( - location, p.qualifiedName(), "package.html"); - } catch (IOException e) { - docPath = null; - } - - if (docPath == null) { - // fall back on older semantics of looking in same directory as - // source file for this class - SourcePosition po = position(); - if (env.fileManager instanceof StandardJavaFileManager && - po instanceof SourcePositionImpl) { - URI uri = ((SourcePositionImpl) po).filename.toUri(); - if ("file".equals(uri.getScheme())) { - File f = new File(uri); - File dir = f.getParentFile(); - if (dir != null) { - File pf = new File(dir, "package.html"); - if (pf.exists()) { - StandardJavaFileManager sfm = (StandardJavaFileManager) env.fileManager; - docPath = sfm.getJavaFileObjects(pf).iterator().next(); - } - } - - } - } - } - - p.setDocPath(docPath); - } - return p; - } - - /** - * Return the class name without package qualifier - but with - * enclosing class qualifier - as a String. - *

    -     * Examples:
    -     *  for java.util.Hashtable
    -     *  return Hashtable
    -     *  for java.util.Map.Entry
    -     *  return Map.Entry
    -     * 
    - */ - public String name() { - if (name == null) { - name = getClassName(tsym, false); - } - return name; - } - - private String name; - - /** - * Return the qualified class name as a String. - *
    -     * Example:
    -     *  for java.util.Hashtable
    -     *  return java.util.Hashtable
    -     *  if no qualifier, just return flat name
    -     * 
    - */ - public String qualifiedName() { - if (qualifiedName == null) { - qualifiedName = getClassName(tsym, true); - } - return qualifiedName; - } - - private String qualifiedName; - - /** - * Return unqualified name of type excluding any dimension information. - *

    - * For example, a two dimensional array of String returns 'String'. - */ - public String typeName() { - return name(); - } - - /** - * Return qualified name of type excluding any dimension information. - *

    - * For example, a two dimensional array of String - * returns 'java.lang.String'. - */ - public String qualifiedTypeName() { - return qualifiedName(); - } - - /** - * Return the simple name of this type. - */ - public String simpleTypeName() { - if (simpleTypeName == null) { - simpleTypeName = tsym.name.toString(); - } - return simpleTypeName; - } - - private String simpleTypeName; - - /** - * Return the qualified name and any type parameters. - * Each parameter is a type variable with optional bounds. - */ - @Override - public String toString() { - return classToString(env, tsym, true); - } - - /** - * Return the class name as a string. If "full" is true the name is - * qualified, otherwise it is qualified by its enclosing class(es) only. - */ - static String getClassName(ClassSymbol c, boolean full) { - if (full) { - return c.getQualifiedName().toString(); - } else { - String n = ""; - for ( ; c != null; c = c.owner.enclClass()) { - n = c.name + (n.isEmpty() ? "" : ".") + n; - } - return n; - } - } - - /** - * Return the class name with any type parameters as a string. - * Each parameter is a type variable with optional bounds. - * If "full" is true all names are qualified, otherwise they are - * qualified by their enclosing class(es) only. - */ - static String classToString(DocEnv env, ClassSymbol c, boolean full) { - StringBuilder s = new StringBuilder(); - if (!c.isInner()) { // if c is not an inner class - s.append(getClassName(c, full)); - } else { - // c is an inner class, so include type params of outer. - ClassSymbol encl = c.owner.enclClass(); - s.append(classToString(env, encl, full)) - .append('.') - .append(c.name); - } - s.append(TypeMaker.typeParametersString(env, c, full)); - return s.toString(); - } - - /** - * Is this class (or any enclosing class) generic? That is, does - * it have type parameters? - */ - static boolean isGeneric(ClassSymbol c) { - return c.type.allparams().nonEmpty(); - } - - /** - * Return the formal type parameters of this class or interface. - * Return an empty array if there are none. - */ - public TypeVariable[] typeParameters() { - if (env.legacyDoclet) { - return new TypeVariable[0]; - } - TypeVariable res[] = new TypeVariable[type.getTypeArguments().length()]; - TypeMaker.getTypes(env, type.getTypeArguments(), res); - return res; - } - - /** - * Return the type parameter tags of this class or interface. - */ - public ParamTag[] typeParamTags() { - return (env.legacyDoclet) - ? new ParamTag[0] - : comment().typeParamTags(); - } - - /** - * Return the modifier string for this class. If it's an interface - * exclude 'abstract' keyword from the modifier string - */ - @Override - public String modifiers() { - return Modifier.toString(modifierSpecifier()); - } - - @Override - public int modifierSpecifier() { - int modifiers = getModifiers(); - return (isInterface() || isAnnotationType()) - ? modifiers & ~Modifier.ABSTRACT - : modifiers; - } - - /** - * Return the superclass of this class - * - * @return the ClassDocImpl for the superclass of this class, null - * if there is no superclass. - */ - public ClassDoc superclass() { - if (isInterface() || isAnnotationType()) return null; - if (tsym == env.syms.objectType.tsym) return null; - ClassSymbol c = (ClassSymbol)env.types.supertype(type).tsym; - if (c == null || c == tsym) c = (ClassSymbol)env.syms.objectType.tsym; - return env.getClassDoc(c); - } - - /** - * Return the superclass of this class. Return null if this is an - * interface. A superclass is represented by either a - * ClassDoc or a ParameterizedType. - */ - public com.sun.javadoc.Type superclassType() { - if (isInterface() || isAnnotationType() || - (tsym == env.syms.objectType.tsym)) - return null; - Type sup = env.types.supertype(type); - return TypeMaker.getType(env, - (sup.hasTag(TypeTag.NONE)) ? env.syms.objectType : sup); - } - - /** - * Test whether this class is a subclass of the specified class. - * - * @param cd the candidate superclass. - * @return true if cd is a superclass of this class. - */ - public boolean subclassOf(ClassDoc cd) { - return tsym.isSubClass(((ClassDocImpl)cd).tsym, env.types); - } - - /** - * Return interfaces implemented by this class or interfaces - * extended by this interface. - * - * @return An array of ClassDocImpl representing the interfaces. - * Return an empty array if there are no interfaces. - */ - public ClassDoc[] interfaces() { - ListBuffer ta = new ListBuffer<>(); - for (Type t : env.types.interfaces(type)) { - ta.append(env.getClassDoc((ClassSymbol)t.tsym)); - } - //### Cache ta here? - return ta.toArray(new ClassDocImpl[ta.length()]); - } - - /** - * Return interfaces implemented by this class or interfaces extended - * by this interface. Includes only directly-declared interfaces, not - * inherited interfaces. - * Return an empty array if there are no interfaces. - */ - public com.sun.javadoc.Type[] interfaceTypes() { - //### Cache result here? - return TypeMaker.getTypes(env, env.types.interfaces(type)); - } - - /** - * Return fields in class. - * @param filter include only the included fields if filter==true - */ - public FieldDoc[] fields(boolean filter) { - return fields(filter, false); - } - - /** - * Return included fields in class. - */ - public FieldDoc[] fields() { - return fields(true, false); - } - - /** - * Return the enum constants if this is an enum type. - */ - public FieldDoc[] enumConstants() { - return fields(false, true); - } - - /** - * Return fields in class. - * @param filter if true, return only the included fields - * @param enumConstants if true, return the enum constants instead - */ - private FieldDoc[] fields(boolean filter, boolean enumConstants) { - List fields = List.nil(); - for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) { - if (sym != null && sym.kind == VAR) { - VarSymbol s = (VarSymbol)sym; - boolean isEnum = ((s.flags() & Flags.ENUM) != 0) && - !env.legacyDoclet; - if (isEnum == enumConstants && - (!filter || env.shouldDocument(s))) { - fields = fields.prepend(env.getFieldDoc(s)); - } - } - } - return fields.toArray(new FieldDocImpl[fields.length()]); - } - - /** - * Return methods in class. - * This method is overridden by AnnotationTypeDocImpl. - * - * @param filter include only the included methods if filter==true - * @return an array of MethodDocImpl for representing the visible - * methods in this class. Does not include constructors. - */ - public MethodDoc[] methods(boolean filter) { - Names names = tsym.name.table.names; - List methods = List.nil(); - for (Symbol sym :tsym.members().getSymbols(NON_RECURSIVE)) { - if (sym != null - && sym.kind == MTH - && sym.name != names.init - && sym.name != names.clinit) { - MethodSymbol s = (MethodSymbol)sym; - if (!filter || env.shouldDocument(s)) { - methods = methods.prepend(env.getMethodDoc(s)); - } - } - } - //### Cache methods here? - return methods.toArray(new MethodDocImpl[methods.length()]); - } - - /** - * Return included methods in class. - * - * @return an array of MethodDocImpl for representing the visible - * methods in this class. Does not include constructors. - */ - public MethodDoc[] methods() { - return methods(true); - } - - /** - * Return constructors in class. - * - * @param filter include only the included constructors if filter==true - * @return an array of ConstructorDocImpl for representing the visible - * constructors in this class. - */ - public ConstructorDoc[] constructors(boolean filter) { - Names names = tsym.name.table.names; - List constructors = List.nil(); - for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) { - if (sym != null && - sym.kind == MTH && sym.name == names.init) { - MethodSymbol s = (MethodSymbol)sym; - if (!filter || env.shouldDocument(s)) { - constructors = constructors.prepend(env.getConstructorDoc(s)); - } - } - } - //### Cache constructors here? - return constructors.toArray(new ConstructorDocImpl[constructors.length()]); - } - - /** - * Return included constructors in class. - * - * @return an array of ConstructorDocImpl for representing the visible - * constructors in this class. - */ - public ConstructorDoc[] constructors() { - return constructors(true); - } - - /** - * Adds all inner classes of this class, and their - * inner classes recursively, to the list l. - */ - void addAllClasses(ListBuffer l, boolean filtered) { - try { - if (isSynthetic()) return; - // sometimes synthetic classes are not marked synthetic - if (!JavadocTool.isValidClassName(tsym.name.toString())) return; - if (filtered && !env.shouldDocument(tsym)) return; - if (l.contains(this)) return; - l.append(this); - List more = List.nil(); - for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) { - if (sym != null && sym.kind == TYP) { - ClassSymbol s = (ClassSymbol)sym; - ClassDocImpl c = env.getClassDoc(s); - if (c.isSynthetic()) continue; - if (c != null) more = more.prepend(c); - } - } - // this extra step preserves the ordering from oldjavadoc - for (; more.nonEmpty(); more=more.tail) { - more.head.addAllClasses(l, filtered); - } - } catch (CompletionFailure e) { - // quietly ignore completion failures - } - } - - /** - * Return inner classes within this class. - * - * @param filter include only the included inner classes if filter==true. - * @return an array of ClassDocImpl for representing the visible - * classes defined in this class. Anonymous and local classes - * are not included. - */ - public ClassDoc[] innerClasses(boolean filter) { - ListBuffer innerClasses = new ListBuffer<>(); - for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) { - if (sym != null && sym.kind == TYP) { - ClassSymbol s = (ClassSymbol)sym; - if ((s.flags_field & Flags.SYNTHETIC) != 0) continue; - if (!filter || env.isVisible(s)) { - innerClasses.prepend(env.getClassDoc(s)); - } - } - } - //### Cache classes here? - return innerClasses.toArray(new ClassDocImpl[innerClasses.length()]); - } - - /** - * Return included inner classes within this class. - * - * @return an array of ClassDocImpl for representing the visible - * classes defined in this class. Anonymous and local classes - * are not included. - */ - public ClassDoc[] innerClasses() { - return innerClasses(true); - } - - /** - * Find a class within the context of this class. - * Search order: qualified name, in this class (inner), - * in this package, in the class imports, in the package - * imports. - * Return the ClassDocImpl if found, null if not found. - */ - //### The specified search order is not the normal rule the - //### compiler would use. Leave as specified or change it? - public ClassDoc findClass(String className) { - ClassDoc searchResult = searchClass(className); - if (searchResult == null) { - ClassDocImpl enclosingClass = (ClassDocImpl)containingClass(); - //Expand search space to include enclosing class. - while (enclosingClass != null && enclosingClass.containingClass() != null) { - enclosingClass = (ClassDocImpl)enclosingClass.containingClass(); - } - searchResult = enclosingClass == null ? - null : enclosingClass.searchClass(className); - } - return searchResult; - } - - private ClassDoc searchClass(String className) { - Names names = tsym.name.table.names; - - // search by qualified name first - ClassDoc cd = env.lookupClass(className); - if (cd != null) { - return cd; - } - - // search inner classes - //### Add private entry point to avoid creating array? - //### Replicate code in innerClasses here to avoid consing? - for (ClassDoc icd : innerClasses()) { - if (icd.name().equals(className) || - //### This is from original javadoc but it looks suspicious to me... - //### I believe it is attempting to compensate for the confused - //### convention of including the nested class qualifiers in the - //### 'name' of the inner class, rather than the true simple name. - icd.name().endsWith("." + className)) { - return icd; - } else { - ClassDoc innercd = ((ClassDocImpl) icd).searchClass(className); - if (innercd != null) { - return innercd; - } - } - } - - // check in this package - cd = containingPackage().findClass(className); - if (cd != null) { - return cd; - } - - // make sure that this symbol has been completed - tsym.complete(); - - // search imports - - if (tsym.sourcefile != null) { - - //### This information is available only for source classes. - - Env compenv = env.enter.getEnv(tsym); - if (compenv == null) return null; - - Scope s = compenv.toplevel.namedImportScope; - for (Symbol sym : s.getSymbolsByName(names.fromString(className))) { - if (sym.kind == TYP) { - ClassDoc c = env.getClassDoc((ClassSymbol)sym); - return c; - } - } - - s = compenv.toplevel.starImportScope; - for (Symbol sym : s.getSymbolsByName(names.fromString(className))) { - if (sym.kind == TYP) { - ClassDoc c = env.getClassDoc((ClassSymbol)sym); - return c; - } - } - } - - return null; // not found - } - - - private boolean hasParameterTypes(MethodSymbol method, String[] argTypes) { - - if (argTypes == null) { - // wildcard - return true; - } - - int i = 0; - List types = method.type.getParameterTypes(); - - if (argTypes.length != types.length()) { - return false; - } - - for (Type t : types) { - String argType = argTypes[i++]; - // For vararg method, "T..." matches type T[]. - if (i == argTypes.length) { - argType = argType.replace("...", "[]"); - } - if (!hasTypeName(env.types.erasure(t), argType)) { //###(gj) - return false; - } - } - return true; - } - // where - private boolean hasTypeName(Type t, String name) { - return - name.equals(TypeMaker.getTypeName(t, true)) - || - name.equals(TypeMaker.getTypeName(t, false)) - || - (qualifiedName() + "." + name).equals(TypeMaker.getTypeName(t, true)); - } - - - - /** - * Find a method in this class scope. - * Search order: this class, interfaces, superclasses, outerclasses. - * Note that this is not necessarily what the compiler would do! - * - * @param methodName the unqualified name to search for. - * @param paramTypes the array of Strings for method parameter types. - * @return the first MethodDocImpl which matches, null if not found. - */ - public MethodDocImpl findMethod(String methodName, String[] paramTypes) { - // Use hash table 'searched' to avoid searching same class twice. - //### It is not clear how this could happen. - return searchMethod(methodName, paramTypes, new HashSet()); - } - - private MethodDocImpl searchMethod(String methodName, - String[] paramTypes, Set searched) { - //### Note that this search is not necessarily what the compiler would do! - - Names names = tsym.name.table.names; - // do not match constructors - if (names.init.contentEquals(methodName)) { - return null; - } - - ClassDocImpl cdi; - MethodDocImpl mdi; - - if (searched.contains(this)) { - return null; - } - searched.add(this); - - //DEBUG - /*---------------------------------* - System.out.print("searching " + this + " for " + methodName); - if (paramTypes == null) { - System.out.println("()"); - } else { - System.out.print("("); - for (int k=0; k < paramTypes.length; k++) { - System.out.print(paramTypes[k]); - if ((k + 1) < paramTypes.length) { - System.out.print(", "); - } - } - System.out.println(")"); - } - *---------------------------------*/ - - // search current class - - //### Using modifier filter here isn't really correct, - //### but emulates the old behavior. Instead, we should - //### apply the normal rules of visibility and inheritance. - - if (paramTypes == null) { - // If no parameters specified, we are allowed to return - // any method with a matching name. In practice, the old - // code returned the first method, which is now the last! - // In order to provide textually identical results, we - // attempt to emulate the old behavior. - MethodSymbol lastFound = null; - for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(methodName))) { - if (sym.kind == MTH) { - //### Should intern methodName as Name. - if (sym.name.toString().equals(methodName)) { - lastFound = (MethodSymbol)sym; - } - } - } - if (lastFound != null) { - return env.getMethodDoc(lastFound); - } - } else { - for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(methodName))) { - if (sym != null && - sym.kind == MTH) { - //### Should intern methodName as Name. - if (hasParameterTypes((MethodSymbol)sym, paramTypes)) { - return env.getMethodDoc((MethodSymbol)sym); - } - } - } - } - - //### If we found a MethodDoc above, but which did not pass - //### the modifier filter, we should return failure here! - - // search superclass - cdi = (ClassDocImpl)superclass(); - if (cdi != null) { - mdi = cdi.searchMethod(methodName, paramTypes, searched); - if (mdi != null) { - return mdi; - } - } - - // search interfaces - for (ClassDoc intf : interfaces()) { - cdi = (ClassDocImpl) intf; - mdi = cdi.searchMethod(methodName, paramTypes, searched); - if (mdi != null) { - return mdi; - } - } - - // search enclosing class - cdi = (ClassDocImpl)containingClass(); - if (cdi != null) { - mdi = cdi.searchMethod(methodName, paramTypes, searched); - if (mdi != null) { - return mdi; - } - } - - //###(gj) As a temporary measure until type variables are better - //### handled, try again without the parameter types. - //### This should most often find the right method, and occassionally - //### find the wrong one. - //if (paramTypes != null) { - // return findMethod(methodName, null); - //} - - return null; - } - - /** - * Find constructor in this class. - * - * @param constrName the unqualified name to search for. - * @param paramTypes the array of Strings for constructor parameters. - * @return the first ConstructorDocImpl which matches, null if not found. - */ - public ConstructorDoc findConstructor(String constrName, - String[] paramTypes) { - Names names = tsym.name.table.names; - for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(""))) { - if (sym.kind == MTH) { - if (hasParameterTypes((MethodSymbol)sym, paramTypes)) { - return env.getConstructorDoc((MethodSymbol)sym); - } - } - } - - //###(gj) As a temporary measure until type variables are better - //### handled, try again without the parameter types. - //### This will often find the right constructor, and occassionally - //### find the wrong one. - //if (paramTypes != null) { - // return findConstructor(constrName, null); - //} - - return null; - } - - /** - * Find a field in this class scope. - * Search order: this class, outerclasses, interfaces, - * superclasses. IMP: If see tag is defined in an inner class, - * which extends a super class and if outerclass and the super - * class have a visible field in common then Java compiler cribs - * about the ambiguity, but the following code will search in the - * above given search order. - * - * @param fieldName the unqualified name to search for. - * @return the first FieldDocImpl which matches, null if not found. - */ - public FieldDoc findField(String fieldName) { - return searchField(fieldName, new HashSet()); - } - - private FieldDocImpl searchField(String fieldName, Set searched) { - Names names = tsym.name.table.names; - if (searched.contains(this)) { - return null; - } - searched.add(this); - - for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(fieldName))) { - if (sym.kind == VAR) { - //### Should intern fieldName as Name. - return env.getFieldDoc((VarSymbol)sym); - } - } - - //### If we found a FieldDoc above, but which did not pass - //### the modifier filter, we should return failure here! - - ClassDocImpl cdi = (ClassDocImpl)containingClass(); - if (cdi != null) { - FieldDocImpl fdi = cdi.searchField(fieldName, searched); - if (fdi != null) { - return fdi; - } - } - - // search superclass - cdi = (ClassDocImpl)superclass(); - if (cdi != null) { - FieldDocImpl fdi = cdi.searchField(fieldName, searched); - if (fdi != null) { - return fdi; - } - } - - // search interfaces - for (ClassDoc intf : interfaces()) { - cdi = (ClassDocImpl) intf; - FieldDocImpl fdi = cdi.searchField(fieldName, searched); - if (fdi != null) { - return fdi; - } - } - - return null; - } - - /** - * Get the list of classes declared as imported. - * These are called "single-type-import declarations" in the JLS. - * This method is deprecated in the ClassDoc interface. - * - * @return an array of ClassDocImpl representing the imported classes. - * - * @deprecated Import declarations are implementation details that - * should not be exposed here. In addition, not all imported - * classes are imported through single-type-import declarations. - */ - @Deprecated(since="9", forRemoval=true) - public ClassDoc[] importedClasses() { - // information is not available for binary classfiles - if (tsym.sourcefile == null) return new ClassDoc[0]; - - ListBuffer importedClasses = new ListBuffer<>(); - - Env compenv = env.enter.getEnv(tsym); - if (compenv == null) return new ClassDocImpl[0]; - - Name asterisk = tsym.name.table.names.asterisk; - for (JCTree t : compenv.toplevel.defs) { - if (t.hasTag(IMPORT)) { - JCTree imp = ((JCImport) t).qualid; - if ((TreeInfo.name(imp) != asterisk) && - imp.type.tsym.kind.matches(KindSelector.TYP)) { - importedClasses.append( - env.getClassDoc((ClassSymbol)imp.type.tsym)); - } - } - } - - return importedClasses.toArray(new ClassDocImpl[importedClasses.length()]); - } - - /** - * Get the list of packages declared as imported. - * These are called "type-import-on-demand declarations" in the JLS. - * This method is deprecated in the ClassDoc interface. - * - * @return an array of PackageDocImpl representing the imported packages. - * - * ###NOTE: the syntax supports importing all inner classes from a class as well. - * @deprecated Import declarations are implementation details that - * should not be exposed here. In addition, this method's - * return type does not allow for all type-import-on-demand - * declarations to be returned. - */ - @Deprecated(since="9", forRemoval=true) - public PackageDoc[] importedPackages() { - // information is not available for binary classfiles - if (tsym.sourcefile == null) return new PackageDoc[0]; - - ListBuffer importedPackages = new ListBuffer<>(); - - //### Add the implicit "import java.lang.*" to the result - Names names = tsym.name.table.names; - importedPackages.append(env.getPackageDoc(env.syms.enterPackage(env.syms.java_base, names.java_lang))); - - Env compenv = env.enter.getEnv(tsym); - if (compenv == null) return new PackageDocImpl[0]; - - for (JCTree t : compenv.toplevel.defs) { - if (t.hasTag(IMPORT)) { - JCTree imp = ((JCImport) t).qualid; - if (TreeInfo.name(imp) == names.asterisk) { - JCFieldAccess sel = (JCFieldAccess)imp; - Symbol s = sel.selected.type.tsym; - PackageDocImpl pdoc = env.getPackageDoc(s.packge()); - if (!importedPackages.contains(pdoc)) - importedPackages.append(pdoc); - } - } - } - - return importedPackages.toArray(new PackageDocImpl[importedPackages.length()]); - } - - /** - * Return the type's dimension information. - * Always return "", as this is not an array type. - */ - public String dimension() { - return ""; - } - - /** - * Return this type as a class, which it already is. - */ - public ClassDoc asClassDoc() { - return this; - } - - /** - * Return null (unless overridden), as this is not an annotation type. - */ - public AnnotationTypeDoc asAnnotationTypeDoc() { - return null; - } - - /** - * Return null, as this is not a class instantiation. - */ - public ParameterizedType asParameterizedType() { - return null; - } - - /** - * Return null, as this is not a type variable. - */ - public TypeVariable asTypeVariable() { - return null; - } - - /** - * Return null, as this is not a wildcard type. - */ - public WildcardType asWildcardType() { - return null; - } - - /** - * Returns null, as this is not an annotated type. - */ - public AnnotatedType asAnnotatedType() { - return null; - } - - /** - * Return false, as this is not a primitive type. - */ - public boolean isPrimitive() { - return false; - } - - //--- Serialization --- - - //### These methods ignore modifier filter. - - /** - * Return true if this class implements java.io.Serializable. - * - * Since java.io.Externalizable extends - * java.io.Serializable, - * Externalizable objects are also Serializable. - */ - public boolean isSerializable() { - try { - return env.types.isSubtype(type, env.syms.serializableType); - } catch (CompletionFailure ex) { - // quietly ignore completion failures - return false; - } - } - - /** - * Return true if this class implements - * java.io.Externalizable. - */ - public boolean isExternalizable() { - try { - return env.types.isSubtype(type, env.externalizableSym.type); - } catch (CompletionFailure ex) { - // quietly ignore completion failures - return false; - } - } - - /** - * Return the serialization methods for this class. - * - * @return an array of MethodDocImpl that represents - * the serialization methods for this class. - */ - public MethodDoc[] serializationMethods() { - if (serializedForm == null) { - serializedForm = new SerializedForm(env, tsym, this); - } - //### Clone this? - return serializedForm.methods(); - } - - /** - * Return the Serializable fields of class.

    - * - * Return either a list of default fields documented by - * serial tag
    - * or return a single FieldDoc for - * serialPersistentField member. - * There should be a serialField tag for - * each Serializable field defined by an ObjectStreamField - * array component of serialPersistentField. - * - * @return an array of {@code FieldDoc} for the Serializable fields - * of this class. - * - * @see #definesSerializableFields() - * @see SerialFieldTagImpl - */ - public FieldDoc[] serializableFields() { - if (serializedForm == null) { - serializedForm = new SerializedForm(env, tsym, this); - } - //### Clone this? - return serializedForm.fields(); - } - - /** - * Return true if Serializable fields are explicitly defined with - * the special class member serialPersistentFields. - * - * @see #serializableFields() - * @see SerialFieldTagImpl - */ - public boolean definesSerializableFields() { - if (!isSerializable() || isExternalizable()) { - return false; - } else { - if (serializedForm == null) { - serializedForm = new SerializedForm(env, tsym, this); - } - //### Clone this? - return serializedForm.definesSerializableFields(); - } - } - - /** - * Determine if a class is a RuntimeException. - *

    - * Used only by ThrowsTagImpl. - */ - boolean isRuntimeException() { - return tsym.isSubClass(env.syms.runtimeExceptionType.tsym, env.types); - } - - /** - * Return the source position of the entity, or null if - * no position is available. - */ - @Override - public SourcePosition position() { - if (tsym.sourcefile == null) return null; - return SourcePositionImpl.make(tsym.sourcefile, - (tree==null) ? Position.NOPOS : tree.pos, - lineMap); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java deleted file mode 100644 index 98881933de4..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/Comment.java +++ /dev/null @@ -1,462 +0,0 @@ -/* - * Copyright (c) 1997, 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. 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 com.sun.tools.javadoc.main; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import com.sun.javadoc.*; -import com.sun.tools.javac.util.ListBuffer; - -/** - * Comment contains all information in comment part. - * It allows users to get first sentence of this comment, get - * comment for different tags... - * - *

    This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @author Kaiyang Liu (original) - * @author Robert Field (rewrite) - * @author Atul M Dambalkar - * @author Neal Gafter (rewrite) - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -class Comment { - - /** - * sorted comments with different tags. - */ - private final ListBuffer tagList = new ListBuffer<>(); - - /** - * text minus any tags. - */ - private String text; - - /** - * Doc environment - */ - private final DocEnv docenv; - - /** - * constructor of Comment. - */ - Comment(final DocImpl holder, final String commentString) { - this.docenv = holder.env; - - /** - * Separate the comment into the text part and zero to N tags. - * Simple state machine is in one of three states: - *

    -         * IN_TEXT: parsing the comment text or tag text.
    -         * TAG_NAME: parsing the name of a tag.
    -         * TAG_GAP: skipping through the gap between the tag name and
    -         * the tag text.
    -         * 
    - */ - @SuppressWarnings("fallthrough") - class CommentStringParser { - /** - * The entry point to the comment string parser - */ - void parseCommentStateMachine() { - final int IN_TEXT = 1; - final int TAG_GAP = 2; - final int TAG_NAME = 3; - int state = TAG_GAP; - boolean newLine = true; - String tagName = null; - int tagStart = 0; - int textStart = 0; - int lastNonWhite = -1; - int len = commentString.length(); - for (int inx = 0; inx < len; ++inx) { - char ch = commentString.charAt(inx); - boolean isWhite = Character.isWhitespace(ch); - switch (state) { - case TAG_NAME: - if (isWhite) { - tagName = commentString.substring(tagStart, inx); - state = TAG_GAP; - } - break; - case TAG_GAP: - if (isWhite) { - break; - } - textStart = inx; - state = IN_TEXT; - /* fall thru */ - case IN_TEXT: - if (newLine && ch == '@') { - parseCommentComponent(tagName, textStart, - lastNonWhite+1); - tagStart = inx; - state = TAG_NAME; - } - break; - } - if (ch == '\n') { - newLine = true; - } else if (!isWhite) { - lastNonWhite = inx; - newLine = false; - } - } - // Finish what's currently being processed - switch (state) { - case TAG_NAME: - tagName = commentString.substring(tagStart, len); - /* fall thru */ - case TAG_GAP: - textStart = len; - /* fall thru */ - case IN_TEXT: - parseCommentComponent(tagName, textStart, lastNonWhite+1); - break; - } - } - - /** - * Save away the last parsed item. - */ - void parseCommentComponent(String tagName, - int from, int upto) { - String tx = upto <= from ? "" : commentString.substring(from, upto); - if (tagName == null) { - text = tx; - } else { - TagImpl tag; - switch (tagName) { - case "@exception": - case "@throws": - warnIfEmpty(tagName, tx); - tag = new ThrowsTagImpl(holder, tagName, tx); - break; - case "@param": - warnIfEmpty(tagName, tx); - tag = new ParamTagImpl(holder, tagName, tx); - break; - case "@see": - warnIfEmpty(tagName, tx); - tag = new SeeTagImpl(holder, tagName, tx); - break; - case "@serialField": - warnIfEmpty(tagName, tx); - tag = new SerialFieldTagImpl(holder, tagName, tx); - break; - case "@return": - warnIfEmpty(tagName, tx); - tag = new TagImpl(holder, tagName, tx); - break; - case "@author": - warnIfEmpty(tagName, tx); - tag = new TagImpl(holder, tagName, tx); - break; - case "@version": - warnIfEmpty(tagName, tx); - tag = new TagImpl(holder, tagName, tx); - break; - default: - tag = new TagImpl(holder, tagName, tx); - break; - } - tagList.append(tag); - } - } - - void warnIfEmpty(String tagName, String tx) { - if (tx.length() == 0) { - docenv.warning(holder, "tag.tag_has_no_arguments", tagName); - } - } - - } - - new CommentStringParser().parseCommentStateMachine(); - } - - /** - * Return the text of the comment. - */ - String commentText() { - return text; - } - - /** - * Return all tags in this comment. - */ - Tag[] tags() { - return tagList.toArray(new Tag[tagList.length()]); - } - - /** - * Return tags of the specified kind in this comment. - */ - Tag[] tags(String tagname) { - ListBuffer found = new ListBuffer<>(); - String target = tagname; - if (target.charAt(0) != '@') { - target = "@" + target; - } - for (Tag tag : tagList) { - if (tag.kind().equals(target)) { - found.append(tag); - } - } - return found.toArray(new Tag[found.length()]); - } - - /** - * Return throws tags in this comment. - */ - ThrowsTag[] throwsTags() { - ListBuffer found = new ListBuffer<>(); - for (Tag next : tagList) { - if (next instanceof ThrowsTag) { - found.append((ThrowsTag)next); - } - } - return found.toArray(new ThrowsTag[found.length()]); - } - - /** - * Return param tags (excluding type param tags) in this comment. - */ - ParamTag[] paramTags() { - return paramTags(false); - } - - /** - * Return type param tags in this comment. - */ - ParamTag[] typeParamTags() { - return paramTags(true); - } - - /** - * Return param tags in this comment. If typeParams is true - * include only type param tags, otherwise include only ordinary - * param tags. - */ - private ParamTag[] paramTags(boolean typeParams) { - ListBuffer found = new ListBuffer<>(); - for (Tag next : tagList) { - if (next instanceof ParamTag) { - ParamTag p = (ParamTag)next; - if (typeParams == p.isTypeParameter()) { - found.append(p); - } - } - } - return found.toArray(new ParamTag[found.length()]); - } - - /** - * Return see also tags in this comment. - */ - SeeTag[] seeTags() { - ListBuffer found = new ListBuffer<>(); - for (Tag next : tagList) { - if (next instanceof SeeTag) { - found.append((SeeTag)next); - } - } - return found.toArray(new SeeTag[found.length()]); - } - - /** - * Return serialField tags in this comment. - */ - SerialFieldTag[] serialFieldTags() { - ListBuffer found = new ListBuffer<>(); - for (Tag next : tagList) { - if (next instanceof SerialFieldTag) { - found.append((SerialFieldTag)next); - } - } - return found.toArray(new SerialFieldTag[found.length()]); - } - - /** - * Return array of tags with text and inline See Tags for a Doc comment. - */ - static Tag[] getInlineTags(DocImpl holder, String inlinetext) { - ListBuffer taglist = new ListBuffer<>(); - int delimend = 0, textstart = 0, len = inlinetext.length(); - boolean inPre = false; - DocEnv docenv = holder.env; - - if (len == 0) { - return taglist.toArray(new Tag[taglist.length()]); - } - while (true) { - int linkstart; - if ((linkstart = inlineTagFound(holder, inlinetext, - textstart)) == -1) { - taglist.append(new TagImpl(holder, "Text", - inlinetext.substring(textstart))); - break; - } else { - inPre = scanForPre(inlinetext, textstart, linkstart, inPre); - int seetextstart = linkstart; - for (int i = linkstart; i < inlinetext.length(); i++) { - char c = inlinetext.charAt(i); - if (Character.isWhitespace(c) || - c == '}') { - seetextstart = i; - break; - } - } - String linkName = inlinetext.substring(linkstart+2, seetextstart); - if (!(inPre && (linkName.equals("code") || linkName.equals("literal")))) { - //Move past the white space after the inline tag name. - while (Character.isWhitespace(inlinetext. - charAt(seetextstart))) { - if (inlinetext.length() <= seetextstart) { - taglist.append(new TagImpl(holder, "Text", - inlinetext.substring(textstart, seetextstart))); - docenv.warning(holder, - "tag.Improper_Use_Of_Link_Tag", - inlinetext); - return taglist.toArray(new Tag[taglist.length()]); - } else { - seetextstart++; - } - } - } - taglist.append(new TagImpl(holder, "Text", - inlinetext.substring(textstart, linkstart))); - textstart = seetextstart; // this text is actually seetag - if ((delimend = findInlineTagDelim(inlinetext, textstart)) == -1) { - //Missing closing '}' character. - // store the text as it is with the {@link. - taglist.append(new TagImpl(holder, "Text", - inlinetext.substring(textstart))); - docenv.warning(holder, - "tag.End_delimiter_missing_for_possible_SeeTag", - inlinetext); - return taglist.toArray(new Tag[taglist.length()]); - } else { - //Found closing '}' character. - if (linkName.equals("see") - || linkName.equals("link") - || linkName.equals("linkplain")) { - taglist.append( new SeeTagImpl(holder, "@" + linkName, - inlinetext.substring(textstart, delimend))); - } else { - taglist.append( new TagImpl(holder, "@" + linkName, - inlinetext.substring(textstart, delimend))); - } - textstart = delimend + 1; - } - } - if (textstart == inlinetext.length()) { - break; - } - } - return taglist.toArray(new Tag[taglist.length()]); - } - - /** regex for case-insensitive match for {@literal
     } and  {@literal 
    }. */ - private static final Pattern prePat = Pattern.compile("(?i)<(/?)pre>"); - - private static boolean scanForPre(String inlinetext, int start, int end, boolean inPre) { - Matcher m = prePat.matcher(inlinetext).region(start, end); - while (m.find()) { - inPre = m.group(1).isEmpty(); - } - return inPre; - } - - /** - * Recursively find the index of the closing '}' character for an inline tag - * and return it. If it can't be found, return -1. - * @param inlineText the text to search in. - * @param searchStart the index of the place to start searching at. - * @return the index of the closing '}' character for an inline tag. - * If it can't be found, return -1. - */ - private static int findInlineTagDelim(String inlineText, int searchStart) { - int delimEnd, nestedOpenBrace; - if ((delimEnd = inlineText.indexOf("}", searchStart)) == -1) { - return -1; - } else if (((nestedOpenBrace = inlineText.indexOf("{", searchStart)) != -1) && - nestedOpenBrace < delimEnd){ - //Found a nested open brace. - int nestedCloseBrace = findInlineTagDelim(inlineText, nestedOpenBrace + 1); - return (nestedCloseBrace != -1) ? - findInlineTagDelim(inlineText, nestedCloseBrace + 1) : - -1; - } else { - return delimEnd; - } - } - - /** - * Recursively search for the characters '{', '@', followed by - * name of inline tag and white space, - * if found - * return the index of the text following the white space. - * else - * return -1. - */ - private static int inlineTagFound(DocImpl holder, String inlinetext, int start) { - DocEnv docenv = holder.env; - int linkstart = inlinetext.indexOf("{@", start); - if (start == inlinetext.length() || linkstart == -1) { - return -1; - } else if (inlinetext.indexOf('}', linkstart) == -1) { - //Missing '}'. - docenv.warning(holder, "tag.Improper_Use_Of_Link_Tag", - inlinetext.substring(linkstart, inlinetext.length())); - return -1; - } else { - return linkstart; - } - } - - - /** - * Return array of tags for the locale specific first sentence in the text. - */ - static Tag[] firstSentenceTags(DocImpl holder, String text) { - DocLocale doclocale = holder.env.doclocale; - return getInlineTags(holder, - doclocale.localeSpecificFirstSentence(holder, text)); - } - - /** - * Return text for this Doc comment. - */ - @Override - public String toString() { - return text; - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ConstructorDocImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ConstructorDocImpl.java deleted file mode 100644 index 02c13c9aac3..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ConstructorDocImpl.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 1997, 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. 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 com.sun.tools.javadoc.main; - -import com.sun.javadoc.*; - -import com.sun.source.util.TreePath; -import com.sun.tools.javac.code.Symbol.ClassSymbol; -import com.sun.tools.javac.code.Symbol.MethodSymbol; - -/** - * Represents a constructor of a java class. - * - *

    This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @since 1.2 - * @author Robert Field - * @author Neal Gafter (rewrite) - */ - -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class ConstructorDocImpl - extends ExecutableMemberDocImpl implements ConstructorDoc { - - /** - * constructor. - */ - public ConstructorDocImpl(DocEnv env, MethodSymbol sym) { - super(env, sym); - } - - /** - * constructor. - */ - public ConstructorDocImpl(DocEnv env, MethodSymbol sym, TreePath treePath) { - super(env, sym, treePath); - } - - /** - * Return true if it is a constructor, which it is. - * - * @return true - */ - public boolean isConstructor() { - return true; - } - - /** - * Get the name. - * - * @return the name of the member. - */ - public String name() { - ClassSymbol c = sym.enclClass(); - return c.name.toString(); - } - - /** - * Get the name. - * - * @return the qualified name of the member. - */ - public String qualifiedName() { - return sym.enclClass().getQualifiedName().toString(); - } - - /** - * Returns a string representation of this constructor. Includes the - * qualified signature and any type parameters. - * Type parameters precede the class name, as they do in the syntax - * for invoking constructors with explicit type parameters using "new". - * (This is unlike the syntax for invoking methods with explicit type - * parameters.) - */ - public String toString() { - return typeParametersString() + qualifiedName() + signature(); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java deleted file mode 100644 index 57050dfcd18..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java +++ /dev/null @@ -1,881 +0,0 @@ -/* - * 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 - * 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 com.sun.tools.javadoc.main; - -import java.lang.reflect.Modifier; -import java.util.*; - -import javax.tools.JavaFileManager; - -import com.sun.javadoc.*; -import com.sun.source.tree.CompilationUnitTree; -import com.sun.source.util.JavacTask; -import com.sun.source.util.TreePath; -import com.sun.tools.doclint.DocLint; -import com.sun.tools.javac.api.BasicJavacTask; -import com.sun.tools.javac.code.*; -import com.sun.tools.javac.code.Symbol.*; -import com.sun.tools.javac.code.Symbol.ClassSymbol; -import com.sun.tools.javac.code.Symbol.CompletionFailure; -import com.sun.tools.javac.code.Symbol.MethodSymbol; -import com.sun.tools.javac.code.Symbol.PackageSymbol; -import com.sun.tools.javac.code.Symbol.VarSymbol; -import com.sun.tools.javac.code.Type.ClassType; -import com.sun.tools.javac.comp.Check; -import com.sun.tools.javac.comp.Enter; -import com.sun.tools.javac.file.JavacFileManager; -import com.sun.tools.javac.tree.JCTree; -import com.sun.tools.javac.tree.JCTree.JCClassDecl; -import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; -import com.sun.tools.javac.tree.JCTree.JCPackageDecl; -import com.sun.tools.javac.util.Context; -import com.sun.tools.javac.util.Convert; -import com.sun.tools.javac.util.Name; -import com.sun.tools.javac.util.Names; - -/** - * Holds the environment for a run of javadoc. - * Holds only the information needed throughout the - * run and not the compiler info that could be GC'ed - * or ported. - * - *

    This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @since 1.4 - * @author Robert Field - * @author Neal Gafter (rewrite) - * @author Scott Seligman (generics) - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public class DocEnv { - protected static final Context.Key docEnvKey = new Context.Key<>(); - - public static DocEnv instance(Context context) { - DocEnv instance = context.get(docEnvKey); - if (instance == null) - instance = new DocEnv(context); - return instance; - } - - DocLocale doclocale; - - private final Messager messager; - - /** Predefined symbols known to the compiler. */ - final Symtab syms; - - /** Referenced directly in RootDocImpl. */ - private final ClassFinder finder; - - /** Javadoc's own version of the compiler's enter phase. */ - final Enter enter; - - /** The name table. */ - private final Names names; - - /** The encoding name. */ - private String encoding; - - final Symbol externalizableSym; - - /** Access filter (public, protected, ...). */ - protected ModifierFilter showAccess; - - /** True if we are using a sentence BreakIterator. */ - boolean breakiterator; - - /** - * True if we do not want to print any notifications at all. - */ - boolean quiet = false; - - Check chk; - Types types; - JavaFileManager fileManager; - Context context; - DocLint doclint; - JavaScriptScanner javaScriptScanner; - - WeakHashMap treePaths = new WeakHashMap<>(); - - /** Allow documenting from class files? */ - boolean docClasses = false; - - /** Does the doclet only expect pre-1.5 doclet API? */ - protected boolean legacyDoclet = true; - - /** - * Set this to true if you would like to not emit any errors, warnings and - * notices. - */ - private boolean silent = false; - - /** - * The source language version. - */ - protected Source source; - - /** - * Constructor - * - * @param context Context for this javadoc instance. - */ - protected DocEnv(Context context) { - context.put(docEnvKey, this); - this.context = context; - - messager = Messager.instance0(context); - syms = Symtab.instance(context); - finder = JavadocClassFinder.instance(context); - enter = JavadocEnter.instance(context); - names = Names.instance(context); - externalizableSym = syms.enterClass(syms.java_base, names.fromString("java.io.Externalizable")); - chk = Check.instance(context); - types = Types.instance(context); - fileManager = context.get(JavaFileManager.class); - if (fileManager instanceof JavacFileManager) { - ((JavacFileManager)fileManager).setSymbolFileEnabled(false); - } - - // Default. Should normally be reset with setLocale. - this.doclocale = new DocLocale(this, "", breakiterator); - source = Source.instance(context); - } - - public void setSilent(boolean silent) { - this.silent = silent; - } - - /** - * Look up ClassDoc by qualified name. - */ - public ClassDocImpl lookupClass(String name) { - ClassSymbol c = getClassSymbol(name); - if (c != null) { - return getClassDoc(c); - } else { - return null; - } - } - - /** - * Load ClassDoc by qualified name. - */ - public ClassDocImpl loadClass(String name) { - try { - Name nameImpl = names.fromString(name); - ModuleSymbol mod = syms.inferModule(Convert.packagePart(nameImpl)); - ClassSymbol c = finder.loadClass(mod != null ? mod : syms.errModule, nameImpl); - return getClassDoc(c); - } catch (CompletionFailure ex) { - chk.completionError(null, ex); - return null; - } - } - - /** - * Look up PackageDoc by qualified name. - */ - public PackageDocImpl lookupPackage(String name) { - //### Jing alleges that class check is needed - //### to avoid a compiler bug. Most likely - //### instead a dummy created for error recovery. - //### Should investigate this. - Name nameImpl = names.fromString(name); - ModuleSymbol mod = syms.inferModule(nameImpl); - PackageSymbol p = mod != null ? syms.getPackage(mod, nameImpl) : null; - ClassSymbol c = getClassSymbol(name); - if (p != null && c == null) { - return getPackageDoc(p); - } else { - return null; - } - } - // where - /** Retrieve class symbol by fully-qualified name. - */ - ClassSymbol getClassSymbol(String name) { - // Name may contain nested class qualification. - // Generate candidate flatnames with successively shorter - // package qualifiers and longer nested class qualifiers. - int nameLen = name.length(); - char[] nameChars = name.toCharArray(); - int idx = name.length(); - for (;;) { - Name nameImpl = names.fromChars(nameChars, 0, nameLen); - ModuleSymbol mod = syms.inferModule(Convert.packagePart(nameImpl)); - ClassSymbol s = mod != null ? syms.getClass(mod, nameImpl) : null; - if (s != null) - return s; // found it! - idx = name.substring(0, idx).lastIndexOf('.'); - if (idx < 0) break; - nameChars[idx] = '$'; - } - return null; - } - - /** - * Set the locale. - */ - public void setLocale(String localeName) { - // create locale specifics - doclocale = new DocLocale(this, localeName, breakiterator); - // update Messager if locale has changed. - messager.setLocale(doclocale.locale); - } - - /** Check whether this member should be documented. */ - public boolean shouldDocument(VarSymbol sym) { - long mod = sym.flags(); - - if ((mod & Flags.SYNTHETIC) != 0) { - return false; - } - - return showAccess.checkModifier(translateModifiers(mod)); - } - - /** Check whether this member should be documented. */ - public boolean shouldDocument(MethodSymbol sym) { - long mod = sym.flags(); - - if ((mod & Flags.SYNTHETIC) != 0) { - return false; - } - - return showAccess.checkModifier(translateModifiers(mod)); - } - - /** check whether this class should be documented. */ - public boolean shouldDocument(ClassSymbol sym) { - return - (sym.flags_field&Flags.SYNTHETIC) == 0 && // no synthetics - (docClasses || getClassDoc(sym).tree != null) && - isVisible(sym); - } - - //### Comment below is inaccurate wrt modifier filter testing - /** - * Check the visibility if this is an nested class. - * if this is not a nested class, return true. - * if this is an static visible nested class, - * return true. - * if this is an visible nested class - * if the outer class is visible return true. - * else return false. - * IMPORTANT: This also allows, static nested classes - * to be defined inside an nested class, which is not - * allowed by the compiler. So such an test case will - * not reach upto this method itself, but if compiler - * allows it, then that will go through. - */ - protected boolean isVisible(ClassSymbol sym) { - long mod = sym.flags_field; - if (!showAccess.checkModifier(translateModifiers(mod))) { - return false; - } - ClassSymbol encl = sym.owner.enclClass(); - return (encl == null || (mod & Flags.STATIC) != 0 || isVisible(encl)); - } - - //---------------- print forwarders ----------------// - - /** - * Print error message, increment error count. - * - * @param msg message to print. - */ - public void printError(String msg) { - if (silent) - return; - messager.printError(msg); - } - - /** - * Print error message, increment error count. - * - * @param key selects message from resource - */ - public void error(DocImpl doc, String key) { - if (silent) - return; - messager.error(doc==null ? null : doc.position(), key); - } - - /** - * Print error message, increment error count. - * - * @param key selects message from resource - */ - public void error(SourcePosition pos, String key) { - if (silent) - return; - messager.error(pos, key); - } - - /** - * Print error message, increment error count. - * - * @param msg message to print. - */ - public void printError(SourcePosition pos, String msg) { - if (silent) - return; - messager.printError(pos, msg); - } - - /** - * Print error message, increment error count. - * - * @param key selects message from resource - * @param a1 first argument - */ - public void error(DocImpl doc, String key, String a1) { - if (silent) - return; - messager.error(doc==null ? null : doc.position(), key, a1); - } - - /** - * Print error message, increment error count. - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - */ - public void error(DocImpl doc, String key, String a1, String a2) { - if (silent) - return; - messager.error(doc==null ? null : doc.position(), key, a1, a2); - } - - /** - * Print error message, increment error count. - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - * @param a3 third argument - */ - public void error(DocImpl doc, String key, String a1, String a2, String a3) { - if (silent) - return; - messager.error(doc==null ? null : doc.position(), key, a1, a2, a3); - } - - /** - * Print warning message, increment warning count. - * - * @param msg message to print. - */ - public void printWarning(String msg) { - if (silent) - return; - messager.printWarning(msg); - } - - /** - * Print warning message, increment warning count. - * - * @param key selects message from resource - */ - public void warning(DocImpl doc, String key) { - if (silent) - return; - messager.warning(doc==null ? null : doc.position(), key); - } - - /** - * Print warning message, increment warning count. - * - * @param msg message to print. - */ - public void printWarning(SourcePosition pos, String msg) { - if (silent) - return; - messager.printWarning(pos, msg); - } - - /** - * Print warning message, increment warning count. - * - * @param key selects message from resource - * @param a1 first argument - */ - public void warning(DocImpl doc, String key, String a1) { - if (silent) - return; - // suppress messages that have (probably) been covered by doclint - if (doclint != null && doc != null && key.startsWith("tag")) - return; - messager.warning(doc==null ? null : doc.position(), key, a1); - } - - /** - * Print warning message, increment warning count. - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - */ - public void warning(DocImpl doc, String key, String a1, String a2) { - if (silent) - return; - messager.warning(doc==null ? null : doc.position(), key, a1, a2); - } - - /** - * Print warning message, increment warning count. - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - * @param a3 third argument - */ - public void warning(DocImpl doc, String key, String a1, String a2, String a3) { - if (silent) - return; - messager.warning(doc==null ? null : doc.position(), key, a1, a2, a3); - } - - /** - * Print warning message, increment warning count. - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - * @param a3 third argument - */ - public void warning(DocImpl doc, String key, String a1, String a2, String a3, - String a4) { - if (silent) - return; - messager.warning(doc==null ? null : doc.position(), key, a1, a2, a3, a4); - } - - /** - * Print a message. - * - * @param msg message to print. - */ - public void printNotice(String msg) { - if (silent || quiet) - return; - messager.printNotice(msg); - } - - - /** - * Print a message. - * - * @param key selects message from resource - */ - public void notice(String key) { - if (silent || quiet) - return; - messager.notice(key); - } - - /** - * Print a message. - * - * @param msg message to print. - */ - public void printNotice(SourcePosition pos, String msg) { - if (silent || quiet) - return; - messager.printNotice(pos, msg); - } - - /** - * Print a message. - * - * @param key selects message from resource - * @param a1 first argument - */ - public void notice(String key, String a1) { - if (silent || quiet) - return; - messager.notice(key, a1); - } - - /** - * Print a message. - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - */ - public void notice(String key, String a1, String a2) { - if (silent || quiet) - return; - messager.notice(key, a1, a2); - } - - /** - * Print a message. - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - * @param a3 third argument - */ - public void notice(String key, String a1, String a2, String a3) { - if (silent || quiet) - return; - messager.notice(key, a1, a2, a3); - } - - /** - * Exit, reporting errors and warnings. - */ - public void exit() { - // Messager should be replaced by a more general - // compilation environment. This can probably - // subsume DocEnv as well. - messager.exit(); - } - - protected Map packageMap = new HashMap<>(); - /** - * Return the PackageDoc of this package symbol. - */ - public PackageDocImpl getPackageDoc(PackageSymbol pack) { - PackageDocImpl result = packageMap.get(pack); - if (result != null) return result; - result = new PackageDocImpl(this, pack); - packageMap.put(pack, result); - return result; - } - - /** - * Create the PackageDoc (or a subtype) for a package symbol. - */ - void makePackageDoc(PackageSymbol pack, TreePath treePath) { - PackageDocImpl result = packageMap.get(pack); - if (result != null) { - if (treePath != null) result.setTreePath(treePath); - } else { - result = new PackageDocImpl(this, pack, treePath); - packageMap.put(pack, result); - } - } - - - protected Map classMap = new HashMap<>(); - /** - * Return the ClassDoc (or a subtype) of this class symbol. - */ - public ClassDocImpl getClassDoc(ClassSymbol clazz) { - ClassDocImpl result = classMap.get(clazz); - if (result != null) return result; - if (isAnnotationType(clazz)) { - result = new AnnotationTypeDocImpl(this, clazz); - } else { - result = new ClassDocImpl(this, clazz); - } - classMap.put(clazz, result); - return result; - } - - /** - * Create the ClassDoc (or a subtype) for a class symbol. - */ - protected void makeClassDoc(ClassSymbol clazz, TreePath treePath) { - ClassDocImpl result = classMap.get(clazz); - if (result != null) { - if (treePath != null) result.setTreePath(treePath); - return; - } - if (isAnnotationType((JCClassDecl) treePath.getLeaf())) { // flags of clazz may not yet be set - result = new AnnotationTypeDocImpl(this, clazz, treePath); - } else { - result = new ClassDocImpl(this, clazz, treePath); - } - classMap.put(clazz, result); - } - - protected static boolean isAnnotationType(ClassSymbol clazz) { - return ClassDocImpl.isAnnotationType(clazz); - } - - protected static boolean isAnnotationType(JCClassDecl tree) { - return (tree.mods.flags & Flags.ANNOTATION) != 0; - } - - protected Map fieldMap = new HashMap<>(); - /** - * Return the FieldDoc of this var symbol. - */ - public FieldDocImpl getFieldDoc(VarSymbol var) { - FieldDocImpl result = fieldMap.get(var); - if (result != null) return result; - result = new FieldDocImpl(this, var); - fieldMap.put(var, result); - return result; - } - /** - * Create a FieldDoc for a var symbol. - */ - protected void makeFieldDoc(VarSymbol var, TreePath treePath) { - FieldDocImpl result = fieldMap.get(var); - if (result != null) { - if (treePath != null) result.setTreePath(treePath); - } else { - result = new FieldDocImpl(this, var, treePath); - fieldMap.put(var, result); - } - } - - protected Map methodMap = new HashMap<>(); - /** - * Create a MethodDoc for this MethodSymbol. - * Should be called only on symbols representing methods. - */ - protected void makeMethodDoc(MethodSymbol meth, TreePath treePath) { - MethodDocImpl result = (MethodDocImpl)methodMap.get(meth); - if (result != null) { - if (treePath != null) result.setTreePath(treePath); - } else { - result = new MethodDocImpl(this, meth, treePath); - methodMap.put(meth, result); - } - } - - /** - * Return the MethodDoc for a MethodSymbol. - * Should be called only on symbols representing methods. - */ - public MethodDocImpl getMethodDoc(MethodSymbol meth) { - assert !meth.isConstructor() : "not expecting a constructor symbol"; - MethodDocImpl result = (MethodDocImpl)methodMap.get(meth); - if (result != null) return result; - result = new MethodDocImpl(this, meth); - methodMap.put(meth, result); - return result; - } - - /** - * Create the ConstructorDoc for a MethodSymbol. - * Should be called only on symbols representing constructors. - */ - protected void makeConstructorDoc(MethodSymbol meth, TreePath treePath) { - ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth); - if (result != null) { - if (treePath != null) result.setTreePath(treePath); - } else { - result = new ConstructorDocImpl(this, meth, treePath); - methodMap.put(meth, result); - } - } - - /** - * Return the ConstructorDoc for a MethodSymbol. - * Should be called only on symbols representing constructors. - */ - public ConstructorDocImpl getConstructorDoc(MethodSymbol meth) { - assert meth.isConstructor() : "expecting a constructor symbol"; - ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth); - if (result != null) return result; - result = new ConstructorDocImpl(this, meth); - methodMap.put(meth, result); - return result; - } - - /** - * Create the AnnotationTypeElementDoc for a MethodSymbol. - * Should be called only on symbols representing annotation type elements. - */ - protected void makeAnnotationTypeElementDoc(MethodSymbol meth, TreePath treePath) { - AnnotationTypeElementDocImpl result = - (AnnotationTypeElementDocImpl)methodMap.get(meth); - if (result != null) { - if (treePath != null) result.setTreePath(treePath); - } else { - result = - new AnnotationTypeElementDocImpl(this, meth, treePath); - methodMap.put(meth, result); - } - } - - /** - * Return the AnnotationTypeElementDoc for a MethodSymbol. - * Should be called only on symbols representing annotation type elements. - */ - public AnnotationTypeElementDocImpl getAnnotationTypeElementDoc( - MethodSymbol meth) { - - AnnotationTypeElementDocImpl result = - (AnnotationTypeElementDocImpl)methodMap.get(meth); - if (result != null) return result; - result = new AnnotationTypeElementDocImpl(this, meth); - methodMap.put(meth, result); - return result; - } - -// private Map parameterizedTypeMap = -// new HashMap(); - /** - * Return the ParameterizedType of this instantiation. -// * ### Could use Type.sameTypeAs() instead of equality matching in hashmap -// * ### to avoid some duplication. - */ - ParameterizedTypeImpl getParameterizedType(ClassType t) { - return new ParameterizedTypeImpl(this, t); -// ParameterizedTypeImpl result = parameterizedTypeMap.get(t); -// if (result != null) return result; -// result = new ParameterizedTypeImpl(this, t); -// parameterizedTypeMap.put(t, result); -// return result; - } - - TreePath getTreePath(JCCompilationUnit tree) { - TreePath p = treePaths.get(tree); - if (p == null) - treePaths.put(tree, p = new TreePath(tree)); - return p; - } - - TreePath getTreePath(JCCompilationUnit toplevel, JCPackageDecl tree) { - TreePath p = treePaths.get(tree); - if (p == null) - treePaths.put(tree, p = new TreePath(getTreePath(toplevel), tree)); - return p; - } - - TreePath getTreePath(JCCompilationUnit toplevel, JCClassDecl tree) { - TreePath p = treePaths.get(tree); - if (p == null) - treePaths.put(tree, p = new TreePath(getTreePath(toplevel), tree)); - return p; - } - - TreePath getTreePath(JCCompilationUnit toplevel, JCClassDecl cdecl, JCTree tree) { - return new TreePath(getTreePath(toplevel, cdecl), tree); - } - - /** - * Set the encoding. - */ - public void setEncoding(String encoding) { - this.encoding = encoding; - } - - /** - * Get the encoding. - */ - public String getEncoding() { - return encoding; - } - - /** - * Convert modifier bits from private coding used by - * the compiler to that of java.lang.reflect.Modifier. - */ - static int translateModifiers(long flags) { - int result = 0; - if ((flags & Flags.ABSTRACT) != 0) - result |= Modifier.ABSTRACT; - if ((flags & Flags.FINAL) != 0) - result |= Modifier.FINAL; - if ((flags & Flags.INTERFACE) != 0) - result |= Modifier.INTERFACE; - if ((flags & Flags.NATIVE) != 0) - result |= Modifier.NATIVE; - if ((flags & Flags.PRIVATE) != 0) - result |= Modifier.PRIVATE; - if ((flags & Flags.PROTECTED) != 0) - result |= Modifier.PROTECTED; - if ((flags & Flags.PUBLIC) != 0) - result |= Modifier.PUBLIC; - if ((flags & Flags.STATIC) != 0) - result |= Modifier.STATIC; - if ((flags & Flags.SYNCHRONIZED) != 0) - result |= Modifier.SYNCHRONIZED; - if ((flags & Flags.TRANSIENT) != 0) - result |= Modifier.TRANSIENT; - if ((flags & Flags.VOLATILE) != 0) - result |= Modifier.VOLATILE; - return result; - } - - void initDoclint(Collection opts, Collection customTagNames, String htmlVersion) { - ArrayList doclintOpts = new ArrayList<>(); - boolean msgOptionSeen = false; - - for (String opt : opts) { - if (opt.startsWith(DocLint.XMSGS_OPTION)) { - if (opt.equals(DocLint.XMSGS_CUSTOM_PREFIX + "none")) - return; - msgOptionSeen = true; - } - doclintOpts.add(opt); - } - - if (!msgOptionSeen) { - doclintOpts.add(DocLint.XMSGS_OPTION); - } - - String sep = ""; - StringBuilder customTags = new StringBuilder(); - for (String customTag : customTagNames) { - customTags.append(sep); - customTags.append(customTag); - sep = DocLint.SEPARATOR; - } - doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString()); - doclintOpts.add(DocLint.XHTML_VERSION_PREFIX + htmlVersion); - - JavacTask t = BasicJavacTask.instance(context); - doclint = new DocLint(); - // standard doclet normally generates H1, H2 - doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2"); - doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false); - } - - JavaScriptScanner initJavaScriptScanner(boolean allowScriptInComments) { - if (allowScriptInComments) { - javaScriptScanner = null; - } else { - javaScriptScanner = new JavaScriptScanner(); - } - return javaScriptScanner; - } - - boolean showTagMessages() { - return (doclint == null); - } - - Map shouldCheck = new HashMap<>(); - - boolean shouldCheck(CompilationUnitTree unit) { - return shouldCheck.computeIfAbsent(unit, doclint :: shouldCheck); - } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocImpl.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocImpl.java deleted file mode 100644 index 172b998444f..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocImpl.java +++ /dev/null @@ -1,455 +0,0 @@ -/* - * Copyright (c) 1997, 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. 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 com.sun.tools.javadoc.main; - -import java.io.DataInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.text.CollationKey; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.tools.FileObject; - -import com.sun.javadoc.*; -import com.sun.source.util.TreePath; -import com.sun.tools.javac.tree.JCTree; -import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; -import com.sun.tools.javac.util.Position; - -/** - * abstract base class of all Doc classes. Doc item's are representations - * of java language constructs (class, package, method,...) which have - * comments and have been processed by this run of javadoc. All Doc items - * are unique, that is, they are == comparable. - * - *

    This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @since 1.2 - * @author Robert Field - * @author Atul M Dambalkar - * @author Neal Gafter (rewrite) - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -public abstract class DocImpl implements Doc, Comparable { - - /** - * Doc environment - */ - protected final DocEnv env; //### Rename this everywhere to 'docenv' ? - - /** - * Back pointer to the tree node for this doc item. - * May be null if there is no associated tree. - */ - protected TreePath treePath; - - /** - * The complex comment object, lazily initialized. - */ - private Comment comment; - - /** - * The cached sort key, to take care of Natural Language Text sorting. - */ - private CollationKey collationkey = null; - - /** - * Raw documentation string. - */ - protected String documentation; // Accessed in PackageDocImpl, RootDocImpl - - /** - * Cached first sentence. - */ - private Tag[] firstSentence; - - /** - * Cached inline tags. - */ - private Tag[] inlineTags; - - /** - * Constructor. - */ - DocImpl(DocEnv env, TreePath treePath) { - this.treePath = treePath; - this.documentation = getCommentText(treePath); - this.env = env; - } - - private static String getCommentText(TreePath p) { - if (p == null) - return null; - - JCCompilationUnit topLevel = (JCCompilationUnit) p.getCompilationUnit(); - JCTree tree = (JCTree) p.getLeaf(); - return topLevel.docComments.getCommentText(tree); - } - - /** - * So subclasses have the option to do lazy initialization of - * "documentation" string. - */ - protected String documentation() { - if (documentation == null) documentation = ""; - return documentation; - } - - /** - * For lazy initialization of comment. - */ - Comment comment() { - if (comment == null) { - String d = documentation(); - if (env.javaScriptScanner != null) { - env.javaScriptScanner.parse(d, new JavaScriptScanner.Reporter() { - @Override - public void report() { - env.error(DocImpl.this, "javadoc.JavaScript_in_comment"); - throw new Error(); - } - }); - } - if (env.doclint != null - && treePath != null - && env.shouldCheck(treePath.getCompilationUnit()) - && d.equals(getCommentText(treePath))) { - env.doclint.scan(treePath); - } - comment = new Comment(this, d); - } - return comment; - } - - /** - * Return the text of the comment for this doc item. - * TagImpls have been removed. - */ - public String commentText() { - return comment().commentText(); - } - - /** - * Return all tags in this Doc item. - * - * @return an array of TagImpl containing all tags on this Doc item. - */ - public Tag[] tags() { - return comment().tags(); - } - - /** - * Return tags of the specified kind in this Doc item. - * - * @param tagname name of the tag kind to search for. - * @return an array of TagImpl containing all tags whose 'kind()' - * matches 'tagname'. - */ - public Tag[] tags(String tagname) { - return comment().tags(tagname); - } - - /** - * Return the see also tags in this Doc item. - * - * @return an array of SeeTag containing all @see tags. - */ - public SeeTag[] seeTags() { - return comment().seeTags(); - } - - public Tag[] inlineTags() { - if (inlineTags == null) { - inlineTags = Comment.getInlineTags(this, commentText()); - } - return inlineTags; - } - - public Tag[] firstSentenceTags() { - if (firstSentence == null) { - //Parse all sentences first to avoid duplicate warnings. - inlineTags(); - try { - env.setSilent(true); - firstSentence = Comment.firstSentenceTags(this, commentText()); - } finally { - env.setSilent(false); - } - } - return firstSentence; - } - - /** - * Utility for subclasses which read HTML documentation files. - */ - String readHTMLDocumentation(InputStream input, FileObject filename) throws IOException { - byte[] filecontents = new byte[input.available()]; - try { - DataInputStream dataIn = new DataInputStream(input); - dataIn.readFully(filecontents); - } finally { - input.close(); - } - String encoding = env.getEncoding(); - String rawDoc = (encoding!=null) - ? new String(filecontents, encoding) - : new String(filecontents); - Pattern bodyPat = Pattern.compile("(?is).*]*>(.*) - * Default is name(). - */ - CollationKey generateKey() { - String k = name(); - // System.out.println("COLLATION KEY FOR " + this + " is \"" + k + "\""); - return env.doclocale.collator.getCollationKey(k); - } - - /** - * Returns a string representation of this Doc item. - */ - @Override - public String toString() { - return qualifiedName(); - } - - /** - * Returns the name of this Doc item. - * - * @return the name - */ - public abstract String name(); - - /** - * Returns the qualified name of this Doc item. - * - * @return the name - */ - public abstract String qualifiedName(); - - /** - * Compares this Object with the specified Object for order. Returns a - * negative integer, zero, or a positive integer as this Object is less - * than, equal to, or greater than the given Object. - *

    - * Included so that Doc item are java.lang.Comparable. - * - * @param obj the {@code Object} to be compared. - * @return a negative integer, zero, or a positive integer as this Object - * is less than, equal to, or greater than the given Object. - * @exception ClassCastException the specified Object's type prevents it - * from being compared to this Object. - */ - public int compareTo(Object obj) { - // System.out.println("COMPARE \"" + this + "\" to \"" + obj + "\" = " + key().compareTo(((DocImpl)obj).key())); - return key().compareTo(((DocImpl)obj).key()); - } - - /** - * Is this Doc item a field? False until overridden. - * - * @return true if it represents a field - */ - public boolean isField() { - return false; - } - - /** - * Is this Doc item an enum constant? False until overridden. - * - * @return true if it represents an enum constant - */ - public boolean isEnumConstant() { - return false; - } - - /** - * Is this Doc item a constructor? False until overridden. - * - * @return true if it represents a constructor - */ - public boolean isConstructor() { - return false; - } - - /** - * Is this Doc item a method (but not a constructor or annotation - * type element)? - * False until overridden. - * - * @return true if it represents a method - */ - public boolean isMethod() { - return false; - } - - /** - * Is this Doc item an annotation type element? - * False until overridden. - * - * @return true if it represents an annotation type element - */ - public boolean isAnnotationTypeElement() { - return false; - } - - /** - * Is this Doc item a interface (but not an annotation type)? - * False until overridden. - * - * @return true if it represents a interface - */ - public boolean isInterface() { - return false; - } - - /** - * Is this Doc item a exception class? False until overridden. - * - * @return true if it represents a exception - */ - public boolean isException() { - return false; - } - - /** - * Is this Doc item a error class? False until overridden. - * - * @return true if it represents a error - */ - public boolean isError() { - return false; - } - - /** - * Is this Doc item an enum type? False until overridden. - * - * @return true if it represents an enum type - */ - public boolean isEnum() { - return false; - } - - /** - * Is this Doc item an annotation type? False until overridden. - * - * @return true if it represents an annotation type - */ - public boolean isAnnotationType() { - return false; - } - - /** - * Is this Doc item an ordinary class (i.e. not an interface, - * annotation type, enumeration, exception, or error)? - * False until overridden. - * - * @return true if it represents an ordinary class - */ - public boolean isOrdinaryClass() { - return false; - } - - /** - * Is this Doc item a class - * (and not an interface or annotation type)? - * This includes ordinary classes, enums, errors and exceptions. - * False until overridden. - * - * @return true if it represents a class - */ - public boolean isClass() { - return false; - } - - /** - * return true if this Doc is include in the active set. - */ - public abstract boolean isIncluded(); - - /** - * Return the source position of the entity, or null if - * no position is available. - */ - public SourcePosition position() { return null; } -} diff --git a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocLocale.java b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocLocale.java deleted file mode 100644 index ca9aaa74aba..00000000000 --- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocLocale.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * 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 - * 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 com.sun.tools.javadoc.main; - -import java.text.BreakIterator; -import java.text.Collator; -import java.util.Locale; - -/** - * This class holds the information about locales. - * - *

    This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @since 1.4 - * @author Robert Field - */ -@Deprecated(since="9", forRemoval=true) -@SuppressWarnings("removal") -class DocLocale { - - /** - * The locale name will be set by Main, if option is provided on the - * command line. - */ - final String localeName; - - /** - * The locale to be used. If user doesn't provide this, - * then set it to default locale value. - */ - final Locale locale; - - /** - * The collator for this application. This is to take care of Locale - * Specific or Natural Language Text sorting. - */ - final Collator collator; - - /** - * Enclosing DocEnv - */ - private final DocEnv docenv; - - /** - * Sentence instance from the BreakIterator. - */ - private final BreakIterator sentenceBreaker; - - /** - * True is we should use BreakIterator - * to compute first sentence. - */ - private boolean useBreakIterator = false; - - /** - * The HTML sentence terminators. - */ - static final String[] sentenceTerminators = - { - "

    ", "

    ", "

    ", "

    ", - "

    ", "

    ", "

    ", "
    ", - "
    ", "", "", "", "", - "", "
    ", "
    ", "
    " - }; - - /** - * Constructor - */ - DocLocale(DocEnv docenv, String localeName, boolean useBreakIterator) { - this.docenv = docenv; - this.localeName = localeName; - this.useBreakIterator = useBreakIterator; - locale = getLocale(); - if (locale == null) { - docenv.exit(); - } else { - Locale.setDefault(locale); // NOTE: updating global state - } - collator = Collator.getInstance(locale); - sentenceBreaker = BreakIterator.getSentenceInstance(locale); - } - - /** - * Get the locale if specified on the command line - * else return null and if locale option is not used - * then return default locale. - */ - private Locale getLocale() { - Locale userlocale = null; - if (localeName.length() > 0) { - int firstuscore = localeName.indexOf('_'); - int seconduscore = -1; - String language = null; - String country = null; - String variant = null; - if (firstuscore == 2) { - language = localeName.substring(0, firstuscore); - seconduscore = localeName.indexOf('_', firstuscore + 1); - if (seconduscore > 0) { - if (seconduscore != firstuscore + 3 || - localeName.length() <= seconduscore + 1) { - docenv.error(null, "main.malformed_locale_name", localeName); - return null; - } - country = localeName.substring(firstuscore + 1, - seconduscore); - variant = localeName.substring(seconduscore + 1); - } else if (localeName.length() == firstuscore + 3) { - country = localeName.substring(firstuscore + 1); - } else { - docenv.error(null, "main.malformed_locale_name", localeName); - return null; - } - } else if (firstuscore == -1 && localeName.length() == 2) { - language = localeName; - } else { - docenv.error(null, "main.malformed_locale_name", localeName); - return null; - } - userlocale = searchLocale(language, country, variant); - if (userlocale == null) { - docenv.error(null, "main.illegal_locale_name", localeName); - return null; - } else { - return userlocale; - } - } else { - return Locale.getDefault(); - } - } - - /** - * Search the locale for specified language, specified country and - * specified variant. - */ - private Locale searchLocale(String language, String country, - String variant) { - for (Locale loc : Locale.getAvailableLocales()) { - if (loc.getLanguage().equals(language) && - (country == null || loc.getCountry().equals(country)) && - (variant == null || loc.getVariant().equals(variant))) { - return loc; - } - } - return null; - } - - String localeSpecificFirstSentence(DocImpl doc, String s) { - if (s == null || s.length() == 0) { - return ""; - } - int index = s.indexOf("-->"); - if(s.trim().startsWith(" - - - - -Voice or no voice, the people can always be brought to the bidding of -the leaders. That is easy. All you have to do is tell them they are -being attacked, and denounce the peacemakers for lack of patriotism -and exposing the country to danger. It works the same in any country. -
    -        Hermann Goering
    -        Commander in Chief, Luftwaffe
    -
    - - - diff --git a/test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/B.java b/test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/B.java deleted file mode 100644 index b1284f83eaa..00000000000 --- a/test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/B.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2004, 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. - */ - -/** - * Doc comment here is ignored. - */ -package pkg2; - -public class B { -} diff --git a/test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/package.html b/test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/package.html deleted file mode 100644 index a15495a6a77..00000000000 --- a/test/langtools/tools/javadoc/annotations/annotatePackage/pkg2/package.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - -Albert Einstein commenting on the book -110 German Scientists Against Einstein: -"If I had been wrong it would only have needed one." - - - - diff --git a/test/langtools/tools/javadoc/annotations/annotateParams/Main.java b/test/langtools/tools/javadoc/annotations/annotateParams/Main.java deleted file mode 100644 index b40b776f0b6..00000000000 --- a/test/langtools/tools/javadoc/annotations/annotateParams/Main.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2004, 2016, 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 5031171 - * @summary Test parameter annotations. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (PackageDoc pkg : root.specifiedPackages()) { - for (ClassDoc cd : pkg.ordinaryClasses()) { - for (ConstructorDoc c : cd.constructors()) { - tester.println(c); - tester.println(); - for (Parameter p : c.parameters()) { - tester.printParameter(p); - } - tester.println(); - } - for (MethodDoc m : cd.methods()) { - tester.println(m); - tester.println(); - for (Parameter p : m.parameters()) { - tester.printParameter(p); - } - tester.println(); - } - } - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/annotations/annotateParams/expected.out b/test/langtools/tools/javadoc/annotations/annotateParams/expected.out deleted file mode 100644 index 2389c13c7c3..00000000000 --- a/test/langtools/tools/javadoc/annotations/annotateParams/expected.out +++ /dev/null @@ -1,17 +0,0 @@ -pkg1.C(boolean) - -parameter boolean p0 - annotations: - @pkg1.A("p0") - -pkg1.C.m(int, int, java.lang.String) - -parameter int p1 - annotations: - @pkg1.A("p1") -parameter int p2 -parameter String p3 - annotations: - @java.lang.Deprecated - @pkg1.A("p3") - diff --git a/test/langtools/tools/javadoc/annotations/annotateParams/pkg1/A.java b/test/langtools/tools/javadoc/annotations/annotateParams/pkg1/A.java deleted file mode 100644 index 2c996e7c52f..00000000000 --- a/test/langtools/tools/javadoc/annotations/annotateParams/pkg1/A.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2004, 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 pkg1; - -public @interface A { - String value(); -} diff --git a/test/langtools/tools/javadoc/annotations/annotateParams/pkg1/C.java b/test/langtools/tools/javadoc/annotations/annotateParams/pkg1/C.java deleted file mode 100644 index eb53ac60b34..00000000000 --- a/test/langtools/tools/javadoc/annotations/annotateParams/pkg1/C.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2004, 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 pkg1; - -public class C { - - public C(@A("p0") boolean p0) { - } - - public void m(@A("p1") int p1, - int p2, - @Deprecated @A("p3") String p3) { - } -} diff --git a/test/langtools/tools/javadoc/annotations/badVals/Main.java b/test/langtools/tools/javadoc/annotations/badVals/Main.java deleted file mode 100644 index ef1c5cec4d5..00000000000 --- a/test/langtools/tools/javadoc/annotations/badVals/Main.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2004, 2016, 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 5029874 - * @summary Verify that bad annotation values don't result in NPE - * @library ../../lib - * @modules jdk.javadoc - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - tester.printClass(cd); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/annotations/badVals/pkg1/A.java b/test/langtools/tools/javadoc/annotations/badVals/pkg1/A.java deleted file mode 100644 index 3b703bc2821..00000000000 --- a/test/langtools/tools/javadoc/annotations/badVals/pkg1/A.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2004, 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 pkg1; - -import java.lang.annotation.*; - -public class A { - - @Retention(BOGUS) // illegal - public @interface A1 {} - - @Target({BOGUS}) // illegal - public @interface A2 {} - - @Retention(true) // illegal - public @interface A3 {} - - public @interface A4 { - ElementType value() default BOGUS; // illegal - } - - public @interface A5 { - int[] value() default {true}; // illegal - } -} diff --git a/test/langtools/tools/javadoc/annotations/defaults/Main.java b/test/langtools/tools/javadoc/annotations/defaults/Main.java deleted file mode 100644 index 03ca9445d6a..00000000000 --- a/test/langtools/tools/javadoc/annotations/defaults/Main.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 4904495 - * @summary Test an annotation type with default element values, and - * annotations that use them. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; -import com.sun.javadoc.AnnotationDesc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (AnnotationTypeDoc at : - root.specifiedPackages()[0].annotationTypes()) { - tester.printAnnotationType(at); - tester.println(); - } - - for (ClassDoc cd : - root.specifiedPackages()[0].interfaces()) { - for (MethodDoc m : cd.methods()) { - tester.printMethod(m); - } - tester.println(); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/annotations/defaults/expected.out b/test/langtools/tools/javadoc/annotations/defaults/expected.out deleted file mode 100644 index dfe409bd028..00000000000 --- a/test/langtools/tools/javadoc/annotations/defaults/expected.out +++ /dev/null @@ -1,55 +0,0 @@ -@interface pkg1.A - elements: - String value() default "sigh" - int i() default 2 - double d() default 3.14 - boolean b() default true - java.lang.Class c() default java.lang.Boolean.class - java.lang.Class w() default java.lang.Long.class - ElementType e() default java.lang.annotation.ElementType.TYPE - A a() default @pkg1.A(d=2.718) - java.lang.String[] sa() default {"up", "down"} - -method pkg1.B.m1() - signature: () - () - annotations: - @pkg1.A - returns: - void -method pkg1.B.m2() - signature: () - () - annotations: - @pkg1.A("flip") - returns: - void -method pkg1.B.m3() - signature: () - () - annotations: - @pkg1.A("flop") - returns: - void -method pkg1.B.m4() - signature: () - () - annotations: - @pkg1.A(c=java.lang.Boolean.class, w=java.lang.Long.class, sa={}) - returns: - void -method pkg1.B.m5() - signature: () - () - annotations: - @pkg1.A(i=0, e=java.lang.annotation.ElementType.FIELD) - returns: - void -method pkg1.B.m6() - signature: () - () - annotations: - @pkg1.A(a=@pkg1.A("splat")) - returns: - void - diff --git a/test/langtools/tools/javadoc/annotations/defaults/pkg1/A.java b/test/langtools/tools/javadoc/annotations/defaults/pkg1/A.java deleted file mode 100644 index a4c0b4d35b8..00000000000 --- a/test/langtools/tools/javadoc/annotations/defaults/pkg1/A.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -public @interface A { - String value() default "sigh"; - int i() default 1+1; - double d() default 3.14; - boolean b() default true; - Class c() default Boolean.class; - Class w() default Long.class; - java.lang.annotation.ElementType e() default java.lang.annotation.ElementType.TYPE; - A a() default @A(d=2.718); - String[] sa() default {"up", "down"}; -} diff --git a/test/langtools/tools/javadoc/annotations/defaults/pkg1/B.java b/test/langtools/tools/javadoc/annotations/defaults/pkg1/B.java deleted file mode 100644 index 601441298a8..00000000000 --- a/test/langtools/tools/javadoc/annotations/defaults/pkg1/B.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -public interface B { - @A void m1(); - @A("flip") void m2(); - @A(value="flop") void m3(); - @A(c=Boolean.class, w=Long.class, sa={}) - void m4(); - @A(i=0, e=java.lang.annotation.ElementType.FIELD) void m5(); - @A(a=@A("splat")) void m6(); -} diff --git a/test/langtools/tools/javadoc/annotations/elementTypes/Main.java b/test/langtools/tools/javadoc/annotations/elementTypes/Main.java deleted file mode 100644 index 0f8753b8ad5..00000000000 --- a/test/langtools/tools/javadoc/annotations/elementTypes/Main.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 4904495 - * @summary Test an annotation type and annotations with elements of various - * types. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import java.util.Arrays; -import com.sun.javadoc.*; -import com.sun.javadoc.AnnotationDesc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - ClassDoc[] cds = root.classes(); - Arrays.sort(cds); - for (ClassDoc cd : cds) { - tester.printClass(cd); - tester.println(); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/annotations/elementTypes/expected.out b/test/langtools/tools/javadoc/annotations/elementTypes/expected.out deleted file mode 100644 index 7cfad55e207..00000000000 --- a/test/langtools/tools/javadoc/annotations/elementTypes/expected.out +++ /dev/null @@ -1,17 +0,0 @@ -@interface pkg1.A - elements: - int i() - double d() - boolean b() - String s() - java.lang.Class c() - java.lang.Class w() - ElementType e() - A a() - java.lang.String[] sa() - -interface pkg1.B - name: B / B / pkg1.B - annotations: - @pkg1.A(i=2, d=3.14, b=true, s="sigh", c=java.lang.Boolean.class, w=java.lang.Long.class, e=java.lang.annotation.ElementType.TYPE, a=@pkg1.A, sa={"up", "down"}) - diff --git a/test/langtools/tools/javadoc/annotations/elementTypes/pkg1/A.java b/test/langtools/tools/javadoc/annotations/elementTypes/pkg1/A.java deleted file mode 100644 index b7ab93ad5aa..00000000000 --- a/test/langtools/tools/javadoc/annotations/elementTypes/pkg1/A.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -public @interface A { - int i(); - double d(); - boolean b(); - String s(); - Class c(); - Class w(); - java.lang.annotation.ElementType e(); - A a(); - String[] sa(); -} diff --git a/test/langtools/tools/javadoc/annotations/elementTypes/pkg1/B.java b/test/langtools/tools/javadoc/annotations/elementTypes/pkg1/B.java deleted file mode 100644 index 64b37f7eb89..00000000000 --- a/test/langtools/tools/javadoc/annotations/elementTypes/pkg1/B.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -@A(i = 1+1, - d = 3.14, - b = true, - s = "sigh", - c = Boolean.class, - w = Long.class, - e = java.lang.annotation.ElementType.TYPE, - a = @A, - sa = {"up", "down"}) -public interface B { -} diff --git a/test/langtools/tools/javadoc/annotations/missing/Main.java b/test/langtools/tools/javadoc/annotations/missing/Main.java deleted file mode 100644 index 88858d316bf..00000000000 --- a/test/langtools/tools/javadoc/annotations/missing/Main.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2009 Google, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6709246 - * @summary Class-cast exception when annotation type is missing. - * @library ../../lib - * @modules jdk.javadoc - */ - -import java.io.IOException; -import com.sun.javadoc.RootDoc; -import com.sun.javadoc.ClassDoc; -import com.sun.javadoc.AnnotationDesc; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "somepackage"); - - public static void main(String... args) throws Exception { - tester.run(); - } - - public static boolean start(RootDoc root) { - for (ClassDoc d : root.classes()) { - for (AnnotationDesc a : d.annotations()) { - System.out.println(a.annotationType()); - } - } - return true; - } -} diff --git a/test/langtools/tools/javadoc/annotations/missing/somepackage/MissingAnnotationClass.java b/test/langtools/tools/javadoc/annotations/missing/somepackage/MissingAnnotationClass.java deleted file mode 100644 index d018cc580da..00000000000 --- a/test/langtools/tools/javadoc/annotations/missing/somepackage/MissingAnnotationClass.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2009 Google, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package somepackage; - -/** - * This class has an annotation which is not available. - */ -@NoSuchAnnotation -public class MissingAnnotationClass { -} diff --git a/test/langtools/tools/javadoc/annotations/shortcuts/Main.java b/test/langtools/tools/javadoc/annotations/shortcuts/Main.java deleted file mode 100644 index 2fadd859c9f..00000000000 --- a/test/langtools/tools/javadoc/annotations/shortcuts/Main.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 4904495 - * @summary Verify that "shortcuts" are used when printing annotations. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - if (cd.isInterface()) { - tester.printClass(cd); - } - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/annotations/shortcuts/expected.out b/test/langtools/tools/javadoc/annotations/shortcuts/expected.out deleted file mode 100644 index f53ff244f78..00000000000 --- a/test/langtools/tools/javadoc/annotations/shortcuts/expected.out +++ /dev/null @@ -1,6 +0,0 @@ -interface pkg1.A - name: A / A / pkg1.A - annotations: - @pkg1.Value("there is only one") - @pkg1.Array(favoriteNumbers=3.5) - @pkg1.Marker diff --git a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/A.java b/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/A.java deleted file mode 100644 index 514032fe4dd..00000000000 --- a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/A.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -@Value("there is only one") -@Array(favoriteNumbers={3.5}) -@Marker -public interface A { -} diff --git a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Array.java b/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Array.java deleted file mode 100644 index 12e3b42c1fc..00000000000 --- a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Array.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -public @interface Array { - double[] favoriteNumbers(); -} diff --git a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Marker.java b/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Marker.java deleted file mode 100644 index 57abb010167..00000000000 --- a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Marker.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -public @interface Marker { -} diff --git a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Value.java b/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Value.java deleted file mode 100644 index 026c7173443..00000000000 --- a/test/langtools/tools/javadoc/annotations/shortcuts/pkg1/Value.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -public @interface Value { - String value(); -} diff --git a/test/langtools/tools/javadoc/api/basic/APITest.java b/test/langtools/tools/javadoc/api/basic/APITest.java deleted file mode 100644 index c24bbd1890b..00000000000 --- a/test/langtools/tools/javadoc/api/basic/APITest.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * 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. - */ - -import java.io.File; -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URI; -import java.nio.file.DirectoryStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.TreeSet; -import java.util.stream.*; - -import javax.tools.JavaFileObject; -import javax.tools.SimpleJavaFileObject; - - -/* - * Superclass with utility methods for API tests. - */ -class APITest { - protected APITest() { } - - /** Marker annotation for test cases. */ - @Retention(RetentionPolicy.RUNTIME) - @interface Test { } - - /** Invoke all methods annotated with @Test. */ - protected void run() throws Exception { - for (Method m: getClass().getDeclaredMethods()) { - Annotation a = m.getAnnotation(Test.class); - if (a != null) { - testCount++; - testName = m.getName(); - System.err.println("test: " + testName); - try { - m.invoke(this, new Object[] { }); - } catch (InvocationTargetException e) { - Throwable cause = e.getCause(); - throw (cause instanceof Exception) ? ((Exception) cause) : e; - } - System.err.println(); - } - } - - if (testCount == 0) - error("no tests found"); - - StringBuilder summary = new StringBuilder(); - if (testCount != 1) - summary.append(testCount).append(" tests"); - if (errorCount > 0) { - if (summary.length() > 0) summary.append(", "); - summary.append(errorCount).append(" errors"); - } - System.err.println(summary); - if (errorCount > 0) - throw new Exception(errorCount + " errors found"); - } - - /** - * Create a directory in which to store generated doc files. - * Avoid using the default (current) directory, so that we can - * be sure that javadoc is writing in the intended location, - * not a default location. - */ - protected File getOutDir() { - File dir = new File(testName); - dir.mkdirs(); - return dir; - } - - /** - * Create a directory in which to store generated doc files. - * Avoid using the default (current) directory, so that we can - * be sure that javadoc is writing in the intended location, - * not a default location. - */ - protected File getOutDir(String path) { - File dir = new File(testName, path); - dir.mkdirs(); - return dir; - } - - protected JavaFileObject createSimpleJavaFileObject() { - return createSimpleJavaFileObject("pkg/C", "package pkg; public class C { }"); - } - - protected JavaFileObject createSimpleJavaFileObject(final String binaryName, final String content) { - return new SimpleJavaFileObject( - URI.create("myfo:///" + binaryName + ".java"), JavaFileObject.Kind.SOURCE) { - @Override - public CharSequence getCharContent(boolean ignoreEncoding) { - return content; - } - }; - } - - protected void checkFiles(File dir, Set expectFiles) { - Set files = new HashSet(); - listFiles(dir, files); - Set foundFiles = new HashSet(); - URI dirURI = dir.toURI(); - for (File f: files) - foundFiles.add(dirURI.relativize(f.toURI()).getPath()); - checkFiles(foundFiles, expectFiles, dir); - } - - protected void checkFiles(Path dir, Set expectFiles) throws IOException { - Set files = new HashSet(); - listFiles(dir, files); - Set foundFiles = new HashSet(); - for (Path f: files) { - foundFiles.add(dir.relativize(f).toString().replace(f.getFileSystem().getSeparator(), "/")); - } - checkFiles(foundFiles, expectFiles, dir); - } - - private void checkFiles(Set foundFiles, Set expectFiles, Object where) { - if (!foundFiles.equals(expectFiles)) { - Set missing = new TreeSet(expectFiles); - missing.removeAll(foundFiles); - if (!missing.isEmpty()) - error("the following files were not found in " + where + ": " + missing); - Set unexpected = new TreeSet(foundFiles); - unexpected.removeAll(expectFiles); - if (!unexpected.isEmpty()) - error("the following unexpected files were found in " + where + ": " + unexpected); - } - } - - protected void listFiles(File dir, Set files) { - for (File f: dir.listFiles()) { - if (f.isDirectory()) - listFiles(f, files); - else if (f.isFile()) - files.add(f); - } - } - - private void listFiles(Path dir, Set files) throws IOException { - try (DirectoryStream ds = Files.newDirectoryStream(dir)) { - for (Path f: ds) { - if (Files.isDirectory(f)) - listFiles(f, files); - else if (Files.isRegularFile(f)) - files.add(f); - } - } - } - - protected void error(String msg) { - System.err.println("Error: " + msg); - errorCount++; - } - - protected int testCount; - protected int errorCount; - - protected String testName; - - /** - * Standard files generated by processing a documented class pkg.C. - */ - protected static Set standardExpectFiles = new HashSet<>(Arrays.asList( - "allclasses-index.html", - "allpackages-index.html", - "constant-values.html", - "deprecated-list.html", - "help-doc.html", - "index-all.html", - "index.html", - "jquery/jquery-3.3.1.js", - "jquery/jquery-migrate-3.0.1.js", - "jquery/jquery-ui.js", - "jquery/jquery-ui.css", - "jquery/jquery-ui.min.js", - "jquery/jquery-ui.min.css", - "jquery/jquery-ui.structure.min.css", - "jquery/jquery-ui.structure.css", - "jquery/external/jquery/jquery.js", - "jquery/jszip/dist/jszip.js", - "jquery/jszip/dist/jszip.min.js", - "jquery/jszip-utils/dist/jszip-utils.js", - "jquery/jszip-utils/dist/jszip-utils.min.js", - "jquery/jszip-utils/dist/jszip-utils-ie.js", - "jquery/jszip-utils/dist/jszip-utils-ie.min.js", - "jquery/images/ui-bg_glass_65_dadada_1x400.png", - "jquery/images/ui-icons_454545_256x240.png", - "jquery/images/ui-bg_glass_95_fef1ec_1x400.png", - "jquery/images/ui-bg_glass_75_dadada_1x400.png", - "jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png", - "jquery/images/ui-icons_888888_256x240.png", - "jquery/images/ui-icons_2e83ff_256x240.png", - "jquery/images/ui-icons_cd0a0a_256x240.png", - "jquery/images/ui-bg_glass_55_fbf9ee_1x400.png", - "jquery/images/ui-icons_222222_256x240.png", - "jquery/images/ui-bg_glass_75_e6e6e6_1x400.png", - "member-search-index.js", - "member-search-index.zip", - "overview-tree.html", - "element-list", - "package-search-index.js", - "package-search-index.zip", - "pkg/C.html", - "pkg/package-summary.html", - "pkg/package-tree.html", - "resources/glass.png", - "resources/x.png", - "script.js", - "search.js", - "stylesheet.css", - "type-search-index.js", - "type-search-index.zip" - )); - - protected static Set noIndexFiles = standardExpectFiles.stream() - .filter(s -> !s.startsWith("jquery") && !s.startsWith("resources") && !s.endsWith("zip") - && !s.equals("index-all.html") && !s.equals("search.js") && !s.endsWith("-search-index.js") - && !s.equals("allclasses-index.html") && !s.equals("allpackages-index.html")) - .collect(Collectors.toSet()); -} - diff --git a/test/langtools/tools/javadoc/api/basic/DocletPathTest.java b/test/langtools/tools/javadoc/api/basic/DocletPathTest.java deleted file mode 100644 index 42d8c463cad..00000000000 --- a/test/langtools/tools/javadoc/api/basic/DocletPathTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2012, 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. - * - * 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 6493690 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main DocletPathTest - */ - -import java.io.File; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Arrays; -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.JavaCompiler; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; -import javax.tools.StandardLocation; -import javax.tools.ToolProvider; - -/** - * Tests for locating a doclet via the file manager's DOCLET_PATH. - */ -public class DocletPathTest extends APITest { - public static void main(String... args) throws Exception { - new DocletPathTest().run(); - } - - /** - * Verify that an alternate doclet can be specified, and located via - * the file manager's DOCLET_PATH. - */ - @Test - public void testDocletPath() throws Exception { - JavaFileObject docletSrc = - createSimpleJavaFileObject("DocletOnDocletPath", docletSrcText); - File docletDir = getOutDir("classes"); - JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); - try (StandardJavaFileManager cfm = compiler.getStandardFileManager(null, null, null)) { - cfm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(docletDir)); - Iterable cfiles = Arrays.asList(docletSrc); - if (!compiler.getTask(null, cfm, null, null, null, cfiles).call()) - throw new Exception("cannot compile doclet"); - } - - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir("api"); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - fm.setLocation(DocumentationTool.Location.DOCLET_PATH, Arrays.asList(docletDir)); - Iterable files = Arrays.asList(srcFile); - Iterable options = Arrays.asList("-doclet", "DocletOnDocletPath"); - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - DocumentationTask t = tool.getTask(pw, fm, null, null, options, files); - boolean ok = t.call(); - String out = sw.toString(); - System.err.println(">>" + out + "<<"); - if (ok) { - if (out.contains(TEST_STRING)) { - System.err.println("doclet executed as expected"); - } else { - error("test string not found in doclet output"); - } - } else { - error("task failed"); - } - } - } - - private static final String TEST_STRING = "DocletOnDocletPath found and running"; - - private static final String docletSrcText = - "import com.sun.javadoc.*;\n" + - "public class DocletOnDocletPath {\n" + - " public static boolean start(RootDoc doc) {\n" + - " doc.printNotice(\"" + TEST_STRING + "\");\n" + - " return true;\n" + - " }\n" + - " public static int optionLength(String option) { return 0; }\n" + - " public static boolean validOptions(String options[][],\n" + - " DocErrorReporter reporter) { return true; }\n" + - " public static LanguageVersion languageVersion() {\n" + - " return LanguageVersion.JAVA_1_1;\n" + - " }\n" + - "}\n"; -} - diff --git a/test/langtools/tools/javadoc/api/basic/DocumentationToolLocationTest.java b/test/langtools/tools/javadoc/api/basic/DocumentationToolLocationTest.java deleted file mode 100644 index d61c49635b3..00000000000 --- a/test/langtools/tools/javadoc/api/basic/DocumentationToolLocationTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2013, 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. - * - * 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 8025844 - * @summary test DocumentationTool.Location methods - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main DocumentationToolLocationTest - */ - -import javax.tools.DocumentationTool; -import java.util.Objects; - -/** - * Test for DocumentationTool.Location methods. - */ -public class DocumentationToolLocationTest extends APITest { - public static void main(String[] args) throws Exception { - new DocumentationToolLocationTest().run(); - } - - /** - * Test getName() method - */ - @Test - public void testGetName() throws Exception { - // getName() returns name(). This is for test coverage of getName. - for (DocumentationTool.Location dl: DocumentationTool.Location.values()) { - String expect = dl.name(); - String found = dl.getName(); - if (!Objects.equals(expect, found)) - throw new Exception("mismatch for " + dl + "; expected " + expect + ", found " + found); - } - } - - /** - * Test generated enum methods values() and valueOf() - */ - @Test - public void testEnumMethods() throws Exception { - DocumentationTool.Location[] values = DocumentationTool.Location.values(); - if (values.length != 3) - throw new Exception("unexpected number of values returned"); - - for (DocumentationTool.Location dl: values) { - DocumentationTool.Location expect = dl; - DocumentationTool.Location found = DocumentationTool.Location.valueOf(dl.name()); - if (!Objects.equals(expect, found)) - throw new Exception("mismatch for " + dl + "; expected " + expect + ", found " + found); - } - } -} diff --git a/test/langtools/tools/javadoc/api/basic/GetSourceVersionsTest.java b/test/langtools/tools/javadoc/api/basic/GetSourceVersionsTest.java deleted file mode 100644 index 6a6a4e9da5e..00000000000 --- a/test/langtools/tools/javadoc/api/basic/GetSourceVersionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2012, 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. - * - * 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 6493690 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main GetSourceVersionsTest - */ - -import java.util.EnumSet; -import java.util.Set; -import javax.lang.model.SourceVersion; -import javax.tools.DocumentationTool; -import javax.tools.ToolProvider; - -/** - * Tests for DocumentationTool.getSourceVersions method. - */ -public class GetSourceVersionsTest extends APITest { - public static void main(String... args) throws Exception { - new GetSourceVersionsTest().run(); - } - - /** - * Verify getSourceVersions. - */ - @Test - public void testRun() throws Exception { - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - Set found = tool.getSourceVersions(); - Set expect = EnumSet.range(SourceVersion.RELEASE_3, SourceVersion.latest()); - if (!expect.equals(found)) { - System.err.println("expect: " + expect); - System.err.println(" found: " + expect); - error("unexpected versions"); - } - } -} - diff --git a/test/langtools/tools/javadoc/api/basic/GetTask_DiagListenerTest.java b/test/langtools/tools/javadoc/api/basic/GetTask_DiagListenerTest.java deleted file mode 100644 index a090d04df4a..00000000000 --- a/test/langtools/tools/javadoc/api/basic/GetTask_DiagListenerTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2012, 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. - * - * 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 6493690 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main GetTask_DiagListenerTest - */ - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import javax.tools.Diagnostic; -import javax.tools.DiagnosticCollector; -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; -import javax.tools.ToolProvider; - -/** - * Tests for DocumentationTool.getTask diagnosticListener parameter. - */ -public class GetTask_DiagListenerTest extends APITest { - public static void main(String... args) throws Exception { - new GetTask_DiagListenerTest().run(); - } - - /** - * Verify that a diagnostic listener can be specified. - * Note that messages from the tool and doclet are imperfectly modeled - * because the DocErrorReporter API works in terms of localized strings - * and file:line positions. Therefore, messages reported via DocErrorReporter - * and simply wrapped and passed through. - */ - @Test - public void testDiagListener() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject("pkg/C", "package pkg; public error { }"); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - DiagnosticCollector dc = new DiagnosticCollector(); - DocumentationTask t = tool.getTask(null, fm, dc, null, null, files); - if (t.call()) { - throw new Exception("task succeeded unexpectedly"); - } else { - List diagCodes = new ArrayList(); - for (Diagnostic d: dc.getDiagnostics()) { - System.err.println(d); - diagCodes.add(d.getCode()); - } - List expect = Arrays.asList( - "javadoc.note.msg", // Loading source file - "compiler.err.expected3", // class, interface, or enum expected - "javadoc.note.msg"); // 1 error - if (!diagCodes.equals(expect)) - throw new Exception("unexpected diagnostics occurred"); - System.err.println("diagnostics received as expected"); - } - } - } - -} - diff --git a/test/langtools/tools/javadoc/api/basic/GetTask_DocletClassTest.java b/test/langtools/tools/javadoc/api/basic/GetTask_DocletClassTest.java deleted file mode 100644 index 275c19b02f5..00000000000 --- a/test/langtools/tools/javadoc/api/basic/GetTask_DocletClassTest.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2012, 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. - * - * 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 6493690 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules jdk.javadoc - * @build APITest - * @run main GetTask_DocletClassTest - * @key randomness - */ - -import com.sun.javadoc.DocErrorReporter; -import com.sun.javadoc.LanguageVersion; -import com.sun.javadoc.RootDoc; -import java.io.File; -import java.util.Arrays; -import java.util.Collections; -import java.util.Random; -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; -import javax.tools.ToolProvider; - -/** - * Tests for DocumentationTool.getTask docletClass parameter. - */ -public class GetTask_DocletClassTest extends APITest { - public static void main(String... args) throws Exception { - new GetTask_DocletClassTest().run(); - } - - /** - * Verify that an alternate doclet can be specified. - * - * There is no standard interface or superclass for a doclet; - * the only requirement is that it provides static methods that - * can be invoked via reflection. So, for now, the doclet is - * specified as a class. - * Because we cannot create and use a unique instance of the class, - * we verify that the doclet has been called by having it record - * (in a static field!) the comment from the last time it was invoked, - * which is randomly generated each time the test is run. - */ - @Test - public void testDoclet() throws Exception { - Random r = new Random(); - int key = r.nextInt(); - JavaFileObject srcFile = createSimpleJavaFileObject( - "pkg/C", - "package pkg; /** " + key + "*/ public class C { }"); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - DocumentationTask t = tool.getTask(null, fm, null, TestDoclet.class, null, files); - if (t.call()) { - System.err.println("task succeeded"); - if (TestDoclet.lastCaller.equals(String.valueOf(key))) - System.err.println("found expected key: " + key); - else - error("Expected key not found"); - checkFiles(outDir, Collections.emptySet()); - } else { - throw new Exception("task failed"); - } - } - } - - public static class TestDoclet { - static String lastCaller; - public static boolean start(RootDoc root) { - lastCaller = root.classNamed("pkg.C").commentText().trim(); - return true; - } - - public static int optionLength(String option) { - return 0; // default is option unknown - } - - public static boolean validOptions(String options[][], - DocErrorReporter reporter) { - return true; // default is options are valid - } - - public static LanguageVersion languageVersion() { - return LanguageVersion.JAVA_1_1; - } - } - - /** - * Verify that exceptions from a doclet are thrown as expected. - */ - @Test - public void testBadDoclet() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - DocumentationTask t = tool.getTask(null, fm, null, BadDoclet.class, null, files); - try { - t.call(); - error("call completed without exception"); - } catch (RuntimeException e) { - Throwable c = e.getCause(); - if (c.getClass() == UnexpectedError.class) - System.err.println("exception caught as expected: " + c); - else - throw e; - } - } - } - - public static class UnexpectedError extends Error { } - - public static class BadDoclet { - public static boolean start(RootDoc root) { - throw new UnexpectedError(); - } - - public static int optionLength(String option) { - return 0; // default is option unknown - } - - public static boolean validOptions(String options[][], - DocErrorReporter reporter) { - return true; // default is options are valid - } - - public static LanguageVersion languageVersion() { - return LanguageVersion.JAVA_1_1; - } - } - -} - diff --git a/test/langtools/tools/javadoc/api/basic/GetTask_FileManagerTest.java b/test/langtools/tools/javadoc/api/basic/GetTask_FileManagerTest.java deleted file mode 100644 index 46925df338c..00000000000 --- a/test/langtools/tools/javadoc/api/basic/GetTask_FileManagerTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2012, 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. - * - * 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 6493690 8024434 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules jdk.compiler/com.sun.tools.javac.file - * jdk.compiler/com.sun.tools.javac.util - * @build APITest - * @run main GetTask_FileManagerTest - */ - -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.util.Arrays; -import java.util.Set; - -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.FileObject; -import javax.tools.ForwardingJavaFileManager; -import javax.tools.JavaFileObject; -import javax.tools.JavaFileObject.Kind; -import javax.tools.StandardJavaFileManager; -import javax.tools.ToolProvider; - -import com.sun.tools.javac.file.JavacFileManager; -import com.sun.tools.javac.util.Context; - -/** - * Tests for DocumentationTool.getTask fileManager parameter. - */ -public class GetTask_FileManagerTest extends APITest { - public static void main(String... args) throws Exception { - new GetTask_FileManagerTest().run(); - } - - /** - * Verify that an alternate file manager can be specified: - * in this case, a TestFileManager. - */ - @Test - public void testFileManager() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - StandardJavaFileManager fm = new TestFileManager(); - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - DocumentationTask t = tool.getTask(null, fm, null, null, Arrays.asList("-verbose"), files); - if (t.call()) { - System.err.println("task succeeded"); - checkFiles(outDir, standardExpectFiles); - } else { - throw new Exception("task failed"); - } - } - - /** - * Verify that exceptions from a bad file manager are thrown as expected. - */ - @Test - public void testBadFileManager() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - StandardJavaFileManager fm = new TestFileManager() { - @Override - public Iterable list(Location location, - String packageName, - Set kinds, - boolean recurse) - throws IOException { - throw new UnexpectedError(); - } - }; - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(getOutDir())); - Iterable files = Arrays.asList(srcFile); - DocumentationTask t = tool.getTask(null, fm, null, null, null, files); - try { - t.call(); - error("call completed without exception"); - } catch (RuntimeException e) { - Throwable c = e.getCause(); - if (c.getClass() == UnexpectedError.class) - System.err.println("exception caught as expected: " + c); - else - throw e; - } - } - - public static class UnexpectedError extends Error { } - - /* - * A JavaFileManager which is not a JavacFileManager, even though it uses one internally for - * convenience. - */ - static class TestFileManager extends ForwardingJavaFileManager - implements StandardJavaFileManager { - TestFileManager() { - super(new JavacFileManager(new Context(), false, null)); - } - - @Override - public Iterable getJavaFileObjectsFromFiles(Iterable files) { - return fileManager.getJavaFileObjectsFromFiles(files); - } - - @Override - public Iterable getJavaFileObjects(File... files) { - return fileManager.getJavaFileObjects(files); - } - - @Override - public Iterable getJavaFileObjectsFromStrings(Iterable names) { - return fileManager.getJavaFileObjectsFromStrings(names); - } - - @Override - public Iterable getJavaFileObjects(String... names) { - return fileManager.getJavaFileObjects(names); - } - - @Override - public void setLocation(Location location, Iterable path) throws IOException { - fileManager.setLocation(location, path); - } - - @Override - public Iterable getLocation(Location location) { - return fileManager.getLocation(location); - } - - } -} diff --git a/test/langtools/tools/javadoc/api/basic/GetTask_FileObjectsTest.java b/test/langtools/tools/javadoc/api/basic/GetTask_FileObjectsTest.java deleted file mode 100644 index e5c72ab6988..00000000000 --- a/test/langtools/tools/javadoc/api/basic/GetTask_FileObjectsTest.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2012, 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. - * - * 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 6493690 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main GetTask_FileObjectsTest - */ - -import java.io.File; -import java.util.Arrays; -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; -import javax.tools.ToolProvider; - -/** - * Tests for DocumentationTool.getTask fileObjects parameter. - */ -public class GetTask_FileObjectsTest extends APITest { - public static void main(String... args) throws Exception { - new GetTask_FileObjectsTest().run(); - } - - /** - * Verify that expected output files are written via the file manager, - * for a source file read from the file system with StandardJavaFileManager. - */ - @Test - public void testStandardFileObject() throws Exception { - File testSrc = new File(System.getProperty("test.src")); - File srcFile = new File(testSrc, "pkg/C.java"); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = fm.getJavaFileObjects(srcFile); - DocumentationTask t = tool.getTask(null, fm, null, null, null, files); - if (t.call()) { - System.err.println("task succeeded"); - checkFiles(outDir, standardExpectFiles); - } else { - throw new Exception("task failed"); - } - } - } - - /** - * Verify that expected output files are written via the file manager, - * for an in-memory file object. - */ - @Test - public void testMemoryFileObject() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - DocumentationTask t = tool.getTask(null, fm, null, null, null, files); - if (t.call()) { - System.err.println("task succeeded"); - checkFiles(outDir, standardExpectFiles); - } else { - throw new Exception("task failed"); - } - } - } - - /** - * Verify bad file object is handled correctly. - */ - @Test - public void testBadFileObject() throws Exception { - File testSrc = new File(System.getProperty("test.src")); - File srcFile = new File(testSrc, "pkg/C.class"); // unacceptable file kind - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = fm.getJavaFileObjects(srcFile); - try { - DocumentationTask t = tool.getTask(null, fm, null, null, null, files); - error("getTask succeeded, no exception thrown"); - } catch (IllegalArgumentException e) { - System.err.println("exception caught as expected: " + e); - } - } - } - - /** - * Verify null is handled correctly. - */ - @Test - public void testNull() throws Exception { - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList((JavaFileObject) null); - try { - DocumentationTask t = tool.getTask(null, fm, null, null, null, files); - error("getTask succeeded, no exception thrown"); - } catch (NullPointerException e) { - System.err.println("exception caught as expected: " + e); - } - } - } - -} - diff --git a/test/langtools/tools/javadoc/api/basic/GetTask_OptionsTest.java b/test/langtools/tools/javadoc/api/basic/GetTask_OptionsTest.java deleted file mode 100644 index 36817ff20a8..00000000000 --- a/test/langtools/tools/javadoc/api/basic/GetTask_OptionsTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2012, 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. - * - * 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 6493690 8141492 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main GetTask_OptionsTest - */ - -import java.io.File; -import java.util.Arrays; -import java.util.Set; -import java.util.TreeSet; -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; -import javax.tools.ToolProvider; - -/** - * Tests for DocumentationTool.getTask options parameter. - */ -public class GetTask_OptionsTest extends APITest { - public static void main(String... args) throws Exception { - new GetTask_OptionsTest().run(); - } - - /** - * Verify that expected output files are written for given options. - */ - @Test - public void testNoIndex() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - Iterable options = Arrays.asList("-noindex"); - DocumentationTask t = tool.getTask(null, fm, null, null, options, files); - if (t.call()) { - System.err.println("task succeeded"); - Set expectFiles = new TreeSet(noIndexFiles); - checkFiles(outDir, expectFiles); - } else { - error("task failed"); - } - } - } - - /** - * Verify null is handled correctly. - */ - @Test - public void testNull() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable options = Arrays.asList((String) null); - Iterable files = Arrays.asList(srcFile); - try { - DocumentationTask t = tool.getTask(null, fm, null, null, options, files); - error("getTask succeeded, no exception thrown"); - } catch (NullPointerException e) { - System.err.println("exception caught as expected: " + e); - } - } - } - -} - diff --git a/test/langtools/tools/javadoc/api/basic/GetTask_WriterTest.java b/test/langtools/tools/javadoc/api/basic/GetTask_WriterTest.java deleted file mode 100644 index df64c96ffdc..00000000000 --- a/test/langtools/tools/javadoc/api/basic/GetTask_WriterTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2012, 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. - * - * 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 6493690 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main GetTask_WriterTest - */ - -import java.io.File; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Arrays; -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; -import javax.tools.ToolProvider; - -/** - * Tests for DocumentationTool.getTask writer parameter. - */ -public class GetTask_WriterTest extends APITest { - public static void main(String... args) throws Exception { - new GetTask_WriterTest().run(); - } - - /** - * Verify that a writer can be provided. - */ - @Test - public void testWriter() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - DocumentationTask t = tool.getTask(pw, fm, null, null, null, files); - if (t.call()) { - System.err.println("task succeeded"); - checkFiles(outDir, standardExpectFiles); - String out = sw.toString(); - System.err.println(">>" + out + "<<"); - for (String f: standardExpectFiles) { - String f1 = f.replace('/', File.separatorChar); - if (f1.endsWith(".html") && !out.contains(f1)) - throw new Exception("expected string not found: " + f1); - } - } else { - throw new Exception("task failed"); - } - } - } -} - diff --git a/test/langtools/tools/javadoc/api/basic/Task_reuseTest.java b/test/langtools/tools/javadoc/api/basic/Task_reuseTest.java deleted file mode 100644 index 536bb52aa98..00000000000 --- a/test/langtools/tools/javadoc/api/basic/Task_reuseTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2012, 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. - * - * 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 6493690 - * @summary javadoc should have a javax.tools.Tool service provider - * @modules java.compiler - * jdk.compiler - * @build APITest - * @run main Task_reuseTest - */ - -import java.io.File; -import java.util.Arrays; -import java.util.Locale; -import javax.tools.DocumentationTool; -import javax.tools.DocumentationTool.DocumentationTask; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; -import javax.tools.ToolProvider; - -/** - * Tests for reusing a documentation task. - */ -public class Task_reuseTest extends APITest { - public static void main(String... args) throws Exception { - new Task_reuseTest().run(); - } - - /** - * Verify that call can only be called once. - */ - @Test - public void testReuse() throws Exception { - DocumentationTask t = getAndRunTask(); - try { - t.call(); - error("task was reused without exception"); - } catch (IllegalStateException e) { - System.err.println("caught exception " + e); - } - } - - /** - * Verify that cannot update task after call - */ - @Test - public void testUpdateSetLocale() throws Exception { - DocumentationTask t = getAndRunTask(); - try { - t.setLocale(Locale.getDefault()); - error("task was reused without exception"); - } catch (IllegalStateException e) { - System.err.println("caught exception " + e); - } - } - - private DocumentationTask getAndRunTask() throws Exception { - JavaFileObject srcFile = createSimpleJavaFileObject(); - DocumentationTool tool = ToolProvider.getSystemDocumentationTool(); - try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) { - File outDir = getOutDir(); - fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir)); - Iterable files = Arrays.asList(srcFile); - DocumentationTask t = tool.getTask(null, fm, null, null, null, files); - if (t.call()) { - System.err.println("task succeeded"); - return t; - } else { - throw new Exception("task failed"); - } - } - } -} - diff --git a/test/langtools/tools/javadoc/api/basic/pkg/C.java b/test/langtools/tools/javadoc/api/basic/pkg/C.java deleted file mode 100644 index 74383c04f08..00000000000 --- a/test/langtools/tools/javadoc/api/basic/pkg/C.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * 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 pkg; - -public class C { } - diff --git a/test/langtools/tools/javadoc/api/basic/taglets/UnderlineTaglet.java b/test/langtools/tools/javadoc/api/basic/taglets/UnderlineTaglet.java deleted file mode 100644 index 426b0db853e..00000000000 --- a/test/langtools/tools/javadoc/api/basic/taglets/UnderlineTaglet.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * -Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * -Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of Oracle nor the names of - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any - * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND - * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY - * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY - * DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT OF OR - * RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR - * ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE - * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, - * SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER - * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF - * THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that Software is not designed, licensed or - * intended for use in the design, construction, operation or - * maintenance of any nuclear facility. - */ - -import com.sun.tools.doclets.Taglet; -import com.sun.javadoc.*; -import java.util.Map; - -/** - * A sample Inline Taglet representing {@underline ...}. This tag can - * be used in any kind of {@link com.sun.javadoc.Doc}. - * The text is underlined. For example, - * "@underline UNDERLINE ME" would be shown as: UNDERLINE ME. - * - * @author Jamie Ho - * @since 1.4 - */ - -public class UnderlineTaglet implements Taglet { - - private static final String NAME = "underline"; - - /** - * Return the name of this custom tag. - */ - public String getName() { - return NAME; - } - - /** - * @return true since this tag can be used in a field - * doc comment - */ - public boolean inField() { - return true; - } - - /** - * @return true since this tag can be used in a constructor - * doc comment - */ - public boolean inConstructor() { - return true; - } - - /** - * @return true since this tag can be used in a method - * doc comment - */ - public boolean inMethod() { - return true; - } - - /** - * @return true since this tag can be used in an overview - * doc comment - */ - public boolean inOverview() { - return true; - } - - /** - * @return true since this tag can be used in a package - * doc comment - */ - public boolean inPackage() { - return true; - } - - /** - * @return true since this - */ - public boolean inType() { - return true; - } - - /** - * Will return true since this is an inline tag. - * @return true since this is an inline tag. - */ - - public boolean isInlineTag() { - return true; - } - - /** - * Register this Taglet. - * @param tagletMap the map to register this tag to. - */ - public static void register(Map tagletMap) { - UnderlineTaglet tag = new UnderlineTaglet(); - Taglet t = (Taglet) tagletMap.get(tag.getName()); - if (t != null) { - tagletMap.remove(tag.getName()); - } - tagletMap.put(tag.getName(), tag); - } - - /** - * Given the Tag representation of this custom - * tag, return its string representation. - * @param tag he Tag representation of this custom tag. - */ - public String toString(Tag tag) { - return "" + tag.text() + ""; - } - - /** - * This method should not be called since arrays of inline tags do not - * exist. Method {@link #tostring(Tag)} should be used to convert this - * inline tag to a string. - * @param tags the array of Tags representing of this custom tag. - */ - public String toString(Tag[] tags) { - return null; - } -} - diff --git a/test/langtools/tools/javadoc/completionFailure/CompletionFailure.java b/test/langtools/tools/javadoc/completionFailure/CompletionFailure.java deleted file mode 100644 index c09e627ba10..00000000000 --- a/test/langtools/tools/javadoc/completionFailure/CompletionFailure.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - * 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 4670772 6328529 - * @summary Completion failures should be ignored in javadoc. - * @author gafter - * @modules jdk.javadoc - */ - -import com.sun.javadoc.*; -import java.util.*; - -public class CompletionFailure extends Doclet -{ - public static void main(String[] args) { - // run javadoc on package pkg - if (com.sun.tools.javadoc.Main.execute("javadoc", - "CompletionFailure", - CompletionFailure.class.getClassLoader(), - new String[]{"pkg"}) != 0) - throw new Error(); - } - - public static boolean start(com.sun.javadoc.RootDoc root) { - ClassDoc[] classes = root.classes(); - if (classes.length != 1) - throw new Error("1 " + Arrays.asList(classes)); - return true; - } -} diff --git a/test/langtools/tools/javadoc/completionFailure/pkg/A.java b/test/langtools/tools/javadoc/completionFailure/pkg/A.java deleted file mode 100644 index 3f0826064e4..00000000000 --- a/test/langtools/tools/javadoc/completionFailure/pkg/A.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2002, 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 pkg; - -public class A { -} diff --git a/test/langtools/tools/javadoc/completionFailure/pkg/B.java b/test/langtools/tools/javadoc/completionFailure/pkg/B.java deleted file mode 100644 index 7b4d1645dc1..00000000000 --- a/test/langtools/tools/javadoc/completionFailure/pkg/B.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2002, 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 pkg.A; - -public class B { -} diff --git a/test/langtools/tools/javadoc/dupOk/DupOk.java b/test/langtools/tools/javadoc/dupOk/DupOk.java deleted file mode 100644 index bba8242905a..00000000000 --- a/test/langtools/tools/javadoc/dupOk/DupOk.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - * 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 4673477 - * @summary The first definition found for each class should be documented - * @author gafter - * @modules jdk.javadoc - */ - -import com.sun.javadoc.*; -import java.util.*; - -public class DupOk extends Doclet -{ - public static void main(String[] args) { - // run javadoc on package p - if (com.sun.tools.javadoc.Main. - execute("javadoc", "DupOk", DupOk.class.getClassLoader(), - new String[] - {"-sourcepath", - System.getProperty("test.src", ".") + java.io.File.separatorChar + "sp1" + - System.getProperty("path.separator") + - System.getProperty("test.src", ".") + java.io.File.separatorChar + "sp2", - "p" - }) != 0) - throw new Error(); - } - - public static boolean start(com.sun.javadoc.RootDoc root) { - ClassDoc[] classes = root.classes(); - if (classes.length != 2) - throw new Error("1 " + Arrays.asList(classes)); - for (int i=0; i - enum constants: - Thoreau - McLuhan - Pynchon - Mencken - Allen - Vidal - Occam - Groening - Juvenal - Eco - methods: - pkg1.QuotablePerson[] values() - QuotablePerson valueOf(String) diff --git a/test/langtools/tools/javadoc/enum/enumType/pkg1/QuotablePerson.java b/test/langtools/tools/javadoc/enum/enumType/pkg1/QuotablePerson.java deleted file mode 100644 index 311bfda8a40..00000000000 --- a/test/langtools/tools/javadoc/enum/enumType/pkg1/QuotablePerson.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -/** - * Some people we love to quote. - */ -public enum QuotablePerson { - - /** "Beware of all enterprises that require new clothes." */ - Thoreau, - - /** - * "A point of view can be a dangerous luxury when substituted for - * insight and understanding." - */ - McLuhan, - - /** - * "If they can keep you asking the wrong questions, they don't have to - * worry about the answers." - */ - Pynchon, - - /** - * "For every problem, there is a solution that is simple, elegant, - * and wrong." - */ - Mencken, - - /** - * "Formerly unsolvable equations are dealt with by threats of reprisals." - */ - Allen, - - /** "It is not enough to succeed. Others must fail." */ - Vidal, - - /** "Entia non sunt multiplicanda praeter necessitatem." */ - Occam, - - /** - * "Love is a snowmobile racing across the tundra and then suddenly it - * flips over, pinning you underneath. At night, the ice weasels come." - */ - Groening, - - /** "Sed Quis custodiet ipsos custodes?" */ - Juvenal, - - /** - * "The list could surely go on, and there is nothing more wonderful - * than a list, instrument of wondrous hypotyposis." - */ - Eco -} diff --git a/test/langtools/tools/javadoc/generics/genericClass/Main.java b/test/langtools/tools/javadoc/generics/genericClass/Main.java deleted file mode 100644 index a45db3da386..00000000000 --- a/test/langtools/tools/javadoc/generics/genericClass/Main.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 4421066 - * @summary Verify the contents of the ClassDoc of a generic class. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - tester.printClass(cd); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/genericClass/expected.out b/test/langtools/tools/javadoc/generics/genericClass/expected.out deleted file mode 100644 index 968b6ee9dc0..00000000000 --- a/test/langtools/tools/javadoc/generics/genericClass/expected.out +++ /dev/null @@ -1,16 +0,0 @@ -class pkg1.A - name: A / A / pkg1.A - type parameters: - T - superclass: - java.lang.Object - fields: - T t - pkg1.A at - pkg1.A as - constructors: - A() - methods: - void m1(T) - void m2(A) - void m3(A) diff --git a/test/langtools/tools/javadoc/generics/genericClass/pkg1/A.java b/test/langtools/tools/javadoc/generics/genericClass/pkg1/A.java deleted file mode 100644 index 28206a29e4d..00000000000 --- a/test/langtools/tools/javadoc/generics/genericClass/pkg1/A.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -public class A { - public T t; - public A at; - public A as; - - public void m1(T t) {} - public void m2(A at) {} - public void m3(A as) {} -} diff --git a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/Main.java b/test/langtools/tools/javadoc/generics/genericInnerAndOuter/Main.java deleted file mode 100644 index 75b21a72cce..00000000000 --- a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/Main.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 4421066 - * @summary Verify the contents of the ClassDoc of - * a generic class with a generic inner class. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import java.util.Arrays; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - ClassDoc[] cds = root.classes(); - Arrays.sort(cds); - for (ClassDoc cd : cds) { - tester.printClass(cd); - tester.println(); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/expected.out b/test/langtools/tools/javadoc/generics/genericInnerAndOuter/expected.out deleted file mode 100644 index 1c0040ee6a0..00000000000 --- a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/expected.out +++ /dev/null @@ -1,53 +0,0 @@ -class pkg1.O - name: O / O / pkg1.O - type parameters: - T - superclass: - java.lang.Object - constructors: - O() - -class pkg1.O.I - name: I / O.I / pkg1.O.I - type parameters: - S - nested in: - pkg1.O - superclass: - java.lang.Object - constructors: - I() - methods: - void m1(O.I) - -class pkg1.X - name: X / X / pkg1.X - type parameters: - T - superclass: - java.lang.Object - constructors: - X() - -class pkg1.X.Y - name: Y / X.Y / pkg1.X.Y - nested in: - pkg1.X - superclass: - java.lang.Object - constructors: - Y() - -class pkg1.X.Y.Z - name: Z / X.Y.Z / pkg1.X.Y.Z - type parameters: - S - nested in: - pkg1.X.Y - superclass: - java.lang.Object - constructors: - Z() - methods: - void m1(X.Y.Z) - diff --git a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/O.java b/test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/O.java deleted file mode 100644 index 0eb3267c8be..00000000000 --- a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/O.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -public class O { - public class I { - public void m1(O.I a) {} - } -} diff --git a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/X.java b/test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/X.java deleted file mode 100644 index c3beb828a99..00000000000 --- a/test/langtools/tools/javadoc/generics/genericInnerAndOuter/pkg1/X.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -public class X { - public class Y { - public class Z { - public void m1(X.Y.Z a) {} - } - } -} diff --git a/test/langtools/tools/javadoc/generics/genericInterface/Main.java b/test/langtools/tools/javadoc/generics/genericInterface/Main.java deleted file mode 100644 index 5c73963d633..00000000000 --- a/test/langtools/tools/javadoc/generics/genericInterface/Main.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 4421066 - * @summary Verify the contents of the ClassDoc of a generic interface. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - tester.printClass(cd); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/genericInterface/expected.out b/test/langtools/tools/javadoc/generics/genericInterface/expected.out deleted file mode 100644 index 2332f210b65..00000000000 --- a/test/langtools/tools/javadoc/generics/genericInterface/expected.out +++ /dev/null @@ -1,6 +0,0 @@ -interface pkg1.A - name: A / A / pkg1.A - type parameters: - T - methods: - void m1(T) diff --git a/test/langtools/tools/javadoc/generics/genericInterface/pkg1/A.java b/test/langtools/tools/javadoc/generics/genericInterface/pkg1/A.java deleted file mode 100644 index d20c2435a26..00000000000 --- a/test/langtools/tools/javadoc/generics/genericInterface/pkg1/A.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -public interface A { - void m1(T t); -} diff --git a/test/langtools/tools/javadoc/generics/genericMethod/Main.java b/test/langtools/tools/javadoc/generics/genericMethod/Main.java deleted file mode 100644 index d0b26f3dd7b..00000000000 --- a/test/langtools/tools/javadoc/generics/genericMethod/Main.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 4421066 - * @summary Verify the reading of generic methods and constructors. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - for (ConstructorDoc c : cd.constructors()) - tester.printConstructor(c); - for (MethodDoc m : cd.methods()) - tester.printMethod(m); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/genericMethod/expected.out b/test/langtools/tools/javadoc/generics/genericMethod/expected.out deleted file mode 100644 index 8b051a1e669..00000000000 --- a/test/langtools/tools/javadoc/generics/genericMethod/expected.out +++ /dev/null @@ -1,20 +0,0 @@ -constructor pkg1.A() - signature: () - () - type parameters: - T -method pkg1.A.m1(T) - signature: (T) - (T) - type parameters: - T - returns: - void -method pkg1.A.m2(T, U) - signature: (T, U) - (T, U) - type parameters: - T extends java.lang.Number - U - returns: - void diff --git a/test/langtools/tools/javadoc/generics/genericMethod/pkg1/A.java b/test/langtools/tools/javadoc/generics/genericMethod/pkg1/A.java deleted file mode 100644 index 4a7749c4bf2..00000000000 --- a/test/langtools/tools/javadoc/generics/genericMethod/pkg1/A.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -public class A { - public A() {} - public void m1(T t) {} - public void m2(T t, U u) {} -} diff --git a/test/langtools/tools/javadoc/generics/genericSuper/Main.java b/test/langtools/tools/javadoc/generics/genericSuper/Main.java deleted file mode 100644 index b83df575d89..00000000000 --- a/test/langtools/tools/javadoc/generics/genericSuper/Main.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 4421066 - * @summary Verify the contents of the ClassDoc of a generic class. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import java.util.Arrays; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = - new OldToolTester("Main", "pkg1", "-package"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - ClassDoc[] cds = root.classes(); - Arrays.sort(cds); - for (ClassDoc cd : cds) { - tester.printClass(cd); - tester.println(); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/genericSuper/expected.out b/test/langtools/tools/javadoc/generics/genericSuper/expected.out deleted file mode 100644 index 2faad58662d..00000000000 --- a/test/langtools/tools/javadoc/generics/genericSuper/expected.out +++ /dev/null @@ -1,27 +0,0 @@ -class pkg1.A - name: A / A / pkg1.A - type parameters: - V - W - superclass: - pkg1.S - interfaces: - pkg1.I - constructors: - A() - -interface pkg1.I - name: I / I / pkg1.I - type parameters: - R - -class pkg1.S - name: S / S / pkg1.S - type parameters: - T - U - superclass: - java.lang.Object - constructors: - S() - diff --git a/test/langtools/tools/javadoc/generics/genericSuper/pkg1/A.java b/test/langtools/tools/javadoc/generics/genericSuper/pkg1/A.java deleted file mode 100644 index c12caf96f51..00000000000 --- a/test/langtools/tools/javadoc/generics/genericSuper/pkg1/A.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -class S { -} - -interface I { -} - -public class A extends S implements I { -} diff --git a/test/langtools/tools/javadoc/generics/supertypes/Main.java b/test/langtools/tools/javadoc/generics/supertypes/Main.java deleted file mode 100644 index 2c7994556a3..00000000000 --- a/test/langtools/tools/javadoc/generics/supertypes/Main.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 4922918 - * @summary Check supertypes and superinterfaces of parameterized types. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import java.util.Comparator; -import java.util.Arrays; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - ClassDoc[] cds = root.classes(); - Arrays.sort(cds); - for (ClassDoc cd : cds) { - ParameterizedType arrayList = - cd.superclassType().asParameterizedType(); - tester.println(arrayList); - tester.println(); - - tester.println(arrayList.superclassType()); - Type[] interfaces = arrayList.interfaceTypes(); - // Sort interfaces by type name, for consistent output. - Arrays.sort(interfaces, - new Comparator() { - public int compare(Type t1, Type t2) { - String name1 = t1.qualifiedTypeName(); - String name2 = t2.qualifiedTypeName(); - return name1.compareTo(name2); - } - }); - for (Type t : interfaces) { - tester.println(t); - } - tester.println(); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/supertypes/expected.out b/test/langtools/tools/javadoc/generics/supertypes/expected.out deleted file mode 100644 index d3dd3ce697d..00000000000 --- a/test/langtools/tools/javadoc/generics/supertypes/expected.out +++ /dev/null @@ -1,16 +0,0 @@ -java.util.ArrayList - -java.util.AbstractList -java.io.Serializable -java.lang.Cloneable -java.util.List -java.util.RandomAccess - -java.util.ArrayList - -java.util.AbstractList -java.io.Serializable -java.lang.Cloneable -java.util.List -java.util.RandomAccess - diff --git a/test/langtools/tools/javadoc/generics/supertypes/pkg1/A.java b/test/langtools/tools/javadoc/generics/supertypes/pkg1/A.java deleted file mode 100644 index 202d8452035..00000000000 --- a/test/langtools/tools/javadoc/generics/supertypes/pkg1/A.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -import java.util.ArrayList; - -public class A extends ArrayList { -} diff --git a/test/langtools/tools/javadoc/generics/supertypes/pkg1/B.java b/test/langtools/tools/javadoc/generics/supertypes/pkg1/B.java deleted file mode 100644 index 3991e7cd3f6..00000000000 --- a/test/langtools/tools/javadoc/generics/supertypes/pkg1/B.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -import java.util.ArrayList; - -public class B extends ArrayList { -} diff --git a/test/langtools/tools/javadoc/generics/throwsGeneric/Main.java b/test/langtools/tools/javadoc/generics/throwsGeneric/Main.java deleted file mode 100644 index b46a4467d31..00000000000 --- a/test/langtools/tools/javadoc/generics/throwsGeneric/Main.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 4421066 - * @summary Verify the reading of generic methods and constructors. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - for (MethodDoc m : cd.methods()) - tester.printMethod(m); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/throwsGeneric/expected.out b/test/langtools/tools/javadoc/generics/throwsGeneric/expected.out deleted file mode 100644 index 99e65992a33..00000000000 --- a/test/langtools/tools/javadoc/generics/throwsGeneric/expected.out +++ /dev/null @@ -1,16 +0,0 @@ -method pkg1.A.m1() - signature: () - () - throws: - T extends java.lang.Throwable - returns: - void -method pkg1.A.m2() - signature: () - () - type parameters: - U extends java.lang.Throwable - throws: - U extends java.lang.Throwable - returns: - void diff --git a/test/langtools/tools/javadoc/generics/throwsGeneric/pkg1/A.java b/test/langtools/tools/javadoc/generics/throwsGeneric/pkg1/A.java deleted file mode 100644 index 083d718d173..00000000000 --- a/test/langtools/tools/javadoc/generics/throwsGeneric/pkg1/A.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -public interface A { - void m1() throws T; - void m2() throws U; -} diff --git a/test/langtools/tools/javadoc/generics/tparamCycle/Main.java b/test/langtools/tools/javadoc/generics/tparamCycle/Main.java deleted file mode 100644 index 777072a91d3..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamCycle/Main.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 4421066 - * @summary Check a type parameter whose bound cycles back on itself. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - } - - public static boolean start(RootDoc root) { - ClassDoc cd = root.classes()[0]; - System.out.println("*** " + cd); - TypeVariable E = cd.typeParameters()[0]; - System.out.println("*** " + E); - Type bound = E.bounds()[0]; - System.out.println("*** " + bound); - - // Verify that we have an instantiation of Enum, and not - // the generic interface. - ParameterizedType enumE = (ParameterizedType)bound; - - if (enumE.asClassDoc() != cd) { - throw new Error("Type declaration and type use don't match up."); - } else { - return true; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/tparamCycle/pkg1/LikeEnum.java b/test/langtools/tools/javadoc/generics/tparamCycle/pkg1/LikeEnum.java deleted file mode 100644 index 2369640e650..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamCycle/pkg1/LikeEnum.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -public interface LikeEnum> { -} diff --git a/test/langtools/tools/javadoc/generics/tparamTagOnMethod/Main.java b/test/langtools/tools/javadoc/generics/tparamTagOnMethod/Main.java deleted file mode 100644 index 28df71fd781..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamTagOnMethod/Main.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 4421066 - * @summary Verify the reading of type parameter tags on methods. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - for (MethodDoc m : cd.methods()) { - tester.printMethod(m); - } - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/tparamTagOnMethod/expected.out b/test/langtools/tools/javadoc/generics/tparamTagOnMethod/expected.out deleted file mode 100644 index 1d8c7ec9a55..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamTagOnMethod/expected.out +++ /dev/null @@ -1,12 +0,0 @@ -method pkg1.A.m1(T, U) - signature: (T, U) - (T, U) - @param the kind of thing - @param the other kind of thing - @param t the thing itself - @param u the other thing - type parameters: - T - U - returns: - void diff --git a/test/langtools/tools/javadoc/generics/tparamTagOnMethod/pkg1/A.java b/test/langtools/tools/javadoc/generics/tparamTagOnMethod/pkg1/A.java deleted file mode 100644 index a289efa7bd2..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamTagOnMethod/pkg1/A.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -public interface A { - /** - * @param the kind of thing - * @param the other kind of thing - * @param t the thing itself - * @param u the other thing - */ - public void m1(T t, U u); -} diff --git a/test/langtools/tools/javadoc/generics/tparamTagOnType/Main.java b/test/langtools/tools/javadoc/generics/tparamTagOnType/Main.java deleted file mode 100644 index 970782b1c51..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamTagOnType/Main.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 4421066 - * @summary Verify the reading of a type parameter tag on an interface. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - tester.printClass(cd); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/tparamTagOnType/expected.out b/test/langtools/tools/javadoc/generics/tparamTagOnType/expected.out deleted file mode 100644 index 1b4da64b8cc..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamTagOnType/expected.out +++ /dev/null @@ -1,5 +0,0 @@ -interface pkg1.A - name: A / A / pkg1.A - type parameters: - T - @param the type parameter diff --git a/test/langtools/tools/javadoc/generics/tparamTagOnType/pkg1/A.java b/test/langtools/tools/javadoc/generics/tparamTagOnType/pkg1/A.java deleted file mode 100644 index 22f18693043..00000000000 --- a/test/langtools/tools/javadoc/generics/tparamTagOnType/pkg1/A.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -/** - * @param the type parameter - */ -public interface A { -} diff --git a/test/langtools/tools/javadoc/generics/wildcards/Main.java b/test/langtools/tools/javadoc/generics/wildcards/Main.java deleted file mode 100644 index a45db3da386..00000000000 --- a/test/langtools/tools/javadoc/generics/wildcards/Main.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 4421066 - * @summary Verify the contents of the ClassDoc of a generic class. - * @library ../../lib - * @modules jdk.javadoc - * @compile ../../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = new OldToolTester("Main", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - tester.printClass(cd); - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/generics/wildcards/expected.out b/test/langtools/tools/javadoc/generics/wildcards/expected.out deleted file mode 100644 index 686997b5a72..00000000000 --- a/test/langtools/tools/javadoc/generics/wildcards/expected.out +++ /dev/null @@ -1,16 +0,0 @@ -class pkg1.A - name: A / A / pkg1.A - type parameters: - T - superclass: - java.lang.Object - fields: - pkg1.A f1 - pkg1.A f2 - pkg1.A f3 - constructors: - A() - methods: - void m1(A) - void m2(A) - void m3(A) diff --git a/test/langtools/tools/javadoc/generics/wildcards/pkg1/A.java b/test/langtools/tools/javadoc/generics/wildcards/pkg1/A.java deleted file mode 100644 index 8c832ad5fef..00000000000 --- a/test/langtools/tools/javadoc/generics/wildcards/pkg1/A.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2003, 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 pkg1; - -public class A { - public A f1; - public A f2; - public A f3; - - public void m1(A p1) {} - public void m2(A p2) {} - public void m3(A p3) {} -} diff --git a/test/langtools/tools/javadoc/imports/I.java b/test/langtools/tools/javadoc/imports/I.java deleted file mode 100644 index 49768d4b916..00000000000 --- a/test/langtools/tools/javadoc/imports/I.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2004, 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. - */ - -// The following imported class is bogus, but should still be returned -// when inquired of. -import bo.o.o.o.Gus; - -public interface I { -} diff --git a/test/langtools/tools/javadoc/imports/MissingImport.java b/test/langtools/tools/javadoc/imports/MissingImport.java deleted file mode 100644 index 15fdc262931..00000000000 --- a/test/langtools/tools/javadoc/imports/MissingImport.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * 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 5012972 - * @summary ClassDoc.getImportedClasses should return a class even if - * it's not in the classpath. - * @modules jdk.javadoc - */ - -import com.sun.javadoc.*; - - -public class MissingImport extends Doclet { - - public static void main(String[] args) { - String thisFile = "" + - new java.io.File(System.getProperty("test.src", "."), - "I.java"); - - if (com.sun.tools.javadoc.Main.execute( - "javadoc", - "MissingImport", - MissingImport.class.getClassLoader(), - new String[] {thisFile}) != 0) - throw new Error("Javadoc encountered warnings or errors."); - } - - /* - * The world's simplest doclet. - */ - public static boolean start(RootDoc root) { - ClassDoc c = root.classNamed("I"); - ClassDoc[] imps = c.importedClasses(); - if (imps.length == 0 || - !imps[0].qualifiedName().equals("bo.o.o.o.Gus")) { - throw new Error("Import bo.o.o.o.Gus not found"); - } - return true; - } -} diff --git a/test/langtools/tools/javadoc/lib/OldToolTester.java b/test/langtools/tools/javadoc/lib/OldToolTester.java deleted file mode 100644 index 98bdda499ec..00000000000 --- a/test/langtools/tools/javadoc/lib/OldToolTester.java +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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. - */ - -/* - * A utility used to invoke and test the javadoc tool. - * - * @author Scott Seligman - */ - - -import java.io.*; -import java.util.*; -import com.sun.javadoc.*; - - -public class OldToolTester { - - protected final String TEST_SRC = System.getProperty("test.src", "."); - protected final String TEST_CLASSES = System.getProperty("test.classes", - "."); - private final String DEFAULT_ARGS[] = { - "-sourcepath", TEST_SRC, - }; - - private final File outputFile = new File(TEST_CLASSES, "testrun.out"); - private final File expectedOutputFile = new File(TEST_SRC, "expected.out"); -// private final File bootstrapMarkerFile = new File("bootstrap"); - - // True if we should "set expectations" by writing the expected output file - // rather than reading it and comparing. -// private final boolean bootstrap = bootstrapMarkerFile.isFile(); - - private String docletName; - private String[] args; - private Writer out = null; - - - /* - * Individual tests can extend this to create generics-aware doclets. - */ - public static abstract class Doclet extends com.sun.javadoc.Doclet { - public static LanguageVersion languageVersion() { - return LanguageVersion.JAVA_1_5; - } - } - - - public OldToolTester(String docletName) { - this(docletName, new String[0]); - } - - public OldToolTester(String docletName, String... additionalArgs) { - this.docletName = docletName; - - int len = DEFAULT_ARGS.length + additionalArgs.length; - args = new String[len]; - System.arraycopy(DEFAULT_ARGS, 0, args, 0, DEFAULT_ARGS.length); - System.arraycopy(additionalArgs, 0, args, DEFAULT_ARGS.length, - additionalArgs.length); - - try { - out = new BufferedWriter(new FileWriter(outputFile)); - } catch (IOException e) { - throw new Error("Could not open output file " + outputFile); - } - } - - public void run() throws IOException { - try { - if (com.sun.tools.javadoc.Main.execute("javadoc", - docletName, - getClass().getClassLoader(), - args) != 0) { - throw new Error("Javadoc errors encountered."); - } - System.out.println("--> Output written to " + outputFile); - } finally { - out.close(); - } - } - - /* - * Compare output of test run to expected output. - * Throw an Error if they don't match. - */ - public void verify() throws IOException { - BufferedReader thisRun = - new BufferedReader(new FileReader(outputFile)); - BufferedReader expected = - new BufferedReader(new FileReader(expectedOutputFile)); - - for (int lineNum = 1; true; lineNum++) { - String line1 = thisRun.readLine(); - String line2 = expected.readLine(); - if (line1 == null && line2 == null) { - return; // EOF with all lines matching - } - if (line1 == null || !line1.equals(line2)) { - throw new Error(outputFile + ":" + lineNum + - ": output doesn't match"); - } - } - } - - - public void println(Object o) throws IOException { - prln(0, o); - } - - public void println() throws IOException { - prln(); - } - - public void printPackage(PackageDoc p) throws IOException { - prPackage(0, p); - } - - public void printClass(ClassDoc cd) throws IOException { - if (cd.isAnnotationType()) - printAnnotationType((AnnotationTypeDoc)cd); - else - prClass(0, cd); - } - - public void printAnnotationType(AnnotationTypeDoc at) throws IOException { - prAnnotationType(0, at); - } - - public void printField(FieldDoc f) throws IOException { - prField(0, f); - } - - public void printParameter(Parameter p) throws IOException { - prParameter(0, p); - } - - public void printMethod(MethodDoc m) throws IOException { - prln(0, "method " + m); - prMethod(0, m); - } - - public void printAnnotationTypeElement(AnnotationTypeElementDoc e) - throws IOException { - prln(0, "element " + e); - prMethod(0, e); - } - - public void printConstructor(ConstructorDoc c) throws IOException { - prln(0, "constructor " + c); - prExecutable(0, c); - } - - - private void prPackage(int off, PackageDoc p) throws IOException { - prln(off, "package " + p); - prAnnotations(off + 2, p.annotations()); - } - - private void prClass(int off, ClassDoc cd) throws IOException { - prln(off, - (cd.isInterface() ? "interface" : cd.isEnum() ? "enum" : "class") - + " " + cd); - prln(off + 2, "name: " + cd.simpleTypeName() + " / " + - cd.typeName() + " / " + cd.qualifiedTypeName()); - prAnnotations(off + 2, cd.annotations()); - prLabel(off + 2, "type parameters"); - for (Type t : cd.typeParameters()) - prln(off + 4, t); - prParamTags(off + 2, cd.typeParamTags()); - prLabel(off + 2, "nested in"); - prln(off + 4, cd.containingClass()); - prLabel(off + 2, "superclass"); - prln(off + 4, cd.superclassType()); - prLabel(off + 2, "interfaces"); - Type[] ts = cd.interfaceTypes(); - Arrays.sort(ts); - for (Type t : ts) - prln(off + 4, t); - prLabel(off + 2, "enum constants"); - for (FieldDoc f : cd.enumConstants()) - prln(off + 4, f.name()); - prLabel(off + 2, "fields"); - for (FieldDoc f : cd.fields()) - prln(off + 4, f.type() + " " + f.name()); - prLabel(off + 2, "constructors"); - for (ConstructorDoc c : cd.constructors()) - prln(off + 4, c.name() + c.flatSignature()); - prLabel(off + 2, "methods"); - for (MethodDoc m : cd.methods()) - prln(off + 4, typeUseString(m.returnType()) + " " + - m.name() + m.flatSignature()); - } - - private void prAnnotationType(int off, AnnotationTypeDoc at) - throws IOException { - prln(off, "@interface " + at); - prAnnotations(off + 2, at.annotations()); - prLabel(off + 2, "elements"); - for (AnnotationTypeElementDoc e : at.elements()) { - String def = (e.defaultValue() == null) - ? "" - : " default " + e.defaultValue(); - prln(off + 4, typeUseString(e.returnType()) + " " + e.name() + - e.flatSignature() + def); - } - } - - private void prField(int off, FieldDoc f) throws IOException { - prln(off, "field " + typeUseString(f.type()) + " " + f.name()); - prAnnotations(off + 2, f.annotations()); - } - - private void prParameter(int off, Parameter p) throws IOException { - prln(off, "parameter " + p); - prAnnotations(off + 2, p.annotations()); - } - - private void prMethod(int off, MethodDoc m) throws IOException { - prExecutable(off, m); - prLabel(off + 2, "returns"); - prln(off + 4, typeUseString(m.returnType())); - prLabel(off + 2, "overridden type"); - prln(off + 4, m.overriddenType()); - } - - private void prExecutable(int off, ExecutableMemberDoc m) - throws IOException { - if (!m.isAnnotationTypeElement()) { - prln(off + 2, "signature: " + m.flatSignature()); - prln(off + 2, " " + m.signature()); - } - prAnnotations(off + 2, m.annotations()); - prParamTags(off + 2, m.typeParamTags()); - prParamTags(off + 2, m.paramTags()); - prLabel(off + 2, "type parameters"); - for (Type t : m.typeParameters()) - prln(off + 4, t); - prLabel(off + 2, "throws"); - Type[] ts = m.thrownExceptionTypes(); - Arrays.sort(ts); - for (Type t : ts) - prln(off + 4, t); - } - - private void prAnnotations(int off, AnnotationDesc[] as) - throws IOException { - prLabel(off, "annotations"); - for (AnnotationDesc a : as) - prln(off + 2, a.toString()); - } - - private void prParamTags(int off, ParamTag tags[]) throws IOException { - for (ParamTag tag : tags) - prParamTag(off, tag); - } - - private void prParamTag(int off, ParamTag tag) throws IOException { - String name = tag.parameterName(); - if (tag.isTypeParameter()) name = "<" + name + ">"; - prln(off, "@param " + name + " " + tag.parameterComment()); - } - - - private String typeUseString(Type t) { - return (t instanceof ClassDoc || t instanceof TypeVariable) - ? t.typeName() - : t.toString(); - } - - - // Labels queued for possible printing. Innermost is first in list. - List labels = new ArrayList(); - - // Print label if its section is nonempty. - void prLabel(int off, String s) { - while (!labels.isEmpty() && labels.get(0).off >= off) - labels.remove(0); - labels.add(0, new Line(off, s)); - } - - // Print queued labels with offsets less than "off". - void popLabels(int off) throws IOException { - while (!labels.isEmpty()) { - Line label = labels.remove(0); - if (label.off < off) - prln(label.off, label.o + ":"); - } - } - - // Print "o" at given offset. - void pr(int off, Object o) throws IOException { - popLabels(off); - for (int i = 0; i < off; i++) - out.write(' '); - if (o != null) - out.write(o.toString()); - } - - // Print "o" (if non-null) at given offset, then newline. - void prln(int off, Object o) throws IOException { - if (o != null) { - pr(off, o); - prln(); - } - } - - // Print newline. - void prln() throws IOException { - out.write('\n'); // don't want platform-dependent separator - } - - - static class Line { - int off; - Object o; - Line(int off, Object o) { this.off = off; this.o = o; } - } -} diff --git a/test/langtools/tools/javadoc/lib/ToyDoclet.java b/test/langtools/tools/javadoc/lib/ToyDoclet.java deleted file mode 100644 index 66457cfac7f..00000000000 --- a/test/langtools/tools/javadoc/lib/ToyDoclet.java +++ /dev/null @@ -1,78 +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. - */ - -import java.util.Arrays; - -import com.sun.javadoc.ClassDoc; -import com.sun.javadoc.PackageDoc; -import com.sun.javadoc.ProgramElementDoc; -import com.sun.javadoc.RootDoc; - -@SuppressWarnings("deprecation") -public class ToyDoclet { - - public static boolean start(RootDoc root) { - String whoami = "I am a toy doclet"; - root.printNotice("Notice: " + whoami); - boolean status = false; - for (ClassDoc cls : root.classes()) { - if (!status) status = true; - root.printNotice("Classes: " + cls); - printClassMembers(root, cls); - } - for (ClassDoc cls : root.specifiedClasses()) { - if (!status) status = true; - root.printNotice("Specified-classes: " + cls); - printClassMembers(root, cls); - } - for (PackageDoc pkg : root.specifiedPackages()) { - if (!status) status = true; - root.printNotice("Specified-packages: " + pkg); - } - return status; - } - - static void printClassMembers(RootDoc root, ClassDoc cls) { - root.printNotice("Members for: " + cls); - root.printNotice(" extends " + Arrays.asList(cls.superclass())); - root.printNotice(" Fields: "); - printMembers(root, cls.fields()); - root.printNotice(" Constructor: "); - printMembers(root, cls.constructors()); - root.printNotice(" Method: "); - printMembers(root, cls.methods()); - if (cls.superclass() != null && !cls.superclassType().toString().equals("java.lang.Object")) - printClassMembers(root, cls.superclass()); - } - - static void printMembers(RootDoc root, ProgramElementDoc[] pgmDocs) { - for (ProgramElementDoc pgmDoc : pgmDocs) { - root.printNotice(" " + pgmDoc + ", Comments: " + pgmDoc.getRawCommentText()); - } - } - - public static int optionLength(String option) { - System.out.println("option: " + option); - return 0; // all options are unsupported - } -} diff --git a/test/langtools/tools/javadoc/nestedClass/NestedClass.java b/test/langtools/tools/javadoc/nestedClass/NestedClass.java deleted file mode 100644 index 2fb8f26b314..00000000000 --- a/test/langtools/tools/javadoc/nestedClass/NestedClass.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - * 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 4694497 - * @summary BDoclet API: Bad ClassDoc for nested classes when built from .class files - * @author gafter - * @modules jdk.javadoc - * @compile NestedClass.java NestedClassB.java - * @run main NestedClass - */ - -import com.sun.javadoc.*; -import java.util.*; - -public class NestedClass extends Doclet -{ - public NestedClassB b; - - public static void main(String[] args) { - if (com.sun.tools.javadoc.Main. - execute("javadoc", "NestedClass", NestedClass.class.getClassLoader(), - new String[] {System.getProperty("test.src", ".") + - java.io.File.separatorChar + - "NestedClass.java"}) - != 0) - throw new Error(); - } - - public static boolean start(com.sun.javadoc.RootDoc root) { - ClassDoc[] classes = root.classes(); - if (classes.length != 1) - throw new Error("1 " + Arrays.asList(classes)); - ClassDoc self = classes[0]; - FieldDoc B = self.fields()[0]; - ClassDoc[] Binner = B.type().asClassDoc().innerClasses(); - return Binner.length == 1; - } -} diff --git a/test/langtools/tools/javadoc/nestedClass/NestedClassB.java b/test/langtools/tools/javadoc/nestedClass/NestedClassB.java deleted file mode 100644 index 5f1d73a7890..00000000000 --- a/test/langtools/tools/javadoc/nestedClass/NestedClassB.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2002, 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. - */ - -public class NestedClassB { - public static class Inner {} -} diff --git a/test/langtools/tools/javadoc/nonConstExprs/Test.java b/test/langtools/tools/javadoc/nonConstExprs/Test.java deleted file mode 100644 index fbc5062639d..00000000000 --- a/test/langtools/tools/javadoc/nonConstExprs/Test.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2013, 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 8010310 - * @summary Error processing sources with -private - * @modules jdk.javadoc - */ - -import java.io.File; - -public class Test { - public static void main(String... args) throws Exception { - File testSrc = new File(System.getProperty("test.src")); - String[] jdoc_args = { - new File(testSrc, Test.class.getSimpleName() + ".java").getPath() - }; - int rc = com.sun.tools.javadoc.Main.execute(jdoc_args); - if (rc != 0) - throw new Exception("unexpected return code from javadoc: " + rc); - } - - static int array[] = { 1, 2, 3}; - static int method(int p) { return p; } - static int value = 0; - - public int not_static_not_final = 1; - public static int static_not_final = 2; - public final int not_static_final = 3; - public static final int static_final = 4; - - public static final int array_index = array[0]; - public static final int method_call = method(0); - public static final int inner_class = new Test() { }.method(0); - public static final int new_class = new Test().method(0); - public static final int pre_inc = ++value; - public static final int pre_dec = --value; - public static final int post_inc = value++; - public static final int post_dec = value--; -} - diff --git a/test/langtools/tools/javadoc/outputRedirect/Test.java b/test/langtools/tools/javadoc/outputRedirect/Test.java deleted file mode 100644 index ba03899d4c6..00000000000 --- a/test/langtools/tools/javadoc/outputRedirect/Test.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2002, 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. - * - * 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 4587487 - * @summary com.sun.tools.javadoc.Main.execute ignores PrintWriters - * @author gafter - * @modules jdk.javadoc - * @compile p/OutputRedirect.java - * @run main p.OutputRedirect - */ - -// jtreg description-only file diff --git a/test/langtools/tools/javadoc/outputRedirect/p/OutputRedirect.java b/test/langtools/tools/javadoc/outputRedirect/p/OutputRedirect.java deleted file mode 100644 index 9f37ddeb55b..00000000000 --- a/test/langtools/tools/javadoc/outputRedirect/p/OutputRedirect.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2002, 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 p; - -import java.io.*; -import com.sun.tools.javadoc.Main; - -public class OutputRedirect { - - public static void main(String[] args) { - PrintStream originalOutput = System.out; - try { - doTest(); - } finally { - // restore things - System.setOut(originalOutput); - } - } - - static void doTest() { - ByteArrayOutputStream redirectedOutput = new ByteArrayOutputStream(); - PrintStream originalOutput = System.out; - - // redirect System.out to a buffer - System.setOut(new PrintStream(redirectedOutput)); - - PrintWriter sink = new PrintWriter(new ByteArrayOutputStream()); - - // execute javadoc - int result = Main.execute("javadoc", sink, sink, sink, - "com.sun.tools.doclets.standard.Standard", - new String[] {"p"} - ); - - - // test whether javadoc did any output to System.out - if (redirectedOutput.toByteArray().length > 0) { - originalOutput.println("Test failed; here's what javadoc wrote on its standard output:"); - originalOutput.println(redirectedOutput.toString()); - throw new Error("javadoc output wasn\'t properly redirected"); - } else if (result != 0) { - throw new Error("javadoc run failed"); - } else { - originalOutput.println("OK, good"); - } - } -} diff --git a/test/langtools/tools/javadoc/parser/7091528/T7091528.java b/test/langtools/tools/javadoc/parser/7091528/T7091528.java deleted file mode 100644 index 41d55d9559c..00000000000 --- a/test/langtools/tools/javadoc/parser/7091528/T7091528.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2009, 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 7091528 8029145 8037484 - * @summary ensures javadoc parses unique source files and ignores all class files - * @modules jdk.javadoc/com.sun.tools.doclets.standard - * @library /tools/javadoc/lib - * @build ToyDoclet - * @compile p/C1.java p/q/C2.java - * @run main T7091528 - */ - -import java.io.File; -import java.io.PrintWriter; -import java.io.StringWriter; - -public class T7091528 { - public static void main(String... args) { - new T7091528().run(); - } - void run() { - File testSrc = new File(System.getProperty("test.src")); - File testClasses = new File(System.getProperty("test.classes")); - // 7091528, tests if class files are being ignored - runTest( - "-sourcepath", testClasses + File.pathSeparator + testSrc, - "-subpackages", - "p"); - // 8029145, tests if unique source files are parsed - runTest( - "-sourcepath", testSrc.getAbsolutePath(), - "-subpackages", - "p:p.q"); - File testPkgDir = new File(testSrc, "p"); - File testFile = new File(testPkgDir, "C3.java"); - runTest( - "-sourcepath", testSrc.getAbsolutePath(), - testFile.getAbsolutePath(), - "p"); - runTest( - "-classpath", testSrc.getAbsolutePath(), - testFile.getAbsolutePath(), - "p"); - - } - void runTest(String... args) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - int rc = com.sun.tools.javadoc.Main.execute("example", pw, pw, pw, - "ToyDoclet", getClass().getClassLoader(), args); - pw.close(); - - String out = sw.toString(); - if (!out.isEmpty()) { - System.err.println(out); - } - - if (rc != 0) - throw new Error("javadoc failed: exit code = " + rc); - - if (out.matches("(?s).*p/[^ ]+\\.class.*")) - throw new Error("reading .class files"); - } -} diff --git a/test/langtools/tools/javadoc/parser/7091528/p/C1.java b/test/langtools/tools/javadoc/parser/7091528/p/C1.java deleted file mode 100644 index 7d8ad26643f..00000000000 --- a/test/langtools/tools/javadoc/parser/7091528/p/C1.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2011, 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 p1; - -/** This is class C1. */ -public class C1 { } - diff --git a/test/langtools/tools/javadoc/parser/7091528/p/C3.java b/test/langtools/tools/javadoc/parser/7091528/p/C3.java deleted file mode 100644 index 4653b5a6ce0..00000000000 --- a/test/langtools/tools/javadoc/parser/7091528/p/C3.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** This is class C3, and no package for me please */ -public class C3 {} - diff --git a/test/langtools/tools/javadoc/parser/7091528/p/q/C2.java b/test/langtools/tools/javadoc/parser/7091528/p/q/C2.java deleted file mode 100644 index 91b8d96c2c7..00000000000 --- a/test/langtools/tools/javadoc/parser/7091528/p/q/C2.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2011, 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 p.q; - -/** This is class p.q.C2. */ -public class C2 { } - diff --git a/test/langtools/tools/javadoc/sourceOnly/Test.java b/test/langtools/tools/javadoc/sourceOnly/Test.java deleted file mode 100644 index 3a32254ee8a..00000000000 --- a/test/langtools/tools/javadoc/sourceOnly/Test.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2015, 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 4548768 8034258 - * @summary Javadoc in JDK 1.4 uses classpath and not just source dir - * @author gafter - * @modules jdk.javadoc - * @compile p/SourceOnly.java p/NonSource.jasm - * @run main p.SourceOnly - */ - -// this file is just a dummy to get the javadoc started. -// -// NOTE: this test only seems to work in separate JVM mode for -// reasons having something to do with javing tools.jar -// on the classpath. Until that is sorted out, these tests -// must be run in separate VM mode. diff --git a/test/langtools/tools/javadoc/sourceOnly/p/NonSource.jasm b/test/langtools/tools/javadoc/sourceOnly/p/NonSource.jasm deleted file mode 100644 index 2a2be83d031..00000000000 --- a/test/langtools/tools/javadoc/sourceOnly/p/NonSource.jasm +++ /dev/null @@ -1,36 +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. - */ - -package p; - -super public class NonSource - version 46:0 -{ - public Method "":"()V" - stack 1 locals 1 - { - aload_0; - invokespecial Method java/lang/Object."":"()V"; - return; - } -} diff --git a/test/langtools/tools/javadoc/sourceOnly/p/SourceOnly.java b/test/langtools/tools/javadoc/sourceOnly/p/SourceOnly.java deleted file mode 100644 index 075fc79cb99..00000000000 --- a/test/langtools/tools/javadoc/sourceOnly/p/SourceOnly.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2008, 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 p; - -/** Test that when running javadoc on a package, we only get - * documentation for those classes for which source was provided. - */ -public class SourceOnly extends com.sun.javadoc.Doclet { - NonSource dependency; // force a compilation error if not on classpath. - - public static void main(String[] args) { - // run javadoc on package p - int result = com.sun.tools.javadoc.Main. - execute("javadoc", "p.SourceOnly", SourceOnly.class.getClassLoader(), new String[] {"p"}); - if (result != 0) - throw new Error(); - } - - public static boolean start(com.sun.javadoc.RootDoc root) { - if (root.classes().length != 1) - throw new Error("wrong set of classes documented: " + java.util.Arrays.asList(root.classes())); - return true; - } -} diff --git a/test/langtools/tools/javadoc/sourceOption/SourceOption.java b/test/langtools/tools/javadoc/sourceOption/SourceOption.java deleted file mode 100644 index bcfa3f61d71..00000000000 --- a/test/langtools/tools/javadoc/sourceOption/SourceOption.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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 - * 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 6507179 - * @summary Ensure that "-source" option isn't ignored. - * @author Scott Seligman - * @modules jdk.javadoc - * @run main/fail SourceOption 7 - * @run main SourceOption 9 - * @run main SourceOption - */ - -/* - * In order to test whether or not the -source option is working - * correctly, this test tries to parse source code that contains - * a feature that is not available in at least one of the currently - * supported previous versions. - * - * Parsing such code should be expected to fail; if the action - * passes, that means the -source option is (incorrectly) ineffective. - * - * Additional actions are performed to ensure that the source - * provided is valid for the current release of the JDK. - * - * As support for older versions of the platform are dropped, the - * source code (currently p/LambdaConstructTest.java) will need to - * be updated with a more recent feature. - */ - -import com.sun.javadoc.*; - -public class SourceOption extends Doclet { - - public static void main(String[] args) { - String[] params; - if ((args == null) || (args.length==0)) { - params = new String[]{"p"}; - System.out.println("NOTE : -source not provided, default taken"); - } else { - params = new String[]{"-source", args[0], "p"}; - System.out.println("NOTE : -source will be: " + args[0]); - } - - if (com.sun.tools.javadoc.Main.execute( - "javadoc", - "SourceOption", - SourceOption.class.getClassLoader(), - params) != 0) - throw new Error("Javadoc encountered warnings or errors."); - - } - - public static boolean start(RootDoc root) { - root.classes(); // force parser into action - return true; - } -} diff --git a/test/langtools/tools/javadoc/sourceOption/p/LambdaConstructTest.java b/test/langtools/tools/javadoc/sourceOption/p/LambdaConstructTest.java deleted file mode 100644 index b88f5869a3f..00000000000 --- a/test/langtools/tools/javadoc/sourceOption/p/LambdaConstructTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -public class LambdaConstructTest { - public static void main(String[] args) { - - System.out.println("=== LambdaConstructTest ==="); - - // Lambda Runnable - Runnable lambda = () -> System.out.println("it's a Lambda world!"); - - // Run it! - lambda.run(); - - } -} - diff --git a/test/langtools/tools/javadoc/subpackageIgnore/SubpackageIgnore.java b/test/langtools/tools/javadoc/subpackageIgnore/SubpackageIgnore.java deleted file mode 100644 index 2e766504e4d..00000000000 --- a/test/langtools/tools/javadoc/subpackageIgnore/SubpackageIgnore.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2003, 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. - * - * 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 4773013 - * @summary When hunting subpackages, silently ignore any directory name that - * can't be part of a subpackage. - * @modules jdk.javadoc - */ - -import com.sun.javadoc.*; - -public class SubpackageIgnore extends Doclet { - - public static void main(String[] args) { - if (com.sun.tools.javadoc.Main.execute( - "javadoc", - "SubpackageIgnore", - SubpackageIgnore.class.getClassLoader(), - new String[] {"-Xwerror", - "-sourcepath", - System.getProperty("test.src", "."), - "-subpackages", - "pkg1"}) != 0) - throw new Error("Javadoc encountered warnings or errors."); - } - - /* - * The world's simplest doclet. - */ - public static boolean start(RootDoc root) { - return true; - } -} diff --git a/test/langtools/tools/javadoc/subpackageIgnore/pkg1/not-subpkg/SomeJavaFile.java b/test/langtools/tools/javadoc/subpackageIgnore/pkg1/not-subpkg/SomeJavaFile.java deleted file mode 100644 index 7d886ce8861..00000000000 --- a/test/langtools/tools/javadoc/subpackageIgnore/pkg1/not-subpkg/SomeJavaFile.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2003, 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. - */ - diff --git a/test/langtools/tools/javadoc/varArgs/Main.java b/test/langtools/tools/javadoc/varArgs/Main.java deleted file mode 100644 index e934341501b..00000000000 --- a/test/langtools/tools/javadoc/varArgs/Main.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 4421066 5006659 - * @summary Verify the contents of a ClassDoc containing a varArgs method. - * Verify that see/link tags can use "..." notation. - * @library ../lib - * @modules jdk.javadoc - * @compile ../lib/OldToolTester.java Main.java - * @run main Main - */ - -import java.io.IOException; -import com.sun.javadoc.*; - -public class Main extends OldToolTester.Doclet { - - private static final OldToolTester tester = - new OldToolTester("Main", "-Xwerror", "pkg1"); - - public static void main(String[] args) throws IOException { - tester.run(); - tester.verify(); - } - - public static boolean start(RootDoc root) { - try { - for (ClassDoc cd : root.classes()) { - tester.printClass(cd); - - for (SeeTag tag : cd.seeTags()) { - if (tag.referencedMember() != cd.methods()[0]) { - throw new Error("5006659: @see tag meets varArgs"); - } - } - } - - return true; - } catch (IOException e) { - return false; - } - } -} diff --git a/test/langtools/tools/javadoc/varArgs/expected.out b/test/langtools/tools/javadoc/varArgs/expected.out deleted file mode 100644 index 705bb0c3a30..00000000000 --- a/test/langtools/tools/javadoc/varArgs/expected.out +++ /dev/null @@ -1,4 +0,0 @@ -interface pkg1.A - name: A / A / pkg1.A - methods: - void m1(int, String...) diff --git a/test/langtools/tools/javadoc/varArgs/pkg1/A.java b/test/langtools/tools/javadoc/varArgs/pkg1/A.java deleted file mode 100644 index e456e3f6c6e..00000000000 --- a/test/langtools/tools/javadoc/varArgs/pkg1/A.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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 pkg1; - -/** - * Interface A. - * - * @see #m1(int, String[]) - * @see #m1(int, String...) - */ -public interface A { - void m1(int i, String... ss); -} From 33d947b7e3390865d5c4edea45c26fffd775410f Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Fri, 22 Feb 2019 09:23:37 +0100 Subject: [PATCH 077/109] 8219247: Enable inlining of newly introduced PlatformMonitor methods Reviewed-by: dholmes, rehn --- src/hotspot/os/aix/os_aix.inline.hpp | 1 + src/hotspot/os/bsd/os_bsd.cpp | 1 + src/hotspot/os/bsd/os_bsd.inline.hpp | 1 + src/hotspot/os/linux/os_linux.cpp | 1 + src/hotspot/os/posix/os_posix.cpp | 26 --------------- src/hotspot/os/posix/os_posix.inline.hpp | 33 ++++++++++++++++++++ src/hotspot/os/windows/os_windows.cpp | 29 ----------------- src/hotspot/os/windows/os_windows.inline.hpp | 31 ++++++++++++++++++ 8 files changed, 68 insertions(+), 55 deletions(-) diff --git a/src/hotspot/os/aix/os_aix.inline.hpp b/src/hotspot/os/aix/os_aix.inline.hpp index 6d9acbaad50..4140d0613fa 100644 --- a/src/hotspot/os/aix/os_aix.inline.hpp +++ b/src/hotspot/os/aix/os_aix.inline.hpp @@ -27,6 +27,7 @@ #define OS_AIX_OS_AIX_INLINE_HPP #include "runtime/os.hpp" +#include "os_posix.inline.hpp" // System includes diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index 2e71bfd09be..69b61d38515 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -37,6 +37,7 @@ #include "memory/filemap.hpp" #include "oops/oop.inline.hpp" #include "os_bsd.inline.hpp" +#include "os_posix.inline.hpp" #include "os_share_bsd.hpp" #include "prims/jniFastGetField.hpp" #include "prims/jvm_misc.hpp" diff --git a/src/hotspot/os/bsd/os_bsd.inline.hpp b/src/hotspot/os/bsd/os_bsd.inline.hpp index 591cead568f..0f95010f200 100644 --- a/src/hotspot/os/bsd/os_bsd.inline.hpp +++ b/src/hotspot/os/bsd/os_bsd.inline.hpp @@ -26,6 +26,7 @@ #define OS_BSD_OS_BSD_INLINE_HPP #include "runtime/os.hpp" +#include "os_posix.inline.hpp" // System includes diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 1a485a94f75..c08010a4aad 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -38,6 +38,7 @@ #include "memory/filemap.hpp" #include "oops/oop.inline.hpp" #include "os_linux.inline.hpp" +#include "os_posix.inline.hpp" #include "os_share_linux.hpp" #include "osContainer_linux.hpp" #include "prims/jniFastGetField.hpp" diff --git a/src/hotspot/os/posix/os_posix.cpp b/src/hotspot/os/posix/os_posix.cpp index 77ee13b5a5d..3bc6444bcb3 100644 --- a/src/hotspot/os/posix/os_posix.cpp +++ b/src/hotspot/os/posix/os_posix.cpp @@ -2219,22 +2219,6 @@ os::PlatformMonitor::~PlatformMonitor() { assert_status(status == 0, status, "mutex_destroy"); } -void os::PlatformMonitor::lock() { - int status = pthread_mutex_lock(&_mutex); - assert_status(status == 0, status, "mutex_lock"); -} - -void os::PlatformMonitor::unlock() { - int status = pthread_mutex_unlock(&_mutex); - assert_status(status == 0, status, "mutex_unlock"); -} - -bool os::PlatformMonitor::try_lock() { - int status = pthread_mutex_trylock(&_mutex); - assert_status(status == 0 || status == EBUSY, status, "mutex_trylock"); - return status == 0; -} - // Must already be locked int os::PlatformMonitor::wait(jlong millis) { assert(millis >= 0, "negative timeout"); @@ -2263,14 +2247,4 @@ int os::PlatformMonitor::wait(jlong millis) { } } -void os::PlatformMonitor::notify() { - int status = pthread_cond_signal(&_cond); - assert_status(status == 0, status, "cond_signal"); -} - -void os::PlatformMonitor::notify_all() { - int status = pthread_cond_broadcast(&_cond); - assert_status(status == 0, status, "cond_broadcast"); -} - #endif // !SOLARIS diff --git a/src/hotspot/os/posix/os_posix.inline.hpp b/src/hotspot/os/posix/os_posix.inline.hpp index aa0c2402ffd..d9d57365be3 100644 --- a/src/hotspot/os/posix/os_posix.inline.hpp +++ b/src/hotspot/os/posix/os_posix.inline.hpp @@ -42,6 +42,39 @@ inline int os::Posix::clock_gettime(clockid_t clock_id, struct timespec *tp) { inline int os::Posix::clock_getres(clockid_t clock_id, struct timespec *tp) { return _clock_getres != NULL ? _clock_getres(clock_id, tp) : -1; } + #endif // SUPPORTS_CLOCK_MONOTONIC +#ifndef SOLARIS + +// Platform Monitor implementation + +inline void os::PlatformMonitor::lock() { + int status = pthread_mutex_lock(&_mutex); + assert_status(status == 0, status, "mutex_lock"); +} + +inline void os::PlatformMonitor::unlock() { + int status = pthread_mutex_unlock(&_mutex); + assert_status(status == 0, status, "mutex_unlock"); +} + +inline bool os::PlatformMonitor::try_lock() { + int status = pthread_mutex_trylock(&_mutex); + assert_status(status == 0 || status == EBUSY, status, "mutex_trylock"); + return status == 0; +} + +inline void os::PlatformMonitor::notify() { + int status = pthread_cond_signal(&_cond); + assert_status(status == 0, status, "cond_signal"); +} + +inline void os::PlatformMonitor::notify_all() { + int status = pthread_cond_broadcast(&_cond); + assert_status(status == 0, status, "cond_broadcast"); +} + +#endif // !SOLARIS + #endif // OS_POSIX_OS_POSIX_INLINE_HPP diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 7dc28ffd283..0f60133ab41 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -5320,27 +5320,6 @@ void Parker::unpark() { // Platform Monitor implementation -os::PlatformMonitor::PlatformMonitor() { - InitializeConditionVariable(&_cond); - InitializeCriticalSection(&_mutex); -} - -os::PlatformMonitor::~PlatformMonitor() { - DeleteCriticalSection(&_mutex); -} - -void os::PlatformMonitor::lock() { - EnterCriticalSection(&_mutex); -} - -void os::PlatformMonitor::unlock() { - LeaveCriticalSection(&_mutex); -} - -bool os::PlatformMonitor::try_lock() { - return TryEnterCriticalSection(&_mutex); -} - // Must already be locked int os::PlatformMonitor::wait(jlong millis) { assert(millis >= 0, "negative timeout"); @@ -5359,14 +5338,6 @@ int os::PlatformMonitor::wait(jlong millis) { return ret; } -void os::PlatformMonitor::notify() { - WakeConditionVariable(&_cond); -} - -void os::PlatformMonitor::notify_all() { - WakeAllConditionVariable(&_cond); -} - // Run the specified command in a separate process. Return its exit value, // or -1 on failure (e.g. can't create a new process). int os::fork_and_exec(char* cmd, bool use_vfork_if_available) { diff --git a/src/hotspot/os/windows/os_windows.inline.hpp b/src/hotspot/os/windows/os_windows.inline.hpp index 8515a23350f..56168c67b09 100644 --- a/src/hotspot/os/windows/os_windows.inline.hpp +++ b/src/hotspot/os/windows/os_windows.inline.hpp @@ -86,4 +86,35 @@ inline void os::exit(int num) { win32::exit_process_or_thread(win32::EPT_PROCESS, num); } +// Platform Monitor implementation + +inline os::PlatformMonitor::PlatformMonitor() { + InitializeConditionVariable(&_cond); + InitializeCriticalSection(&_mutex); +} + +inline os::PlatformMonitor::~PlatformMonitor() { + DeleteCriticalSection(&_mutex); +} + +inline void os::PlatformMonitor::lock() { + EnterCriticalSection(&_mutex); +} + +inline void os::PlatformMonitor::unlock() { + LeaveCriticalSection(&_mutex); +} + +inline bool os::PlatformMonitor::try_lock() { + return TryEnterCriticalSection(&_mutex); +} + +inline void os::PlatformMonitor::notify() { + WakeConditionVariable(&_cond); +} + +inline void os::PlatformMonitor::notify_all() { + WakeAllConditionVariable(&_cond); +} + #endif // OS_WINDOWS_OS_WINDOWS_INLINE_HPP From 45f74c8c95ee6dfade6bdf448acb9a05bf85d06d Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 19 Feb 2019 13:47:45 +0100 Subject: [PATCH 078/109] 8219462: ZGC: Use wait/notify in ZNMethodTable Reviewed-by: pliden --- src/hotspot/share/gc/z/zNMethodTable.cpp | 25 +++++++++++++----------- src/hotspot/share/gc/z/zNMethodTable.hpp | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/hotspot/share/gc/z/zNMethodTable.cpp b/src/hotspot/share/gc/z/zNMethodTable.cpp index 78259813438..1a544582724 100644 --- a/src/hotspot/share/gc/z/zNMethodTable.cpp +++ b/src/hotspot/share/gc/z/zNMethodTable.cpp @@ -40,7 +40,6 @@ #include "memory/resourceArea.hpp" #include "runtime/atomic.hpp" #include "runtime/orderAccess.hpp" -#include "runtime/os.hpp" #include "utilities/debug.hpp" class ZNMethodDataImmediateOops { @@ -440,24 +439,24 @@ void ZNMethodTable::register_nmethod(nmethod* nm) { disarm_nmethod(nm); } -void ZNMethodTable::sweeper_wait_for_iteration() { - // The sweeper must wait for any ongoing iteration to complete - // before it can unregister an nmethod. - if (!Thread::current()->is_Code_cache_sweeper_thread()) { - return; - } +void ZNMethodTable::wait_until_iteration_done() { + assert(CodeCache_lock->owned_by_self(), "Lock must be held"); while (_iter_table != NULL) { - MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - os::naked_short_sleep(1); + CodeCache_lock->wait(Monitor::_no_safepoint_check_flag); } } void ZNMethodTable::unregister_nmethod(nmethod* nm) { assert(CodeCache_lock->owned_by_self(), "Lock must be held"); - ResourceMark rm; - sweeper_wait_for_iteration(); + if (Thread::current()->is_Code_cache_sweeper_thread()) { + // The sweeper must wait for any ongoing iteration to complete + // before it can unregister an nmethod. + ZNMethodTable::wait_until_iteration_done(); + } + + ResourceMark rm; log_unregister(nm); @@ -494,6 +493,7 @@ void ZNMethodTable::nmethod_entries_do_end() { delete [] _iter_table; } _iter_table = NULL; + assert(_claimed >= _iter_table_size, "Failed to claim all table entries"); // Process deferred deletes @@ -502,6 +502,9 @@ void ZNMethodTable::nmethod_entries_do_end() { FREE_C_HEAP_ARRAY(uint8_t, data); } _iter_deferred_deletes.clear(); + + // Notify iteration done + CodeCache_lock->notify_all(); } void ZNMethodTable::entry_oops_do(ZNMethodTableEntry entry, OopClosure* cl) { diff --git a/src/hotspot/share/gc/z/zNMethodTable.hpp b/src/hotspot/share/gc/z/zNMethodTable.hpp index a16e09aad9c..18dd8306195 100644 --- a/src/hotspot/share/gc/z/zNMethodTable.hpp +++ b/src/hotspot/share/gc/z/zNMethodTable.hpp @@ -54,7 +54,7 @@ private: static size_t first_index(const nmethod* nm, size_t size); static size_t next_index(size_t prev_index, size_t size); - static void sweeper_wait_for_iteration(); + static void wait_until_iteration_done(); static bool register_entry(ZNMethodTableEntry* table, size_t size, ZNMethodTableEntry entry); static void unregister_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm); From b0383a247dddf1a02711a4a42ef25b14cd3ec6f4 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Wed, 20 Feb 2019 10:46:39 +0100 Subject: [PATCH 079/109] 8219463: ZGC: Remove redundant ZNMethodTable::_iter_lock Reviewed-by: pliden --- src/hotspot/share/gc/z/zNMethodTable.cpp | 9 ++++----- src/hotspot/share/gc/z/zNMethodTable.hpp | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/gc/z/zNMethodTable.cpp b/src/hotspot/share/gc/z/zNMethodTable.cpp index 1a544582724..67cbdeda654 100644 --- a/src/hotspot/share/gc/z/zNMethodTable.cpp +++ b/src/hotspot/share/gc/z/zNMethodTable.cpp @@ -153,7 +153,6 @@ static void set_gc_data(nmethod* nm, ZNMethodData* data) { ZNMethodTableEntry* ZNMethodTable::_table = NULL; size_t ZNMethodTable::_size = 0; -ZLock ZNMethodTable::_iter_lock; ZNMethodTableEntry* ZNMethodTable::_iter_table = NULL; size_t ZNMethodTable::_iter_table_size = 0; ZArray ZNMethodTable::_iter_deferred_deletes; @@ -162,11 +161,12 @@ size_t ZNMethodTable::_nunregistered = 0; volatile size_t ZNMethodTable::_claimed = 0; void ZNMethodTable::safe_delete(void* data) { + assert(CodeCache_lock->owned_by_self(), "Lock must be held"); + if (data == NULL) { return; } - ZLocker locker(&_iter_lock); if (_iter_table != NULL) { // Iteration in progress, defer delete _iter_deferred_deletes.add(data); @@ -290,7 +290,8 @@ void ZNMethodTable::unregister_entry(ZNMethodTableEntry* table, size_t size, nme } void ZNMethodTable::rebuild(size_t new_size) { - ZLocker locker(&_iter_lock); + assert(CodeCache_lock->owned_by_self(), "Lock must be held"); + assert(is_power_of_2(new_size), "Invalid size"); log_debug(gc, nmethod)("Rebuilding NMethod Table: " @@ -475,7 +476,6 @@ void ZNMethodTable::disarm_nmethod(nmethod* nm) { void ZNMethodTable::nmethod_entries_do_begin() { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - ZLocker locker(&_iter_lock); // Prepare iteration _iter_table = _table; @@ -486,7 +486,6 @@ void ZNMethodTable::nmethod_entries_do_begin() { void ZNMethodTable::nmethod_entries_do_end() { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - ZLocker locker(&_iter_lock); // Finish iteration if (_iter_table != _table) { diff --git a/src/hotspot/share/gc/z/zNMethodTable.hpp b/src/hotspot/share/gc/z/zNMethodTable.hpp index 18dd8306195..27a6c0141d5 100644 --- a/src/hotspot/share/gc/z/zNMethodTable.hpp +++ b/src/hotspot/share/gc/z/zNMethodTable.hpp @@ -41,7 +41,6 @@ class ZNMethodTable : public AllStatic { private: static ZNMethodTableEntry* _table; static size_t _size; - static ZLock _iter_lock; static ZNMethodTableEntry* _iter_table; static size_t _iter_table_size; static ZArray _iter_deferred_deletes; From 7c5141a048feb90bc615a100b28505504f5b2f7d Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Thu, 21 Feb 2019 13:20:34 +0100 Subject: [PATCH 080/109] 8219573: Add NMethodClosure Reviewed-by: pliden, eosterlund --- src/hotspot/share/memory/iterator.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/hotspot/share/memory/iterator.hpp b/src/hotspot/share/memory/iterator.hpp index 8f117954487..ff3fc5e04cb 100644 --- a/src/hotspot/share/memory/iterator.hpp +++ b/src/hotspot/share/memory/iterator.hpp @@ -263,6 +263,11 @@ class MarkingCodeBlobClosure : public CodeBlobToOopClosure { virtual void do_code_blob(CodeBlob* cb); }; +class NMethodClosure : public Closure { + public: + virtual void do_nmethod(nmethod* n) = 0; +}; + // MonitorClosure is used for iterating over monitors in the monitors cache class ObjectMonitor; From 2895d5534d5f4a43d444e676ccac44f4623d5498 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Wed, 20 Feb 2019 10:47:03 +0100 Subject: [PATCH 081/109] 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData Reviewed-by: pliden --- src/hotspot/share/gc/z/zNMethodTable.cpp | 241 +++++++++--------- src/hotspot/share/gc/z/zNMethodTable.hpp | 21 +- src/hotspot/share/gc/z/zNMethodTableEntry.hpp | 46 ++-- src/hotspot/share/gc/z/zRootsIterator.cpp | 4 +- 4 files changed, 150 insertions(+), 162 deletions(-) diff --git a/src/hotspot/share/gc/z/zNMethodTable.cpp b/src/hotspot/share/gc/z/zNMethodTable.cpp index 67cbdeda654..65f74a22744 100644 --- a/src/hotspot/share/gc/z/zNMethodTable.cpp +++ b/src/hotspot/share/gc/z/zNMethodTable.cpp @@ -37,71 +37,80 @@ #include "gc/z/zWorkers.hpp" #include "logging/log.hpp" #include "memory/allocation.inline.hpp" +#include "memory/iterator.hpp" #include "memory/resourceArea.hpp" #include "runtime/atomic.hpp" #include "runtime/orderAccess.hpp" #include "utilities/debug.hpp" -class ZNMethodDataImmediateOops { +class ZNMethodDataOops { private: - const size_t _nimmediate_oops; + const size_t _nimmediates; + bool _has_non_immediates; static size_t header_size(); - ZNMethodDataImmediateOops(const GrowableArray& immediate_oops); + ZNMethodDataOops(const GrowableArray& immediates, bool has_non_immediates); public: - static ZNMethodDataImmediateOops* create(const GrowableArray& immediate_oops); - static void destroy(ZNMethodDataImmediateOops* data_immediate_oops); + static ZNMethodDataOops* create(const GrowableArray& immediates, bool has_non_immediates); + static void destroy(ZNMethodDataOops* oops); - size_t immediate_oops_count() const; - oop** immediate_oops_begin() const; - oop** immediate_oops_end() const; + size_t immediates_count() const; + oop** immediates_begin() const; + oop** immediates_end() const; + + bool has_non_immediates() const; }; -size_t ZNMethodDataImmediateOops::header_size() { - const size_t size = sizeof(ZNMethodDataImmediateOops); +size_t ZNMethodDataOops::header_size() { + const size_t size = sizeof(ZNMethodDataOops); assert(is_aligned(size, sizeof(oop*)), "Header misaligned"); return size; } -ZNMethodDataImmediateOops* ZNMethodDataImmediateOops::create(const GrowableArray& immediate_oops) { - // Allocate memory for the ZNMethodDataImmediateOops object +ZNMethodDataOops* ZNMethodDataOops::create(const GrowableArray& immediates, bool has_non_immediates) { + // Allocate memory for the ZNMethodDataOops object // plus the immediate oop* array that follows right after. - const size_t size = ZNMethodDataImmediateOops::header_size() + (sizeof(oop*) * immediate_oops.length()); - void* const data_immediate_oops = NEW_C_HEAP_ARRAY(uint8_t, size, mtGC); - return ::new (data_immediate_oops) ZNMethodDataImmediateOops(immediate_oops); + const size_t size = ZNMethodDataOops::header_size() + (sizeof(oop*) * immediates.length()); + void* const data = NEW_C_HEAP_ARRAY(uint8_t, size, mtGC); + return ::new (data) ZNMethodDataOops(immediates, has_non_immediates); } -void ZNMethodDataImmediateOops::destroy(ZNMethodDataImmediateOops* data_immediate_oops) { - ZNMethodTable::safe_delete(data_immediate_oops); +void ZNMethodDataOops::destroy(ZNMethodDataOops* oops) { + ZNMethodTable::safe_delete(oops); } -ZNMethodDataImmediateOops::ZNMethodDataImmediateOops(const GrowableArray& immediate_oops) : - _nimmediate_oops(immediate_oops.length()) { +ZNMethodDataOops::ZNMethodDataOops(const GrowableArray& immediates, bool has_non_immediates) : + _nimmediates(immediates.length()), + _has_non_immediates(has_non_immediates) { // Save all immediate oops - for (size_t i = 0; i < _nimmediate_oops; i++) { - immediate_oops_begin()[i] = immediate_oops.at(i); + for (size_t i = 0; i < _nimmediates; i++) { + immediates_begin()[i] = immediates.at(i); } } -size_t ZNMethodDataImmediateOops::immediate_oops_count() const { - return _nimmediate_oops; +size_t ZNMethodDataOops::immediates_count() const { + return _nimmediates; } -oop** ZNMethodDataImmediateOops::immediate_oops_begin() const { +oop** ZNMethodDataOops::immediates_begin() const { // The immediate oop* array starts immediately after this object return (oop**)((uintptr_t)this + header_size()); } -oop** ZNMethodDataImmediateOops::immediate_oops_end() const { - return immediate_oops_begin() + immediate_oops_count(); +oop** ZNMethodDataOops::immediates_end() const { + return immediates_begin() + immediates_count(); +} + +bool ZNMethodDataOops::has_non_immediates() const { + return _has_non_immediates; } class ZNMethodData { private: - ZReentrantLock _lock; - ZNMethodDataImmediateOops* volatile _immediate_oops; + ZReentrantLock _lock; + ZNMethodDataOops* volatile _oops; ZNMethodData(nmethod* nm); @@ -111,8 +120,8 @@ public: ZReentrantLock* lock(); - ZNMethodDataImmediateOops* immediate_oops() const; - ZNMethodDataImmediateOops* swap_immediate_oops(const GrowableArray& immediate_oops); + ZNMethodDataOops* oops() const; + ZNMethodDataOops* swap_oops(ZNMethodDataOops* oops); }; ZNMethodData* ZNMethodData::create(nmethod* nm) { @@ -121,26 +130,24 @@ ZNMethodData* ZNMethodData::create(nmethod* nm) { } void ZNMethodData::destroy(ZNMethodData* data) { - ZNMethodDataImmediateOops::destroy(data->immediate_oops()); + ZNMethodDataOops::destroy(data->oops()); ZNMethodTable::safe_delete(data); } ZNMethodData::ZNMethodData(nmethod* nm) : _lock(), - _immediate_oops(NULL) {} + _oops(NULL) {} ZReentrantLock* ZNMethodData::lock() { return &_lock; } -ZNMethodDataImmediateOops* ZNMethodData::immediate_oops() const { - return OrderAccess::load_acquire(&_immediate_oops); +ZNMethodDataOops* ZNMethodData::oops() const { + return OrderAccess::load_acquire(&_oops); } -ZNMethodDataImmediateOops* ZNMethodData::swap_immediate_oops(const GrowableArray& immediate_oops) { - ZNMethodDataImmediateOops* const data_immediate_oops = - immediate_oops.is_empty() ? NULL : ZNMethodDataImmediateOops::create(immediate_oops); - return Atomic::xchg(data_immediate_oops, &_immediate_oops); +ZNMethodDataOops* ZNMethodData::swap_oops(ZNMethodDataOops* new_oops) { + return Atomic::xchg(new_oops, &_oops); } static ZNMethodData* gc_data(const nmethod* nm) { @@ -176,7 +183,7 @@ void ZNMethodTable::safe_delete(void* data) { } } -ZNMethodTableEntry ZNMethodTable::create_entry(nmethod* nm) { +void ZNMethodTable::attach_gc_data(nmethod* nm) { GrowableArray immediate_oops; bool non_immediate_oops = false; @@ -211,12 +218,16 @@ ZNMethodTableEntry ZNMethodTable::create_entry(nmethod* nm) { set_gc_data(nm, data); } - // Attach immediate oops in GC data - ZNMethodDataImmediateOops* const old_data_immediate_oops = data->swap_immediate_oops(immediate_oops); - ZNMethodDataImmediateOops::destroy(old_data_immediate_oops); + // Attach oops in GC data + ZNMethodDataOops* const new_oops = ZNMethodDataOops::create(immediate_oops, non_immediate_oops); + ZNMethodDataOops* const old_oops = data->swap_oops(new_oops); + ZNMethodDataOops::destroy(old_oops); +} - // Create entry - return ZNMethodTableEntry(nm, non_immediate_oops, !immediate_oops.is_empty()); +void ZNMethodTable::detach_gc_data(nmethod* nm) { + // Destroy GC data + ZNMethodData::destroy(gc_data(nm)); + set_gc_data(nm, NULL); } ZReentrantLock* ZNMethodTable::lock_for_nmethod(nmethod* nm) { @@ -240,8 +251,8 @@ size_t ZNMethodTable::next_index(size_t prev_index, size_t size) { return (prev_index + 1) & mask; } -bool ZNMethodTable::register_entry(ZNMethodTableEntry* table, size_t size, ZNMethodTableEntry entry) { - const nmethod* const nm = entry.method(); +bool ZNMethodTable::register_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm) { + const ZNMethodTableEntry entry(nm); size_t index = first_index(nm, size); for (;;) { @@ -264,11 +275,6 @@ bool ZNMethodTable::register_entry(ZNMethodTableEntry* table, size_t size, ZNMet } void ZNMethodTable::unregister_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm) { - if (size == 0) { - // Table is empty - return; - } - size_t index = first_index(nm, size); for (;;) { @@ -278,10 +284,6 @@ void ZNMethodTable::unregister_entry(ZNMethodTableEntry* table, size_t size, nme if (table_entry.registered() && table_entry.method() == nm) { // Remove entry table[index] = ZNMethodTableEntry(true /* unregistered */); - - // Destroy GC data - ZNMethodData::destroy(gc_data(nm)); - set_gc_data(nm, NULL); return; } @@ -309,7 +311,7 @@ void ZNMethodTable::rebuild(size_t new_size) { for (size_t i = 0; i < _size; i++) { const ZNMethodTableEntry entry = _table[i]; if (entry.registered()) { - register_entry(new_table, new_size, entry); + register_entry(new_table, new_size, entry.method()); } } @@ -353,12 +355,14 @@ void ZNMethodTable::rebuild_if_needed() { } } -void ZNMethodTable::log_register(const nmethod* nm, ZNMethodTableEntry entry) { +void ZNMethodTable::log_register(const nmethod* nm) { LogTarget(Trace, gc, nmethod) log; if (!log.is_enabled()) { return; } + const ZNMethodDataOops* const oops = gc_data(nm)->oops(); + log.print("Register NMethod: %s.%s (" PTR_FORMAT "), " "Compiler: %s, Oops: %d, ImmediateOops: " SIZE_FORMAT ", NonImmediateOops: %s", nm->method()->method_holder()->external_name(), @@ -366,8 +370,8 @@ void ZNMethodTable::log_register(const nmethod* nm, ZNMethodTableEntry entry) { p2i(nm), nm->compiler_name(), nm->oops_count() - 1, - entry.immediate_oops() ? gc_data(nm)->immediate_oops()->immediate_oops_count() : 0, - entry.non_immediate_oops() ? "Yes" : "No"); + oops->immediates_count(), + oops->has_non_immediates() ? "Yes" : "No"); LogTarget(Trace, gc, nmethod, oops) log_oops; if (!log_oops.is_enabled()) { @@ -375,23 +379,22 @@ void ZNMethodTable::log_register(const nmethod* nm, ZNMethodTableEntry entry) { } // Print nmethod oops table - oop* const begin = nm->oops_begin(); - oop* const end = nm->oops_end(); - for (oop* p = begin; p < end; p++) { - log_oops.print(" Oop[" SIZE_FORMAT "] " PTR_FORMAT " (%s)", - (p - begin), p2i(*p), (*p)->klass()->external_name()); + { + oop* const begin = nm->oops_begin(); + oop* const end = nm->oops_end(); + for (oop* p = begin; p < end; p++) { + log_oops.print(" Oop[" SIZE_FORMAT "] " PTR_FORMAT " (%s)", + (p - begin), p2i(*p), (*p)->klass()->external_name()); + } } - if (entry.immediate_oops()) { - // Print nmethod immediate oops - const ZNMethodDataImmediateOops* const nmi = gc_data(nm)->immediate_oops(); - if (nmi != NULL) { - oop** const begin = nmi->immediate_oops_begin(); - oop** const end = nmi->immediate_oops_end(); - for (oop** p = begin; p < end; p++) { - log_oops.print(" ImmediateOop[" SIZE_FORMAT "] " PTR_FORMAT " @ " PTR_FORMAT " (%s)", - (p - begin), p2i(**p), p2i(*p), (**p)->klass()->external_name()); - } + // Print nmethod immediate oops + { + oop** const begin = oops->immediates_begin(); + oop** const end = oops->immediates_end(); + for (oop** p = begin; p < end; p++) { + log_oops.print(" ImmediateOop[" SIZE_FORMAT "] " PTR_FORMAT " @ " PTR_FORMAT " (%s)", + (p - begin), p2i(**p), p2i(*p), (**p)->klass()->external_name()); } } } @@ -423,13 +426,13 @@ void ZNMethodTable::register_nmethod(nmethod* nm) { // Grow/Shrink/Prune table if needed rebuild_if_needed(); - // Create entry - const ZNMethodTableEntry entry = create_entry(nm); + // Create and attach gc data + attach_gc_data(nm); - log_register(nm, entry); + log_register(nm); // Insert new entry - if (register_entry(_table, _size, entry)) { + if (register_entry(_table, _size, nm)) { // New entry registered. When register_entry() instead returns // false the nmethod was already in the table so we do not want // to increase number of registered entries in that case. @@ -465,6 +468,8 @@ void ZNMethodTable::unregister_nmethod(nmethod* nm) { unregister_entry(_table, _size, nm); _nunregistered++; _nregistered--; + + detach_gc_data(nm); } void ZNMethodTable::disarm_nmethod(nmethod* nm) { @@ -474,7 +479,7 @@ void ZNMethodTable::disarm_nmethod(nmethod* nm) { } } -void ZNMethodTable::nmethod_entries_do_begin() { +void ZNMethodTable::nmethods_do_begin() { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); // Prepare iteration @@ -484,7 +489,7 @@ void ZNMethodTable::nmethod_entries_do_begin() { assert(_iter_deferred_deletes.is_empty(), "Should be emtpy"); } -void ZNMethodTable::nmethod_entries_do_end() { +void ZNMethodTable::nmethods_do_end() { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); // Finish iteration @@ -506,58 +511,56 @@ void ZNMethodTable::nmethod_entries_do_end() { CodeCache_lock->notify_all(); } -void ZNMethodTable::entry_oops_do(ZNMethodTableEntry entry, OopClosure* cl) { - nmethod* const nm = entry.method(); - +void ZNMethodTable::oops_do(nmethod* nm, OopClosure* cl) { // Process oops table - oop* const begin = nm->oops_begin(); - oop* const end = nm->oops_end(); - for (oop* p = begin; p < end; p++) { - if (*p != Universe::non_oop_word()) { - cl->do_oop(p); + { + oop* const begin = nm->oops_begin(); + oop* const end = nm->oops_end(); + for (oop* p = begin; p < end; p++) { + if (*p != Universe::non_oop_word()) { + cl->do_oop(p); + } } } + ZNMethodDataOops* const oops = gc_data(nm)->oops(); + // Process immediate oops - if (entry.immediate_oops()) { - const ZNMethodDataImmediateOops* const nmi = gc_data(nm)->immediate_oops(); - if (nmi != NULL) { - oop** const begin = nmi->immediate_oops_begin(); - oop** const end = nmi->immediate_oops_end(); - for (oop** p = begin; p < end; p++) { - if (**p != Universe::non_oop_word()) { - cl->do_oop(*p); - } + { + oop** const begin = oops->immediates_begin(); + oop** const end = oops->immediates_end(); + for (oop** p = begin; p < end; p++) { + if (**p != Universe::non_oop_word()) { + cl->do_oop(*p); } } } // Process non-immediate oops - if (entry.non_immediate_oops()) { - nmethod* const nm = entry.method(); + if (oops->has_non_immediates()) { nm->fix_oop_relocations(); } } -class ZNMethodTableEntryToOopsDo : public ZNMethodTableEntryClosure { +class ZNMethodToOopsDoClosure : public NMethodClosure { private: OopClosure* _cl; public: - ZNMethodTableEntryToOopsDo(OopClosure* cl) : + ZNMethodToOopsDoClosure(OopClosure* cl) : _cl(cl) {} - void do_nmethod_entry(ZNMethodTableEntry entry) { - ZNMethodTable::entry_oops_do(entry, _cl); + virtual void do_nmethod(nmethod* nm) { + ZNMethodTable::oops_do(nm, _cl); } }; void ZNMethodTable::oops_do(OopClosure* cl) { - ZNMethodTableEntryToOopsDo entry_cl(cl); - nmethod_entries_do(&entry_cl); + ZNMethodToOopsDoClosure nm_cl(cl); + nmethods_do(&nm_cl); } -void ZNMethodTable::nmethod_entries_do(ZNMethodTableEntryClosure* cl) { +void ZNMethodTable::nmethods_do(NMethodClosure* cl) { for (;;) { // Claim table partition. Each partition is currently sized to span // two cache lines. This number is just a guess, but seems to work well. @@ -573,13 +576,13 @@ void ZNMethodTable::nmethod_entries_do(ZNMethodTableEntryClosure* cl) { for (size_t i = partition_start; i < partition_end; i++) { const ZNMethodTableEntry entry = _iter_table[i]; if (entry.registered()) { - cl->do_nmethod_entry(entry); + cl->do_nmethod(entry.method()); } } } } -class ZNMethodTableUnlinkClosure : public ZNMethodTableEntryClosure { +class ZNMethodTableUnlinkClosure : public NMethodClosure { private: bool _unloading_occurred; volatile bool _failed; @@ -593,12 +596,11 @@ public: _unloading_occurred(unloading_occurred), _failed(false) {} - virtual void do_nmethod_entry(ZNMethodTableEntry entry) { + virtual void do_nmethod(nmethod* nm) { if (failed()) { return; } - nmethod* const nm = entry.method(); if (!nm->is_alive()) { return; } @@ -619,7 +621,7 @@ public: // Heal oops and disarm ZNMethodOopClosure cl; - ZNMethodTable::entry_oops_do(entry, &cl); + ZNMethodTable::oops_do(nm, &cl); ZNMethodTable::disarm_nmethod(nm); // Clear compiled ICs and exception caches @@ -643,16 +645,16 @@ public: ZTask("ZNMethodTableUnlinkTask"), _cl(unloading_occurred), _verifier(verifier) { - ZNMethodTable::nmethod_entries_do_begin(); + ZNMethodTable::nmethods_do_begin(); } ~ZNMethodTableUnlinkTask() { - ZNMethodTable::nmethod_entries_do_end(); + ZNMethodTable::nmethods_do_end(); } virtual void work() { ICRefillVerifierMark mark(_verifier); - ZNMethodTable::nmethod_entries_do(&_cl); + ZNMethodTable::nmethods_do(&_cl); } bool success() const { @@ -680,10 +682,9 @@ void ZNMethodTable::unlink(ZWorkers* workers, bool unloading_occurred) { } } -class ZNMethodTablePurgeClosure : public ZNMethodTableEntryClosure { +class ZNMethodTablePurgeClosure : public NMethodClosure { public: - virtual void do_nmethod_entry(ZNMethodTableEntry entry) { - nmethod* const nm = entry.method(); + virtual void do_nmethod(nmethod* nm) { if (nm->is_alive() && nm->is_unloading()) { nm->make_unloaded(); } @@ -698,15 +699,15 @@ public: ZNMethodTablePurgeTask() : ZTask("ZNMethodTablePurgeTask"), _cl() { - ZNMethodTable::nmethod_entries_do_begin(); + ZNMethodTable::nmethods_do_begin(); } ~ZNMethodTablePurgeTask() { - ZNMethodTable::nmethod_entries_do_end(); + ZNMethodTable::nmethods_do_end(); } virtual void work() { - ZNMethodTable::nmethod_entries_do(&_cl); + ZNMethodTable::nmethods_do(&_cl); } }; diff --git a/src/hotspot/share/gc/z/zNMethodTable.hpp b/src/hotspot/share/gc/z/zNMethodTable.hpp index 27a6c0141d5..4d3b2c0e8e4 100644 --- a/src/hotspot/share/gc/z/zNMethodTable.hpp +++ b/src/hotspot/share/gc/z/zNMethodTable.hpp @@ -30,13 +30,9 @@ #include "gc/z/zNMethodTableEntry.hpp" #include "memory/allocation.hpp" +class NMethodClosure; class ZWorkers; -class ZNMethodTableEntryClosure { -public: - virtual void do_nmethod_entry(ZNMethodTableEntry entry) = 0; -}; - class ZNMethodTable : public AllStatic { private: static ZNMethodTableEntry* _table; @@ -48,20 +44,21 @@ private: static size_t _nunregistered; static volatile size_t _claimed ATTRIBUTE_ALIGNED(ZCacheLineSize); - static ZNMethodTableEntry create_entry(nmethod* nm); + static void attach_gc_data(nmethod* nm); + static void detach_gc_data(nmethod* nm); static size_t first_index(const nmethod* nm, size_t size); static size_t next_index(size_t prev_index, size_t size); static void wait_until_iteration_done(); - static bool register_entry(ZNMethodTableEntry* table, size_t size, ZNMethodTableEntry entry); + static bool register_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm); static void unregister_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm); static void rebuild(size_t new_size); static void rebuild_if_needed(); - static void log_register(const nmethod* nm, ZNMethodTableEntry entry); + static void log_register(const nmethod* nm); static void log_unregister(const nmethod* nm); public: @@ -78,11 +75,11 @@ public: static void oops_do(OopClosure* cl); - static void entry_oops_do(ZNMethodTableEntry entry, OopClosure* cl); + static void oops_do(nmethod* nm, OopClosure* cl); - static void nmethod_entries_do_begin(); - static void nmethod_entries_do_end(); - static void nmethod_entries_do(ZNMethodTableEntryClosure* cl); + static void nmethods_do_begin(); + static void nmethods_do_end(); + static void nmethods_do(NMethodClosure* cl); static void unlink(ZWorkers* workers, bool unloading_occurred); static void purge(ZWorkers* workers); diff --git a/src/hotspot/share/gc/z/zNMethodTableEntry.hpp b/src/hotspot/share/gc/z/zNMethodTableEntry.hpp index d40d9295f2d..bdbb0feeab0 100644 --- a/src/hotspot/share/gc/z/zNMethodTableEntry.hpp +++ b/src/hotspot/share/gc/z/zNMethodTableEntry.hpp @@ -32,16 +32,16 @@ // -------------------------- // // 6 -// 3 3 2 1 0 -// +--------------------------------------------------------------------+-+-+-+ -// |11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111|1|1|1| -// +--------------------------------------------------------------------+-+-+-+ -// | | | | -// | 2-2 Non-immediate Oops Flag (1-bits) * | | -// | | | -// | 1-1 Immediate Oops/Unregistered Flag (1-bits) * | -// | | -// | 0-0 Registered Flag (1-bits) * +// 3 2 1 0 +// +---------------------------------------------------------------------+-+-+ +// |11111111 11111111 11111111 11111111 11111111 11111111 11111111 111111|1|1| +// +---------------------------------------------------------------------+-+-+ +// | | | +// | | | +// | | | +// | 1-1 Unregistered Flag (1-bits) * | +// | | +// | 0-0 Registered Flag (1-bits) * // | // * 63-3 NMethod Address (61-bits) // @@ -52,22 +52,20 @@ class ZNMethodTableEntry : public CHeapObj { private: typedef ZBitField field_registered; typedef ZBitField field_unregistered; - typedef ZBitField field_immediate_oops; - typedef ZBitField field_non_immediate_oops; - typedef ZBitField field_method; + typedef ZBitField field_method; uint64_t _entry; public: explicit ZNMethodTableEntry(bool unregistered = false) : - _entry(field_unregistered::encode(unregistered) | - field_registered::encode(false)) {} + _entry(field_registered::encode(false) | + field_unregistered::encode(unregistered) | + field_method::encode(NULL)) {} - ZNMethodTableEntry(nmethod* method, bool non_immediate_oops, bool immediate_oops) : - _entry(field_method::encode(method) | - field_non_immediate_oops::encode(non_immediate_oops) | - field_immediate_oops::encode(immediate_oops) | - field_registered::encode(true)) {} + explicit ZNMethodTableEntry(nmethod* method) : + _entry(field_registered::encode(true) | + field_unregistered::encode(false) | + field_method::encode(method)) {} bool registered() const { return field_registered::decode(_entry); @@ -77,14 +75,6 @@ public: return field_unregistered::decode(_entry); } - bool immediate_oops() const { - return field_immediate_oops::decode(_entry); - } - - bool non_immediate_oops() const { - return field_non_immediate_oops::decode(_entry); - } - nmethod* method() const { return field_method::decode(_entry); } diff --git a/src/hotspot/share/gc/z/zRootsIterator.cpp b/src/hotspot/share/gc/z/zRootsIterator.cpp index 2658da70df0..a4064bb88e1 100644 --- a/src/hotspot/share/gc/z/zRootsIterator.cpp +++ b/src/hotspot/share/gc/z/zRootsIterator.cpp @@ -184,7 +184,7 @@ ZRootsIterator::ZRootsIterator() : if (ClassUnloading) { nmethod::oops_do_marking_prologue(); } else { - ZNMethodTable::nmethod_entries_do_begin(); + ZNMethodTable::nmethods_do_begin(); } } @@ -194,7 +194,7 @@ ZRootsIterator::~ZRootsIterator() { if (ClassUnloading) { nmethod::oops_do_marking_epilogue(); } else { - ZNMethodTable::nmethod_entries_do_end(); + ZNMethodTable::nmethods_do_end(); } JvmtiExport::gc_epilogue(); From 858c007cf8a86bef6e8c417920720e8c860edace Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Wed, 20 Feb 2019 11:39:36 +0100 Subject: [PATCH 082/109] 8219466: ZGC: Extract allocation functionality into a new ZNMethodAllocator class Reviewed-by: pliden --- src/hotspot/share/gc/z/zNMethodAllocator.cpp | 69 ++++++++++++++++++++ src/hotspot/share/gc/z/zNMethodAllocator.hpp | 46 +++++++++++++ src/hotspot/share/gc/z/zNMethodTable.cpp | 49 +++++--------- src/hotspot/share/gc/z/zNMethodTable.hpp | 5 +- 4 files changed, 132 insertions(+), 37 deletions(-) create mode 100644 src/hotspot/share/gc/z/zNMethodAllocator.cpp create mode 100644 src/hotspot/share/gc/z/zNMethodAllocator.hpp diff --git a/src/hotspot/share/gc/z/zNMethodAllocator.cpp b/src/hotspot/share/gc/z/zNMethodAllocator.cpp new file mode 100644 index 00000000000..8f46caa669a --- /dev/null +++ b/src/hotspot/share/gc/z/zNMethodAllocator.cpp @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2019, 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. + */ + +#include "precompiled.hpp" +#include "gc/z/zArray.inline.hpp" +#include "gc/z/zNMethodAllocator.hpp" +#include "memory/allocation.hpp" + +ZArray ZNMethodAllocator::_deferred_frees; +bool ZNMethodAllocator::_defer_frees(false); + +void ZNMethodAllocator::immediate_free(void* data) { + FREE_C_HEAP_ARRAY(uint8_t, data); +} + +void ZNMethodAllocator::deferred_free(void* data) { + _deferred_frees.add(data); +} + +void* ZNMethodAllocator::allocate(size_t size) { + return NEW_C_HEAP_ARRAY(uint8_t, size, mtGC); +} + +void ZNMethodAllocator::free(void* data) { + if (data == NULL) { + return; + } + + if (_defer_frees) { + deferred_free(data); + } else { + immediate_free(data); + } +} + +void ZNMethodAllocator::activate_deferred_frees() { + assert(_deferred_frees.is_empty(), "precondition"); + _defer_frees = true; +} + +void ZNMethodAllocator::deactivate_and_process_deferred_frees() { + _defer_frees = false; + + ZArrayIterator iter(&_deferred_frees); + for (void* data; iter.next(&data);) { + immediate_free(data); + } + _deferred_frees.clear(); +} diff --git a/src/hotspot/share/gc/z/zNMethodAllocator.hpp b/src/hotspot/share/gc/z/zNMethodAllocator.hpp new file mode 100644 index 00000000000..dbe4f7817c1 --- /dev/null +++ b/src/hotspot/share/gc/z/zNMethodAllocator.hpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#ifndef SHARE_GC_Z_ZNMETHODALLOCATOR_HPP +#define SHARE_GC_Z_ZNMETHODALLOCATOR_HPP + +#include "memory/allocation.hpp" +#include "gc/z/zArray.hpp" + +class ZNMethodAllocator : public AllStatic { +private: + static ZArray _deferred_frees; + static bool _defer_frees; + + static void immediate_free(void* data); + static void deferred_free(void* data); + +public: + static void* allocate(size_t size); + static void free(void* data); + + static void activate_deferred_frees(); + static void deactivate_and_process_deferred_frees(); +}; + +#endif // SHARE_GC_Z_ZNMETHODALLOCATOR_HPP diff --git a/src/hotspot/share/gc/z/zNMethodTable.cpp b/src/hotspot/share/gc/z/zNMethodTable.cpp index 65f74a22744..67551fadaad 100644 --- a/src/hotspot/share/gc/z/zNMethodTable.cpp +++ b/src/hotspot/share/gc/z/zNMethodTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,16 +27,16 @@ #include "code/icBuffer.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetNMethod.hpp" -#include "gc/z/zArray.inline.hpp" #include "gc/z/zGlobals.hpp" #include "gc/z/zHash.inline.hpp" #include "gc/z/zLock.inline.hpp" +#include "gc/z/zNMethodAllocator.hpp" #include "gc/z/zNMethodTable.hpp" #include "gc/z/zOopClosures.inline.hpp" #include "gc/z/zTask.hpp" #include "gc/z/zWorkers.hpp" #include "logging/log.hpp" -#include "memory/allocation.inline.hpp" +#include "memory/allocation.hpp" #include "memory/iterator.hpp" #include "memory/resourceArea.hpp" #include "runtime/atomic.hpp" @@ -73,12 +73,12 @@ ZNMethodDataOops* ZNMethodDataOops::create(const GrowableArray& immediates // Allocate memory for the ZNMethodDataOops object // plus the immediate oop* array that follows right after. const size_t size = ZNMethodDataOops::header_size() + (sizeof(oop*) * immediates.length()); - void* const data = NEW_C_HEAP_ARRAY(uint8_t, size, mtGC); - return ::new (data) ZNMethodDataOops(immediates, has_non_immediates); + void* const mem = ZNMethodAllocator::allocate(size); + return ::new (mem) ZNMethodDataOops(immediates, has_non_immediates); } void ZNMethodDataOops::destroy(ZNMethodDataOops* oops) { - ZNMethodTable::safe_delete(oops); + ZNMethodAllocator::free(oops); } ZNMethodDataOops::ZNMethodDataOops(const GrowableArray& immediates, bool has_non_immediates) : @@ -125,13 +125,13 @@ public: }; ZNMethodData* ZNMethodData::create(nmethod* nm) { - void* const method = NEW_C_HEAP_ARRAY(uint8_t, sizeof(ZNMethodData), mtGC); - return ::new (method) ZNMethodData(nm); + void* const mem = ZNMethodAllocator::allocate(sizeof(ZNMethodData)); + return ::new (mem) ZNMethodData(nm); } void ZNMethodData::destroy(ZNMethodData* data) { - ZNMethodDataOops::destroy(data->oops()); - ZNMethodTable::safe_delete(data); + ZNMethodAllocator::free(data->oops()); + ZNMethodAllocator::free(data); } ZNMethodData::ZNMethodData(nmethod* nm) : @@ -162,27 +162,10 @@ ZNMethodTableEntry* ZNMethodTable::_table = NULL; size_t ZNMethodTable::_size = 0; ZNMethodTableEntry* ZNMethodTable::_iter_table = NULL; size_t ZNMethodTable::_iter_table_size = 0; -ZArray ZNMethodTable::_iter_deferred_deletes; size_t ZNMethodTable::_nregistered = 0; size_t ZNMethodTable::_nunregistered = 0; volatile size_t ZNMethodTable::_claimed = 0; -void ZNMethodTable::safe_delete(void* data) { - assert(CodeCache_lock->owned_by_self(), "Lock must be held"); - - if (data == NULL) { - return; - } - - if (_iter_table != NULL) { - // Iteration in progress, defer delete - _iter_deferred_deletes.add(data); - } else { - // Iteration not in progress, delete now - FREE_C_HEAP_ARRAY(uint8_t, data); - } -} - void ZNMethodTable::attach_gc_data(nmethod* nm) { GrowableArray immediate_oops; bool non_immediate_oops = false; @@ -482,11 +465,13 @@ void ZNMethodTable::disarm_nmethod(nmethod* nm) { void ZNMethodTable::nmethods_do_begin() { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); + // Make sure we don't free data while iterating + ZNMethodAllocator::activate_deferred_frees(); + // Prepare iteration _iter_table = _table; _iter_table_size = _size; _claimed = 0; - assert(_iter_deferred_deletes.is_empty(), "Should be emtpy"); } void ZNMethodTable::nmethods_do_end() { @@ -500,12 +485,8 @@ void ZNMethodTable::nmethods_do_end() { assert(_claimed >= _iter_table_size, "Failed to claim all table entries"); - // Process deferred deletes - ZArrayIterator iter(&_iter_deferred_deletes); - for (void* data; iter.next(&data);) { - FREE_C_HEAP_ARRAY(uint8_t, data); - } - _iter_deferred_deletes.clear(); + // Process deferred frees + ZNMethodAllocator::deactivate_and_process_deferred_frees(); // Notify iteration done CodeCache_lock->notify_all(); diff --git a/src/hotspot/share/gc/z/zNMethodTable.hpp b/src/hotspot/share/gc/z/zNMethodTable.hpp index 4d3b2c0e8e4..2bd19793b36 100644 --- a/src/hotspot/share/gc/z/zNMethodTable.hpp +++ b/src/hotspot/share/gc/z/zNMethodTable.hpp @@ -31,6 +31,8 @@ #include "memory/allocation.hpp" class NMethodClosure; +class ZNMethodData; +class ZNMethodDataOops; class ZWorkers; class ZNMethodTable : public AllStatic { @@ -39,7 +41,6 @@ private: static size_t _size; static ZNMethodTableEntry* _iter_table; static size_t _iter_table_size; - static ZArray _iter_deferred_deletes; static size_t _nregistered; static size_t _nunregistered; static volatile size_t _claimed ATTRIBUTE_ALIGNED(ZCacheLineSize); @@ -62,8 +63,6 @@ private: static void log_unregister(const nmethod* nm); public: - static void safe_delete(void* data); - static size_t registered_nmethods(); static size_t unregistered_nmethods(); From a7707862a9fdb113654b6cd5671ec4c35e087f8a Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Wed, 20 Feb 2019 11:42:49 +0100 Subject: [PATCH 083/109] 8219467: ZGC: Move ZNMethodData to its own file Reviewed-by: pliden --- src/hotspot/share/gc/z/zNMethodData.cpp | 103 +++++++++++++++++++ src/hotspot/share/gc/z/zNMethodData.hpp | 71 +++++++++++++ src/hotspot/share/gc/z/zNMethodTable.cpp | 122 ++--------------------- 3 files changed, 182 insertions(+), 114 deletions(-) create mode 100644 src/hotspot/share/gc/z/zNMethodData.cpp create mode 100644 src/hotspot/share/gc/z/zNMethodData.hpp diff --git a/src/hotspot/share/gc/z/zNMethodData.cpp b/src/hotspot/share/gc/z/zNMethodData.cpp new file mode 100644 index 00000000000..995c111d187 --- /dev/null +++ b/src/hotspot/share/gc/z/zNMethodData.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2017, 2019, 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. + */ + +#include "precompiled.hpp" +#include "gc/z/zLock.inline.hpp" +#include "gc/z/zNMethodAllocator.hpp" +#include "gc/z/zNMethodData.hpp" +#include "memory/allocation.hpp" +#include "runtime/atomic.hpp" +#include "runtime/orderAccess.hpp" +#include "utilities/align.hpp" +#include "utilities/debug.hpp" +#include "utilities/growableArray.hpp" + +size_t ZNMethodDataOops::header_size() { + const size_t size = sizeof(ZNMethodDataOops); + assert(is_aligned(size, sizeof(oop*)), "Header misaligned"); + return size; +} + +ZNMethodDataOops* ZNMethodDataOops::create(const GrowableArray& immediates, bool has_non_immediates) { + // Allocate memory for the ZNMethodDataOops object + // plus the immediate oop* array that follows right after. + const size_t size = ZNMethodDataOops::header_size() + (sizeof(oop*) * immediates.length()); + void* const mem = ZNMethodAllocator::allocate(size); + return ::new (mem) ZNMethodDataOops(immediates, has_non_immediates); +} + +void ZNMethodDataOops::destroy(ZNMethodDataOops* oops) { + ZNMethodAllocator::free(oops); +} + +ZNMethodDataOops::ZNMethodDataOops(const GrowableArray& immediates, bool has_non_immediates) : + _nimmediates(immediates.length()), + _has_non_immediates(has_non_immediates) { + // Save all immediate oops + for (size_t i = 0; i < _nimmediates; i++) { + immediates_begin()[i] = immediates.at(i); + } +} + +size_t ZNMethodDataOops::immediates_count() const { + return _nimmediates; +} + +oop** ZNMethodDataOops::immediates_begin() const { + // The immediate oop* array starts immediately after this object + return (oop**)((uintptr_t)this + header_size()); +} + +oop** ZNMethodDataOops::immediates_end() const { + return immediates_begin() + immediates_count(); +} + +bool ZNMethodDataOops::has_non_immediates() const { + return _has_non_immediates; +} + +ZNMethodData* ZNMethodData::create(nmethod* nm) { + void* const mem = ZNMethodAllocator::allocate(sizeof(ZNMethodData)); + return ::new (mem) ZNMethodData(nm); +} + +void ZNMethodData::destroy(ZNMethodData* data) { + ZNMethodAllocator::free(data->oops()); + ZNMethodAllocator::free(data); +} + +ZNMethodData::ZNMethodData(nmethod* nm) : + _lock(), + _oops(NULL) {} + +ZReentrantLock* ZNMethodData::lock() { + return &_lock; +} + +ZNMethodDataOops* ZNMethodData::oops() const { + return OrderAccess::load_acquire(&_oops); +} + +ZNMethodDataOops* ZNMethodData::swap_oops(ZNMethodDataOops* new_oops) { + return Atomic::xchg(new_oops, &_oops); +} diff --git a/src/hotspot/share/gc/z/zNMethodData.hpp b/src/hotspot/share/gc/z/zNMethodData.hpp new file mode 100644 index 00000000000..8240e855104 --- /dev/null +++ b/src/hotspot/share/gc/z/zNMethodData.hpp @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2017, 2019, 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. + */ + +#include "gc/z/zLock.hpp" +#include "oops/oopsHierarchy.hpp" +#include "utilities/globalDefinitions.hpp" + +#ifndef SHARE_GC_Z_ZNMETHODDATA_HPP +#define SHARE_GC_Z_ZNMETHODDATA_HPP + +class nmethod; +template class GrowableArray; + +class ZNMethodDataOops { +private: + const size_t _nimmediates; + bool _has_non_immediates; + + static size_t header_size(); + + ZNMethodDataOops(const GrowableArray& immediates, bool has_non_immediates); + +public: + static ZNMethodDataOops* create(const GrowableArray& immediates, bool has_non_immediates); + static void destroy(ZNMethodDataOops* oops); + + size_t immediates_count() const; + oop** immediates_begin() const; + oop** immediates_end() const; + + bool has_non_immediates() const; +}; + +class ZNMethodData { +private: + ZReentrantLock _lock; + ZNMethodDataOops* volatile _oops; + + ZNMethodData(nmethod* nm); + +public: + static ZNMethodData* create(nmethod* nm); + static void destroy(ZNMethodData* data); + + ZReentrantLock* lock(); + + ZNMethodDataOops* oops() const; + ZNMethodDataOops* swap_oops(ZNMethodDataOops* oops); +}; + +#endif // SHARE_GC_Z_ZNMETHODDATA_HPP diff --git a/src/hotspot/share/gc/z/zNMethodTable.cpp b/src/hotspot/share/gc/z/zNMethodTable.cpp index 67551fadaad..fa927bf84d2 100644 --- a/src/hotspot/share/gc/z/zNMethodTable.cpp +++ b/src/hotspot/share/gc/z/zNMethodTable.cpp @@ -31,6 +31,7 @@ #include "gc/z/zHash.inline.hpp" #include "gc/z/zLock.inline.hpp" #include "gc/z/zNMethodAllocator.hpp" +#include "gc/z/zNMethodData.hpp" #include "gc/z/zNMethodTable.hpp" #include "gc/z/zOopClosures.inline.hpp" #include "gc/z/zTask.hpp" @@ -43,112 +44,13 @@ #include "runtime/orderAccess.hpp" #include "utilities/debug.hpp" -class ZNMethodDataOops { -private: - const size_t _nimmediates; - bool _has_non_immediates; - - static size_t header_size(); - - ZNMethodDataOops(const GrowableArray& immediates, bool has_non_immediates); - -public: - static ZNMethodDataOops* create(const GrowableArray& immediates, bool has_non_immediates); - static void destroy(ZNMethodDataOops* oops); - - size_t immediates_count() const; - oop** immediates_begin() const; - oop** immediates_end() const; - - bool has_non_immediates() const; -}; - -size_t ZNMethodDataOops::header_size() { - const size_t size = sizeof(ZNMethodDataOops); - assert(is_aligned(size, sizeof(oop*)), "Header misaligned"); - return size; -} - -ZNMethodDataOops* ZNMethodDataOops::create(const GrowableArray& immediates, bool has_non_immediates) { - // Allocate memory for the ZNMethodDataOops object - // plus the immediate oop* array that follows right after. - const size_t size = ZNMethodDataOops::header_size() + (sizeof(oop*) * immediates.length()); - void* const mem = ZNMethodAllocator::allocate(size); - return ::new (mem) ZNMethodDataOops(immediates, has_non_immediates); -} - -void ZNMethodDataOops::destroy(ZNMethodDataOops* oops) { - ZNMethodAllocator::free(oops); -} - -ZNMethodDataOops::ZNMethodDataOops(const GrowableArray& immediates, bool has_non_immediates) : - _nimmediates(immediates.length()), - _has_non_immediates(has_non_immediates) { - // Save all immediate oops - for (size_t i = 0; i < _nimmediates; i++) { - immediates_begin()[i] = immediates.at(i); - } -} - -size_t ZNMethodDataOops::immediates_count() const { - return _nimmediates; -} - -oop** ZNMethodDataOops::immediates_begin() const { - // The immediate oop* array starts immediately after this object - return (oop**)((uintptr_t)this + header_size()); -} - -oop** ZNMethodDataOops::immediates_end() const { - return immediates_begin() + immediates_count(); -} - -bool ZNMethodDataOops::has_non_immediates() const { - return _has_non_immediates; -} - -class ZNMethodData { -private: - ZReentrantLock _lock; - ZNMethodDataOops* volatile _oops; - - ZNMethodData(nmethod* nm); - -public: - static ZNMethodData* create(nmethod* nm); - static void destroy(ZNMethodData* data); - - ZReentrantLock* lock(); - - ZNMethodDataOops* oops() const; - ZNMethodDataOops* swap_oops(ZNMethodDataOops* oops); -}; - -ZNMethodData* ZNMethodData::create(nmethod* nm) { - void* const mem = ZNMethodAllocator::allocate(sizeof(ZNMethodData)); - return ::new (mem) ZNMethodData(nm); -} - -void ZNMethodData::destroy(ZNMethodData* data) { - ZNMethodAllocator::free(data->oops()); - ZNMethodAllocator::free(data); -} - -ZNMethodData::ZNMethodData(nmethod* nm) : - _lock(), - _oops(NULL) {} - -ZReentrantLock* ZNMethodData::lock() { - return &_lock; -} - -ZNMethodDataOops* ZNMethodData::oops() const { - return OrderAccess::load_acquire(&_oops); -} - -ZNMethodDataOops* ZNMethodData::swap_oops(ZNMethodDataOops* new_oops) { - return Atomic::xchg(new_oops, &_oops); -} +ZNMethodTableEntry* ZNMethodTable::_table = NULL; +size_t ZNMethodTable::_size = 0; +ZNMethodTableEntry* ZNMethodTable::_iter_table = NULL; +size_t ZNMethodTable::_iter_table_size = 0; +size_t ZNMethodTable::_nregistered = 0; +size_t ZNMethodTable::_nunregistered = 0; +volatile size_t ZNMethodTable::_claimed = 0; static ZNMethodData* gc_data(const nmethod* nm) { return nm->gc_data(); @@ -158,14 +60,6 @@ static void set_gc_data(nmethod* nm, ZNMethodData* data) { return nm->set_gc_data(data); } -ZNMethodTableEntry* ZNMethodTable::_table = NULL; -size_t ZNMethodTable::_size = 0; -ZNMethodTableEntry* ZNMethodTable::_iter_table = NULL; -size_t ZNMethodTable::_iter_table_size = 0; -size_t ZNMethodTable::_nregistered = 0; -size_t ZNMethodTable::_nunregistered = 0; -volatile size_t ZNMethodTable::_claimed = 0; - void ZNMethodTable::attach_gc_data(nmethod* nm) { GrowableArray immediate_oops; bool non_immediate_oops = false; From 8fec4b7f85f6153953d1d82b3fa3bf95b1c254ba Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Wed, 20 Feb 2019 12:04:12 +0100 Subject: [PATCH 084/109] 8219468: ZGC: Extract iteration functionality into a new ZNMethodTableIteration class Reviewed-by: pliden --- src/hotspot/share/gc/z/zNMethodTable.cpp | 55 +++++--------- src/hotspot/share/gc/z/zNMethodTable.hpp | 17 +++-- .../share/gc/z/zNMethodTableIteration.cpp | 76 +++++++++++++++++++ .../share/gc/z/zNMethodTableIteration.hpp | 48 ++++++++++++ 4 files changed, 152 insertions(+), 44 deletions(-) create mode 100644 src/hotspot/share/gc/z/zNMethodTableIteration.cpp create mode 100644 src/hotspot/share/gc/z/zNMethodTableIteration.hpp diff --git a/src/hotspot/share/gc/z/zNMethodTable.cpp b/src/hotspot/share/gc/z/zNMethodTable.cpp index fa927bf84d2..9b45ddeaecd 100644 --- a/src/hotspot/share/gc/z/zNMethodTable.cpp +++ b/src/hotspot/share/gc/z/zNMethodTable.cpp @@ -33,6 +33,7 @@ #include "gc/z/zNMethodAllocator.hpp" #include "gc/z/zNMethodData.hpp" #include "gc/z/zNMethodTable.hpp" +#include "gc/z/zNMethodTableIteration.hpp" #include "gc/z/zOopClosures.inline.hpp" #include "gc/z/zTask.hpp" #include "gc/z/zWorkers.hpp" @@ -46,11 +47,9 @@ ZNMethodTableEntry* ZNMethodTable::_table = NULL; size_t ZNMethodTable::_size = 0; -ZNMethodTableEntry* ZNMethodTable::_iter_table = NULL; -size_t ZNMethodTable::_iter_table_size = 0; size_t ZNMethodTable::_nregistered = 0; size_t ZNMethodTable::_nunregistered = 0; -volatile size_t ZNMethodTable::_claimed = 0; +ZNMethodTableIteration ZNMethodTable::_iteration; static ZNMethodData* gc_data(const nmethod* nm) { return nm->gc_data(); @@ -60,6 +59,15 @@ static void set_gc_data(nmethod* nm, ZNMethodData* data) { return nm->set_gc_data(data); } +ZNMethodTableEntry* ZNMethodTable::create(size_t size) { + void* const mem = ZNMethodAllocator::allocate(size * sizeof(ZNMethodTableEntry)); + return ::new (mem) ZNMethodTableEntry[size]; +} + +void ZNMethodTable::destroy(ZNMethodTableEntry* table) { + ZNMethodAllocator::free(table); +} + void ZNMethodTable::attach_gc_data(nmethod* nm) { GrowableArray immediate_oops; bool non_immediate_oops = false; @@ -182,7 +190,7 @@ void ZNMethodTable::rebuild(size_t new_size) { _nunregistered, percent_of(_nunregistered, _size), 0.0); // Allocate new table - ZNMethodTableEntry* const new_table = new ZNMethodTableEntry[new_size]; + ZNMethodTableEntry* const new_table = ZNMethodTable::create(new_size); // Transfer all registered entries for (size_t i = 0; i < _size; i++) { @@ -192,10 +200,8 @@ void ZNMethodTable::rebuild(size_t new_size) { } } - if (_iter_table != _table) { - // Delete old table - delete [] _table; - } + // Free old table + ZNMethodTable::destroy(_table); // Install new table _table = new_table; @@ -323,7 +329,7 @@ void ZNMethodTable::register_nmethod(nmethod* nm) { void ZNMethodTable::wait_until_iteration_done() { assert(CodeCache_lock->owned_by_self(), "Lock must be held"); - while (_iter_table != NULL) { + while (_iteration.in_progress()) { CodeCache_lock->wait(Monitor::_no_safepoint_check_flag); } } @@ -363,21 +369,14 @@ void ZNMethodTable::nmethods_do_begin() { ZNMethodAllocator::activate_deferred_frees(); // Prepare iteration - _iter_table = _table; - _iter_table_size = _size; - _claimed = 0; + _iteration.nmethods_do_begin(_table, _size); } void ZNMethodTable::nmethods_do_end() { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); // Finish iteration - if (_iter_table != _table) { - delete [] _iter_table; - } - _iter_table = NULL; - - assert(_claimed >= _iter_table_size, "Failed to claim all table entries"); + _iteration.nmethods_do_end(); // Process deferred frees ZNMethodAllocator::deactivate_and_process_deferred_frees(); @@ -436,25 +435,7 @@ void ZNMethodTable::oops_do(OopClosure* cl) { } void ZNMethodTable::nmethods_do(NMethodClosure* cl) { - for (;;) { - // Claim table partition. Each partition is currently sized to span - // two cache lines. This number is just a guess, but seems to work well. - const size_t partition_size = (ZCacheLineSize * 2) / sizeof(ZNMethodTableEntry); - const size_t partition_start = MIN2(Atomic::add(partition_size, &_claimed) - partition_size, _iter_table_size); - const size_t partition_end = MIN2(partition_start + partition_size, _iter_table_size); - if (partition_start == partition_end) { - // End of table - break; - } - - // Process table partition - for (size_t i = partition_start; i < partition_end; i++) { - const ZNMethodTableEntry entry = _iter_table[i]; - if (entry.registered()) { - cl->do_nmethod(entry.method()); - } - } - } + _iteration.nmethods_do(cl); } class ZNMethodTableUnlinkClosure : public NMethodClosure { diff --git a/src/hotspot/share/gc/z/zNMethodTable.hpp b/src/hotspot/share/gc/z/zNMethodTable.hpp index 2bd19793b36..c66e96b584f 100644 --- a/src/hotspot/share/gc/z/zNMethodTable.hpp +++ b/src/hotspot/share/gc/z/zNMethodTable.hpp @@ -28,8 +28,10 @@ #include "gc/z/zGlobals.hpp" #include "gc/z/zLock.hpp" #include "gc/z/zNMethodTableEntry.hpp" +#include "gc/z/zNMethodTableIteration.hpp" #include "memory/allocation.hpp" +class nmethod; class NMethodClosure; class ZNMethodData; class ZNMethodDataOops; @@ -37,13 +39,14 @@ class ZWorkers; class ZNMethodTable : public AllStatic { private: - static ZNMethodTableEntry* _table; - static size_t _size; - static ZNMethodTableEntry* _iter_table; - static size_t _iter_table_size; - static size_t _nregistered; - static size_t _nunregistered; - static volatile size_t _claimed ATTRIBUTE_ALIGNED(ZCacheLineSize); + static ZNMethodTableEntry* _table; + static size_t _size; + static size_t _nregistered; + static size_t _nunregistered; + static ZNMethodTableIteration _iteration; + + static ZNMethodTableEntry* create(size_t size); + static void destroy(ZNMethodTableEntry* table); static void attach_gc_data(nmethod* nm); static void detach_gc_data(nmethod* nm); diff --git a/src/hotspot/share/gc/z/zNMethodTableIteration.cpp b/src/hotspot/share/gc/z/zNMethodTableIteration.cpp new file mode 100644 index 00000000000..42a400b70df --- /dev/null +++ b/src/hotspot/share/gc/z/zNMethodTableIteration.cpp @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2017, 2019, 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. + */ + +#include "precompiled.hpp" +#include "gc/z/zNMethodTableEntry.hpp" +#include "gc/z/zNMethodTableIteration.hpp" +#include "memory/iterator.hpp" +#include "runtime/atomic.hpp" +#include "utilities/debug.hpp" +#include "utilities/globalDefinitions.hpp" + +ZNMethodTableIteration::ZNMethodTableIteration() : + _table(NULL), + _size(0), + _claimed(0) {} + +bool ZNMethodTableIteration::in_progress() const { + return _table != NULL; +} + +void ZNMethodTableIteration::nmethods_do_begin(ZNMethodTableEntry* table, size_t size) { + assert(!in_progress(), "precondition"); + + _table = table; + _size = size; + _claimed = 0; +} + +void ZNMethodTableIteration::nmethods_do_end() { + assert(_claimed >= _size, "Failed to claim all table entries"); + + // Finish iteration + _table = NULL; +} + +void ZNMethodTableIteration::nmethods_do(NMethodClosure* cl) { + for (;;) { + // Claim table partition. Each partition is currently sized to span + // two cache lines. This number is just a guess, but seems to work well. + const size_t partition_size = (ZCacheLineSize * 2) / sizeof(ZNMethodTableEntry); + const size_t partition_start = MIN2(Atomic::add(partition_size, &_claimed) - partition_size, _size); + const size_t partition_end = MIN2(partition_start + partition_size, _size); + if (partition_start == partition_end) { + // End of table + break; + } + + // Process table partition + for (size_t i = partition_start; i < partition_end; i++) { + const ZNMethodTableEntry entry = _table[i]; + if (entry.registered()) { + cl->do_nmethod(entry.method()); + } + } + } +} diff --git a/src/hotspot/share/gc/z/zNMethodTableIteration.hpp b/src/hotspot/share/gc/z/zNMethodTableIteration.hpp new file mode 100644 index 00000000000..130a30b8abf --- /dev/null +++ b/src/hotspot/share/gc/z/zNMethodTableIteration.hpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#ifndef SHARE_GC_Z_ZNMETHODTABLEITERATION_HPP +#define SHARE_GC_Z_ZNMETHODTABLEITERATION_HPP + +#include "gc/z/zGlobals.hpp" + +class NMethodClosure; +class ZNMethodTableEntry; + +class ZNMethodTableIteration { +private: + ZNMethodTableEntry* _table; + size_t _size; + volatile size_t _claimed ATTRIBUTE_ALIGNED(ZCacheLineSize); + +public: + ZNMethodTableIteration(); + + bool in_progress() const; + + void nmethods_do_begin(ZNMethodTableEntry* table, size_t size); + void nmethods_do_end(); + void nmethods_do(NMethodClosure* cl); +}; + +#endif // SHARE_GC_Z_ZNMETHODTABLEITERATION_HPP From 2133bed0900ff0b259158083b68000ddb5bff8cd Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Thu, 21 Feb 2019 14:24:44 +0100 Subject: [PATCH 085/109] 8219469: ZGC: Extract functions out from ZNMethodTable into new ZNMethod class Reviewed-by: pliden --- src/hotspot/share/gc/z/zBarrierSetNMethod.cpp | 4 +- src/hotspot/share/gc/z/zCollectedHeap.cpp | 6 +- src/hotspot/share/gc/z/zNMethod.cpp | 394 ++++++++++++++++++ src/hotspot/share/gc/z/zNMethod.hpp | 60 +++ src/hotspot/share/gc/z/zNMethodTable.cpp | 331 +-------------- src/hotspot/share/gc/z/zNMethodTable.hpp | 24 +- src/hotspot/share/gc/z/zRootsIterator.cpp | 8 +- src/hotspot/share/gc/z/zUnload.cpp | 14 +- 8 files changed, 474 insertions(+), 367 deletions(-) create mode 100644 src/hotspot/share/gc/z/zNMethod.cpp create mode 100644 src/hotspot/share/gc/z/zNMethod.hpp diff --git a/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp b/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp index 9fb5b910514..f90bc0504e9 100644 --- a/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp +++ b/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp @@ -27,12 +27,12 @@ #include "gc/z/zGlobals.hpp" #include "gc/z/zLock.inline.hpp" #include "gc/z/zOopClosures.hpp" -#include "gc/z/zNMethodTable.hpp" +#include "gc/z/zNMethod.hpp" #include "gc/z/zThreadLocalData.hpp" #include "logging/log.hpp" bool ZBarrierSetNMethod::nmethod_entry_barrier(nmethod* nm) { - ZLocker locker(ZNMethodTable::lock_for_nmethod(nm)); + ZLocker locker(ZNMethod::lock_for_nmethod(nm)); log_trace(nmethod, barrier)("Entered critical zone for %p", nm); if (!is_armed(nm)) { diff --git a/src/hotspot/share/gc/z/zCollectedHeap.cpp b/src/hotspot/share/gc/z/zCollectedHeap.cpp index 8457ca53a14..49751014cff 100644 --- a/src/hotspot/share/gc/z/zCollectedHeap.cpp +++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp @@ -27,7 +27,7 @@ #include "gc/z/zCollectedHeap.hpp" #include "gc/z/zGlobals.hpp" #include "gc/z/zHeap.inline.hpp" -#include "gc/z/zNMethodTable.hpp" +#include "gc/z/zNMethod.hpp" #include "gc/z/zServiceability.hpp" #include "gc/z/zStat.hpp" #include "gc/z/zUtils.inline.hpp" @@ -255,11 +255,11 @@ bool ZCollectedHeap::block_is_obj(const HeapWord* addr) const { } void ZCollectedHeap::register_nmethod(nmethod* nm) { - ZNMethodTable::register_nmethod(nm); + ZNMethod::register_nmethod(nm); } void ZCollectedHeap::unregister_nmethod(nmethod* nm) { - ZNMethodTable::unregister_nmethod(nm); + ZNMethod::unregister_nmethod(nm); } void ZCollectedHeap::verify_nmethod(nmethod* nm) { diff --git a/src/hotspot/share/gc/z/zNMethod.cpp b/src/hotspot/share/gc/z/zNMethod.cpp new file mode 100644 index 00000000000..16d05c957a4 --- /dev/null +++ b/src/hotspot/share/gc/z/zNMethod.cpp @@ -0,0 +1,394 @@ +/* + * 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 + * 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. + */ + +#include "precompiled.hpp" +#include "code/relocInfo.hpp" +#include "code/nmethod.hpp" +#include "code/icBuffer.hpp" +#include "gc/shared/barrierSet.hpp" +#include "gc/shared/barrierSetNMethod.hpp" +#include "gc/z/zGlobals.hpp" +#include "gc/z/zLock.inline.hpp" +#include "gc/z/zNMethod.hpp" +#include "gc/z/zNMethodData.hpp" +#include "gc/z/zNMethodTable.hpp" +#include "gc/z/zOopClosures.inline.hpp" +#include "gc/z/zTask.hpp" +#include "gc/z/zWorkers.hpp" +#include "logging/log.hpp" +#include "memory/allocation.inline.hpp" +#include "memory/iterator.hpp" +#include "memory/resourceArea.hpp" +#include "runtime/atomic.hpp" +#include "runtime/orderAccess.hpp" +#include "utilities/debug.hpp" + +static ZNMethodData* gc_data(const nmethod* nm) { + return nm->gc_data(); +} + +static void set_gc_data(nmethod* nm, ZNMethodData* data) { + return nm->set_gc_data(data); +} + +void ZNMethod::attach_gc_data(nmethod* nm) { + GrowableArray immediate_oops; + bool non_immediate_oops = false; + + // Find all oops relocations + RelocIterator iter(nm); + while (iter.next()) { + if (iter.type() != relocInfo::oop_type) { + // Not an oop + continue; + } + + oop_Relocation* r = iter.oop_reloc(); + + if (!r->oop_is_immediate()) { + // Non-immediate oop found + non_immediate_oops = true; + continue; + } + + if (r->oop_value() != NULL) { + // Non-NULL immediate oop found. NULL oops can safely be + // ignored since the method will be re-registered if they + // are later patched to be non-NULL. + immediate_oops.push(r->oop_addr()); + } + } + + // Attach GC data to nmethod + ZNMethodData* data = gc_data(nm); + if (data == NULL) { + data = ZNMethodData::create(nm); + set_gc_data(nm, data); + } + + // Attach oops in GC data + ZNMethodDataOops* const new_oops = ZNMethodDataOops::create(immediate_oops, non_immediate_oops); + ZNMethodDataOops* const old_oops = data->swap_oops(new_oops); + ZNMethodDataOops::destroy(old_oops); +} + +void ZNMethod::detach_gc_data(nmethod* nm) { + // Destroy GC data + ZNMethodData::destroy(gc_data(nm)); + set_gc_data(nm, NULL); +} + +ZReentrantLock* ZNMethod::lock_for_nmethod(nmethod* nm) { + ZNMethodData* const data = gc_data(nm); + if (data == NULL) { + return NULL; + } + return data->lock(); +} + +void ZNMethod::log_register(const nmethod* nm) { + LogTarget(Trace, gc, nmethod) log; + if (!log.is_enabled()) { + return; + } + + const ZNMethodDataOops* const oops = gc_data(nm)->oops(); + + log.print("Register NMethod: %s.%s (" PTR_FORMAT "), " + "Compiler: %s, Oops: %d, ImmediateOops: " SIZE_FORMAT ", NonImmediateOops: %s", + nm->method()->method_holder()->external_name(), + nm->method()->name()->as_C_string(), + p2i(nm), + nm->compiler_name(), + nm->oops_count() - 1, + oops->immediates_count(), + oops->has_non_immediates() ? "Yes" : "No"); + + LogTarget(Trace, gc, nmethod, oops) log_oops; + if (!log_oops.is_enabled()) { + return; + } + + // Print nmethod oops table + { + oop* const begin = nm->oops_begin(); + oop* const end = nm->oops_end(); + for (oop* p = begin; p < end; p++) { + log_oops.print(" Oop[" SIZE_FORMAT "] " PTR_FORMAT " (%s)", + (p - begin), p2i(*p), (*p)->klass()->external_name()); + } + } + + // Print nmethod immediate oops + { + oop** const begin = oops->immediates_begin(); + oop** const end = oops->immediates_end(); + for (oop** p = begin; p < end; p++) { + log_oops.print(" ImmediateOop[" SIZE_FORMAT "] " PTR_FORMAT " @ " PTR_FORMAT " (%s)", + (p - begin), p2i(**p), p2i(*p), (**p)->klass()->external_name()); + } + } +} + +void ZNMethod::log_unregister(const nmethod* nm) { + LogTarget(Debug, gc, nmethod) log; + if (!log.is_enabled()) { + return; + } + + log.print("Unregister NMethod: %s.%s (" PTR_FORMAT ")", + nm->method()->method_holder()->external_name(), + nm->method()->name()->as_C_string(), + p2i(nm)); +} + +void ZNMethod::register_nmethod(nmethod* nm) { + ResourceMark rm; + + // Create and attach gc data + attach_gc_data(nm); + + log_register(nm); + + ZNMethodTable::register_nmethod(nm); + + // Disarm nmethod entry barrier + disarm_nmethod(nm); +} + +void ZNMethod::unregister_nmethod(nmethod* nm) { + assert(CodeCache_lock->owned_by_self(), "Lock must be held"); + + if (Thread::current()->is_Code_cache_sweeper_thread()) { + // The sweeper must wait for any ongoing iteration to complete + // before it can unregister an nmethod. + ZNMethodTable::wait_until_iteration_done(); + } + + ResourceMark rm; + + log_unregister(nm); + + ZNMethodTable::unregister_nmethod(nm); + + // Destroy and detach gc data + detach_gc_data(nm); +} + +void ZNMethod::disarm_nmethod(nmethod* nm) { + BarrierSetNMethod* const bs = BarrierSet::barrier_set()->barrier_set_nmethod(); + if (bs != NULL) { + bs->disarm(nm); + } +} + +void ZNMethod::nmethod_oops_do(nmethod* nm, OopClosure* cl) { + // Process oops table + { + oop* const begin = nm->oops_begin(); + oop* const end = nm->oops_end(); + for (oop* p = begin; p < end; p++) { + if (*p != Universe::non_oop_word()) { + cl->do_oop(p); + } + } + } + + ZNMethodDataOops* const oops = gc_data(nm)->oops(); + + // Process immediate oops + { + oop** const begin = oops->immediates_begin(); + oop** const end = oops->immediates_end(); + for (oop** p = begin; p < end; p++) { + if (**p != Universe::non_oop_word()) { + cl->do_oop(*p); + } + } + } + + // Process non-immediate oops + if (oops->has_non_immediates()) { + nm->fix_oop_relocations(); + } +} + +class ZNMethodToOopsDoClosure : public NMethodClosure { +private: + OopClosure* _cl; + +public: + ZNMethodToOopsDoClosure(OopClosure* cl) : + _cl(cl) {} + + virtual void do_nmethod(nmethod* nm) { + ZNMethod::nmethod_oops_do(nm, _cl); + } +}; + +void ZNMethod::oops_do_begin() { + ZNMethodTable::nmethods_do_begin(); +} + +void ZNMethod::oops_do_end() { + ZNMethodTable::nmethods_do_end(); +} + +void ZNMethod::oops_do(OopClosure* cl) { + ZNMethodToOopsDoClosure nmethod_cl(cl); + ZNMethodTable::nmethods_do(&nmethod_cl); +} + +class ZNMethodUnlinkClosure : public NMethodClosure { +private: + bool _unloading_occurred; + volatile bool _failed; + + void set_failed() { + Atomic::store(true, &_failed); + } + +public: + ZNMethodUnlinkClosure(bool unloading_occurred) : + _unloading_occurred(unloading_occurred), + _failed(false) {} + + virtual void do_nmethod(nmethod* nm) { + if (failed()) { + return; + } + + if (!nm->is_alive()) { + return; + } + + ZLocker locker(ZNMethod::lock_for_nmethod(nm)); + + if (nm->is_unloading()) { + // Unlinking of the dependencies must happen before the + // handshake separating unlink and purge. + nm->flush_dependencies(false /* delete_immediately */); + + // We don't need to take the lock when unlinking nmethods from + // the Method, because it is only concurrently unlinked by + // the entry barrier, which acquires the per nmethod lock. + nm->unlink_from_method(false /* acquire_lock */); + return; + } + + // Heal oops and disarm + ZNMethodOopClosure cl; + ZNMethod::nmethod_oops_do(nm, &cl); + ZNMethod::disarm_nmethod(nm); + + // Clear compiled ICs and exception caches + if (!nm->unload_nmethod_caches(_unloading_occurred)) { + set_failed(); + } + } + + bool failed() const { + return Atomic::load(&_failed); + } +}; + +class ZNMethodUnlinkTask : public ZTask { +private: + ZNMethodUnlinkClosure _cl; + ICRefillVerifier* _verifier; + +public: + ZNMethodUnlinkTask(bool unloading_occurred, ICRefillVerifier* verifier) : + ZTask("ZNMethodUnlinkTask"), + _cl(unloading_occurred), + _verifier(verifier) { + ZNMethodTable::nmethods_do_begin(); + } + + ~ZNMethodUnlinkTask() { + ZNMethodTable::nmethods_do_end(); + } + + virtual void work() { + ICRefillVerifierMark mark(_verifier); + ZNMethodTable::nmethods_do(&_cl); + } + + bool success() const { + return !_cl.failed(); + } +}; + +void ZNMethod::unlink(ZWorkers* workers, bool unloading_occurred) { + for (;;) { + ICRefillVerifier verifier; + + { + ZNMethodUnlinkTask task(unloading_occurred, &verifier); + workers->run_concurrent(&task); + if (task.success()) { + return; + } + } + + // Cleaning failed because we ran out of transitional IC stubs, + // so we have to refill and try again. Refilling requires taking + // a safepoint, so we temporarily leave the suspendible thread set. + SuspendibleThreadSetLeaver sts; + InlineCacheBuffer::refill_ic_stubs(); + } +} + +class ZNMethodPurgeClosure : public NMethodClosure { +public: + virtual void do_nmethod(nmethod* nm) { + if (nm->is_alive() && nm->is_unloading()) { + nm->make_unloaded(); + } + } +}; + +class ZNMethodPurgeTask : public ZTask { +private: + ZNMethodPurgeClosure _cl; + +public: + ZNMethodPurgeTask() : + ZTask("ZNMethodPurgeTask"), + _cl() { + ZNMethodTable::nmethods_do_begin(); + } + + ~ZNMethodPurgeTask() { + ZNMethodTable::nmethods_do_end(); + } + + virtual void work() { + ZNMethodTable::nmethods_do(&_cl); + } +}; + +void ZNMethod::purge(ZWorkers* workers) { + ZNMethodPurgeTask task; + workers->run_concurrent(&task); +} diff --git a/src/hotspot/share/gc/z/zNMethod.hpp b/src/hotspot/share/gc/z/zNMethod.hpp new file mode 100644 index 00000000000..5146a35c8e8 --- /dev/null +++ b/src/hotspot/share/gc/z/zNMethod.hpp @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#ifndef SHARE_GC_Z_ZNMETHOD_HPP +#define SHARE_GC_Z_ZNMETHOD_HPP + +#include "memory/allocation.hpp" + +class nmethod; +class OopClosure; +class ZReentrantLock; +class ZWorkers; + +class ZNMethod : public AllStatic { +private: + static void attach_gc_data(nmethod* nm); + static void detach_gc_data(nmethod* nm); + + static void log_register(const nmethod* nm); + static void log_unregister(const nmethod* nm); + +public: + static void register_nmethod(nmethod* nm); + static void unregister_nmethod(nmethod* nm); + + static void disarm_nmethod(nmethod* nm); + + static void nmethod_oops_do(nmethod* nm, OopClosure* cl); + + static void oops_do_begin(); + static void oops_do_end(); + static void oops_do(OopClosure* cl); + + static ZReentrantLock* lock_for_nmethod(nmethod* nm); + + static void unlink(ZWorkers* workers, bool unloading_occurred); + static void purge(ZWorkers* workers); +}; + +#endif // SHARE_GC_Z_ZNMETHOD_HPP diff --git a/src/hotspot/share/gc/z/zNMethodTable.cpp b/src/hotspot/share/gc/z/zNMethodTable.cpp index 9b45ddeaecd..6a16b678cec 100644 --- a/src/hotspot/share/gc/z/zNMethodTable.cpp +++ b/src/hotspot/share/gc/z/zNMethodTable.cpp @@ -33,6 +33,7 @@ #include "gc/z/zNMethodAllocator.hpp" #include "gc/z/zNMethodData.hpp" #include "gc/z/zNMethodTable.hpp" +#include "gc/z/zNMethodTableEntry.hpp" #include "gc/z/zNMethodTableIteration.hpp" #include "gc/z/zOopClosures.inline.hpp" #include "gc/z/zTask.hpp" @@ -51,14 +52,6 @@ size_t ZNMethodTable::_nregistered = 0; size_t ZNMethodTable::_nunregistered = 0; ZNMethodTableIteration ZNMethodTable::_iteration; -static ZNMethodData* gc_data(const nmethod* nm) { - return nm->gc_data(); -} - -static void set_gc_data(nmethod* nm, ZNMethodData* data) { - return nm->set_gc_data(data); -} - ZNMethodTableEntry* ZNMethodTable::create(size_t size) { void* const mem = ZNMethodAllocator::allocate(size * sizeof(ZNMethodTableEntry)); return ::new (mem) ZNMethodTableEntry[size]; @@ -68,61 +61,6 @@ void ZNMethodTable::destroy(ZNMethodTableEntry* table) { ZNMethodAllocator::free(table); } -void ZNMethodTable::attach_gc_data(nmethod* nm) { - GrowableArray immediate_oops; - bool non_immediate_oops = false; - - // Find all oops relocations - RelocIterator iter(nm); - while (iter.next()) { - if (iter.type() != relocInfo::oop_type) { - // Not an oop - continue; - } - - oop_Relocation* r = iter.oop_reloc(); - - if (!r->oop_is_immediate()) { - // Non-immediate oop found - non_immediate_oops = true; - continue; - } - - if (r->oop_value() != NULL) { - // Non-NULL immediate oop found. NULL oops can safely be - // ignored since the method will be re-registered if they - // are later patched to be non-NULL. - immediate_oops.push(r->oop_addr()); - } - } - - // Attach GC data to nmethod - ZNMethodData* data = gc_data(nm); - if (data == NULL) { - data = ZNMethodData::create(nm); - set_gc_data(nm, data); - } - - // Attach oops in GC data - ZNMethodDataOops* const new_oops = ZNMethodDataOops::create(immediate_oops, non_immediate_oops); - ZNMethodDataOops* const old_oops = data->swap_oops(new_oops); - ZNMethodDataOops::destroy(old_oops); -} - -void ZNMethodTable::detach_gc_data(nmethod* nm) { - // Destroy GC data - ZNMethodData::destroy(gc_data(nm)); - set_gc_data(nm, NULL); -} - -ZReentrantLock* ZNMethodTable::lock_for_nmethod(nmethod* nm) { - ZNMethodData* const data = gc_data(nm); - if (data == NULL) { - return NULL; - } - return data->lock(); -} - size_t ZNMethodTable::first_index(const nmethod* nm, size_t size) { assert(is_power_of_2(size), "Invalid size"); const size_t mask = size - 1; @@ -238,62 +176,6 @@ void ZNMethodTable::rebuild_if_needed() { } } -void ZNMethodTable::log_register(const nmethod* nm) { - LogTarget(Trace, gc, nmethod) log; - if (!log.is_enabled()) { - return; - } - - const ZNMethodDataOops* const oops = gc_data(nm)->oops(); - - log.print("Register NMethod: %s.%s (" PTR_FORMAT "), " - "Compiler: %s, Oops: %d, ImmediateOops: " SIZE_FORMAT ", NonImmediateOops: %s", - nm->method()->method_holder()->external_name(), - nm->method()->name()->as_C_string(), - p2i(nm), - nm->compiler_name(), - nm->oops_count() - 1, - oops->immediates_count(), - oops->has_non_immediates() ? "Yes" : "No"); - - LogTarget(Trace, gc, nmethod, oops) log_oops; - if (!log_oops.is_enabled()) { - return; - } - - // Print nmethod oops table - { - oop* const begin = nm->oops_begin(); - oop* const end = nm->oops_end(); - for (oop* p = begin; p < end; p++) { - log_oops.print(" Oop[" SIZE_FORMAT "] " PTR_FORMAT " (%s)", - (p - begin), p2i(*p), (*p)->klass()->external_name()); - } - } - - // Print nmethod immediate oops - { - oop** const begin = oops->immediates_begin(); - oop** const end = oops->immediates_end(); - for (oop** p = begin; p < end; p++) { - log_oops.print(" ImmediateOop[" SIZE_FORMAT "] " PTR_FORMAT " @ " PTR_FORMAT " (%s)", - (p - begin), p2i(**p), p2i(*p), (**p)->klass()->external_name()); - } - } -} - -void ZNMethodTable::log_unregister(const nmethod* nm) { - LogTarget(Debug, gc, nmethod) log; - if (!log.is_enabled()) { - return; - } - - log.print("Unregister NMethod: %s.%s (" PTR_FORMAT ")", - nm->method()->method_holder()->external_name(), - nm->method()->name()->as_C_string(), - p2i(nm)); -} - size_t ZNMethodTable::registered_nmethods() { return _nregistered; } @@ -304,16 +186,10 @@ size_t ZNMethodTable::unregistered_nmethods() { void ZNMethodTable::register_nmethod(nmethod* nm) { assert(CodeCache_lock->owned_by_self(), "Lock must be held"); - ResourceMark rm; // Grow/Shrink/Prune table if needed rebuild_if_needed(); - // Create and attach gc data - attach_gc_data(nm); - - log_register(nm); - // Insert new entry if (register_entry(_table, _size, nm)) { // New entry registered. When register_entry() instead returns @@ -321,9 +197,6 @@ void ZNMethodTable::register_nmethod(nmethod* nm) { // to increase number of registered entries in that case. _nregistered++; } - - // Disarm nmethod entry barrier - disarm_nmethod(nm); } void ZNMethodTable::wait_until_iteration_done() { @@ -337,29 +210,10 @@ void ZNMethodTable::wait_until_iteration_done() { void ZNMethodTable::unregister_nmethod(nmethod* nm) { assert(CodeCache_lock->owned_by_self(), "Lock must be held"); - if (Thread::current()->is_Code_cache_sweeper_thread()) { - // The sweeper must wait for any ongoing iteration to complete - // before it can unregister an nmethod. - ZNMethodTable::wait_until_iteration_done(); - } - - ResourceMark rm; - - log_unregister(nm); - // Remove entry unregister_entry(_table, _size, nm); _nunregistered++; _nregistered--; - - detach_gc_data(nm); -} - -void ZNMethodTable::disarm_nmethod(nmethod* nm) { - BarrierSetNMethod* const bs = BarrierSet::barrier_set()->barrier_set_nmethod(); - if (bs != NULL) { - bs->disarm(nm); - } } void ZNMethodTable::nmethods_do_begin() { @@ -385,189 +239,6 @@ void ZNMethodTable::nmethods_do_end() { CodeCache_lock->notify_all(); } -void ZNMethodTable::oops_do(nmethod* nm, OopClosure* cl) { - // Process oops table - { - oop* const begin = nm->oops_begin(); - oop* const end = nm->oops_end(); - for (oop* p = begin; p < end; p++) { - if (*p != Universe::non_oop_word()) { - cl->do_oop(p); - } - } - } - - ZNMethodDataOops* const oops = gc_data(nm)->oops(); - - // Process immediate oops - { - oop** const begin = oops->immediates_begin(); - oop** const end = oops->immediates_end(); - for (oop** p = begin; p < end; p++) { - if (**p != Universe::non_oop_word()) { - cl->do_oop(*p); - } - } - } - - // Process non-immediate oops - if (oops->has_non_immediates()) { - nm->fix_oop_relocations(); - } -} - -class ZNMethodToOopsDoClosure : public NMethodClosure { -private: - OopClosure* _cl; - -public: - ZNMethodToOopsDoClosure(OopClosure* cl) : - _cl(cl) {} - - virtual void do_nmethod(nmethod* nm) { - ZNMethodTable::oops_do(nm, _cl); - } -}; - -void ZNMethodTable::oops_do(OopClosure* cl) { - ZNMethodToOopsDoClosure nm_cl(cl); - nmethods_do(&nm_cl); -} - void ZNMethodTable::nmethods_do(NMethodClosure* cl) { _iteration.nmethods_do(cl); } - -class ZNMethodTableUnlinkClosure : public NMethodClosure { -private: - bool _unloading_occurred; - volatile bool _failed; - - void set_failed() { - Atomic::store(true, &_failed); - } - -public: - ZNMethodTableUnlinkClosure(bool unloading_occurred) : - _unloading_occurred(unloading_occurred), - _failed(false) {} - - virtual void do_nmethod(nmethod* nm) { - if (failed()) { - return; - } - - if (!nm->is_alive()) { - return; - } - - ZLocker locker(ZNMethodTable::lock_for_nmethod(nm)); - - if (nm->is_unloading()) { - // Unlinking of the dependencies must happen before the - // handshake separating unlink and purge. - nm->flush_dependencies(false /* delete_immediately */); - - // We don't need to take the lock when unlinking nmethods from - // the Method, because it is only concurrently unlinked by - // the entry barrier, which acquires the per nmethod lock. - nm->unlink_from_method(false /* acquire_lock */); - return; - } - - // Heal oops and disarm - ZNMethodOopClosure cl; - ZNMethodTable::oops_do(nm, &cl); - ZNMethodTable::disarm_nmethod(nm); - - // Clear compiled ICs and exception caches - if (!nm->unload_nmethod_caches(_unloading_occurred)) { - set_failed(); - } - } - - bool failed() const { - return Atomic::load(&_failed); - } -}; - -class ZNMethodTableUnlinkTask : public ZTask { -private: - ZNMethodTableUnlinkClosure _cl; - ICRefillVerifier* _verifier; - -public: - ZNMethodTableUnlinkTask(bool unloading_occurred, ICRefillVerifier* verifier) : - ZTask("ZNMethodTableUnlinkTask"), - _cl(unloading_occurred), - _verifier(verifier) { - ZNMethodTable::nmethods_do_begin(); - } - - ~ZNMethodTableUnlinkTask() { - ZNMethodTable::nmethods_do_end(); - } - - virtual void work() { - ICRefillVerifierMark mark(_verifier); - ZNMethodTable::nmethods_do(&_cl); - } - - bool success() const { - return !_cl.failed(); - } -}; - -void ZNMethodTable::unlink(ZWorkers* workers, bool unloading_occurred) { - for (;;) { - ICRefillVerifier verifier; - - { - ZNMethodTableUnlinkTask task(unloading_occurred, &verifier); - workers->run_concurrent(&task); - if (task.success()) { - return; - } - } - - // Cleaning failed because we ran out of transitional IC stubs, - // so we have to refill and try again. Refilling requires taking - // a safepoint, so we temporarily leave the suspendible thread set. - SuspendibleThreadSetLeaver sts; - InlineCacheBuffer::refill_ic_stubs(); - } -} - -class ZNMethodTablePurgeClosure : public NMethodClosure { -public: - virtual void do_nmethod(nmethod* nm) { - if (nm->is_alive() && nm->is_unloading()) { - nm->make_unloaded(); - } - } -}; - -class ZNMethodTablePurgeTask : public ZTask { -private: - ZNMethodTablePurgeClosure _cl; - -public: - ZNMethodTablePurgeTask() : - ZTask("ZNMethodTablePurgeTask"), - _cl() { - ZNMethodTable::nmethods_do_begin(); - } - - ~ZNMethodTablePurgeTask() { - ZNMethodTable::nmethods_do_end(); - } - - virtual void work() { - ZNMethodTable::nmethods_do(&_cl); - } -}; - -void ZNMethodTable::purge(ZWorkers* workers) { - ZNMethodTablePurgeTask task; - workers->run_concurrent(&task); -} diff --git a/src/hotspot/share/gc/z/zNMethodTable.hpp b/src/hotspot/share/gc/z/zNMethodTable.hpp index c66e96b584f..8a2c1395023 100644 --- a/src/hotspot/share/gc/z/zNMethodTable.hpp +++ b/src/hotspot/share/gc/z/zNMethodTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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,17 +24,12 @@ #ifndef SHARE_GC_Z_ZNMETHODTABLE_HPP #define SHARE_GC_Z_ZNMETHODTABLE_HPP -#include "gc/z/zArray.hpp" -#include "gc/z/zGlobals.hpp" -#include "gc/z/zLock.hpp" -#include "gc/z/zNMethodTableEntry.hpp" #include "gc/z/zNMethodTableIteration.hpp" #include "memory/allocation.hpp" class nmethod; class NMethodClosure; -class ZNMethodData; -class ZNMethodDataOops; +class ZNMethodTableEntry; class ZWorkers; class ZNMethodTable : public AllStatic { @@ -48,36 +43,23 @@ private: static ZNMethodTableEntry* create(size_t size); static void destroy(ZNMethodTableEntry* table); - static void attach_gc_data(nmethod* nm); - static void detach_gc_data(nmethod* nm); - static size_t first_index(const nmethod* nm, size_t size); static size_t next_index(size_t prev_index, size_t size); - static void wait_until_iteration_done(); - static bool register_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm); static void unregister_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm); static void rebuild(size_t new_size); static void rebuild_if_needed(); - static void log_register(const nmethod* nm); - static void log_unregister(const nmethod* nm); - public: static size_t registered_nmethods(); static size_t unregistered_nmethods(); static void register_nmethod(nmethod* nm); static void unregister_nmethod(nmethod* nm); - static void disarm_nmethod(nmethod* nm); - static ZReentrantLock* lock_for_nmethod(nmethod* nm); - - static void oops_do(OopClosure* cl); - - static void oops_do(nmethod* nm, OopClosure* cl); + static void wait_until_iteration_done(); static void nmethods_do_begin(); static void nmethods_do_end(); diff --git a/src/hotspot/share/gc/z/zRootsIterator.cpp b/src/hotspot/share/gc/z/zRootsIterator.cpp index a4064bb88e1..74d034aa425 100644 --- a/src/hotspot/share/gc/z/zRootsIterator.cpp +++ b/src/hotspot/share/gc/z/zRootsIterator.cpp @@ -33,7 +33,7 @@ #include "gc/shared/suspendibleThreadSet.hpp" #include "gc/z/zBarrierSetNMethod.hpp" #include "gc/z/zGlobals.hpp" -#include "gc/z/zNMethodTable.hpp" +#include "gc/z/zNMethod.hpp" #include "gc/z/zOopClosures.inline.hpp" #include "gc/z/zRootsIterator.hpp" #include "gc/z/zStat.hpp" @@ -184,7 +184,7 @@ ZRootsIterator::ZRootsIterator() : if (ClassUnloading) { nmethod::oops_do_marking_prologue(); } else { - ZNMethodTable::nmethods_do_begin(); + ZNMethod::oops_do_begin(); } } @@ -194,7 +194,7 @@ ZRootsIterator::~ZRootsIterator() { if (ClassUnloading) { nmethod::oops_do_marking_epilogue(); } else { - ZNMethodTable::nmethods_do_end(); + ZNMethod::oops_do_end(); } JvmtiExport::gc_epilogue(); @@ -242,7 +242,7 @@ void ZRootsIterator::do_threads(ZRootsIteratorClosure* cl) { void ZRootsIterator::do_code_cache(ZRootsIteratorClosure* cl) { ZStatTimer timer(ZSubPhasePauseRootsCodeCache); - ZNMethodTable::oops_do(cl); + ZNMethod::oops_do(cl); } void ZRootsIterator::oops_do(ZRootsIteratorClosure* cl, bool visit_jvmti_weak_export) { diff --git a/src/hotspot/share/gc/z/zUnload.cpp b/src/hotspot/share/gc/z/zUnload.cpp index 5d1cd1053f1..8f09d76d761 100644 --- a/src/hotspot/share/gc/z/zUnload.cpp +++ b/src/hotspot/share/gc/z/zUnload.cpp @@ -30,7 +30,7 @@ #include "gc/shared/gcBehaviours.hpp" #include "gc/shared/suspendibleThreadSet.hpp" #include "gc/z/zLock.inline.hpp" -#include "gc/z/zNMethodTable.hpp" +#include "gc/z/zNMethod.hpp" #include "gc/z/zOopClosures.hpp" #include "gc/z/zStat.hpp" #include "gc/z/zUnload.hpp" @@ -75,7 +75,7 @@ private: public: virtual bool is_unloading(CompiledMethod* method) const { nmethod* const nm = method->as_nmethod(); - ZReentrantLock* const lock = ZNMethodTable::lock_for_nmethod(nm); + ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm); if (lock == NULL) { return is_unloading(nm); } else { @@ -89,7 +89,7 @@ class ZCompiledICProtectionBehaviour : public CompiledICProtectionBehaviour { public: virtual bool lock(CompiledMethod* method) { nmethod* const nm = method->as_nmethod(); - ZReentrantLock* const lock = ZNMethodTable::lock_for_nmethod(nm); + ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm); if (lock != NULL) { lock->lock(); } @@ -98,7 +98,7 @@ public: virtual void unlock(CompiledMethod* method) { nmethod* const nm = method->as_nmethod(); - ZReentrantLock* const lock = ZNMethodTable::lock_for_nmethod(nm); + ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm); if (lock != NULL) { lock->unlock(); } @@ -110,7 +110,7 @@ public: } nmethod* const nm = method->as_nmethod(); - ZReentrantLock* const lock = ZNMethodTable::lock_for_nmethod(nm); + ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm); return lock == NULL || lock->is_owned(); } }; @@ -149,7 +149,7 @@ void ZUnload::unlink() { Klass::clean_weak_klass_links(unloading_occurred); - ZNMethodTable::unlink(_workers, unloading_occurred); + ZNMethod::unlink(_workers, unloading_occurred); DependencyContext::cleaning_end(); } @@ -157,7 +157,7 @@ void ZUnload::unlink() { void ZUnload::purge() { { SuspendibleThreadSetJoiner sts; - ZNMethodTable::purge(_workers); + ZNMethod::purge(_workers); } ClassLoaderDataGraph::purge(); From 74d466fd5f1bba0a8164c7f95efd2ae10e23f593 Mon Sep 17 00:00:00 2001 From: Robbin Ehn Date: Fri, 22 Feb 2019 14:20:06 +0100 Subject: [PATCH 086/109] 8219436: Safepoint logs correction and misc Reviewed-by: mdoerr, coleenp --- src/hotspot/share/jfr/metadata/metadata.xml | 6 - src/hotspot/share/prims/jni.cpp | 3 - src/hotspot/share/runtime/init.cpp | 5 +- src/hotspot/share/runtime/safepoint.cpp | 368 +++++++----------- src/hotspot/share/runtime/safepoint.hpp | 60 ++- .../share/runtime/tieredThresholdPolicy.cpp | 4 +- src/hotspot/share/runtime/vmOperations.hpp | 18 +- src/hotspot/share/runtime/vmThread.cpp | 45 +-- src/hotspot/share/runtime/vmThread.hpp | 10 +- src/hotspot/share/services/runtimeService.cpp | 78 +--- src/hotspot/share/services/runtimeService.hpp | 15 +- src/jdk.jfr/share/conf/jfr/default.jfc | 5 - src/jdk.jfr/share/conf/jfr/profile.jfc | 5 - .../jtreg/runtime/logging/SafepointTest.java | 2 - .../event/runtime/TestSafepointEvents.java | 1 - test/lib/jdk/test/lib/jfr/EventNames.java | 1 - 16 files changed, 238 insertions(+), 388 deletions(-) diff --git a/src/hotspot/share/jfr/metadata/metadata.xml b/src/hotspot/share/jfr/metadata/metadata.xml index b590b9b9679..1821714887e 100644 --- a/src/hotspot/share/jfr/metadata/metadata.xml +++ b/src/hotspot/share/jfr/metadata/metadata.xml @@ -533,12 +533,6 @@ - - - - - diff --git a/src/hotspot/share/prims/jni.cpp b/src/hotspot/share/prims/jni.cpp index 096af7f7271..397f137948a 100644 --- a/src/hotspot/share/prims/jni.cpp +++ b/src/hotspot/share/prims/jni.cpp @@ -3953,9 +3953,6 @@ static jint JNI_CreateJavaVM_inner(JavaVM **vm, void **penv, void *args) { } #endif - // Tracks the time application was running before GC - RuntimeService::record_application_start(); - // Notify JVMTI if (JvmtiExport::should_post_thread_life()) { JvmtiExport::post_thread_start(thread); diff --git a/src/hotspot/share/runtime/init.cpp b/src/hotspot/share/runtime/init.cpp index 490f9d67108..772987c02fb 100644 --- a/src/hotspot/share/runtime/init.cpp +++ b/src/hotspot/share/runtime/init.cpp @@ -174,10 +174,7 @@ void exit_globals() { ObjectSynchronizer::audit_and_print_stats(true /* on_exit */); } perfMemory_exit(); - if (log_is_enabled(Debug, safepoint, stats)) { - // Print the collected safepoint statistics. - SafepointSynchronize::print_stat_on_exit(); - } + SafepointTracing::statistics_exit_log(); if (PrintStringTableStatistics) { SymbolTable::dump(tty); StringTable::dump(tty); diff --git a/src/hotspot/share/runtime/safepoint.cpp b/src/hotspot/share/runtime/safepoint.cpp index de5464a24e3..2f353197378 100644 --- a/src/hotspot/share/runtime/safepoint.cpp +++ b/src/hotspot/share/runtime/safepoint.cpp @@ -103,16 +103,6 @@ static void post_safepoint_synchronize_event(EventSafepointStateSynchronization& } } -static void post_safepoint_wait_blocked_event(EventSafepointWaitBlocked& event, - uint64_t safepoint_id, - int initial_threads_waiting_to_block) { - if (event.should_commit()) { - event.set_safepointId(safepoint_id); - event.set_runningThreadCount(initial_threads_waiting_to_block); - event.commit(); - } -} - static void post_safepoint_cleanup_task_event(EventSafepointCleanupTask& event, uint64_t safepoint_id, const char* name) { @@ -138,27 +128,21 @@ int SafepointSynchronize::_waiting_to_block = 0; volatile uint64_t SafepointSynchronize::_safepoint_counter = 0; const uint64_t SafepointSynchronize::InactiveSafepointCounter = 0; int SafepointSynchronize::_current_jni_active_count = 0; -long SafepointSynchronize::_end_of_last_safepoint = 0; WaitBarrier* SafepointSynchronize::_wait_barrier; -// We need a place to save the desc since it is released before we need it. -static char stopped_description[64] = ""; -static bool _vm_is_waiting = false; - static volatile bool PageArmed = false; // safepoint polling page is RO|RW vs PROT_NONE static bool timeout_error_printed = false; // Statistic related -julong SafepointSynchronize::_coalesced_vmop_count = 0; static jlong _safepoint_begin_time = 0; -static float _ts_of_current_safepoint = 0.0f; static volatile int _nof_threads_hit_polling_page = 0; void SafepointSynchronize::init(Thread* vmthread) { // WaitBarrier should never be destroyed since we will have // threads waiting on it while exiting. _wait_barrier = new WaitBarrier(vmthread); + SafepointTracing::init(); } void SafepointSynchronize::increment_jni_active_count() { @@ -244,16 +228,13 @@ int SafepointSynchronize::synchronize_threads(jlong safepoint_limit_time, int no DEBUG_ONLY(assert_list_is_valid(tss_head, still_running);) *initial_running = still_running; - if (log_is_enabled(Debug, safepoint, stats)) { - begin_statistics(nof_threads, still_running); - } int iterations = 1; // The first iteration is above. while (still_running > 0) { // Check if this has taken too long: if (SafepointTimeout && safepoint_limit_time < os::javaTimeNanos()) { - print_safepoint_timeout(_spinning_timeout); + print_safepoint_timeout(); } if (int(iterations) == -1) { // overflow - something is wrong. // We can only overflow here when we are using global @@ -291,9 +272,6 @@ int SafepointSynchronize::synchronize_threads(jlong safepoint_limit_time, int no assert(tss_head == NULL, "Must be empty"); - if (log_is_enabled(Debug, safepoint, stats)) { - update_statistics_on_spin_end(); - } return iterations; } @@ -303,8 +281,11 @@ void SafepointSynchronize::arm_safepoint() { // stopped by different mechanisms: // // 1. Running interpreted - // The interpreter dispatch table is changed to force it to - // check for a safepoint condition between bytecodes. + // When executing branching/returning byte codes interpreter + // checks if the poll is armed, if so blocks in SS::block(). + // When using global polling the interpreter dispatch table + // is changed to force it to check for a safepoint condition + // between bytecodes. // 2. Running in native code // When returning from the native code, a Java thread must check // the safepoint _state to see if we must block. If the @@ -322,9 +303,9 @@ void SafepointSynchronize::arm_safepoint() { // block condition until the safepoint operation is complete. // 5. In VM or Transitioning between states // If a Java thread is currently running in the VM or transitioning - // between states, the safepointing code will wait for the thread to - // block itself when it attempts transitions to a new state. - // + // between states, the safepointing code will poll the thread state + // until the thread blocks itself when it attempts transitions to a + // new state or locking a safepoint checked monitor. // We must never miss a thread with correct safepoint id, so we must make sure we arm // the wait barrier for the next safepoint id/counter. @@ -363,17 +344,10 @@ void SafepointSynchronize::arm_safepoint() { // Roll all threads forward to a safepoint and suspend them all void SafepointSynchronize::begin() { - EventSafepointBegin begin_event; assert(Thread::current()->is_VM_thread(), "Only VM thread may execute a safepoint"); - strncpy(stopped_description, VMThread::vm_safepoint_description(), sizeof(stopped_description) - 1); - stopped_description[sizeof(stopped_description) - 1] = '\0'; - - if (log_is_enabled(Debug, safepoint, stats)) { - _safepoint_begin_time = os::javaTimeNanos(); - _ts_of_current_safepoint = tty->time_stamp().seconds(); - _nof_threads_hit_polling_page = 0; - } + EventSafepointBegin begin_event; + SafepointTracing::begin(VMThread::vm_op_type()); Universe::heap()->safepoint_synchronize_begin(); @@ -385,9 +359,9 @@ void SafepointSynchronize::begin() { int nof_threads = Threads::number_of_threads(); - log_debug(safepoint)("Safepoint synchronization initiated using %s wait barrier. (%d threads)", _wait_barrier->description(), nof_threads); + _nof_threads_hit_polling_page = 0; - RuntimeService::record_safepoint_begin(); + log_debug(safepoint)("Safepoint synchronization initiated using %s wait barrier. (%d threads)", _wait_barrier->description(), nof_threads); // Reset the count of active JNI critical threads _current_jni_active_count = 0; @@ -399,9 +373,9 @@ void SafepointSynchronize::begin() { if (SafepointTimeout) { // Set the limit time, so that it can be compared to see if this has taken // too long to complete. - safepoint_limit_time = os::javaTimeNanos() + (jlong)SafepointTimeoutDelay * MICROUNITS; + safepoint_limit_time = SafepointTracing::start_of_safepoint() + (jlong)SafepointTimeoutDelay * (NANOUNITS / MILLIUNITS); + timeout_error_printed = false; } - timeout_error_printed = false; EventSafepointStateSynchronization sync_event; int initial_running = 0; @@ -413,20 +387,13 @@ void SafepointSynchronize::begin() { int iterations = synchronize_threads(safepoint_limit_time, nof_threads, &initial_running); assert(_waiting_to_block == 0, "No thread should be running"); - post_safepoint_synchronize_event(sync_event, _safepoint_counter, initial_running, - _waiting_to_block, iterations); - - // Keep event from now. - EventSafepointWaitBlocked wait_blocked_event; - #ifndef PRODUCT - if (SafepointTimeout) { + if (safepoint_limit_time != 0) { jlong current_time = os::javaTimeNanos(); if (safepoint_limit_time < current_time) { log_warning(safepoint)("# SafepointSynchronize: Finished after " INT64_FORMAT_W(6) " ms", - (int64_t)((current_time - safepoint_limit_time) / MICROUNITS + - (jlong)SafepointTimeoutDelay)); + (int64_t)(current_time - SafepointTracing::start_of_safepoint()) / (NANOUNITS / MILLIUNITS)); } } #endif @@ -438,8 +405,6 @@ void SafepointSynchronize::begin() { OrderAccess::fence(); - post_safepoint_wait_blocked_event(wait_blocked_event, _safepoint_counter, 0); - #ifdef ASSERT // Make sure all the threads were visited. for (JavaThreadIteratorWithHandle jtiwh; JavaThread *cur = jtiwh.next(); ) { @@ -450,12 +415,12 @@ void SafepointSynchronize::begin() { // Update the count of active JNI critical regions GCLocker::set_jni_lock_count(_current_jni_active_count); - log_info(safepoint)("Entering safepoint region: %s", stopped_description); + post_safepoint_synchronize_event(sync_event, + _safepoint_counter, + initial_running, + _waiting_to_block, iterations); - RuntimeService::record_safepoint_synchronized(); - if (log_is_enabled(Debug, safepoint, stats)) { - update_statistics_on_sync_end(os::javaTimeNanos()); - } + SafepointTracing::synchronized(nof_threads, initial_running, _nof_threads_hit_polling_page); // We do the safepoint cleanup first since a GC related safepoint // needs cleanup to be completed before running the GC op. @@ -463,12 +428,8 @@ void SafepointSynchronize::begin() { do_cleanup_tasks(); post_safepoint_cleanup_event(cleanup_event, _safepoint_counter); - if (log_is_enabled(Debug, safepoint, stats)) { - // Record how much time spend on the above cleanup tasks - update_statistics_on_cleanup_end(os::javaTimeNanos()); - } - post_safepoint_begin_event(begin_event, _safepoint_counter, nof_threads, _current_jni_active_count); + SafepointTracing::cleanup(); } void SafepointSynchronize::disarm_safepoint() { @@ -520,10 +481,6 @@ void SafepointSynchronize::disarm_safepoint() { } } // ~JavaThreadIteratorWithHandle - log_info(safepoint)("Leaving safepoint region"); - - RuntimeService::record_safepoint_end(); - // Release threads lock, so threads can be created/destroyed again. Threads_lock->unlock(); @@ -539,19 +496,11 @@ void SafepointSynchronize::end() { uint64_t safepoint_id = _safepoint_counter; assert(Thread::current()->is_VM_thread(), "Only VM thread can execute a safepoint"); - if (log_is_enabled(Debug, safepoint, stats)) { - end_statistics(os::javaTimeNanos()); - } - disarm_safepoint(); - RuntimeService::record_safepoint_epilog(stopped_description); - Universe::heap()->safepoint_synchronize_end(); - // record this time so VMThread can keep track how much time has elapsed - // since last safepoint. - _end_of_last_safepoint = os::javaTimeMillis(); + SafepointTracing::end(); post_safepoint_end_event(event, safepoint_id); } @@ -915,7 +864,7 @@ void SafepointSynchronize::handle_polling_page_exception(JavaThread *thread) { assert(SafepointSynchronize::is_synchronizing(), "polling encountered outside safepoint synchronization"); } - if (log_is_enabled(Debug, safepoint, stats)) { + if (log_is_enabled(Info, safepoint, stats)) { Atomic::inc(&_nof_threads_hit_polling_page); } @@ -925,7 +874,7 @@ void SafepointSynchronize::handle_polling_page_exception(JavaThread *thread) { } -void SafepointSynchronize::print_safepoint_timeout(SafepointTimeoutReason reason) { +void SafepointSynchronize::print_safepoint_timeout() { if (!timeout_error_printed) { timeout_error_printed = true; // Print out the thread info which didn't reach the safepoint for debugging @@ -937,20 +886,10 @@ void SafepointSynchronize::print_safepoint_timeout(SafepointTimeoutReason reason ls.cr(); ls.print_cr("# SafepointSynchronize::begin: Timeout detected:"); - if (reason == _spinning_timeout) { - ls.print_cr("# SafepointSynchronize::begin: Timed out while spinning to reach a safepoint."); - } else if (reason == _blocking_timeout) { - ls.print_cr("# SafepointSynchronize::begin: Timed out while waiting for threads to stop."); - } - + ls.print_cr("# SafepointSynchronize::begin: Timed out while spinning to reach a safepoint."); ls.print_cr("# SafepointSynchronize::begin: Threads which did not reach the safepoint:"); - ThreadSafepointState *cur_state; for (JavaThreadIteratorWithHandle jtiwh; JavaThread *cur_thread = jtiwh.next(); ) { - cur_state = cur_thread->safepoint_state(); - - if (cur_thread->thread_state() != _thread_blocked && - ((reason == _spinning_timeout && cur_state->is_running()) || - (reason == _blocking_timeout))) { + if (cur_thread->safepoint_state()->is_running()) { ls.print("# "); cur_thread->print_on(&ls); ls.cr(); @@ -964,11 +903,10 @@ void SafepointSynchronize::print_safepoint_timeout(SafepointTimeoutReason reason // ShowMessageBoxOnError. if (AbortVMOnSafepointTimeout) { fatal("Safepoint sync time longer than " INTX_FORMAT "ms detected when executing %s.", - SafepointTimeoutDelay, VMThread::vm_safepoint_description()); + SafepointTimeoutDelay, VMThread::vm_operation()->name()); } } - // ------------------------------------------------------------------------------------------------------- // Implementation of ThreadSafepointState @@ -1176,108 +1114,25 @@ void ThreadSafepointState::handle_polling_page_exception() { } -// -// Statistics & Instrumentations -// -struct SafepointStats { - float _time_stamp; // record when the current safepoint occurs in seconds - int _vmop_type; // tyep of VM operation triggers the safepoint - int _nof_total_threads; // total number of Java threads - int _nof_initial_running_threads; // total number of initially seen running threads - int _nof_threads_wait_to_block; // total number of threads waiting for to block - bool _page_armed; // true if polling page is armed, false otherwise - int _nof_threads_hit_page_trap; // total number of threads hitting the page trap - jlong _time_to_spin; // total time in millis spent in spinning - jlong _time_to_wait_to_block; // total time in millis spent in waiting for to block - jlong _time_to_do_cleanups; // total time in millis spent in performing cleanups - jlong _time_to_sync; // total time in millis spent in getting to _synchronized - jlong _time_to_exec_vmop; // total time in millis spent in vm operation itself -}; +// ------------------------------------------------------------------------------------------------------- +// Implementation of SafepointTracing -static const int _statistics_header_count = 30; -static int _cur_stat_index = 0; -static SafepointStats safepoint_stats = {0}; // zero initialize -static SafepointStats* spstat = &safepoint_stats; +jlong SafepointTracing::_last_safepoint_begin_time_ns = 0; +jlong SafepointTracing::_last_safepoint_sync_time_ns = 0; +jlong SafepointTracing::_last_safepoint_cleanup_time_ns = 0; +jlong SafepointTracing::_last_safepoint_end_time_ns = 0; +jlong SafepointTracing::_last_app_time_ns = 0; +int SafepointTracing::_nof_threads = 0; +int SafepointTracing::_nof_running = 0; +int SafepointTracing::_page_trap = 0; +VM_Operation::VMOp_Type SafepointTracing::_current_type; +jlong SafepointTracing::_max_sync_time = 0; +jlong SafepointTracing::_max_vmop_time = 0; +uint64_t SafepointTracing::_op_count[VM_Operation::VMOp_Terminating] = {0}; -static julong _safepoint_reasons[VM_Operation::VMOp_Terminating]; -static jlong _max_sync_time = 0; -static jlong _max_vmop_time = 0; - -static jlong cleanup_end_time = 0; - -void SafepointSynchronize::begin_statistics(int nof_threads, int nof_running) { - - spstat->_time_stamp = _ts_of_current_safepoint; - - VM_Operation *op = VMThread::vm_operation(); - spstat->_vmop_type = op != NULL ? op->type() : VM_Operation::VMOp_None; - _safepoint_reasons[spstat->_vmop_type]++; - - spstat->_nof_total_threads = nof_threads; - spstat->_nof_initial_running_threads = nof_running; - - // Records the start time of spinning. The real time spent on spinning - // will be adjusted when spin is done. Same trick is applied for time - // spent on waiting for threads to block. - if (nof_running != 0) { - spstat->_time_to_spin = os::javaTimeNanos(); - } else { - spstat->_time_to_spin = 0; - } -} - -void SafepointSynchronize::update_statistics_on_spin_end() { - jlong cur_time = os::javaTimeNanos(); - - spstat->_nof_threads_wait_to_block = _waiting_to_block; - if (spstat->_nof_initial_running_threads != 0) { - spstat->_time_to_spin = cur_time - spstat->_time_to_spin; - } - - // Records the start time of waiting for to block. Updated when block is done. - if (_waiting_to_block != 0) { - spstat->_time_to_wait_to_block = cur_time; - } else { - spstat->_time_to_wait_to_block = 0; - } -} - -void SafepointSynchronize::update_statistics_on_sync_end(jlong end_time) { - - if (spstat->_nof_threads_wait_to_block != 0) { - spstat->_time_to_wait_to_block = end_time - - spstat->_time_to_wait_to_block; - } - - // Records the end time of sync which will be used to calculate the total - // vm operation time. Again, the real time spending in syncing will be deducted - // from the start of the sync time later when end_statistics is called. - spstat->_time_to_sync = end_time - _safepoint_begin_time; - if (spstat->_time_to_sync > _max_sync_time) { - _max_sync_time = spstat->_time_to_sync; - } - - spstat->_time_to_do_cleanups = end_time; -} - -void SafepointSynchronize::update_statistics_on_cleanup_end(jlong end_time) { - - // Record how long spent in cleanup tasks. - spstat->_time_to_do_cleanups = end_time - spstat->_time_to_do_cleanups; - cleanup_end_time = end_time; -} - -void SafepointSynchronize::end_statistics(jlong vmop_end_time) { - - // Update the vm operation time. - spstat->_time_to_exec_vmop = vmop_end_time - cleanup_end_time; - if (spstat->_time_to_exec_vmop > _max_vmop_time) { - _max_vmop_time = spstat->_time_to_exec_vmop; - } - - spstat->_nof_threads_hit_page_trap = _nof_threads_hit_polling_page; - - print_statistics(); +void SafepointTracing::init() { + // Application start + _last_safepoint_end_time_ns = os::javaTimeNanos(); } // Helper method to print the header. @@ -1285,66 +1140,121 @@ static void print_header(outputStream* st) { // The number of spaces is significant here, and should match the format // specifiers in print_statistics(). - st->print(" vmop " - "[ threads: total initially_running wait_to_block ]" - "[ time: spin block sync cleanup vmop ] "); + st->print("VM Operation " + "[ threads: total initial_running ]" + "[ time: sync cleanup vmop total ]"); - st->print_cr("page_trap_count"); + st->print_cr(" page_trap_count"); } // This prints a nice table. To get the statistics to not shift due to the logging uptime -// decorator, use the option as: -Xlog:safepoint+stats=debug:[outputfile]:none -void SafepointSynchronize::print_statistics() { - LogTarget(Debug, safepoint, stats) lt; +// decorator, use the option as: -Xlog:safepoint+stats:[outputfile]:none +void SafepointTracing::statistics_log() { + LogTarget(Info, safepoint, stats) lt; assert (lt.is_enabled(), "should only be called when printing statistics is enabled"); LogStream ls(lt); + static int _cur_stat_index = 0; + // Print header every 30 entries - if ((_cur_stat_index % _statistics_header_count) == 0) { + if ((_cur_stat_index % 30) == 0) { print_header(&ls); _cur_stat_index = 1; // wrap } else { _cur_stat_index++; } - ls.print("%8.3f: ", spstat->_time_stamp); - ls.print("%-28s [ " - INT32_FORMAT_W(8) " " INT32_FORMAT_W(17) " " INT32_FORMAT_W(13) " " + ls.print("%-28s [ " + INT32_FORMAT_W(8) " " INT32_FORMAT_W(8) " " "]", - VM_Operation::name(spstat->_vmop_type), - spstat->_nof_total_threads, - spstat->_nof_initial_running_threads, - spstat->_nof_threads_wait_to_block); - // "/ MICROUNITS " is to convert the unit from nanos to millis. + VM_Operation::name(_current_type), + _nof_threads, + _nof_running); ls.print("[ " - INT64_FORMAT_W(7) " " INT64_FORMAT_W(7) " " - INT64_FORMAT_W(7) " " INT64_FORMAT_W(7) " " - INT64_FORMAT_W(7) " ] ", - (int64_t)(spstat->_time_to_spin / MICROUNITS), - (int64_t)(spstat->_time_to_wait_to_block / MICROUNITS), - (int64_t)(spstat->_time_to_sync / MICROUNITS), - (int64_t)(spstat->_time_to_do_cleanups / MICROUNITS), - (int64_t)(spstat->_time_to_exec_vmop / MICROUNITS)); + INT64_FORMAT_W(10) " " INT64_FORMAT_W(10) " " + INT64_FORMAT_W(10) " " INT64_FORMAT_W(10) " ]", + (int64_t)(_last_safepoint_sync_time_ns - _last_safepoint_begin_time_ns), + (int64_t)(_last_safepoint_cleanup_time_ns - _last_safepoint_sync_time_ns), + (int64_t)(_last_safepoint_end_time_ns - _last_safepoint_cleanup_time_ns), + (int64_t)(_last_safepoint_end_time_ns - _last_safepoint_begin_time_ns)); - ls.print_cr(INT32_FORMAT_W(15) " ", spstat->_nof_threads_hit_page_trap); + ls.print_cr(INT32_FORMAT_W(16), _page_trap); } // This method will be called when VM exits. This tries to summarize the sampling. // Current thread may already be deleted, so don't use ResourceMark. -void SafepointSynchronize::print_stat_on_exit() { - +void SafepointTracing::statistics_exit_log() { + if (!log_is_enabled(Info, safepoint, stats)) { + return; + } for (int index = 0; index < VM_Operation::VMOp_Terminating; index++) { - if (_safepoint_reasons[index] != 0) { - log_debug(safepoint, stats)("%-28s" UINT64_FORMAT_W(10), VM_Operation::name(index), - _safepoint_reasons[index]); + if (_op_count[index] != 0) { + log_info(safepoint, stats)("%-28s" UINT64_FORMAT_W(10), VM_Operation::name(index), + _op_count[index]); } } - log_debug(safepoint, stats)("VM operations coalesced during safepoint " INT64_FORMAT, - _coalesced_vmop_count); - log_debug(safepoint, stats)("Maximum sync time " INT64_FORMAT" ms", - (int64_t)(_max_sync_time / MICROUNITS)); - log_debug(safepoint, stats)("Maximum vm operation time (except for Exit VM operation) " - INT64_FORMAT " ms", - (int64_t)(_max_vmop_time / MICROUNITS)); + log_info(safepoint, stats)("VM operations coalesced during safepoint " INT64_FORMAT, + VMThread::get_coalesced_count()); + log_info(safepoint, stats)("Maximum sync time " INT64_FORMAT" ns", + (int64_t)(_max_sync_time)); + log_info(safepoint, stats)("Maximum vm operation time (except for Exit VM operation) " + INT64_FORMAT " ns", + (int64_t)(_max_vmop_time)); +} + +void SafepointTracing::begin(VM_Operation::VMOp_Type type) { + _op_count[type]++; + _current_type = type; + + // update the time stamp to begin recording safepoint time + _last_safepoint_begin_time_ns = os::javaTimeNanos(); + _last_safepoint_sync_time_ns = 0; + _last_safepoint_cleanup_time_ns = 0; + + _last_app_time_ns = _last_safepoint_begin_time_ns - _last_safepoint_end_time_ns; + _last_safepoint_end_time_ns = 0; + + RuntimeService::record_safepoint_begin(_last_app_time_ns); +} + +void SafepointTracing::synchronized(int nof_threads, int nof_running, int traps) { + _last_safepoint_sync_time_ns = os::javaTimeNanos(); + _nof_threads = nof_threads; + _nof_running = nof_running; + _page_trap = traps; + RuntimeService::record_safepoint_synchronized(_last_safepoint_sync_time_ns - _last_safepoint_begin_time_ns); +} + +void SafepointTracing::cleanup() { + _last_safepoint_cleanup_time_ns = os::javaTimeNanos(); +} + +void SafepointTracing::end() { + _last_safepoint_end_time_ns = os::javaTimeNanos(); + + if (_max_sync_time < (_last_safepoint_sync_time_ns - _last_safepoint_begin_time_ns)) { + _max_sync_time = _last_safepoint_sync_time_ns - _last_safepoint_begin_time_ns; + } + if (_max_vmop_time < (_last_safepoint_end_time_ns - _last_safepoint_sync_time_ns)) { + _max_vmop_time = _last_safepoint_end_time_ns - _last_safepoint_sync_time_ns; + } + if (log_is_enabled(Info, safepoint, stats)) { + statistics_log(); + } + + log_info(safepoint)( + "Safepoint \"%s\", " + "Time since last: " JLONG_FORMAT " ns, " + "Reaching safepoint: " JLONG_FORMAT " ns, " + "At safepoint: " JLONG_FORMAT " ns, " + "Total: " JLONG_FORMAT " ns", + VM_Operation::name(_current_type), + _last_app_time_ns, + _last_safepoint_cleanup_time_ns - _last_safepoint_begin_time_ns, + _last_safepoint_end_time_ns - _last_safepoint_cleanup_time_ns, + _last_safepoint_end_time_ns - _last_safepoint_begin_time_ns + ); + + RuntimeService::record_safepoint_end(_last_safepoint_end_time_ns - _last_safepoint_cleanup_time_ns); } diff --git a/src/hotspot/share/runtime/safepoint.hpp b/src/hotspot/share/runtime/safepoint.hpp index 2779395af9f..ee75cd8090d 100644 --- a/src/hotspot/share/runtime/safepoint.hpp +++ b/src/hotspot/share/runtime/safepoint.hpp @@ -28,6 +28,7 @@ #include "memory/allocation.hpp" #include "runtime/os.hpp" #include "runtime/thread.hpp" +#include "runtime/vmOperations.hpp" #include "utilities/ostream.hpp" #include "utilities/waitBarrier.hpp" @@ -77,11 +78,6 @@ class SafepointSynchronize : AllStatic { friend class ThreadSafepointState; friend class HandshakeState; - enum SafepointTimeoutReason { - _spinning_timeout = 0, - _blocking_timeout = 1 - }; - // Threads might read this flag directly, without acquiring the Threads_lock: static volatile SynchronizeState _state; // Number of threads we are waiting for to block: @@ -110,7 +106,7 @@ class SafepointSynchronize : AllStatic { static void print_statistics(); // For debug long safepoint - static void print_safepoint_timeout(SafepointTimeoutReason timeout_reason); + static void print_safepoint_timeout(); // Helper methods for safepoint procedure: static void arm_safepoint(); @@ -150,19 +146,9 @@ public: // Exception handling for page polling static void handle_polling_page_exception(JavaThread *thread); - // VM Thread interface for determining safepoint rate - static long last_non_safepoint_interval() { - return os::javaTimeMillis() - _end_of_last_safepoint; - } - static long end_of_last_safepoint() { - return _end_of_last_safepoint; - } static bool is_cleanup_needed(); static void do_cleanup_tasks(); - static void print_stat_on_exit(); - static void inc_vmop_coalesced_count() { _coalesced_vmop_count++; } - static void set_is_at_safepoint() { _state = _synchronized; } static void set_is_not_at_safepoint() { _state = _not_synchronized; } @@ -247,6 +233,48 @@ class ThreadSafepointState: public CHeapObj { static void destroy(JavaThread *thread); }; +class SafepointTracing : public AllStatic { +private: + // Absolute + static jlong _last_safepoint_begin_time_ns; + static jlong _last_safepoint_sync_time_ns; + static jlong _last_safepoint_cleanup_time_ns; + static jlong _last_safepoint_end_time_ns; + // Relative + static jlong _last_app_time_ns; + static int _nof_threads; + static int _nof_running; + static int _page_trap; + + static VM_Operation::VMOp_Type _current_type; + static jlong _max_sync_time; + static jlong _max_vmop_time; + static uint64_t _op_count[VM_Operation::VMOp_Terminating]; + + static void statistics_log(); + +public: + static void init(); + + static void begin(VM_Operation::VMOp_Type type); + static void synchronized(int nof_threads, int nof_running, int traps); + static void cleanup(); + static void end(); + + static void statistics_exit_log(); + + static jlong time_since_last_safepoint_ms() { + return (os::javaTimeNanos() - _last_safepoint_end_time_ns) / (NANOUNITS / MILLIUNITS); + } + + static jlong end_of_last_safepoint_ms() { + return _last_safepoint_end_time_ns / (NANOUNITS / MILLIUNITS); + } + + static jlong start_of_safepoint() { + return _last_safepoint_begin_time_ns; + } +}; #endif // SHARE_RUNTIME_SAFEPOINT_HPP diff --git a/src/hotspot/share/runtime/tieredThresholdPolicy.cpp b/src/hotspot/share/runtime/tieredThresholdPolicy.cpp index 66afdcff264..c1be9dbdf7b 100644 --- a/src/hotspot/share/runtime/tieredThresholdPolicy.cpp +++ b/src/hotspot/share/runtime/tieredThresholdPolicy.cpp @@ -479,7 +479,7 @@ void TieredThresholdPolicy::update_rate(jlong t, Method* m) { // We don't update the rate if we've just came out of a safepoint. // delta_s is the time since last safepoint in milliseconds. - jlong delta_s = t - SafepointSynchronize::end_of_last_safepoint(); + jlong delta_s = t - SafepointTracing::end_of_last_safepoint_ms(); jlong delta_t = t - (m->prev_time() != 0 ? m->prev_time() : start_time()); // milliseconds since the last measurement // How many events were there since the last time? int event_count = m->invocation_count() + m->backedge_count(); @@ -504,7 +504,7 @@ void TieredThresholdPolicy::update_rate(jlong t, Method* m) { // Check if this method has been stale from a given number of milliseconds. // See select_task(). bool TieredThresholdPolicy::is_stale(jlong t, jlong timeout, Method* m) { - jlong delta_s = t - SafepointSynchronize::end_of_last_safepoint(); + jlong delta_s = t - SafepointTracing::end_of_last_safepoint_ms(); jlong delta_t = t - m->prev_time(); if (delta_t > timeout && delta_s > timeout) { int event_count = m->invocation_count() + m->backedge_count(); diff --git a/src/hotspot/share/runtime/vmOperations.hpp b/src/hotspot/share/runtime/vmOperations.hpp index f90b966d34c..3130eb85dbd 100644 --- a/src/hotspot/share/runtime/vmOperations.hpp +++ b/src/hotspot/share/runtime/vmOperations.hpp @@ -41,6 +41,7 @@ // Note: When new VM_XXX comes up, add 'XXX' to the template table. #define VM_OPS_DO(template) \ template(None) \ + template(Cleanup) \ template(ThreadStop) \ template(ThreadDump) \ template(PrintThreads) \ @@ -213,7 +214,7 @@ class VM_Operation: public CHeapObj { // Debugging virtual void print_on_error(outputStream* st) const; - const char* name() const { return _names[type()]; } + virtual const char* name() const { return _names[type()]; } static const char* name(int type) { assert(type >= 0 && type < VMOp_Terminating, "invalid VM operation type"); return _names[type]; @@ -223,6 +224,21 @@ class VM_Operation: public CHeapObj { #endif }; +class VM_None: public VM_Operation { + const char* _reason; + public: + VM_None(const char* reason) : _reason(reason) {} + const char* name() const { return _reason; } + VMOp_Type type() const { return VMOp_None; } + void doit() {}; +}; + +class VM_Cleanup: public VM_Operation { + public: + VMOp_Type type() const { return VMOp_Cleanup; } + void doit() {}; +}; + class VM_ThreadStop: public VM_Operation { private: oop _thread; // The Thread that the Throwable is thrown against diff --git a/src/hotspot/share/runtime/vmThread.cpp b/src/hotspot/share/runtime/vmThread.cpp index 1dfd0a1c2f0..d5d5b523470 100644 --- a/src/hotspot/share/runtime/vmThread.cpp +++ b/src/hotspot/share/runtime/vmThread.cpp @@ -48,19 +48,13 @@ #include "utilities/vmError.hpp" #include "utilities/xmlstream.hpp" -// Dummy VM operation to act as first element in our circular double-linked list -class VM_None: public VM_Operation { - VMOp_Type type() const { return VMOp_None; } - void doit() {}; -}; - VMOperationQueue::VMOperationQueue() { // The queue is a circular doubled-linked list, which always contains // one element (i.e., one element means empty). for(int i = 0; i < nof_priorities; i++) { _queue_length[i] = 0; _queue_counter = 0; - _queue[i] = new VM_None(); + _queue[i] = new VM_None("QueueHead"); _queue[i]->set_next(_queue[i]); _queue[i]->set_prev(_queue[i]); } @@ -229,14 +223,14 @@ void VMOperationTimeoutTask::disarm() { //------------------------------------------------------------------------------------------------------------------ // Implementation of VMThread stuff -bool VMThread::_should_terminate = false; +bool VMThread::_should_terminate = false; bool VMThread::_terminated = false; Monitor* VMThread::_terminate_lock = NULL; VMThread* VMThread::_vm_thread = NULL; VM_Operation* VMThread::_cur_vm_operation = NULL; VMOperationQueue* VMThread::_vm_queue = NULL; PerfCounter* VMThread::_perf_accumulated_vm_operation_time = NULL; -const char* VMThread::_no_op_reason = NULL; +uint64_t VMThread::_coalesced_count = 0; VMOperationTimeoutTask* VMThread::_timeout_task = NULL; @@ -283,6 +277,8 @@ void VMThread::destroy() { _vm_thread = NULL; // VM thread is gone } +static VM_None halt_op("Halt"); + void VMThread::run() { assert(this == vm_thread(), "check"); @@ -320,7 +316,7 @@ void VMThread::run() { } // 4526887 let VM thread exit at Safepoint - _no_op_reason = "Halt"; + _cur_vm_operation = &halt_op; SafepointSynchronize::begin(); if (VerifyBeforeExit) { @@ -435,24 +431,25 @@ void VMThread::evaluate_operation(VM_Operation* op) { } } -bool VMThread::no_op_safepoint_needed(bool check_time) { +static VM_None safepointALot_op("SafepointALot"); +static VM_Cleanup cleanup_op; + +VM_Operation* VMThread::no_op_safepoint(bool check_time) { if (SafepointALot) { - _no_op_reason = "SafepointALot"; - return true; + return &safepointALot_op; } if (!SafepointSynchronize::is_cleanup_needed()) { - return false; + return NULL; } if (check_time) { - long interval = SafepointSynchronize::last_non_safepoint_interval(); + long interval_ms = SafepointTracing::time_since_last_safepoint_ms(); bool max_time_exceeded = GuaranteedSafepointInterval != 0 && - (interval > GuaranteedSafepointInterval); + (interval_ms > GuaranteedSafepointInterval); if (!max_time_exceeded) { - return false; + return NULL; } } - _no_op_reason = "Cleanup"; - return true; + return &cleanup_op; } void VMThread::loop() { @@ -494,7 +491,7 @@ void VMThread::loop() { exit(-1); } - if (timedout && VMThread::no_op_safepoint_needed(false)) { + if (timedout && (_cur_vm_operation = VMThread::no_op_safepoint(false)) != NULL) { MutexUnlockerEx mul(VMOperationQueue_lock, Mutex::_no_safepoint_check_flag); // Force a safepoint since we have not had one for at least @@ -506,6 +503,7 @@ void VMThread::loop() { if (GCALotAtAllSafepoints) InterfaceSupport::check_gc_alot(); #endif SafepointSynchronize::end(); + _cur_vm_operation = NULL; } _cur_vm_operation = _vm_queue->remove_next(); @@ -555,9 +553,7 @@ void VMThread::loop() { _vm_queue->set_drain_list(next); evaluate_operation(_cur_vm_operation); _cur_vm_operation = next; - if (log_is_enabled(Debug, safepoint, stats)) { - SafepointSynchronize::inc_vmop_coalesced_count(); - } + _coalesced_count++; } while (_cur_vm_operation != NULL); } // There is a chance that a thread enqueued a safepoint op @@ -622,10 +618,11 @@ void VMThread::loop() { // // We want to make sure that we get to a safepoint regularly. // - if (VMThread::no_op_safepoint_needed(true)) { + if ((_cur_vm_operation = VMThread::no_op_safepoint(false)) != NULL) { HandleMark hm(VMThread::vm_thread()); SafepointSynchronize::begin(); SafepointSynchronize::end(); + _cur_vm_operation = NULL; } } } diff --git a/src/hotspot/share/runtime/vmThread.hpp b/src/hotspot/share/runtime/vmThread.hpp index b1e44a37082..36648e714da 100644 --- a/src/hotspot/share/runtime/vmThread.hpp +++ b/src/hotspot/share/runtime/vmThread.hpp @@ -119,12 +119,11 @@ class VMThread: public NamedThread { static bool _terminated; static Monitor * _terminate_lock; static PerfCounter* _perf_accumulated_vm_operation_time; - - static const char* _no_op_reason; + static uint64_t _coalesced_count; static VMOperationTimeoutTask* _timeout_task; - static bool no_op_safepoint_needed(bool check_time); + static VM_Operation* no_op_safepoint(bool check_time); void evaluate_operation(VM_Operation* op); @@ -155,9 +154,8 @@ class VMThread: public NamedThread { // Returns the current vm operation if any. static VM_Operation* vm_operation() { return _cur_vm_operation; } - - // Returns the current vm operation name or set reason - static const char* vm_safepoint_description() { return _cur_vm_operation != NULL ? _cur_vm_operation->name() : _no_op_reason; }; + static VM_Operation::VMOp_Type vm_op_type() { return _cur_vm_operation->type(); } + static uint64_t get_coalesced_count() { return _coalesced_count; } // Returns the single instance of VMThread. static VMThread* vm_thread() { return _vm_thread; } diff --git a/src/hotspot/share/services/runtimeService.cpp b/src/hotspot/share/services/runtimeService.cpp index 4386f940a5e..be2108a86c7 100644 --- a/src/hotspot/share/services/runtimeService.cpp +++ b/src/hotspot/share/services/runtimeService.cpp @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "classfile/classLoader.hpp" #include "logging/log.hpp" -#include "runtime/timer.hpp" +#include "logging/logStream.hpp" #include "runtime/vm_version.hpp" #include "services/attachListener.hpp" #include "services/management.hpp" @@ -35,18 +35,12 @@ #include "utilities/macros.hpp" #if INCLUDE_MANAGEMENT -TimeStamp RuntimeService::_app_timer; -TimeStamp RuntimeService::_safepoint_timer; PerfCounter* RuntimeService::_sync_time_ticks = NULL; PerfCounter* RuntimeService::_total_safepoints = NULL; PerfCounter* RuntimeService::_safepoint_time_ticks = NULL; PerfCounter* RuntimeService::_application_time_ticks = NULL; -jlong RuntimeService::_last_safepoint_sync_time_ns = 0; -jlong RuntimeService::_last_safepoint_end_time_ns = 0; -jlong RuntimeService::_last_app_time_ns = 0; void RuntimeService::init() { - if (UsePerfData) { EXCEPTION_MARK; @@ -87,85 +81,27 @@ void RuntimeService::init() { } } -void RuntimeService::record_safepoint_begin() { +void RuntimeService::record_safepoint_begin(jlong app_ticks) { HS_PRIVATE_SAFEPOINT_BEGIN(); - - // Print the time interval in which the app was executing - if (_app_timer.is_updated()) { - _last_app_time_ns = _app_timer.ticks_since_update(); - log_info(safepoint)("Application time: %3.7f seconds", TimeHelper::counter_to_seconds(_last_app_time_ns)); - } - - // update the time stamp to begin recording safepoint time - _last_safepoint_sync_time_ns = 0; - _last_safepoint_end_time_ns = 0; - _safepoint_timer.update(); if (UsePerfData) { _total_safepoints->inc(); - if (_app_timer.is_updated()) { - _application_time_ticks->inc(_app_timer.ticks_since_update()); - } + _application_time_ticks->inc(app_ticks); } } -void RuntimeService::record_safepoint_synchronized() { +void RuntimeService::record_safepoint_synchronized(jlong sync_ticks) { if (UsePerfData) { - _sync_time_ticks->inc(_safepoint_timer.ticks_since_update()); - } - if (log_is_enabled(Info, safepoint) || log_is_enabled(Info, safepoint, stats)) { - _last_safepoint_sync_time_ns = _safepoint_timer.ticks_since_update(); + _sync_time_ticks->inc(sync_ticks); } } -void RuntimeService::record_safepoint_end() { +void RuntimeService::record_safepoint_end(jlong safepoint_ticks) { HS_PRIVATE_SAFEPOINT_END(); - - // Logging of safepoint+stats=info needs _last_safepoint_end_time_ns to be set. - // Logging of safepoint=info needs _last_safepoint_end_time_ns for following log. - if (log_is_enabled(Info, safepoint) || log_is_enabled(Info, safepoint, stats)) { - _last_safepoint_end_time_ns = _safepoint_timer.ticks_since_update(); - log_info(safepoint)( - "Total time for which application threads were stopped: %3.7f seconds, " - "Stopping threads took: %3.7f seconds", - TimeHelper::counter_to_seconds(_last_safepoint_end_time_ns), - TimeHelper::counter_to_seconds(_last_safepoint_sync_time_ns)); - } - - // update the time stamp to begin recording app time - _app_timer.update(); if (UsePerfData) { - _safepoint_time_ticks->inc(_safepoint_timer.ticks_since_update()); + _safepoint_time_ticks->inc(safepoint_ticks); } } -void RuntimeService::record_safepoint_epilog(const char* operation_name) { - if (!log_is_enabled(Info, safepoint, stats)) { - return; - } - - log_info(safepoint, stats)( - "Safepoint \"%s\", " - "Time since last: " JLONG_FORMAT " ns; " - "Reaching safepoint: " JLONG_FORMAT " ns; " - "At safepoint: " JLONG_FORMAT " ns; " - "Total: " JLONG_FORMAT " ns", - operation_name, - _last_app_time_ns, - _last_safepoint_sync_time_ns, - _last_safepoint_end_time_ns - _last_safepoint_sync_time_ns, - _last_safepoint_end_time_ns - ); -} - -void RuntimeService::record_application_start() { - // update the time stamp to begin recording app time - _app_timer.update(); -} - -// Don't need to record application end because we currently -// exit at a safepoint and record_safepoint_begin() handles updating -// the application time counter at VM exit. - jlong RuntimeService::safepoint_sync_time_ms() { return UsePerfData ? Management::ticks_to_ms(_sync_time_ticks->get_value()) : -1; diff --git a/src/hotspot/share/services/runtimeService.hpp b/src/hotspot/share/services/runtimeService.hpp index 0817fd5485d..bdbd137fa45 100644 --- a/src/hotspot/share/services/runtimeService.hpp +++ b/src/hotspot/share/services/runtimeService.hpp @@ -35,12 +35,6 @@ private: static PerfCounter* _safepoint_time_ticks; // Accumulated time at safepoints static PerfCounter* _application_time_ticks; // Accumulated time not at safepoints - static TimeStamp _safepoint_timer; - static TimeStamp _app_timer; - static jlong _last_safepoint_sync_time_ns; - static jlong _last_safepoint_end_time_ns; - static jlong _last_app_time_ns; - public: static void init(); @@ -50,12 +44,9 @@ public: static jlong application_time_ms(); // callbacks - static void record_safepoint_begin() NOT_MANAGEMENT_RETURN; - static void record_safepoint_synchronized() NOT_MANAGEMENT_RETURN; - static void record_safepoint_end() NOT_MANAGEMENT_RETURN; - static void record_safepoint_epilog(const char* operation_name) NOT_MANAGEMENT_RETURN; - static void record_application_start() NOT_MANAGEMENT_RETURN; - + static void record_safepoint_begin(jlong app_ticks) NOT_MANAGEMENT_RETURN; + static void record_safepoint_synchronized(jlong sync_ticks) NOT_MANAGEMENT_RETURN; + static void record_safepoint_end(jlong safepoint_ticks) NOT_MANAGEMENT_RETURN; }; #endif // SHARE_SERVICES_RUNTIMESERVICE_HPP diff --git a/src/jdk.jfr/share/conf/jfr/default.jfc b/src/jdk.jfr/share/conf/jfr/default.jfc index 294823aba3f..47e764548e1 100644 --- a/src/jdk.jfr/share/conf/jfr/default.jfc +++ b/src/jdk.jfr/share/conf/jfr/default.jfc @@ -133,11 +133,6 @@ 10 ms - - false - 10 ms - - false 10 ms diff --git a/src/jdk.jfr/share/conf/jfr/profile.jfc b/src/jdk.jfr/share/conf/jfr/profile.jfc index eb170c1996b..8c18b4ecc7d 100644 --- a/src/jdk.jfr/share/conf/jfr/profile.jfc +++ b/src/jdk.jfr/share/conf/jfr/profile.jfc @@ -133,11 +133,6 @@ 0 ms - - false - 0 ms - - false 0 ms diff --git a/test/hotspot/jtreg/runtime/logging/SafepointTest.java b/test/hotspot/jtreg/runtime/logging/SafepointTest.java index f4f36f8a256..b0cba9a5094 100644 --- a/test/hotspot/jtreg/runtime/logging/SafepointTest.java +++ b/test/hotspot/jtreg/runtime/logging/SafepointTest.java @@ -41,8 +41,6 @@ public class SafepointTest { InnerClass.class.getName()); OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Safepoint synchronization initiated"); - output.shouldContain("Entering safepoint region: "); - output.shouldContain("Leaving safepoint region"); output.shouldHaveExitValue(0); } diff --git a/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.java b/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.java index 285dbf2212b..21a54bc2995 100644 --- a/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.java +++ b/test/jdk/jdk/jfr/event/runtime/TestSafepointEvents.java @@ -55,7 +55,6 @@ public class TestSafepointEvents { static final String[] EVENT_NAMES = new String[] { EventNames.SafepointBegin, EventNames.SafepointStateSynchronization, - EventNames.SafepointWaitBlocked, EventNames.SafepointCleanup, EventNames.SafepointCleanupTask, EventNames.SafepointEnd diff --git a/test/lib/jdk/test/lib/jfr/EventNames.java b/test/lib/jdk/test/lib/jfr/EventNames.java index a202fb22a53..e8478b565f9 100644 --- a/test/lib/jdk/test/lib/jfr/EventNames.java +++ b/test/lib/jdk/test/lib/jfr/EventNames.java @@ -66,7 +66,6 @@ public class EventNames { public final static String ClassUnload = PREFIX + "ClassUnload"; public final static String SafepointBegin = PREFIX + "SafepointBegin"; public final static String SafepointStateSynchronization = PREFIX + "SafepointStateSynchronization"; - public final static String SafepointWaitBlocked = PREFIX + "SafepointWaitBlocked"; public final static String SafepointCleanup = PREFIX + "SafepointCleanup"; public final static String SafepointCleanupTask = PREFIX + "SafepointCleanupTask"; public final static String SafepointEnd = PREFIX + "SafepointEnd"; From 2c2ca43c15bc44a4bb6319e3c08238c829ba3a5a Mon Sep 17 00:00:00 2001 From: Priya Lakshmi Muthuswamy Date: Fri, 22 Feb 2019 19:58:22 +0530 Subject: [PATCH 087/109] 8219575: jdk/javadoc/tool/removeOldDoclet/RemoveOldDoclet test fails in mach5 Reviewed-by: hannesw --- .../share/classes/jdk/javadoc/internal/tool/Start.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java index 54798ddb2d3..cccd66b0da2 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java @@ -756,6 +756,13 @@ public class Start extends ToolOption.Helper { } String text = messager.getText("main.doclet_class_not_found", userDocletName); throw new ToolException(CMDERR, text, cnfe); + } catch (NoClassDefFoundError ncfe) { + if (ncfe.getMessage().contains("com/sun/javadoc/Doclet")) { + String text = messager.getText("main.not_a_doclet", userDocletName); + throw new ToolException(ERROR, text, ncfe); + } else { + throw ncfe; + } } } From 504562b3a4692ead68203402ee5051adc716d97c Mon Sep 17 00:00:00 2001 From: Boris Ulasevich Date: Fri, 22 Feb 2019 17:30:07 +0300 Subject: [PATCH 088/109] 8217647: JFR: recordings on 32-bit systems unreadable Co-authored-by: Markus Gronlund Reviewed-by: egahlin --- src/hotspot/share/jfr/jni/jfrJniMethod.cpp | 2 +- .../checkpoint/jfrCheckpointWriter.cpp | 16 +++++----- .../checkpoint/jfrCheckpointWriter.hpp | 14 ++++----- .../jfr/recorder/checkpoint/types/jfrType.cpp | 2 +- .../checkpoint/types/jfrTypeSetWriter.hpp | 2 +- .../recorder/repository/jfrChunkRotation.cpp | 5 ++- .../recorder/repository/jfrChunkRotation.hpp | 2 +- .../jfr/recorder/repository/jfrChunkState.cpp | 10 +++--- .../jfr/recorder/repository/jfrChunkState.hpp | 21 ++++++------- .../recorder/repository/jfrChunkWriter.cpp | 17 +++++----- .../recorder/repository/jfrChunkWriter.hpp | 10 +++--- .../jfr/recorder/repository/jfrRepository.cpp | 31 ++++++++++++------- .../jfr/recorder/repository/jfrRepository.hpp | 2 +- .../recorder/service/jfrRecorderService.cpp | 22 ++++++------- .../jfr/writers/jfrEventWriterHost.inline.hpp | 2 +- src/hotspot/share/jfr/writers/jfrPosition.hpp | 4 +-- .../share/jfr/writers/jfrPosition.inline.hpp | 4 +-- .../share/jfr/writers/jfrStreamWriterHost.hpp | 8 ++--- .../writers/jfrStreamWriterHost.inline.hpp | 10 +++--- .../share/jfr/writers/jfrWriterHost.hpp | 8 ++--- .../jfr/writers/jfrWriterHost.inline.hpp | 18 +++++------ 21 files changed, 107 insertions(+), 103 deletions(-) diff --git a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp index b1b2e13626e..a5d9a5ed750 100644 --- a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp +++ b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp @@ -114,7 +114,7 @@ NO_TRANSITION(void, jfr_set_enabled(JNIEnv* env, jobject jvm, jlong event_type_i NO_TRANSITION_END NO_TRANSITION(void, jfr_set_file_notification(JNIEnv* env, jobject jvm, jlong threshold)) - JfrChunkRotation::set_threshold((intptr_t)threshold); + JfrChunkRotation::set_threshold(threshold); NO_TRANSITION_END NO_TRANSITION(void, jfr_set_sample_threads(JNIEnv* env, jobject jvm, jboolean sampleThreads)) diff --git a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.cpp b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.cpp index 1fc884780b2..4f0e2f35b35 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.cpp @@ -44,13 +44,13 @@ JfrCheckpointWriter::JfrCheckpointWriter(bool flushpoint, bool header, Thread* t } } -static void write_checkpoint_header(u1* pos, jlong size, jlong time, bool flushpoint, juint type_count) { +static void write_checkpoint_header(u1* pos, int64_t size, jlong time, bool flushpoint, u4 type_count) { assert(pos != NULL, "invariant"); JfrBigEndianWriter be_writer(pos, sizeof(JfrCheckpointEntry)); be_writer.write(size); be_writer.write(time); be_writer.write(JfrTicks::now().value() - time); - be_writer.write(flushpoint ? (juint)1 : (juint)0); + be_writer.write(flushpoint ? (u4)1 : (u4)0); be_writer.write(type_count); assert(be_writer.is_valid(), "invariant"); } @@ -71,7 +71,7 @@ JfrCheckpointWriter::~JfrCheckpointWriter() { assert(this->is_valid(), "invariant"); assert(count() > 0, "invariant"); assert(this->used_size() > sizeof(JfrCheckpointEntry), "invariant"); - const jlong size = this->current_offset(); + const int64_t size = this->current_offset(); assert(size + this->start_pos() == this->current_pos(), "invariant"); write_checkpoint_header(const_cast(this->start_pos()), size, _time, is_flushpoint(), count()); release(); @@ -85,11 +85,11 @@ bool JfrCheckpointWriter::is_flushpoint() const { return _flushpoint; } -juint JfrCheckpointWriter::count() const { +u4 JfrCheckpointWriter::count() const { return _count; } -void JfrCheckpointWriter::set_count(juint count) { +void JfrCheckpointWriter::set_count(u4 count) { _count = count; } @@ -111,7 +111,7 @@ void JfrCheckpointWriter::write_type(JfrTypeId type_id) { } void JfrCheckpointWriter::write_key(u8 key) { - write(key); + write(key); } void JfrCheckpointWriter::increment() { @@ -119,10 +119,10 @@ void JfrCheckpointWriter::increment() { } void JfrCheckpointWriter::write_count(u4 nof_entries) { - write((u4)nof_entries); + write(nof_entries); } -void JfrCheckpointWriter::write_count(u4 nof_entries, jlong offset) { +void JfrCheckpointWriter::write_count(u4 nof_entries, int64_t offset) { write_padded_at_offset(nof_entries, offset); } diff --git a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.hpp b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.hpp index 431ce393ae0..e02b160ac79 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.hpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.hpp @@ -49,21 +49,21 @@ typedef AcquireReleaseMemoryWriterHost JfrTrans typedef EventWriterHost JfrCheckpointWriterBase; struct JfrCheckpointContext { - jlong offset; - juint count; + int64_t offset; + u4 count; }; class JfrCheckpointWriter : public JfrCheckpointWriterBase { friend class JfrSerializerRegistration; private: JfrTicks _time; - jlong _offset; - juint _count; + int64_t _offset; + u4 _count; bool _flushpoint; bool _header; - juint count() const; - void set_count(juint count); + u4 count() const; + void set_count(u4 count); void increment(); void set_flushpoint(bool flushpoint); bool is_flushpoint() const; @@ -75,7 +75,7 @@ class JfrCheckpointWriter : public JfrCheckpointWriterBase { ~JfrCheckpointWriter(); void write_type(JfrTypeId type_id); void write_count(u4 nof_entries); - void write_count(u4 nof_entries, jlong offset); + void write_count(u4 nof_entries, int64_t offset); void write_key(u8 key); const JfrCheckpointContext context() const; void set_context(const JfrCheckpointContext ctx); diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp index 6c517ab2f79..387f0db955d 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp @@ -65,7 +65,7 @@ class JfrCheckpointThreadClosure : public ThreadClosure { private: JfrCheckpointWriter& _writer; JfrCheckpointContext _ctx; - const intptr_t _count_position; + const int64_t _count_position; Thread* const _curthread; u4 _count; diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetWriter.hpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetWriter.hpp index cebd439e58d..df75d5e1c7c 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetWriter.hpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetWriter.hpp @@ -35,7 +35,7 @@ class JfrArtifactWriterHost : public StackObj { WriterImpl _impl; JfrCheckpointWriter* _writer; JfrCheckpointContext _ctx; - jlong _count_offset; + int64_t _count_offset; int _count; bool _skip_header; public: diff --git a/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.cpp b/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.cpp index 4bc903b9a2c..520d487fa13 100644 --- a/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.cpp +++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.cpp @@ -29,7 +29,7 @@ #include "runtime/handles.inline.hpp" static jobject chunk_monitor = NULL; -static intptr_t threshold = 0; +static int64_t threshold = 0; static bool rotate = false; static jobject install_chunk_monitor(Thread* thread) { @@ -62,7 +62,6 @@ void JfrChunkRotation::evaluate(const JfrChunkWriter& writer) { // already in progress return; } - assert(!rotate, "invariant"); if (writer.size_written() > threshold) { rotate = true; notify(); @@ -77,6 +76,6 @@ void JfrChunkRotation::on_rotation() { rotate = false; } -void JfrChunkRotation::set_threshold(intptr_t bytes) { +void JfrChunkRotation::set_threshold(int64_t bytes) { threshold = bytes; } diff --git a/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.hpp b/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.hpp index ef3d423de9e..973fa611718 100644 --- a/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.hpp +++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.hpp @@ -36,7 +36,7 @@ class JfrChunkWriter; class JfrChunkRotation : AllStatic { public: static void evaluate(const JfrChunkWriter& writer); - static void set_threshold(intptr_t bytes); + static void set_threshold(int64_t bytes); static bool should_rotate(); static void on_rotation(); }; diff --git a/src/hotspot/share/jfr/recorder/repository/jfrChunkState.cpp b/src/hotspot/share/jfr/recorder/repository/jfrChunkState.cpp index 9825cd21ed7..19a5558b2bc 100644 --- a/src/hotspot/share/jfr/recorder/repository/jfrChunkState.cpp +++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkState.cpp @@ -53,19 +53,19 @@ void JfrChunkState::reset() { set_previous_checkpoint_offset(0); } -void JfrChunkState::set_previous_checkpoint_offset(jlong offset) { +void JfrChunkState::set_previous_checkpoint_offset(int64_t offset) { _previous_checkpoint_offset = offset; } -jlong JfrChunkState::previous_checkpoint_offset() const { +int64_t JfrChunkState::previous_checkpoint_offset() const { return _previous_checkpoint_offset; } -jlong JfrChunkState::previous_start_ticks() const { +int64_t JfrChunkState::previous_start_ticks() const { return _previous_start_ticks; } -jlong JfrChunkState::previous_start_nanos() const { +int64_t JfrChunkState::previous_start_nanos() const { return _previous_start_nanos; } @@ -92,7 +92,7 @@ void JfrChunkState::update_time_to_now() { save_current_and_update_start_ticks(); } -jlong JfrChunkState::last_chunk_duration() const { +int64_t JfrChunkState::last_chunk_duration() const { return _start_nanos - _previous_start_nanos; } diff --git a/src/hotspot/share/jfr/recorder/repository/jfrChunkState.hpp b/src/hotspot/share/jfr/recorder/repository/jfrChunkState.hpp index 2ee10d6c095..5549d1836cb 100644 --- a/src/hotspot/share/jfr/recorder/repository/jfrChunkState.hpp +++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkState.hpp @@ -25,7 +25,6 @@ #ifndef SHARE_JFR_RECORDER_REPOSITORY_JFRCHUNKSTATE_HPP #define SHARE_JFR_RECORDER_REPOSITORY_JFRCHUNKSTATE_HPP -#include "jni.h" #include "jfr/utilities/jfrAllocation.hpp" #include "jfr/utilities/jfrTypes.hpp" @@ -33,11 +32,11 @@ class JfrChunkState : public JfrCHeapObj { friend class JfrChunkWriter; private: char* _path; - jlong _start_ticks; - jlong _start_nanos; - jlong _previous_start_ticks; - jlong _previous_start_nanos; - jlong _previous_checkpoint_offset; + int64_t _start_ticks; + int64_t _start_nanos; + int64_t _previous_start_ticks; + int64_t _previous_start_nanos; + int64_t _previous_checkpoint_offset; void update_start_ticks(); void update_start_nanos(); @@ -47,11 +46,11 @@ class JfrChunkState : public JfrCHeapObj { JfrChunkState(); ~JfrChunkState(); void reset(); - jlong previous_checkpoint_offset() const; - void set_previous_checkpoint_offset(jlong offset); - jlong previous_start_ticks() const; - jlong previous_start_nanos() const; - jlong last_chunk_duration() const; + int64_t previous_checkpoint_offset() const; + void set_previous_checkpoint_offset(int64_t offset); + int64_t previous_start_ticks() const; + int64_t previous_start_nanos() const; + int64_t last_chunk_duration() const; void update_time_to_now(); void set_path(const char* path); const char* path() const; diff --git a/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp b/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp index 2ecffe2cb19..cbd539568f8 100644 --- a/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp +++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp @@ -32,9 +32,8 @@ #include "runtime/os.hpp" #include "runtime/os.inline.hpp" -const u2 JFR_VERSION_MAJOR = 2; -const u2 JFR_VERSION_MINOR = 0; - +static const u2 JFR_VERSION_MAJOR = 2; +static const u2 JFR_VERSION_MINOR = 0; static const size_t MAGIC_LEN = 4; static const size_t FILEHEADER_SLOT_SIZE = 8; static const size_t CHUNK_SIZE_OFFSET = 8; @@ -79,14 +78,14 @@ bool JfrChunkWriter::open() { return is_open; } -size_t JfrChunkWriter::close(intptr_t metadata_offset) { +size_t JfrChunkWriter::close(int64_t metadata_offset) { write_header(metadata_offset); this->flush(); this->close_fd(); - return size_written(); + return (size_t)size_written(); } -void JfrChunkWriter::write_header(intptr_t metadata_offset) { +void JfrChunkWriter::write_header(int64_t metadata_offset) { assert(this->is_valid(), "invariant"); // Chunk size this->write_be_at_offset(size_written(), CHUNK_SIZE_OFFSET); @@ -106,15 +105,15 @@ void JfrChunkWriter::set_chunk_path(const char* chunk_path) { _chunkstate->set_path(chunk_path); } -intptr_t JfrChunkWriter::size_written() const { +int64_t JfrChunkWriter::size_written() const { return this->is_valid() ? this->current_offset() : 0; } -intptr_t JfrChunkWriter::previous_checkpoint_offset() const { +int64_t JfrChunkWriter::previous_checkpoint_offset() const { return _chunkstate->previous_checkpoint_offset(); } -void JfrChunkWriter::set_previous_checkpoint_offset(intptr_t offset) { +void JfrChunkWriter::set_previous_checkpoint_offset(int64_t offset) { _chunkstate->set_previous_checkpoint_offset(offset); } diff --git a/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.hpp b/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.hpp index 2a304542530..df45ca3438e 100644 --- a/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.hpp +++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.hpp @@ -41,16 +41,16 @@ class JfrChunkWriter : public JfrChunkWriterBase { JfrChunkState* _chunkstate; bool open(); - size_t close(intptr_t metadata_offset); - void write_header(intptr_t metadata_offset); + size_t close(int64_t metadata_offset); + void write_header(int64_t metadata_offset); void set_chunk_path(const char* chunk_path); public: JfrChunkWriter(); bool initialize(); - intptr_t size_written() const; - intptr_t previous_checkpoint_offset() const; - void set_previous_checkpoint_offset(intptr_t offset); + int64_t size_written() const; + int64_t previous_checkpoint_offset() const; + void set_previous_checkpoint_offset(int64_t offset); void time_stamp_chunk_now(); }; diff --git a/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp b/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp index a877732608d..18817084357 100644 --- a/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp +++ b/src/hotspot/share/jfr/recorder/repository/jfrRepository.cpp @@ -147,10 +147,10 @@ static void date_time(char* buffer, size_t buffer_len) { iso8601_to_date_time(buffer); } -static jlong file_size(fio_fd fd) { +static int64_t file_size(fio_fd fd) { assert(fd != invalid_fd, "invariant"); - const jlong current_offset = os::current_file_offset(fd); - const jlong size = os::lseek(fd, 0, SEEK_END); + const int64_t current_offset = os::current_file_offset(fd); + const int64_t size = os::lseek(fd, 0, SEEK_END); os::seek_to_file_offset(fd, current_offset); return size; } @@ -218,7 +218,7 @@ const char* const RepositoryIterator::filter(const char* entry) const { if (invalid_fd == entry_fd) { return NULL; } - const jlong entry_size = file_size(entry_fd); + const int64_t entry_size = file_size(entry_fd); os::close(entry_fd); if (0 == entry_size) { return NULL; @@ -260,6 +260,7 @@ void RepositoryIterator::print_repository_files() const { } } #endif + bool RepositoryIterator::has_next() const { return (_files != NULL && _iterator < _files->length()); } @@ -275,21 +276,27 @@ static void write_emergency_file(fio_fd emergency_fd, const RepositoryIterator& if (file_copy_block == NULL) { return; } - jlong bytes_written_total = 0; + int64_t bytes_written_total = 0; while (iterator.has_next()) { fio_fd current_fd = invalid_fd; const char* const fqn = iterator.next(); if (fqn != NULL) { current_fd = open_existing(fqn); if (current_fd != invalid_fd) { - const jlong current_filesize = file_size(current_fd); + const int64_t current_filesize = file_size(current_fd); assert(current_filesize > 0, "invariant"); - jlong bytes_read = 0; - jlong bytes_written = 0; + int64_t bytes_read = 0; + int64_t bytes_written = 0; while (bytes_read < current_filesize) { - bytes_read += (jlong)os::read_at(current_fd, file_copy_block, size_of_file_copy_block, bytes_read); - assert(bytes_read - bytes_written <= (jlong)size_of_file_copy_block, "invariant"); - bytes_written += (jlong)os::write(emergency_fd, file_copy_block, bytes_read - bytes_written); + const ssize_t read_result = os::read_at(current_fd, file_copy_block, size_of_file_copy_block, bytes_read); + if (-1 == read_result) { + log_info(jfr) ( // For user, should not be "jfr, system" + "Unable to recover JFR data"); + break; + } + bytes_read += (int64_t)read_result; + assert(bytes_read - bytes_written <= (int64_t)size_of_file_copy_block, "invariant"); + bytes_written += (int64_t)os::write(emergency_fd, file_copy_block, bytes_read - bytes_written); assert(bytes_read == bytes_written, "invariant"); } os::close(current_fd); @@ -468,6 +475,6 @@ bool JfrRepository::open_chunk(bool vm_error /* false */) { return _chunkwriter->open(); } -size_t JfrRepository::close_chunk(jlong metadata_offset) { +size_t JfrRepository::close_chunk(int64_t metadata_offset) { return _chunkwriter->close(metadata_offset); } diff --git a/src/hotspot/share/jfr/recorder/repository/jfrRepository.hpp b/src/hotspot/share/jfr/recorder/repository/jfrRepository.hpp index 15c04a0e61f..708ff5aa533 100644 --- a/src/hotspot/share/jfr/recorder/repository/jfrRepository.hpp +++ b/src/hotspot/share/jfr/recorder/repository/jfrRepository.hpp @@ -55,7 +55,7 @@ class JfrRepository : public JfrCHeapObj { bool set_path(const char* path); void set_chunk_path(const char* path); bool open_chunk(bool vm_error = false); - size_t close_chunk(jlong metadata_offset); + size_t close_chunk(int64_t metadata_offset); void on_vm_error(); static void notify_on_new_chunk_path(); static JfrChunkWriter& chunkwriter(); diff --git a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp index c0c4964aa7c..1c8f067760b 100644 --- a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp +++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp @@ -130,18 +130,18 @@ class RotationLock : public StackObj { bool not_acquired() const { return !_acquired; } }; -static intptr_t write_checkpoint_event_prologue(JfrChunkWriter& cw, u8 type_id) { - const intptr_t prev_cp_offset = cw.previous_checkpoint_offset(); - const intptr_t prev_cp_relative_offset = 0 == prev_cp_offset ? 0 : prev_cp_offset - cw.current_offset(); +static int64_t write_checkpoint_event_prologue(JfrChunkWriter& cw, u8 type_id) { + const int64_t prev_cp_offset = cw.previous_checkpoint_offset(); + const int64_t prev_cp_relative_offset = 0 == prev_cp_offset ? 0 : prev_cp_offset - cw.current_offset(); cw.reserve(sizeof(u4)); cw.write(EVENT_CHECKPOINT); cw.write(JfrTicks::now()); - cw.write((jlong)0); + cw.write((int64_t)0); cw.write(prev_cp_relative_offset); // write previous checkpoint offset delta cw.write(false); // flushpoint - cw.write((u4)1); // nof types in this checkpoint - cw.write(type_id); - const intptr_t number_of_elements_offset = cw.current_offset(); + cw.write((u4)1); // nof types in this checkpoint + cw.write(type_id); + const int64_t number_of_elements_offset = cw.current_offset(); cw.reserve(sizeof(u4)); return number_of_elements_offset; } @@ -161,8 +161,8 @@ class WriteCheckpointEvent : public StackObj { } bool process() { // current_cp_offset is also offset for the event size header field - const intptr_t current_cp_offset = _cw.current_offset(); - const intptr_t num_elements_offset = write_checkpoint_event_prologue(_cw, _type_id); + const int64_t current_cp_offset = _cw.current_offset(); + const int64_t num_elements_offset = write_checkpoint_event_prologue(_cw, _type_id); // invocation _content_functor.process(); const u4 number_of_elements = (u4)_content_functor.processed(); @@ -468,9 +468,9 @@ void JfrRecorderService::safepoint_write() { JfrMetadataEvent::lock(); } -static jlong write_metadata_event(JfrChunkWriter& chunkwriter) { +static int64_t write_metadata_event(JfrChunkWriter& chunkwriter) { assert(chunkwriter.is_valid(), "invariant"); - const jlong metadata_offset = chunkwriter.current_offset(); + const int64_t metadata_offset = chunkwriter.current_offset(); JfrMetadataEvent::write(chunkwriter, metadata_offset); return metadata_offset; } diff --git a/src/hotspot/share/jfr/writers/jfrEventWriterHost.inline.hpp b/src/hotspot/share/jfr/writers/jfrEventWriterHost.inline.hpp index ac8b9b0c500..e619a2b0257 100644 --- a/src/hotspot/share/jfr/writers/jfrEventWriterHost.inline.hpp +++ b/src/hotspot/share/jfr/writers/jfrEventWriterHost.inline.hpp @@ -49,7 +49,7 @@ template inline intptr_t EventWriterHost::end_write(void) { assert(this->is_acquired(), "state corruption, calling end with writer with non-acquired state!"); - return this->is_valid() ? this->used_offset() : 0; + return this->is_valid() ? (intptr_t)this->used_offset() : 0; } template diff --git a/src/hotspot/share/jfr/writers/jfrPosition.hpp b/src/hotspot/share/jfr/writers/jfrPosition.hpp index 06ea76fe5ed..c42639adfb2 100644 --- a/src/hotspot/share/jfr/writers/jfrPosition.hpp +++ b/src/hotspot/share/jfr/writers/jfrPosition.hpp @@ -48,8 +48,8 @@ class Position : public AP { public: size_t available_size() const; - intptr_t used_offset() const; - intptr_t current_offset() const; + int64_t used_offset() const; + int64_t current_offset() const; size_t used_size() const; void reset(); }; diff --git a/src/hotspot/share/jfr/writers/jfrPosition.inline.hpp b/src/hotspot/share/jfr/writers/jfrPosition.inline.hpp index dede04666f4..cf57070121e 100644 --- a/src/hotspot/share/jfr/writers/jfrPosition.inline.hpp +++ b/src/hotspot/share/jfr/writers/jfrPosition.inline.hpp @@ -80,12 +80,12 @@ inline size_t Position::available_size() const { } template -inline intptr_t Position::used_offset() const { +inline int64_t Position::used_offset() const { return _current_pos - _start_pos; } template -inline intptr_t Position::current_offset() const { +inline int64_t Position::current_offset() const { return this->used_offset(); } diff --git a/src/hotspot/share/jfr/writers/jfrStreamWriterHost.hpp b/src/hotspot/share/jfr/writers/jfrStreamWriterHost.hpp index e5f82183500..6187cc62a19 100644 --- a/src/hotspot/share/jfr/writers/jfrStreamWriterHost.hpp +++ b/src/hotspot/share/jfr/writers/jfrStreamWriterHost.hpp @@ -33,9 +33,9 @@ class StreamWriterHost : public MemoryWriterHost { public: typedef typename Adapter::StorageType StorageType; private: - intptr_t _stream_pos; + int64_t _stream_pos; fio_fd _fd; - intptr_t current_stream_position() const; + int64_t current_stream_position() const; protected: StreamWriterHost(StorageType* storage, Thread* thread); @@ -47,8 +47,8 @@ class StreamWriterHost : public MemoryWriterHost { bool has_valid_fd() const; public: - intptr_t current_offset() const; - void seek(intptr_t offset); + int64_t current_offset() const; + void seek(int64_t offset); void flush(); void write_unbuffered(const void* src, size_t len); bool is_valid() const; diff --git a/src/hotspot/share/jfr/writers/jfrStreamWriterHost.inline.hpp b/src/hotspot/share/jfr/writers/jfrStreamWriterHost.inline.hpp index ca660641244..8b7c1e1d9ea 100644 --- a/src/hotspot/share/jfr/writers/jfrStreamWriterHost.inline.hpp +++ b/src/hotspot/share/jfr/writers/jfrStreamWriterHost.inline.hpp @@ -44,7 +44,7 @@ StreamWriterHost::StreamWriterHost(Thread* thread) : } template -inline intptr_t StreamWriterHost::current_stream_position() const { +inline int64_t StreamWriterHost::current_stream_position() const { return this->used_offset() + _stream_pos; } @@ -73,7 +73,7 @@ template inline void StreamWriterHost::flush(size_t size) { assert(size > 0, "invariant"); assert(this->is_valid(), "invariant"); - _stream_pos += os::write(_fd, this->start_pos(), (int)size); + _stream_pos += os::write(_fd, this->start_pos(), (unsigned int)size); StorageHost::reset(); assert(0 == this->used_offset(), "invariant"); } @@ -84,12 +84,12 @@ inline bool StreamWriterHost::has_valid_fd() const { } template -inline intptr_t StreamWriterHost::current_offset() const { +inline int64_t StreamWriterHost::current_offset() const { return current_stream_position(); } template -void StreamWriterHost::seek(intptr_t offset) { +void StreamWriterHost::seek(int64_t offset) { this->flush(); assert(0 == this->used_offset(), "can only seek from beginning"); _stream_pos = os::seek_to_file_offset(_fd, offset); @@ -110,7 +110,7 @@ void StreamWriterHost::write_unbuffered(const void* buf, size_t len this->flush(); assert(0 == this->used_offset(), "can only seek from beginning"); while (len > 0) { - const int n = MIN2((int)len, INT_MAX); + const unsigned int n = MIN2((unsigned int)len, (unsigned int)INT_MAX); _stream_pos += os::write(_fd, buf, n); len -= n; } diff --git a/src/hotspot/share/jfr/writers/jfrWriterHost.hpp b/src/hotspot/share/jfr/writers/jfrWriterHost.hpp index e4ba4cd074a..8f059aea78b 100644 --- a/src/hotspot/share/jfr/writers/jfrWriterHost.hpp +++ b/src/hotspot/share/jfr/writers/jfrWriterHost.hpp @@ -91,12 +91,12 @@ class WriterHost : public WriterPolicyImpl { void bytes(const void* buf, size_t len); void write_utf8_u2_len(const char* value); template - void write_padded_at_offset(T value, intptr_t offset); + void write_padded_at_offset(T value, int64_t offset); template - void write_at_offset(T value, intptr_t offset); + void write_at_offset(T value, int64_t offset); template - void write_be_at_offset(T value, intptr_t offset); - intptr_t reserve(size_t size); + void write_be_at_offset(T value, int64_t offset); + int64_t reserve(size_t size); }; #endif // SHARE_JFR_WRITERS_JFRWRITERHOST_HPP diff --git a/src/hotspot/share/jfr/writers/jfrWriterHost.inline.hpp b/src/hotspot/share/jfr/writers/jfrWriterHost.inline.hpp index 88ce3d06c7d..3f7e6444b5d 100644 --- a/src/hotspot/share/jfr/writers/jfrWriterHost.inline.hpp +++ b/src/hotspot/share/jfr/writers/jfrWriterHost.inline.hpp @@ -196,7 +196,7 @@ inline void WriterHost::write(float value) { template inline void WriterHost::write(double value) { - be_write(*(uintptr_t*)&(value)); + be_write(*(u8*)&(value)); } template @@ -317,9 +317,9 @@ inline void WriterHost::write_utf8_u2_len(const char* } template -inline intptr_t WriterHost::reserve(size_t size) { +inline int64_t WriterHost::reserve(size_t size) { if (ensure_size(size) != NULL) { - intptr_t reserved_offset = this->current_offset(); + const int64_t reserved_offset = this->current_offset(); this->set_current_pos(size); return reserved_offset; } @@ -329,9 +329,9 @@ inline intptr_t WriterHost::reserve(size_t size) { template template -inline void WriterHost::write_padded_at_offset(T value, intptr_t offset) { +inline void WriterHost::write_padded_at_offset(T value, int64_t offset) { if (this->is_valid()) { - const intptr_t current = this->current_offset(); + const int64_t current = this->current_offset(); this->seek(offset); write_padded(value); this->seek(current); // restore @@ -340,9 +340,9 @@ inline void WriterHost::write_padded_at_offset(T value template template -inline void WriterHost::write_at_offset(T value, intptr_t offset) { +inline void WriterHost::write_at_offset(T value, int64_t offset) { if (this->is_valid()) { - const intptr_t current = this->current_offset(); + const int64_t current = this->current_offset(); this->seek(offset); write(value); this->seek(current); // restore @@ -351,9 +351,9 @@ inline void WriterHost::write_at_offset(T value, intpt template template -inline void WriterHost::write_be_at_offset(T value, intptr_t offset) { +inline void WriterHost::write_be_at_offset(T value, int64_t offset) { if (this->is_valid()) { - const intptr_t current = this->current_offset(); + const int64_t current = this->current_offset(); this->seek(offset); be_write(value); this->seek(current); // restore From c97af8c3f780babd754ce56f2e15e807877c755a Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Fri, 22 Feb 2019 16:41:01 +0100 Subject: [PATCH 089/109] 8219554: Redundant lookup_common in SymbolTable::add Reviewed-by: iklam, coleenp, mikael --- src/hotspot/share/classfile/symbolTable.cpp | 12 +++++------- src/hotspot/share/classfile/symbolTable.hpp | 9 +-------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/hotspot/share/classfile/symbolTable.cpp b/src/hotspot/share/classfile/symbolTable.cpp index 15ef2375275..b856ffbee8e 100644 --- a/src/hotspot/share/classfile/symbolTable.cpp +++ b/src/hotspot/share/classfile/symbolTable.cpp @@ -436,18 +436,16 @@ Symbol* SymbolTable::lookup_only_unicode(const jchar* name, int utf16_length, } } -void SymbolTable::add(ClassLoaderData* loader_data, const constantPoolHandle& cp, - int names_count, const char** names, int* lengths, - int* cp_indices, unsigned int* hashValues, TRAPS) { +void SymbolTable::new_symbols(ClassLoaderData* loader_data, const constantPoolHandle& cp, + int names_count, const char** names, int* lengths, + int* cp_indices, unsigned int* hashValues, TRAPS) { bool c_heap = !loader_data->is_the_null_class_loader_data(); for (int i = 0; i < names_count; i++) { const char *name = names[i]; int len = lengths[i]; unsigned int hash = hashValues[i]; - Symbol* sym = SymbolTable::the_table()->lookup_common(name, len, hash); - if (sym == NULL) { - sym = SymbolTable::the_table()->do_add_if_needed(name, len, hash, c_heap, CHECK); - } + assert(SymbolTable::the_table()->lookup_shared(name, len, hash) == NULL, "must have checked already"); + Symbol* sym = SymbolTable::the_table()->do_add_if_needed(name, len, hash, c_heap, CHECK); assert(sym->refcount() != 0, "lookup should have incremented the count"); cp->symbol_at_put(cp_indices[i], sym); } diff --git a/src/hotspot/share/classfile/symbolTable.hpp b/src/hotspot/share/classfile/symbolTable.hpp index 6316eecc916..8f24d858feb 100644 --- a/src/hotspot/share/classfile/symbolTable.hpp +++ b/src/hotspot/share/classfile/symbolTable.hpp @@ -144,18 +144,11 @@ private: Symbol* do_add_if_needed(const char* name, int len, uintx hash, bool heap, TRAPS); // Adding elements - static void add(ClassLoaderData* loader_data, - const constantPoolHandle& cp, int names_count, - const char** names, int* lengths, int* cp_indices, - unsigned int* hashValues, TRAPS); - static void new_symbols(ClassLoaderData* loader_data, const constantPoolHandle& cp, int names_count, const char** name, int* lengths, int* cp_indices, unsigned int* hashValues, - TRAPS) { - add(loader_data, cp, names_count, name, lengths, cp_indices, hashValues, THREAD); - } + TRAPS); static Symbol* lookup_shared(const char* name, int len, unsigned int hash); Symbol* lookup_dynamic(const char* name, int len, unsigned int hash); From 8360a7884d7f067fc1e4dc0cfce65046efcea832 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Fri, 22 Feb 2019 17:54:13 +0100 Subject: [PATCH 090/109] 8219574: Minimal VM build failure after JDK-8219414 Reviewed-by: jgeorge, dholmes, cjplummer --- src/hotspot/os/linux/os_linux.cpp | 2 -- src/hotspot/share/classfile/classLoader.cpp | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index c08010a4aad..20bbd5ca75d 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -1359,11 +1359,9 @@ void os::shutdown() { void os::abort(bool dump_core, void* siginfo, const void* context) { os::shutdown(); if (dump_core) { -#ifndef ZERO if (DumpPrivateMappingsInCore) { ClassLoader::close_jrt_image(); } -#endif #ifndef PRODUCT fdStream out(defaultStream::output_fd()); out.print_raw("Current thread is "); diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index ed1dbdca4d8..099d8ee3a66 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -620,13 +620,14 @@ void ClassLoader::setup_module_search_path(const char* path, TRAPS) { update_module_path_entry_list(path, THREAD); } +#endif // INCLUDE_CDS + void ClassLoader::close_jrt_image() { - assert(ClassLoader::has_jrt_entry(), "Not applicable for exploded builds"); + // Not applicable for exploded builds + if (!ClassLoader::has_jrt_entry()) return; _jrt_entry->close_jimage(); } -#endif // INCLUDE_CDS - // Construct the array of module/path pairs as specified to --patch-module // for the boot loader to search ahead of the jimage, if the class being // loaded is defined to a module that has been specified to --patch-module. From 98ebd2bc9e10e81f0cba8c3047d8f51bafbad7af Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Fri, 22 Feb 2019 09:47:00 -0800 Subject: [PATCH 091/109] 8219417: bump jtreg requiredVersion to b14 Reviewed-by: alanb, dholmes --- test/hotspot/jtreg/TEST.ROOT | 5 ++++- test/jaxp/TEST.ROOT | 2 +- test/jdk/TEST.ROOT | 5 ++++- test/nashorn/TEST.ROOT | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/test/hotspot/jtreg/TEST.ROOT b/test/hotspot/jtreg/TEST.ROOT index 0b2f84d2983..406709d1d47 100644 --- a/test/hotspot/jtreg/TEST.ROOT +++ b/test/hotspot/jtreg/TEST.ROOT @@ -70,7 +70,7 @@ requires.properties= \ test.vm.gc.nvdimm # Minimum jtreg version -requiredVersion=4.2 b13 +requiredVersion=4.2 b14 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../../ notation to reach them @@ -81,3 +81,6 @@ useNewOptions=true # Use --patch-module instead of -Xmodule: useNewPatchModule=true + +# disabled till JDK-8219140 is fixed +allowSmartActionArgs=false diff --git a/test/jaxp/TEST.ROOT b/test/jaxp/TEST.ROOT index e9525b912b3..f5754d7b155 100644 --- a/test/jaxp/TEST.ROOT +++ b/test/jaxp/TEST.ROOT @@ -23,7 +23,7 @@ modules=java.xml groups=TEST.groups # Minimum jtreg version -requiredVersion=4.2 b13 +requiredVersion=4.2 b14 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../ notation to reach them diff --git a/test/jdk/TEST.ROOT b/test/jdk/TEST.ROOT index 15be645fbf4..ae8f7e2a1f1 100644 --- a/test/jdk/TEST.ROOT +++ b/test/jdk/TEST.ROOT @@ -49,7 +49,7 @@ requires.properties= \ release.implementor # Minimum jtreg version -requiredVersion=4.2 b13 +requiredVersion=4.2 b14 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../ notation to reach them @@ -60,3 +60,6 @@ useNewOptions=true # Use --patch-module instead of -Xmodule: useNewPatchModule=true + +# disabled till JDK-8219408 is fixed +allowSmartActionArgs=false diff --git a/test/nashorn/TEST.ROOT b/test/nashorn/TEST.ROOT index e4489382dcf..d989a1e85c5 100644 --- a/test/nashorn/TEST.ROOT +++ b/test/nashorn/TEST.ROOT @@ -8,7 +8,7 @@ keys=intermittent randomness groups=TEST.groups # Minimum jtreg version -requiredVersion=4.2 b13 +requiredVersion=4.2 b14 # Use new module options useNewOptions=true From b24f8ba2ec532d157dd213239d2a50af0af55a56 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Fri, 22 Feb 2019 10:13:33 -0800 Subject: [PATCH 092/109] 8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char Reviewed-by: alanb, redestad --- .../java/nio/Heap-X-Buffer.java.template | 19 ++++++ .../openjdk/bench/java/nio/CharBuffers.java | 66 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 test/micro/org/openjdk/bench/java/nio/CharBuffers.java diff --git a/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template b/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template index 8875e535feb..3a4e1799118 100644 --- a/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template +++ b/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template @@ -270,6 +270,25 @@ class Heap$Type$Buffer$RW$ #end[rw] } +#if[char] + + public $Type$Buffer put(String src, int start, int end) { + int length = end - start; + checkBounds(start, length, src.length()); + if (isReadOnly()) + throw new ReadOnlyBufferException(); + int pos = position(); + int lim = limit(); + int rem = (pos <= lim) ? lim - pos : 0; + if (length > rem) + throw new BufferOverflowException(); + src.getChars(start, end, hb, ix(pos)); + position(pos + length); + return this; + } + +#end[char] + public $Type$Buffer compact() { #if[rw] System.arraycopy(hb, ix(position()), hb, ix(0), remaining()); diff --git a/test/micro/org/openjdk/bench/java/nio/CharBuffers.java b/test/micro/org/openjdk/bench/java/nio/CharBuffers.java new file mode 100644 index 00000000000..e663633a02c --- /dev/null +++ b/test/micro/org/openjdk/bench/java/nio/CharBuffers.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2019, 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 org.openjdk.bench.java.nio; + +import java.nio.CharBuffer; +import java.util.Arrays; +import java.util.concurrent.TimeUnit; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; + +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@State(Scope.Thread) +public class CharBuffers { + + @Param({"2", "256", "16384"}) + public int numChars; + + public String str; + public CharBuffer buf; + + @Setup(Level.Iteration) + public void createString() { + char[] c = new char[numChars]; + Arrays.fill(c, 'X'); + str = String.valueOf(c); + buf = CharBuffer.allocate(numChars); + } + + @Benchmark + public CharBuffer putString() { + buf.clear(); + return buf.put(str); + } + +} From 24c70fcf8845b447362aa1da9e672ca896c181c3 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Fri, 22 Feb 2019 10:13:34 -0800 Subject: [PATCH 093/109] 8048192: (bf) Out of direct buffer memory message should include the limits Reviewed-by: alanb, rriggs --- src/java.base/share/classes/java/nio/Bits.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/java.base/share/classes/java/nio/Bits.java b/src/java.base/share/classes/java/nio/Bits.java index 8872492f839..fe483b65ac0 100644 --- a/src/java.base/share/classes/java/nio/Bits.java +++ b/src/java.base/share/classes/java/nio/Bits.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -172,7 +172,10 @@ class Bits { // package-private } // no luck - throw new OutOfMemoryError("Direct buffer memory"); + throw new OutOfMemoryError + ("Cannot reserve " + + size + " bytes of direct buffer memory (allocated: " + + RESERVED_MEMORY.get() + ", limit: " + MAX_MEMORY +")"); } finally { if (interrupted) { From b88c7ac223b6a6132c35511ca7d62b2bf0aa1f28 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Fri, 22 Feb 2019 11:07:18 -0800 Subject: [PATCH 094/109] 8219158: use 'test.root' property instead of traversing test-src path Reviewed-by: dholmes --- .../gc/g1/unloading/GenClassesBuilder.java | 23 ++++++----------- .../stress/classload/GenClassesBuilder.java | 23 ++++++----------- .../vm/mlvm/share/StratumClassesBuilder.java | 12 ++------- .../vm/runtime/defmeth/shared/BuildJar.java | 25 +++++++------------ test/lib/jdk/test/lib/Utils.java | 22 ++++++++++------ 5 files changed, 41 insertions(+), 64 deletions(-) diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/GenClassesBuilder.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/GenClassesBuilder.java index 75e77b29eda..964d1350ef4 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/GenClassesBuilder.java +++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/GenClassesBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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,12 +35,13 @@ import java.nio.file.Paths; */ public class GenClassesBuilder { public static void main(String[] args) { - Path template = testRoot().resolve("vmTestbase") - .resolve("gc") - .resolve("g1") - .resolve("unloading") - .resolve("ClassNNN.java.template") - .toAbsolutePath(); + Path template = Paths.get(Utils.TEST_ROOT) + .resolve("vmTestbase") + .resolve("gc") + .resolve("g1") + .resolve("unloading") + .resolve("ClassNNN.java.template") + .toAbsolutePath(); Path dir = Paths.get(".").toAbsolutePath(); String count = "1000"; if (Files.notExists(template)) { @@ -52,14 +53,6 @@ public class GenClassesBuilder { throw new Error("can't generate classPool.jar", e); } } - - private static Path testRoot() { - Path p = Paths.get(Utils.TEST_SRC); - while (!Files.exists(p.resolve("TEST.ROOT"))) { - p = p.getParent(); - } - return p; - } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/GenClassesBuilder.java b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/GenClassesBuilder.java index 47be14a4721..871ad434265 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/GenClassesBuilder.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/classload/GenClassesBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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 @@ -79,12 +79,13 @@ public class GenClassesBuilder { } catch (IOException e) { throw new Error("can't create dirs for" + dir, e); } - Path pattern = testRoot().resolve("vmTestbase") - .resolve("nsk") - .resolve("monitoring") - .resolve("share") - .resolve("LoadableClass.pattern") - .toAbsolutePath(); + Path pattern = Paths.get(Utils.TEST_ROOT) + .resolve("vmTestbase") + .resolve("nsk") + .resolve("monitoring") + .resolve("share") + .resolve("LoadableClass.pattern") + .toAbsolutePath(); if (Files.notExists(pattern)) { throw new Error("can't find pattern file: " + pattern); } @@ -94,13 +95,5 @@ public class GenClassesBuilder { throw new Error("can't generate classes", e); } } - - private static Path testRoot() { - Path p = Paths.get(Utils.TEST_SRC); - while (!Files.exists(p.resolve("TEST.ROOT"))) { - p = p.getParent(); - } - return p; - } } diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/StratumClassesBuilder.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/StratumClassesBuilder.java index ec25dfae96c..23ed2460560 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/StratumClassesBuilder.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/StratumClassesBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -38,7 +38,7 @@ import java.util.stream.Stream; public class StratumClassesBuilder { public static void main(String[] args) { - Path root = testRoot(); + Path root = Paths.get(Utils.TEST_ROOT); Arrays.stream(args) .map(root::resolve) .forEach(StratumClassesBuilder::build); @@ -113,12 +113,4 @@ public class StratumClassesBuilder { return file.getParent() .resolve(filename.replaceFirst("\\.class$", ".smap")); } - - private static Path testRoot() { - Path p = Paths.get(Utils.TEST_SRC); - while (!Files.exists(p.resolve("TEST.ROOT"))) { - p = p.getParent(); - } - return p; - } } diff --git a/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/BuildJar.java b/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/BuildJar.java index ef06a4bc961..3866329ea2e 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/BuildJar.java +++ b/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/BuildJar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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 @@ -41,13 +41,14 @@ import java.util.Arrays; */ public class BuildJar { public static void main(String[] args) { - Path manifest = testRoot().resolve("vmTestbase") - .resolve("vm") - .resolve("runtime") - .resolve("defmeth") - .resolve("shared") - .resolve("retransform.mf") - .toAbsolutePath(); + Path manifest = Paths.get(Utils.TEST_ROOT) + .resolve("vmTestbase") + .resolve("vm") + .resolve("runtime") + .resolve("defmeth") + .resolve("shared") + .resolve("retransform.mf") + .toAbsolutePath(); if (Files.notExists(manifest)) { throw new Error("can't find manifest file: " + manifest); } @@ -90,13 +91,5 @@ public class BuildJar { } throw new Error("can't find " + file + " in " + Utils.TEST_CLASS_PATH); } - - private static Path testRoot() { - Path p = Paths.get(Utils.TEST_SRC); - while (!Files.exists(p.resolve("TEST.ROOT"))) { - p = p.getParent(); - } - return p; - } } diff --git a/test/lib/jdk/test/lib/Utils.java b/test/lib/jdk/test/lib/Utils.java index dea36051c22..a98f52aae6f 100644 --- a/test/lib/jdk/test/lib/Utils.java +++ b/test/lib/jdk/test/lib/Utils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, 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 @@ -88,6 +88,11 @@ public final class Utils { */ public static final String TEST_SRC = System.getProperty("test.src", "").trim(); + /** + * Returns the value of 'test.root' system property. + */ + public static final String TEST_ROOT = System.getProperty("test.root", "").trim(); + /* * Returns the value of 'test.jdk' system property */ @@ -96,12 +101,13 @@ public final class Utils { /* * Returns the value of 'compile.jdk' system property */ - public static final String COMPILE_JDK= System.getProperty("compile.jdk", TEST_JDK); + public static final String COMPILE_JDK = System.getProperty("compile.jdk", TEST_JDK); /** * Returns the value of 'test.classes' system property */ public static final String TEST_CLASSES = System.getProperty("test.classes", "."); + /** * Defines property name for seed value. */ @@ -118,9 +124,9 @@ public final class Utils { */ public static final long SEED = Long.getLong(SEED_PROPERTY_NAME, new Random().nextLong()); /** - * Returns the value of 'test.timeout.factor' system property - * converted to {@code double}. - */ + * Returns the value of 'test.timeout.factor' system property + * converted to {@code double}. + */ public static final double TIMEOUT_FACTOR; static { String toFactor = System.getProperty("test.timeout.factor", "1.0"); @@ -128,9 +134,9 @@ public final class Utils { } /** - * Returns the value of JTREG default test timeout in milliseconds - * converted to {@code long}. - */ + * Returns the value of JTREG default test timeout in milliseconds + * converted to {@code long}. + */ public static final long DEFAULT_TEST_TIMEOUT = TimeUnit.SECONDS.toMillis(120); private Utils() { From 351280bbb8337eff6b61ce305ead2bf207370889 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Fri, 22 Feb 2019 13:56:08 -0500 Subject: [PATCH 095/109] 8078725: method adjustments can be done just once for all classes involved into redefinition Walk all classes at the end of redefinition and adjust method entries and clean MethodData Reviewed-by: sspitsyn --- src/hotspot/share/oops/cpCache.cpp | 23 ++-- src/hotspot/share/oops/cpCache.hpp | 4 +- src/hotspot/share/oops/instanceKlass.cpp | 12 +- src/hotspot/share/oops/instanceKlass.hpp | 2 +- src/hotspot/share/oops/klassVtable.cpp | 24 ++-- src/hotspot/share/oops/klassVtable.hpp | 4 +- src/hotspot/share/oops/method.hpp | 9 ++ .../share/prims/jvmtiRedefineClasses.cpp | 118 +++++++----------- .../share/prims/jvmtiRedefineClasses.hpp | 26 ++-- .../share/prims/resolvedMethodTable.cpp | 9 +- 10 files changed, 91 insertions(+), 140 deletions(-) diff --git a/src/hotspot/share/oops/cpCache.cpp b/src/hotspot/share/oops/cpCache.cpp index a7615461c4f..4eda9a8e31c 100644 --- a/src/hotspot/share/oops/cpCache.cpp +++ b/src/hotspot/share/oops/cpCache.cpp @@ -591,7 +591,7 @@ void ConstantPoolCacheEntry::adjust_method_entry(Method* old_method, // a constant pool cache entry should never contain old or obsolete methods bool ConstantPoolCacheEntry::check_no_old_or_obsolete_entries() { - Method* m = get_interesting_method_entry(NULL); + Method* m = get_interesting_method_entry(); // return false if m refers to a non-deleted old or obsolete method if (m != NULL) { assert(m->is_valid() && m->is_method(), "m is a valid method"); @@ -601,7 +601,7 @@ bool ConstantPoolCacheEntry::check_no_old_or_obsolete_entries() { } } -Method* ConstantPoolCacheEntry::get_interesting_method_entry(Klass* k) { +Method* ConstantPoolCacheEntry::get_interesting_method_entry() { if (!is_method_entry()) { // not a method entry so not interesting by default return NULL; @@ -622,12 +622,9 @@ Method* ConstantPoolCacheEntry::get_interesting_method_entry(Klass* k) { } } assert(m != NULL && m->is_method(), "sanity check"); - if (m == NULL || !m->is_method() || (k != NULL && m->method_holder() != k)) { - // robustness for above sanity checks or method is not in - // the interesting class + if (m == NULL || !m->is_method()) { return NULL; } - // the method is in the interesting class so the entry is interesting return m; } #endif // INCLUDE_JVMTI @@ -777,10 +774,10 @@ void ConstantPoolCache::set_archived_references(oop o) { // RedefineClasses() API support: // If any entry of this ConstantPoolCache points to any of // old_methods, replace it with the corresponding new_method. -void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) { +void ConstantPoolCache::adjust_method_entries(bool * trace_name_printed) { for (int i = 0; i < length(); i++) { ConstantPoolCacheEntry* entry = entry_at(i); - Method* old_method = entry->get_interesting_method_entry(holder); + Method* old_method = entry->get_interesting_method_entry(); if (old_method == NULL || !old_method->is_old()) { continue; // skip uninteresting entries } @@ -789,11 +786,7 @@ void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trac entry->initialize_entry(entry->constant_pool_index()); continue; } - Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum()); - - assert(new_method != NULL, "method_with_idnum() should not be NULL"); - assert(old_method != new_method, "sanity check"); - + Method* new_method = old_method->get_new_method(); entry_at(i)->adjust_method_entry(old_method, new_method, trace_name_printed); } } @@ -801,7 +794,7 @@ void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trac // the constant pool cache should never contain old or obsolete methods bool ConstantPoolCache::check_no_old_or_obsolete_entries() { for (int i = 1; i < length(); i++) { - if (entry_at(i)->get_interesting_method_entry(NULL) != NULL && + if (entry_at(i)->get_interesting_method_entry() != NULL && !entry_at(i)->check_no_old_or_obsolete_entries()) { return false; } @@ -811,7 +804,7 @@ bool ConstantPoolCache::check_no_old_or_obsolete_entries() { void ConstantPoolCache::dump_cache() { for (int i = 1; i < length(); i++) { - if (entry_at(i)->get_interesting_method_entry(NULL) != NULL) { + if (entry_at(i)->get_interesting_method_entry() != NULL) { entry_at(i)->print(tty, i); } } diff --git a/src/hotspot/share/oops/cpCache.hpp b/src/hotspot/share/oops/cpCache.hpp index e9aca49b1c6..d3d9cb6f02d 100644 --- a/src/hotspot/share/oops/cpCache.hpp +++ b/src/hotspot/share/oops/cpCache.hpp @@ -376,7 +376,7 @@ class ConstantPoolCacheEntry { void adjust_method_entry(Method* old_method, Method* new_method, bool* trace_name_printed); bool check_no_old_or_obsolete_entries(); - Method* get_interesting_method_entry(Klass* k); + Method* get_interesting_method_entry(); #endif // INCLUDE_JVMTI // Debugging & Printing @@ -496,7 +496,7 @@ class ConstantPoolCache: public MetaspaceObj { // trace_name_printed is set to true if the current call has // printed the klass name so that other routines in the adjust_* // group don't print the klass name. - void adjust_method_entries(InstanceKlass* holder, bool* trace_name_printed); + void adjust_method_entries(bool* trace_name_printed); bool check_no_old_or_obsolete_entries(); void dump_cache(); #endif // INCLUDE_JVMTI diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index a101f507052..19e43423ab9 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -2917,22 +2917,18 @@ Method* InstanceKlass::method_at_itable(Klass* holder, int index, TRAPS) { // not yet in the vtable due to concurrent subclass define and superinterface // redefinition // Note: those in the vtable, should have been updated via adjust_method_entries -void InstanceKlass::adjust_default_methods(InstanceKlass* holder, bool* trace_name_printed) { +void InstanceKlass::adjust_default_methods(bool* trace_name_printed) { // search the default_methods for uses of either obsolete or EMCP methods if (default_methods() != NULL) { for (int index = 0; index < default_methods()->length(); index ++) { Method* old_method = default_methods()->at(index); - if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) { + if (old_method == NULL || !old_method->is_old()) { continue; // skip uninteresting entries } assert(!old_method->is_deleted(), "default methods may not be deleted"); - - Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum()); - - assert(new_method != NULL, "method_with_idnum() should not be NULL"); - assert(old_method != new_method, "sanity check"); - + Method* new_method = old_method->get_new_method(); default_methods()->at_put(index, new_method); + if (log_is_enabled(Info, redefine, class, update)) { ResourceMark rm; if (!(*trace_name_printed)) { diff --git a/src/hotspot/share/oops/instanceKlass.hpp b/src/hotspot/share/oops/instanceKlass.hpp index 7811c6c9650..13029ca4111 100644 --- a/src/hotspot/share/oops/instanceKlass.hpp +++ b/src/hotspot/share/oops/instanceKlass.hpp @@ -1141,7 +1141,7 @@ public: Method* method_at_itable(Klass* holder, int index, TRAPS); #if INCLUDE_JVMTI - void adjust_default_methods(InstanceKlass* holder, bool* trace_name_printed); + void adjust_default_methods(bool* trace_name_printed); #endif // INCLUDE_JVMTI void clean_weak_instanceklass_links(); diff --git a/src/hotspot/share/oops/klassVtable.cpp b/src/hotspot/share/oops/klassVtable.cpp index 8f5fd36ae5f..d67afb1de86 100644 --- a/src/hotspot/share/oops/klassVtable.cpp +++ b/src/hotspot/share/oops/klassVtable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -942,21 +942,18 @@ bool klassVtable::adjust_default_method(int vtable_index, Method* old_method, Me } // search the vtable for uses of either obsolete or EMCP methods -void klassVtable::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) { +void klassVtable::adjust_method_entries(bool * trace_name_printed) { int prn_enabled = 0; for (int index = 0; index < length(); index++) { Method* old_method = unchecked_method_at(index); - if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) { + if (old_method == NULL || !old_method->is_old()) { continue; // skip uninteresting entries } assert(!old_method->is_deleted(), "vtable methods may not be deleted"); - Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum()); - - assert(new_method != NULL, "method_with_idnum() should not be NULL"); - assert(old_method != new_method, "sanity check"); - + Method* new_method = old_method->get_new_method(); put_method_at(new_method, index); + // For default methods, need to update the _default_methods array // which can only have one method entry for a given signature bool updated_default = false; @@ -1272,21 +1269,16 @@ void klassItable::initialize_itable_for_interface(int method_table_offset, Insta #if INCLUDE_JVMTI // search the itable for uses of either obsolete or EMCP methods -void klassItable::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) { +void klassItable::adjust_method_entries(bool * trace_name_printed) { itableMethodEntry* ime = method_entry(0); for (int i = 0; i < _size_method_table; i++, ime++) { Method* old_method = ime->method(); - if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) { + if (old_method == NULL || !old_method->is_old()) { continue; // skip uninteresting entries } assert(!old_method->is_deleted(), "itable methods may not be deleted"); - - Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum()); - - assert(new_method != NULL, "method_with_idnum() should not be NULL"); - assert(old_method != new_method, "sanity check"); - + Method* new_method = old_method->get_new_method(); ime->initialize(new_method); if (log_is_enabled(Info, redefine, class, update)) { diff --git a/src/hotspot/share/oops/klassVtable.hpp b/src/hotspot/share/oops/klassVtable.hpp index 08e35cd0b34..9e895e22b34 100644 --- a/src/hotspot/share/oops/klassVtable.hpp +++ b/src/hotspot/share/oops/klassVtable.hpp @@ -103,7 +103,7 @@ class klassVtable { // printed the klass name so that other routines in the adjust_* // group don't print the klass name. bool adjust_default_method(int vtable_index, Method* old_method, Method* new_method); - void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed); + void adjust_method_entries(bool* trace_name_printed); bool check_no_old_or_obsolete_entries(); void dump_vtable(); #endif // INCLUDE_JVMTI @@ -322,7 +322,7 @@ class klassItable { // trace_name_printed is set to true if the current call has // printed the klass name so that other routines in the adjust_* // group don't print the klass name. - void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed); + void adjust_method_entries(bool* trace_name_printed); bool check_no_old_or_obsolete_entries(); void dump_itable(); #endif // INCLUDE_JVMTI diff --git a/src/hotspot/share/oops/method.hpp b/src/hotspot/share/oops/method.hpp index d715d2e3b04..7f039aea353 100644 --- a/src/hotspot/share/oops/method.hpp +++ b/src/hotspot/share/oops/method.hpp @@ -974,6 +974,15 @@ class Method : public Metadata { // Deallocation function for redefine classes or if an error occurs void deallocate_contents(ClassLoaderData* loader_data); + Method* get_new_method() const { + InstanceKlass* holder = method_holder(); + Method* new_method = holder->method_with_idnum(orig_method_idnum()); + + assert(new_method != NULL, "method_with_idnum() should not be NULL"); + assert(this != new_method, "sanity check"); + return new_method; + } + // Printing #ifndef PRODUCT void print_on(outputStream* st) const; diff --git a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp index 8002f4bd8dc..d703c211998 100644 --- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp +++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp @@ -62,10 +62,11 @@ Method** VM_RedefineClasses::_matching_old_methods = NULL; Method** VM_RedefineClasses::_matching_new_methods = NULL; Method** VM_RedefineClasses::_deleted_methods = NULL; Method** VM_RedefineClasses::_added_methods = NULL; -int VM_RedefineClasses::_matching_methods_length = 0; -int VM_RedefineClasses::_deleted_methods_length = 0; -int VM_RedefineClasses::_added_methods_length = 0; -Klass* VM_RedefineClasses::_the_class = NULL; +int VM_RedefineClasses::_matching_methods_length = 0; +int VM_RedefineClasses::_deleted_methods_length = 0; +int VM_RedefineClasses::_added_methods_length = 0; +bool VM_RedefineClasses::_has_redefined_Object = false; +bool VM_RedefineClasses::_has_null_class_loader = false; VM_RedefineClasses::VM_RedefineClasses(jint class_count, @@ -76,6 +77,9 @@ VM_RedefineClasses::VM_RedefineClasses(jint class_count, _class_load_kind = class_load_kind; _any_class_has_resolved_methods = false; _res = JVMTI_ERROR_NONE; + _the_class = NULL; + _has_redefined_Object = false; + _has_null_class_loader = false; } static inline InstanceKlass* get_ik(jclass def) { @@ -214,11 +218,12 @@ void VM_RedefineClasses::doit() { // Flush all compiled code that depends on the classes redefined. flush_dependent_code(); - // Clean out MethodData pointing to old Method* + // Adjust constantpool caches and vtables for all classes + // that reference methods of the evolved classes. // Have to do this after all classes are redefined and all methods that // are redefined are marked as old. - MethodDataCleaner clean_weak_method_links; - ClassLoaderDataGraph::classes_do(&clean_weak_method_links); + AdjustAndCleanMetadata adjust_and_clean_metadata(thread); + ClassLoaderDataGraph::classes_do(&adjust_and_clean_metadata); // JSR-292 support if (_any_class_has_resolved_methods) { @@ -3415,25 +3420,35 @@ void VM_RedefineClasses::set_new_constant_pool( // Unevolving classes may point to methods of the_class directly // from their constant pool caches, itables, and/or vtables. We // use the ClassLoaderDataGraph::classes_do() facility and this helper -// to fix up these pointers. +// to fix up these pointers. MethodData also points to old methods and +// must be cleaned. // Adjust cpools and vtables closure -void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) { +void VM_RedefineClasses::AdjustAndCleanMetadata::do_klass(Klass* k) { // This is a very busy routine. We don't want too much tracing // printed out. bool trace_name_printed = false; - InstanceKlass *the_class = InstanceKlass::cast(_the_class); // If the class being redefined is java.lang.Object, we need to fix all // array class vtables also - if (k->is_array_klass() && _the_class == SystemDictionary::Object_klass()) { - k->vtable().adjust_method_entries(the_class, &trace_name_printed); + if (k->is_array_klass() && _has_redefined_Object) { + k->vtable().adjust_method_entries(&trace_name_printed); } else if (k->is_instance_klass()) { HandleMark hm(_thread); InstanceKlass *ik = InstanceKlass::cast(k); + // Clean MethodData of this class's methods so they don't refer to + // old methods that are no longer running. + Array* methods = ik->methods(); + int num_methods = methods->length(); + for (int index = 0; index < num_methods; ++index) { + if (methods->at(index)->method_data() != NULL) { + methods->at(index)->method_data()->clean_weak_method_links(); + } + } + // HotSpot specific optimization! HotSpot does not currently // support delegation from the bootstrap class loader to a // user-defined class loader. This means that if the bootstrap @@ -3446,57 +3461,29 @@ void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) { // If the current class being redefined has a user-defined class // loader as its defining class loader, then we can skip all // classes loaded by the bootstrap class loader. - bool is_user_defined = (_the_class->class_loader() != NULL); - if (is_user_defined && ik->class_loader() == NULL) { + if (!_has_null_class_loader && ik->class_loader() == NULL) { return; } - // Fix the vtable embedded in the_class and subclasses of the_class, - // if one exists. We discard scratch_class and we don't keep an - // InstanceKlass around to hold obsolete methods so we don't have - // any other InstanceKlass embedded vtables to update. The vtable - // holds the Method*s for virtual (but not final) methods. - // Default methods, or concrete methods in interfaces are stored - // in the vtable, so if an interface changes we need to check - // adjust_method_entries() for every InstanceKlass, which will also - // adjust the default method vtable indices. - // We also need to adjust any default method entries that are - // not yet in the vtable, because the vtable setup is in progress. - // This must be done after we adjust the default_methods and - // default_vtable_indices for methods already in the vtable. - // If redefining Unsafe, walk all the vtables looking for entries. - if (ik->vtable_length() > 0 && (_the_class->is_interface() - || _the_class == SystemDictionary::internal_Unsafe_klass() - || ik->is_subtype_of(_the_class))) { - // ik->vtable() creates a wrapper object; rm cleans it up - ResourceMark rm(_thread); - - ik->vtable().adjust_method_entries(the_class, &trace_name_printed); - ik->adjust_default_methods(the_class, &trace_name_printed); + // Adjust all vtables, default methods and itables, to clean out old methods. + ResourceMark rm(_thread); + if (ik->vtable_length() > 0) { + ik->vtable().adjust_method_entries(&trace_name_printed); + ik->adjust_default_methods(&trace_name_printed); } - // If the current class has an itable and we are either redefining an - // interface or if the current class is a subclass of the_class, then - // we potentially have to fix the itable. If we are redefining an - // interface, then we have to call adjust_method_entries() for - // every InstanceKlass that has an itable since there isn't a - // subclass relationship between an interface and an InstanceKlass. - // If redefining Unsafe, walk all the itables looking for entries. - if (ik->itable_length() > 0 && (_the_class->is_interface() - || _the_class == SystemDictionary::internal_Unsafe_klass() - || ik->is_subclass_of(_the_class))) { - ResourceMark rm(_thread); - ik->itable().adjust_method_entries(the_class, &trace_name_printed); + if (ik->itable_length() > 0) { + ik->itable().adjust_method_entries(&trace_name_printed); } // The constant pools in other classes (other_cp) can refer to - // methods in the_class. We have to update method information in + // old methods. We have to update method information in // other_cp's cache. If other_cp has a previous version, then we // have to repeat the process for each previous version. The // constant pool cache holds the Method*s for non-virtual // methods and for virtual, final methods. // - // Special case: if the current class is the_class, then new_cp + // Special case: if the current class being redefined, then new_cp // has already been attached to the_class and old_cp has already // been added as a previous version. The new_cp doesn't have any // cached references to old methods so it doesn't need to be @@ -3505,12 +3492,12 @@ void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) { constantPoolHandle other_cp; ConstantPoolCache* cp_cache; - if (ik != _the_class) { + if (!ik->is_being_redefined()) { // this klass' constant pool cache may need adjustment other_cp = constantPoolHandle(ik->constants()); cp_cache = other_cp->cache(); if (cp_cache != NULL) { - cp_cache->adjust_method_entries(the_class, &trace_name_printed); + cp_cache->adjust_method_entries(&trace_name_printed); } } @@ -3520,23 +3507,7 @@ void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) { pv_node = pv_node->previous_versions()) { cp_cache = pv_node->constants()->cache(); if (cp_cache != NULL) { - cp_cache->adjust_method_entries(pv_node, &trace_name_printed); - } - } - } -} - -// Clean method data for this class -void VM_RedefineClasses::MethodDataCleaner::do_klass(Klass* k) { - if (k->is_instance_klass()) { - InstanceKlass *ik = InstanceKlass::cast(k); - // Clean MethodData of this class's methods so they don't refer to - // old methods that are no longer running. - Array* methods = ik->methods(); - int num_methods = methods->length(); - for (int index = 0; index < num_methods; ++index) { - if (methods->at(index)->method_data() != NULL) { - methods->at(index)->method_data()->clean_weak_method_links(); + cp_cache->adjust_method_entries(&trace_name_printed); } } } @@ -3972,6 +3943,10 @@ void VM_RedefineClasses::redefine_single_class(jclass the_jclass, InstanceKlass* the_class = get_ik(the_jclass); + // Set some flags to control and optimize adjusting method entries + _has_redefined_Object |= the_class == SystemDictionary::Object_klass(); + _has_null_class_loader |= the_class->class_loader() == NULL; + // Remove all breakpoints in methods of this class JvmtiBreakpoints& jvmti_breakpoints = JvmtiCurrentBreakpoints::get_jvmti_breakpoints(); jvmti_breakpoints.clearall_in_class_at_safepoint(the_class); @@ -4193,11 +4168,6 @@ void VM_RedefineClasses::redefine_single_class(jclass the_jclass, _timer_rsc_phase2.start(); } - // Adjust constantpool caches and vtables for all classes - // that reference methods of the evolved class. - AdjustCpoolCacheAndVtable adjust_cpool_cache_and_vtable(THREAD); - ClassLoaderDataGraph::classes_do(&adjust_cpool_cache_and_vtable); - if (the_class->oop_map_cache() != NULL) { // Flush references to any obsolete methods from the oop map cache // so that obsolete methods are not pinned. diff --git a/src/hotspot/share/prims/jvmtiRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiRedefineClasses.hpp index ed6d3c3ca7b..7918e678630 100644 --- a/src/hotspot/share/prims/jvmtiRedefineClasses.hpp +++ b/src/hotspot/share/prims/jvmtiRedefineClasses.hpp @@ -338,20 +338,22 @@ struct JvmtiCachedClassFileData { class VM_RedefineClasses: public VM_Operation { private: // These static fields are needed by ClassLoaderDataGraph::classes_do() - // facility and the AdjustCpoolCacheAndVtable helper: + // facility and the CheckClass and AdjustAndCleanMetadata helpers. static Array* _old_methods; static Array* _new_methods; - static Method** _matching_old_methods; - static Method** _matching_new_methods; - static Method** _deleted_methods; - static Method** _added_methods; + static Method** _matching_old_methods; + static Method** _matching_new_methods; + static Method** _deleted_methods; + static Method** _added_methods; static int _matching_methods_length; static int _deleted_methods_length; static int _added_methods_length; - static Klass* _the_class; + static bool _has_redefined_Object; + static bool _has_null_class_loader; // The instance fields are used to pass information from // doit_prologue() to doit() and doit_epilogue(). + Klass* _the_class; jint _class_count; const jvmtiClassDefinition *_class_defs; // ptr to _class_count defs @@ -513,20 +515,14 @@ class VM_RedefineClasses: public VM_Operation { // Unevolving classes may point to methods of the_class directly // from their constant pool caches, itables, and/or vtables. We // use the ClassLoaderDataGraph::classes_do() facility and this helper - // to fix up these pointers. - class AdjustCpoolCacheAndVtable : public KlassClosure { + // to fix up these pointers and clean MethodData out. + class AdjustAndCleanMetadata : public KlassClosure { Thread* _thread; public: - AdjustCpoolCacheAndVtable(Thread* t) : _thread(t) {} + AdjustAndCleanMetadata(Thread* t) : _thread(t) {} void do_klass(Klass* k); }; - // Clean MethodData out - class MethodDataCleaner : public KlassClosure { - public: - MethodDataCleaner() {} - void do_klass(Klass* k); - }; public: VM_RedefineClasses(jint class_count, const jvmtiClassDefinition *class_defs, diff --git a/src/hotspot/share/prims/resolvedMethodTable.cpp b/src/hotspot/share/prims/resolvedMethodTable.cpp index 62761269a54..01c9b15014a 100644 --- a/src/hotspot/share/prims/resolvedMethodTable.cpp +++ b/src/hotspot/share/prims/resolvedMethodTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, 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 @@ -232,12 +232,7 @@ void ResolvedMethodTable::adjust_method_entries(bool * trace_name_printed) { continue; } - InstanceKlass* holder = old_method->method_holder(); - Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum()); - assert(holder == new_method->method_holder(), "call after swapping redefined guts"); - assert(new_method != NULL, "method_with_idnum() should not be NULL"); - assert(old_method != new_method, "sanity check"); - + Method* new_method = old_method->get_new_method(); java_lang_invoke_ResolvedMethodName::set_vmtarget(mem_name, new_method); ResourceMark rm; From 17777a76802fac70c8ff05c0730eb282abda6553 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Fri, 22 Feb 2019 20:42:01 +0100 Subject: [PATCH 096/109] 8219571: ProblemList serviceability/sa/TestJmapCoreMetaspace.java Reviewed-by: iignatyev --- test/hotspot/jtreg/ProblemList-zgc.txt | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/hotspot/jtreg/ProblemList-zgc.txt diff --git a/test/hotspot/jtreg/ProblemList-zgc.txt b/test/hotspot/jtreg/ProblemList-zgc.txt new file mode 100644 index 00000000000..2d4c1c2cdf5 --- /dev/null +++ b/test/hotspot/jtreg/ProblemList-zgc.txt @@ -0,0 +1,30 @@ +# +# Copyright (c) 2019, 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. +# + +############################################################################# +# +# List of quarantined tests for testing with ZGC. +# +############################################################################# + +serviceability/sa/TestJmapCoreMetaspace.java 8219443 generic-all From db21ab11f714307c90fd538b815343ad63080981 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Fri, 22 Feb 2019 14:39:57 -0800 Subject: [PATCH 097/109] 8209807: improve handling exception in requires.VMProps Reviewed-by: vlivanov, mseledtsov --- test/jtreg-ext/requires/VMProps.java | 189 ++++++++++++++------------- 1 file changed, 97 insertions(+), 92 deletions(-) diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index c7e0ca9a812..2483d0f29ea 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -37,6 +37,7 @@ import java.util.Map; import java.util.Properties; import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -49,13 +50,31 @@ import jdk.test.lib.Platform; /** * The Class to be invoked by jtreg prior Test Suite execution to * collect information about VM. - * Do not use any API's that may not be available in all target VMs. + * Do not use any APIs that may not be available in all target VMs. * Properties set by this Class will be available in the @requires expressions. */ public class VMProps implements Callable> { + // value known to jtreg as an indicator of error state + private static final String ERROR_STATE = "__ERROR__"; private static final WhiteBox WB = WhiteBox.getWhiteBox(); + private static class SafeMap { + private final Map map = new HashMap<>(); + + public void put(String key, Supplier s) { + String value; + try { + value = s.get(); + } catch (Throwable t) { + System.err.println("failed to get value for " + key); + t.printStackTrace(System.err); + value = ERROR_STATE + t; + } + map.put(key, value); + } + } + /** * Collects information about VM properties. * This method will be invoked by jtreg. @@ -64,58 +83,58 @@ public class VMProps implements Callable> { */ @Override public Map call() { - Map map = new HashMap<>(); - map.put("vm.flavor", vmFlavor()); - map.put("vm.compMode", vmCompMode()); - map.put("vm.bits", vmBits()); - map.put("vm.flightRecorder", vmFlightRecorder()); - map.put("vm.simpleArch", vmArch()); - map.put("vm.debug", vmDebug()); - map.put("vm.jvmci", vmJvmci()); - map.put("vm.emulatedClient", vmEmulatedClient()); + SafeMap map = new SafeMap(); + map.put("vm.flavor", this::vmFlavor); + map.put("vm.compMode", this::vmCompMode); + map.put("vm.bits", this::vmBits); + map.put("vm.flightRecorder", this::vmFlightRecorder); + map.put("vm.simpleArch", this::vmArch); + map.put("vm.debug", this::vmDebug); + map.put("vm.jvmci", this::vmJvmci); + map.put("vm.emulatedClient", this::vmEmulatedClient); // vm.hasSA is "true" if the VM contains the serviceability agent // and jhsdb. - map.put("vm.hasSA", vmHasSA()); + map.put("vm.hasSA", this::vmHasSA); // vm.hasSAandCanAttach is "true" if the VM contains the serviceability agent // and jhsdb and it can attach to the VM. - map.put("vm.hasSAandCanAttach", vmHasSAandCanAttach()); + map.put("vm.hasSAandCanAttach", this::vmHasSAandCanAttach); // vm.hasJFR is "true" if JFR is included in the build of the VM and // so tests can be executed. - map.put("vm.hasJFR", vmHasJFR()); - map.put("vm.cpu.features", cpuFeatures()); - map.put("vm.rtm.cpu", vmRTMCPU()); - map.put("vm.rtm.compiler", vmRTMCompiler()); - map.put("vm.aot", vmAOT()); - map.put("vm.aot.enabled", vmAotEnabled()); + map.put("vm.hasJFR", this::vmHasJFR); + map.put("vm.cpu.features", this::cpuFeatures); + map.put("vm.rtm.cpu", this::vmRTMCPU); + map.put("vm.rtm.compiler", this::vmRTMCompiler); + map.put("vm.aot", this::vmAOT); + map.put("vm.aot.enabled", this::vmAotEnabled); // vm.cds is true if the VM is compiled with cds support. - map.put("vm.cds", vmCDS()); - map.put("vm.cds.custom.loaders", vmCDSForCustomLoaders()); - map.put("vm.cds.archived.java.heap", vmCDSForArchivedJavaHeap()); + map.put("vm.cds", this::vmCDS); + map.put("vm.cds.custom.loaders", this::vmCDSForCustomLoaders); + map.put("vm.cds.archived.java.heap", this::vmCDSForArchivedJavaHeap); // vm.graal.enabled is true if Graal is used as JIT - map.put("vm.graal.enabled", isGraalEnabled()); - map.put("vm.compiler1.enabled", isCompiler1Enabled()); - map.put("vm.compiler2.enabled", isCompiler2Enabled()); - map.put("docker.support", dockerSupport()); - map.put("release.implementor", implementor()); - map.put("test.vm.gc.nvdimm", isNvdimmTestEnabled()); + map.put("vm.graal.enabled", this::isGraalEnabled); + map.put("vm.compiler1.enabled", this::isCompiler1Enabled); + map.put("vm.compiler2.enabled", this::isCompiler2Enabled); + map.put("docker.support", this::dockerSupport); + map.put("release.implementor", this::implementor); + map.put("test.vm.gc.nvdimm", this::isNvdimmTestEnabled); vmGC(map); // vm.gc.X = true/false vmOptFinalFlags(map); - VMProps.dump(map); - return map; + dump(map.map); + return map.map; } /** - * Prints a stack trace before returning null. + * Print a stack trace before returning error state; * Used by the various helper functions which parse information from * VM properties in the case where they don't find an expected property - * or a propoerty doesn't conform to an expected format. + * or a property doesn't conform to an expected format. * - * @return null + * @return {@link #ERROR_STATE} */ - private String nullWithException(String message) { + private String errorWithMessage(String message) { new Exception(message).printStackTrace(); - return null; + return ERROR_STATE + message; } /** @@ -125,8 +144,7 @@ public class VMProps implements Callable> { String arch = System.getProperty("os.arch"); if (arch.equals("x86_64") || arch.equals("amd64")) { return "x64"; - } - else if (arch.contains("86")) { + } else if (arch.contains("86")) { return "x86"; } else { return arch; @@ -140,7 +158,7 @@ public class VMProps implements Callable> { // E.g. "Java HotSpot(TM) 64-Bit Server VM" String vmName = System.getProperty("java.vm.name"); if (vmName == null) { - return nullWithException("Can't get 'java.vm.name' property"); + return errorWithMessage("Can't get 'java.vm.name' property"); } Pattern startP = Pattern.compile(".* (\\S+) VM"); @@ -148,7 +166,7 @@ public class VMProps implements Callable> { if (m.matches()) { return m.group(1).toLowerCase(); } - return nullWithException("Can't get VM flavor from 'java.vm.name'"); + return errorWithMessage("Can't get VM flavor from 'java.vm.name'"); } /** @@ -158,16 +176,17 @@ public class VMProps implements Callable> { // E.g. "mixed mode" String vmInfo = System.getProperty("java.vm.info"); if (vmInfo == null) { - return nullWithException("Can't get 'java.vm.info' property"); + return errorWithMessage("Can't get 'java.vm.info' property"); } - if (vmInfo.toLowerCase().indexOf("mixed mode") != -1) { + vmInfo = vmInfo.toLowerCase(); + if (vmInfo.contains("mixed mode")) { return "Xmixed"; - } else if (vmInfo.toLowerCase().indexOf("compiled mode") != -1) { + } else if (vmInfo.contains("compiled mode")) { return "Xcomp"; - } else if (vmInfo.toLowerCase().indexOf("interpreted mode") != -1) { + } else if (vmInfo.contains("interpreted mode")) { return "Xint"; } else { - return nullWithException("Can't get compilation mode from 'java.vm.info'"); + return errorWithMessage("Can't get compilation mode from 'java.vm.info'"); } } @@ -179,7 +198,7 @@ public class VMProps implements Callable> { if (dataModel != null) { return dataModel; } else { - return nullWithException("Can't get 'sun.arch.data.model' property"); + return errorWithMessage("Can't get 'sun.arch.data.model' property"); } } @@ -206,7 +225,7 @@ public class VMProps implements Callable> { if (debug != null) { return "" + debug.contains("debug"); } else { - return nullWithException("Can't get 'jdk.debug' property"); + return errorWithMessage("Can't get 'jdk.debug' property"); } } @@ -224,7 +243,7 @@ public class VMProps implements Callable> { protected String vmEmulatedClient() { String vmInfo = System.getProperty("java.vm.info"); if (vmInfo == null) { - return "false"; + return errorWithMessage("Can't get 'java.vm.info' property"); } return "" + vmInfo.contains(" emulated-client"); } @@ -241,30 +260,34 @@ public class VMProps implements Callable> { * Example vm.gc.G1=true means: * VM supports G1 * User either set G1 explicitely (-XX:+UseG1GC) or did not set any GC + * * @param map - property-value pairs */ - protected void vmGC(Map map) { + protected void vmGC(SafeMap map) { for (GC gc: GC.values()) { - boolean isAcceptable = gc.isSupported() && (gc.isSelected() || GC.isSelectedErgonomically()); - map.put("vm.gc." + gc.name(), "" + isAcceptable); + map.put("vm.gc." + gc.name(), + () -> "" + (gc.isSupported() + && (gc.isSelected() || GC.isSelectedErgonomically()))); } } /** * Selected final flag. + * * @param map - property-value pairs * @param flagName - flag name */ - private void vmOptFinalFlag(Map map, String flagName) { - String value = String.valueOf(WB.getBooleanVMFlag(flagName)); - map.put("vm.opt.final." + flagName, value); + private void vmOptFinalFlag(SafeMap map, String flagName) { + map.put("vm.opt.final." + flagName, + () -> String.valueOf(WB.getBooleanVMFlag(flagName))); } /** * Selected sets of final flags. + * * @param map - property-value pairs */ - protected void vmOptFinalFlags(Map map) { + protected void vmOptFinalFlags(SafeMap map) { vmOptFinalFlag(map, "ClassUnloading"); vmOptFinalFlag(map, "UseCompressedOops"); vmOptFinalFlag(map, "EnableJVMCI"); @@ -286,10 +309,8 @@ public class VMProps implements Callable> { try { return "" + Platform.shouldSAAttach(); } catch (IOException e) { - System.out.println("Checking whether SA can attach to the VM failed."); e.printStackTrace(); - // Run the tests anyways. - return "true"; + return errorWithMessage("Checking whether SA can attach to the VM failed.:" + e); } } @@ -350,11 +371,7 @@ public class VMProps implements Callable> { * @return true if CDS is supported by the VM to be tested. */ protected String vmCDS() { - if (WB.isCDSIncludedInVmBuild()) { - return "true"; - } else { - return "false"; - } + return "" + WB.isCDSIncludedInVmBuild(); } /** @@ -363,11 +380,7 @@ public class VMProps implements Callable> { * @return true if CDS provides support for customer loader in the VM to be tested. */ protected String vmCDSForCustomLoaders() { - if (vmCDS().equals("true") && Platform.areCustomLoadersSupportedForCDS()) { - return "true"; - } else { - return "false"; - } + return "" + ("true".equals(vmCDS()) && Platform.areCustomLoadersSupportedForCDS()); } /** @@ -376,11 +389,7 @@ public class VMProps implements Callable> { * @return true if CDS provides support for archive Java heap regions in the VM to be tested. */ protected String vmCDSForArchivedJavaHeap() { - if (vmCDS().equals("true") && WB.isJavaHeapArchiveSupported()) { - return "true"; - } else { - return "false"; - } + return "" + ("true".equals(vmCDS()) && WB.isJavaHeapArchiveSupported()); } /** @@ -389,7 +398,7 @@ public class VMProps implements Callable> { * @return true if Graal is used as JIT compiler. */ protected String isGraalEnabled() { - return Compiler.isGraalEnabled() ? "true" : "false"; + return "" + Compiler.isGraalEnabled(); } /** @@ -398,7 +407,7 @@ public class VMProps implements Callable> { * @return true if Compiler1 is used as JIT compiler, either alone or as part of the tiered system. */ protected String isCompiler1Enabled() { - return Compiler.isC1Enabled() ? "true" : "false"; + return "" + Compiler.isC1Enabled(); } /** @@ -407,7 +416,7 @@ public class VMProps implements Callable> { * @return true if Compiler2 is used as JIT compiler, either alone or as part of the tiered system. */ protected String isCompiler2Enabled() { - return Compiler.isC2Enabled() ? "true" : "false"; + return "" + Compiler.isC2Enabled(); } /** @@ -425,14 +434,11 @@ public class VMProps implements Callable> { if (Platform.isX64()) { isSupported = true; - } - else if (Platform.isAArch64()) { + } else if (Platform.isAArch64()) { isSupported = true; - } - else if (Platform.isS390x()) { + } else if (Platform.isS390x()) { isSupported = true; - } - else if (arch.equals("ppc64le")) { + } else if (arch.equals("ppc64le")) { isSupported = true; } } @@ -445,7 +451,7 @@ public class VMProps implements Callable> { } } - return (isSupported) ? "true" : "false"; + return "" + isSupported; } private boolean checkDockerSupport() throws IOException, InterruptedException { @@ -456,30 +462,27 @@ public class VMProps implements Callable> { return (p.exitValue() == 0); } - private String implementor() { try (InputStream in = new BufferedInputStream(new FileInputStream( System.getProperty("java.home") + "/release"))) { Properties properties = new Properties(); properties.load(in); String implementorProperty = properties.getProperty("IMPLEMENTOR"); - return (implementorProperty == null) ? "null" : implementorProperty.replace("\"", ""); + if (implementorProperty != null) { + return implementorProperty.replace("\"", ""); + } + return errorWithMessage("Can't get 'IMPLEMENTOR' property from 'release' file"); } catch (IOException e) { e.printStackTrace(); + return errorWithMessage("Failed to read 'release' file " + e); } - return null; } private String isNvdimmTestEnabled() { - String isEnbled = System.getenv("TEST_VM_GC_NVDIMM"); - if (isEnbled != null && isEnbled.toLowerCase().equals("true")) { - return "true"; - } - return "false"; + String isEnabled = System.getenv("TEST_VM_GC_NVDIMM"); + return "" + "true".equalsIgnoreCase(isEnabled); } - - /** * Dumps the map to the file if the file name is given as the property. * This functionality could be helpful to know context in the real @@ -495,7 +498,8 @@ public class VMProps implements Callable> { List lines = new ArrayList<>(); map.forEach((k, v) -> lines.add(k + ":" + v)); try { - Files.write(Paths.get(dumpFileName), lines, StandardOpenOption.APPEND); + Files.write(Paths.get(dumpFileName), lines, + StandardOpenOption.APPEND, StandardOpenOption.CREATE); } catch (IOException e) { throw new RuntimeException("Failed to dump properties into '" + dumpFileName + "'", e); @@ -504,6 +508,7 @@ public class VMProps implements Callable> { /** * This method is for the testing purpose only. + * * @param args */ public static void main(String args[]) { From 1f65a934c0b5f4fe33ea2db7023e395013f0b49a Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Fri, 22 Feb 2019 18:54:23 -0800 Subject: [PATCH 098/109] 8219611: Remove superfluous sigfillset code Reviewed-by: dholmes --- src/hotspot/os/posix/os_posix.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/hotspot/os/posix/os_posix.cpp b/src/hotspot/os/posix/os_posix.cpp index 3bc6444bcb3..12153618ad3 100644 --- a/src/hotspot/os/posix/os_posix.cpp +++ b/src/hotspot/os/posix/os_posix.cpp @@ -191,10 +191,6 @@ int os::create_file_for_heap(const char* dir) { os::native_path(fullname); - sigset_t set, oldset; - int ret = sigfillset(&set); - assert_with_errno(ret == 0, "sigfillset returned error"); - // set the file creation mask. mode_t file_mode = S_IRUSR | S_IWUSR; @@ -208,7 +204,7 @@ int os::create_file_for_heap(const char* dir) { } // delete the name from the filesystem. When 'fd' is closed, the file (and space) will be deleted. - ret = unlink(fullname); + int ret = unlink(fullname); assert_with_errno(ret == 0, "unlink returned error"); os::free(fullname); From 3d6795e0e3a0fa11ee008455f808cb817e1abe00 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Sat, 23 Feb 2019 10:55:45 +0100 Subject: [PATCH 099/109] 8219583: Windows build failure after JDK-8214777 (Avoid some GCC 8.X strncpy() errors in HotSpot) Reviewed-by: kbarrett, mikael --- src/hotspot/share/classfile/classFileParser.cpp | 5 +++-- src/hotspot/share/classfile/classLoaderExt.cpp | 2 +- src/hotspot/share/classfile/verifier.cpp | 4 ++-- src/hotspot/share/services/diagnosticArgument.cpp | 2 +- src/hotspot/share/utilities/xmlstream.cpp | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp index b2b776f724a..83a0fcb4573 100644 --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -60,6 +60,7 @@ #include "runtime/arguments.hpp" #include "runtime/handles.inline.hpp" #include "runtime/javaCalls.hpp" +#include "runtime/os.hpp" #include "runtime/perfData.hpp" #include "runtime/reflection.hpp" #include "runtime/safepointVerifiers.hpp" @@ -5747,8 +5748,8 @@ void ClassFileParser::prepend_host_package_name(const InstanceKlass* unsafe_anon int class_name_len = _class_name->utf8_length(); int symbol_len = host_pkg_len + 1 + class_name_len; char* new_anon_name = NEW_RESOURCE_ARRAY(char, symbol_len + 1); - int n = snprintf(new_anon_name, symbol_len + 1, "%s/%.*s", - host_pkg_name, class_name_len, _class_name->base()); + int n = os::snprintf(new_anon_name, symbol_len + 1, "%s/%.*s", + host_pkg_name, class_name_len, _class_name->base()); assert(n == symbol_len, "Unexpected number of characters in string"); // Decrement old _class_name to avoid leaking. diff --git a/src/hotspot/share/classfile/classLoaderExt.cpp b/src/hotspot/share/classfile/classLoaderExt.cpp index a1a5cc562a1..84d4ec90e8e 100644 --- a/src/hotspot/share/classfile/classLoaderExt.cpp +++ b/src/hotspot/share/classfile/classLoaderExt.cpp @@ -208,7 +208,7 @@ void ClassLoaderExt::process_jar_manifest(ClassPathEntry* entry, ResourceMark rm(THREAD); size_t libname_len = dir_len + name_len; char* libname = NEW_RESOURCE_ARRAY(char, libname_len + 1); - int n = snprintf(libname, libname_len + 1, "%.*s%s", dir_len, dir_name, file_start); + int n = os::snprintf(libname, libname_len + 1, "%.*s%s", dir_len, dir_name, file_start); assert((size_t)n == libname_len, "Unexpected number of characters in string"); trace_class_path("library = ", libname); ClassLoader::update_class_path_entry_list(libname, true, false); diff --git a/src/hotspot/share/classfile/verifier.cpp b/src/hotspot/share/classfile/verifier.cpp index 8e301f9f20b..b617d1899f5 100644 --- a/src/hotspot/share/classfile/verifier.cpp +++ b/src/hotspot/share/classfile/verifier.cpp @@ -2982,14 +2982,14 @@ void ClassVerifier::verify_anewarray( // add one dimension to component length++; arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length + 1); - int n = snprintf(arr_sig_str, length + 1, "[%s", component_name); + int n = os::snprintf(arr_sig_str, length + 1, "[%s", component_name); assert(n == length, "Unexpected number of characters in string"); } else { // it's an object or interface const char* component_name = component_type.name()->as_utf8(); // add one dimension to component with 'L' prepended and ';' postpended. length = (int)strlen(component_name) + 3; arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length + 1); - int n = snprintf(arr_sig_str, length + 1, "[L%s;", component_name); + int n = os::snprintf(arr_sig_str, length + 1, "[L%s;", component_name); assert(n == length, "Unexpected number of characters in string"); } Symbol* arr_sig = create_temporary_symbol( diff --git a/src/hotspot/share/services/diagnosticArgument.cpp b/src/hotspot/share/services/diagnosticArgument.cpp index 9dfe4786bac..71719f0b6e8 100644 --- a/src/hotspot/share/services/diagnosticArgument.cpp +++ b/src/hotspot/share/services/diagnosticArgument.cpp @@ -180,7 +180,7 @@ template <> void DCmdArgument::parse_value(const char* str, _value = NULL; } else { _value = NEW_C_HEAP_ARRAY(char, len + 1, mtInternal); - int n = snprintf(_value, len + 1, "%.*s", (int)len, str); + int n = os::snprintf(_value, len + 1, "%.*s", (int)len, str); assert((size_t)n <= len, "Unexpected number of characters in string"); } } diff --git a/src/hotspot/share/utilities/xmlstream.cpp b/src/hotspot/share/utilities/xmlstream.cpp index a7922fd478e..c13b62442d8 100644 --- a/src/hotspot/share/utilities/xmlstream.cpp +++ b/src/hotspot/share/utilities/xmlstream.cpp @@ -356,11 +356,11 @@ void xmlStream::va_done(const char* format, va_list ap) { size_t kind_len; if (kind_end != NULL) { kind_len = kind_end - kind; - int n = snprintf(buffer, sizeof(buffer), "%.*s_done", (int)kind_len, kind); + int n = os::snprintf(buffer, sizeof(buffer), "%.*s_done", (int)kind_len, kind); assert((size_t)n < sizeof(buffer), "Unexpected number of characters in string"); } else { kind_len = format_len; - int n = snprintf(buffer, sizeof(buffer), "%s_done%s", kind, kind + kind_len); + int n = os::snprintf(buffer, sizeof(buffer), "%s_done%s", kind, kind + kind_len); assert((size_t)n < sizeof(buffer), "Unexpected number of characters in string"); } // Output the trailing event with the timestamp. From 4d368850e1c1f62776d97d462a34505fa3070982 Mon Sep 17 00:00:00 2001 From: Vicente Romero Date: Sat, 23 Feb 2019 19:41:53 -0500 Subject: [PATCH 100/109] 8219480: j.l.c.ClassDesc::arrayType(int rank) throws IllegalArgumentException if rank = 0 Reviewed-by: mchung, briangoetz --- .../share/classes/java/lang/constant/ClassDesc.java | 2 +- test/jdk/java/lang/constant/ClassDescTest.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/java.base/share/classes/java/lang/constant/ClassDesc.java b/src/java.base/share/classes/java/lang/constant/ClassDesc.java index 67e9d943a88..d6850d5abcf 100644 --- a/src/java.base/share/classes/java/lang/constant/ClassDesc.java +++ b/src/java.base/share/classes/java/lang/constant/ClassDesc.java @@ -170,7 +170,7 @@ public interface ClassDesc * * @param rank the rank of the array * @return a {@linkplain ClassDesc} describing the array type - * @throws IllegalArgumentException if the rank is less than zero or if the rank of the resulting array type is + * @throws IllegalArgumentException if the rank is less than or equal to zero or if the rank of the resulting array type is * greater than 255 * @jvms 4.4.1 The CONSTANT_Class_info Structure */ diff --git a/test/jdk/java/lang/constant/ClassDescTest.java b/test/jdk/java/lang/constant/ClassDescTest.java index 3f4ca553ec5..f4fab6760cd 100644 --- a/test/jdk/java/lang/constant/ClassDescTest.java +++ b/test/jdk/java/lang/constant/ClassDescTest.java @@ -176,6 +176,12 @@ public class ClassDescTest extends SymbolicDescTest { } catch (IllegalArgumentException e) { // good } + try { + cr.arrayType(0); + fail(""); + } catch (IllegalArgumentException e) { + // good + } } public void testArrayClassDesc() throws ReflectiveOperationException { From 1d5674ab339f0b2bcba6a246ed79aa0001d7eecc Mon Sep 17 00:00:00 2001 From: David Holmes Date: Sun, 24 Feb 2019 16:10:52 -0500 Subject: [PATCH 101/109] 8208278: [mlvm] [TESTBUG] vm.mlvm.mixed.stress.java.findDeadlock.INDIFY_Test Deadlocked threads are not always detected Reviewed-by: iignatyev --- test/hotspot/jtreg/ProblemList.txt | 1 - .../stress/java/findDeadlock/INDIFY_Test.java | 130 +++++++++++------- .../stress/java/findDeadlock/INDIFY_Test.jmpp | 130 +++++++++++------- 3 files changed, 166 insertions(+), 95 deletions(-) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 2056fb7206b..7b8083a46ca 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -189,7 +189,6 @@ vmTestbase/vm/mlvm/meth/stress/compiler/sequences/Test.java 8058176 generic-all vmTestbase/vm/mlvm/meth/stress/gc/callSequencesDuringGC/Test.java 8058176 generic-all vmTestbase/vm/mlvm/meth/stress/java/sequences/Test.java 8058176 generic-all vmTestbase/vm/mlvm/meth/stress/jdi/breakpointInCompiledCode/Test.java 8058176 generic-all -vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/TestDescription.java 8208278 macosx-all vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2none_a/TestDescription.java 8013267 generic-all vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_b/TestDescription.java 8013267 generic-all vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b/TestDescription.java 8013267 generic-all diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/INDIFY_Test.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/INDIFY_Test.java index 4fe99716141..a9980c2b0af 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/INDIFY_Test.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/INDIFY_Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2019, 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 @@ -33,6 +33,7 @@ import java.lang.invoke.MutableCallSite; import java.lang.management.ManagementFactory; import java.lang.management.ThreadMXBean; import java.lang.reflect.Method; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.CyclicBarrier; import java.util.concurrent.locks.ReentrantLock; @@ -53,6 +54,7 @@ public class INDIFY_Test extends MlvmTest { static MutableCallSite[] _cs = new MutableCallSite[THREAD_NUM]; static CyclicBarrier _threadRaceStartBarrier; + static CountDownLatch _threadsRunningLatch; static volatile boolean _testFailed; static volatile boolean _testDone; static volatile int _iteration; @@ -63,22 +65,22 @@ public class INDIFY_Test extends MlvmTest { boolean locked = false; place = Thread.currentThread().getName() + ": " + place; if ( ! lockInterruptible ) { - Env.traceVerbose(place + ": Locking " + n); + Env.traceVerbose("Iteration " + _iteration + " " + place + ": Locking " + n); _locks[n].lock(); locked = true; } else { try { - Env.traceVerbose(place + ": Locking interruptibly " + n); + Env.traceVerbose("Iteration " + _iteration + " " + place + ": Locking interruptibly " + n); _locks[n].lockInterruptibly(); locked = true; if ( ! _testDone ) throw new Exception(place + ": LOCKED " + n); else - Env.traceVerbose(place + ": LOCKED " + n); + Env.traceVerbose("Iteration " + _iteration + " " + place + ": LOCKED " + n); } catch ( InterruptedException swallow ) { - Env.traceVerbose(place + ": interrupted while locking " + n); + Env.traceVerbose("Iteration " + _iteration + " " + place + ": interrupted while locking " + n); } } @@ -87,9 +89,9 @@ public class INDIFY_Test extends MlvmTest { private static boolean unlock(String place, int n) throws Throwable { place = Thread.currentThread().getName() + ": " + place; - Env.traceVerbose(place + ": Unlocking " + n); + Env.traceVerbose("Iteration " + _iteration + " " + place + ": Unlocking " + n); _locks[n].unlock(); - Env.traceVerbose(place + ": UNLOCKED " + n); + Env.traceVerbose("Iteration " + _iteration + " " + place + ": UNLOCKED " + n); return false; } @@ -98,7 +100,7 @@ public class INDIFY_Test extends MlvmTest { if ( l instanceof MethodHandles.Lookup ) { // Method is used as BSM - Env.traceVerbose(thread.getName() + ": Entered BSM. Lock=" + lockNum); + Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entered BSM. Lock=" + lockNum); if ( _iteration > 0 ) throw new Exception("BSM called twice!"); @@ -107,6 +109,7 @@ public class INDIFY_Test extends MlvmTest { case 0: thread._lockedCurrent = lock("BSM", lockNum, false); _threadRaceStartBarrier.await(); + _threadsRunningLatch.countDown(); thread._lockedNext = lock("BSM", nextLock(lockNum), true); break; @@ -123,7 +126,7 @@ public class INDIFY_Test extends MlvmTest { } else { // Method is used as target - Env.traceVerbose(thread.getName() + ": Entered target method. Lock=" + lockNum); + Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entered target method. Lock=" + lockNum); try { if ( _iteration > 0 ) { @@ -132,26 +135,29 @@ public class INDIFY_Test extends MlvmTest { case 0: thread._lockedCurrent = lock("Target", lockNum, false); _threadRaceStartBarrier.await(); + _threadsRunningLatch.countDown(); thread._lockedNext = lock("Target", nextLock(lockNum), true); break; case 1: thread._lockedCurrent = lock("Target", lockNum, false); _threadRaceStartBarrier.await(); - Env.traceVerbose(thread.getName() + ": Entering synchronize ( " + lockNum + " )"); + _threadsRunningLatch.countDown(); + Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entering synchronize ( " + lockNum + " )"); synchronized ( _locks[nextLock(lockNum)] ) { } - Env.traceVerbose(thread.getName() + ": Exited synchronize ( " + lockNum + " )"); + Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Exited synchronize ( " + lockNum + " )"); break; case 2: - Env.traceVerbose(thread.getName() + ": Entering synchronize ( " + lockNum + " )"); + Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entering synchronize ( " + lockNum + " )"); synchronized ( _locks[lockNum] ) { _threadRaceStartBarrier.await(); + _threadsRunningLatch.countDown(); thread._lockedNext = lock("Target", nextLock(lockNum), true); thread._lockedNext = unlock("Target", nextLock(lockNum)); } - Env.traceVerbose(thread.getName() + ": Exited synchronize ( " + lockNum + " )"); + Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Exited synchronize ( " + lockNum + " )"); break; } @@ -163,12 +169,14 @@ public class INDIFY_Test extends MlvmTest { case 1: _threadRaceStartBarrier.await(); + _threadsRunningLatch.countDown(); thread._lockedNext = lock("Target", nextLock(lockNum), true); break; case 2: thread._lockedCurrent = lock("Target", lockNum, false); _threadRaceStartBarrier.await(); + _threadsRunningLatch.countDown(); thread._lockedNext = lock("Target", nextLock(lockNum), true); break; } @@ -18205,8 +18213,9 @@ public class INDIFY_Test extends MlvmTest { } boolean test() throws Throwable { - Env.traceNormal("Starting test..."); + Env.traceNormal("Iteration " + _iteration + " Starting test..."); + // Sanity check that all the locks are available. for ( int i = 0; i < THREAD_NUM; i++ ) { if ( _locks[i].isLocked() ) { Env.getLog().complain("Lock " + i + " is still locked!"); @@ -18217,60 +18226,87 @@ public class INDIFY_Test extends MlvmTest { if ( _testFailed ) throw new Exception("Some locks are still locked"); + // Threads generally wait on this after claiming their first lock, + // and then when released will try to claim the second, which leads + // to deadlock. _threadRaceStartBarrier = new CyclicBarrier(THREAD_NUM + 1); + + // Threads signal this latch after being released from the startbarrier + // so that they are closer to triggering deadlock before the main thread + // starts to check for it. + _threadsRunningLatch = new CountDownLatch(THREAD_NUM); + _testDone = false; _testFailed = false; - for ( int i = 0; i < THREAD_NUM; i++ ) + // Start the new batch of threads. + for ( int i = 0; i < THREAD_NUM; i++ ) { (_threads[i] = new DeadlockedThread(i)).start(); + } try { - _threadRaceStartBarrier.await(); - Env.traceVerbose("Start race..."); - - // - // Wait for the deadlock and detect it using ThreadMXBean - // - - boolean resultsReady = false; - for ( int i = 0; i < 10 && ! resultsReady && ! _testFailed; i++ ) { - Env.traceNormal("Waiting for threads to lock up..."); - Thread.sleep(100); - - resultsReady = true; - for ( int t = 0; t < THREAD_NUM; t++ ) { - if ( _iteration == 0 && t % 3 != 2 && ! _locks[t].hasQueuedThreads() ) { - Env.traceVerbose("Lock " + t + ": no waiters"); - resultsReady = false; - } else { - Env.traceVerbose("Lock " + t + ": has waiters"); - } - } + // If a thread encounters an error before it reaches the start barrier + // then we will hang here until the test times out. So we do a token + // check for such failure. + if (_testFailed) { + Env.complain("Unexpected thread failure before startBarrier was reached"); + return false; } - if ( ! resultsReady ) - Env.traceImportant("Warning: threads are still not deadlocked?"); + _threadRaceStartBarrier.await(); + Env.traceVerbose("Iteration " + _iteration + " Start race..."); - long[] deadlockedThreads = _threadMXBean.findDeadlockedThreads(); - if ( deadlockedThreads == null ) { - Env.complain("Found no deadlocked threads. Expected to find " + THREAD_NUM); + // Wait till all threads poised to deadlock. Again we may hang here + // if unexpected errors are encountered, so again a token check. + if (_testFailed) { + Env.complain("Unexpected thread failure after startBarrier was reached"); return false; - } else if ( deadlockedThreads.length != THREAD_NUM ) { + } + + _threadsRunningLatch.await(); + + // There is a race now between checking for a deadlock and the threads + // actually engaging in that deadlock. We can't query all of the "locks" + // involved to see if they are owned and have waiters (no API for built-in + // monitors). Nor can we check the thread states because they could be blocked + // on incidental synchronization (like I/O monitors when logging is enabled). + // So we simply loop checking for a deadlock until we find it, or else the + // overall test times out. + + long[] deadlockedThreads = null; + do { + deadlockedThreads = _threadMXBean.findDeadlockedThreads(); + } while (deadlockedThreads == null && !_testFailed); + + if (_testFailed) { + Env.complain("Unexpected thread failure while checking for deadlock"); + return false; + } + + if (deadlockedThreads.length != THREAD_NUM) { Env.complain("Found " + deadlockedThreads.length + " deadlocked threads. Expected to find " + THREAD_NUM); return false; } else { Env.traceNormal("Found " + deadlockedThreads.length + " deadlocked threads as expected"); - return ! _testFailed; + return true; } } finally { + // Tells the locking threads the interrupt was expected. _testDone = true; + // Break the deadlock by dropping the attempt to lock + // the interruptible locks, which then causes all other + // locks to be released and allow threads acquiring + // non-interruptible locks to proceed. _threads[0].interrupt(); - for ( int i = 0; i < THREAD_NUM; i++ ) { - _threads[i].join(1000); - if ( _threads[i].isAlive() ) - Env.getLog().complain("Thread " + _threads[i].getName() + " is still alive"); + // Wait for all threads to terminate before proceeding to next + // iteration. If we only join() for a limited time and its too short + // then we not only complain here, but will also find locks that are + // still locked. It is far simpler to only proceed when all threads + // are done and rely on the overall test timeout to detect problems. + for (int i = 0; i < THREAD_NUM; i++) { + _threads[i].join(); } MutableCallSite.syncAll(_cs); diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/INDIFY_Test.jmpp b/test/hotspot/jtreg/vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/INDIFY_Test.jmpp index 835ea7eee1d..44d08d7e165 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/INDIFY_Test.jmpp +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/INDIFY_Test.jmpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2019, 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 @@ import java.lang.invoke.MutableCallSite; import java.lang.management.ManagementFactory; import java.lang.management.ThreadMXBean; import java.lang.reflect.Method; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.CyclicBarrier; import java.util.concurrent.locks.ReentrantLock; @@ -55,6 +56,7 @@ public class INDIFY_Test extends MlvmTest { static MutableCallSite[] _cs = new MutableCallSite[THREAD_NUM]; static CyclicBarrier _threadRaceStartBarrier; + static CountDownLatch _threadsRunningLatch; static volatile boolean _testFailed; static volatile boolean _testDone; static volatile int _iteration; @@ -65,22 +67,22 @@ public class INDIFY_Test extends MlvmTest { boolean locked = false; place = Thread.currentThread().getName() + ": " + place; if ( ! lockInterruptible ) { - Env.traceVerbose(place + ": Locking " + n); + Env.traceVerbose("Iteration " + _iteration + " " + place + ": Locking " + n); _locks[n].lock(); locked = true; } else { try { - Env.traceVerbose(place + ": Locking interruptibly " + n); + Env.traceVerbose("Iteration " + _iteration + " " + place + ": Locking interruptibly " + n); _locks[n].lockInterruptibly(); locked = true; if ( ! _testDone ) throw new Exception(place + ": LOCKED " + n); else - Env.traceVerbose(place + ": LOCKED " + n); + Env.traceVerbose("Iteration " + _iteration + " " + place + ": LOCKED " + n); } catch ( InterruptedException swallow ) { - Env.traceVerbose(place + ": interrupted while locking " + n); + Env.traceVerbose("Iteration " + _iteration + " " + place + ": interrupted while locking " + n); } } @@ -89,9 +91,9 @@ public class INDIFY_Test extends MlvmTest { private static boolean unlock(String place, int n) throws Throwable { place = Thread.currentThread().getName() + ": " + place; - Env.traceVerbose(place + ": Unlocking " + n); + Env.traceVerbose("Iteration " + _iteration + " " + place + ": Unlocking " + n); _locks[n].unlock(); - Env.traceVerbose(place + ": UNLOCKED " + n); + Env.traceVerbose("Iteration " + _iteration + " " + place + ": UNLOCKED " + n); return false; } @@ -100,7 +102,7 @@ public class INDIFY_Test extends MlvmTest { if ( l instanceof MethodHandles.Lookup ) { // Method is used as BSM - Env.traceVerbose(thread.getName() + ": Entered BSM. Lock=" + lockNum); + Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entered BSM. Lock=" + lockNum); if ( _iteration > 0 ) throw new Exception("BSM called twice!"); @@ -109,6 +111,7 @@ public class INDIFY_Test extends MlvmTest { case 0: thread._lockedCurrent = lock("BSM", lockNum, false); _threadRaceStartBarrier.await(); + _threadsRunningLatch.countDown(); thread._lockedNext = lock("BSM", nextLock(lockNum), true); break; @@ -125,7 +128,7 @@ public class INDIFY_Test extends MlvmTest { } else { // Method is used as target - Env.traceVerbose(thread.getName() + ": Entered target method. Lock=" + lockNum); + Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entered target method. Lock=" + lockNum); try { if ( _iteration > 0 ) { @@ -134,26 +137,29 @@ public class INDIFY_Test extends MlvmTest { case 0: thread._lockedCurrent = lock("Target", lockNum, false); _threadRaceStartBarrier.await(); + _threadsRunningLatch.countDown(); thread._lockedNext = lock("Target", nextLock(lockNum), true); break; case 1: thread._lockedCurrent = lock("Target", lockNum, false); _threadRaceStartBarrier.await(); - Env.traceVerbose(thread.getName() + ": Entering synchronize ( " + lockNum + " )"); + _threadsRunningLatch.countDown(); + Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entering synchronize ( " + lockNum + " )"); synchronized ( _locks[nextLock(lockNum)] ) { } - Env.traceVerbose(thread.getName() + ": Exited synchronize ( " + lockNum + " )"); + Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Exited synchronize ( " + lockNum + " )"); break; case 2: - Env.traceVerbose(thread.getName() + ": Entering synchronize ( " + lockNum + " )"); + Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Entering synchronize ( " + lockNum + " )"); synchronized ( _locks[lockNum] ) { _threadRaceStartBarrier.await(); + _threadsRunningLatch.countDown(); thread._lockedNext = lock("Target", nextLock(lockNum), true); thread._lockedNext = unlock("Target", nextLock(lockNum)); } - Env.traceVerbose(thread.getName() + ": Exited synchronize ( " + lockNum + " )"); + Env.traceVerbose("Iteration " + _iteration + " " + thread.getName() + ": Exited synchronize ( " + lockNum + " )"); break; } @@ -165,12 +171,14 @@ public class INDIFY_Test extends MlvmTest { case 1: _threadRaceStartBarrier.await(); + _threadsRunningLatch.countDown(); thread._lockedNext = lock("Target", nextLock(lockNum), true); break; case 2: thread._lockedCurrent = lock("Target", lockNum, false); _threadRaceStartBarrier.await(); + _threadsRunningLatch.countDown(); thread._lockedNext = lock("Target", nextLock(lockNum), true); break; } @@ -255,8 +263,9 @@ public class INDIFY_Test extends MlvmTest { } boolean test() throws Throwable { - Env.traceNormal("Starting test..."); + Env.traceNormal("Iteration " + _iteration + " Starting test..."); + // Sanity check that all the locks are available. for ( int i = 0; i < THREAD_NUM; i++ ) { if ( _locks[i].isLocked() ) { Env.getLog().complain("Lock " + i + " is still locked!"); @@ -267,60 +276,87 @@ public class INDIFY_Test extends MlvmTest { if ( _testFailed ) throw new Exception("Some locks are still locked"); + // Threads generally wait on this after claiming their first lock, + // and then when released will try to claim the second, which leads + // to deadlock. _threadRaceStartBarrier = new CyclicBarrier(THREAD_NUM + 1); + + // Threads signal this latch after being released from the startbarrier + // so that they are closer to triggering deadlock before the main thread + // starts to check for it. + _threadsRunningLatch = new CountDownLatch(THREAD_NUM); + _testDone = false; _testFailed = false; - for ( int i = 0; i < THREAD_NUM; i++ ) + // Start the new batch of threads. + for ( int i = 0; i < THREAD_NUM; i++ ) { (_threads[i] = new DeadlockedThread(i)).start(); + } try { - _threadRaceStartBarrier.await(); - Env.traceVerbose("Start race..."); - - // - // Wait for the deadlock and detect it using ThreadMXBean - // - - boolean resultsReady = false; - for ( int i = 0; i < 10 && ! resultsReady && ! _testFailed; i++ ) { - Env.traceNormal("Waiting for threads to lock up..."); - Thread.sleep(100); - - resultsReady = true; - for ( int t = 0; t < THREAD_NUM; t++ ) { - if ( _iteration == 0 && t % 3 != 2 && ! _locks[t].hasQueuedThreads() ) { - Env.traceVerbose("Lock " + t + ": no waiters"); - resultsReady = false; - } else { - Env.traceVerbose("Lock " + t + ": has waiters"); - } - } + // If a thread encounters an error before it reaches the start barrier + // then we will hang here until the test times out. So we do a token + // check for such failure. + if (_testFailed) { + Env.complain("Unexpected thread failure before startBarrier was reached"); + return false; } - if ( ! resultsReady ) - Env.traceImportant("Warning: threads are still not deadlocked?"); + _threadRaceStartBarrier.await(); + Env.traceVerbose("Iteration " + _iteration + " Start race..."); - long[] deadlockedThreads = _threadMXBean.findDeadlockedThreads(); - if ( deadlockedThreads == null ) { - Env.complain("Found no deadlocked threads. Expected to find " + THREAD_NUM); + // Wait till all threads poised to deadlock. Again we may hang here + // if unexpected errors are encountered, so again a token check. + if (_testFailed) { + Env.complain("Unexpected thread failure after startBarrier was reached"); return false; - } else if ( deadlockedThreads.length != THREAD_NUM ) { + } + + _threadsRunningLatch.await(); + + // There is a race now between checking for a deadlock and the threads + // actually engaging in that deadlock. We can't query all of the "locks" + // involved to see if they are owned and have waiters (no API for built-in + // monitors). Nor can we check the thread states because they could be blocked + // on incidental synchronization (like I/O monitors when logging is enabled). + // So we simply loop checking for a deadlock until we find it, or else the + // overall test times out. + + long[] deadlockedThreads = null; + do { + deadlockedThreads = _threadMXBean.findDeadlockedThreads(); + } while (deadlockedThreads == null && !_testFailed); + + if (_testFailed) { + Env.complain("Unexpected thread failure while checking for deadlock"); + return false; + } + + if (deadlockedThreads.length != THREAD_NUM) { Env.complain("Found " + deadlockedThreads.length + " deadlocked threads. Expected to find " + THREAD_NUM); return false; } else { Env.traceNormal("Found " + deadlockedThreads.length + " deadlocked threads as expected"); - return ! _testFailed; + return true; } } finally { + // Tells the locking threads the interrupt was expected. _testDone = true; + // Break the deadlock by dropping the attempt to lock + // the interruptible locks, which then causes all other + // locks to be released and allow threads acquiring + // non-interruptible locks to proceed. _threads[0].interrupt(); - for ( int i = 0; i < THREAD_NUM; i++ ) { - _threads[i].join(1000); - if ( _threads[i].isAlive() ) - Env.getLog().complain("Thread " + _threads[i].getName() + " is still alive"); + // Wait for all threads to terminate before proceeding to next + // iteration. If we only join() for a limited time and its too short + // then we not only complain here, but will also find locks that are + // still locked. It is far simpler to only proceed when all threads + // are done and rely on the overall test timeout to detect problems. + for (int i = 0; i < THREAD_NUM; i++) { + _threads[i].join(); } MutableCallSite.syncAll(_cs); From 4de51069e4b1a031a91c4c8cc8dfd74f595dc648 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Mon, 18 Feb 2019 16:17:48 +0100 Subject: [PATCH 102/109] 8218811: replace open by os::open in hotspot coding Reviewed-by: dholmes, iklam, stuefe --- src/hotspot/os/linux/os_perf_linux.cpp | 2 +- src/hotspot/os/linux/perfMemory_linux.cpp | 10 +++++----- src/hotspot/os/solaris/os_perf_solaris.cpp | 2 +- .../os_cpu/linux_x86/gc/z/zBackingFile_linux_x86.cpp | 6 +++--- src/hotspot/share/ci/ciEnv.cpp | 4 ++-- src/hotspot/share/classfile/compactHashtable.cpp | 4 ++-- src/hotspot/share/memory/filemap.cpp | 4 ++-- src/hotspot/share/utilities/ostream.cpp | 7 +------ 8 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/hotspot/os/linux/os_perf_linux.cpp b/src/hotspot/os/linux/os_perf_linux.cpp index 5008fb274c4..9572921f994 100644 --- a/src/hotspot/os/linux/os_perf_linux.cpp +++ b/src/hotspot/os/linux/os_perf_linux.cpp @@ -1062,7 +1062,7 @@ int64_t NetworkPerformanceInterface::NetworkPerformance::read_counter(const char snprintf(buf, sizeof(buf), "/sys/class/net/%s/statistics/%s", iface, counter); - int fd = open(buf, O_RDONLY); + int fd = os::open(buf, O_RDONLY, 0); if (fd == -1) { return -1; } diff --git a/src/hotspot/os/linux/perfMemory_linux.cpp b/src/hotspot/os/linux/perfMemory_linux.cpp index 4a562dcc9ff..b99b186859b 100644 --- a/src/hotspot/os/linux/perfMemory_linux.cpp +++ b/src/hotspot/os/linux/perfMemory_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -97,8 +97,8 @@ static void save_memory_to_file(char* addr, size_t size) { int result; - RESTARTABLE(::open(destfile, O_CREAT|O_WRONLY|O_TRUNC, S_IREAD|S_IWRITE), - result);; + RESTARTABLE(os::open(destfile, O_CREAT|O_WRONLY|O_TRUNC, S_IRUSR|S_IWUSR), + result); if (result == OS_ERR) { if (PrintMiscellaneous && Verbose) { warning("Could not create Perfdata save file: %s: %s\n", @@ -871,7 +871,7 @@ static int create_sharedmem_resources(const char* dirname, const char* filename, // Cannot use O_TRUNC here; truncation of an existing file has to happen // after the is_file_secure() check below. int result; - RESTARTABLE(::open(filename, O_RDWR|O_CREAT|O_NOFOLLOW, S_IREAD|S_IWRITE), result); + RESTARTABLE(os::open(filename, O_RDWR|O_CREAT|O_NOFOLLOW, S_IRUSR|S_IWUSR), result); if (result == OS_ERR) { if (PrintMiscellaneous && Verbose) { if (errno == ELOOP) { @@ -949,7 +949,7 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) { // open the file int result; - RESTARTABLE(::open(filename, oflags), result); + RESTARTABLE(os::open(filename, oflags, 0), result); if (result == OS_ERR) { if (errno == ENOENT) { THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), diff --git a/src/hotspot/os/solaris/os_perf_solaris.cpp b/src/hotspot/os/solaris/os_perf_solaris.cpp index c67a9494fb1..772fd8b755e 100644 --- a/src/hotspot/os/solaris/os_perf_solaris.cpp +++ b/src/hotspot/os/solaris/os_perf_solaris.cpp @@ -74,7 +74,7 @@ static int get_info(const char* path, void* info, size_t s, off_t o) { int fd = -1; - if ((fd = open(path, O_RDONLY)) < 0) { + if ((fd = os::open(path, O_RDONLY, 0)) < 0) { return OS_ERR; } if (pread(fd, info, s, o) != s) { diff --git a/src/hotspot/os_cpu/linux_x86/gc/z/zBackingFile_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/gc/z/zBackingFile_linux_x86.cpp index 4bdcf30dbf5..39632495b67 100644 --- a/src/hotspot/os_cpu/linux_x86/gc/z/zBackingFile_linux_x86.cpp +++ b/src/hotspot/os_cpu/linux_x86/gc/z/zBackingFile_linux_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, 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 @@ -191,7 +191,7 @@ int ZBackingFile::create_file_fd(const char* name) const { // Try to create an anonymous file using the O_TMPFILE flag. Note that this // flag requires kernel >= 3.11. If this fails we fall back to open/unlink. - const int fd_anon = open(path.get(), O_TMPFILE|O_EXCL|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR); + const int fd_anon = os::open(path.get(), O_TMPFILE|O_EXCL|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR); if (fd_anon == -1) { ZErrno err; log_debug(gc, init)("Failed to create anonymous file in %s (%s)", path.get(), @@ -217,7 +217,7 @@ int ZBackingFile::create_file_fd(const char* name) const { snprintf(filename, sizeof(filename), "%s/%s.%d", path.get(), name, os::current_process_id()); // Create file - const int fd = open(filename, O_CREAT|O_EXCL|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR); + const int fd = os::open(filename, O_CREAT|O_EXCL|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR); if (fd == -1) { ZErrno err; log_error(gc, init)("Failed to create file %s (%s)", filename, err.to_string()); diff --git a/src/hotspot/share/ci/ciEnv.cpp b/src/hotspot/share/ci/ciEnv.cpp index c3ca69e1f63..d21f5b965e2 100644 --- a/src/hotspot/share/ci/ciEnv.cpp +++ b/src/hotspot/share/ci/ciEnv.cpp @@ -1253,7 +1253,7 @@ void ciEnv::dump_replay_data(int compile_id) { static char buffer[O_BUFLEN]; int ret = jio_snprintf(buffer, O_BUFLEN, "replay_pid%p_compid%d.log", os::current_process_id(), compile_id); if (ret > 0) { - int fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); + int fd = os::open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); if (fd != -1) { FILE* replay_data_file = os::open(fd, "w"); if (replay_data_file != NULL) { @@ -1271,7 +1271,7 @@ void ciEnv::dump_inline_data(int compile_id) { static char buffer[O_BUFLEN]; int ret = jio_snprintf(buffer, O_BUFLEN, "inline_pid%p_compid%d.log", os::current_process_id(), compile_id); if (ret > 0) { - int fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); + int fd = os::open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); if (fd != -1) { FILE* inline_data_file = os::open(fd, "w"); if (inline_data_file != NULL) { diff --git a/src/hotspot/share/classfile/compactHashtable.cpp b/src/hotspot/share/classfile/compactHashtable.cpp index 2a28c563bfd..36d5bf9226f 100644 --- a/src/hotspot/share/classfile/compactHashtable.cpp +++ b/src/hotspot/share/classfile/compactHashtable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -198,7 +198,7 @@ HashtableTextDump::HashtableTextDump(const char* filename) : _fd(-1) { quit("Unable to get hashtable dump file size", filename); } _size = st.st_size; - _fd = open(filename, O_RDONLY | O_BINARY, 0); + _fd = os::open(filename, O_RDONLY | O_BINARY, 0); if (_fd < 0) { quit("Unable to open hashtable dump file", filename); } diff --git a/src/hotspot/share/memory/filemap.cpp b/src/hotspot/share/memory/filemap.cpp index 84e37f309de..b541966d75f 100644 --- a/src/hotspot/share/memory/filemap.cpp +++ b/src/hotspot/share/memory/filemap.cpp @@ -561,7 +561,7 @@ bool FileMapInfo::init_from_file(int fd) { // Read the FileMapInfo information from the file. bool FileMapInfo::open_for_read() { _full_path = Arguments::GetSharedArchivePath(); - int fd = open(_full_path, O_RDONLY | O_BINARY, 0); + int fd = os::open(_full_path, O_RDONLY | O_BINARY, 0); if (fd < 0) { if (errno == ENOENT) { // Not locating the shared archive is ok. @@ -596,7 +596,7 @@ void FileMapInfo::open_for_write() { // Use remove() to delete the existing file because, on Unix, this will // allow processes that have it open continued access to the file. remove(_full_path); - int fd = open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0444); + int fd = os::open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0444); if (fd < 0) { fail_stop("Unable to create shared archive file %s: (%s).", _full_path, os::strerror(errno)); diff --git a/src/hotspot/share/utilities/ostream.cpp b/src/hotspot/share/utilities/ostream.cpp index ed9b43cf82e..2089765bdf2 100644 --- a/src/hotspot/share/utilities/ostream.cpp +++ b/src/hotspot/share/utilities/ostream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -559,11 +559,6 @@ void fileStream::flush() { fflush(_file); } -fdStream::fdStream(const char* file_name) { - _fd = open(file_name, O_WRONLY | O_CREAT | O_TRUNC, 0666); - _need_close = true; -} - fdStream::~fdStream() { if (_fd != -1) { if (_need_close) close(_fd); From 8b01c4b53d6c98532de5e74b9ff6f80d6e0f6c5d Mon Sep 17 00:00:00 2001 From: Jini George Date: Mon, 25 Feb 2019 13:50:32 +0530 Subject: [PATCH 103/109] 8214756: SA should ignore archived java heap objects that are not in use Ignore objects, the associated classes of which are unloaded while walking the heap to create a heapdump Reviewed-by: jiangli, redestad --- .../sun/jvm/hotspot/utilities/HeapHprofBinWriter.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java index 6864be53ab2..603ebee9f3c 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2019, 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 @@ -938,10 +938,16 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter { } protected void writeInstance(Instance instance) throws IOException { + Klass klass = instance.getKlass(); + if (klass.getClassLoaderData() == null) { + // Ignoring this object since the corresponding Klass is not loaded. + // Might be a dormant archive object. + return; + } + out.writeByte((byte) HPROF_GC_INSTANCE_DUMP); writeObjectID(instance); out.writeInt(DUMMY_STACK_TRACE_ID); - Klass klass = instance.getKlass(); writeObjectID(klass.getJavaMirror()); ClassData cd = (ClassData) classDataCache.get(klass); From 677aaed7650b2a883fdddc53046e6b3ca0acdd1e Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Mon, 25 Feb 2019 08:25:23 -0500 Subject: [PATCH 104/109] 8159525: Add @FunctionalInterface annotation to PrivilegedAction and PrivilegedExceptionAction Reviewed-by: clanger --- .../share/classes/java/security/PrivilegedAction.java | 4 ++-- .../classes/java/security/PrivilegedExceptionAction.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/java.base/share/classes/java/security/PrivilegedAction.java b/src/java.base/share/classes/java/security/PrivilegedAction.java index fec7a37d9ba..3b50fde5ba6 100644 --- a/src/java.base/share/classes/java/security/PrivilegedAction.java +++ b/src/java.base/share/classes/java/security/PrivilegedAction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ package java.security; * @see AccessController#doPrivileged(PrivilegedAction) * @see PrivilegedExceptionAction */ - +@FunctionalInterface public interface PrivilegedAction { /** * Performs the computation. This method will be called by diff --git a/src/java.base/share/classes/java/security/PrivilegedExceptionAction.java b/src/java.base/share/classes/java/security/PrivilegedExceptionAction.java index 35b9abfe354..37b67c53671 100644 --- a/src/java.base/share/classes/java/security/PrivilegedExceptionAction.java +++ b/src/java.base/share/classes/java/security/PrivilegedExceptionAction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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,7 +42,7 @@ package java.security; * AccessControlContext) * @see PrivilegedAction */ - +@FunctionalInterface public interface PrivilegedExceptionAction { /** * Performs the computation. This method will be called by From 8813c391df15d83d54edb5148b7be0d38beb46ea Mon Sep 17 00:00:00 2001 From: Mikhailo Seledtsov Date: Mon, 25 Feb 2019 08:16:20 -0800 Subject: [PATCH 105/109] 8219553: [TESTBUG] Problem list JFR TestPeriod test Problem listed the test Reviewed-by: egahlin --- test/jdk/ProblemList.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index d53efbafb2b..0d3b8cd4fe6 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -868,3 +868,4 @@ javax/rmi/ssl/SSLSocketParametersTest.sh 8162906 generic- # jdk_jfr jdk/jfr/event/io/TestInstrumentation.java 8202142 generic-all +jdk/jfr/api/recording/event/TestPeriod.java 8215890 generic-all From 1610706716b31b69a717301cee009f85062d7204 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Mon, 25 Feb 2019 14:45:29 -0800 Subject: [PATCH 106/109] 8219561: Update jdeprscan to avoid the need for start-of-release changes Reviewed-by: dfuchs, lancea, smarks --- .../share/classes/com/sun/tools/jdeprscan/Main.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java index 7fc54ae9e4a..2f8e61e08f4 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java @@ -45,6 +45,8 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; import java.util.Queue; +import java.util.stream.Collectors; +import java.util.stream.IntStream; import java.util.stream.Stream; import java.util.stream.StreamSupport; import java.util.jar.JarEntry; @@ -106,7 +108,10 @@ public class Main implements DiagnosticListener { // Keep these updated manually until there's a compiler API // that allows querying of supported releases. final Set releasesWithoutForRemoval = Set.of("6", "7", "8"); - final Set releasesWithForRemoval = Set.of("9", "10", "11", "12", "13"); + final Set releasesWithForRemoval = // "9", "10", "11", ... + IntStream.rangeClosed(9, Runtime.version().feature()) + .mapToObj(Integer::toString) + .collect(Collectors.toUnmodifiableSet()); final Set validReleases; { From e4fd3054fc130c4be7cb5c8f04550fc60cd95073 Mon Sep 17 00:00:00 2001 From: John Jiang Date: Tue, 26 Feb 2019 07:26:29 +0800 Subject: [PATCH 107/109] 8215524: Finished message validation failure should be decrypt_error alert Reviewed-by: xuelei --- src/java.base/share/classes/sun/security/ssl/Finished.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/Finished.java b/src/java.base/share/classes/sun/security/ssl/Finished.java index 2e76645dce4..e063de34dfa 100644 --- a/src/java.base/share/classes/sun/security/ssl/Finished.java +++ b/src/java.base/share/classes/sun/security/ssl/Finished.java @@ -102,7 +102,7 @@ final class Finished { } if (m.remaining() != verifyDataLen) { - throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER, + throw context.conContext.fatal(Alert.DECODE_ERROR, "Inappropriate finished message: need " + verifyDataLen + " but remaining " + m.remaining() + " bytes verify_data"); } @@ -120,7 +120,7 @@ final class Finished { "Failed to generate verify_data", ioe); } if (!MessageDigest.isEqual(myVerifyData, verifyData)) { - throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER, + throw context.conContext.fatal(Alert.DECRYPT_ERROR, "The Finished message cannot be verified."); } } From ab5cedabe1bfb827535042551102a09d414fbe99 Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Mon, 25 Feb 2019 16:05:06 -0800 Subject: [PATCH 108/109] 8219675: Disable harfbuzz warnings with gcc 8 Reviewed-by: erikj, prr --- make/lib/Awt2dLibraries.gmk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/make/lib/Awt2dLibraries.gmk b/make/lib/Awt2dLibraries.gmk index debd1499a6f..e47ada21883 100644 --- a/make/lib/Awt2dLibraries.gmk +++ b/make/lib/Awt2dLibraries.gmk @@ -613,7 +613,8 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \ type-limits missing-field-initializers implicit-fallthrough \ strict-aliasing undef unused-function, \ DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \ - maybe-uninitialized, \ + maybe-uninitialized \ + missing-attributes class-memaccess, \ DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \ tautological-constant-out-of-range-compare int-to-pointer-cast \ sign-compare undef missing-field-initializers, \ From b0eedd125f7531f94bb525d78b95294bfc047c08 Mon Sep 17 00:00:00 2001 From: Chris Plummer Date: Mon, 25 Feb 2019 18:54:40 -0800 Subject: [PATCH 109/109] 8219143: jdb should support breakpoint thread filters Add thread filter to stop command. Reviewed-by: sspitsyn, amenkov --- .../example/debug/tty/BreakpointSpec.java | 21 ++- .../sun/tools/example/debug/tty/Commands.java | 118 +++++++++++---- .../debug/tty/EventRequestSpecList.java | 11 +- .../tools/example/debug/tty/TTYResources.java | 40 ++++- test/jdk/com/sun/jdi/JdbStopThreadidTest.java | 143 ++++++++++++++++++ test/jdk/com/sun/jdi/lib/jdb/JdbCommand.java | 9 +- 6 files changed, 291 insertions(+), 51 deletions(-) create mode 100644 test/jdk/com/sun/jdi/JdbStopThreadidTest.java diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java index 2bd04857e00..b2d86f7f9e3 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -44,20 +44,24 @@ class BreakpointSpec extends EventRequestSpec { String methodId; List methodArgs; int lineNumber; + ThreadReference threadFilter; /* Thread to break in. null if global breakpoint. */ + public static final String locationTokenDelimiter = ":( \t\n\r"; - BreakpointSpec(ReferenceTypeSpec refSpec, int lineNumber) { + BreakpointSpec(ReferenceTypeSpec refSpec, int lineNumber, ThreadReference threadFilter) { super(refSpec); this.methodId = null; this.methodArgs = null; this.lineNumber = lineNumber; + this.threadFilter = threadFilter; } - BreakpointSpec(ReferenceTypeSpec refSpec, String methodId, + BreakpointSpec(ReferenceTypeSpec refSpec, String methodId, ThreadReference threadFilter, List methodArgs) throws MalformedMemberNameException { super(refSpec); this.methodId = methodId; this.methodArgs = methodArgs; this.lineNumber = 0; + this.threadFilter = threadFilter; if (!isValidMethodName(methodId)) { throw new MalformedMemberNameException(methodId); } @@ -78,8 +82,11 @@ class BreakpointSpec extends EventRequestSpec { throw new InvalidTypeException(); } EventRequestManager em = refType.virtualMachine().eventRequestManager(); - EventRequest bp = em.createBreakpointRequest(location); + BreakpointRequest bp = em.createBreakpointRequest(location); bp.setSuspendPolicy(suspendPolicy); + if (threadFilter != null) { + bp.addThreadFilter(threadFilter); + } bp.enable(); return bp; } @@ -104,7 +111,8 @@ class BreakpointSpec extends EventRequestSpec { public int hashCode() { return refSpec.hashCode() + lineNumber + ((methodId != null) ? methodId.hashCode() : 0) + - ((methodArgs != null) ? methodArgs.hashCode() : 0); + ((methodArgs != null) ? methodArgs.hashCode() : 0) + + ((threadFilter != null) ? threadFilter.hashCode() : 0); } @Override @@ -118,6 +126,9 @@ class BreakpointSpec extends EventRequestSpec { ((methodArgs != null) ? methodArgs.equals(breakpoint.methodArgs) : methodArgs == breakpoint.methodArgs) && + ((threadFilter != null) ? + threadFilter.equals(breakpoint.threadFilter) + : threadFilter == breakpoint.threadFilter) && refSpec.equals(breakpoint.refSpec) && (lineNumber == breakpoint.lineNumber); } else { diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java index d20f61a43af..0d96e9b1dbd 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java @@ -1037,16 +1037,16 @@ class Commands { } - private void printBreakpointCommandUsage(String atForm, String inForm) { - MessageOutput.println("printbreakpointcommandusage", - new Object [] {atForm, inForm}); + private void printBreakpointCommandUsage(String usageMessage) { + MessageOutput.println(usageMessage); } - protected BreakpointSpec parseBreakpointSpec(StringTokenizer t, - String atForm, String inForm) { + protected BreakpointSpec parseBreakpointSpec(StringTokenizer t, String next_token, + ThreadReference threadFilter, + String usageMessage) { BreakpointSpec breakpoint = null; try { - String token = t.nextToken(":( \t\n\r"); + String token = next_token; // We can't use hasMoreTokens here because it will cause any leading // paren to be lost. @@ -1064,16 +1064,24 @@ class Commands { NumberFormat nf = NumberFormat.getNumberInstance(); nf.setParseIntegerOnly(true); - Number n = nf.parse(lineToken); + Number n; + try { + n = nf.parse(lineToken); + } catch (java.text.ParseException pe) { + MessageOutput.println("Invalid line number specified"); + printBreakpointCommandUsage(usageMessage); + return null; + } int lineNumber = n.intValue(); if (t.hasMoreTokens()) { - printBreakpointCommandUsage(atForm, inForm); + MessageOutput.println("Extra tokens after breakpoint location"); + printBreakpointCommandUsage(usageMessage); return null; } try { breakpoint = Env.specList.createBreakpoint(classId, - lineNumber); + lineNumber, threadFilter); } catch (ClassNotFoundException exc) { MessageOutput.println("is not a valid class name", classId); } @@ -1082,7 +1090,8 @@ class Commands { int idot = token.lastIndexOf('.'); if ( (idot <= 0) || /* No dot or dot in first char */ (idot >= token.length() - 1) ) { /* dot in last char */ - printBreakpointCommandUsage(atForm, inForm); + MessageOutput.println("Invalid . specification"); + printBreakpointCommandUsage(usageMessage); return null; } String methodName = token.substring(idot + 1); @@ -1090,9 +1099,9 @@ class Commands { List argumentList = null; if (rest != null) { if (!rest.startsWith("(") || !rest.endsWith(")")) { - MessageOutput.println("Invalid method specification:", + MessageOutput.println("Invalid specification:", methodName + rest); - printBreakpointCommandUsage(atForm, inForm); + printBreakpointCommandUsage(usageMessage); return null; } // Trim the parens @@ -1107,6 +1116,7 @@ class Commands { try { breakpoint = Env.specList.createBreakpoint(classId, methodName, + threadFilter, argumentList); } catch (MalformedMemberNameException exc) { MessageOutput.println("is not a valid method name", methodName); @@ -1115,7 +1125,7 @@ class Commands { } } } catch (Exception e) { - printBreakpointCommandUsage(atForm, inForm); + printBreakpointCommandUsage(usageMessage); return null; } return breakpoint; @@ -1145,33 +1155,74 @@ class Commands { } void commandStop(StringTokenizer t) { - String atIn; byte suspendPolicy = EventRequest.SUSPEND_ALL; + ThreadReference threadFilter = null; - if (t.hasMoreTokens()) { - atIn = t.nextToken(); - if (atIn.equals("go") && t.hasMoreTokens()) { - suspendPolicy = EventRequest.SUSPEND_NONE; - atIn = t.nextToken(); - } else if (atIn.equals("thread") && t.hasMoreTokens()) { - suspendPolicy = EventRequest.SUSPEND_EVENT_THREAD; - atIn = t.nextToken(); - } - } else { + /* + * Allowed syntax: + * stop [go|thread] [] + * If no options are given, the current list of breakpoints is printed. + * If "go" is specified, then immediately resume after stopping. No threads are suspended. + * If "thread" is specified, then only suspend the thread we stop in. + * If neither "go" nor "thread" are specified, then suspend all threads. + * If an integer is specified, then only stop in the specified thread. + * can either be a line number or a method: + * - : + * - .[(argument_type,...)] + */ + + if (!t.hasMoreTokens()) { listBreakpoints(); return; } - BreakpointSpec spec = parseBreakpointSpec(t, "stop at", "stop in"); - if (spec != null) { - // Enforcement of "at" vs. "in". The distinction is really - // unnecessary and we should consider not checking for this - // (and making "at" and "in" optional). - if (atIn.equals("at") && spec.isMethodBreakpoint()) { - MessageOutput.println("Use stop at to set a breakpoint at a line number"); - printBreakpointCommandUsage("stop at", "stop in"); + String token = t.nextToken(); + + /* Check for "go" or "thread" modifiers. */ + if (token.equals("go") && t.hasMoreTokens()) { + suspendPolicy = EventRequest.SUSPEND_NONE; + token = t.nextToken(); + } else if (token.equals("thread") && t.hasMoreTokens()) { + suspendPolicy = EventRequest.SUSPEND_EVENT_THREAD; + token = t.nextToken(); + } + + /* Handle modifier. */ + if (!token.equals("at") && !token.equals("in")) { + Long threadid; + try { + threadid = Long.decode(token); + } catch (NumberFormatException nfe) { + MessageOutput.println("Expected at, in, or an integer :", token); + printBreakpointCommandUsage("printstopcommandusage"); return; } + try { + ThreadInfo threadInfo = ThreadInfo.getThreadInfo(token); + if (threadInfo == null) { + MessageOutput.println("Invalid :", token); + return; + } + threadFilter = threadInfo.getThread(); + token = t.nextToken(BreakpointSpec.locationTokenDelimiter); + } catch (VMNotConnectedException vmnce) { + MessageOutput.println(" option not valid until the VM is started with the run command"); + return; + } + + } + + /* Make sure "at" or "in" comes next. */ + if (!token.equals("at") && !token.equals("in")) { + MessageOutput.println("Missing at or in"); + printBreakpointCommandUsage("printstopcommandusage"); + return; + } + + token = t.nextToken(BreakpointSpec.locationTokenDelimiter); + + BreakpointSpec spec = parseBreakpointSpec(t, token, threadFilter, "printstopcommandusage"); + if (spec != null) { spec.suspendPolicy = suspendPolicy; resolveNow(spec); } @@ -1183,7 +1234,8 @@ class Commands { return; } - BreakpointSpec spec = parseBreakpointSpec(t, "clear", "clear"); + String token = t.nextToken(BreakpointSpec.locationTokenDelimiter); + BreakpointSpec spec = parseBreakpointSpec(t, token, null, "printclearcommandusage"); if (spec != null) { if (Env.specList.delete(spec)) { MessageOutput.println("Removed:", spec.toString()); diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/EventRequestSpecList.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/EventRequestSpecList.java index edab1286569..e7c5ab943f9 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/EventRequestSpecList.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/EventRequestSpecList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -36,6 +36,7 @@ package com.sun.tools.example.debug.tty; import com.sun.jdi.request.EventRequest; import com.sun.jdi.event.ClassPrepareEvent; +import com.sun.jdi.ThreadReference; import java.util.ArrayList; import java.util.Collections; @@ -108,21 +109,21 @@ class EventRequestSpecList { } } - BreakpointSpec createBreakpoint(String classPattern, int line) + BreakpointSpec createBreakpoint(String classPattern, int line, ThreadReference threadFilter) throws ClassNotFoundException { ReferenceTypeSpec refSpec = new PatternReferenceTypeSpec(classPattern); - return new BreakpointSpec(refSpec, line); + return new BreakpointSpec(refSpec, line, threadFilter); } BreakpointSpec createBreakpoint(String classPattern, - String methodId, + String methodId, ThreadReference threadFilter, List methodArgs) throws MalformedMemberNameException, ClassNotFoundException { ReferenceTypeSpec refSpec = new PatternReferenceTypeSpec(classPattern); - return new BreakpointSpec(refSpec, methodId, methodArgs); + return new BreakpointSpec(refSpec, methodId, threadFilter, methodArgs); } EventRequestSpec createExceptionCatch(String classPattern, diff --git a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java index 6fbc1e7f7f1..5f773288e5e 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java @@ -120,12 +120,14 @@ public class TTYResources extends java.util.ListResourceBundle { {"Exception occurred caught", "Exception occurred: {0} (to be caught at: {1})"}, {"Exception occurred uncaught", "Exception occurred: {0} (uncaught)"}, {"Exceptions caught:", "Break when these exceptions occur:"}, + {"Expected at, in, or an integer :", "Expected \"at\", \"in\", or an integer : {0}"}, {"expr is null", "{0} = null"}, {"expr is value", "{0} = {1}"}, {"expr is value ", " {0} = {1} "}, {"Expression cannot be void", "Expression cannot be void"}, {"Expression must evaluate to an object", "Expression must evaluate to an object"}, {"extends:", "extends: {0}"}, + {"Extra tokens after breakpoint location", "Extra tokens after breakpoint location"}, {"Failed reading output", "Failed reading output of child java interpreter."}, {"Fatal error", "Fatal error:"}, {"Field access encountered before after", "Field ({0}) is {1}, will be {2}: "}, @@ -154,11 +156,14 @@ public class TTYResources extends java.util.ListResourceBundle { {"Invalid connect type", "Invalid connect type"}, {"Invalid consecutive invocations", "Invalid consecutive invocations"}, {"Invalid exception object", "Invalid exception object"}, - {"Invalid method specification:", "Invalid method specification: {0}"}, + {"Invalid line number specified", "Invalid line number specified"}, + {"Invalid specification:", "Invalid specification: {0}"}, {"Invalid option on class command", "Invalid option on class command"}, {"invalid option", "invalid option: {0}"}, {"Invalid thread status.", "Invalid thread status."}, + {"Invalid :", "Invalid : {0}"}, {"Invalid transport name:", "Invalid transport name: {0}"}, + {"Invalid . specification", "Invalid . specification"}, {"I/O exception occurred:", "I/O Exception occurred: {0}"}, {"is an ambiguous method name in", "\"{0}\" is an ambiguous method name in \"{1}\""}, {"is an invalid line number for", "{0,number,integer} is an invalid line number for {1}"}, @@ -191,6 +196,7 @@ public class TTYResources extends java.util.ListResourceBundle { {"Method exitedValue:", "Method exited: return value = {0}, "}, {"Method is overloaded; specify arguments", "Method {0} is overloaded; specify arguments"}, {"minus version", "This is {0} version {1,number,integer}.{2,number,integer} (Java SE version {3})"}, + {"Missing at or in", "Missing \"at\" or \"in\""}, {"Monitor information for thread", "Monitor information for thread {0}:"}, {"Monitor information for expr", "Monitor information for {0} ({1}):"}, {"More than one class named", "More than one class named: ''{0}''"}, @@ -241,7 +247,18 @@ public class TTYResources extends java.util.ListResourceBundle { {"Owned by:", " Owned by: {0}, entry count: {1,number,integer}"}, {"Owned monitor:", " Owned monitor: {0}"}, {"Parse exception:", "Parse Exception: {0}"}, - {"printbreakpointcommandusage", "Usage: {0} : or\n {1} .[(argument_type,...)]"}, + {"printclearcommandusage", "Usage clear : or\n clear .[(argument_type,...)]"}, + {"printstopcommandusage", + "Usage: stop [go|thread] [] \n" + + " If \"go\" is specified, immediately resume after stopping\n" + + " If \"thread\" is specified, only suspend the thread we stop in\n" + + " If neither \"go\" nor \"thread\" are specified, suspend all threads\n" + + " If an integer is specified, only stop in the specified thread\n" + + " \"at\" and \"in\" have the same meaning\n" + + " can either be a line number or a method:\n" + + " :\n" + + " .[(argument_type,...)]" + }, {"Removed:", "Removed: {0}"}, {"Requested stack frame is no longer active:", "Requested stack frame is no longer active: {0,number,integer}"}, {"run command is valid only with launched VMs", "'run ' command is valid only with launched VMs"}, @@ -292,6 +309,8 @@ public class TTYResources extends java.util.ListResourceBundle { {"Thread not suspended", "Thread not suspended"}, {"thread group number description name", "{0,number,integer}. {1} {2}"}, {"Threadgroup name not specified.", "Threadgroup name not specified."}, + {" option not valid until the VM is started with the run command", + " option not valid until the VM is started with the run command"}, {"Threads must be suspended", "Threads must be suspended"}, {"trace method exit in effect for", "trace method exit in effect for {0}"}, {"trace method exits in effect", "trace method exits in effect"}, @@ -318,7 +337,6 @@ public class TTYResources extends java.util.ListResourceBundle { {"Usage: unmonitor ", "Usage: unmonitor "}, {"Usage: up [n frames]", "Usage: up [n frames]"}, {"Use java minus X to see", "Use 'java -X' to see the available non-standard options"}, - {"Use stop at to set a breakpoint at a line number", "Use 'stop at' to set a breakpoint at a line number"}, {"VM already running. use cont to continue after events.", "VM already running. Use 'cont' to continue after events."}, {"VM Started:", "VM Started: "}, {"vmstartexception", "VM start exception: {0}"}, @@ -357,9 +375,17 @@ public class TTYResources extends java.util.ListResourceBundle { "threadgroups -- list threadgroups\n" + "threadgroup -- set current threadgroup\n" + "\n" + - "stop in .[(argument_type,...)]\n" + - " -- set a breakpoint in a method\n" + - "stop at : -- set a breakpoint at a line\n" + + "stop [go|thread] [] \n" + + " -- set a breakpoint\n" + + " -- if no options are given, the current list of breakpoints is printed\n" + + " -- if \"go\" is specified, immediately resume after stopping\n" + + " -- if \"thread\" is specified, only suspend the thread we stop in\n" + + " -- if neither \"go\" nor \"thread\" are specified, suspend all threads\n" + + " -- if an integer is specified, only stop in the specified thread\n" + + " -- \"at\" and \"in\" have the same meaning\n" + + " -- can either be a line number or a method:\n" + + " -- :\n" + + " -- .[(argument_type,...)]\n" + "clear .[(argument_type,...)]\n" + " -- clear a breakpoint in a method\n" + "clear : -- clear a breakpoint at a line\n" + @@ -412,7 +438,7 @@ public class TTYResources extends java.util.ListResourceBundle { " -- repeat command n times\n" + "# -- discard (no-op)\n" + "help (or ?) -- list commands\n" + - "dbgtrace [flag] -- same as dbgtrace command line option" + + "dbgtrace [flag] -- same as dbgtrace command line option\n" + "version -- print version information\n" + "exit (or quit) -- exit debugger\n" + "\n" + diff --git a/test/jdk/com/sun/jdi/JdbStopThreadidTest.java b/test/jdk/com/sun/jdi/JdbStopThreadidTest.java new file mode 100644 index 00000000000..9a32463799f --- /dev/null +++ b/test/jdk/com/sun/jdi/JdbStopThreadidTest.java @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2019, 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 8219143 + * @summary Tests that using the "stop in" threadid option will properly cause the + * breakpoint to only be triggered when hit in the specified thread. + * + * @library /test/lib + * @run compile -g JdbStopThreadidTest.java + * @run main/othervm JdbStopThreadidTest + */ + +import lib.jdb.Jdb; +import lib.jdb.JdbCommand; +import lib.jdb.JdbTest; + +import java.util.regex.*; + +class JdbStopThreadidTestTarg { + static Object lockObj = new Object(); + + public static void main(String[] args) { + test(); + } + + private static void test() { + JdbStopThreadidTestTarg test = new JdbStopThreadidTestTarg(); + MyThread myThread1 = test.new MyThread("MYTHREAD-1"); + MyThread myThread2 = test.new MyThread("MYTHREAD-2"); + MyThread myThread3 = test.new MyThread("MYTHREAD-3"); + + synchronized (lockObj) { + myThread1.start(); + myThread2.start(); + myThread3.start(); + // Wait for all threads to have started. Note they all block on lockObj after starting. + while (!myThread1.started || !myThread2.started || !myThread3.started) { + try { + Thread.sleep(50); + } catch (InterruptedException e) { + } + } + // Stop here so the test can setup the breakpoint in MYTHREAD-2 + brkMethod(); + } + + // Wait for all threads to finish before exiting + try { + myThread1.join(); + myThread2.join(); + myThread3.join(); + } catch (InterruptedException e) { + } + } + + static void brkMethod() { + } + + public static void print(Object obj) { + System.out.println(obj); + } + + class MyThread extends Thread { + volatile boolean started = false; + + public MyThread(String name) { + super(name); + } + + public void run() { + started = true; + synchronized (JdbStopThreadidTestTarg.lockObj) { + } + brkMethod(); + } + + void brkMethod() { + } + } +} + +public class JdbStopThreadidTest extends JdbTest { + public static void main(String argv[]) { + new JdbStopThreadidTest().run(); + } + + private JdbStopThreadidTest() { + super(DEBUGGEE_CLASS); + } + + private static final String DEBUGGEE_CLASS = JdbStopThreadidTestTarg.class.getName(); + private static final String DEBUGGEE_THREAD_CLASS = JdbStopThreadidTestTarg.class.getName() + "$MyThread"; + private static Pattern threadidPattern = Pattern.compile("MyThread\\)(\\S+)\\s+MYTHREAD-2"); + + @Override + protected void runCases() { + jdb.command(JdbCommand.stopIn(DEBUGGEE_CLASS, "brkMethod")); + jdb.command(JdbCommand.run().waitForPrompt("Breakpoint hit: \"thread=main\"", true)); + jdb.command(JdbCommand.threads()); + + // Find the threadid for MYTHREAD-2 in the "threads" command output + String output = jdb.getJdbOutput(); + Matcher m = threadidPattern.matcher(output); + String threadid = null; + if (m.find()) { + threadid = m.group(1); + } else { + throw new RuntimeException("FAILED: Did not match threadid pattern."); + } + + // Setup a breakpoint in MYTHREAD-2. + jdb.command(JdbCommand.stopInThreadid(DEBUGGEE_THREAD_CLASS, "brkMethod", threadid)); + + // Continue until MYTHREAD-2 breakpoint is hit. If we hit any other breakpoint before + // then (we aren't suppose to), then this test will fail. + jdb.command(JdbCommand.cont().waitForPrompt("Breakpoint hit: \"thread=MYTHREAD-2\", \\S+MyThread.brkMethod", true)); + // Continue until the application exits. Once again, hitting a breakpoint will cause + // a failure because we are not suppose to hit one. + jdb.command(JdbCommand.cont().waitForPrompt(Jdb.APPLICATION_EXIT, true)); + } +} diff --git a/test/jdk/com/sun/jdi/lib/jdb/JdbCommand.java b/test/jdk/com/sun/jdi/lib/jdb/JdbCommand.java index dd736bce019..a68826fbeb8 100644 --- a/test/jdk/com/sun/jdi/lib/jdb/JdbCommand.java +++ b/test/jdk/com/sun/jdi/lib/jdb/JdbCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2019, 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 @@ -162,6 +162,9 @@ public class JdbCommand { public static JdbCommand stopIn(String targetClass, String methodName) { return new JdbCommand("stop in " + targetClass + "." + methodName); } + public static JdbCommand stopInThreadid(String targetClass, String methodName, String threadid) { + return new JdbCommand("stop " + threadid + " in " + targetClass + "." + methodName); + } public static JdbCommand thread(int threadNumber) { return new JdbCommand("thread " + threadNumber); } @@ -226,6 +229,10 @@ public class JdbCommand { return new JdbCommand("methods " + classId); } + public static JdbCommand threads() { + return new JdbCommand("threads"); + } + // trace [go] methods [thread] // -- trace method entries and exits. // -- All threads are suspended unless 'go' is specified