src/share/classes/com/sun/tools/hat/internal/parser/HprofReader.java
Print this page
rev 10195 : 8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
Reviewed-by: chegar, psandoz
Contributed-by: otaviojava@java.net
@@ -213,19 +213,19 @@
switch (type) {
case HPROF_UTF8: {
long id = readID();
byte[] chars = new byte[(int)length - identifierSize];
in.readFully(chars);
- names.put(new Long(id), new String(chars));
+ names.put(id, new String(chars));
break;
}
case HPROF_LOAD_CLASS: {
int serialNo = in.readInt(); // Not used
long classID = readID();
int stackTraceSerialNo = in.readInt();
long classNameID = readID();
- Long classIdI = new Long(classID);
+ Long classIdI = classID;
String nm = getNameFromID(classNameID).replace('/', '.');
classNameFromObjectID.put(classIdI, nm);
if (classNameFromSerialNo != null) {
classNameFromSerialNo.put(new Integer(serialNo), nm);
}
@@ -301,11 +301,11 @@
int lineNumber = in.readInt();
if (lineNumber < StackFrame.LINE_NUMBER_NATIVE) {
warn("Weird stack frame line number: " + lineNumber);
lineNumber = StackFrame.LINE_NUMBER_UNKNOWN;
}
- stackFrames.put(new Long(id),
+ stackFrames.put(id,
new StackFrame(methodName, methodSig,
className, sourceFile,
lineNumber));
}
break;
@@ -317,11 +317,11 @@
int serialNo = in.readInt();
int threadSeq = in.readInt(); // Not used
StackFrame[] frames = new StackFrame[in.readInt()];
for (int i = 0; i < frames.length; i++) {
long fid = readID();
- frames[i] = stackFrames.get(new Long(fid));
+ frames[i] = stackFrames.get(fid);
if (frames[i] == null) {
throw new IOException("Stack frame " + toHex(fid) + " not found");
}
}
stackTraces.put(new Integer(serialNo),
@@ -617,11 +617,11 @@
}
return to;
}
private String getNameFromID(long id) throws IOException {
- return getNameFromID(new Long(id));
+ return getNameFromID(id);
}
private String getNameFromID(Long id) throws IOException {
if (id.longValue() == 0L) {
return "";
@@ -701,11 +701,11 @@
type = signatureFromTypeId(type);
}
String signature = "" + ((char) type);
fields[i] = new JavaField(fieldName, signature);
}
- String name = classNameFromObjectID.get(new Long(id));
+ String name = classNameFromObjectID.get(id);
if (name == null) {
warn("Class name not found for " + toHex(id));
name = "unknown-name@" + toHex(id);
}
JavaClass c = new JavaClass(id, name, superId, classLoaderId, signersId,