Skip to content

Commit

Permalink
Issue #429 Tolerate both MySuperInterface (#433)
Browse files Browse the repository at this point in the history
* Issue #429 Tolerate both MySuperInterface and MySuperInterface<Number> for raw-type types
  • Loading branch information
jeanouii authored Feb 27, 2023
1 parent c4eb66e commit 1a9921d
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import jakarta.enterprise.context.RequestScoped;
import jakarta.enterprise.inject.spi.Bean;

import jakarta.enterprise.util.TypeLiteral;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.cdi.tck.AbstractTest;
import org.jboss.cdi.tck.shrinkwrap.WebArchiveBuilder;
Expand Down Expand Up @@ -130,7 +131,13 @@ public void testRawBeanTypes() {
assertTrue(bean.getTypes().contains(MyRawBean.class));
assertTrue(bean.getTypes().contains(MyBean.class));
assertTrue(bean.getTypes().contains(MyInterface.class));
assertTrue(bean.getTypes().contains(MySuperInterface.class));

// CDI isn't clear whereas we should get MySuperInterface with or without Number parameter.
// It assumes JLS must be followed to determine the list of super types
// JLS isn't clear itself and Java implementations either. So we need to keep it open and support both
// https://bugs.openjdk.org/browse/JDK-8044366
assertTrue(bean.getTypes().contains(MySuperInterface.class)
|| bean.getTypes().contains(new TypeLiteral<MySuperInterface<Number>>() {}.getType()));
assertTrue(bean.getTypes().contains(Object.class));
}

Expand Down

0 comments on commit 1a9921d

Please sign in to comment.