Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qute type-safe validation fix #20515

Merged
merged 1 commit into from
Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,7 @@ private static TemplateExtensionMethodBuildItem findTemplateExtensionMethod(Info
private static AnnotationTarget findProperty(String name, ClassInfo clazz, IndexView index) {
Set<DotName> interfaceNames = new HashSet<>();
while (clazz != null) {
addInterfaces(clazz, index, interfaceNames);
interfaceNames.addAll(clazz.interfaceNames());
// Fields
for (FieldInfo field : clazz.fields()) {
Expand Down Expand Up @@ -1756,6 +1757,19 @@ private static AnnotationTarget findProperty(String name, ClassInfo clazz, Index
return null;
}

private static void addInterfaces(ClassInfo clazz, IndexView index, Set<DotName> interfaceNames) {
if (clazz == null) {
return;
}
List<DotName> names = clazz.interfaceNames();
if (!names.isEmpty()) {
interfaceNames.addAll(names);
for (DotName name : names) {
addInterfaces(index.getClassByName(name), index, interfaceNames);
}
}
}

/**
* Find a non-static non-synthetic method with the given name, matching number of params and assignable parameter types.
*
Expand All @@ -1771,7 +1785,7 @@ private static AnnotationTarget findMethod(VirtualMethodPart virtualMethod, Clas
IndexView index, Function<String, String> templateIdToPathFun, Map<String, Match> results) {
Set<DotName> interfaceNames = new HashSet<>();
while (clazz != null) {
interfaceNames.addAll(clazz.interfaceNames());
addInterfaces(clazz, index, interfaceNames);
for (MethodInfo method : clazz.methods()) {
if (Modifier.isPublic(method.flags()) && !Modifier.isStatic(method.flags())
&& !ValueResolverGenerator.isSynthetic(method.flags())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class InterfaceValidationSuccessTest {
@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(Metrics.class, Count.class, Wrapper.class)
.addClasses(Metrics.class, Count.class, Wrapper.class, NumericWrapper.class)
.addAsResource(new StringAsset("{@java.util.List list}"
+ "{list.empty}:{list.toString}"),
"templates/list.html")
Expand Down Expand Up @@ -76,7 +76,10 @@ public interface Wrapper<T> {
String name(int age);
}

public interface Count extends Wrapper<Integer> {
public interface NumericWrapper extends Wrapper<Integer> {
}

public interface Count extends NumericWrapper {
}

public interface Metrics {
Expand Down