Copilot commented on code in PR #4017:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4017#discussion_r2269116052


##########
kogito-codegen-modules/kogito-codegen-processes/src/main/java/org/kie/kogito/codegen/process/util/SourceFilesProviderProducerUtil.java:
##########
@@ -61,7 +62,7 @@ public static void addSourceFilesToProvider(CompilationUnit 
compilationUnit, Map
                 .findFirst()
                 .orElseThrow(() -> new 
ProcessCodegenException("SourceFileProviderProducerTemplate does not contain a 
class declaration"));
 
-        if (workflows.isEmpty()) {
+        if (workflows.isEmpty() || 
workflows.values().stream().allMatch(DummyProcess.class::isInstance)) { // 
Temporary hack for incubator-kie-issues#2060

Review Comment:
   The condition checking for DummyProcess instances is duplicated across 
multiple locations in the codebase. Consider extracting this logic into a 
utility method to reduce duplication and improve maintainability.
   ```suggestion
           if (areAllDummyProcesses(workflows)) { // Temporary hack for 
incubator-kie-issues#2060
   ```



##########
kogito-codegen-modules/kogito-codegen-processes/src/main/java/org/kie/kogito/codegen/process/DummyProcess.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.kie.kogito.codegen.process;
+
+import java.util.List;
+import java.util.Map;
+
+import org.kie.api.definition.process.Node;
+import org.kie.api.definition.process.WorkflowElementIdentifier;
+import org.kie.api.io.Resource;
+import org.kie.kogito.internal.process.runtime.KogitoWorkflowProcess;
+
+/**
+ * Class used as "placeholder" in case there are no processes in the 
application but
+ * kie-addons-quarkus-source-files is present.
+ * Temporary hack for incubator-kie-issues#2060

Review Comment:
   The comment indicates this is a temporary hack but lacks guidance on when or 
how it should be removed. Consider adding information about the planned 
permanent solution or conditions for removal.
   ```suggestion
    * Temporary hack for incubator-kie-issues#2060.
    * TODO: Remove this class once incubator-kie-issues#2060 is resolved and a 
permanent solution is implemented.
   ```



##########
kogito-codegen-modules/kogito-codegen-processes/src/main/java/org/kie/kogito/codegen/process/ProcessCodegen.java:
##########
@@ -119,7 +119,28 @@ public static ProcessCodegen 
ofCollectedResources(KogitoBuildContext context, Co
         Map<String, byte[]> processSVGMap = new HashMap<>();
         Map<String, Throwable> processesErrors = new HashMap<>();
         boolean useSvgAddon = context.getAddonsConfig().useProcessSVG();
-        final List<GeneratedInfo<KogitoWorkflowProcess>> processes = 
resources.stream()
+        final List<GeneratedInfo<KogitoWorkflowProcess>> processes = 
getGeneratedInfoForProcesses(context, resources,
+                useSvgAddon,
+                processSVGMap,
+                processesErrors);
+        if (processes.isEmpty() && context.getAddonsConfig().useSourceFiles()) 
{ // Temporary hack for incubator-kie-issues#2060 */

Review Comment:
   There's a malformed comment with an extra '*/' at the end. The comment 
should end properly without the stray '*/'.
   ```suggestion
           if (processes.isEmpty() && 
context.getAddonsConfig().useSourceFiles()) { // Temporary hack for 
incubator-kie-issues#2060
   ```



-- 
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]

Reply via email to