quarkiverse / quarkus-github-app

Develop your GitHub Apps in Java with Quarkus.
https://docs.quarkiverse.io/quarkus-github-app/dev/index.html
Apache License 2.0
65 stars 29 forks source link

cryptic exception when overloaded methods #620

Open maxandersen opened 5 months ago

maxandersen commented 5 months ago
void onDiscussion(@Discussion.Created GHEventPayload.Discussion discussionPayload, DynamicGraphQLClient gitHubGraphQLClient) throws IOException {
        addComment(gitHubGraphQLClient, discussionPayload.getDiscussion(), "Hello from my jconqbot App");
    }

    void onDiscussion(@DiscussionComment.Created GHEventPayload.DiscussionComment discussionCommentPayload, DynamicGraphQLClient gitHubGraphQLClient) throws IOException {
        addComment(gitHubGraphQLClient, discussionCommentPayload.getDiscussion(), "Another Hello from my jconqbot App");
    }

is valid java but gives this error:

java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.arc.deployment.ArcProcessor#registerBeans threw an exception: jakarta.enterprise.inject.spi.DefinitionException: Multiple event parameters found for void onDiscussion_9c21b751bd1c3c76c9e9f8d4cbcacbc05e9e7ed7(io.quarkiverse.githubapp.runtime.MultiplexedEvent) throws java.io.IOException, java.io.IOException
        at io.quarkus.arc.processor.ObserverInfo.initEventParam(ObserverInfo.java:365)
        at io.quarkus.arc.processor.ObserverInfo.create(ObserverInfo.java:47)
        at io.quarkus.arc.processor.BeanDeployment.registerObserverMethods(BeanDeployment.java:1377)
        at io.quarkus.arc.processor.BeanDeployment.findBeans(BeanDeployment.java:1315)
        at io.quarkus.arc.processor.BeanDeployment.registerBeans(BeanDeployment.java:278)
        at io.quarkus.arc.processor.BeanProcessor.registerBeans(BeanProcessor.java:146)
        at io.quarkus.arc.deployment.ArcProcessor.registerBeans(ArcProcessor.java:438)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
        at java.base/java.lang.Thread.run(Thread.java:1583)
        at org.jboss.threads.JBossThread.run(JBossThread.java:483)

        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:337)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.reloadExistingApplication(AugmentActionImpl.java:267)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.reloadExistingApplication(AugmentActionImpl.java:60)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.restartApp(IsolatedDevModeMain.java:190)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.restartCallback(IsolatedDevModeMain.java:173)
        at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:542)
        at io.quarkus.deployment.console.ConsoleStateManager.forceRestart(ConsoleStateManager.java:175)
        at io.quarkus.deployment.console.ConsoleStateManager.lambda$installBuiltins$0(ConsoleStateManager.java:112)
        at io.quarkus.deployment.console.ConsoleStateManager$1.accept(ConsoleStateManager.java:77)
        at io.quarkus.deployment.console.ConsoleStateManager$1.accept(ConsoleStateManager.java:49)
        at io.quarkus.deployment.console.AeshConsole.lambda$setup$1(AeshConsole.java:278)
        at org.aesh.terminal.EventDecoder.accept(EventDecoder.java:118)
        at org.aesh.terminal.EventDecoder.accept(EventDecoder.java:31)
        at org.aesh.terminal.io.Decoder.write(Decoder.java:133)
        at org.aesh.readline.tty.terminal.TerminalConnection.openBlocking(TerminalConnection.java:216)
        at org.aesh.readline.tty.terminal.TerminalConnection.openBlocking(TerminalConnection.java:203)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.arc.deployment.ArcProcessor#registerBeans threw an exception: jakarta.enterprise.inject.spi.DefinitionException: Multiple event parameters found for void onDiscussion_9c21b751bd1c3c76c9e9f8d4cbcacbc05e9e7ed7(io.quarkiverse.githubapp.runtime.MultiplexedEvent) throws java.io.IOException, java.io.IOException
        at io.quarkus.arc.processor.ObserverInfo.initEventParam(ObserverInfo.java:365)
        at io.quarkus.arc.processor.ObserverInfo.create(ObserverInfo.java:47)
        at io.quarkus.arc.processor.BeanDeployment.registerObserverMethods(BeanDeployment.java:1377)
        at io.quarkus.arc.processor.BeanDeployment.findBeans(BeanDeployment.java:1315)
        at io.quarkus.arc.processor.BeanDeployment.registerBeans(BeanDeployment.java:278)
        at io.quarkus.arc.processor.BeanProcessor.registerBeans(BeanProcessor.java:146)
        at io.quarkus.arc.deployment.ArcProcessor.registerBeans(ArcProcessor.java:438)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
        at java.base/java.lang.Thread.run(Thread.java:1583)
        at org.jboss.threads.JBossThread.run(JBossThread.java:483)

        at io.quarkus.builder.Execution.run(Execution.java:123)
        at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
        at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:160)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:333)
        ... 18 more
Caused by: jakarta.enterprise.inject.spi.DefinitionException: Multiple event parameters found for void onDiscussion_9c21b751bd1c3c76c9e9f8d4cbcacbc05e9e7ed7(io.quarkiverse.githubapp.runtime.MultiplexedEvent) throws java.io.IOException, java.io.IOException
        at io.quarkus.arc.processor.ObserverInfo.initEventParam(ObserverInfo.java:365)
        at io.quarkus.arc.processor.ObserverInfo.create(ObserverInfo.java:47)
        at io.quarkus.arc.processor.BeanDeployment.registerObserverMethods(BeanDeployment.java:1377)
        at io.quarkus.arc.processor.BeanDeployment.findBeans(BeanDeployment.java:1315)
        at io.quarkus.arc.processor.BeanDeployment.registerBeans(BeanDeployment.java:278)
        at io.quarkus.arc.processor.BeanProcessor.registerBeans(BeanProcessor.java:146)
        at io.quarkus.arc.deployment.ArcProcessor.registerBeans(ArcProcessor.java:438)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
        at java.base/java.lang.Thread.run(Thread.java:1583)
        at org.jboss.threads.JBossThread.run(JBossThread.java:483)

"Multiple event parameters" isn't the issue from a user perspective. could it handle the overladed names or state that multiple methods with same name is the issue?

gsmet commented 5 months ago

I wonder if it’s a bug caused by having methods with the same name.

I remember I stumbled upon something when I worked on comment-based commands and fixed it there but I might not have fixed it in the original impl.

I will have a look.