summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarvey Harrison <[email protected]>2012-10-14 11:16:00 -0700
committerHarvey Harrison <[email protected]>2012-10-14 11:19:56 -0700
commit5e0af71477289c7686a0f4b348dfe36fb8e5b644 (patch)
tree4a43e6b4faa8860e052176cf136bd7ed8ddf8a9f /src
parent6838d3593512d0388948c784023303d966b6e298 (diff)
gluegen: conditional cleanup in Type.equals()
- instanceof includes null checking - simplify comparison of name, either they are the same object (possibly null) or they compare equal as strings Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/Type.java19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/java/com/jogamp/gluegen/cgram/types/Type.java b/src/java/com/jogamp/gluegen/cgram/types/Type.java
index 169d962..a269ae0 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/Type.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/Type.java
@@ -187,28 +187,23 @@ public abstract class Type implements Cloneable {
*/
@Override
public boolean equals(Object arg) {
- if (arg == this) {
+ if (arg == this)
return true;
- }
- if (arg == null || (!(arg instanceof Type))) {
+
+ if (!(arg instanceof Type))
return false;
- }
- Type t = (Type) arg;
+
+ Type t = (Type)arg;
if (size != t.size)
return false;
if (cvAttributes != t.cvAttributes)
return false;
- // Includes test for both names == null
- if (name == t.name)
- return true;
-
if (name != null)
return name.equals(t.name);
-
- // If we got here, name is null, t.name is not, they cannot compare equal
- return false;
+ else
+ return name == t.name;
}
/** Returns a string representation of this type. This string is not