dcdh opened a new issue, #6273: URL: https://github.com/apache/incubator-kie-drools/issues/6273
I do not have any drl file present in the classpath because I manually load them following this [way](https://github.com/apache/incubator-kie-drools/issues/6248) **Current behavior** When I start my test the application fails to start with this stacktrace ``` java.lang.RuntimeException: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step org.drools.quarkus.deployment.DroolsAssetsProcessor#generateSources threw an exception: java.lang.UnsupportedOperationException at java.base/java.util.AbstractCollection.add(AbstractCollection.java:253) at org.drools.quarkus.deployment.DroolsAssetsProcessor.generateSources(DroolsAssetsProcessor.java:116) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733) at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856) at io.quarkus.builder.BuildContext.run(BuildContext.java:255) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654) at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594) at java.base/java.lang.Thread.run(Thread.java:1583) at org.jboss.threads.JBossThread.run(JBossThread.java:499) at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:611) at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:706) at java.base/java.util.Optional.orElseGet(Optional.java:364) at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) Caused by: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step org.drools.quarkus.deployment.DroolsAssetsProcessor#generateSources threw an exception: java.lang.UnsupportedOperationException at java.base/java.util.AbstractCollection.add(AbstractCollection.java:253) at org.drools.quarkus.deployment.DroolsAssetsProcessor.generateSources(DroolsAssetsProcessor.java:116) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733) at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856) at io.quarkus.builder.BuildContext.run(BuildContext.java:255) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654) at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594) at java.base/java.lang.Thread.run(Thread.java:1583) at org.jboss.threads.JBossThread.run(JBossThread.java:499) at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:372) at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:289) at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:61) at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:195) at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:578) at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:628) ... 1 more Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step org.drools.quarkus.deployment.DroolsAssetsProcessor#generateSources threw an exception: java.lang.UnsupportedOperationException at java.base/java.util.AbstractCollection.add(AbstractCollection.java:253) at org.drools.quarkus.deployment.DroolsAssetsProcessor.generateSources(DroolsAssetsProcessor.java:116) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733) at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856) at io.quarkus.builder.BuildContext.run(BuildContext.java:255) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654) at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594) at java.base/java.lang.Thread.run(Thread.java:1583) at org.jboss.threads.JBossThread.run(JBossThread.java:499) at io.quarkus.builder.Execution.run(Execution.java:122) at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:78) at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:161) at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:368) ... 6 more Caused by: java.lang.UnsupportedOperationException at java.base/java.util.AbstractCollection.add(AbstractCollection.java:253) at org.drools.quarkus.deployment.DroolsAssetsProcessor.generateSources(DroolsAssetsProcessor.java:116) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733) at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856) at io.quarkus.builder.BuildContext.run(BuildContext.java:255) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654) at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594) at java.base/java.lang.Thread.run(Thread.java:1583) at org.jboss.threads.JBossThread.run(JBossThread.java:499) ``` **Expected behavior** My application should start. **Additional informations** This issue is due to the fact that we want to add an element to an unmodifiable collection. Following this [code](https://github.com/apache/incubator-kie-drools/blob/10.0.0/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/DroolsAssetsProcessor.java#L110C1-L117C10) ```java Collection<GeneratedFile> generatedFiles = ruleCodegen.generate(); generatedFiles.addAll(getRuleUnitDefProducerSource(combinedIndexBuildItem.getIndex())); // The HotReloadSupportClass has to be generated only during the first model generation // During actual hot reloads it will be regenerated by the compilation providers in order to retrigger this build step if (!liveReload.isLiveReload()) { generatedFiles.add(new GeneratedFile(GeneratedFileType.SOURCE, HOT_RELOAD_SUPPORT_PATH + ".java", getHotReloadSupportSource())); } ``` The ruleCodegen will generate a Collection of GeneratedFile. Next - because we are not in a live reload context - another GeneratedFile will be added to this collection. Moreover, I am quite surprise about it, because the item is in relation with the hot reload and so, maybe it should be added when it is in live reload context ? But, now regarding the way ruleCodegen generate [work](https://github.com/apache/incubator-kie-drools/blob/10.0.0/drools-quarkus-extension/drools-quarkus-deployment/src/main/java/org/drools/quarkus/deployment/DroolsAssetsProcessor.java#L110C1-L117C10) ```java public final Collection<GeneratedFile> generate() { if (isEmpty()) { return Collections.emptySet(); } return internalGenerate(); } ``` and so the [isEmpty()](https://github.com/apache/incubator-kie-drools/blob/10.0.0/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/RuleCodegen.java#L67C1-L69C6) ```java public boolean isEmpty() { return resources.isEmpty(); } ``` In my case, I do not have any drl resources. And so the generate method will return an emptySet Collections - which is an unmodifiable Set - and so adding a new item will fail. Could you please: 1. return a modifiable Set 2. also validate the adding the hot reload support GeneratedFile when not in live reload. Thanks. Regards, Damien -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
