8048267: Replace uses of 'new Long()' with appropriate alternative across core classes

Reviewed-by: chegar, psandoz, prappo
This commit is contained in:
Otavio Santana 2014-07-01 15:12:59 +01:00 committed by Pavel Rappo
parent 3962277490
commit 4da668378d
53 changed files with 153 additions and 153 deletions

View File

@ -415,7 +415,7 @@ public final class CStrike extends FontStrike {
generalCache = new HashMap<Integer, Long>();
}
generalCache.put(new Integer(index), new Long(value));
generalCache.put(new Integer(index), Long.valueOf(value));
}
public synchronized void dispose() {

View File

@ -616,7 +616,7 @@ public class GIFImageReader extends ImageReader {
return index;
}
Long l1 = new Long(stream.getStreamPosition());
Long l1 = stream.getStreamPosition();
imageStartPosition.add(l1);
++index;
}

View File

@ -367,10 +367,10 @@ public class JPEGImageReader extends ImageReader {
// Now we are at the first image if there are any, so add it
// to the list
if (hasNextImage()) {
imagePositions.add(new Long(iis.getStreamPosition()));
imagePositions.add(iis.getStreamPosition());
}
} else { // Not tables only, so add original pos to the list
imagePositions.add(new Long(savePos));
imagePositions.add(savePos);
// And set current image since we've read it now
currentImage = 0;
}
@ -498,7 +498,7 @@ public class JPEGImageReader extends ImageReader {
if (!hasNextImage()) {
throw new IndexOutOfBoundsException();
}
pos = new Long(iis.getStreamPosition());
pos = iis.getStreamPosition();
imagePositions.add(pos);
if (seekForwardOnly) {
iis.flushBefore(pos.longValue());

View File

@ -84,7 +84,7 @@ public class SnmpCounter64 extends SnmpValue {
* @return The <CODE>Long</CODE> representation of the value.
*/
public Long toLong() {
return new Long(value) ;
return value;
}
/**

View File

@ -130,7 +130,7 @@ public class SnmpInt extends SnmpValue {
* @return The <CODE>Long</CODE> representation of the value.
*/
public Long toLong() {
return new Long(value) ;
return value;
}
/**

View File

@ -136,7 +136,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid
*/
public boolean isNestedArc(long arc) {
if (subgroups == null) return false;
Object obj = subgroups.get(new Long(arc));
Object obj = subgroups.get(arc);
// if the arc is registered in the hashtable,
// it leads to a subgroup.
return (obj != null);
@ -260,7 +260,7 @@ public abstract class SnmpMibGroup extends SnmpMibOid
*
*/
void registerNestedArc(long arc) {
Long obj = new Long(arc);
Long obj = arc;
if (subgroups == null) subgroups = new Hashtable<>();
// registers the arc in the hashtable.
subgroups.put(obj,obj);

View File

@ -858,7 +858,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpOutTraps() {
return new Long(snmpOutTraps);
return (long)snmpOutTraps;
}
/**
@ -868,7 +868,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpOutGetResponses() {
return new Long(snmpOutGetResponses);
return (long)snmpOutGetResponses;
}
/**
@ -878,7 +878,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpOutGenErrs() {
return new Long(snmpOutGenErrs);
return (long)snmpOutGenErrs;
}
/**
@ -888,7 +888,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpOutBadValues() {
return new Long(snmpOutBadValues);
return (long)snmpOutBadValues;
}
/**
@ -898,7 +898,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpOutNoSuchNames() {
return new Long(snmpOutNoSuchNames);
return (long)snmpOutNoSuchNames;
}
/**
@ -908,7 +908,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpOutTooBigs() {
return new Long(snmpOutTooBigs);
return (long)snmpOutTooBigs;
}
/**
@ -918,7 +918,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInASNParseErrs() {
return new Long(snmpInASNParseErrs);
return (long)snmpInASNParseErrs;
}
/**
@ -928,7 +928,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInBadCommunityUses() {
return new Long(snmpInBadCommunityUses);
return (long)snmpInBadCommunityUses;
}
/**
@ -939,7 +939,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInBadCommunityNames() {
return new Long(snmpInBadCommunityNames);
return (long)snmpInBadCommunityNames;
}
/**
@ -949,7 +949,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInBadVersions() {
return new Long(snmpInBadVersions);
return (long)snmpInBadVersions;
}
/**
@ -959,7 +959,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpOutPkts() {
return new Long(snmpOutPkts);
return (long)snmpOutPkts;
}
/**
@ -969,7 +969,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInPkts() {
return new Long(snmpInPkts);
return (long)snmpInPkts;
}
/**
@ -979,7 +979,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInGetRequests() {
return new Long(snmpInGetRequests);
return (long)snmpInGetRequests;
}
/**
@ -989,7 +989,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInGetNexts() {
return new Long(snmpInGetNexts);
return (long)snmpInGetNexts;
}
/**
@ -999,7 +999,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInSetRequests() {
return new Long(snmpInSetRequests);
return (long)snmpInSetRequests;
}
/**
@ -1009,7 +1009,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInTotalSetVars() {
return new Long(snmpInTotalSetVars);
return (long)snmpInTotalSetVars;
}
/**
@ -1019,7 +1019,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpInTotalReqVars() {
return new Long(snmpInTotalReqVars);
return (long)snmpInTotalReqVars;
}
/**
@ -1032,7 +1032,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpSilentDrops() {
return new Long(snmpSilentDrops);
return (long)snmpSilentDrops;
}
/**
@ -1045,7 +1045,7 @@ public class SnmpAdaptorServer extends CommunicatorServer
*/
@Override
public Long getSnmpProxyDrops() {
return new Long(0);
return 0L;
}

View File

@ -421,7 +421,7 @@ public final class LdapPoolManager {
try {
return Long.getLong(propName, defVal);
} catch (SecurityException e) {
return new Long(defVal);
return defVal;
}
}
});

View File

@ -221,7 +221,7 @@ final class NamingEventNotifier implements Runnable {
return;
NamingEvent e = new NamingEvent(eventSrc, NamingEvent.OBJECT_ADDED,
newBd, null, new Long(changeID));
newBd, null, changeID);
support.queueEvent(e, namingListeners);
}
@ -233,7 +233,7 @@ final class NamingEventNotifier implements Runnable {
return;
NamingEvent e = new NamingEvent(eventSrc, NamingEvent.OBJECT_REMOVED,
null, oldBd, new Long(changeID));
null, oldBd, changeID);
support.queueEvent(e, namingListeners);
}
@ -248,7 +248,7 @@ final class NamingEventNotifier implements Runnable {
Binding oldBd = new Binding(newBd.getName(), null, newBd.isRelative());
NamingEvent e = new NamingEvent(
eventSrc, NamingEvent.OBJECT_CHANGED, newBd, oldBd, new Long(changeID));
eventSrc, NamingEvent.OBJECT_CHANGED, newBd, oldBd, changeID);
support.queueEvent(e, namingListeners);
}
@ -273,7 +273,7 @@ final class NamingEventNotifier implements Runnable {
}
NamingEvent e = new NamingEvent(
eventSrc, NamingEvent.OBJECT_RENAMED, newBd, oldBd, new Long(changeID));
eventSrc, NamingEvent.OBJECT_RENAMED, newBd, oldBd, changeID);
support.queueEvent(e, namingListeners);
}

