File tree Expand file tree Collapse file tree 9 files changed +26
-34
lines changed
caching.api/src/org/graalvm/visualvm/api/caching
core/src/org/graalvm/visualvm/core/datasupport
lib.profiler/src/org/graalvm/visualvm/lib/jfluid
profiler.api/src/org/graalvm/visualvm/lib/profiler/api/java
profiler.oql/src/org/graalvm/visualvm/lib/profiler/oql/engine/api Expand file tree Collapse file tree 9 files changed +26
-34
lines changed Original file line number Diff line number Diff line change 24
24
*/
25
25
package org .graalvm .visualvm .api .caching ;
26
26
27
+ import java .util .Objects ;
28
+
27
29
/**
28
30
* Generic representation of a cache entry
29
31
* Supports operations based on TTL (time-to-live)
@@ -88,7 +90,7 @@ public boolean equals(Object obj) {
88
90
if (this .updateTs != other .updateTs ) {
89
91
return false ;
90
92
}
91
- if (this . object != other . object && ( this . object == null || ! this . object . equals ( other .object ) )) {
93
+ if (! Objects . equals ( object , other .object )) {
92
94
return false ;
93
95
}
94
96
return true ;
Original file line number Diff line number Diff line change 27
27
28
28
import java .lang .ref .ReferenceQueue ;
29
29
import java .lang .ref .SoftReference ;
30
+ import java .util .Objects ;
30
31
31
32
/**
32
33
* Extended {@linkplain SoftReference} to allow euqals() and hashCode()
@@ -51,8 +52,7 @@ class SoftReferenceEx<T> extends SoftReference<T> {
51
52
public boolean equals (Object obj ) {
52
53
if (!(obj instanceof SoftReferenceEx )) return false ;
53
54
SoftReferenceEx other = (SoftReferenceEx )obj ;
54
- if (get () == null || other .get () == null ) return false ;
55
- return get ().equals (other .get ());
55
+ return Objects .equals (get (), other .get ());
56
56
}
57
57
58
58
@ Override
Original file line number Diff line number Diff line change 27
27
28
28
import java .lang .ref .ReferenceQueue ;
29
29
import java .lang .ref .WeakReference ;
30
+ import java .util .Objects ;
30
31
31
32
/**
32
33
* Extended {@linkplain WeakReference} to allow euqals() and hashCode()
@@ -51,8 +52,7 @@ class WeakReferenceEx<T> extends WeakReference<T> {
51
52
public boolean equals (Object obj ) {
52
53
if (!(obj instanceof WeakReferenceEx )) return false ;
53
54
WeakReferenceEx other = (WeakReferenceEx )obj ;
54
- if (get () == null || other .get () == null ) return false ;
55
- return get ().equals (other .get ());
55
+ return Objects .equals (get (), other .get ());
56
56
}
57
57
58
58
@ Override
Original file line number Diff line number Diff line change 26
26
27
27
import java .lang .ref .ReferenceQueue ;
28
28
import java .lang .ref .WeakReference ;
29
+ import java .util .Objects ;
29
30
30
31
/**
31
32
* WeakReference delegating hashCode() and equals(Object) methods to the referenced object.
@@ -71,9 +72,6 @@ public boolean equals(Object o) {
71
72
if (!(o instanceof ComparableWeakReference )) {
72
73
return false ;
73
74
}
74
- try {
75
- return this .get ().equals (((ComparableWeakReference ) o ).get ());
76
- } catch (Exception e ) {}
77
- return false ;
75
+ return Objects .equals (get (), ((ComparableWeakReference ) o ).get ());
78
76
}
79
77
}
Original file line number Diff line number Diff line change 25
25
26
26
package org .graalvm .visualvm .lib .jfluid .client ;
27
27
28
+ import java .util .Objects ;
28
29
import java .util .regex .Pattern ;
29
30
import org .graalvm .visualvm .lib .jfluid .global .CommonConstants ;
30
31
import org .graalvm .visualvm .lib .jfluid .utils .formatting .DefaultMethodNameFormatter ;
@@ -206,24 +207,11 @@ public boolean equals(Object obj) {
206
207
// }
207
208
if (!getNormalizedClassName ().equals (other .getNormalizedClassName ())) return false ;
208
209
209
- if (this .methodName != null ) {
210
- if (!this .methodName .equals (other .methodName )) {
211
- return false ;
212
- }
213
- } else {
214
- if (other .methodName != null ) {
215
- return false ;
216
- }
210
+ if (!Objects .equals (methodName , other .methodName )) {
211
+ return false ;
217
212
}
218
-
219
- if (this .methodSignature != null ) {
220
- if (!this .methodSignature .equals (other .methodSignature )) {
221
- return false ;
222
- }
223
- } else {
224
- if (other .methodSignature != null ) {
225
- return false ;
226
- }
213
+ if (!Objects .equals (methodSignature , other .methodSignature )) {
214
+ return false ;
227
215
}
228
216
229
217
return true ;
Original file line number Diff line number Diff line change 34
34
import java .util .List ;
35
35
import java .util .ListIterator ;
36
36
import java .util .Map ;
37
+ import java .util .Objects ;
37
38
import java .util .Set ;
38
39
import java .util .concurrent .atomic .AtomicReference ;
39
40
import org .graalvm .visualvm .lib .jfluid .filters .InstrumentationFilter ;
@@ -157,10 +158,10 @@ public boolean equals(Object obj) {
157
158
return false ;
158
159
}
159
160
final MethodInfo other = (MethodInfo ) obj ;
160
- if (( className == null ) ? ( other . className != null ) : ! className .equals (other .className )) {
161
+ if (! Objects .equals (className , other .className )) {
161
162
return false ;
162
163
}
163
- if (( methodName == null ) ? ( other . methodName != null ) : ! methodName .equals (other .methodName )) {
164
+ if (! Objects .equals (methodName , other .methodName )) {
164
165
return false ;
165
166
}
166
167
return true ;
Original file line number Diff line number Diff line change 25
25
package org .graalvm .visualvm .lib .profiler .api .java ;
26
26
27
27
import java .util .Comparator ;
28
+ import java .util .Objects ;
28
29
import java .util .Set ;
29
30
import java .util .regex .Pattern ;
30
31
import org .openide .filesystems .FileObject ;
@@ -63,7 +64,7 @@ public boolean equals(Object obj) {
63
64
return false ;
64
65
}
65
66
final SourceClassInfo other = (SourceClassInfo ) obj ;
66
- if (( this . vmName == null ) ? ( other . vmName != null ) : ! this . vmName . equals (other .vmName )) {
67
+ if (! Objects . equals (vmName , other .vmName )) {
67
68
return false ;
68
69
}
69
70
return true ;
Original file line number Diff line number Diff line change 25
25
package org .graalvm .visualvm .lib .profiler .api .java ;
26
26
27
27
import java .lang .reflect .Modifier ;
28
+ import java .util .Objects ;
28
29
29
30
/**
30
31
* A simplified java method descriptor
@@ -56,13 +57,13 @@ public boolean equals(Object obj) {
56
57
return false ;
57
58
}
58
59
final SourceMethodInfo other = (SourceMethodInfo ) obj ;
59
- if (( this . className == null ) ? ( other . className != null ) : ! this . className . equals (other .className )) {
60
+ if (! Objects . equals (className , other .className )) {
60
61
return false ;
61
62
}
62
- if (( this . name == null ) ? ( other . name != null ) : ! this . name . equals (other .name )) {
63
+ if (! Objects . equals (name , other .name )) {
63
64
return false ;
64
65
}
65
- if (( this . signature == null ) ? ( other . signature != null ) : ! this . signature . equals (other .signature )) {
66
+ if (! Objects . equals (signature , other .signature )) {
66
67
return false ;
67
68
}
68
69
return true ;
Original file line number Diff line number Diff line change 25
25
package org .graalvm .visualvm .lib .profiler .oql .engine .api ;
26
26
27
27
import java .lang .ref .WeakReference ;
28
+ import java .util .Objects ;
28
29
import org .graalvm .visualvm .lib .jfluid .heap .Heap ;
29
30
import org .graalvm .visualvm .lib .jfluid .heap .Instance ;
30
31
import org .graalvm .visualvm .lib .jfluid .heap .JavaClass ;
@@ -115,10 +116,10 @@ public boolean equals(Object obj) {
115
116
return false ;
116
117
}
117
118
final ReferenceChain other = (ReferenceChain ) obj ;
118
- if (this . obj != other . obj && ( this . obj == null || ! this . obj . equals ( other .obj ) )) {
119
+ if (! Objects . equals ( obj , other .obj )) {
119
120
return false ;
120
121
}
121
- if (this . next != other . next && ( this . next == null || ! this . next . equals ( other .next ) )) {
122
+ if (! Objects . equals ( next , other .next )) {
122
123
return false ;
123
124
}
124
125
return true ;
You can’t perform that action at this time.
0 commit comments