You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by bw...@apache.org on 2022/02/20 19:20:08 UTC
[netbeans] branch master updated: Cleanup floating-point constructor use (#3648)
This is an automated email from the ASF dual-hosted git repository.
bwalker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 4ae01ea Cleanup floating-point constructor use (#3648)
4ae01ea is described below
commit 4ae01ea70f4530443343beee3292e880a74099bd
Author: Brad Walker <bw...@musings.com>
AuthorDate: Sun Feb 20 14:19:55 2022 -0500
Cleanup floating-point constructor use (#3648)
Cleaned up the deprecated use of old constructors. The compiler/VM will now autobox this into a proper
class. So this change removes warnings like this:
[repeat] /home/bwalker/src/netbeans/profiler/lib.profiler/src/org/netbeans/lib/profiler/heap/HprofInstanceValue.java:93: warning: [deprecation] Byte(byte) in Byte has been deprecated
[repeat] return new Byte(bt);
[repeat] ^
Also, added a couple of override annotations since I was here..
---
.../lib/profiler/heap/HprofInstanceValue.java | 48 ++++++++++------------
1 file changed, 21 insertions(+), 27 deletions(-)
diff --git a/profiler/lib.profiler/src/org/netbeans/lib/profiler/heap/HprofInstanceValue.java b/profiler/lib.profiler/src/org/netbeans/lib/profiler/heap/HprofInstanceValue.java
index 9bf4d2b..9e45143 100644
--- a/profiler/lib.profiler/src/org/netbeans/lib/profiler/heap/HprofInstanceValue.java
+++ b/profiler/lib.profiler/src/org/netbeans/lib/profiler/heap/HprofInstanceValue.java
@@ -40,14 +40,17 @@ class HprofInstanceValue extends HprofObject implements FieldValue {
//~ Methods ------------------------------------------------------------------------------------------------------------------
+ @Override
public Instance getDefiningInstance() {
return field.classDump.getHprof().getInstanceByOffset(new long[] {instanceOffset});
}
+ @Override
public Field getField() {
return field;
}
+ @Override
public String getValue() {
return getTypeValue().toString();
}
@@ -62,50 +65,41 @@ class HprofInstanceValue extends HprofObject implements FieldValue {
static Object getTypeValue(final HprofByteBuffer dumpBuffer, final long position, final byte type) {
switch (type) {
case HprofHeap.OBJECT:
-
long obj = dumpBuffer.getID(position);
-
- return new Long(obj);
+ return obj;
+
case HprofHeap.BOOLEAN:
-
byte b = dumpBuffer.get(position);
-
- return Boolean.valueOf(b != 0);
+ return b != 0;
+
case HprofHeap.CHAR:
-
char ch = dumpBuffer.getChar(position);
-
- return Character.valueOf(ch);
+ return ch;
+
case HprofHeap.FLOAT:
-
float f = dumpBuffer.getFloat(position);
-
- return new Float(f);
+ return f;
+
case HprofHeap.DOUBLE:
-
double d = dumpBuffer.getDouble(position);
-
- return new Double(d);
+ return d;
+
case HprofHeap.BYTE:
-
byte bt = dumpBuffer.get(position);
-
- return new Byte(bt);
+ return bt;
+
case HprofHeap.SHORT:
-
short sh = dumpBuffer.getShort(position);
-
- return new Short(sh);
+ return sh;
+
case HprofHeap.INT:
-
int i = dumpBuffer.getInt(position);
-
- return Integer.valueOf(i);
+ return i;
+
case HprofHeap.LONG:
-
long lg = dumpBuffer.getLong(position);
-
- return new Long(lg);
+ return lg;
+
default:
return "Invalid type " + type; // NOI18N
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists