Skip to content

Commit

Permalink
WELD-2221 AnnotatedTypeValidator should consider extended interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
mkouba committed Aug 15, 2016
1 parent c52175e commit 51ddb0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import javax.enterprise.inject.spi.AnnotatedType;

import org.jboss.weld.logging.MetadataLogger;
import org.jboss.weld.util.collections.WeldCollections;
import org.jboss.weld.util.reflection.Formats;
import org.jboss.weld.util.reflection.Reflections;

/**
* Validates that methods of an {@link Annotated} implementation return sane values.
Expand Down Expand Up @@ -85,9 +85,8 @@ private static void checkSensibility(AnnotatedType<?> type) {
Set<Class<?>> hierarchy = new HashSet<Class<?>>();
for (Class<?> clazz = type.getJavaClass(); clazz != null; clazz = clazz.getSuperclass()) {
hierarchy.add(clazz);
WeldCollections.addAll(hierarchy, clazz.getInterfaces());
hierarchy.addAll(Reflections.getInterfaceClosure(clazz));
}

checkMembersBelongToHierarchy(type.getConstructors(), hierarchy, type);
checkMembersBelongToHierarchy(type.getMethods(), hierarchy, type);
checkMembersBelongToHierarchy(type.getFields(), hierarchy, type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public interface MetadataLogger extends WeldLogger {
void noConstructor(Object param1);

@LogMessage(level = Level.WARN)
@Message(id = 1117, value = "Member {0} ({1}) does not belong to the actual class hierarchy of the annotatedType {2} ({3})\n\tat {4}\n StackTrace:", format = Format.MESSAGE_FORMAT)
@Message(id = 1117, value = "Member {0} ({1}) does not belong to the actual class hierarchy of the annotatedType {2} ({3})\n\tat {4}", format = Format.MESSAGE_FORMAT)
void notInHierarchy(Object memberName, Object member, Object annotatedTypeJavaClassName, Object annotatedType, Object stackElement);

@Message(id = 1118, value = "A type variable is not a valid bean type. Bean type {0} of bean {1}", format = Format.MESSAGE_FORMAT)
Expand Down

0 comments on commit 51ddb0b

Please sign in to comment.