summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-06-09 06:11:33 +0200
committerSven Gothel <[email protected]>2013-06-09 06:11:33 +0200
commit1c1ffed31548094cf7afbb4c83b0cb627ae3a1ad (patch)
treec25833a57fdbc471d6796d02a8e714e2fcdaa53c /src/nativewindow/classes
parent70087b3067df7bfe6612af7388f8e86f77b150b4 (diff)
Bug 747: Allow usage of IdentityHashMap w/ keys: AbstractGraphicsDevice.getUniqueID() and GLContext.getDeviceVersionAvailableKey()
.. both value classes unique, long lived and rare.
Diffstat (limited to 'src/nativewindow/classes')
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java12
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java7
2 files changed, 15 insertions, 4 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
index 585cd1f09..ed305d49e 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
@@ -89,10 +89,16 @@ public interface AbstractGraphicsDevice extends Cloneable {
public int getUnitID();
/**
- * Returns a unique ID String of this device using {@link #getType() type},
- * {@link #getConnection() connection} and {@link #getUnitID() unitID}.<br>
- * The unique ID does not reflect the instance of the device, hence the handle is not included.<br>
+ * Returns a unique ID object of this device using {@link #getType() type},
+ * {@link #getConnection() connection} and {@link #getUnitID() unitID} as it's key components.
+ * <p>
+ * The unique ID does not reflect the instance of the device, hence the handle is not included.
* The unique ID may be used as a key for semantic device mapping.
+ * </p>
+ * <p>
+ * The returned string object reference is unique using {@link String#intern()}
+ * and hence can be used as a key itself.
+ * </p>
*/
public String getUniqueID();
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
index 66b81d7fa..0bf5c2937 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
@@ -253,7 +253,12 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
return toolkitLock;
}
+ /**
+ * Returns a unique String object using {@link String#intern()} for the given arguments,
+ * which object reference itself can be used as a key.
+ */
protected static String getUniqueID(String type, String connection, int unitID) {
- return (type + separator + connection + separator + unitID).intern();
+ final String r = (type + separator + connection + separator + unitID).intern();
+ return r.intern();
}
}