View File

@ -110,7 +110,7 @@ public class SolarisNumericGroupPrincipal implements
*
*/
public SolarisNumericGroupPrincipal(long name, boolean primaryGroup) {
this.name = (new Long(name)).toString();
this.name = Long.toString(name);
this.primaryGroup = primaryGroup;
}
@ -137,7 +137,7 @@ public class SolarisNumericGroupPrincipal implements
* <code>SolarisNumericGroupPrincipal</code> as a long.
*/
public long longValue() {
return ((new Long(name)).longValue());
return Long.parseLong(name);
}
/**

View File

@ -96,7 +96,7 @@ public class SolarisNumericUserPrincipal implements
* represented as a long.
*/
public SolarisNumericUserPrincipal(long name) {
this.name = (new Long(name)).toString();
this.name = Long.toString(name);
}
/**
@ -122,7 +122,7 @@ public class SolarisNumericUserPrincipal implements
* <code>SolarisNumericUserPrincipal</code> as a long.
*/
public long longValue() {
return ((new Long(name)).longValue());
return Long.parseLong(name);
}
/**

View File

@ -102,7 +102,7 @@ public class UnixNumericGroupPrincipal implements
*
*/
public UnixNumericGroupPrincipal(long name, boolean primaryGroup) {
this.name = (new Long(name)).toString();
this.name = Long.toString(name);
this.primaryGroup = primaryGroup;
}
@ -129,7 +129,7 @@ public class UnixNumericGroupPrincipal implements
* <code>UnixNumericGroupPrincipal</code> as a long.
*/
public long longValue() {
return ((new Long(name)).longValue());
return Long.parseLong(name);
}
/**

View File

@ -87,7 +87,7 @@ public class UnixNumericUserPrincipal implements
* represented as a long.
*/
public UnixNumericUserPrincipal(long name) {
this.name = (new Long(name)).toString();
this.name = Long.toString(name);
}
/**
@ -113,7 +113,7 @@ public class UnixNumericUserPrincipal implements
* <code>UnixNumericUserPrincipal</code> as a long.
*/
public long longValue() {
return ((new Long(name)).longValue());
return Long.parseLong(name);
}
/**

View File

@ -142,8 +142,8 @@ class BreakpointSpec extends EventRequestSpec {
refSpec.toString()));
} else if (e instanceof LineNotFoundException) {
return (MessageOutput.format("No code at line",
new Object [] {new Long (lineNumber()),
refSpec.toString()}));
new Object [] {Long.valueOf(lineNumber()),
refSpec.toString()}));
} else if (e instanceof InvalidTypeException) {
return (MessageOutput.format("Breakpoints can be located only in classes.",
refSpec.toString()));

View File

@ -935,7 +935,7 @@ class Commands {
try {
methodInfo = loc.sourceName() +
MessageOutput.format("line number",
new Object [] {new Long(lineNumber)});
new Object [] {Long.valueOf(lineNumber)});
} catch (AbsentInformationException e) {
methodInfo = MessageOutput.format("unknown");
}
@ -946,7 +946,7 @@ class Commands {
meth.declaringType().name(),
meth.name(),
methodInfo,
new Long(pc)});
Long.valueOf(pc)});
} else {
MessageOutput.println("stack frame dump",
new Object [] {new Integer(frameNumber + 1),
@ -1015,7 +1015,7 @@ class Commands {
new Object [] {loc.declaringType().name(),
loc.method().name(),
new Integer (loc.lineNumber()),
new Long (loc.codeIndex())});
Long.valueOf(loc.codeIndex())});
}
void listBreakpoints() {

View File

@ -102,7 +102,7 @@ public abstract class JavaLazyReadObject extends JavaHeapObject {
if ((id & ~Snapshot.SMALL_ID_MASK) == 0) {
return new Integer((int)id);
} else {
return new Long(id);
return id;
}
}

View File

@ -583,7 +583,7 @@ public class Snapshot {
if (identifierSize == 4) {
return new Integer((int)id);
} else {
return new Long(id);
return id;
}
}

View File

@ -215,7 +215,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
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: {
@ -223,7 +223,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
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) {
@ -303,7 +303,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
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));
@ -319,7 +319,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
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");
}
@ -619,7 +619,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
}
private String getNameFromID(long id) throws IOException {
return getNameFromID(new Long(id));
return getNameFromID(Long.valueOf(id));
}
private String getNameFromID(Long id) throws IOException {
@ -703,7 +703,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
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);

View File

@ -63,9 +63,9 @@ public class RefsByTypeQuery extends QueryHandler {
}
Long count = referrersStat.get(cl);
if (count == null) {
count = new Long(1);
count = 1L;
} else {
count = new Long(count.longValue() + 1);
count = count + 1L;
}
referrersStat.put(cl, count);
}
@ -75,9 +75,9 @@ public class RefsByTypeQuery extends QueryHandler {
JavaClass cl = obj.getClazz();
Long count = refereesStat.get(cl);
if (count == null) {
count = new Long(1);
count = 1L;
} else {
count = new Long(count.longValue() + 1);
count = count + 1L;
}
refereesStat.put(cl, count);
}

View File

@ -781,7 +781,7 @@ class VirtualMachineImpl extends MirrorImpl
type.setSignature(signature);
}
typesByID.put(new Long(id), type);
typesByID.put(id, type);
typesBySignature.add(type);
if ((vm.traceFlags & VirtualMachine.TRACE_REFTYPES) != 0) {
@ -809,7 +809,7 @@ class VirtualMachineImpl extends MirrorImpl
if (comp == 0) {
matches++;
iter.remove();
typesByID.remove(new Long(type.ref()));
typesByID.remove(type.ref());
if ((vm.traceFlags & VirtualMachine.TRACE_REFTYPES) != 0) {
vm.printTrace("Uncaching ReferenceType, sig=" + signature +
", id=" + type.ref());
@ -895,7 +895,7 @@ class VirtualMachineImpl extends MirrorImpl
ReferenceTypeImpl retType = null;
synchronized (this) {
if (typesByID != null) {
retType = (ReferenceTypeImpl)typesByID.get(new Long(id));
retType = (ReferenceTypeImpl)typesByID.get(id);
}
if (retType == null) {
retType = addReferenceType(id, tag, signature);
@ -1247,7 +1247,7 @@ class VirtualMachineImpl extends MirrorImpl
return null;
}
ObjectReferenceImpl object = null;
Long key = new Long(id);
Long key = id;
/*
* Attempt to retrieve an existing object object reference
@ -1313,7 +1313,7 @@ class VirtualMachineImpl extends MirrorImpl
// Handle any queue elements that are not strongly reachable
processQueue();
SoftObjectReference ref = objectsByID.remove(new Long(object.ref()));
SoftObjectReference ref = objectsByID.remove(object.ref());
if (ref != null) {
batchForDispose(ref);
} else {

View File

@ -381,7 +381,7 @@ public class ParameterBlock implements Cloneable, Serializable {
* the specified parameter.
*/
public ParameterBlock add(long l) {
return add(new Long(l));
return add(Long.valueOf(l));
}
/**
@ -505,7 +505,7 @@ public class ParameterBlock implements Cloneable, Serializable {
* the specified parameter.
*/
public ParameterBlock set(long l, int index) {
return set(new Long(l), index);
return set(Long.valueOf(l), index);
}
/**

View File

@ -2094,7 +2094,7 @@ public class DecimalFormat extends NumberFormat {
}
return gotDouble ?
(Number)new Double(doubleResult) : (Number)new Long(longResult);
(Number)new Double(doubleResult) : (Number)Long.valueOf(longResult);
}
}

View File

@ -1311,7 +1311,7 @@ public class MLet extends java.net.URLClassLoader
if (type.compareTo("java.lang.Short") == 0)
return new Short(param);
if (type.compareTo("java.lang.Long") == 0)
return new Long(param);
return Long.valueOf(param);
if (type.compareTo("java.lang.Integer") == 0)
return new Integer(param);
if (type.compareTo("java.lang.Float") == 0)

View File

@ -544,7 +544,7 @@ public class RequiredModelMBean
}
// convert seconds to milliseconds for time comparison
currencyPeriod = ((new Long(expTime)).longValue()) * 1000;
currencyPeriod = Long.parseLong(expTime) * 1000;
if (currencyPeriod < 0) {
/* if currencyTimeLimit is -1 then value is never cached */
returnCachedValue = false;
@ -580,7 +580,7 @@ public class RequiredModelMBean
if (tStamp == null)
tStamp = "0";
long lastTime = (new Long(tStamp)).longValue();
long lastTime = Long.parseLong(tStamp);
if (tracing) {
MODELMBEAN_LOGGER.logp(Level.FINER,

View File

@ -458,7 +458,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel implements Serializab
Integer fiveHundred = new Integer(500);
// *** Shared Longs
Long oneThousand = new Long(1000);
Long oneThousand = 1000L;
LazyValue dialogPlain12 = t ->
new FontUIResource(Font.DIALOG, Font.PLAIN, 12);

View File

@ -66,7 +66,7 @@ public class PerfLongMonitor extends AbstractMonitor implements LongMonitor {
* return type is guaranteed to be of type Long.
*/
public Object getValue() {
return new Long(lb.get(0));
return Long.valueOf(lb.get(0));
}
/**

View File

@ -105,10 +105,10 @@ public class GcInfoCompositeData extends LazyCompositeData {
try {
baseGcInfoItemValues = new Object[] {
new Long(info.getId()),
new Long(info.getStartTime()),
new Long(info.getEndTime()),
new Long(info.getDuration()),
info.getId(),
info.getStartTime(),
info.getEndTime(),
info.getDuration(),
memoryUsageMapType.toOpenTypeData(info.getMemoryUsageBeforeGc()),
memoryUsageMapType.toOpenTypeData(info.getMemoryUsageAfterGc()),
};

View File

@ -60,7 +60,7 @@ class HotspotThread
int numThreads = getInternalThreadTimes0(names, times);
Map<String, Long> result = new HashMap<>(numThreads);
for (int i = 0; i < numThreads; i++) {
result.put(names[i], new Long(times[i]));
result.put(names[i], times[i]);
}
return result;
}

View File

@ -60,7 +60,7 @@ public class MemoryNotifInfoCompositeData extends LazyCompositeData {
final Object[] memoryNotifInfoItemValues = {
memoryNotifInfo.getPoolName(),
MemoryUsageCompositeData.toCompositeData(memoryNotifInfo.getUsage()),
new Long(memoryNotifInfo.getCount()),
memoryNotifInfo.getCount(),
};
try {

View File

@ -56,10 +56,10 @@ public class MemoryUsageCompositeData extends LazyCompositeData {
// CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
// memoryUsageItemNames!
final Object[] memoryUsageItemValues = {
new Long(usage.getInit()),
new Long(usage.getUsed()),
new Long(usage.getCommitted()),
new Long(usage.getMax()),
usage.getInit(),
usage.getUsed(),
usage.getCommitted(),
usage.getMax(),
};
try {

View File

@ -108,16 +108,16 @@ public class ThreadInfoCompositeData extends LazyCompositeData {
// CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
// threadInfoItemNames!
final Object[] threadInfoItemValues = {
new Long(threadInfo.getThreadId()),
threadInfo.getThreadId(),
threadInfo.getThreadName(),
threadInfo.getThreadState().name(),
new Long(threadInfo.getBlockedTime()),
new Long(threadInfo.getBlockedCount()),
new Long(threadInfo.getWaitedTime()),
new Long(threadInfo.getWaitedCount()),
threadInfo.getBlockedTime(),
threadInfo.getBlockedCount(),
threadInfo.getWaitedTime(),
threadInfo.getWaitedCount(),
lockInfoData,
threadInfo.getLockName(),
new Long(threadInfo.getLockOwnerId()),
threadInfo.getLockOwnerId(),
threadInfo.getLockOwnerName(),
stackTraceData,
threadInfo.isSuspended(),

View File

@ -43,7 +43,7 @@ class LongCounterSnapshot extends AbstractCounter
}
public Object getValue() {
return new Long(value);
return Long.valueOf(value);
}
/**

View File

@ -42,7 +42,7 @@ public class PerfLongCounter extends AbstractCounter
}
public Object getValue() {
return new Long(lb.get(0));
return Long.valueOf(lb.get(0));
}
/**

View File

@ -129,21 +129,21 @@ public class JvmClassLoadingImpl implements JvmClassLoadingMBean {
* Getter for the "JvmClassesUnloadedCount" variable.
*/
public Long getJvmClassesUnloadedCount() throws SnmpStatusException {
return new Long(getClassLoadingMXBean().getUnloadedClassCount());
return getClassLoadingMXBean().getUnloadedClassCount();
}
/**
* Getter for the "JvmClassesTotalLoadedCount" variable.
*/
public Long getJvmClassesTotalLoadedCount() throws SnmpStatusException {
return new Long(getClassLoadingMXBean().getTotalLoadedClassCount());
return getClassLoadingMXBean().getTotalLoadedClassCount();
}
/**
* Getter for the "JvmClassesLoadedCount" variable.
*/
public Long getJvmClassesLoadedCount() throws SnmpStatusException {
return new Long(getClassLoadingMXBean().getLoadedClassCount());
return (long)getClassLoadingMXBean().getLoadedClassCount();
}
}

View File

@ -115,7 +115,7 @@ public class JvmCompilationImpl implements JvmCompilationMBean {
t = getCompilationMXBean().getTotalCompilationTime();
else
t = 0;
return new Long(t);
return t;
}
/**

View File

@ -70,7 +70,7 @@ public class JvmMemGCEntryImpl implements JvmMemGCEntryMBean {
*/
// Don't bother to uses the request contextual cache for this.
public Long getJvmMemGCTimeMs() throws SnmpStatusException {
return new Long(gcm.getCollectionTime());
return gcm.getCollectionTime();
}
/**
@ -78,7 +78,7 @@ public class JvmMemGCEntryImpl implements JvmMemGCEntryMBean {
*/
// Don't bother to uses the request contextual cache for this.
public Long getJvmMemGCCount() throws SnmpStatusException {
return new Long(gcm.getCollectionCount());
return gcm.getCollectionCount();
}
/**

View File

@ -191,7 +191,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
*/
public Long getJvmMemPoolMaxSize() throws SnmpStatusException {
final long val = getMemoryUsage().getMax();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return JvmMemoryImpl.Long0;
}
@ -200,7 +200,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
*/
public Long getJvmMemPoolUsed() throws SnmpStatusException {
final long val = getMemoryUsage().getUsed();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return JvmMemoryImpl.Long0;
}
@ -209,7 +209,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
*/
public Long getJvmMemPoolInitSize() throws SnmpStatusException {
final long val = getMemoryUsage().getInit();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return JvmMemoryImpl.Long0;
}
@ -218,7 +218,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
*/
public Long getJvmMemPoolCommitted() throws SnmpStatusException {
final long val = getMemoryUsage().getCommitted();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return JvmMemoryImpl.Long0;
}
@ -227,7 +227,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
*/
public Long getJvmMemPoolPeakMaxSize() throws SnmpStatusException {
final long val = getPeakMemoryUsage().getMax();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return JvmMemoryImpl.Long0;
}
@ -236,7 +236,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
*/
public Long getJvmMemPoolPeakUsed() throws SnmpStatusException {
final long val = getPeakMemoryUsage().getUsed();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return JvmMemoryImpl.Long0;
}
@ -245,7 +245,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
*/
public Long getJvmMemPoolPeakCommitted() throws SnmpStatusException {
final long val = getPeakMemoryUsage().getCommitted();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return JvmMemoryImpl.Long0;
}
@ -254,7 +254,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
*/
public Long getJvmMemPoolCollectMaxSize() throws SnmpStatusException {
final long val = getCollectMemoryUsage().getMax();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return JvmMemoryImpl.Long0;
}
@ -263,7 +263,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
*/
public Long getJvmMemPoolCollectUsed() throws SnmpStatusException {
final long val = getCollectMemoryUsage().getUsed();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return JvmMemoryImpl.Long0;
}
@ -272,7 +272,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
*/
public Long getJvmMemPoolCollectCommitted() throws SnmpStatusException {
final long val = getCollectMemoryUsage().getCommitted();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return JvmMemoryImpl.Long0;
}
@ -283,7 +283,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
if (!pool.isUsageThresholdSupported())
return JvmMemoryImpl.Long0;
final long val = pool.getUsageThreshold();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return JvmMemoryImpl.Long0;
}
@ -334,7 +334,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
if (!pool.isUsageThresholdSupported())
return JvmMemoryImpl.Long0;
final long val = pool.getUsageThresholdCount();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return JvmMemoryImpl.Long0;
}
@ -345,7 +345,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
if (!pool.isCollectionUsageThresholdSupported())
return JvmMemoryImpl.Long0;
final long val = pool.getCollectionUsageThreshold();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return JvmMemoryImpl.Long0;
}
@ -399,7 +399,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
if (!pool.isCollectionUsageThresholdSupported())
return JvmMemoryImpl.Long0;
final long val = pool.getCollectionUsageThresholdCount();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return JvmMemoryImpl.Long0;
}
@ -450,7 +450,7 @@ public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
*/
public synchronized Long getJvmMemPoolPeakReset()
throws SnmpStatusException {
return new Long(jvmMemPoolPeakReset);
return jvmMemPoolPeakReset;
}
/**

View File

@ -222,7 +222,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
}
}
static final Long Long0 = new Long(0);
static final Long Long0 = 0L;
/**
* Getter for the "JvmMemoryNonHeapMaxSize" variable.
@ -230,7 +230,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
public Long getJvmMemoryNonHeapMaxSize()
throws SnmpStatusException {
final long val = getNonHeapMemoryUsage().getMax();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return Long0;
}
@ -239,7 +239,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
*/
public Long getJvmMemoryNonHeapCommitted() throws SnmpStatusException {
final long val = getNonHeapMemoryUsage().getCommitted();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return Long0;
}
@ -248,7 +248,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
*/
public Long getJvmMemoryNonHeapUsed() throws SnmpStatusException {
final long val = getNonHeapMemoryUsage().getUsed();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return Long0;
}
@ -257,7 +257,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
*/
public Long getJvmMemoryNonHeapInitSize() throws SnmpStatusException {
final long val = getNonHeapMemoryUsage().getInit();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return Long0;
}
@ -266,7 +266,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
*/
public Long getJvmMemoryHeapMaxSize() throws SnmpStatusException {
final long val = getHeapMemoryUsage().getMax();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return Long0;
}
@ -320,7 +320,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
*/
public Long getJvmMemoryHeapCommitted() throws SnmpStatusException {
final long val = getHeapMemoryUsage().getCommitted();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return Long0;
}
@ -359,7 +359,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
*/
public Long getJvmMemoryHeapUsed() throws SnmpStatusException {
final long val = getHeapMemoryUsage().getUsed();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return Long0;
}
@ -368,7 +368,7 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
*/
public Long getJvmMemoryHeapInitSize() throws SnmpStatusException {
final long val = getHeapMemoryUsage().getInit();
if (val > -1) return new Long(val);
if (val > -1) return val;
else return Long0;
}
@ -380,11 +380,11 @@ public class JvmMemoryImpl implements JvmMemoryMBean {
final long val = ManagementFactory.getMemoryMXBean().
getObjectPendingFinalizationCount();
if (val > -1) return new Long((int)val);
if (val > -1) return Long.valueOf((int) val);
// Should never happen... but stay safe all the same.
//
else return new Long(0);
else return 0L;
}
static final MibLogger log = new MibLogger(JvmMemoryImpl.class);

