0 Replies Latest reply on Oct 6, 2010 3:22 AM by swiegersf.francois.swiegers.gmail.com

    Infinite loop at bootstrap with self-referencing parameterized interfaces

    swiegersf.francois.swiegers.gmail.com

      Good day,


      I have the following interfaces in my workspace:


      public interface SomeInterface<T> {
      
           AnotherInterface<T> doSomething();
      
           public interface AnotherInterface<T> extends SomeInterface<T> {
           }
      
      }
      



      When I try to bootstrap Weld, I get the following StackOverflowError


      com.google.common.collect.ComputationException
      java.lang.StackOverflowError
       at com.google.common.collect.ComputingConcurrentHashMap.compute(ComputingConcurrentHashMap.java:218)
       at com.google.common.collect.ComputingConcurrentHashMap.apply(ComputingConcurrentHashMap.java:100)
       at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:515)
       at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:182)
       at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:94)
       at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:131)
       at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:171)
       at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:412)
       at org.jboss.weld.environment.se.Weld.initialize(Weld.java:91)
      
      ...
      
      Caused by java.lang.StackOverflowError
       at sun.reflect.generics.repository.GenericDeclRepository.getTypeParameters(GenericDeclRepository.java:64)
       at java.lang.Class.getTypeParameters(Class.java:621)
       at org.jboss.weld.util.reflection.HierarchyDiscovery.resolveTypeParameter(HierarchyDiscovery.java:201)
       at org.jboss.weld.util.reflection.HierarchyDiscovery.resolveType(HierarchyDiscovery.java:171)
       at org.jboss.weld.util.reflection.HierarchyDiscovery.resolveTypeParameter(HierarchyDiscovery.java:207)
       at org.jboss.weld.util.reflection.HierarchyDiscovery.resolveType(HierarchyDiscovery.java:171)
       at org.jboss.weld.util.reflection.HierarchyDiscovery.resolveTypeParameter(HierarchyDiscovery.java:207)
       at org.jboss.weld.util.reflection.HierarchyDiscovery.resolveType(HierarchyDiscovery.java:171)
       at org.jboss.weld.util.reflection.HierarchyDiscovery.resolveTypeParameter(HierarchyDiscovery.java:222)
       at org.jboss.weld.util.reflection.HierarchyDiscovery.resolveType(HierarchyDiscovery.java:171)
       at org.jboss.weld.util.reflection.HierarchyDiscovery.resolveTypeParameter(HierarchyDiscovery.java:207)
       at org.jboss.weld.util.reflection.HierarchyDiscovery.resolveType(HierarchyDiscovery.java:171)
       at org.jboss.weld.util.reflection.HierarchyDiscovery.resolveTypeParameter(HierarchyDiscovery.java:207)
      
      ...
      
       



      This happens only when



      1. the interfaces are parameterized

      2. the second interface extends the first and

      3. the first interface has a method with the second interface as a return type



      Also note that these are not interfaces to CDI managed beans at all - I'm not sure why Weld is even attempting to read them.