From 4418ad0388b58cab6a129908f78baec5bc73906e Mon Sep 17 00:00:00 2001
From: Noel Grandin WeakReference
wrappers are automatically cleared as soon as the
* values are disposed.
WeakMap
.
*/
@@ -70,7 +78,7 @@ public final class WeakMap implements Map {
*
* @param m the map whose mappings are to be placed in this map
*/
- public WeakMap(Map m) {
+ public WeakMap(Maptrue
if this map contains a mapping for the
* specified key
*/
- public boolean containsKey(Object key) {
+ public boolean containsKey(K key) {
return map.containsKey(key);
}
@@ -122,7 +130,7 @@ public final class WeakMap implements Map {
* @return true
if this map maps one or more keys to the
* specified value
*/
- public boolean containsValue(Object value) {
+ public boolean containsValue(WeakReferencenull
if the map contains no mapping for this key
*/
- public Object get(Object key) {
+ public WeakReferencenull
if there was no mapping for the key
*/
- public Object put(Object key, Object value) {
+ public WeakReferencenull
if there was no mapping for the key
*/
- public Object remove(Object key) {
+ public WeakReferenceWeakReference
.
*/
- public void putAll(Map t) {
+ public void putAll(MapWeakReference
, or
* null
if ref
is null
*/
- public static Object getValue(Object ref) {
- return ref == null ? null : ((WeakReference) ref).get();
+ public static
* @return the corresponding java class.
*/
- Class getZClass();
+ Class> getZClass();
}
diff --git a/ridljar/com/sun/star/uno/Type.java b/ridljar/com/sun/star/uno/Type.java
index 31766441b59c..539c6ebd6a77 100644
--- a/ridljar/com/sun/star/uno/Type.java
+++ b/ridljar/com/sun/star/uno/Type.java
@@ -78,7 +78,7 @@ public class Type {
TYPE_NAME_ANY
};
- private static final HashMap __javaClassToTypeClass = new HashMap();
+ private static final HashMapnull
.
*/
- public Type(Class zClass) {
+ public Type(Class> zClass) {
init(null, zClass, false, false);
}
@@ -243,7 +243,7 @@ public class Type {
*
* @since UDK 3.2.0
*/
- public Type(Class zClass, boolean alternative) {
+ public Type(Class> zClass, boolean alternative) {
init(null, zClass, alternative, false);
}
@@ -333,7 +333,7 @@ public class Type {
* @return the type name; may be null
in extreme situations
* (inconsistent TypeClass
, error loading a class)
*/
- public Class getZClass() {
+ public Class> getZClass() {
synchronized (this) {
if (_class == null) {
_class = determineClass();
@@ -401,8 +401,8 @@ public class Type {
}
case TypeClass.EXCEPTION_value:
case TypeClass.INTERFACE_value:
- Class c1 = getZClass();
- Class c2 = type.getZClass();
+ Class> c1 = getZClass();
+ Class> c2 = type.getZClass();
return c1 != null && c2 != null && c1.isAssignableFrom(c2);
default:
@@ -428,9 +428,9 @@ public class Type {
}
private void init(
- String name, Class zClass, boolean alternative, boolean arguments)
+ String name, Class> zClass, boolean alternative, boolean arguments)
{
- TypeClass[] tc = (TypeClass[]) __javaClassToTypeClass.get(zClass);
+ TypeClass[] tc = __javaClassToTypeClass.get(zClass);
if (tc != null) {
// tc only contains primitive type classes, except for
// TypeClass.INTERFACE, which stands for XInterface (the alternative
@@ -488,7 +488,7 @@ public class Type {
}
}
- private Class determineClass() {
+ private Class> determineClass() {
switch (_typeClass.getValue()) {
case TypeClass.VOID_value:
return _typeName.equals(TYPE_NAME_VOID) ? void.class : null;
@@ -580,7 +580,7 @@ public class Type {
if (args >= 0) {
base = base.substring(0, args);
}
- Class c;
+ Class> c;
try {
c = Class.forName(base);
} catch (ClassNotFoundException e) {
@@ -604,7 +604,7 @@ public class Type {
case TypeClass.EXCEPTION_value:
case TypeClass.INTERFACE_value:
{
- Class c;
+ Class> c;
try {
c = Class.forName(_typeName);
} catch (ClassNotFoundException e) {
@@ -616,7 +616,7 @@ public class Type {
case TypeClass.STRUCT_value:
{
int args = _typeName.indexOf('<');
- Class c;
+ Class> c;
try {
c = Class.forName(
args < 0 ? _typeName : _typeName.substring(0, args));
@@ -638,6 +638,6 @@ public class Type {
protected TypeClass _typeClass; // TODO should be final
protected String _typeName; // TODO should be final
- protected Class _class;
+ protected Class> _class;
protected ITypeDescription _iTypeDescription;
}
diff --git a/ridljar/com/sun/star/uno/UnoRuntime.java b/ridljar/com/sun/star/uno/UnoRuntime.java
index bac97b57e021..e20ba72e492d 100644
--- a/ridljar/com/sun/star/uno/UnoRuntime.java
+++ b/ridljar/com/sun/star/uno/UnoRuntime.java
@@ -149,7 +149,7 @@ public class UnoRuntime {
}
}
// Ensure that the object implements the requested interface type:
- Class c = type.getZClass();
+ Class> c = type.getZClass();
if (c == null || !c.isInstance(object)) {
object = null;
}
@@ -367,7 +367,7 @@ public class UnoRuntime {
* if no context has been set for the current thread
*/
public static XCurrentContext getCurrentContext() {
- return (XCurrentContext) currentContext.get();
+ return currentContext.get();
}
/**
@@ -407,13 +407,13 @@ public class UnoRuntime {
throws java.lang.Exception
{
synchronized (environments) {
- IEnvironment env = (IEnvironment) WeakMap.getValue(
+ IEnvironment env = WeakMap.getValue(
environments.get(name + context));
if (env == null) {
- Class c = Class.forName(
+ Class> c = Class.forName(
"com.sun.star.lib.uno.environments." + name + "." + name
+ "_environment");
- Constructor ctor = c.getConstructor(
+ Constructor> ctor = c.getConstructor(
new Class[] { Object.class });
env = (IEnvironment) ctor.newInstance(new Object[] { context });
environments.put(name + context, env);
@@ -453,9 +453,9 @@ public class UnoRuntime {
String name = from.getName() + "_" + to.getName();
String hashName = from.getName() + from.getContext() + "_"
+ to.getName() + to.getContext();
- IBridge bridge = (IBridge) WeakMap.getValue(bridges.get(hashName));
+ IBridge bridge = WeakMap.getValue(bridges.get(hashName));
if(bridge == null) {
- Class zClass = null;
+ Class> zClass = null;
String className = name + "_bridge";
try {
zClass = Class.forName(className);
@@ -464,9 +464,9 @@ public class UnoRuntime {
+ className;
zClass = Class.forName(className);
}
- Class[] signature = {
+ Class>[] signature = {
IEnvironment.class, IEnvironment.class, args.getClass() };
- Constructor constructor = zClass.getConstructor(signature);
+ Constructor> constructor = zClass.getConstructor(signature);
Object[] iargs = { from, to, args };
bridge = (IBridge) constructor.newInstance(iargs);
bridges.put(hashName, bridge);
@@ -521,16 +521,16 @@ public class UnoRuntime {
* offering a replacement.
*/
public static IBridge[] getBridges() {
- ArrayList l = new ArrayList();
+ ArrayList