aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From timothyjw...@apache.org
Subject svn commit: r1171946 - in /aries/trunk/proxy/proxy-impl/src: main/java/org/apache/aries/proxy/impl/interfaces/ test/java/org/apache/aries/blueprint/proxy/
Date Sat, 17 Sep 2011 11:05:37 GMT
Author: timothyjward
Date: Sat Sep 17 11:05:37 2011
New Revision: 1171946

URL: http://svn.apache.org/viewvc?rev=1171946&view=rev
Log:
ARIES-746: Fix Object methods on pure interface proxies - avoid implementing interfaces in
a random order (In particular make sure that we get the same behaviour from Sun and IBM derived
VMs)

Modified:
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/ProxyClassLoader.java
    aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/InterfaceProxyingTest.java

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java?rev=1171946&r1=1171945&r2=1171946&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/InterfaceProxyGenerator.java
Sat Sep 17 11:05:37 2011
@@ -23,6 +23,7 @@ import java.lang.reflect.Constructor;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.WeakHashMap;
 import java.util.concurrent.Callable;
@@ -55,7 +56,7 @@ public final class InterfaceProxyGenerat
     
     ProxyClassLoader pcl = null;
     
-    HashSet<Class<?>> classSet = createSet(ifaces);
+    LinkedHashSet<Class<?>> classSet = createSet(ifaces);
     
     synchronized (cache) {
       WeakReference<ProxyClassLoader> ref = cache.get(client);
@@ -92,8 +93,8 @@ public final class InterfaceProxyGenerat
    * @param ifaces
    * @return
    */
-  private static HashSet<Class<?>> createSet(Collection<Class<?>>
ifaces) {
-    HashSet<Class<?>> classes = new HashSet<Class<?>>();
+  private static LinkedHashSet<Class<?>> createSet(Collection<Class<?>>
ifaces) {
+    LinkedHashSet<Class<?>> classes = new LinkedHashSet<Class<?>>();
     for(Class<?> c : ifaces) {
       //If we already have a class contained then we have already covered its hierarchy
       if(classes.add(c))

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/ProxyClassLoader.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/ProxyClassLoader.java?rev=1171946&r1=1171945&r2=1171946&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/ProxyClassLoader.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/interfaces/ProxyClassLoader.java
Sat Sep 17 11:05:37 2011
@@ -5,6 +5,7 @@ import java.security.PermissionCollectio
 import java.security.Permissions;
 import java.security.ProtectionDomain;
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
@@ -32,8 +33,8 @@ final class ProxyClassLoader extends Cla
   }
   
   /** A {@link Map} of classes we already know */
-  private final ConcurrentMap<HashSet<Class<?>>, String> classes = 
-                new ConcurrentHashMap<HashSet<Class<?>>, String>();
+  private final ConcurrentMap<LinkedHashSet<Class<?>>, String> classes
= 
+                new ConcurrentHashMap<LinkedHashSet<Class<?>>, String>();
   
   private final ConcurrentMap<String, Class<?>> locatedClasses = 
                 new ConcurrentHashMap<String, Class<?>>();
@@ -96,7 +97,7 @@ final class ProxyClassLoader extends Cla
       return false;
   }
 
-  public Class<?> createProxyClass(HashSet<Class<?>> createSet) throws
UnableToProxyException {
+  public Class<?> createProxyClass(LinkedHashSet<Class<?>> createSet) throws
UnableToProxyException {
     
     String className = classes.get(createSet);
     

Modified: aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/InterfaceProxyingTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/InterfaceProxyingTest.java?rev=1171946&r1=1171945&r2=1171946&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/InterfaceProxyingTest.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/InterfaceProxyingTest.java
Sat Sep 17 11:05:37 2011
@@ -197,10 +197,10 @@ public class InterfaceProxyingTest {
       
       // obeys hashCode and equals, they *are* on the interface
       assertTrue(proxied.equals(Arrays.asList("one", "two", "three")));
-      assertEquals(Collection.class.getMethod("equals", Object.class), listener.getLastMethod());
+      assertEquals(List.class.getMethod("equals", Object.class), listener.getLastMethod());
       listener.clear();
       assertEquals(Arrays.asList("one", "two", "three").hashCode(), proxied.hashCode());
-      assertEquals(Collection.class.getMethod("hashCode"), listener.getLastMethod());
+      assertEquals(List.class.getMethod("hashCode"), listener.getLastMethod());
       listener.clear();
       // and toString
       assertEquals(list.toString(), proxied.toString());



Mime
View raw message