Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-6769

Process with java.util.List<T> cannot compile

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 1.16.1.Final
    • Core Engine
    • None
    • 2022 Week 05-07 (from Jan 31)

      A process with java.util.List<myDomainObject> as a process variable (so a part of a model) is not compilable:

      [ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.7.1.Final:build (default) on project kogito-stp-benchmarks-quarkus: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
      [ERROR]         [error]: Build step org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor#generateModel threw an exception: java.lang.IllegalStateException: src/main/java/org/kie/smarthouse/SmartHouseProcess.java (55:2583) : java.util.List cannot be resolved to a variable
      [ERROR] src/main/java/org/kie/smarthouse/SmartHouseProcess.java (55:2598) : org.kie.smarthouse.SensorInput cannot be resolved to a variable
      [ERROR] src/main/java/org/kie/smarthouse/SmartHouseProcess.java (55:2628) : Syntax error on token ">", byte expected after this token
      [ERROR] src/main/java/org/kie/smarthouse/SmartHouseProcess.java (56:2767) : java.util.List cannot be resolved to a variable
      [ERROR] src/main/java/org/kie/smarthouse/SmartHouseProcess.java (56:2782) : org.kie.smarthouse.SensorInput cannot be resolved to a variable
      [ERROR] src/main/java/org/kie/smarthouse/SmartHouseProcess.java (56:2812) : Syntax error on token ">", byte expected after this token
      [ERROR] src/main/java/org/kie/smarthouse/SmartHouseProcess.java (55:2583) : java.util.List cannot be resolved to a variablesrc/main/java/org/kie/smarthouse/SmartHouseProcess.java (55:2598) : org.kie.smarthouse.SensorInput cannot be resolved to a variablesrc/main/java/org/kie/smarthouse/SmartHouseProcess.java (55:2628) : Syntax error on token ">", byte expected after this tokensrc/main/java/org/kie/smarthouse/SmartHouseProcess.java (56:2767) : java.util.List cannot be resolved to a variablesrc/main/java/org/kie/smarthouse/SmartHouseProcess.java (56:2782) : org.kie.smarthouse.SensorInput cannot be resolved to a variablesrc/main/java/org/kie/smarthouse/SmartHouseProcess.java (56:2812) : Syntax error on token ">", byte expected after this token
      [ERROR]         at org.kie.kogito.quarkus.common.deployment.InMemoryCompiler.compile(InMemoryCompiler.java:104)
      [ERROR]         at org.kie.kogito.quarkus.common.deployment.KogitoQuarkusResourceUtils.compileGeneratedSources(KogitoQuarkusResourceUtils.java:174)
      [ERROR]         at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.compileAndIndexJavaSources(KogitoAssetsProcessor.java:209)
      [ERROR]         at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.generateModel(KogitoAssetsProcessor.java:139)
      [ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      [ERROR]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      [ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      [ERROR]         at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:882)
      [ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
      [ERROR]         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
      [ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
      [ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
      [ERROR]         at java.base/java.lang.Thread.run(Thread.java:829)
      [ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:501)
      

      The issue is likely this commit: https://github.com/kiegroup/kogito-runtimes/commit/393932d8364ffd7bfd6d8900ad2743d9c6f2e6ed#diff-11b53d95b8bf658bd3160c01bb18633bbc8ac44e42c3c7536047e6947af851a5R103
      which is a part of KOGITO-6561. There the codegen was changed from:

      factory.variable("var", org.jbpm.process.core.datatype.DataTypeResolver.fromType("java.util.List<org.kie.smarthouse.SensorInput>", org.kie.smarthouse.SmartHouseProcess.class.getClassLoader()), null, "customTags", null);
      

      to

      factory.variable("var", org.jbpm.process.core.datatype.DataTypeResolver.fromClass(java.util.List<org.kie.smarthouse.SensorInput>.class), null, "customTags", null);
      

      And as Java doesn't allow java.util.List<org.kie.smarthouse.SensorInput>.class, it fails.

              ftirados Francisco Javier Tirado Sarti
              mmacik@redhat.com Marian Macik
              Marian Macik Marian Macik
              Marian Macik Marian Macik
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: