You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by gn...@apache.org on 2018/01/31 08:18:18 UTC

svn commit: r1822771 - in /aries/trunk/blueprint/blueprint-core/src: main/java/org/apache/aries/blueprint/utils/generics/ test/java/org/apache/aries/blueprint/ test/java/org/apache/aries/blueprint/pojos/ test/resources/

Author: gnodet
Date: Wed Jan 31 08:18:18 2018
New Revision: 1822771

URL: http://svn.apache.org/viewvc?rev=1822771&view=rev
Log:
[ARIES-1282] BeanRecipe.findMatchingMethods is not able to filter out overridden method signatures

Added:
    aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/CachePojos.java
    aries/trunk/blueprint/blueprint-core/src/test/resources/test-cache.xml
Modified:
    aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/generics/TypeInference.java
    aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/WiringTest.java

Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/generics/TypeInference.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/generics/TypeInference.java?rev=1822771&r1=1822770&r2=1822771&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/generics/TypeInference.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/utils/generics/TypeInference.java Wed Jan 31 08:18:18 2018
@@ -207,9 +207,7 @@ public class TypeInference {
             }
             methods.add(method);
         }
-        if (!instance) {
-            methods = applyStaticHidingRules(methods);
-        }
+        methods = applyStaticHidingRules(methods);
         List<Executable<Method>> executables = new ArrayList<Executable<Method>>();
         for (Method method : methods) {
             executables.add(new MethodExecutable(method));

Modified: aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/WiringTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/WiringTest.java?rev=1822771&r1=1822770&r2=1822771&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/WiringTest.java (original)
+++ aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/WiringTest.java Wed Jan 31 08:18:18 2018
@@ -44,17 +44,7 @@ import org.apache.aries.blueprint.di.Map
 import org.apache.aries.blueprint.di.Recipe;
 import org.apache.aries.blueprint.di.Repository;
 import org.apache.aries.blueprint.parser.ComponentDefinitionRegistryImpl;
-import org.apache.aries.blueprint.pojos.AmbiguousPojo;
-import org.apache.aries.blueprint.pojos.BeanD;
-import org.apache.aries.blueprint.pojos.BeanF;
-import org.apache.aries.blueprint.pojos.FITestBean;
-import org.apache.aries.blueprint.pojos.Multiple;
-import org.apache.aries.blueprint.pojos.PojoA;
-import org.apache.aries.blueprint.pojos.PojoB;
-import org.apache.aries.blueprint.pojos.PojoGenerics;
-import org.apache.aries.blueprint.pojos.PojoListener;
-import org.apache.aries.blueprint.pojos.PojoRecursive;
-import org.apache.aries.blueprint.pojos.Primavera;
+import org.apache.aries.blueprint.pojos.*;
 import org.apache.aries.blueprint.proxy.ProxyUtils;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.blueprint.container.ComponentDefinitionException;
@@ -520,6 +510,12 @@ public class WiringTest extends Abstract
         repository.create("executorService");
     }
 
+    public void testCachePojo() throws Exception {
+        ComponentDefinitionRegistryImpl registry = parse("/test-cache.xml");
+        Repository repository = new TestBlueprintContainer(registry).getRepository();
+        Thread.currentThread().setContextClassLoader(CachePojos.CacheContainer.class.getClassLoader());
+        repository.create("queueCountCache");
+    }
 
     public void testCircular() throws Exception {
         BlueprintRepository repository = createBlueprintContainer().getRepository();

Added: aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/CachePojos.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/CachePojos.java?rev=1822771&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/CachePojos.java (added)
+++ aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/CachePojos.java Wed Jan 31 08:18:18 2018
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.pojos;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+public class CachePojos {
+
+    public interface BasicCache<K, V> {
+
+    }
+
+    public interface Cache<K, V> extends BasicCache<K, V> {
+
+    }
+
+    public interface CacheContainer extends BasicCacheContainer {
+        <K, V> Cache<K, V> getCache();
+
+        <K, V> Cache<K, V> getCache(String var1);
+    }
+
+    public interface BasicCacheContainer {
+
+        <K, V> BasicCache<K, V> getCache();
+
+        <K, V> BasicCache<K, V> getCache(String var1);
+    }
+
+    public static class SimpleCacheContainerFactory {
+        public static CacheContainer create() {
+            return (CacheContainer) Proxy.newProxyInstance(
+                    SimpleCacheContainerFactory.class.getClassLoader(),
+                    new Class<?>[] { CacheContainer.class },
+                    new InvocationHandler() {
+                        @Override
+                        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+                            return new Cache() {};
+                        }
+                    });
+        }
+    }
+
+}

Added: aries/trunk/blueprint/blueprint-core/src/test/resources/test-cache.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/test/resources/test-cache.xml?rev=1822771&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/test/resources/test-cache.xml (added)
+++ aries/trunk/blueprint/blueprint-core/src/test/resources/test-cache.xml Wed Jan 31 08:18:18 2018
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <bean id="cacheManager"
+          class="org.apache.aries.blueprint.pojos.CachePojos.SimpleCacheContainerFactory"
+          factory-method="create" />
+
+    <bean id="queueCountCache" factory-ref="cacheManager" factory-method="getCache">
+        <argument index="0" type="java.lang.String" value="QueueCountCache" />
+    </bean>
+
+</blueprint>
\ No newline at end of file