This is an automated email from the ASF dual-hosted git repository.

ljmotta pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new 88ce3850153 kie-issues#2821: KIE Tools: TypeError when invoking Java 
method inside BKM (#2831)
88ce3850153 is described below

commit 88ce385015324463efcaa2c641c7d4f884d6e61a
Author: Kusuma04-dev <kusumachinnama...@gmail.com>
AuthorDate: Fri Jan 3 18:27:56 2025 +0530

    kie-issues#2821: KIE Tools: TypeError when invoking Java method inside BKM 
(#2831)
    
    Co-authored-by: chinnamatli kusumalatha 
<chinnamatlikusumalatha@chinnamatlis-MacBook-Pro.local>
---
 .../FunctionExpression/JavaFunctionExpression.tsx  | 46 +++++++++++++---------
 1 file changed, 27 insertions(+), 19 deletions(-)

diff --git 
a/packages/boxed-expression-component/src/expressions/FunctionExpression/JavaFunctionExpression.tsx
 
b/packages/boxed-expression-component/src/expressions/FunctionExpression/JavaFunctionExpression.tsx
index 5f2b882f6a8..bc144facf01 100644
--- 
a/packages/boxed-expression-component/src/expressions/FunctionExpression/JavaFunctionExpression.tsx
+++ 
b/packages/boxed-expression-component/src/expressions/FunctionExpression/JavaFunctionExpression.tsx
@@ -332,21 +332,25 @@ export function JavaFunctionExpression({
         // Class
         if (u.rowIndex === 0) {
           setExpression((prev: Normalized<BoxedFunctionJava>) => {
-            clazz.expression = {
-              ...clazz.expression,
-              __$$element: "literalExpression",
-              text: {
-                __$$text: u.value,
-              },
-            };
-
             // Do not inline this variable for type safety. See 
https://github.com/microsoft/TypeScript/issues/241
             const ret: Normalized<BoxedFunction> = {
               ...prev,
               expression: {
                 __$$element: "context",
                 ...context,
-                contextEntry: [clazz, method],
+                contextEntry: [
+                  {
+                    ...clazz,
+                    expression: {
+                      ...clazz.expression,
+                      __$$element: "literalExpression",
+                      text: {
+                        __$$text: u.value,
+                      },
+                    },
+                  },
+                  method,
+                ],
               },
             };
 
@@ -356,22 +360,26 @@ export function JavaFunctionExpression({
         // Method
         else if (u.rowIndex === 1) {
           setExpression((prev: Normalized<BoxedFunctionJava>) => {
-            method.expression = {
-              ...method.expression,
-              __$$element: "literalExpression",
-              "@_id": method.expression["@_id"] ?? generateUuid(),
-              text: {
-                __$$text: u.value,
-              },
-            };
-
             // Do not inline this variable for type safety. See 
https://github.com/microsoft/TypeScript/issues/241
             const ret: Normalized<BoxedFunction> = {
               ...prev,
               expression: {
                 __$$element: "context",
                 ...context,
-                contextEntry: [clazz, method],
+                contextEntry: [
+                  clazz,
+                  {
+                    ...method,
+                    expression: {
+                      ...method.expression,
+                      __$$element: "literalExpression",
+                      "@_id": method.expression["@_id"] ?? generateUuid(),
+                      text: {
+                        __$$text: u.value,
+                      },
+                    },
+                  },
+                ],
               },
             };
             return ret;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@kie.apache.org
For additional commands, e-mail: commits-h...@kie.apache.org

Reply via email to