View File

@ -259,14 +259,14 @@ public class JvmRuntimeImpl implements JvmRuntimeMBean {
* Getter for the "JvmRTUptimeMs" variable.
*/
public Long getJvmRTUptimeMs() throws SnmpStatusException {
return new Long(getRuntimeMXBean().getUptime());
return getRuntimeMXBean().getUptime();
}
/**
* Getter for the "JvmRTStartTimeMs" variable.
*/
public Long getJvmRTStartTimeMs() throws SnmpStatusException {
return new Long(getRuntimeMXBean().getStartTime());
return getRuntimeMXBean().getStartTime();
}
/**

View File

@ -231,7 +231,7 @@ public class JvmThreadInstanceEntryImpl
log.debug("getJvmThreadInstCpuTimeNs",
"Operation not supported: " + e);
}
return new Long(l);
return l;
}
/**
@ -248,14 +248,14 @@ public class JvmThreadInstanceEntryImpl
//Monitoring is disabled
if(l == -1) l = 0;
}
return new Long(l);
return l;
}
/**
* Getter for the "JvmThreadInstBlockCount" variable.
*/
public Long getJvmThreadInstBlockCount() throws SnmpStatusException {
return new Long(info.getBlockedCount());
return info.getBlockedCount();
}
/**
@ -272,14 +272,14 @@ public class JvmThreadInstanceEntryImpl
//Monitoring is disabled
if(l == -1) l = 0;
}
return new Long(l);
return l;
}
/**
* Getter for the "JvmThreadInstWaitCount" variable.
*/
public Long getJvmThreadInstWaitCount() throws SnmpStatusException {
return new Long(info.getWaitedCount());
return info.getWaitedCount();
}
/**
@ -294,7 +294,7 @@ public class JvmThreadInstanceEntryImpl
* Getter for the "JvmThreadInstId" variable.
*/
public Long getJvmThreadInstId() throws SnmpStatusException {
return new Long(info.getThreadId());
return info.getThreadId();
}
/**

View File

@ -303,28 +303,28 @@ public class JvmThreadingImpl implements JvmThreadingMBean {
* Getter for the "JvmThreadTotalStartedCount" variable.
*/
public Long getJvmThreadTotalStartedCount() throws SnmpStatusException {
return new Long(getThreadMXBean().getTotalStartedThreadCount());
return getThreadMXBean().getTotalStartedThreadCount();
}
/**
* Getter for the "JvmThreadPeakCount" variable.
*/
public Long getJvmThreadPeakCount() throws SnmpStatusException {
return new Long(getThreadMXBean().getPeakThreadCount());
return (long)getThreadMXBean().getPeakThreadCount();
}
/**
* Getter for the "JvmThreadDaemonCount" variable.
*/
public Long getJvmThreadDaemonCount() throws SnmpStatusException {
return new Long(getThreadMXBean().getDaemonThreadCount());
return (long)getThreadMXBean().getDaemonThreadCount();
}
/**
* Getter for the "JvmThreadCount" variable.
*/
public Long getJvmThreadCount() throws SnmpStatusException {
return new Long(getThreadMXBean().getThreadCount());
return (long)getThreadMXBean().getThreadCount();
}
/**
@ -332,7 +332,7 @@ public class JvmThreadingImpl implements JvmThreadingMBean {
*/
public synchronized Long getJvmThreadPeakCountReset()
throws SnmpStatusException {
return new Long(jvmThreadPeakCountReset);
return jvmThreadPeakCountReset;
}
/**

View File

@ -329,7 +329,7 @@ public class Util {
try {
dbb = (MappedByteBuffer)directByteBufferConstructor.newInstance(
new Object[] { new Integer(size),
new Long(addr),
addr,
fd,
unmapper });
} catch (InstantiationException |
@ -374,7 +374,7 @@ public class Util {
try {
dbb = (MappedByteBuffer)directByteBufferRConstructor.newInstance(
new Object[] { new Integer(size),
new Long(addr),
addr,
fd,
unmapper });
} catch (InstantiationException |

View File

@ -106,7 +106,7 @@ public class GetLongAction implements java.security.PrivilegedAction<Long> {
public Long run() {
Long value = Long.getLong(theProp);
if ((value == null) && defaultSet)
return new Long(defaultVal);
return defaultVal;
return value;
}
}

View File

@ -203,7 +203,7 @@ public class GSSNameElement implements GSSNameSpi {
}
public int hashCode() {
return new Long(pName).hashCode();
return Long.hashCode(pName);
}
public byte[] export() throws GSSException {

View File

@ -188,8 +188,8 @@ public class KerberosTime {
}
public int getMicroSeconds() {
Long temp_long = new Long((kerberosTime % 1000L) * 1000L);
return temp_long.intValue() + microSeconds;
int temp_int = (int) ((kerberosTime % 1000L) * 1000L);
return temp_int + microSeconds;
}
/**
@ -250,8 +250,7 @@ public class KerberosTime {
}
public int getSeconds() {
Long temp_long = new Long(kerberosTime / 1000L);
return temp_long.intValue();
return (int) (kerberosTime / 1000L);
}
/**

View File

@ -1675,7 +1675,7 @@ public final class Main {
Object[] source = {new Integer(keysize),
privKey.getAlgorithm(),
chain[0].getSigAlgName(),
new Long(validity),
validity,
x500Name};
System.err.println(form.format(source));
}

View File

@ -66,7 +66,7 @@ class BinaryConstantPool implements Constants {
cpool[i] = new Float(in.readFloat());
break;
case CONSTANT_LONG:
cpool[i++] = new Long(in.readLong());
cpool[i++] = in.readLong();
break;
case CONSTANT_DOUBLE:
cpool[i++] = new Double(in.readDouble());

View File

@ -56,7 +56,7 @@ public class MemoryPoolProxy {
ObjectName mbeanName = new ObjectName(GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE +
",name=" + name);
if (client.isRegistered(mbeanName)) {
gcMBeans.put(mbeanName, new Long(0));
gcMBeans.put(mbeanName, 0L);
}
} catch (Exception e) {
assert false;
@ -97,7 +97,7 @@ public class MemoryPoolProxy {
Long gcCount = e.getValue();
Long newCount = gc.getCollectionCount();
if (newCount > gcCount) {
gcMBeans.put(e.getKey(), new Long(newCount));
gcMBeans.put(e.getKey(), newCount);
lastGcInfo = gc.getLastGcInfo();
if (lastGcInfo.getEndTime() > lastGcEndTime) {
gcId = lastGcInfo.getId();

View File

@ -83,7 +83,7 @@ class BitNotExpression extends UnaryExpression {
asm.add(where, opc_ldc, new Integer(-1));
asm.add(where, opc_ixor);
} else {
asm.add(where, opc_ldc2_w, new Long(-1));
asm.add(where, opc_ldc2_w, -1L);
asm.add(where, opc_lxor);
}
}

View File

@ -131,7 +131,7 @@ class IncDecExpression extends UnaryExpression {
asm.add(where, inc ? opc_iadd : opc_isub);
break;
case TC_LONG:
asm.add(where, opc_ldc2_w, new Long(1));
asm.add(where, opc_ldc2_w, 1L);
asm.add(where, inc ? opc_ladd : opc_lsub);
break;
case TC_FLOAT:

View File

@ -50,7 +50,7 @@ class LongExpression extends ConstantExpression {
* Get the value
*/
public Object getValue() {
return new Long(value);
return value;
}
/**
@ -71,7 +71,7 @@ class LongExpression extends ConstantExpression {
* Code
*/
public void codeValue(Environment env, Context ctx, Assembler asm) {
asm.add(where, opc_ldc2_w, new Long(value));
asm.add(where, opc_ldc2_w, value);
}
/**

View File

@ -747,7 +747,7 @@ class FileSystemPreferences extends AbstractPreferences {
nmt = systemRootModFile.lastModified();
isSystemRootModified = systemRootModTime == nmt;
}
return new Long(nmt);
return nmt;
}
});
try {

View File

@ -38,8 +38,9 @@ public class XFocusProxyWindow extends XBaseWindow {
public XFocusProxyWindow(XWindowPeer owner) {
super(new XCreateWindowParams(new Object[] {
BOUNDS, new Rectangle(-1, -1, 1, 1),
PARENT_WINDOW, new Long(owner.getWindow()),
EVENT_MASK, new Long(XConstants.FocusChangeMask | XConstants.KeyPressMask | XConstants.KeyReleaseMask)
PARENT_WINDOW, Long.valueOf(owner.getWindow()),
EVENT_MASK, Long.valueOf(XConstants.FocusChangeMask | XConstants
.KeyPressMask | XConstants.KeyReleaseMask)
}));
this.owner = owner;
}