Repository: quarkusio/quarkus
Issue: Native build fails with hibernate-orm-rest-data-panache + elytron-security-properties-file

### Describe the bug

Combination of `hibernate-orm-rest-data-panache` and `elytron-security-properties-file`, together with a panache resource with a class annotation from `javax.annotation.security` cause native build to fail.
```java
package org.acme;

import io.quarkus.hibernate.orm.rest.data.panache.PanacheEntityResource;

import javax.annotation.security.DenyAll;

@DenyAll
public interface MyResource extends PanacheEntityResource<MyEntity, Long> {
}
```

This can be reproduced for any Quarkus newer than `2.14.3.Final`.

### Expected behavior

Native build succeeds.

### Actual behavior

```
Fatal error: com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing org.acme.MyResourceJaxRs_ab15c77efe36959f9555ec5aecafdc237bba9ef3_Subclass.count$$superforward1() 
Parsing context:
   at org.acme.MyResourceJaxRs_ab15c77efe36959f9555ec5aecafdc237bba9ef3_Subclass.count$$superforward1(Unknown Source)
   at org.acme.MyResourceJaxRs_ab15c77efe36959f9555ec5aecafdc237bba9ef3_Subclass$$function$$12.apply(Unknown Source)
   at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
   at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1932)
   at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
   at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
   at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
   at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
   at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
   at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
   at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
   at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
   at java.lang.reflect.Executable.sharedToString(Executable.java:122)
   at java.lang.reflect.Constructor.toString(Constructor.java:358)
   at java.lang.String.valueOf(String.java:4225)
   at com.oracle.svm.core.jdk.localization.substitutions.Target_java_util_Locale.initDefault(Target_java_util_Locale.java:52)
   at java.util.Locale.getDisplayLocale(Locale.java:1039)
   at java.util.Locale.getDefault(Locale.java:1023)
   at java.util.Formatter.<init>(Formatter.java:2095)
   at java.lang.String.format(String.java:4150)
   at jdk.internal.util.Preconditions.outOfBoundsMessage(Preconditions.java:245)
   at jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
   at jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
   at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
   at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
   at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
   at java.lang.String.checkIndex(String.java:4570)

...

Caused by: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: org.acme.MyResourceJaxRs_ab15c77efe36959f9555ec5aecafdc237bba9ef3.count(). This error is reported at image build time because class org.acme.MyResourceJaxRs_ab15c77efe36959f9555ec5aecafdc237bba9ef3_Subclass is registered for linking at image build time by command line
	at parsing org.acme.MyResourceJaxRs_ab15c77efe36959f9555ec5aecafdc237bba9ef3_Subclass.count$$superforward1(Unknown Source)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2518)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:110)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3393)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3345)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3190)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1138)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1030)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:97)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:84)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:446)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:135)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:685)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:171)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:349)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.createFlowsGraph(MethodTypeFlow.java:93)

```

### How to Reproduce?

```
git clone git@github.com:jsmrcka/orm-rest-data-panache-security-native-reproducer.git
mvn -f ./orm-rest-data-panache-security-native-reproducer clean package -Dnative
```

### Output of `uname -a` or `ver`

Linux ... 6.0.15-300.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Dec 21 18:33:23 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

### Output of `java -version`

openjdk version "11.0.12" 2021-07-20

### GraalVM version (if different from Java)

GraalVM 22.3.0 Java 19 CE (Java Version 19.0.1+10-jvmci-22.3-b08)

### Quarkus version or git rev

2.15.0.CR1+, 999-SNAPSHOT

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

3.8.6

### Additional information

_No response_

Changed files:
extensions/panache/rest-data-panache/deployment/src/main/java/io/quarkus/rest/data/panache/deployment/methods/CountMethodImplementor.java

diff --git a/extensions/panache/rest-data-panache/deployment/src/main/java/io/quarkus/rest/data/panache/deployment/methods/CountMethodImplementor.java b/extensions/panache/rest-data-panache/deployment/src/main/java/io/quarkus/rest/data/panache/deployment/methods/CountMethodImplementor.java
index efc45733a16..c3594cdc4c7 100644
--- a/extensions/panache/rest-data-panache/deployment/src/main/java/io/quarkus/rest/data/panache/deployment/methods/CountMethodImplementor.java
+++ b/extensions/panache/rest-data-panache/deployment/src/main/java/io/quarkus/rest/data/panache/deployment/methods/CountMethodImplementor.java
@@ -4,6 +4,7 @@
 import static io.quarkus.rest.data.panache.deployment.utils.SignatureMethodCreator.ofType;
 
 import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
 
 import io.quarkus.deployment.Capabilities;
 import io.quarkus.gizmo.ClassCreator;
@@ -41,9 +42,9 @@ public CountMethodImplementor(Capabilities capabilities) {
      * {@code
      * &#64;GET
      * &#64;Path("/count")
-     * public long count() {
+     * public Response count(UriInfo uriInfo) {
      *     try {
-     *         return resource.count();
+     *         return Response.ok(resource.count());
      *     } catch (Throwable t) {
      *         throw new RestDataPanacheException(t);
      *     }
@@ -74,10 +75,13 @@ protected void implementInternal(ClassCreator classCreator, ResourceMetadata res
             ResourceProperties resourceProperties, FieldDescriptor resourceField) {
         // Method parameters: sort strings, page index, page size, uri info
         MethodCreator methodCreator = SignatureMethodCreator.getMethodCreator(RESOURCE_METHOD_NAME, classCreator,
-                isNotReactivePanache() ? ofType(Response.class) : ofType(Uni.class, Long.class));
+                isNotReactivePanache() ? ofType(Response.class) : ofType(Uni.class, Long.class),
+                UriInfo.class);
+        methodCreator.setParameterNames(new String[] { "uriInfo" });
 
         // Add method annotations
         addGetAnnotation(methodCreator);
+        addContextAnnotation(methodCreator.getParameterAnnotations(0));
         addProducesAnnotation(methodCreator, APPLICATION_JSON);
         addPathAnnotation(methodCreator, appendToPath(resourceProperties.getPath(RESOURCE_METHOD_NAME), RESOURCE_METHOD_NAME));
         addMethodAnnotations(methodCreator, resourceProperties.getMethodAnnotations(RESOURCE_METHOD_NAME));