Repository: quarkusio/quarkus
Issue: Qute fails to find methods from parent interface when using multilevel inheritance 

### Describe the bug

As a follow up on https://github.com/quarkusio/quarkus/issues/19564 I was playing around with Qute and strict rendering a bit more. Just noticed that when I introduce another level of interfaces that Qute won't be able to find the methods anymore.

See https://github.com/wjglerum/quarkus/commit/7fb6d7b68ab19af24827ac6dc263bf70fb8a58ca

```
java.lang.RuntimeException: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.qute.deployment.QuteProcessor#processTemplateErrors threw an exception: io.quarkus.qute.TemplateException: Found template problems (3):
[1] Incorrect expression found: {metrics.responses.value}
	- property/method [value] not found on class [io.quarkus.qute.deployment.typesafe.InterfaceValidationSuccessTest$Count] nor handled by an extension method
	- at metrics.html:1
[2] Incorrect expression found: {metrics.responses.name(1)}
	- property/method [name(1)] not found on class [io.quarkus.qute.deployment.typesafe.InterfaceValidationSuccessTest$Count] nor handled by an extension method
	- at metrics.html:1
[3] Incorrect expression found: {metrics.requests.value.or(null)}
	- property/method [value] not found on class [io.quarkus.qute.deployment.typesafe.InterfaceValidationSuccessTest$Count] nor handled by an extension method
	- at metrics.html:1
	at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:196)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
	at java.base/java.lang.Thread.run(Thread.java:829)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
	Suppressed: io.quarkus.qute.TemplateException: Incorrect expression found: {metrics.responses.value}
	- property/method [value] not found on class [io.quarkus.qute.deployment.typesafe.InterfaceValidationSuccessTest$Count] nor handled by an extension method
	- at metrics.html:1
		at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:176)
		... 11 more
	Suppressed: io.quarkus.qute.TemplateException: Incorrect expression found: {metrics.responses.name(1)}
	- property/method [name(1)] not found on class [io.quarkus.qute.deployment.typesafe.InterfaceValidationSuccessTest$Count] nor handled by an extension method
	- at metrics.html:1
		at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:176)
		... 11 more
	Suppressed: io.quarkus.qute.TemplateException: Incorrect expression found: {metrics.requests.value.or(null)}
	- property/method [value] not found on class [io.quarkus.qute.deployment.typesafe.InterfaceValidationSuccessTest$Count] nor handled by an extension method
	- at metrics.html:1
		at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:176)
		... 11 more
```

Any ideas on how Qute should handle this?

### Expected behavior

_No response_

### Actual behavior

_No response_

### How to Reproduce?

_No response_

### Output of `uname -a` or `ver`

```
Darwin Willems-MacBook-Pro.local 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64
```

### Output of `java -version`

```
openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
```

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

`2.2.3.Final` and `2.3.0.CR1`

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

```
Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f)
Maven home: /Users/wjglerum/.m2/wrapper/dists/apache-maven-3.8.2-bin/1um3pu5poco57pibs3g92d6vrf/apache-maven-3.8.2
Java version: 11.0.11, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
Default locale: en_NL, platform encoding: UTF-8
OS name: "mac os x", version: "11.5", arch: "x86_64", family: "mac"
```

### Additional information

_No response_

Changed files:
extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/typesafe/InterfaceValidationSuccessTest.java
extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java

diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java
index 76a7c6d1a04..f2e341003a5 100644
--- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java
+++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java
@@ -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()) {
@@ -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.
      *
@@ -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())
diff --git a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/typesafe/InterfaceValidationSuccessTest.java b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/typesafe/InterfaceValidationSuccessTest.java
index c98a77f1821..6806e4af0fe 100644
--- a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/typesafe/InterfaceValidationSuccessTest.java
+++ b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/typesafe/InterfaceValidationSuccessTest.java
@@ -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")
@@ -76,7 +76,10 @@ public Count requests() {
         String name(int age);
     }
 
-    public interface Count extends Wrapper<Integer> {
+    public interface NumericWrapper extends Wrapper<Integer> {
+    }
+
+    public interface Count extends NumericWrapper {
     }
 
     public interface Metrics {