8241618: Fix trivial unchecked warnings for jdk.hotspot.agent

Reviewed-by: cjplummer, sspitsyn
This commit is contained in:
Magnus Ihse Bursie 2020-04-15 08:58:03 +02:00
parent 919027a90e
commit b0d709cc23
117 changed files with 620 additions and 637 deletions
src/jdk.hotspot.agent/share/classes
com/sun/java/swing
sun/jvm/hotspot
CommandProcessor.javaHSDB.javaHotSpotAgent.java
ci
code
debugger
interpreter
memory
oops
opto
runtime
tools
types/basic
ui
utilities

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 @@ public abstract class ActionManager
protected ActionManager()
{
actions = new HashMap();
actions = new HashMap<>();
addActions();
}
@ -93,7 +93,7 @@ public abstract class ActionManager
action.setEnabled(enabled);
}
private HashMap actions;
private HashMap<String, Action> actions;
private static ActionUtilities utilities = new ActionUtilities();
private static ActionManager manager;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,30 +176,30 @@ public class CommonUI
return createCheckBox(text, -1, null, false);
}
public static JComboBox createComboBox(Object items[], ActionListener listener, boolean editable)
public static JComboBox<Object> createComboBox(Object items[], ActionListener listener, boolean editable)
{
JComboBox comboBox = new JComboBox(items);
JComboBox<Object> comboBox = new JComboBox<>(items);
if(listener != null)
comboBox.addActionListener(listener);
comboBox.setEditable(editable);
return comboBox;
}
public static JComboBox createComboBox(Object items[], boolean editable)
public static JComboBox<Object> createComboBox(Object items[], boolean editable)
{
return createComboBox(items, null, editable);
}
public static JComboBox createComboBox(Vector items, ActionListener listener, boolean editable)
public static JComboBox<Object> createComboBox(Vector<Object> items, ActionListener listener, boolean editable)
{
JComboBox comboBox = new JComboBox(items);
JComboBox<Object> comboBox = new JComboBox<>(items);
if(listener != null)
comboBox.addActionListener(listener);
comboBox.setEditable(editable);
return comboBox;
}
public static JComboBox createComboBox(Vector items, boolean editable)
public static JComboBox<Object> createComboBox(Vector<Object> items, boolean editable)
{
return createComboBox(items, null, editable);
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 TabsDlg extends JDialog
JPanel p4 = new JPanel();
p4.add(new JButton("Four"));
p4.setName("Four");
Vector panels = new Vector();
Vector<JPanel> panels = new Vector<>();
panels.addElement(p1);
panels.addElement(p2);
panels.addElement(p3);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -178,7 +178,7 @@ public class WizardDlg extends JDialog
p3.add(new JButton("Three"));
JPanel p4 = new JPanel();
p4.add(new JButton("Four"));
Vector panels = new Vector();
Vector<JPanel> panels = new Vector<>();
panels.addElement(p1);
panels.addElement(p2);
panels.addElement(p3);

@ -128,7 +128,7 @@ public class CommandProcessor {
}
public static class NonBootFilter implements ClassFilter {
private HashMap emitted = new HashMap();
private HashMap<Symbol, InstanceKlass> emitted = new HashMap<>();
public boolean canInclude(InstanceKlass kls) {
if (kls.getClassLoader() == null) return false;
if (emitted.get(kls.getName()) != null) {
@ -156,7 +156,7 @@ public class CommandProcessor {
return t;
}
void add(String s, ArrayList t) {
void add(String s, ArrayList<String> t) {
if (s.length() > 0) {
t.add(s);
}
@ -167,7 +167,7 @@ public class CommandProcessor {
// check for quoting
int quote = cmd.indexOf('"');
ArrayList t = new ArrayList();
ArrayList<String> t = new ArrayList<>();
if (quote != -1) {
while (cmd.length() > 0) {
if (quote != -1) {
@ -682,7 +682,7 @@ public class CommandProcessor {
} else if (tokens == 0) {
out.println("Available commands:");
Object[] keys = commands.keySet().toArray();
Arrays.sort(keys, new Comparator() {
Arrays.sort(keys, new Comparator<>() {
public int compare(Object o1, Object o2) {
return o1.toString().compareTo(o2.toString());
}
@ -993,8 +993,8 @@ public class CommandProcessor {
// be read back.
Iterator i = agent.getTypeDataBase().getTypes();
// Make sure the types are emitted in an order than can be read back in
HashSet emitted = new HashSet();
Stack pending = new Stack();
HashSet<String> emitted = new HashSet<>();
Stack<Type> pending = new Stack<>();
while (i.hasNext()) {
Type n = (Type)i.next();
if (emitted.contains(n.getName())) {
@ -1389,8 +1389,8 @@ public class CommandProcessor {
} else {
Iterator i = agent.getTypeDataBase().getTypes();
// Make sure the types are emitted in an order than can be read back in
HashSet emitted = new HashSet();
Stack pending = new Stack();
HashSet<String> emitted = new HashSet<>();
Stack<Type> pending = new Stack<>();
while (i.hasNext()) {
Type n = (Type)i.next();
if (emitted.contains(n.getName())) {
@ -1640,7 +1640,7 @@ public class CommandProcessor {
if (t.countTokens() != 0) {
usage();
} else {
ArrayList nmethods = new ArrayList();
ArrayList<NMethod> nmethods = new ArrayList<>();
Threads threads = VM.getVM().getThreads();
HTMLGenerator gen = new HTMLGenerator(false);
for (int i = 0; i < threads.getNumberOfThreads(); i++) {
@ -1832,8 +1832,8 @@ public class CommandProcessor {
};
private boolean verboseExceptions = false;
private ArrayList history = new ArrayList();
private HashMap commands = new HashMap();
private ArrayList<String> history = new ArrayList<>();
private HashMap<String, Command> commands = new HashMap<>();
private boolean doEcho = false;
private Command findCommand(String key) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,10 +66,8 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
private boolean attached;
private boolean argError;
private JFrame frame;
/** List <JMenuItem> */
private java.util.List attachMenuItems;
/** List <JMenuItem> */
private java.util.List detachMenuItems;
private java.util.List<JMenuItem> attachMenuItems;
private java.util.List<JMenuItem> detachMenuItems;
private JMenu toolsMenu;
private JMenuItem showDbgConsoleMenuItem;
private JMenuItem computeRevPtrsMenuItem;
@ -155,8 +153,8 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
agent = new HotSpotAgent();
workerThread = new WorkerThread();
attachMenuItems = new java.util.ArrayList();
detachMenuItems = new java.util.ArrayList();
attachMenuItems = new java.util.ArrayList<>();
detachMenuItems = new java.util.ArrayList<>();
JMenuBar menuBar = new JMenuBar();
@ -875,7 +873,7 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
// frames in a table and one which finds Java frames and if they
// are in the table indicates that they were interrupted by a signal.
Map interruptedFrameMap = new HashMap();
Map<sun.jvm.hotspot.runtime.Frame, SignalInfo> interruptedFrameMap = new HashMap<>();
{
sun.jvm.hotspot.runtime.Frame tmpFrame = thread.getCurrentFrameGuess();
RegisterMap tmpMap = thread.newRegisterMap(false);
@ -1845,9 +1843,9 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
return buf.toString();
}
private void setMenuItemsEnabled(java.util.List items, boolean enabled) {
for (Iterator iter = items.iterator(); iter.hasNext(); ) {
((JMenuItem) iter.next()).setEnabled(enabled);
private void setMenuItemsEnabled(java.util.List<JMenuItem> items, boolean enabled) {
for (Iterator<JMenuItem> iter = items.iterator(); iter.hasNext(); ) {
iter.next().setEnabled(enabled);
}
}
}

@ -483,7 +483,7 @@ public class HotSpotAgent {
private void setupDebuggerAlternate(String alternateName) {
try {
Class c = Class.forName(alternateName);
Class<?> c = Class.forName(alternateName);
Constructor cons = c.getConstructor();
debugger = (JVMDebugger) cons.newInstance();
attachDebugger();

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -63,13 +63,13 @@ public class ciObjectFactory extends VMObject {
public static ciObject get(Address addr) {
if (addr == null) return null;
return (ciObject)ciObjectConstructor.instantiateWrapperFor(addr);
return ciObjectConstructor.instantiateWrapperFor(addr);
}
public static ciMetadata getMetadata(Address addr) {
if (addr == null) return null;
return (ciMetadata)ciMetadataConstructor.instantiateWrapperFor(addr);
return ciMetadataConstructor.instantiateWrapperFor(addr);
}
public GrowableArray<ciMetadata> objects() {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -49,8 +49,8 @@ public class CodeCache {
// Get array of CodeHeaps
// Note: CodeHeap may be subclassed with optional private heap mechanisms.
Type codeHeapType = db.lookupType("CodeHeap");
VirtualBaseConstructor heapConstructor =
new VirtualBaseConstructor(db, codeHeapType, "sun.jvm.hotspot.memory", CodeHeap.class);
VirtualBaseConstructor<CodeHeap> heapConstructor =
new VirtualBaseConstructor<>(db, codeHeapType, "sun.jvm.hotspot.memory", CodeHeap.class);
AddressField heapsField = type.getAddressField("_heaps");
heapArray = GrowableArray.create(heapsField.getValue(), heapConstructor);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,7 @@ import sun.jvm.hotspot.oops.Method;
public class DebugInfoReadStream extends CompressedReadStream {
private NMethod code;
private int InvocationEntryBCI;
private List objectPool; // ArrayList<ObjectValue>
private List<ObjectValue> objectPool;
public DebugInfoReadStream(NMethod code, int offset) {
super(code.scopesDataBegin(), offset);
@ -43,7 +43,7 @@ public class DebugInfoReadStream extends CompressedReadStream {
this.objectPool = null;
}
public DebugInfoReadStream(NMethod code, int offset, List objectPool) {
public DebugInfoReadStream(NMethod code, int offset, List<ObjectValue> objectPool) {
super(code.scopesDataBegin(), offset);
InvocationEntryBCI = VM.getVM().getInvocationEntryBCI();
this.code = code;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -416,8 +416,8 @@ public class NMethod extends CompiledMethod {
return new ScopeDesc(this, pd.getScopeDecodeOffset(), pd.getObjDecodeOffset(), pd.getReexecute());
}
public Map/*<Address, PCDesc>*/ getSafepoints() {
Map safepoints = new HashMap(); // Map<Address, PCDesc>
public Map<sun.jvm.hotspot.debugger.Address, PCDesc> getSafepoints() {
Map<sun.jvm.hotspot.debugger.Address, PCDesc> safepoints = new HashMap<>();
sun.jvm.hotspot.debugger.Address p = null;
for (p = scopesPCsBegin(); p.lessThan(scopesPCsEnd());
p = p.addOffsetTo(pcDescSize)) {
@ -474,7 +474,7 @@ public class NMethod extends CompiledMethod {
}
public void dumpReplayData(PrintStream out) {
HashMap h = new HashMap();
HashMap<Metadata, Metadata> h = new HashMap<>();
for (int i = 1; i < getMetadataLength(); i++) {
Metadata meta = Metadata.instantiateWrapperFor(getMetadataAt(i));
System.err.println(meta);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,9 @@ import sun.jvm.hotspot.utilities.*;
/** An ObjectValue describes an object eliminated by escape analysis. */
public class ObjectValue extends ScopeValue {
private int id;
private ScopeValue klass;
private List fieldsValue; // ArrayList<ScopeValue>
private int id;
private ScopeValue klass;
private List<ScopeValue> fieldsValue;
// Field "boolean visited" is not implemented here since
// it is used only a during debug info creation.
@ -43,13 +43,13 @@ public class ObjectValue extends ScopeValue {
public ObjectValue(int id) {
this.id = id;
klass = null;
fieldsValue = new ArrayList();
fieldsValue = new ArrayList<>();
}
public boolean isObject() { return true; }
public int id() { return id; }
public ScopeValue getKlass() { return klass; }
public List getFieldsValue() { return fieldsValue; }
public List<ScopeValue> getFieldsValue() { return fieldsValue; }
public ScopeValue getFieldAt(int i) { return (ScopeValue)fieldsValue.get(i); }
public int fieldsSize() { return fieldsValue.size(); }

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -49,9 +49,9 @@ public class ScopeDesc {
private int expressionsDecodeOffset;
private int monitorsDecodeOffset;
/** Scalar replaced bjects pool */
private List objects; // ArrayList<ScopeValue>
private List<ObjectValue> objects;
private ScopeDesc(NMethod code, int decodeOffset, List objects, boolean reexecute) {
private ScopeDesc(NMethod code, int decodeOffset, List<ObjectValue> objects, boolean reexecute) {
this.code = code;
this.decodeOffset = decodeOffset;
this.objects = objects;
@ -93,22 +93,22 @@ public class ScopeDesc {
public boolean getReexecute() { return reexecute;}
/** Returns a List&lt;ScopeValue&gt; */
public List getLocals() {
public List<ScopeValue> getLocals() {
return decodeScopeValues(localsDecodeOffset);
}
/** Returns a List&lt;ScopeValue&gt; */
public List getExpressions() {
public List<ScopeValue> getExpressions() {
return decodeScopeValues(expressionsDecodeOffset);
}
/** Returns a List&lt;MonitorValue&gt; */
public List getMonitors() {
public List<MonitorValue> getMonitors() {
return decodeMonitorValues(monitorsDecodeOffset);
}
/** Returns a List&lt;ObjectValue&gt; */
public List getObjects() {
public List<ObjectValue> getObjects() {
return objects;
}
@ -166,13 +166,13 @@ public class ScopeDesc {
}
/** Returns a List&lt;ScopeValue&gt; or null if no values were present */
private List decodeScopeValues(int decodeOffset) {
private List<ScopeValue> decodeScopeValues(int decodeOffset) {
if (decodeOffset == DebugInformationRecorder.SERIALIZED_NULL) {
return null;
}
DebugInfoReadStream stream = streamAt(decodeOffset);
int length = stream.readInt();
List res = new ArrayList(length);
List<ScopeValue> res = new ArrayList<>(length);
for (int i = 0; i < length; i++) {
res.add(ScopeValue.readFrom(stream));
}
@ -180,13 +180,13 @@ public class ScopeDesc {
}
/** Returns a List&lt;MonitorValue&gt; or null if no values were present */
private List decodeMonitorValues(int decodeOffset) {
private List<MonitorValue> decodeMonitorValues(int decodeOffset) {
if (decodeOffset == DebugInformationRecorder.SERIALIZED_NULL) {
return null;
}
DebugInfoReadStream stream = streamAt(decodeOffset);
int length = stream.readInt();
List res = new ArrayList(length);
List<MonitorValue> res = new ArrayList<>(length);
for (int i = 0; i < length; i++) {
res.add(new MonitorValue(stream));
}
@ -194,11 +194,11 @@ public class ScopeDesc {
}
/** Returns a List&lt;ObjectValue&gt; or null if no values were present */
private List decodeObjectValues(int decodeOffset) {
private List<ObjectValue> decodeObjectValues(int decodeOffset) {
if (decodeOffset == DebugInformationRecorder.SERIALIZED_NULL) {
return null;
}
List res = new ArrayList();
List<ObjectValue> res = new ArrayList<>();
DebugInfoReadStream stream = new DebugInfoReadStream(code, decodeOffset, res);
int length = stream.readInt();
for (int i = 0; i < length; i++) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 StubQueue extends VMObject {
// The type of the contained stubs (i.e., InterpreterCodelet,
// ICStub). Must be a subclass of type Stub.
private Class stubType;
private Class<?> stubType;
static {
VM.registerVMInitializedObserver(new Observer() {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 @@ public interface Debugger extends SymbolLookup, ThreadAccess {
/** Provide a snapshot of the list of currently-running processes in
the form of a List of ProcessInfo objects. Must only be called
if hasProcessList(), above, returns true. */
public List getProcessList() throws DebuggerException;
public List<ProcessInfo> getProcessList() throws DebuggerException;
/** If an error occurs during attachment (i.e., "no such process"),
the thrown DebuggerException will contain a description of the

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,11 @@ class BsdCDebugger implements CDebugger {
this.dbg = dbg;
}
public List getThreadList() throws DebuggerException {
public List<ThreadProxy> getThreadList() throws DebuggerException {
return dbg.getThreadList();
}
public List/*<LoadObject>*/ getLoadObjectList() throws DebuggerException {
public List<LoadObject> getLoadObjectList() throws DebuggerException {
return dbg.getLoadObjectList();
}
@ -53,7 +53,7 @@ class BsdCDebugger implements CDebugger {
if (pc == null) {
return null;
}
List objs = getLoadObjectList();
List<LoadObject> objs = getLoadObjectList();
Object[] arr = objs.toArray();
// load objects are sorted by base address, do binary search
int mid = -1;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,8 +54,8 @@ public interface BsdDebugger extends JVMDebugger {
public Address newAddress(long value) throws DebuggerException;
// For BsdCDebugger
public List getThreadList();
public List getLoadObjectList();
public List<ThreadProxy> getThreadList();
public List<LoadObject> getLoadObjectList();
public ClosestSymbol lookup(long address);
// NOTE: this interface implicitly contains the following methods:

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 sun.jvm.hotspot.debugger.DebuggerUtilities;
import sun.jvm.hotspot.debugger.MachineDescription;
import sun.jvm.hotspot.debugger.NotInHeapException;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.debugger.ProcessInfo;
import sun.jvm.hotspot.debugger.ReadResult;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.UnalignedAddressException;
@ -75,8 +76,8 @@ public class BsdDebuggerLocal extends DebuggerBase implements BsdDebugger {
private BsdCDebugger cdbg;
// threadList and loadObjectList are filled by attach0 method
private List threadList;
private List loadObjectList;
private List<ThreadProxy> threadList;
private List<LoadObject> loadObjectList;
// called by native method lookupByAddress0
private ClosestSymbol createClosestSymbol(String name, long offset) {
@ -230,7 +231,7 @@ public class BsdDebuggerLocal extends DebuggerBase implements BsdDebugger {
}
/** From the Debugger interface via JVMDebugger */
public List getProcessList() throws DebuggerException {
public List<ProcessInfo> getProcessList() throws DebuggerException {
throw new DebuggerException("getProcessList not implemented yet");
}
@ -266,8 +267,8 @@ public class BsdDebuggerLocal extends DebuggerBase implements BsdDebugger {
/** From the Debugger interface via JVMDebugger */
public synchronized void attach(int processID) throws DebuggerException {
checkAttached();
threadList = new ArrayList();
loadObjectList = new ArrayList();
threadList = new ArrayList<>();
loadObjectList = new ArrayList<>();
class AttachTask implements WorkerThreadTask {
int pid;
public void doit(BsdDebuggerLocal debugger) {
@ -286,8 +287,8 @@ public class BsdDebuggerLocal extends DebuggerBase implements BsdDebugger {
/** From the Debugger interface via JVMDebugger */
public synchronized void attach(String execName, String coreName) {
checkAttached();
threadList = new ArrayList();
loadObjectList = new ArrayList();
threadList = new ArrayList<>();
loadObjectList = new ArrayList<>();
attach0(execName, coreName);
attached = true;
isCore = true;
@ -536,13 +537,13 @@ public class BsdDebuggerLocal extends DebuggerBase implements BsdDebugger {
}
/** From the BsdCDebugger interface */
public List/*<ThreadProxy>*/ getThreadList() {
public List<ThreadProxy> getThreadList() {
requireAttach();
return threadList;
}
/** From the BsdCDebugger interface */
public List/*<LoadObject>*/ getLoadObjectList() {
public List<LoadObject> getLoadObjectList() {
requireAttach();
return loadObjectList;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,13 +35,13 @@ public interface CDebugger {
ThreadProxy objects. Do not mutate this list. Throws
DebuggerException if the target process is not suspended (via
ProcessControl) or if the fetch failed for some other reason. */
public List/*<ThreadProxy>*/ getThreadList() throws DebuggerException;
public List<ThreadProxy> getThreadList() throws DebuggerException;
/** Return a list of LoadObjects in the target process. Do not
mutate this list. Throws DebuggerException if the target process
is not suspended (via ProcessControl) or if the fetch failed for
some other reason. */
public List/*<LoadObject>*/ getLoadObjectList() throws DebuggerException;
public List<LoadObject> getLoadObjectList() throws DebuggerException;
/** Fetch the loadobject containing the current program counter.
Returns null if the PC was outside the ranges of all loadobjects

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,10 +29,8 @@ import sun.jvm.hotspot.debugger.*;
// a comparator used to sort LoadObjects by base address
public class LoadObjectComparator implements Comparator {
public int compare(Object o1, Object o2) {
LoadObject lo1 = (LoadObject) o1;
LoadObject lo2 = (LoadObject) o2;
public class LoadObjectComparator implements Comparator<LoadObject> {
public int compare(LoadObject lo1, LoadObject lo2) {
Address base1 = lo1.getBase();
Address base2 = lo2.getBase();
long diff = base1.minus(base2);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,5 +29,5 @@ import java.util.*;
public interface TemplateType extends Type {
public int getNumTemplateArguments();
public Type instantiate(Type[] arguments);
public Type instantiate(List/*<Type>*/ arguments);
public Type instantiate(List<Type> arguments);
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,7 @@ public class BasicBlockSym extends BasicSym implements BlockSym {
private long length;
private Address addr;
private List locals;
private List<LocalSym> locals;
/** Creates a new BlockSym. Parent can be null. */
public BasicBlockSym(BlockSym parent, long length, Address addr, String name) {
@ -64,7 +64,7 @@ public class BasicBlockSym extends BasicSym implements BlockSym {
public void addLocal(LocalSym local) {
if (locals == null) {
locals = new ArrayList();
locals = new ArrayList<>();
}
locals.add(local);
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -43,27 +43,27 @@ public class BasicCDebugInfoDataBase implements CDebugInfoDataBase {
///////////
// Used only during construction
private Map lazyTypeMap;
private Map<Object, Type> lazyTypeMap;
// Used during construction and at run time for iteration
private List types;
private List<Type> types;
// Used only during runtime
private Map nameToTypeMap;
private Map<String, Type> nameToTypeMap;
/////////////
// Symbols //
/////////////
// Used only during construction
private Map lazySymMap;
private Map<Object, BlockSym> lazySymMap;
// List of blocks in increasing order by starting address. These can
// then be binary searched.
private List blocks;
private List<BlockSym> blocks;
// Name-to-global symbol table
private Map nameToSymMap;
private Map<String, GlobalSym> nameToSymMap;
//////////////////
// Line numbers //
@ -85,13 +85,13 @@ public class BasicCDebugInfoDataBase implements CDebugInfoDataBase {
state = CONSTRUCTION_STATE;
// Types
lazyTypeMap = new HashMap();
types = new ArrayList();
lazyTypeMap = new HashMap<>();
types = new ArrayList<>();
// Symbols
lazySymMap = new HashMap();
blocks = new ArrayList();
nameToSymMap = new HashMap();
lazySymMap = new HashMap<>();
blocks = new ArrayList<>();
nameToSymMap = new HashMap<>();
// Line numbers
lineNumbers = new BasicLineNumberMapping();
@ -119,7 +119,7 @@ public class BasicCDebugInfoDataBase implements CDebugInfoDataBase {
// Go through all types in lazyTypeMap and types.
// Resolve all LazyTypes.
resolveLazyMap(listener);
for (ListIterator iter = types.listIterator(); iter.hasNext(); ) {
for (ListIterator<Type> iter = types.listIterator(); iter.hasNext(); ) {
BasicType t = (BasicType) iter.next();
BasicType t2 = (BasicType) t.resolveTypes(this, listener);
if (t != t2) {
@ -137,10 +137,8 @@ public class BasicCDebugInfoDataBase implements CDebugInfoDataBase {
// Sort blocks in ascending order of starting address (but do not
// change ordering among blocks with the same starting address)
Collections.sort(blocks, new Comparator() {
public int compare(Object o1, Object o2) {
BlockSym b1 = (BlockSym) o1;
BlockSym b2 = (BlockSym) o2;
Collections.sort(blocks, new Comparator<>() {
public int compare(BlockSym b1, BlockSym b2) {
Address a1 = b1.getAddress();
Address a2 = b2.getAddress();
if (AddressOps.lt(a1, a2)) { return -1; }
@ -157,11 +155,11 @@ public class BasicCDebugInfoDataBase implements CDebugInfoDataBase {
Assert.that(state == RESOLVED_STATE, "wrong state");
}
// Move all types to type list
for (Iterator iter = lazyTypeMap.values().iterator(); iter.hasNext(); ) {
for (Iterator<Type> iter = lazyTypeMap.values().iterator(); iter.hasNext(); ) {
types.add(iter.next());
}
// Build name-to-type map
nameToTypeMap = new HashMap();
nameToTypeMap = new HashMap<>();
for (Iterator iter = types.iterator(); iter.hasNext(); ) {
Type t = (Type) iter.next();
if (!t.isConst() && !t.isVolatile()) {
@ -337,8 +335,8 @@ public class BasicCDebugInfoDataBase implements CDebugInfoDataBase {
}
private void resolveLazyMap(ResolveListener listener) {
for (Iterator iter = lazyTypeMap.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry) iter.next();
for (Iterator<Map.Entry<Object, Type>> iter = lazyTypeMap.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry<Object, Type> entry = iter.next();
BasicType t = (BasicType) entry.getValue();
BasicType t2 = (BasicType) t.resolveTypes(this, listener);
if (t2 != t) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,8 +31,8 @@ import sun.jvm.hotspot.utilities.Assert;
public class BasicCompoundType extends BasicType implements CompoundType {
private CompoundTypeKind kind;
private List baseClasses;
private List fields;
private List<BaseClass> baseClasses;
private List<Field> fields;
public BasicCompoundType(String name, int size, CompoundTypeKind kind) {
this(name, size, kind, 0);
@ -57,7 +57,7 @@ public class BasicCompoundType extends BasicType implements CompoundType {
public void addBaseClass(BaseClass b) {
if (baseClasses == null) {
baseClasses = new ArrayList();
baseClasses = new ArrayList<>();
}
baseClasses.add(b);
}
@ -71,7 +71,7 @@ public class BasicCompoundType extends BasicType implements CompoundType {
public void addField(Field f) {
if (fields == null) {
fields = new ArrayList();
fields = new ArrayList<>();
}
fields.add(f);
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,7 +44,7 @@ public class BasicEnumType extends BasicIntType implements EnumType {
String getName() { return name; }
long getValue() { return value; }
}
private List/*<Enum>*/ enums;
private List<Enum> enums;
/** Underlying type of enum must be an integer type (or as yet
unresolved) */
@ -70,7 +70,7 @@ public class BasicEnumType extends BasicIntType implements EnumType {
public void addEnum(String name, long val) {
if (enums == null) {
enums = new ArrayList();
enums = new ArrayList<>();
}
enums.add(new Enum(name, val));
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 @@ import sun.jvm.hotspot.debugger.cdbg.*;
public class BasicFunctionType extends BasicType implements FunctionType {
private Type returnType;
private List argumentTypes;
private List<Type> argumentTypes;
public BasicFunctionType(String name, int size, Type returnType) {
this(name, size, returnType, 0);
@ -51,7 +51,7 @@ public class BasicFunctionType extends BasicType implements FunctionType {
}
public void addArgumentType(Type t) {
if (argumentTypes == null) {
argumentTypes = new ArrayList();
argumentTypes = new ArrayList<>();
}
argumentTypes.add(t);
}
@ -60,8 +60,8 @@ public class BasicFunctionType extends BasicType implements FunctionType {
super.resolveTypes(db, listener);
returnType = db.resolveType(this, returnType, listener, "resolving function return type");
if (argumentTypes != null) {
for (ListIterator iter = argumentTypes.listIterator(); iter.hasNext(); ) {
iter.set(db.resolveType(this, (Type) iter.next(), listener, "resolving function argument types"));
for (ListIterator<Type> iter = argumentTypes.listIterator(); iter.hasNext(); ) {
iter.set(db.resolveType(this, iter.next(), listener, "resolving function argument types"));
}
}
return this;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 @@ import sun.jvm.hotspot.debugger.cdbg.*;
import sun.jvm.hotspot.utilities.AddressOps;
public class BasicLineNumberMapping {
private List infoList;
private List<BasicLineNumberInfo> infoList;
public BasicLineNumberMapping() {
}
@ -41,7 +41,7 @@ public class BasicLineNumberMapping {
recomputeEndPCs() will recompute them if needed. */
public void addLineNumberInfo(BasicLineNumberInfo info) {
if (infoList == null) {
infoList = new ArrayList();
infoList = new ArrayList<>();
}
infoList.add(info);
}
@ -50,10 +50,8 @@ public class BasicLineNumberMapping {
counter. This must be done before any queries are made. */
public void sort() {
if (infoList == null) return;
Collections.sort(infoList, new Comparator() {
public int compare(Object o1, Object o2) {
BasicLineNumberInfo l1 = (BasicLineNumberInfo) o1;
BasicLineNumberInfo l2 = (BasicLineNumberInfo) o2;
Collections.sort(infoList, new Comparator<>() {
public int compare(BasicLineNumberInfo l1, BasicLineNumberInfo l2) {
Address a1 = l1.getStartPC();
Address a2 = l2.getStartPC();
if (AddressOps.lt(a1, a2)) { return -1; }

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 @@ public abstract class BasicType implements Type, CVAttributes {
private int size;
private int cvAttributes;
// Types keep a list of const/volatile qualified variants of themselves
private List cvVariants;
private List<Type> cvVariants;
protected BasicType(String name, int size) {
this(name, size, 0);
@ -83,8 +83,8 @@ public abstract class BasicType implements Type, CVAttributes {
Type resolveTypes(BasicCDebugInfoDataBase db, ResolveListener listener) {
if (cvVariants != null) {
for (ListIterator iter = cvVariants.listIterator(); iter.hasNext(); ) {
iter.set(db.resolveType(this, (BasicType) iter.next(), listener, "resolving const/var variants"));
for (ListIterator<Type> iter = cvVariants.listIterator(); iter.hasNext(); ) {
iter.set(db.resolveType(this, iter.next(), listener, "resolving const/var variants"));
}
}
return this;
@ -110,7 +110,7 @@ public abstract class BasicType implements Type, CVAttributes {
protected abstract Type createCVVariant(int cvAttributes);
protected Type findCVVariant(int cvAttributes) {
if (cvVariants != null) {
for (Iterator iter = cvVariants.iterator(); iter.hasNext(); ) {
for (Iterator<Type> iter = cvVariants.iterator(); iter.hasNext(); ) {
BasicType t = (BasicType) iter.next();
if (t.getCVAttributes() == cvAttributes) return t;
}
@ -119,7 +119,7 @@ public abstract class BasicType implements Type, CVAttributes {
}
protected void addCVVariant(Type t) {
if (cvVariants == null) {
cvVariants = new ArrayList();
cvVariants = new ArrayList<>();
}
cvVariants.add(t);
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 @@ public class DummyDebugger extends DebuggerBase {
return false;
}
public List getProcessList() throws DebuggerException {
public List<ProcessInfo> getProcessList() throws DebuggerException {
return null;
}

@ -49,11 +49,11 @@ class LinuxCDebugger implements CDebugger {
this.dbg = dbg;
}
public List getThreadList() throws DebuggerException {
public List<ThreadProxy> getThreadList() throws DebuggerException {
return dbg.getThreadList();
}
public List/*<LoadObject>*/ getLoadObjectList() throws DebuggerException {
public List<LoadObject> getLoadObjectList() throws DebuggerException {
return dbg.getLoadObjectList();
}
@ -65,7 +65,7 @@ class LinuxCDebugger implements CDebugger {
/* Typically we have about ten loaded objects here. So no reason to do
sort/binary search here. Linear search gives us acceptable performance.*/
List objs = getLoadObjectList();
List<LoadObject> objs = getLoadObjectList();
for (int i = 0; i < objs.size(); i++) {
LoadObject ob = (LoadObject) objs.get(i);

@ -55,8 +55,8 @@ public interface LinuxDebugger extends JVMDebugger {
public Address findLibPtrByAddress(Address pc);
// For LinuxCDebugger
public List getThreadList();
public List getLoadObjectList();
public List<ThreadProxy> getThreadList();
public List<LoadObject> getLoadObjectList();
public ClosestSymbol lookup(long address);
public String demangle(String sym);

@ -43,6 +43,7 @@ import sun.jvm.hotspot.debugger.DebuggerUtilities;
import sun.jvm.hotspot.debugger.MachineDescription;
import sun.jvm.hotspot.debugger.NotInHeapException;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.debugger.ProcessInfo;
import sun.jvm.hotspot.debugger.ReadResult;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.UnalignedAddressException;
@ -77,8 +78,8 @@ public class LinuxDebuggerLocal extends DebuggerBase implements LinuxDebugger {
private LinuxCDebugger cdbg;
// threadList and loadObjectList are filled by attach0 method
private List threadList;
private List loadObjectList;
private List<ThreadProxy> threadList;
private List<LoadObject> loadObjectList;
// PID namespace support
// It maps the LWPID in the host to the LWPID in the container.
@ -248,7 +249,7 @@ public class LinuxDebuggerLocal extends DebuggerBase implements LinuxDebugger {
}
/** From the Debugger interface via JVMDebugger */
public List getProcessList() throws DebuggerException {
public List<ProcessInfo> getProcessList() throws DebuggerException {
throw new DebuggerException("getProcessList not implemented yet");
}
@ -317,8 +318,8 @@ public class LinuxDebuggerLocal extends DebuggerBase implements LinuxDebugger {
/** From the Debugger interface via JVMDebugger */
public synchronized void attach(int processID) throws DebuggerException {
checkAttached();
threadList = new ArrayList();
loadObjectList = new ArrayList();
threadList = new ArrayList<>();
loadObjectList = new ArrayList<>();
Path proc = Paths.get("/proc", Integer.toString(processID));
int NSpid = getNamespacePID(Paths.get(proc.toString(), "status"));
@ -349,8 +350,8 @@ public class LinuxDebuggerLocal extends DebuggerBase implements LinuxDebugger {
/** From the Debugger interface via JVMDebugger */
public synchronized void attach(String execName, String coreName) {
checkAttached();
threadList = new ArrayList();
loadObjectList = new ArrayList();
threadList = new ArrayList<>();
loadObjectList = new ArrayList<>();
attach0(execName, coreName);
attached = true;
isCore = true;
@ -593,13 +594,13 @@ public class LinuxDebuggerLocal extends DebuggerBase implements LinuxDebugger {
}
/** From the LinuxCDebugger interface */
public List/*<ThreadProxy>*/ getThreadList() {
public List<ThreadProxy> getThreadList() {
requireAttach();
return threadList;
}
/** From the LinuxCDebugger interface */
public List/*<LoadObject>*/ getLoadObjectList() {
public List<LoadObject> getLoadObjectList() {
requireAttach();
return loadObjectList;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,11 +37,11 @@ class ProcCDebugger implements CDebugger {
this.dbg = dbg;
}
public List getThreadList() throws DebuggerException {
public List<ThreadProxy> getThreadList() throws DebuggerException {
return dbg.getThreadList();
}
public List/*<LoadObject>*/ getLoadObjectList() throws DebuggerException {
public List<LoadObject> getLoadObjectList() throws DebuggerException {
return dbg.getLoadObjectList();
}
@ -49,7 +49,7 @@ class ProcCDebugger implements CDebugger {
if (pc == null) {
return null;
}
List objs = getLoadObjectList();
List<LoadObject> objs = getLoadObjectList();
Object[] arr = objs.toArray();
// load objects are sorted by base address, do binary search
int mid = -1;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -55,8 +55,8 @@ public interface ProcDebugger extends JVMDebugger {
public Address newAddress(long value) throws DebuggerException;
// for ProcCDebugger, ProcCFrame and SharedObject
public List getThreadList() throws DebuggerException;
public List getLoadObjectList() throws DebuggerException;
public List<ThreadProxy> getThreadList() throws DebuggerException;
public List<LoadObject> getLoadObjectList() throws DebuggerException;
public CFrame topFrameForThread(ThreadProxy thread) throws DebuggerException;
public ClosestSymbol lookup(long address) throws DebuggerException;
public String demangle(String name);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 ProcDebuggerLocal extends DebuggerBase implements ProcDebugger {
return false;
}
public List getProcessList() throws DebuggerException {
public List<ProcessInfo> getProcessList() throws DebuggerException {
throw new DebuggerException("Not yet supported");
}
@ -153,7 +153,7 @@ public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger {
(String executableName, String coreFileName) throws DebuggerException {
checkAttached();
isCore = true;
topFrameCache = new HashMap();
topFrameCache = new HashMap<>();
attach0(executableName, coreFileName);
attached = true;
suspended = true;
@ -439,13 +439,13 @@ public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger {
}
/** From the ProcDebugger interface */
public synchronized List getThreadList() throws DebuggerException {
public synchronized List<ThreadProxy> getThreadList() throws DebuggerException {
requireAttach();
List res = null;
List<ThreadProxy> res = null;
if (isCore && (threadListCache != null)) {
res = threadListCache;
} else {
res = new ArrayList();
res = new ArrayList<>();
fillThreadList0(res);
if (isCore) {
threadListCache = res;
@ -455,7 +455,7 @@ public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger {
}
/** From the ProcDebugger interface */
public synchronized List getLoadObjectList() throws DebuggerException {
public synchronized List<LoadObject> getLoadObjectList() throws DebuggerException {
requireAttach();
if (!suspended) {
throw new DebuggerException("Process not suspended");
@ -505,16 +505,16 @@ public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger {
//
private void updateLoadObjectCache() {
List res = new ArrayList();
nameToDsoMap = new HashMap();
List<LoadObject> res = new ArrayList<>();
nameToDsoMap = new HashMap<>();
fillLoadObjectList0(res);
loadObjectCache = sortLoadObjects(res);
}
// sort load objects by base address
private static List sortLoadObjects(List in) {
private static List<LoadObject> sortLoadObjects(List<LoadObject> in) {
// sort the list by base address
Object[] arr = in.toArray();
LoadObject[] arr = in.toArray(new LoadObject[0]);
Arrays.sort(arr, loadObjectComparator);
return Arrays.asList(arr);
}
@ -614,7 +614,7 @@ public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger {
// threads, stacks
private native long[] getThreadIntegerRegisterSet0(long tid) throws DebuggerException;
private native void fillThreadList0(List l) throws DebuggerException;
private native void fillThreadList0(List<ThreadProxy> l) throws DebuggerException;
// fills stack frame list given reg set of the top frame and top frame
private native ProcCFrame fillCFrameList0(long[] regs) throws DebuggerException;
@ -629,7 +629,7 @@ public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger {
}
// shared objects
private native void fillLoadObjectList0(List l) throws DebuggerException;
private native void fillLoadObjectList0(List<LoadObject> l) throws DebuggerException;
// helper called by fillLoadObjectList0
private LoadObject createLoadObject(String fileName, long textsize, long base) {
@ -689,10 +689,10 @@ public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger {
// Symbol lookup support
// This is a map of library names to DSOs
private Map nameToDsoMap; // Map<String, SharedObject>
private Map<String, SharedObject> nameToDsoMap;
// C/C++ debugging support
private List/*<LoadObject>*/ loadObjects;
private List<LoadObject> loadObjects;
private CDebugger cdbg;
// ProcessControl support
@ -722,7 +722,7 @@ public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger {
// for core files, we cache load object list, thread list, top frames etc.
// for processes we cache load object list and sync. it during suspend.
private List threadListCache;
private List loadObjectCache;
private Map topFrameCache; // Map<ThreadProxy, CFrame>
private List<ThreadProxy> threadListCache;
private List<LoadObject> loadObjectCache;
private Map<ThreadProxy, CFrame> topFrameCache;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 RemoteDebuggerClient extends DebuggerBase implements JVMDebugger {
}
/** Unimplemented in this class (remote remoteDebugger should already be attached) */
public List getProcessList() throws DebuggerException {
public List<ProcessInfo> getProcessList() throws DebuggerException {
throw new DebuggerException("Should not be called on RemoteDebuggerClient");
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1427,14 +1427,14 @@ public class COFFFileParser {
names = new MemoizedObject() {
public Object computeValue() {
int i = 0;
List data = new ArrayList();
List<String> data = new ArrayList<>();
while (i < size) {
String s = readCString();
data.add(s);
i += s.length();
}
String[] res = new String[data.size()];
res = (String[]) data.toArray(res);
res = data.toArray(res);
return res;
}
};
@ -3775,10 +3775,8 @@ public class COFFFileParser {
/** This version takes an absolute offset in the file */
String getAtOffset(int offset) {
int i = Arrays.binarySearch(strings, new COFFString(null, offset),
new Comparator() {
public int compare(Object o1, Object o2) {
COFFString s1 = (COFFString) o1;
COFFString s2 = (COFFString) o2;
new Comparator<>() {
public int compare(COFFString s1, COFFString s2) {
if (s1.offset == s2.offset) {
return 0;
} else if (s1.offset < s2.offset) {
@ -3905,14 +3903,14 @@ public class COFFFileParser {
}
String readCString() throws COFFException {
List data = new ArrayList();
List<Byte> data = new ArrayList<>();
byte b = 0;
while ((b = readByte()) != 0) {
data.add(new Byte(b));
data.add(b);
}
byte[] bytes = new byte[data.size()];
for (int i = 0; i < data.size(); i++) {
bytes[i] = ((Byte) data.get(i)).byteValue();
bytes[i] = (data.get(i)).byteValue();
}
try {
return new String(bytes, US_ASCII);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,13 +48,13 @@ class WindbgCDebugInfoBuilder
private DebugVC50SSSegMap segMap;
// Canonicalization of primitive types
private Map primIndexToTypeMap;
private Map<Integer, BasicType> primIndexToTypeMap;
// Global unnamed enumeration
// (FIXME: must figure out how to handle nested type descriptions)
private BasicEnumType unnamedEnum;
private Stack blockStack;
private Stack<BlockSym> blockStack;
private int endsToSkip;
private static final int POINTER_SIZE = 4;
@ -72,8 +72,8 @@ class WindbgCDebugInfoBuilder
segMap = getSegMap();
primIndexToTypeMap = new HashMap();
blockStack = new Stack();
primIndexToTypeMap = new HashMap<>();
blockStack = new Stack<>();
endsToSkip = 0;
db = new BasicCDebugInfoDataBase();

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,11 +44,11 @@ class WindbgCDebugger implements CDebugger {
this.dbg = dbg;
}
public List getThreadList() throws DebuggerException {
public List<ThreadProxy> getThreadList() throws DebuggerException {
return dbg.getThreadList();
}
public List/*<LoadObject>*/ getLoadObjectList() throws DebuggerException{
public List<LoadObject> getLoadObjectList() throws DebuggerException{
return dbg.getLoadObjectList();
}
@ -58,7 +58,7 @@ class WindbgCDebugger implements CDebugger {
if (pc == null) {
return null;
}
List objs = getLoadObjectList();
List<LoadObject> objs = getLoadObjectList();
for (Iterator iter = objs.iterator(); iter.hasNext(); ) {
LoadObject obj = (LoadObject) iter.next();
if (AddressOps.lte(obj.getBase(), pc) && (pc.minus(obj.getBase()) < obj.getSize())) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -60,11 +60,11 @@ public interface WindbgDebugger extends JVMDebugger {
public long getThreadIdFromSysId(long sysId) throws DebuggerException;
// Support for the CDebugger interface. Retrieves the thread list of
// the target process as a List of ThreadProxy objects.
public List/*<ThreadProxy>*/ getThreadList() throws DebuggerException;
public List<ThreadProxy> getThreadList() throws DebuggerException;
// Support for the CDebugger interface. Retrieves a List of the
// loadobjects in the target process.
public List/*<LoadObject>*/ getLoadObjectList() throws DebuggerException;
public List<LoadObject> getLoadObjectList() throws DebuggerException;
// NOTE: this interface implicitly contains the following methods:
// From the Debugger interface via JVMDebugger

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -59,15 +59,15 @@ public class WindbgDebuggerLocal extends DebuggerBase implements WindbgDebugger
// Symbol lookup support
// This is a map of library names to DLLs
private Map nameToDllMap;
private Map<String, DLL> nameToDllMap;
// C/C++ debugging support
private List/*<LoadObject>*/ loadObjects;
private List<LoadObject> loadObjects;
private CDebugger cdbg;
// thread access
private Map threadIntegerRegisterSet;
private List threadList;
private Map<Long, long[]> threadIntegerRegisterSet;
private List<ThreadProxy> threadList;
// windbg native interface pointers
@ -137,7 +137,7 @@ public class WindbgDebuggerLocal extends DebuggerBase implements WindbgDebugger
}
/** From the Debugger interface via JVMDebugger */
public List getProcessList() throws DebuggerException {
public List<ProcessInfo> getProcessList() throws DebuggerException {
return null;
}
@ -158,7 +158,7 @@ public class WindbgDebuggerLocal extends DebuggerBase implements WindbgDebugger
isCore = true;
}
public List getLoadObjectList() {
public List<LoadObject> getLoadObjectList() {
requireAttach();
return loadObjects;
}
@ -354,7 +354,7 @@ public class WindbgDebuggerLocal extends DebuggerBase implements WindbgDebugger
return (long[]) threadIntegerRegisterSet.get(new Long(threadId));
}
public synchronized List getThreadList() throws DebuggerException {
public synchronized List<ThreadProxy> getThreadList() throws DebuggerException {
requireAttach();
return threadList;
}
@ -438,10 +438,10 @@ public class WindbgDebuggerLocal extends DebuggerBase implements WindbgDebugger
private void attachInit() {
checkAttached();
loadObjects = new ArrayList();
nameToDllMap = new HashMap();
threadIntegerRegisterSet = new HashMap();
threadList = new ArrayList();
loadObjects = new ArrayList<>();
nameToDllMap = new HashMap<>();
threadIntegerRegisterSet = new HashMap<>();
threadList = new ArrayList<>();
}
private void resetNativePointers() {
@ -539,7 +539,7 @@ public class WindbgDebuggerLocal extends DebuggerBase implements WindbgDebugger
String dbgengPath = null;
String dbghelpPath = null;
String saprocPath = null;
List searchList = new ArrayList();
List<String> searchList = new ArrayList<>();
boolean loadLibraryDEBUG =
System.getProperty("sun.jvm.hotspot.loadLibrary.DEBUG") != null;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* 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.utilities.*;
public class BytecodeDisassembler {
private Method method;
private static Map bytecode2Class = new HashMap(); // Map<int, Class>
private static Map<Integer, Class> bytecode2Class = new HashMap<>();
private static void addBytecodeClass(int bytecode, Class clazz) {
bytecode2Class.put(new Integer(bytecode), clazz);
@ -116,7 +116,7 @@ public class BytecodeDisassembler {
// look for special Bytecode class
int bci = stream.bci();
int hotspotcode = method.getBytecodeOrBPAt(bci);
Class clazz = getBytecodeClass(javacode);
Class<?> clazz = getBytecodeClass(javacode);
if (clazz == null) {
// check for fast_(i|a)_access_0
clazz = getBytecodeClass(hotspotcode);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,7 +65,7 @@ class OopMapForCacheEntry extends GenerateOopMap {
}
}
public void fillInitVars(List/*<Integer>*/ initVars) {
public void fillInitVars(List<Integer> initVars) {
// Do nothing
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,7 @@ public class Dictionary extends sun.jvm.hotspot.utilities.Hashtable {
// this is overriden here so that Hashtable.bucket will return
// object of DictionaryEntry.class
protected Class getHashtableEntryClass() {
protected Class<? extends HashtableEntry> getHashtableEntryClass() {
return DictionaryEntry.class;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,6 +40,7 @@ import sun.jvm.hotspot.gc.z.ZCollectedHeap;
import sun.jvm.hotspot.oops.Oop;
import sun.jvm.hotspot.runtime.BasicType;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.VMObject;
import sun.jvm.hotspot.runtime.VirtualConstructor;
import sun.jvm.hotspot.types.AddressField;
import sun.jvm.hotspot.types.CIntegerField;
@ -70,7 +71,7 @@ public class Universe {
return true;
}
private static void addHeapTypeIfInDB(TypeDataBase db, Class heapClass) {
private static void addHeapTypeIfInDB(TypeDataBase db, Class<? extends VMObject> heapClass) {
String heapName = heapClass.getSimpleName();
if (typeExists(db, heapName)) {
heapConstructor.addMapping(heapName, heapClass);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 @@ import java.util.*;
/** Auxiliary class for GenerateOopMap */
public class CellTypeStateList {
public CellTypeStateList(int size) {
list = new ArrayList(size);
list = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
list.add(i, CellTypeState.makeBottom());
}
@ -40,7 +40,7 @@ public class CellTypeStateList {
}
public CellTypeState get(int i) {
return (CellTypeState) list.get(i);
return list.get(i);
}
public CellTypeStateList subList(int fromIndex, int toIndex) {
@ -48,8 +48,8 @@ public class CellTypeStateList {
}
//----------------------------------------------------------------------
private List list;
private CellTypeStateList(List list) {
private List<CellTypeState> list;
private CellTypeStateList(List<CellTypeState> list) {
this.list = list;
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -539,7 +539,7 @@ public class ConstantPool extends Metadata implements ClassConstants {
public void writeBytes(OutputStream os) throws IOException {
// Map between any modified UTF-8 and it's constant pool index.
Map utf8ToIndex = new HashMap();
Map<String, Short> utf8ToIndex = new HashMap<>();
DataOutputStream dos = new DataOutputStream(os);
U1Array tags = getTags();
int len = (int)getLength();

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -168,19 +168,19 @@ public class GenerateOopMap {
static class RetTableEntry {
private static int _init_nof_jsrs; // Default size of jsrs list
private int _target_bci; // Target PC address of jump (bytecode index)
private List/*<int>*/ _jsrs; // List of return addresses (bytecode index)
private List<Integer> _jsrs; // List of return addresses (bytecode index)
private RetTableEntry _next; // Link to next entry
RetTableEntry(int target, RetTableEntry next) {
_target_bci = target;
_jsrs = new ArrayList(_init_nof_jsrs);
_jsrs = new ArrayList<>(_init_nof_jsrs);
_next = next;
}
// Query
int targetBci() { return _target_bci; }
int nofJsrs() { return _jsrs.size(); }
int jsrs(int i) { return ((Integer) _jsrs.get(i)).intValue(); }
int jsrs(int i) { return _jsrs.get(i).intValue(); }
// Update entry
void addJsr (int return_bci) { _jsrs.add(new Integer(return_bci)); }
@ -1926,11 +1926,11 @@ public class GenerateOopMap {
}
// Initvars
List/*<Integer>*/ _init_vars;
List<Integer> _init_vars;
void initializeVars () {
for (int k = 0; k < _init_vars.size(); k++)
_state.get(((Integer) _init_vars.get(k)).intValue()).set(CellTypeState.makeSlotRef(k));
_state.get((_init_vars.get(k)).intValue()).set(CellTypeState.makeSlotRef(k));
}
void addToRefInitSet (int localNo) {
@ -2155,7 +2155,7 @@ public class GenerateOopMap {
_max_stack = (int) method().getMaxStack();
_has_exceptions = (method().hasExceptionTable());
_nof_refval_conflicts = 0;
_init_vars = new ArrayList(5); // There are seldom more than 5 init_vars
_init_vars = new ArrayList<>(5); // There are seldom more than 5 init_vars
_report_result = false;
_report_result_for_send = false;
_report_for_exit_bci = -1;
@ -2314,5 +2314,5 @@ public class GenerateOopMap {
CellTypeStateList vars,
CellTypeStateList stack,
int stackTop) { throw new RuntimeException("ShouldNotReachHere"); }
public void fillInitVars (List/*<Integer>*/ init_vars) { throw new RuntimeException("ShouldNotReachHere"); }
public void fillInitVars (List<Integer> init_vars) { throw new RuntimeException("ShouldNotReachHere"); }
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -682,14 +682,14 @@ public class InstanceKlass extends Klass {
public Field[] getStaticFields() {
U2Array fields = getFields();
int length = getJavaFieldsCount();
ArrayList result = new ArrayList();
ArrayList<Field> result = new ArrayList<>();
for (int index = 0; index < length; index++) {
Field f = newField(index);
if (f.isStatic()) {
result.add(f);
}
}
return (Field[])result.toArray(new Field[result.size()]);
return result.toArray(new Field[result.size()]);
}
public void iterateNonStaticFields(OopVisitor visitor, Oop obj) {
@ -784,11 +784,11 @@ public class InstanceKlass extends Klass {
Inherited fields are not included.
Return an empty list if there are no fields declared in this class.
Only designed for use in a debugging system. */
public List getImmediateFields() {
public List<Field> getImmediateFields() {
// A list of Fields for each field declared in this class/interface,
// not including inherited fields.
int length = getJavaFieldsCount();
List immediateFields = new ArrayList(length);
List<Field> immediateFields = new ArrayList<>(length);
for (int index = 0; index < length; index++) {
immediateFields.add(getFieldByIndex(index));
}
@ -802,10 +802,10 @@ public class InstanceKlass extends Klass {
the same name.
Return an empty list if there are no fields.
Only designed for use in a debugging system. */
public List getAllFields() {
public List<Field> getAllFields() {
// Contains a Field for each field in this class, including immediate
// fields and inherited fields.
List allFields = getImmediateFields();
List<Field> allFields = getImmediateFields();
// transitiveInterfaces contains all interfaces implemented
// by this class and its superclass chain with no duplicates.
@ -838,13 +838,13 @@ public class InstanceKlass extends Klass {
Return an empty list if there are none, or if this isn't a class/
interface.
*/
public List getImmediateMethods() {
public List<Method> getImmediateMethods() {
// Contains a Method for each method declared in this class/interface
// not including inherited methods.
MethodArray methods = getMethods();
int length = methods.length();
Object[] tmp = new Object[length];
Method[] tmp = new Method[length];
IntArray methodOrdering = getMethodOrdering();
if (methodOrdering.length() != length) {
@ -865,13 +865,13 @@ public class InstanceKlass extends Klass {
/** Return a List containing an SA InstanceKlass for each
interface named in this class's 'implements' clause.
*/
public List getDirectImplementedInterfaces() {
public List<Klass> getDirectImplementedInterfaces() {
// Contains an InstanceKlass for each interface in this classes
// 'implements' clause.
KlassArray interfaces = getLocalInterfaces();
int length = interfaces.length();
List directImplementedInterfaces = new ArrayList(length);
List<Klass> directImplementedInterfaces = new ArrayList<>(length);
for (int index = 0; index < length; index ++) {
directImplementedInterfaces.add(interfaces.getAt(index));

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 ObjectHeap {
extremely low level (stepping word-by-word) to provide the
ability to do very low-level debugging */
public void iterateRaw(RawHeapVisitor visitor) {
List liveRegions = collectLiveRegions();
List<Address> liveRegions = collectLiveRegions();
// Summarize size
long totalSize = 0;
@ -223,7 +223,7 @@ public class ObjectHeap {
});
}
private void iterateLiveRegions(List liveRegions, HeapVisitor visitor, ObjectFilter of) {
private void iterateLiveRegions(List<Address> liveRegions, HeapVisitor visitor, ObjectFilter of) {
// Summarize size
long totalSize = 0;
for (int i = 0; i < liveRegions.size(); i += 2) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,16 +29,16 @@ import java.util.*;
public class ObjectHistogram implements HeapVisitor {
public ObjectHistogram() { map = new HashMap(); }
public ObjectHistogram() { map = new HashMap<>(); }
private HashMap map;
private HashMap<Klass, ObjectHistogramElement> map;
public void prologue(long size) {}
public boolean doObj(Oop obj) {
Klass klass = obj.getKlass();
if (!map.containsKey(klass)) map.put(klass, new ObjectHistogramElement(klass));
((ObjectHistogramElement) map.get(klass)).updateWith(obj);
map.get(klass).updateWith(obj);
return false;
}
@ -46,13 +46,13 @@ public class ObjectHistogram implements HeapVisitor {
/** Call this after the iteration is complete to obtain the
ObjectHistogramElements in descending order of total heap size
consumed in the form of a List<ObjectHistogramElement>. */
public List getElements() {
List list = new ArrayList();
consumed. */
public List<ObjectHistogramElement> getElements() {
List<ObjectHistogramElement> list = new ArrayList<>();
list.addAll(map.values());
Collections.sort(list, new Comparator() {
public int compare(Object o1, Object o2) {
return ((ObjectHistogramElement) o1).compare((ObjectHistogramElement) o2);
Collections.sort(list, new Comparator<>() {
public int compare(ObjectHistogramElement o1, ObjectHistogramElement o2) {
return o1.compare(o2);
}
});
return list;
@ -61,14 +61,14 @@ public class ObjectHistogram implements HeapVisitor {
public void print() { printOn(System.out); }
public void printOn(PrintStream tty) {
List list = getElements();
List<ObjectHistogramElement> list = getElements();
ObjectHistogramElement.titleOn(tty);
Iterator iterator = list.listIterator();
Iterator<ObjectHistogramElement> iterator = list.listIterator();
int num=0;
int totalCount=0;
int totalSize=0;
while (iterator.hasNext()) {
ObjectHistogramElement el = (ObjectHistogramElement) iterator.next();
ObjectHistogramElement el = iterator.next();
num++;
totalCount+=el.getCount();
totalSize+=el.getSize();

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,7 @@ import sun.jvm.hotspot.utilities.*;
// A VirtualCallTypeData is used to access profiling information about
// a virtual call for which we collect type information about
// arguments and return value.
public class VirtualCallTypeData<K,M> extends VirtualCallData implements CallTypeDataInterface<K> {
public class VirtualCallTypeData<K,M> extends VirtualCallData<K,M> implements CallTypeDataInterface<K> {
final TypeStackSlotEntries<K,M> args;
final ReturnTypeEntry<K,M> ret;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -55,7 +55,7 @@ public class InlineTree extends VMObject {
private static AddressField callerTreeField;
private static AddressField subtreesField;
private static StaticBaseConstructor inlineTreeConstructor = new StaticBaseConstructor<InlineTree>(InlineTree.class);
private static StaticBaseConstructor<InlineTree> inlineTreeConstructor = new StaticBaseConstructor<>(InlineTree.class);
public InlineTree(Address addr) {
super(addr);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 Node extends VMObject {
nodeType = db.lookupType("Node");
virtualConstructor = new VirtualBaseConstructor(db, nodeType, "sun.jvm.hotspot.opto", Node.class);
virtualConstructor = new VirtualBaseConstructor<>(db, nodeType, "sun.jvm.hotspot.opto", Node.class);
}
private static CIntField outmaxField;
@ -64,11 +64,11 @@ public class Node extends VMObject {
private static AddressField outField;
private static AddressField inField;
private static VirtualBaseConstructor virtualConstructor;
private static VirtualBaseConstructor<Node> virtualConstructor;
private static Type nodeType;
static HashMap nodes = new HashMap();
static HashMap<Address, Node> nodes = new HashMap<>();
static HashMap constructors = new HashMap();
@ -78,7 +78,7 @@ public class Node extends VMObject {
static public Node create(Address addr) {
if (addr == null) return null;
Node result = (Node)nodes.get(addr);
Node result = nodes.get(addr);
if (result == null) {
result = (Node)virtualConstructor.instantiateWrapperFor(addr);
nodes.put(addr, result);
@ -133,9 +133,9 @@ public class Node extends VMObject {
return _in[i];
}
public ArrayList collect(int d, boolean onlyCtrl) {
public ArrayList<Node> collect(int d, boolean onlyCtrl) {
int depth = Math.abs(d);
ArrayList nstack = new ArrayList();
ArrayList<Node> nstack = new ArrayList<>();
BitSet set = new BitSet();
nstack.add(this);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -95,7 +95,7 @@ public class CompiledVFrame extends JavaVFrame {
public StackValueCollection getLocals() {
if (getScope() == null)
return new StackValueCollection();
List scvList = getScope().getLocals();
List<ScopeValue> scvList = getScope().getLocals();
if (scvList == null)
return new StackValueCollection();
@ -104,7 +104,7 @@ public class CompiledVFrame extends JavaVFrame {
int length = scvList.size();
StackValueCollection result = new StackValueCollection(length);
for( int i = 0; i < length; i++ )
result.add( createStackValue((ScopeValue) scvList.get(i)) );
result.add( createStackValue(scvList.get(i)) );
return result;
}
@ -112,7 +112,7 @@ public class CompiledVFrame extends JavaVFrame {
public StackValueCollection getExpressions() {
if (getScope() == null)
return new StackValueCollection();
List scvList = getScope().getExpressions();
List<ScopeValue> scvList = getScope().getExpressions();
if (scvList == null)
return new StackValueCollection();
@ -121,23 +121,22 @@ public class CompiledVFrame extends JavaVFrame {
int length = scvList.size();
StackValueCollection result = new StackValueCollection(length);
for( int i = 0; i < length; i++ )
result.add( createStackValue((ScopeValue) scvList.get(i)) );
result.add( createStackValue(scvList.get(i)) );
return result;
}
/** Returns List<MonitorInfo> */
public List<MonitorInfo> getMonitors() {
if (getScope() == null) {
return new ArrayList<>();
}
List monitors = getScope().getMonitors();
List<MonitorValue> monitors = getScope().getMonitors();
if (monitors == null) {
return new ArrayList<>();
}
List<MonitorInfo> result = new ArrayList<>(monitors.size());
for (int i = 0; i < monitors.size(); i++) {
MonitorValue mv = (MonitorValue) monitors.get(i);
MonitorValue mv = monitors.get(i);
ScopeValue ov = mv.owner();
StackValue ownerSV = createStackValue(ov); // it is an oop
if (ov.isObject()) { // The owner object was scalar replaced

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,20 +30,20 @@ import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.oops.*;
public class ConcurrentLocksPrinter {
private Map locksMap = new HashMap(); // <JavaThread, List<Oop>>
private Map<JavaThread, List<Oop>> locksMap = new HashMap<>();
public ConcurrentLocksPrinter() {
fillLocks();
}
public void print(JavaThread jthread, PrintStream tty) {
List locks = (List) locksMap.get(jthread);
List<Oop> locks = locksMap.get(jthread);
tty.println("Locked ownable synchronizers:");
if (locks == null || locks.isEmpty()) {
tty.println(" - None");
} else {
for (Iterator itr = locks.iterator(); itr.hasNext();) {
Oop oop = (Oop) itr.next();
for (Iterator<Oop> itr = locks.iterator(); itr.hasNext();) {
Oop oop = itr.next();
tty.println(" - <" + oop.getHandle() + ">, (a " +
oop.getKlass().getName().asString() + ")");
}
@ -71,9 +71,9 @@ public class ConcurrentLocksPrinter {
public boolean doObj(Oop oop) {
JavaThread thread = getOwnerThread(oop);
if (thread != null) {
List locks = (List) locksMap.get(thread);
List<Oop> locks = locksMap.get(thread);
if (locks == null) {
locks = new LinkedList();
locks = new LinkedList<>();
locksMap.put(thread, locks);
}
locks.add(oop);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,10 +142,10 @@ public class DeadlockDetector {
//-- Internals only below this point
private static Threads threads;
private static ObjectHeap heap;
private static HashMap threadTable;
private static HashMap<JavaThread, Integer> threadTable;
private static void createThreadTable() {
threadTable = new HashMap();
threadTable = new HashMap<>();
Threads threads = VM.getVM().getThreads();
for (int i = 0; i < threads.getNumberOfThreads(); i++) {
JavaThread cur = threads.getJavaThreadAt(i);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,10 +30,10 @@ import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.types.*;
public class StackValueCollection {
private List list;
private List<StackValue> list;
public StackValueCollection() { list = new ArrayList(); }
public StackValueCollection(int length) { list = new ArrayList(length); }
public StackValueCollection() { list = new ArrayList<>(); }
public StackValueCollection(int length) { list = new ArrayList<>(length); }
public void add(StackValue val) { list.add(val); }
public int size() { return list.size(); }

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -235,8 +235,8 @@ public class Threads {
// refer to Threads::get_pending_threads
// Get list of Java threads that are waiting to enter the specified monitor.
public List getPendingThreads(ObjectMonitor monitor) {
List pendingThreads = new ArrayList();
public List<JavaThread> getPendingThreads(ObjectMonitor monitor) {
List<JavaThread> pendingThreads = new ArrayList<>();
for (int i = 0; i < getNumberOfThreads(); i++) {
JavaThread thread = getJavaThreadAt(i);
if (thread.isCompilerThread() || thread.isCodeCacheSweeperThread()) {
@ -251,8 +251,8 @@ public class Threads {
}
// Get list of Java threads that have called Object.wait on the specified monitor.
public List getWaitingThreads(ObjectMonitor monitor) {
List pendingThreads = new ArrayList();
public List<JavaThread> getWaitingThreads(ObjectMonitor monitor) {
List<JavaThread> pendingThreads = new ArrayList<>();
for (int i = 0; i < getNumberOfThreads(); i++) {
JavaThread thread = getJavaThreadAt(i);
ObjectMonitor waiting = thread.getCurrentWaitingMonitor();

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -67,9 +67,9 @@ import sun.jvm.hotspot.classfile.*;
public class VM {
private static VM soleInstance;
private static List vmInitializedObservers = new ArrayList();
private List vmResumedObservers = new ArrayList();
private List vmSuspendedObservers = new ArrayList();
private static List<Observer> vmInitializedObservers = new ArrayList<>();
private List<Observer> vmResumedObservers = new ArrayList<>();
private List<Observer> vmSuspendedObservers = new ArrayList<>();
private TypeDataBase db;
private boolean isBigEndian;
/** This is only present if in a debugging system */
@ -134,7 +134,7 @@ public class VM {
private String vmInternalInfo;
private Flag[] commandLineFlags;
private Map flagsMap;
private Map<String, Flag> flagsMap;
private static Type intType;
private static Type uintType;
@ -998,7 +998,7 @@ public class VM {
public Flag getCommandLineFlag(String name) {
if (flagsMap == null) {
flagsMap = new HashMap();
flagsMap = new HashMap<>();
Flag[] flags = getCommandLineFlags();
for (int i = 0; i < flags.length; i++) {
flagsMap.put(flags[i].getName(), flags[i]);
@ -1035,10 +1035,8 @@ public class VM {
}
// sort flags by name
Arrays.sort(commandLineFlags, new Comparator() {
public int compare(Object o1, Object o2) {
Flag f1 = (Flag) o1;
Flag f2 = (Flag) o2;
Arrays.sort(commandLineFlags, new Comparator<>() {
public int compare(Flag f1, Flag f2) {
return f1.getName().compareTo(f2.getName());
}
});

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,13 +38,13 @@ import sun.jvm.hotspot.HotSpotTypeDataBase;
public class VirtualBaseConstructor<T> extends InstanceConstructor {
private TypeDataBase db;
private HashMap map; // Map<String, Class>
private Map<String, Class<?>> map;
private Type baseType;
private Class unknownTypeHandler;
public VirtualBaseConstructor(TypeDataBase db, Type baseType, String packageName, Class unknownTypeHandler) {
this.db = (HotSpotTypeDataBase)db;
map = new HashMap();
map = new HashMap<>();
this.baseType = baseType;
this.unknownTypeHandler = unknownTypeHandler;
if (packageName != null) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,7 +71,7 @@ public class ClassLoaderStats extends Tool {
private static class LoaderData {
long numClasses;
long classSize;
List classDetail = new ArrayList(); // List<ClassData>
List<ClassData> classDetail = new ArrayList<>();
}
public void run() {
@ -81,7 +81,7 @@ public class ClassLoaderStats extends Tool {
private void printClassLoaderStatistics() {
final PrintStream out = System.out;
final PrintStream err = System.err;
final Map loaderMap = new HashMap();
final Map<Oop, LoaderData> loaderMap = new HashMap<>();
// loader data for bootstrap class loader
final LoaderData bootstrapLoaderData = new LoaderData();
if (verbose) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 @@ public class FinalizerInfo extends Tool {
OopField nextField =
(OopField) k.findField("next", "Ljava/lang/ref/Reference;");
HashMap map = new HashMap();
HashMap<Klass, ObjectHistogramElement> map = new HashMap<>();
for (;;) {
Oop referent = referentField.getValue(head);
@ -114,7 +114,7 @@ public class FinalizerInfo extends Tool {
if (!map.containsKey(klass)) {
map.put(klass, new ObjectHistogramElement(klass));
}
((ObjectHistogramElement)map.get(klass)).updateWith(referent);
map.get(klass).updateWith(referent);
Oop next = nextField.getValue(head);
if (next == null || next.equals(head)) break;
@ -124,11 +124,11 @@ public class FinalizerInfo extends Tool {
/*
* Sort results - decending order by total size
*/
ArrayList list = new ArrayList();
ArrayList<ObjectHistogramElement> list = new ArrayList<>();
list.addAll(map.values());
Collections.sort(list, new Comparator() {
public int compare(Object o1, Object o2) {
return ((ObjectHistogramElement)o1).compare((ObjectHistogramElement)o2);
Collections.sort(list, new Comparator<>() {
public int compare(ObjectHistogramElement o1, ObjectHistogramElement o2) {
return o1.compare(o2);
}
});

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -60,7 +60,7 @@ public class HeapSummary extends Tool {
public void run() {
CollectedHeap heap = VM.getVM().getUniverse().heap();
VM.Flag[] flags = VM.getVM().getCommandLineFlags();
Map flagMap = new HashMap();
Map<String, VM.Flag> flagMap = new HashMap<>();
if (flags == null) {
System.out.println("WARNING: command line flags are not available");
} else {

@ -61,9 +61,9 @@ public class PMap extends Tool {
CDebugger cdbg = dbg.getCDebugger();
if (cdbg != null) {
List l = cdbg.getLoadObjectList();
for (Iterator itr = l.iterator() ; itr.hasNext();) {
LoadObject lo = (LoadObject) itr.next();
List<LoadObject> l = cdbg.getLoadObjectList();
for (Iterator<LoadObject> itr = l.iterator() ; itr.hasNext();) {
LoadObject lo = itr.next();
out.print(lo.getBase() + "\t");
out.print(lo.getSize()/1024 + "K\t");
out.println(lo.getName());

@ -79,10 +79,10 @@ public class PStack extends Tool {
out.println("can't print deadlock information: " + exp.getMessage());
}
List l = cdbg.getThreadList();
List<ThreadProxy> l = cdbg.getThreadList();
final boolean cdbgCanDemangle = cdbg.canDemangle();
for (Iterator itr = l.iterator() ; itr.hasNext();) {
ThreadProxy th = (ThreadProxy) itr.next();
for (Iterator<ThreadProxy> itr = l.iterator() ; itr.hasNext();) {
ThreadProxy th = itr.next();
try {
CFrame f = cdbg.topFrameForThread(th);
out.print("----------------- ");
@ -199,20 +199,20 @@ public class PStack extends Tool {
}
// -- Internals only below this point
private Map jframeCache; // Map<ThreadProxy, JavaVFrame[]>
private Map proxyToThread; // Map<ThreadProxy, JavaThread>
private Map<ThreadProxy, JavaVFrame[]> jframeCache;
private Map<ThreadProxy, JavaThread> proxyToThread;
private PrintStream out;
private boolean verbose;
private boolean concurrentLocks;
private void initJFrameCache() {
// cache frames for subsequent reference
jframeCache = new HashMap();
proxyToThread = new HashMap();
jframeCache = new HashMap<>();
proxyToThread = new HashMap<>();
Threads threads = VM.getVM().getThreads();
for (int i = 0; i < threads.getNumberOfThreads(); i++) {
JavaThread cur = threads.getJavaThreadAt(i);
List tmp = new ArrayList(10);
List<JavaVFrame> tmp = new ArrayList<>(10);
try {
for (JavaVFrame vf = cur.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) {
tmp.add(vf);
@ -239,7 +239,7 @@ public class PStack extends Tool {
}
JavaVFrame[] jvframes = (JavaVFrame[]) jframeCache.get(th);
if (jvframes == null) return null; // not a java thread
List names = new ArrayList(10);
List<String> names = new ArrayList<>(10);
for (int fCount = 0; fCount < jvframes.length; fCount++) {
JavaVFrame vf = jvframes[fCount];
Frame f = vf.getFrame();

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,9 +47,9 @@ public class ByteCodeRewriter
public static final boolean DEBUG;
static {
String debug = (String) AccessController.doPrivileged(
new PrivilegedAction() {
public Object run() {
String debug = AccessController.doPrivileged(
new PrivilegedAction<>() {
public String run() {
return System.getProperty("sun.jvm.hotspot.tools.jcore.ByteCodeRewriter.DEBUG");
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -82,7 +82,7 @@ public class ClassDump extends Tool {
String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter",
"sun.jvm.hotspot.tools.jcore.PackageNameFilter");
try {
Class filterClass = Class.forName(filterClassName);
Class<?> filterClass = Class.forName(filterClassName);
if (pkgList == null) {
classFilter = (ClassFilter) filterClass.newInstance();
} else {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 @@ import java.util.*;
public class PackageNameFilter implements ClassFilter
{
public Object[] pkgList;
public String[] pkgList;
public PackageNameFilter() {
// give comma separated list of package names to include
@ -39,11 +39,11 @@ public class PackageNameFilter implements ClassFilter
public PackageNameFilter(String pattern) {
try {
StringTokenizer st = new StringTokenizer(pattern, ",");
List l = new LinkedList();
List<String> l = new LinkedList<>();
while (st.hasMoreTokens()) {
l.add(st.nextToken());
}
pkgList = l.toArray();
pkgList = l.toArray(new String[0]);
} catch (Exception exp) {
exp.printStackTrace();
}
@ -59,7 +59,7 @@ public class PackageNameFilter implements ClassFilter
return true;
String klassName = kls.getName().asString().replace('/', '.');
for (int i=0; i < len; i++)
if (klassName.startsWith((String) pkgList[i] )) return true;
if (klassName.startsWith(pkgList[i] )) return true;
return false;
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,8 +51,8 @@ public class BasicType implements Type {
private boolean isOopType;
// These are only the fields defined in this class, not any of this
// class's superclasses.
private Map nameToFieldMap = new HashMap();
private List fieldList = new LinkedList();
private Map<String, Field> nameToFieldMap = new HashMap<>();
private List<Field> fieldList = new LinkedList<>();
// Superclass, or null if none. Primitive types do not have any
// inheritance relationship.
private Type superclass;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,11 +50,11 @@ public class BasicTypeDataBase implements TypeDataBase {
private MachineDescription machDesc;
private VtblAccess vtblAccess;
/** Maps strings to Type objects. This does not contain the primitive types. */
private Map nameToTypeMap = new HashMap();
private Map<String, Type> nameToTypeMap = new HashMap<>();
/** Maps strings to Integers, used for enums, etc. */
private Map nameToIntConstantMap = new HashMap();
private Map<String, Integer> nameToIntConstantMap = new HashMap<>();
/** Maps strings to Longs, used for 32/64-bit constants, etc. */
private Map nameToLongConstantMap = new HashMap();
private Map<String, Long> nameToLongConstantMap = new HashMap<>();
/** Primitive types. */
private Type jbooleanType;
private Type jbyteType;
@ -156,10 +156,10 @@ public class BasicTypeDataBase implements TypeDataBase {
return VM.getVM().getOopSize();
}
HashMap typeToVtbl = new HashMap();
Map<Type, Address> typeToVtbl = new HashMap<>();
private Address vtblForType(Type type) {
Address vtblAddr = (Address)typeToVtbl.get(type);
Address vtblAddr = typeToVtbl.get(type);
if (vtblAddr == null) {
vtblAddr = vtblAccess.getVtblForType(type);
if (vtblAddr != null) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 @@ public abstract class BasicVtblAccess implements VtblAccess {
protected SymbolLookup symbolLookup;
protected String[] dllNames;
private Map typeToVtblMap = new HashMap();
private Map<Type, Object> typeToVtblMap = new HashMap<>();
public BasicVtblAccess(SymbolLookup symbolLookup,
String[] dllNames) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -55,7 +55,7 @@ public class AnnotatedMemoryPanel extends JPanel {
// Type of this is an IntervalTree indexed by Interval<Address> and
// with user data of type Annotation
private IntervalTree annotations =
new IntervalTree(new Comparator() {
new IntervalTree(new Comparator<>() {
public int compare(Object o1, Object o2) {
Address a1 = (Address) o1;
Address a2 = (Address) o2;
@ -82,7 +82,7 @@ public class AnnotatedMemoryPanel extends JPanel {
// This contains the list of currently-visible IntervalNodes, in
// sorted order by their low endpoint, in the form of a
// List<Annotation>. These annotations have already been laid out.
private java.util.List visibleAnnotations;
private java.util.List<Annotation> visibleAnnotations;
// Darker colors than defaults for better readability
private static Color[] colors = {
new Color(0.0f, 0.0f, 0.6f), // blue
@ -201,7 +201,7 @@ public class AnnotatedMemoryPanel extends JPanel {
// FIXME: it would be nice to have a more static layout; that is,
// if something scrolls off the bottom of the screen, other
// annotations still visible shouldn't change position
java.util.List va =
java.util.List<IntervalNode> va =
annotations.findAllNodesIntersecting(new Interval(startAddr.addOffsetTo(-addressSize),
endAddr.addOffsetTo(2 * addressSize)));
@ -214,12 +214,12 @@ public class AnnotatedMemoryPanel extends JPanel {
((Graphics2D) g).setStroke(stroke);
}
Stack drawStack = new Stack();
Stack<AnnoX> drawStack = new Stack<>();
layoutAnnotations(va, g, curTextX, startAddr, lineHeight);
for (Iterator iter = visibleAnnotations.iterator(); iter.hasNext(); ) {
Annotation anno = (Annotation) iter.next();
for (Iterator<Annotation> iter = visibleAnnotations.iterator(); iter.hasNext(); ) {
Annotation anno = iter.next();
Interval interval = anno.getInterval();
if (!drawStack.empty()) {
@ -293,7 +293,7 @@ public class AnnotatedMemoryPanel extends JPanel {
setLayout(new BorderLayout());
setupScrollBar(addrValue, addrLow, addrHigh);
add(scrollBar, BorderLayout.EAST);
visibleAnnotations = new ArrayList();
visibleAnnotations = new ArrayList<>();
setBackground(Color.white);
addHierarchyBoundsListener(new HierarchyBoundsListener() {
public void ancestorMoved(HierarchyEvent e) {
@ -438,8 +438,8 @@ public class AnnotatedMemoryPanel extends JPanel {
/** Scrolls the visible annotations by the given Y amount */
private void scrollAnnotations(int y) {
for (Iterator iter = visibleAnnotations.iterator(); iter.hasNext(); ) {
Annotation anno = (Annotation) iter.next();
for (Iterator<Annotation> iter = visibleAnnotations.iterator(); iter.hasNext(); ) {
Annotation anno = iter.next();
anno.setY(anno.getY() + y);
}
}
@ -448,7 +448,7 @@ public class AnnotatedMemoryPanel extends JPanel {
a List<IntervalNode>) and lays them out given the current
visible position and the already-visible annotations. Does not
perturb the layouts of the currently-visible annotations. */
private void layoutAnnotations(java.util.List va,
private void layoutAnnotations(java.util.List<IntervalNode> va,
Graphics g,
int x,
Address startAddr,
@ -490,15 +490,15 @@ public class AnnotatedMemoryPanel extends JPanel {
// visibleAnnotations list. This reduces the amount of work we do.
int searchIndex = 0;
// The new set of annotations
java.util.List newAnnos = new ArrayList();
java.util.List<Annotation> newAnnos = new ArrayList<>();
for (Iterator iter = va.iterator(); iter.hasNext(); ) {
for (Iterator<IntervalNode> iter = va.iterator(); iter.hasNext(); ) {
Annotation anno = (Annotation) ((IntervalNode) iter.next()).getData();
// Search forward for this one
boolean found = false;
for (int i = searchIndex; i < visibleAnnotations.size(); i++) {
Annotation el = (Annotation) visibleAnnotations.get(i);
Annotation el = visibleAnnotations.get(i);
// See whether we can abort the search unsuccessfully because
// we went forward too far
if (el.getLowAddress().greaterThan(anno.getLowAddress())) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,10 +38,8 @@ import sun.jvm.hotspot.utilities.*;
public class Annotation {
private Interval interval;
// List<String>
private java.util.List strings;
// List<Integer>
private java.util.List heights;
private java.util.List<String> strings;
private java.util.List<Integer> heights;
private Color baseColor;
private int width;
private int height;
@ -53,8 +51,8 @@ public class Annotation {
public Annotation(Address lowAddress,
Address highAddress,
String s) {
strings = new ArrayList();
heights = new ArrayList();
strings = new ArrayList<>();
heights = new ArrayList<>();
for (StringTokenizer tok = new StringTokenizer(s, "\n"); tok.hasMoreTokens(); ) {
strings.add(tok.nextToken());
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -49,7 +49,7 @@ public class FindInHeapPanel extends JPanel {
private HistoryComboBox addressField;
private JButton findButton;
private JTextArea textArea;
private ArrayList updates;
private ArrayList<String> updates;
private double lastFrac;
static final double minUpdateFraction = 0.05;
@ -79,7 +79,7 @@ public class FindInHeapPanel extends JPanel {
iterated = 0;
lastFrac = 0;
error = false;
updates = new ArrayList();
updates = new ArrayList<>();
}
public void visitAddress(Address addr) {
@ -197,7 +197,7 @@ public class FindInHeapPanel extends JPanel {
while (i.hasNext()) {
textArea.append((String)i.next());
}
updates = new ArrayList();;
updates = new ArrayList<>();;
}
pendingUpdate = false;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 HighPrecisionJScrollBar extends JScrollBar {
private static final int BIG_RANGE = 10000;
// Do we need to scale HP values up/down to fit in 0..BIG_RANGE-1?
private boolean down;
private java.util.List changeListeners = new ArrayList();
private java.util.List<ChangeListener> changeListeners = new ArrayList<>();
// Number of digits after decimal point to use when scaling between
// high and low precision
private static final int SCALE = 20;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 @@ import javax.swing.event.*;
/** Provides an editable text field with history. */
public class HistoryComboBox extends JComboBox {
public class HistoryComboBox extends JComboBox<String> {
static final int HISTORY_LENGTH = 15;
public HistoryComboBox() {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,7 +56,7 @@ public class JavaThreadsPanel extends SAPanel implements ActionListener {
private JavaThreadsTableModel dataModel;
private StatusBar statusBar;
private JTable threadTable;
private java.util.List<CachedThread> cachedThreads = new ArrayList();
private java.util.List<CachedThread> cachedThreads = new ArrayList<>();
private static AddressField crashThread;
@ -265,9 +265,9 @@ public class JavaThreadsPanel extends SAPanel implements ActionListener {
private class JavaThreadsTableModel extends AbstractTableModel {
private String[] columnNames = { "OS Thread ID", "Java Thread Name" };
private java.util.List elements;
private java.util.List<CachedThread> elements;
public JavaThreadsTableModel(java.util.List threads) {
public JavaThreadsTableModel(java.util.List<CachedThread> threads) {
this.elements = threads;
}
@ -303,16 +303,16 @@ public class JavaThreadsPanel extends SAPanel implements ActionListener {
}
private CachedThread getRow(int row) {
return (CachedThread)elements.get(row);
return elements.get(row);
}
private String threadIDAt(int index) {
return ((CachedThread) cachedThreads.get(index)).getThreadID();
return cachedThreads.get(index).getThreadID();
}
private String threadNameAt(int index) {
try {
return ((CachedThread) cachedThreads.get(index)).getThreadName();
return cachedThreads.get(index).getThreadName();
} catch (AddressException e) {
return "<Error: AddressException>";
} catch (NullPointerException e) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -59,7 +59,7 @@ public class ObjectHistogramPanel extends JPanel implements ActionListener {
private ObjectHistogramToolBar toolbar;
private StatusBar statusBar;
private JTable table;
private java.util.List listeners;
private java.util.List<Listener> listeners;
public ObjectHistogramPanel(ObjectHistogram histo) {
dataModel = new ObjectHistogramTableModel(histo);
@ -263,7 +263,7 @@ public class ObjectHistogramPanel extends JPanel implements ActionListener {
public void addPanelListener(Listener listener) {
if (listeners == null) {
listeners = new ArrayList();
listeners = new ArrayList<>();
}
listeners.add(listener);
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,7 @@ import sun.jvm.hotspot.debugger.*;
public class ProcessListPanel extends JPanel {
private Debugger dbg;
private AbstractTableModel dataModel;
private java.util.List els;
private java.util.List<ProcessInfo> els;
private boolean sortByName = true;
private boolean sortReversed = false;
private javax.swing.Timer timer;
@ -149,7 +149,7 @@ public class ProcessListPanel extends JPanel {
if (!dbg.hasProcessList()) {
throw new RuntimeException("ProcessListPanel requires that debugger supports getProcessList()");
}
java.util.List newEls = dbg.getProcessList();
java.util.List<ProcessInfo> newEls = dbg.getProcessList();
sort(newEls);
if (table != null) {
// Keep the current selection if possible
@ -176,24 +176,24 @@ public class ProcessListPanel extends JPanel {
if (i < 0) {
return null;
}
return (ProcessInfo) els.get(i);
return els.get(i);
}
private synchronized void sort(java.util.List els) {
Comparator c;
private synchronized void sort(java.util.List<ProcessInfo> els) {
Comparator<ProcessInfo> c;
if (sortByName) {
c = new Comparator() {
public int compare(Object o1, Object o2) {
c = new Comparator<>() {
public int compare(ProcessInfo o1, ProcessInfo o2) {
int scale = (sortReversed ? -1 : 1);
return scale * ((ProcessInfo) o1).getName().compareToIgnoreCase(((ProcessInfo) o2).getName());
return scale * o1.getName().compareToIgnoreCase(o2.getName());
}
};
} else {
c = new Comparator() {
public int compare(Object o1, Object o2) {
c = new Comparator<>() {
public int compare(ProcessInfo o1, ProcessInfo o2) {
int scale = (sortReversed ? -1 : 1);
int pid1 = ((ProcessInfo) o1).getPid();
int pid2 = ((ProcessInfo) o2).getPid();
int pid1 = o1.getPid();
int pid2 = o2.getPid();
int ret;
if (pid1 < pid2) ret = -1;
else if (pid1 == pid2) ret = 0;
@ -216,13 +216,13 @@ public class ProcessListPanel extends JPanel {
return timer;
}
private synchronized int getPid(java.util.List els, int index) {
return ((ProcessInfo) els.get(index)).getPid();
private synchronized int getPid(java.util.List<ProcessInfo> els, int index) {
return els.get(index).getPid();
}
private synchronized int findPid(java.util.List els, int pid) {
private synchronized int findPid(java.util.List<ProcessInfo> els, int pid) {
for (int i = 0; i < els.size(); i++) {
ProcessInfo info = (ProcessInfo) els.get(i);
ProcessInfo info = els.get(i);
if (info.getPid() == pid) {
return i;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 @@ import com.sun.java.swing.action.*;
* in to different containing frameworks (HSDB).
*/
public class SAPanel extends JPanel {
protected List listeners = new ArrayList();
protected List<SAListener> listeners = new ArrayList<>();
public SAPanel() {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,7 +50,7 @@ public class SourceCodePanel extends JPanel {
private static Icon breakpoint;
// State
private int highlightedLine = -1;
private Set/*<Integer>*/ breakpoints = new HashSet(); // Zero-based lines internally
private Set<Integer> breakpoints = new HashSet<>(); // Zero-based lines internally
// Parent Editor container and EditorCommands object for setting breakpoints
private EditorCommands comm;
private Editor parent;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1067,21 +1067,21 @@ public class HTMLGenerator implements /* imports */ ClassConstants {
buf.append(Integer.toString(line));
}
List locals = sd.getLocals();
List<ScopeValue> locals = sd.getLocals();
if (locals != null) {
buf.br();
buf.append(tabs);
buf.append(genHTMLForLocals(sd, locals));
}
List expressions = sd.getExpressions();
List<ScopeValue> expressions = sd.getExpressions();
if (expressions != null) {
buf.br();
buf.append(tabs);
buf.append(genHTMLForExpressions(sd, expressions));
}
List monitors = sd.getMonitors();
List<MonitorValue> monitors = sd.getMonitors();
if (monitors != null) {
buf.br();
buf.append(tabs);
@ -1097,14 +1097,14 @@ public class HTMLGenerator implements /* imports */ ClassConstants {
return;
}
List objects = sd.getObjects();
List<ObjectValue> objects = sd.getObjects();
if (objects == null) {
return;
}
int length = objects.size();
for (int i = 0; i < length; i++) {
buf.append(tabs);
ObjectValue ov = (ObjectValue)objects.get(i);
ObjectValue ov = objects.get(i);
buf.append("ScObj" + i);
ScopeValue sv = ov.getKlass();
if (Assert.ASSERTS_ENABLED) {
@ -1352,12 +1352,12 @@ public class HTMLGenerator implements /* imports */ ClassConstants {
return buf.toString();
}
protected String genHTMLForScopeValues(ScopeDesc sd, boolean locals, List values) {
protected String genHTMLForScopeValues(ScopeDesc sd, boolean locals, List<ScopeValue> values) {
int length = values.size();
Formatter buf = new Formatter(genHTML);
buf.append(locals? "locals " : "expressions ");
for (int i = 0; i < length; i++) {
ScopeValue sv = (ScopeValue) values.get(i);
ScopeValue sv = values.get(i);
if (sv == null) {
continue;
}
@ -1387,20 +1387,20 @@ public class HTMLGenerator implements /* imports */ ClassConstants {
return buf.toString();
}
protected String genHTMLForLocals(ScopeDesc sd, List locals) {
protected String genHTMLForLocals(ScopeDesc sd, List<ScopeValue> locals) {
return genHTMLForScopeValues(sd, true, locals);
}
protected String genHTMLForExpressions(ScopeDesc sd, List expressions) {
protected String genHTMLForExpressions(ScopeDesc sd, List<ScopeValue> expressions) {
return genHTMLForScopeValues(sd, false, expressions);
}
protected String genHTMLForMonitors(ScopeDesc sd, List monitors) {
protected String genHTMLForMonitors(ScopeDesc sd, List<MonitorValue> monitors) {
int length = monitors.size();
Formatter buf = new Formatter(genHTML);
buf.append("monitors ");
for (int i = 0; i < length; i++) {
MonitorValue mv = (MonitorValue) monitors.get(i);
MonitorValue mv = monitors.get(i);
if (mv == null) {
continue;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,7 +40,7 @@ public class CTypeTreeNodeAdapter extends FieldTreeNodeAdapter {
final private Type type;
private CTypeFieldIdentifier[] fields = null;
private void collectFields(Type type, ArrayList list, boolean statics, boolean recurse) {
private void collectFields(Type type, ArrayList<CTypeFieldIdentifier> list, boolean statics, boolean recurse) {
Type supertype = type.getSuperclass();
if (supertype != null && recurse) {
collectFields(supertype, list, statics, recurse);
@ -57,9 +57,9 @@ public class CTypeTreeNodeAdapter extends FieldTreeNodeAdapter {
private CTypeFieldIdentifier[] getFields() {
if (fields == null) {
ArrayList f = new ArrayList();
ArrayList<CTypeFieldIdentifier> f = new ArrayList<>();
collectFields(type, f, false, true);
fields = (CTypeFieldIdentifier[]) f.toArray(new CTypeFieldIdentifier[0]);
fields = f.toArray(new CTypeFieldIdentifier[0]);
}
return fields;
}
@ -97,20 +97,20 @@ public class CTypeTreeNodeAdapter extends FieldTreeNodeAdapter {
super(null, false);
type = t;
addr = null;
ArrayList statics = new ArrayList();
ArrayList<CTypeFieldIdentifier> statics = new ArrayList<>();
collectFields(type, statics, true, false);
fields = (CTypeFieldIdentifier[])statics.toArray(new CTypeFieldIdentifier[0]);
fields = statics.toArray(new CTypeFieldIdentifier[0]);
}
public CTypeTreeNodeAdapter(Iterator types) {
super(null, false);
addr = null;
type = null;
ArrayList statics = new ArrayList();
ArrayList<CTypeFieldIdentifier> statics = new ArrayList<>();
while (types.hasNext()) {
collectFields((Type)types.next(), statics, true, false);
}
fields = (CTypeFieldIdentifier[])statics.toArray(new CTypeFieldIdentifier[0]);
fields = statics.toArray(new CTypeFieldIdentifier[0]);
}
public int getChildCount() {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,7 @@ import sun.jvm.hotspot.utilities.*;
public class RevPtrsTreeNodeAdapter extends FieldTreeNodeAdapter {
private static FieldIdentifier fid = new NamedFieldIdentifier("_revPtrs");
private List children;
private List<LivenessPathElement> children;
public RevPtrsTreeNodeAdapter(Oop oop) {
this(oop, false);
@ -52,7 +52,7 @@ public class RevPtrsTreeNodeAdapter extends FieldTreeNodeAdapter {
}
public SimpleTreeNode getChild(int index) {
LivenessPathElement lpe = (LivenessPathElement)children.get(index);
LivenessPathElement lpe = children.get(index);
IndexableFieldIdentifier ifid = new IndexableFieldIdentifier(index);
Oop oop = lpe.getObj();
if (oop != null) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,10 +30,10 @@ import java.util.*;
of graph */
public class SimpleTreeGroupNode implements SimpleTreeNode {
private List children;
private List<SimpleTreeNode> children;
public SimpleTreeGroupNode() {
children = new ArrayList();
children = new ArrayList<>();
}
public int getChildCount() { return children.size(); }

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,8 +45,7 @@ public class SimpleTreeModel implements TreeModel {
public String getValue() { return toString(); }
};
private SimpleTreeNode root = singletonNullRoot;
/** List<TreeModelListener> */
private List listeners = new ArrayList();
private List<TreeModelListener> listeners = new ArrayList<>();
public void setRoot(SimpleTreeNode node) {
if (node != null) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -63,13 +63,13 @@ public class BasicHashtable extends VMObject {
}
Address tmp = bucketsField.getValue(addr);
tmp = tmp.addOffsetTo(i * bucketSize);
HashtableBucket bucket = (HashtableBucket) VMObjectFactory.newObject(
HashtableBucket bucket = VMObjectFactory.newObject(
HashtableBucket.class, tmp);
return bucket.getEntry(getHashtableEntryClass());
}
// derived class may return Class<? extends BasicHashtableEntry>
protected Class getHashtableEntryClass() {
protected Class<? extends BasicHashtableEntry> getHashtableEntryClass() {
return BasicHashtableEntry.class;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -59,7 +59,7 @@ public class CStringUtilities {
return null;
}
List data = new ArrayList();
List<Byte> data = new ArrayList<>();
byte val = 0;
long i = 0;
do {
@ -73,7 +73,7 @@ public class CStringUtilities {
// Convert to byte[] and from there to String
byte[] bytes = new byte[data.size()];
for (i = 0; i < data.size(); ++i) {
bytes[(int) i] = ((Byte) data.get((int) i)).byteValue();
bytes[(int) i] = data.get((int) i).byteValue();
}
// FIXME: When we switch to use JDK 6 to build SA,
// we can change the following to just return:

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,14 +30,14 @@ import sun.jvm.hotspot.oops.*;
public class FindObjectByType implements HeapVisitor {
private Klass type;
private List results = new ArrayList();
private List<Oop> results = new ArrayList<>();
public FindObjectByType(Klass type) {
this.type = type;
}
/** Returns a List of Oops */
public List getResults() {
public List<Oop> getResults() {
return results;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,8 +44,7 @@ public class Hashtable extends BasicHashtable {
Type type = db.lookupType("IntptrHashtable");
}
// derived class may return Class<? extends HashtableEntry>
protected Class getHashtableEntryClass() {
protected Class<? extends HashtableEntry> getHashtableEntryClass() {
return HashtableEntry.class;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,10 +46,10 @@ public class HashtableBucket extends VMObject {
// Field
private static AddressField entryField;
// Accessor - accepts Class<? extends BasicHashtableEntry>
public BasicHashtableEntry getEntry(Class clazz) {
// Accessor
public BasicHashtableEntry getEntry(Class<? extends BasicHashtableEntry> clazz) {
Address tmp = entryField.getValue(addr);
return (BasicHashtableEntry) VMObjectFactory.newObject(clazz, tmp);
return VMObjectFactory.newObject(clazz, tmp);
}
public BasicHashtableEntry entry() {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -101,7 +101,7 @@ public class HeapGXLWriter extends AbstractHeapGraphWriter {
}
protected void writeObjectHeader(Oop oop) throws IOException {
refFields = new ArrayList();
refFields = new ArrayList<>();
isArray = oop.isArray();
// generate an edge for instanceof relation
@ -403,7 +403,7 @@ public class HeapGXLWriter extends AbstractHeapGraphWriter {
private static final String ENCODING = "UTF-8";
// reference fields of currently visited object
private List/*<OopField>*/ refFields;
private List<OopField> refFields;
// are we writing an array now?
private boolean isArray;
private PrintWriter out;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -637,7 +637,7 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
// two reserved id fields
writeObjectID(null);
writeObjectID(null);
List fields = getInstanceFields(ik);
List<Field> fields = getInstanceFields(ik);
int instSize = getSizeForFields(fields);
classDataCache.put(ik, new ClassData(instSize, fields));
out.writeInt(instSize);
@ -646,12 +646,12 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
// output number of cp entries as zero.
out.writeShort((short) 0);
List declaredFields = ik.getImmediateFields();
List staticFields = new ArrayList();
List instanceFields = new ArrayList();
Iterator itr = null;
List<Field> declaredFields = ik.getImmediateFields();
List<Field> staticFields = new ArrayList<>();
List<Field> instanceFields = new ArrayList<>();
Iterator<Field> itr = null;
for (itr = declaredFields.iterator(); itr.hasNext();) {
Field field = (Field) itr.next();
Field field = itr.next();
if (field.isStatic()) {
staticFields.add(field);
} else {
@ -955,22 +955,22 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
if (Assert.ASSERTS_ENABLED) {
Assert.that(cd != null, "can not get class data for " + klass.getName().asString() + klass.getAddress());
}
List fields = cd.fields;
List<Field> fields = cd.fields;
int size = cd.instSize;
out.writeInt(size);
for (Iterator itr = fields.iterator(); itr.hasNext();) {
writeField((Field) itr.next(), instance);
for (Iterator<Field> itr = fields.iterator(); itr.hasNext();) {
writeField(itr.next(), instance);
}
}
//-- Internals only below this point
private void writeFieldDescriptors(List fields, InstanceKlass ik)
private void writeFieldDescriptors(List<Field> fields, InstanceKlass ik)
throws IOException {
// ik == null for instance fields.
out.writeShort((short) fields.size());
for (Iterator itr = fields.iterator(); itr.hasNext();) {
Field field = (Field) itr.next();
for (Iterator<Field> itr = fields.iterator(); itr.hasNext();) {
Field field = itr.next();
Symbol name = field.getName();
writeSymbolID(name);
char typeCode = (char) field.getSignature().getByteAt(0);
@ -1069,9 +1069,9 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
writeSymbol(k.getName());
if (k instanceof InstanceKlass) {
InstanceKlass ik = (InstanceKlass) k;
List declaredFields = ik.getImmediateFields();
for (Iterator itr = declaredFields.iterator(); itr.hasNext();) {
Field field = (Field) itr.next();
List<Field> declaredFields = ik.getImmediateFields();
for (Iterator<Field> itr = declaredFields.iterator(); itr.hasNext();) {
Field field = itr.next();
writeSymbol(field.getName());
}
}
@ -1174,13 +1174,13 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
}
// get all declared as well as inherited (directly/indirectly) fields
private static List/*<Field>*/ getInstanceFields(InstanceKlass ik) {
private static List<Field> getInstanceFields(InstanceKlass ik) {
InstanceKlass klass = ik;
List res = new ArrayList();
List<Field> res = new ArrayList<>();
while (klass != null) {
List curFields = klass.getImmediateFields();
for (Iterator itr = curFields.iterator(); itr.hasNext();) {
Field f = (Field) itr.next();
List<Field> curFields = klass.getImmediateFields();
for (Iterator<Field> itr = curFields.iterator(); itr.hasNext();) {
Field f = itr.next();
if (! f.isStatic()) {
res.add(f);
}
@ -1193,10 +1193,10 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
// get size in bytes (in stream) required for given fields. Note
// that this is not the same as object size in heap. The size in
// heap will include size of padding/alignment bytes as well.
private int getSizeForFields(List fields) {
private int getSizeForFields(List<Field> fields) {
int size = 0;
for (Iterator itr = fields.iterator(); itr.hasNext();) {
Field field = (Field) itr.next();
for (Iterator<Field> itr = fields.iterator(); itr.hasNext();) {
Field field = itr.next();
char typeCode = (char) field.getSignature().getByteAt(0);
switch (typeCode) {
case JVM_SIGNATURE_BOOLEAN:
@ -1265,13 +1265,13 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
private static class ClassData {
int instSize;
List fields;
List<Field> fields;
ClassData(int instSize, List fields) {
ClassData(int instSize, List<Field> fields) {
this.instSize = instSize;
this.fields = fields;
}
}
private Map classDataCache = new HashMap(); // <InstanceKlass, ClassData>
private Map<InstanceKlass, ClassData> classDataCache = new HashMap<>();
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,7 @@ public class Interval {
/** This takes the Interval to compare against as well as a
Comparator which will be applied to the low and high endpoints
of the given intervals. */
public boolean overlaps(Interval arg, Comparator endpointComparator) {
public boolean overlaps(Interval arg, Comparator<Object> endpointComparator) {
return overlaps(arg.getLowEndpoint(), arg.getHighEndpoint(), endpointComparator);
}
@ -61,7 +61,7 @@ public class Interval {
different data structures */
public boolean overlaps(Object otherLowEndpoint,
Object otherHighEndpoint,
Comparator endpointComparator) {
Comparator<Object> endpointComparator) {
if (endpointComparator.compare(highEndpoint, otherLowEndpoint) <= 0) {
return false;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,11 +30,11 @@ import java.util.Comparator;
public class IntervalNode extends RBNode {
private Interval interval;
private Comparator endpointComparator;
private Comparator<Object> endpointComparator;
private Object minEndpoint;
private Object maxEndpoint;
public IntervalNode(Interval interval, Comparator endpointComparator, Object data) {
public IntervalNode(Interval interval, Comparator<Object> endpointComparator, Object data) {
super(data);
this.interval = interval;
this.endpointComparator = endpointComparator;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* 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,12 +32,12 @@ import java.util.Comparator;
import java.util.List;
public class IntervalTree extends RBTree {
private Comparator endpointComparator;
private Comparator<Object> endpointComparator;
/** This constructor takes only one comparator: one which operates
upon the endpoints of the Intervals this tree will store. It
constructs an internal "interval comparator" out of this one. */
public IntervalTree(Comparator endpointComparator) {
public IntervalTree(Comparator<Object> endpointComparator) {
super(new IntervalComparator(endpointComparator));
this.endpointComparator = endpointComparator;
}
@ -51,8 +51,8 @@ public class IntervalTree extends RBTree {
intervals were intersected by the given query interval. It is
guaranteed that these nodes will be returned sorted by
increasing low endpoint. */
public List findAllNodesIntersecting(Interval interval) {
List retList = new ArrayList();
public List<IntervalNode> findAllNodesIntersecting(Interval interval) {
List<IntervalNode> retList = new ArrayList<>();
searchForIntersectingNodesFrom((IntervalNode) getRoot(), interval, retList);
return retList;
}
@ -108,10 +108,10 @@ public class IntervalTree extends RBTree {
verifyFromNode(node.getRight());
}
static class IntervalComparator implements Comparator {
private Comparator endpointComparator;
static class IntervalComparator implements Comparator<Object> {
private Comparator<Object> endpointComparator;
public IntervalComparator(Comparator endpointComparator) {
public IntervalComparator(Comparator<Object> endpointComparator) {
this.endpointComparator = endpointComparator;
}
@ -124,7 +124,7 @@ public class IntervalTree extends RBTree {
private void searchForIntersectingNodesFrom(IntervalNode node,
Interval interval,
List resultList) {
List<IntervalNode> resultList) {
if (node == null) {
return;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -83,12 +83,12 @@ public class LivenessAnalysis {
// HashSet of Oops acting as a bit mask indicating which ones have
// already been traversed
Set/*<Oop>*/ visitedOops = new HashSet/*<Oop>*/();
Set<Oop> visitedOops = new HashSet<>();
// IdentityHashMap of LivenessElements acting as a bit mask
// indicating which roots have already been traversed
Map/*<LivenessElement, LivenessElement>*/ visitedRoots =
new IdentityHashMap/*<LivenessElement, LivenessElement>*/();
Map<LivenessPathElement, LivenessPathElement> visitedRoots =
new IdentityHashMap<>();
visitedOops.add(target);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 sun.jvm.hotspot.oops.*;
public class LivenessPath {
LivenessPath() {
stack = new Stack();
stack = new Stack<>();
}
/** Number of elements in the path */
@ -104,5 +104,5 @@ public class LivenessPath {
//---------------------------------------------------------------------------
// Internals only below this point
//
private Stack stack;
private Stack<LivenessPathElement> stack;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* 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 @@ import java.util.*;
public class LivenessPathList {
public LivenessPathList() {
list = new ArrayList();
list = new ArrayList<>();
}
public int size() {
@ -49,5 +49,5 @@ public class LivenessPathList {
list.remove(path);
}
private ArrayList list;
private ArrayList<LivenessPath> list;
}

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