diff org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/ClassLookupSupport.d @ 88:9e0ab372d5d8

Revert from TypeInfo/ClassInfo to java.lang.Class
author Frank Benoit <benoit@tionex.de>
date Sun, 19 Apr 2009 11:10:09 +0200
parents 6be48cf9f95c
children
line wrap: on
line diff
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/ClassLookupSupport.d	Sat Apr 18 14:20:15 2009 +0200
+++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/ClassLookupSupport.d	Sun Apr 19 11:10:09 2009 +0200
@@ -12,7 +12,6 @@
 module org.eclipse.core.internal.databinding.ClassLookupSupport;
 
 import java.lang.all;
-import java.nonstandard.RuntimeTraits;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -38,7 +37,7 @@
      * @param type
      * @return an array containing the given type and all its direct and indirect supertypes
      */
-    public static TypeInfo[] getTypeHierarchyFlattened(TypeInfo type) {
+    public static Class[] getTypeHierarchyFlattened(Class type) {
         List classes = null;
         //cache reference to lookup to protect against concurrent flush
         HashMap lookup = classSearchOrderLookup;
@@ -52,7 +51,7 @@
                 classSearchOrderLookup = lookup = new HashMap();
             lookup.put(type, cast(Object)classes);
         }
-        return cast(TypeInfo[]) classes.toArray(new TypeInfo[classes.size()]);
+        return cast(Class[]) classes.toArray(new Class[classes.size()]);
     }
 
     /**
@@ -65,20 +64,20 @@
      * Note that it is important to maintain a consistent class and interface
      * lookup order. See the class comment for more details.
      */
-    private static void computeClassOrder(TypeInfo adaptable, Collection classes) {
-        TypeInfo clazz = adaptable;
+    private static void computeClassOrder(Class adaptable, Collection classes) {
+        Class clazz = adaptable;
         Set seen = new HashSet(4);
         while (clazz !is null) {
             classes.add(clazz);
-            computeInterfaceOrder(getInterfaces(clazz), classes, seen);
-            clazz = isInterface(clazz) ? typeid(Object) : getSuperclass(clazz);
+            computeInterfaceOrder(clazz.getInterfaces(), classes, seen);
+            clazz = clazz.isInterface() ? Class.fromType!(Object) : clazz.getSuperclass();
         }
     }
 
-    private static void computeInterfaceOrder(TypeInfo[] interfaces, Collection classes, Set seen) {
+    private static void computeInterfaceOrder(Class[] interfaces, Collection classes, Set seen) {
         List newInterfaces = new ArrayList(interfaces.length);
         for (int i = 0; i < interfaces.length; i++) {
-            TypeInfo interfac = interfaces[i];
+            Class interfac = interfaces[i];
             if (seen.add(interfac)) {
                 //note we cannot recurse here without changing the resulting interface order
                 classes.add(interfac);
@@ -86,7 +85,7 @@
             }
         }
         for (Iterator it = newInterfaces.iterator(); it.hasNext();)
-            computeInterfaceOrder(getInterfaces(cast(TypeInfo) it.next()), classes, seen);
+            computeInterfaceOrder((cast(Class) it.next()).getInterfaces(), classes, seen);
     }