*/
public static <T> Set<Type> getTypes(EnhancedAnnotated<T, ?> annotated, EjbDescriptor<T> ejbDescriptor) {
ImmutableSet.Builder<Type> types = ImmutableSet.builder();
// session beans
Map<Class<?>, Type> typeMap = new LinkedHashMap<Class<?>, Type>();
HierarchyDiscovery beanClassDiscovery = HierarchyDiscovery.forNormalizedType(ejbDescriptor.getBeanClass());
for (BusinessInterfaceDescriptor<?> businessInterfaceDescriptor : ejbDescriptor.getLocalBusinessInterfaces()) {
// first we need to resolve the local interface
Type resolvedLocalInterface = beanClassDiscovery.resolveType(Types.getCanonicalType(businessInterfaceDescriptor.getInterface()));
SessionBeanHierarchyDiscovery interfaceDiscovery = new SessionBeanHierarchyDiscovery(resolvedLocalInterface);
if (beanClassDiscovery.getTypeMap().containsKey(businessInterfaceDescriptor.getInterface())) {
// WELD-1675 Only add types also included in Annotated.getTypeClosure()
for (Entry<Class<?>, Type> entry : interfaceDiscovery.getTypeMap().entrySet()) {
if (annotated.getTypeClosure().contains(entry.getValue())) {
typeMap.put(entry.getKey(), entry.getValue());
}