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

github-merge-queue[bot] pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git

commit 7d05326551e7d942c97eb61d6eb100a2b451bfd3
Author: carloea2 <[email protected]>
AuthorDate: Tue Nov 10 22:51:49 2026 +0000

    feat(workflow-operator): support Java UI parameters (#9339)
    
    ### What changes were proposed in this PR?
    
    
    
    Java UDFs can declare typed parameters and edit their values in the
    existing Parameters panel. For example, inside `JavaUDFOpExec`:
    
    
    
    ```java
    
    @org.apache.texera.amber.operator.udf.java.UiParameter("count")
    
    private int count;
    
    ```
    
    
    
    The shared model, validation, type manifest, editor, synchronization,
    and resource binding serve Python, R, and Java. Java has a separate
    syntax parser and javac adapter that validates saved metadata and
    inserts field initializers before the constructor runs. Supports six
    scalar types, boxed fields, and model/dataset version selectors on
    string fields.
    
    
    
    The compiling service uses a JDK for Java parameter injection. Bare
    templates remain usable on JRE hosts; saved parameters fail explicitly
    there instead of losing their values.
    
    
    
    ### Any related issues, documentation, discussions?
    
    
    
    Closes #9337.
    
    
    
    [Java UDF
    
usage](https://github.com/carloea2/texera/blob/59f555857f208d1c7a3d9b18172b39178aed0836/docs/reference/operators/user-defined-functions/java/java-udf.md)
    · [UI parameter
    
architecture](https://github.com/carloea2/texera/blob/59f555857f208d1c7a3d9b18172b39178aed0836/docs/contribution-guidelines/ui-parameter-architecture.md)
    
    
    
    ### How was this PR tested?
    
    Retested against fresh upstream main at `e9e5fda4bb`.
    
    | Check | Result |
    | --- | --- |
    | Backend UDF package | 247 passed across 15 suites |
    | JRE subprocess regression | Failed before the fix, passed after it |
    | Full frontend suite | 7,212 passed, one existing skip |
    | Production frontend build and binary dependency check | Passed, 135
    bundled packages accounted for |
    | Module Scala lint, repository Scala formatting, frontend formatting
    and lint | Passed |
    
    The JRE regression covers bare templates, saved parameters, invalid
    metadata and one or two workers. The existing JDK tests still initialize
    parameter values before constructors and execute real tuples.
    
    ```sh
    sbt "set DAO / Compile / sourceGenerators := Seq.empty" 
"WorkflowOperator/testOnly *udf.*"
    sbt "set DAO / Compile / sourceGenerators := Seq.empty" 
"WorkflowOperator/scalafix --check" "WorkflowOperator/Test/scalafix --check" 
scalafmtCheckAll
    ```
    
    Local backend tests reused ignored generated jOOQ sources. Full
    repository scalafix was blocked by stale generated database classes in
    the execution service. The changed module lint and repository formatting
    checks pass.
    
    From `frontend/`, with `NG_BUILD_MAX_WORKERS=2` and
    `RAYON_NUM_THREADS=2`:
    
    ```sh
    node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng.js test 
--watch=false --progress=false --coverage --coverage-reporters=lcovonly
    corepack yarn format:ci
    node build-version.js
    node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng.js build 
--configuration=production --progress=false --source-map=false
    ```
    
    The production build used an isolated copy of the same source and
    dependencies to avoid Windows dependency-junction resolution errors. Its
    `dist/3rdpartylicenses.json` passes the repository check:
    
    ```sh
    python bin/licensing/check_binary_deps.py --ignore-transitive-version npm 
frontend/dist/3rdpartylicenses.json
    ```
    
    Existing UI verification:
    
    Chromium, 1600 × 1000 viewport: Java UDF properties → Parameters → Add
    parameter; add integer/string/boolean rows, enter `42` / `sample run` /
    `true`, and reload. Verified inserted Java fields, preserved values, and
    locked Name/Type controls.
    
    | Before | After |
    | --- | --- |
    | ![Java properties without
    
Parameters](https://raw.githubusercontent.com/carloea2/texera/30a16fde7d22849d3efb64c52eff3288c18a6e51/java-ui-parameters-before.png)
    | ![Java properties with typed UI
    
parameters](https://raw.githubusercontent.com/carloea2/texera/30a16fde7d22849d3efb64c52eff3288c18a6e51/java-ui-parameters-after.png)
    |
    
    Both captures use the feature frontend: before with baseline Java
    metadata, after with metadata exported by the actual Scala generator.
    HTTP fixtures and an isolated in-memory Yjs server supply
    workflow/authentication and reload persistence. Execution was
    independently verified with the browser-generated source and values
    through the real JVM path. [Evidence
    
details](https://raw.githubusercontent.com/carloea2/texera/30a16fde7d22849d3efb64c52eff3288c18a6e51/EVIDENCE.txt).
    
    ### Was this PR authored or co-authored using generative AI tooling?
    
    
    
    Generated-by: OpenAI Codex (GPT-6)
---
 .../workflow-compiling-service.dockerfile          |   4 +-
 common/workflow-operator/build.sbt                 |   7 +
 .../src/main/resources/udf/ui-parameter-types.json |   8 +
 .../texera/amber/operator/udf/UiUDFParameter.scala |   2 +-
 .../operator/udf/UiUdfParameterContract.scala      |   2 +
 .../amber/operator/udf/java/JavaUDFOpDesc.scala    |  22 +-
 .../udf/java/JavaUdfUiParameterInjector.scala      | 214 +++++++++++++++++
 .../amber/operator/udf/java/UiParameter.java       |  33 +++
 .../operator/udf/UiUdfParameterContractSpec.scala  |   8 +
 .../operator/udf/java/JavaUDFOpDescSpec.scala      |   7 +
 .../udf/java/JavaUdfUiParameterInjectorSpec.scala  | 264 +++++++++++++++++++++
 .../python/PythonUdfUiParameterSupportSpec.scala   |  35 ++-
 .../ui-parameter-architecture.md                   |  14 +-
 .../user-defined-functions/java/java-udf.md        |  26 ++
 frontend/LICENSE-binary                            |   1 +
 frontend/package.json                              |   1 +
 .../java-ui-udf-parameters-parser.spec.ts          | 113 +++++++++
 .../code-editor/java-ui-udf-parameters-parser.ts   | 144 +++++++++++
 .../service/code-editor/ui-udf-parameter.ts        |   4 +-
 .../code-editor/ui-udf-parameters-contract.spec.ts |  30 ++-
 .../ui-udf-parameters-parser.service.ts            |  10 +-
 .../ui-udf-parameters-sync.service.spec.ts         |  24 +-
 .../code-editor/ui-udf-parameters-sync.service.ts  |   6 +-
 .../service/workflow-graph/model/workflow-graph.ts |   1 +
 frontend/yarn.lock                                 |  12 +
 25 files changed, 963 insertions(+), 29 deletions(-)

diff --git a/bin/dockerfiles/workflow-compiling-service.dockerfile 
b/bin/dockerfiles/workflow-compiling-service.dockerfile
index 113d69a3c6..e23c8be606 100644
--- a/bin/dockerfiles/workflow-compiling-service.dockerfile
+++ b/bin/dockerfiles/workflow-compiling-service.dockerfile
@@ -52,7 +52,7 @@ RUN sbt clean WorkflowCompilingService/dist
 # Unzip the texera binary
 RUN unzip 
workflow-compiling-service/target/universal/workflow-compiling-service-*.zip -d 
target/
 
-FROM 
docker.io/library/eclipse-temurin:17-jre-jammy@sha256:97137382c6f0c30427d9b7c44ad8b2d55ac823b0768c171d81a643ed219023c5
 AS runtime
+FROM 
docker.io/library/eclipse-temurin:17-jdk-jammy@sha256:60fcdd4a85c94a23ef86d0d55867c6a8dbc4f7c3efc8286e259956c3ea4ef08c
 AS runtime
 
 WORKDIR /texera
 
@@ -80,4 +80,4 @@ USER texera
 
 CMD ["bin/workflow-compiling-service"]
 
-EXPOSE 9090
\ No newline at end of file
+EXPOSE 9090
diff --git a/common/workflow-operator/build.sbt 
b/common/workflow-operator/build.sbt
index 7fb262cda5..d1bd6b72ac 100644
--- a/common/workflow-operator/build.sbt
+++ b/common/workflow-operator/build.sbt
@@ -35,6 +35,13 @@ ThisBuild / conflictManager := ConflictManager.latestRevision
 // Restrict parallel execution of tests to avoid conflicts
 Global / concurrentRestrictions += Tags.limit(Tags.Test, 1)
 
+// Java UDF execution tests use javac, which needs the test classpath on the 
forked JVM.
+// Keep the repo-root working directory so MockTexeraDB can find 
sql/texera_ddl.sql.
+Test / fork := true
+Test / forkOptions := (Test / forkOptions).value
+  .withWorkingDirectory((ThisBuild / baseDirectory).value)
+
+
 // A test needing more than a bare Python interpreter is tagged, so the amber 
job
 // excludes it, and amber-integration, which installs amber's requirements 
files,
 // runs it. The amber job already sets this env var on the step that invokes
diff --git 
a/common/workflow-operator/src/main/resources/udf/ui-parameter-types.json 
b/common/workflow-operator/src/main/resources/udf/ui-parameter-types.json
index 00db3dd69c..4091eb353c 100644
--- a/common/workflow-operator/src/main/resources/udf/ui-parameter-types.json
+++ b/common/workflow-operator/src/main/resources/udf/ui-parameter-types.json
@@ -25,5 +25,13 @@
     "boolean": ["BOOL", "BOOLEAN"],
     "timestamp": ["TIMESTAMP"]
   },
+  "javaTypes": {
+    "string": ["String", "java.lang.String"],
+    "integer": ["int", "Integer", "java.lang.Integer"],
+    "long": ["long", "Long", "java.lang.Long"],
+    "double": ["double", "Double", "java.lang.Double"],
+    "boolean": ["boolean", "Boolean", "java.lang.Boolean"],
+    "timestamp": ["java.sql.Timestamp", "Timestamp"]
+  },
   "resources": {"MODEL": "model", "DATASET": "dataset"}
 }
diff --git 
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/UiUDFParameter.scala
 
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/UiUDFParameter.scala
index b8fa5149cd..c184218bef 100644
--- 
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/UiUDFParameter.scala
+++ 
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/UiUDFParameter.scala
@@ -27,7 +27,7 @@ import javax.validation.Valid
 import javax.validation.constraints.NotNull
 
 /**
-  * Serialized operator property shared by Python and R UDF UI parameters.
+  * Serialized operator property shared by UDF UI parameters.
   *
   * `attribute` carries the inferred parameter name and type. `value` is 
user-entered text.
   * Language adapters own its encoding and native conversion; the wire model 
contains no language-specific types.
diff --git 
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/UiUdfParameterContract.scala
 
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/UiUdfParameterContract.scala
index f54470ed02..f9c7ea7c11 100644
--- 
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/UiUdfParameterContract.scala
+++ 
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/UiUdfParameterContract.scala
@@ -30,6 +30,7 @@ object UiUdfParameterContract {
   @JsonIgnoreProperties(Array("_license"))
   private case class Manifest(
       types: Map[AttributeType, List[String]],
+      javaTypes: Map[AttributeType, List[String]],
       resources: Map[String, String]
   )
 
@@ -39,6 +40,7 @@ object UiUdfParameterContract {
   val types: Map[AttributeType, List[String]] = manifest.types
   val typesByToken: Map[String, AttributeType] =
     types.flatMap { case (attributeType, aliases) => aliases.map(_ -> 
attributeType) }
+  val javaTypes: Map[AttributeType, List[String]] = manifest.javaTypes
   val resourceInputTypes: Map[String, String] = manifest.resources
 
   def validate(uiParameters: List[UiUDFParameter]): Unit = {
diff --git 
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/java/JavaUDFOpDesc.scala
 
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/java/JavaUDFOpDesc.scala
index 0ea42ef3fa..80ea56ad7c 100644
--- 
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/java/JavaUDFOpDesc.scala
+++ 
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/java/JavaUDFOpDesc.scala
@@ -29,8 +29,18 @@ import org.apache.texera.amber.core.workflow._
 import org.apache.texera.amber.operator.metadata.{OperatorGroupConstants, 
OperatorInfo}
 import org.apache.texera.amber.operator.{LogicalOp, PortDescription, 
StateTransferFunc}
 
+import org.apache.texera.amber.operator.udf.{UdfUiParameterSupport, 
UiUDFParameter}
+
 import scala.util.{Success, Try}
-class JavaUDFOpDesc extends LogicalOp {
+class JavaUDFOpDesc extends LogicalOp with UdfUiParameterSupport {
+  override protected def injectParameterValues(
+      code: String,
+      parameters: List[UiUDFParameter]
+  ): String =
+    JavaUdfUiParameterInjector.inject(code, parameters)
+
+  override protected def uiParameterLanguage: String = "java"
+
   @JsonProperty(
     required = true,
     defaultValue =
@@ -41,6 +51,8 @@ class JavaUDFOpDesc extends LogicalOp {
         "import java.io.Serializable;\n" +
         "\n" +
         "public class JavaUDFOpExec extends MapOpExec {\n" +
+        "    // Add UI parameters from the Parameters panel, or declare an 
annotated field:\n" +
+        "    // 
@org.apache.texera.amber.operator.udf.java.UiParameter(\"count\") private int 
count;\n" +
         "    public JavaUDFOpExec () {\n" +
         "        this.setMapFunc((Function1<Tuple, TupleLike> & Serializable) 
this::processTuple);\n" +
         "    }\n" +
@@ -103,13 +115,15 @@ class JavaUDFOpDesc extends LogicalOp {
       Map(operatorInfo.outputPorts.head.id -> outputSchema)
     }
 
+    val opExec = OpExecWithCode(injectUiParameters(code), "java")
+    val binding = executionBinding(code)
     if (workers > 1)
       PhysicalOp
         .oneToOnePhysicalOp(
           workflowId,
           executionId,
           operatorIdentifier,
-          OpExecWithCode(code, "java")
+          opExec
         )
         .withDerivePartition(_ => UnknownPartition())
         .withInputPorts(operatorInfo.inputPorts)
@@ -119,13 +133,14 @@ class JavaUDFOpDesc extends LogicalOp {
         .withParallelizable(true)
         .withSuggestedWorkerNum(workers)
         .withPropagateSchema(SchemaPropagationFunc(propagateSchema))
+        .withExecutionTimeBinding(binding)
     else
       PhysicalOp
         .manyToOnePhysicalOp(
           workflowId,
           executionId,
           operatorIdentifier,
-          OpExecWithCode(code, "java")
+          opExec
         )
         .withDerivePartition(_ => UnknownPartition())
         .withInputPorts(operatorInfo.inputPorts)
@@ -134,6 +149,7 @@ class JavaUDFOpDesc extends LogicalOp {
         .withIsOneToManyOp(true)
         .withParallelizable(false)
         .withPropagateSchema(SchemaPropagationFunc(propagateSchema))
+        .withExecutionTimeBinding(binding)
   }
 
   override def operatorInfo: OperatorInfo = {
diff --git 
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/java/JavaUdfUiParameterInjector.scala
 
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/java/JavaUdfUiParameterInjector.scala
new file mode 100644
index 0000000000..5588e4d76b
--- /dev/null
+++ 
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/java/JavaUdfUiParameterInjector.scala
@@ -0,0 +1,214 @@
+/*
+ * 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.apache.texera.amber.operator.udf.java
+
+import com.sun.source.tree._
+import com.sun.source.util.{JavacTask, Trees}
+import org.apache.texera.amber.core.tuple.AttributeType
+import org.apache.texera.amber.operator.udf.{UiUDFParameter, 
UiUdfParameterContract}
+
+import java.net.URI
+import java.nio.charset.StandardCharsets
+import java.time.{LocalDateTime, ZoneOffset}
+import java.time.format.{DateTimeFormatter, DateTimeFormatterBuilder, 
ResolverStyle}
+import java.time.temporal.ChronoField
+import java.util.{Base64, Locale}
+import javax.lang.model.element.Modifier
+import javax.tools._
+import scala.jdk.CollectionConverters._
+import scala.util.{Try, Using}
+
+/** Uses javac's source tree to initialize annotated fields without executing 
user code. */
+object JavaUdfUiParameterInjector {
+  private val annotationName = 
"org.apache.texera.amber.operator.udf.java.UiParameter"
+  private val nativeTypes = UiUdfParameterContract.javaTypes.flatMap {
+    case (kind, names) => names.map(_ -> kind)
+  }
+  private val timestampFormat = new DateTimeFormatterBuilder()
+    .append(DateTimeFormatter.ISO_LOCAL_DATE)
+    .optionalStart()
+    .appendLiteral('T')
+    .appendPattern("HH")
+    .optionalStart()
+    .appendPattern(":mm")
+    .optionalStart()
+    .appendPattern(":ss")
+    .optionalStart()
+    .appendFraction(ChronoField.NANO_OF_SECOND, 1, 9, true)
+    .optionalEnd()
+    .optionalEnd()
+    .optionalEnd()
+    .optionalEnd()
+    .optionalStart()
+    .appendOffset("+HH:MM", "Z")
+    .optionalEnd()
+    .parseDefaulting(ChronoField.HOUR_OF_DAY, 0)
+    .parseDefaulting(ChronoField.MINUTE_OF_HOUR, 0)
+    .parseDefaulting(ChronoField.SECOND_OF_MINUTE, 0)
+    .toFormatter(Locale.ROOT)
+    .withResolverStyle(ResolverStyle.STRICT)
+
+  private def refuse(message: String): Nothing = throw new 
RuntimeException(s"UiParameter $message")
+  private def stringExpression(text: String): String = {
+    val encoded = 
Base64.getEncoder.encodeToString(text.getBytes(StandardCharsets.UTF_8))
+    s"""new String(java.util.Base64.getDecoder().decode("$encoded"), 
java.nio.charset.StandardCharsets.UTF_8)"""
+  }
+  private def number(raw: String): Double =
+    raw.toLowerCase(Locale.ROOT) match {
+      case "nan" | "+nan" | "-nan"                   => Double.NaN
+      case "inf" | "+inf" | "infinity" | "+infinity" => Double.PositiveInfinity
+      case "-inf" | "-infinity"                      => Double.NegativeInfinity
+      case value if 
value.matches("[+-]?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?") =>
+        value.toDouble
+      case _ => refuse("requires a decimal numeric value.")
+    }
+  private def initializer(p: UiUDFParameter): String = {
+    val raw = p.value.trim
+    Try {
+      p.attribute.getType match {
+        case AttributeType.STRING  => stringExpression(p.value)
+        case AttributeType.INTEGER => raw.toInt.toString
+        case AttributeType.LONG    => s"${raw.toLong}L"
+        case AttributeType.DOUBLE =>
+          
s"java.lang.Double.longBitsToDouble(${java.lang.Double.doubleToLongBits(number(raw))}L)"
+        case AttributeType.BOOLEAN =>
+          (raw.toLowerCase(Locale.ROOT) match {
+            case "true"  => true
+            case "false" => false
+            case _       => number(raw) != 0d
+          }).toString
+        case AttributeType.TIMESTAMP =>
+          val normalized = raw.replace(' ', 
'T').replaceFirst("([+-][0-9]{2})([0-9]{2})$", "$1:$2")
+          val parsed = timestampFormat.parse(normalized)
+          val offset =
+            if (parsed.isSupported(ChronoField.OFFSET_SECONDS)) 
ZoneOffset.from(parsed)
+            else ZoneOffset.UTC
+          val instant = LocalDateTime.from(parsed).toInstant(offset)
+          
s"java.sql.Timestamp.from(java.time.Instant.parse(${stringExpression(instant.toString)}))"
+        case _ => refuse("type is not supported.")
+      }
+    }.recover {
+      case e: Exception =>
+        throw new RuntimeException(
+          s"UiParameter '${p.attribute.getName}' requires a valid 
${p.attribute.getType.getName} value.",
+          e
+        )
+    }.get
+  }
+
+  def inject(code: String, uiParameters: List[UiUDFParameter]): String = {
+    val parameters = Option(uiParameters).getOrElse(Nil)
+    UiUdfParameterContract.validate(parameters)
+    val source = Option(code).getOrElse("")
+    if (parameters.isEmpty && !source.contains("UiParameter")) return source
+    val compiler = ToolProvider.getSystemJavaCompiler
+    if (compiler == null) {
+      if (parameters.isEmpty) return source
+      refuse("declarations require a JDK with javac on the workflow compiling 
service.")
+    }
+    Javac.inject(source, parameters, compiler)
+  }
+
+  // Keep javac's tree classes unloaded on JRE hosts, even for a bare 
template's comment.
+  private object Javac {
+    def inject(source: String, parameters: List[UiUDFParameter], compiler: 
JavaCompiler): String = {
+      val diagnostics = new DiagnosticCollector[JavaFileObject]()
+      Using.resource(
+        compiler.getStandardFileManager(diagnostics, Locale.ROOT, 
StandardCharsets.UTF_8)
+      ) { manager =>
+        val file = new SimpleJavaFileObject(
+          URI.create("string:///JavaUDFOpExec.java"),
+          JavaFileObject.Kind.SOURCE
+        ) {
+          override def getCharContent(ignoreEncodingErrors: Boolean): 
CharSequence = source
+        }
+        val task = compiler
+          .getTask(null, manager, diagnostics, List("-proc:none").asJava, 
null, List(file).asJava)
+          .asInstanceOf[JavacTask]
+        val unit = task.parse().iterator().next()
+        if (diagnostics.getDiagnostics.asScala.exists(_.getKind == 
Diagnostic.Kind.ERROR))
+          refuse("declarations require valid Java syntax.")
+        val classes = unit.getTypeDecls.asScala.collect {
+          case cls: ClassTree if cls.getSimpleName.toString == "JavaUDFOpExec" 
=> cls
+        }
+        if (classes.size != 1) refuse("declarations require one JavaUDFOpExec 
class.")
+        val positions = Trees.instance(task).getSourcePositions
+        val fields = classes.head.getMembers.asScala.collect { case field: 
VariableTree => field }
+        val supplied = parameters.map(p => p.attribute.getName -> p).toMap
+        val used = scala.collection.mutable.Set.empty[String]
+        val edits = fields.flatMap { field =>
+          val annotations = field.getModifiers.getAnnotations.asScala.filter(a 
=>
+            Set("UiParameter", annotationName)(a.getAnnotationType.toString)
+          )
+          if (annotations.isEmpty) None
+          else {
+            if (annotations.size != 1) refuse("must be declared once per 
field.")
+            val args = annotations.head.getArguments.asScala.map {
+              case argument: AssignmentTree =>
+                argument.getVariable.toString -> argument.getExpression
+              case argument => "value" -> argument
+            }
+            val values = args.map {
+              case (key, tree) =>
+                tree match {
+                  case literal: LiteralTree if 
literal.getValue.isInstanceOf[String] =>
+                    key -> literal.getValue.toString
+                  case _ => refuse("annotation arguments must be string 
literals.")
+                }
+            }.toMap
+            if (
+              values.size != args.size || values.keys
+                .exists(key => key != "value" && key != "resource")
+            )
+              refuse("annotation arguments are invalid.")
+            val name = values.getOrElse("value", "").trim
+            if (used(name)) refuse(s"name '$name' is declared more than once.")
+            used += name
+            val start = positions.getStartPosition(unit, field)
+            val end = positions.getEndPosition(unit, field).toInt
+            if (
+              field.getModifiers.getFlags.contains(
+                Modifier.STATIC
+              ) || field.getInitializer != null || fields.count(f =>
+                positions.getStartPosition(unit, f) == start
+              ) != 1 || end <= 0 || source.charAt(end - 1) != ';'
+            )
+              refuse("requires a single uninitialized instance field per 
declaration.")
+            val kind =
+              nativeTypes.getOrElse(field.getType.toString, refuse("field type 
is not supported."))
+            val parameter = supplied.getOrElse(name, refuse(s"'$name' has no 
saved value."))
+            if (
+              parameter.attribute.getType != kind || 
Option(parameter.inputType).getOrElse(
+                ""
+              ) != values.getOrElse("resource", "")
+            )
+              refuse(s"'$name' metadata does not match its field declaration.")
+            Some((end - 1, initializer(parameter)))
+          }
+        }
+        if (used.toSet != supplied.keySet) refuse("saved values do not match 
the declared fields.")
+        edits.toList.sortBy(-_._1).foldLeft(source) {
+          case (text, (offset, value)) =>
+            text.patch(offset, s" = $value", 0)
+        }
+      }
+    }
+  }
+}
diff --git 
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/java/UiParameter.java
 
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/java/UiParameter.java
new file mode 100644
index 0000000000..208723ad97
--- /dev/null
+++ 
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/udf/java/UiParameter.java
@@ -0,0 +1,33 @@
+/*
+ * 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.apache.texera.amber.operator.udf.java;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/** A UI parameter on an uninitialized instance field of JavaUDFOpExec. */
+@Retention(RetentionPolicy.SOURCE)
+@Target(ElementType.FIELD)
+public @interface UiParameter {
+    String value();
+    String resource() default "";
+}
diff --git 
a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/udf/UiUdfParameterContractSpec.scala
 
b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/udf/UiUdfParameterContractSpec.scala
index 7b1d2f02e8..292fbd83ed 100644
--- 
a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/udf/UiUdfParameterContractSpec.scala
+++ 
b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/udf/UiUdfParameterContractSpec.scala
@@ -19,6 +19,7 @@
 
 package org.apache.texera.amber.operator.udf
 
+import org.apache.texera.amber.operator.udf.java.JavaUdfUiParameterInjector
 import org.apache.texera.amber.operator.udf.python.PythonUdfUiParameterInjector
 import org.apache.texera.amber.operator.udf.r.RUdfUiParameterInjector
 import org.apache.texera.amber.util.JSONUtils.objectMapper
@@ -35,6 +36,13 @@ class UiUdfParameterContractSpec extends AnyFlatSpec with 
Matchers {
       PythonUdfUiParameterInjector
         .inject("class ProcessTupleOperator(UDFOperatorV2):\n    pass\n", 
parameters)
     ),
+    "java" -> ((parameters: List[UiUDFParameter]) => {
+      val field =
+        if (Option(parameters).exists(_.nonEmpty))
+          "@org.apache.texera.amber.operator.udf.java.UiParameter(\"x\") 
String x;"
+        else ""
+      JavaUdfUiParameterInjector.inject(s"class JavaUDFOpExec { $field }", 
parameters)
+    }),
     "r" -> ((parameters: List[UiUDFParameter]) =>
       RUdfUiParameterInjector.inject("function() {}", parameters)
     )
diff --git 
a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/udf/java/JavaUDFOpDescSpec.scala
 
b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/udf/java/JavaUDFOpDescSpec.scala
index 586ab99c5f..8c9632c057 100644
--- 
a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/udf/java/JavaUDFOpDescSpec.scala
+++ 
b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/udf/java/JavaUDFOpDescSpec.scala
@@ -23,6 +23,7 @@ import org.apache.texera.amber.core.executor.OpExecWithCode
 import org.apache.texera.amber.core.tuple.{Attribute, AttributeType, Schema}
 import org.apache.texera.amber.core.virtualidentity.{ExecutionIdentity, 
WorkflowIdentity}
 import org.apache.texera.amber.core.workflow.UnknownPartition
+import org.apache.texera.amber.operator.udf.UiUDFParameter
 import org.apache.texera.amber.operator.{LogicalOp, PortDescription}
 import org.apache.texera.amber.operator.metadata.OperatorGroupConstants
 import org.apache.texera.amber.util.JSONUtils.objectMapper
@@ -98,12 +99,18 @@ class JavaUDFOpDescSpec extends AnyFlatSpec with Matchers {
   "JavaUDFOpDesc" should "round-trip its config fields through the polymorphic 
base" in {
     val d = new JavaUDFOpDesc
     d.code = "x"
+    val p = new UiUDFParameter
+    p.attribute = new Attribute("count", AttributeType.INTEGER)
+    p.value = "42"
+    d.uiParameters = List(p)
     d.workers = 4
     d.retainInputColumns = true
     val restored = objectMapper.readValue(objectMapper.writeValueAsString(d), 
classOf[LogicalOp])
     restored shouldBe a[JavaUDFOpDesc]
     val j = restored.asInstanceOf[JavaUDFOpDesc]
     j.code shouldBe "x"
+    j.uiParameters.head.attribute shouldBe p.attribute
+    j.uiParameters.head.value shouldBe "42"
     j.workers shouldBe 4
     j.retainInputColumns shouldBe true
   }
diff --git 
a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/udf/java/JavaUdfUiParameterInjectorSpec.scala
 
b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/udf/java/JavaUdfUiParameterInjectorSpec.scala
new file mode 100644
index 0000000000..9b017b2c58
--- /dev/null
+++ 
b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/udf/java/JavaUdfUiParameterInjectorSpec.scala
@@ -0,0 +1,264 @@
+/*
+ * 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.apache.texera.amber.operator.udf.java
+
+import org.apache.texera.amber.core.executor.{ExecFactory, 
JavaRuntimeCompilation, OpExecWithCode}
+import org.apache.texera.amber.core.tuple.{Attribute, AttributeType, Schema, 
Tuple}
+import org.apache.texera.amber.core.virtualidentity.{ExecutionIdentity, 
WorkflowIdentity}
+import org.apache.texera.amber.operator.udf.{UiUDFParameter, 
UiUdfParameterContract}
+import org.apache.texera.amber.util.JSONUtils.objectMapper
+import org.scalatest.flatspec.AnyFlatSpec
+import org.scalatest.matchers.should.Matchers
+
+import java.sql.Timestamp
+import java.time.Instant
+import java.nio.file.{Files, Paths}
+import java.util.concurrent.TimeUnit
+import scala.jdk.CollectionConverters._
+
+class JavaUdfUiParameterInjectorSpec extends AnyFlatSpec with Matchers {
+  private def parameter(name: String, kind: AttributeType, raw: String): 
UiUDFParameter = {
+    val p = new UiUDFParameter
+    p.attribute = new Attribute(name, kind)
+    p.value = raw
+    p
+  }
+  private def source(field: String): String =
+    s"""import org.apache.texera.amber.operator.udf.java.UiParameter;
+       |public class JavaUDFOpExec { $field }
+       |""".stripMargin
+  private def evaluate(code: String, parameters: List[UiUDFParameter]): Any = {
+    val cls =
+      
JavaRuntimeCompilation.compileCode(JavaUdfUiParameterInjector.inject(code, 
parameters))
+    cls.getField("value").get(cls.getDeclaredConstructor().newInstance())
+  }
+
+  private val fixture =
+    
objectMapper.readTree(getClass.getResourceAsStream("/udf/ui-parameter-contract.json"))
+  private val examples = fixture.path("values").elements().asScala.toList
+  private lazy val validValues = {
+    val valid = examples.filterNot(_.path("error").asBoolean()).zipWithIndex
+    val fields = valid
+      .map {
+        case (example, index) =>
+          val kind = 
UiUdfParameterContract.typesByToken(example.path("type").asText())
+          s"""@UiParameter("${example
+            .path("id")
+            .asText()}") public ${kind.getFieldClass.getName} value_$index;"""
+      }
+      .mkString("\n")
+    val parameters = valid.map {
+      case (example, _) =>
+        parameter(
+          example.path("id").asText(),
+          UiUdfParameterContract.typesByToken(example.path("type").asText()),
+          example.path("raw").asText()
+        )
+    }
+    val cls = JavaRuntimeCompilation.compileCode(
+      JavaUdfUiParameterInjector.inject(source(fields), parameters)
+    )
+    val instance = cls.getDeclaredConstructor().newInstance()
+    valid.map {
+      case (example, index) =>
+        example.path("id").asText() -> 
cls.getField(s"value_$index").get(instance)
+    }.toMap
+  }
+  for (example <- examples) {
+    "Java UI parameter values" should s"honor ${example.path("id").asText()} 
through javac" in {
+      val kind = 
UiUdfParameterContract.typesByToken(example.path("type").asText())
+      val code = source(s"""@UiParameter("x") public 
${kind.getFieldClass.getName} value;""")
+      val parameters = List(parameter("x", kind, example.path("raw").asText()))
+      if (example.path("error").asBoolean()) {
+        intercept[RuntimeException](evaluate(code, parameters)).getMessage 
should include(
+          "UiParameter"
+        )
+      } else {
+        val actual = validValues(example.path("id").asText())
+        kind match {
+          case AttributeType.TIMESTAMP =>
+            actual.asInstanceOf[Timestamp].toInstant shouldBe Instant.parse(
+              example.path("expected").asText()
+            )
+          case AttributeType.BOOLEAN => actual shouldBe 
example.path("expected").asBoolean()
+          case AttributeType.DOUBLE =>
+            val expected = example.path("expected").asText()
+            val number = actual.asInstanceOf[Double]
+            if (expected == "nan") number.isNaN shouldBe true
+            else if (expected == "inf") number shouldBe Double.PositiveInfinity
+            else if (expected == "-inf") number shouldBe 
Double.NegativeInfinity
+            else number shouldBe expected.toDouble
+          case _ => actual.toString shouldBe example.path("expected").asText()
+        }
+      }
+    }
+  }
+
+  "Java parameter injection" should "leave legacy code unchanged" in {
+    JavaUdfUiParameterInjector.inject("return t;", Nil) shouldBe "return t;"
+  }
+
+  it should "accept bare templates but refuse saved parameters when javac is 
unavailable" in {
+    val log = Files.createTempFile("java-ui-jre-", ".log")
+    val arguments = Files.createTempFile("java-ui-jre-", ".args")
+    Files.writeString(
+      arguments,
+      s"""--limit-modules
+         |java.se,jdk.unsupported
+         |-cp
+         |"${System.getProperty("java.class.path").replace('\\', '/')}"
+         |org.apache.texera.amber.operator.udf.java.JavaUiParameterJreProbe
+         |""".stripMargin
+    )
+    val process = new ProcessBuilder(
+      Paths.get(System.getProperty("java.home"), "bin", "java").toString,
+      s"@$arguments"
+    ).redirectErrorStream(true).redirectOutput(log.toFile).start()
+    try {
+      process.waitFor(30, TimeUnit.SECONDS) shouldBe true
+      withClue(Files.readString(log)) { process.exitValue() shouldBe 0 }
+    } finally {
+      process.destroyForcibly()
+      Files.deleteIfExists(log)
+      Files.deleteIfExists(arguments)
+    }
+  }
+
+  it should "keep user text inert and preserve exact signed long limits" in {
+    val text = "\"; throw new RuntimeException(); 
//\n\\u000a\u0000\ud83d\ude80"
+    evaluate(
+      source("@UiParameter(\"x\") public String value;"),
+      List(parameter("x", AttributeType.STRING, text))
+    ) shouldBe text
+    evaluate(
+      source("@UiParameter(\"x\") public long value;"),
+      List(parameter("x", AttributeType.LONG, Long.MinValue.toString))
+    ) shouldBe Long.MinValue
+  }
+
+  for (
+    field <- Seq("static int value;", "int value = 1;", "int value, another;", 
"byte[] value;")
+  ) {
+    it should s"reject unsupported annotated fields: $field" in {
+      intercept[RuntimeException] {
+        JavaUdfUiParameterInjector.inject(
+          source(s"""@UiParameter("x") $field"""),
+          List(parameter("x", AttributeType.INTEGER, "1"))
+        )
+      }.getMessage should include("UiParameter")
+    }
+  }
+
+  it should "reject missing, stale, mismatched and duplicate metadata" in {
+    val code = source("@UiParameter(\"x\") int value;")
+    for (
+      parameters <- Seq(
+        Nil,
+        List(parameter("y", AttributeType.INTEGER, "1")),
+        List(parameter("x", AttributeType.STRING, "1")),
+        List(parameter("x", AttributeType.INTEGER, "1"), parameter("x", 
AttributeType.INTEGER, "2"))
+      )
+    ) {
+      intercept[RuntimeException](
+        JavaUdfUiParameterInjector.inject(code, parameters)
+      ).getMessage should include("UiParameter")
+    }
+    intercept[RuntimeException](
+      JavaUdfUiParameterInjector.inject(
+        source("@UiParameter(\"x\") int a; @UiParameter(\"x\") int b;"),
+        List(parameter("x", AttributeType.INTEGER, "1"))
+      )
+    ).getMessage should include("more than once")
+  }
+
+  it should "initialize each executor before its constructor and process a 
real tuple" in {
+    val code = """import org.apache.texera.amber.operator.udf.java.UiParameter;
+      |import org.apache.texera.amber.operator.map.MapOpExec;
+      |import org.apache.texera.amber.core.tuple.*;
+      |import scala.Function1;
+      |import java.io.Serializable;
+      |public class JavaUDFOpExec extends MapOpExec {
+      |  @UiParameter("count") private final int count;
+      |  public JavaUDFOpExec() {
+      |    if (count <= 0) throw new IllegalStateException("parameter 
unavailable in constructor");
+      |    setMapFunc((Function1<Tuple, TupleLike> & Serializable) tuple ->
+      |      count == 42 ? tuple : 
Tuple.builder(tuple.getSchema()).addSequentially(new Object[]{count}).build());
+      |  }
+      |}
+      |""".stripMargin.replace("\n", "\r\n")
+    val schema = Schema().add(new Attribute("v", AttributeType.INTEGER))
+    val input = Tuple.builder(schema).add(schema.getAttribute("v"), 
Int.box(42)).build()
+    val executors = Seq(42, 7).map { value =>
+      val d = new JavaUDFOpDesc
+      d.code = code
+      d.workers = if (value == 42) 1 else 2
+      d.uiParameters = List(parameter("count", AttributeType.INTEGER, 
value.toString))
+      val OpExecWithCode(compiled, language) = d
+        .getPhysicalOp(WorkflowIdentity(1), ExecutionIdentity(1))
+        .executableOpExecInitInfo: @unchecked
+      language shouldBe "java"
+      ExecFactory.newExecFromJavaCode(compiled)
+    }
+    for ((executor, expected) <- executors.zip(Seq(42, 7))) {
+      executor.open()
+      executor
+        .processTuple(input, 0)
+        .next()
+        .asInstanceOf[Tuple]
+        .getField[Int]("v") shouldBe expected
+      executor.close()
+    }
+  }
+}
+
+object JavaUiParameterJreProbe {
+  def main(args: Array[String]): Unit = {
+    assert(javax.tools.ToolProvider.getSystemJavaCompiler == null)
+    val parameter = new UiUDFParameter
+    parameter.attribute = new Attribute("count", AttributeType.INTEGER)
+    parameter.value = "42"
+    val code = "public class JavaUDFOpExec { /* @UiParameter */ }"
+    assert(JavaUdfUiParameterInjector.inject(code, Nil) == code)
+    for (workers <- Seq(1, 2)) {
+      val descriptor = new JavaUDFOpDesc
+      descriptor.code = code
+      descriptor.workers = workers
+      val physical = descriptor.getPhysicalOp(WorkflowIdentity(1), 
ExecutionIdentity(1))
+      assert(physical.opExecInitInfo == OpExecWithCode(code, "java"))
+    }
+    val missingCompiler = scala.util
+      .Try(
+        JavaUdfUiParameterInjector.inject(
+          "public class JavaUDFOpExec { @UiParameter(\"count\") int count; }",
+          List(parameter)
+        )
+      )
+      .failed
+      .get
+    assert(missingCompiler.getMessage.contains("require a JDK"))
+    val invalid = scala.util
+      .Try(
+        JavaUdfUiParameterInjector.inject("", List(parameter, parameter))
+      )
+      .failed
+      .get
+    assert(invalid.getMessage.contains("declared more than once"))
+  }
+}
diff --git 
a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/udf/python/PythonUdfUiParameterSupportSpec.scala
 
b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/udf/python/PythonUdfUiParameterSupportSpec.scala
index 542ecdd0b4..4152881d30 100644
--- 
a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/udf/python/PythonUdfUiParameterSupportSpec.scala
+++ 
b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/udf/python/PythonUdfUiParameterSupportSpec.scala
@@ -22,7 +22,8 @@ package org.apache.texera.amber.operator.udf.python
 import org.apache.texera.amber.operator.udf.UiUDFParameter
 
 import org.apache.commons.vfs2.FileNotFoundException
-import org.apache.texera.amber.core.executor.OpExecWithCode
+import org.apache.texera.amber.core.executor.{OpExecWithCode, 
JavaRuntimeCompilation}
+import org.apache.texera.amber.operator.udf.java.JavaUDFOpDesc
 import org.apache.texera.amber.core.storage.RepositoryMountManager
 import org.apache.texera.amber.core.tuple.{Attribute, AttributeType}
 import org.apache.texera.amber.core.virtualidentity.{ExecutionIdentity, 
WorkflowIdentity}
@@ -256,4 +257,36 @@ class PythonUdfUiParameterSupportSpec
       parameters.head.value shouldBe "/dataset/[email protected]/sales/v1"
     }
   }
+  "A Java UDF's execution-time binding" should "initialize fields with the 
selected resource mount directories" in {
+    for (workers <- Seq(1, 2)) {
+      val descriptor = new JavaUDFOpDesc {
+        override protected def mounts: RepositoryMountManager = podMounts
+      }
+      descriptor.code = """import 
org.apache.texera.amber.operator.udf.java.UiParameter;
+        |public class JavaUDFOpExec {
+        |  @UiParameter(value="DATA", resource="dataset") public String data;
+        |  @UiParameter(value="MODEL", resource="model") public String model;
+        |}
+        |""".stripMargin
+      descriptor.workers = workers
+      descriptor.uiParameters = List(
+        parameter("DATA", AttributeType.STRING, "dataset", 
"/dataset/[email protected]/sales/v1"),
+        parameter("MODEL", AttributeType.STRING, "model", 
"/model/[email protected]/iris/v2")
+      )
+      val op = descriptor.getPhysicalOp(WorkflowIdentity(1), 
ExecutionIdentity(1))
+      descriptor.uiParameters = Nil
+      op.mountLocators shouldBe Set("dataset-1:d4t4", "model-1:m0d3l")
+      val OpExecWithCode(code, language) = op.executableOpExecInitInfo: 
@unchecked
+      language shouldBe "java"
+      val cls = JavaRuntimeCompilation.compileCode(code)
+      val instance = cls.getDeclaredConstructor().newInstance()
+      cls.getField("data").get(instance) shouldBe Paths
+        .get("/mnt/texera-mounts/dataset-1/d4t4")
+        .toString
+      cls.getField("model").get(instance) shouldBe Paths
+        .get("/mnt/texera-mounts/model-1/m0d3l")
+        .toString
+    }
+  }
+
 }
diff --git a/docs/contribution-guidelines/ui-parameter-architecture.md 
b/docs/contribution-guidelines/ui-parameter-architecture.md
index 008d46d188..5b53b98726 100644
--- a/docs/contribution-guidelines/ui-parameter-architecture.md
+++ b/docs/contribution-guidelines/ui-parameter-architecture.md
@@ -26,30 +26,32 @@ UI parameters use one metadata contract with 
language-specific syntax and runtim
 
 | Layer | Owner | Responsibility |
 | --- | --- | --- |
-| Type manifest | 
`common/workflow-operator/src/main/resources/udf/ui-parameter-types.json` | 
Supported type aliases (canonical token first) and resource kinds |
+| Type manifest | 
`common/workflow-operator/src/main/resources/udf/ui-parameter-types.json` | 
Supported type aliases (canonical token first), Java field types, and resource 
kinds |
 | Serialized model and validator | `udf.UiUDFParameter`, 
`UiUdfParameterContract` | Stable wire fields, metadata validation, duplicate 
names, and resource/type compatibility |
 | Frontend model and policy | `ui-udf-parameter.ts`, parser service | Read the 
manifest; create rows; validate names, additions, and duplicates once before 
dispatch |
-| Declaration parsers | `python-ui-udf-parameters-parser.ts`, 
`r-ui-udf-parameters-parser.ts` | Read and edit each language's syntax; 
delegate metadata policy |
+| Declaration parsers | `python-ui-udf-parameters-parser.ts`, 
`r-ui-udf-parameters-parser.ts`, `java-ui-udf-parameters-parser.ts` | Read and 
edit each language's syntax; delegate metadata policy |
 | Editor synchronization | `UiUdfParametersSyncService` | Observe Yjs and 
preserve user values by name and resource kind |
-| Compilation | Python/R injector adapters | Validate the shared model and 
encode values using the appropriate runtime API |
+| Compilation | Python/R/Java injector adapters | Validate the shared model 
and encode values using the appropriate runtime API |
 | Resource binding | `UdfUiParameterSupport` | Resolve selected versions into 
mount directories at execution time |
-| Runtime | PyTexera SDK / `texera-rudf` SDK | Construct native values and 
maintain per-operator state |
+| Runtime | PyTexera SDK / `texera-rudf` SDK / JVM | Construct native values 
and maintain per-operator state |
 
 ```text
 code declaration -> language parser -> shared parameter rows -> saved workflow
                                                            |
                                        common validation + resource binding
                                                            |
-                                       language compiler -> runtime SDK
+                                       language compiler -> runtime
 ```
 
 The R compiler emits a call to `texera_ui_parameters` with encoded text and 
the shared type/resource mappings. Its implementation belongs to the R plugin, 
which evaluates each parameterized script in a fresh environment. The compiler 
does not embed the SDK implementation. The runtime reports capability version 
1; Amber gives an explicit upgrade error when a parameterized script is used 
with a plugin lacking that capability. Scripts without UI parameters keep the 
existing plugin path.
 
+Java declares parameters with `@UiParameter` on uninitialized instance fields 
in `JavaUDFOpExec`. The shared manifest maps Java primitive, boxed, and 
string/timestamp field types to parameter types. Lezer reads and edits Java 
declarations in the frontend; javac's source tree validates them on the 
backend. The Java adapter validates saved metadata against each declaration and 
inserts safely encoded, typed field initializers. It uses the existing Java 
compilation and executor factory, with [...]
+
 Native conversions remain language-specific. For example, R uses 
`bit64::integer64` for long values and reserves its minimum signed value for 
`NA`. Common value cases preserve the existing Python boolean contract: 
true/false and numeric text, where nonzero is true. R's tuple bridge converts 
`integer64` through its decimal representation to preserve all available bits.
 
 ## Contract tests
 
-`common/workflow-operator/src/test/resources/udf/ui-parameter-contract.json` 
supplies declaration, metadata, and runtime value cases. Frontend tests run the 
declaration cases against both parsers. Scala runs the metadata cases against 
both injectors. Python tests check the same values against the Python SDK and 
the compiled Python/R code.
+`common/workflow-operator/src/test/resources/udf/ui-parameter-contract.json` 
supplies declaration, metadata, and runtime value cases. Frontend tests run the 
declaration cases against all three parsers. Scala runs the metadata cases 
against all three injectors. Python tests check the same values against the 
Python SDK and the compiled Python/R code.
 
 `UiParameterIntegrationFixtures` generates code through the actual Scala 
injectors. The integration suite passes that code to Amber's `ExecutorManager` 
and the actual `texera-rudf` table/tuple source/processing executors. It checks 
Arrow round-trips, exact long values, Unicode and escaped strings, booleans, 
timestamps, resource directories, invalid values, and Windows line endings. SDK 
tests in the plugin cover operator isolation and legacy script compatibility.
 
diff --git a/docs/reference/operators/user-defined-functions/java/java-udf.md 
b/docs/reference/operators/user-defined-functions/java/java-udf.md
index 3ce521bd36..e1dae870e4 100644
--- a/docs/reference/operators/user-defined-functions/java/java-udf.md
+++ b/docs/reference/operators/user-defined-functions/java/java-udf.md
@@ -60,6 +60,32 @@ public class JavaUDFOpExec extends MapOpExec {
 }
 ```
 
+### UI parameters
+
+Use **Parameters → Add parameter** in the Java UDF properties panel, or 
annotate an instance field inside `JavaUDFOpExec`:
+
+```java
+import org.apache.texera.amber.operator.udf.java.UiParameter;
+
+// Inside JavaUDFOpExec:
+@UiParameter("count") private final int count;
+@UiParameter("label") private String label;
+@UiParameter(value="model", resource="model") private String modelDirectory;
+```
+
+The panel infers names and types from the declarations and lets users edit 
values. Model and dataset parameters use the existing version selector; the 
field receives the selected version's mounted directory when the workflow runs. 
Use `resource="dataset"` for a dataset.
+
+| Java field type | Parameter type |
+| --- | --- |
+| `String` | string |
+| `int` / `Integer` | integer |
+| `long` / `Long` | long |
+| `double` / `Double` | double |
+| `boolean` / `Boolean` | boolean |
+| `java.sql.Timestamp` | timestamp |
+
+Declare one field per annotation, without a field initializer. Static fields 
and arrays are unsupported. Values are validated and compiled into instance 
field initializers, so they are available in the constructor, `open()`, and 
tuple processing. Resource parameters must be strings. Timestamp text uses ISO 
dates or datetimes, with UTC assumed when no offset is given. Long values 
retain all 64 bits.
+
 ### Output Ports
 
 | Port | Mode |
diff --git a/frontend/LICENSE-binary b/frontend/LICENSE-binary
index 15b79c0e03..ff4f6e7d68 100644
--- a/frontend/LICENSE-binary
+++ b/frontend/LICENSE-binary
@@ -417,6 +417,7 @@ Angular / npm packages:
   - @ctrl/[email protected]
   - @lezer/[email protected]
   - @lezer/[email protected]
+  - @lezer/[email protected]
   - @lezer/[email protected]
   - @lezer/[email protected]
   - @ngneat/[email protected]
diff --git a/frontend/package.json b/frontend/package.json
index 2d9905478e..805e70c6c3 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -35,6 +35,7 @@
     "@auth0/angular-jwt": "5.1.0",
     "@codingame/monaco-vscode-java-default-extension": "37.6.1",
     "@codingame/monaco-vscode-python-default-extension": "37.6.1",
+    "@lezer/java": "1.1.5",
     "@lezer/python": "1.1.19",
     "@ngneat/until-destroy": "10.0.0",
     "@ngx-formly/core": "7.1.0",
diff --git 
a/frontend/src/app/workspace/service/code-editor/java-ui-udf-parameters-parser.spec.ts
 
b/frontend/src/app/workspace/service/code-editor/java-ui-udf-parameters-parser.spec.ts
new file mode 100644
index 0000000000..f5f8549830
--- /dev/null
+++ 
b/frontend/src/app/workspace/service/code-editor/java-ui-udf-parameters-parser.spec.ts
@@ -0,0 +1,113 @@
+/**
+ * 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.
+ */
+
+import { UiUdfParametersParserService } from 
"./ui-udf-parameters-parser.service";
+import type { UiUdfLanguage } from "./ui-udf-parameter";
+
+const parser = new UiUdfParametersParserService();
+const language = "java" as UiUdfLanguage;
+const udf = (body: string) => `public class JavaUDFOpExec extends MapOpExec { 
${body} }`;
+const row = (attributeName: string, attributeType: string, inputType?: string) 
=> ({
+  attribute: { attributeName, attributeType },
+  value: "",
+  ...(inputType ? { inputType } : {}),
+});
+
+describe("Java UI parameter declarations", () => {
+  it("infers native field types and resource selectors", () => {
+    expect(
+      parser.parse(
+        udf(`
+      @UiParameter("count") private int count;
+      @UiParameter(value="model", resource="model") private String directory;
+      @org.apache.texera.amber.operator.udf.java.UiParameter("when") 
java.sql.Timestamp when;
+    `),
+        language
+      )
+    ).toEqual([row("count", "integer"), row("model", "string", "model"), 
row("when", "timestamp")]);
+  });
+
+  it("ignores comments, strings, local variables, helpers and nested classes", 
() => {
+    expect(
+      parser.parse(
+        `class Helper { @UiParameter("helper") int helper; }
+      ${udf(`// @UiParameter("comment") int comment;
+        String example = "@UiParameter(\\\"example\\\") int example;";
+        String text = """\n@UiParameter("text") int text;\n""";
+        class Nested { @UiParameter("nested") int nested; }
+        void method() { @UiParameter("local") int local; }
+        @UiParameter("active") Integer active;
+      `)}`,
+        language
+      )
+    ).toEqual([row("active", "integer")]);
+  });
+
+  it.each([
+    '@UiParameter("x") byte[] x;',
+    '@UiParameter("x") static int x;',
+    '@UiParameter("x") int x = 5;',
+    '@UiParameter("x") int x, y;',
+    "@UiParameter(value=dynamic) int x;",
+    '@UiParameter(value="x", resource="unknown") String x;',
+    '@UiParameter(value="x", resource="dataset") int x;',
+    '@other.UiParameter("x") int x;',
+  ])("ignores unsupported declarations: %s", declaration => {
+    expect(parser.parse(udf(declaration), language)).toEqual([]);
+  });
+
+  it("decodes Java escapes and trims parameter names", () => {
+    expect(parser.parse(udf(String.raw`@UiParameter(" caf\u00e9\n") String 
value;`), language)).toEqual([
+      row("café", "string"),
+    ]);
+  });
+
+  it("rejects duplicate names", () => {
+    expect(() => parser.parse(udf('@UiParameter("x") int a; @UiParameter("x") 
int b;'), language)).toThrow(
+      "declared more than once"
+    );
+  });
+
+  it("inserts a collision-free field into the UDF class and preserves 
surrounding code", () => {
+    const code = "/* { */ class Helper {}\r\n" + udf("private int count; 
private int count_2;");
+    const edit = parser.computeParameterInsertion(code, "count", "integer", 
language);
+    const changed = code.slice(0, edit.offset) + edit.text + 
code.slice(edit.offset);
+    expect(changed).toContain("private int count_3;");
+    expect(parser.parse(changed, language)).toEqual([row("count", "integer")]);
+    expect(changed.replace(edit.text, "")).toBe(code);
+  });
+
+  it.each(["class", "UiParameter", "1 count", 'na"me', "你好"])("inserts a valid 
field for %s", name => {
+    const code = udf("");
+    const edit = parser.computeParameterInsertion(code, name, "string", 
language);
+    expect(parser.parse(code.slice(0, edit.offset) + edit.text + 
code.slice(edit.offset), language)).toEqual([
+      row(name, "string"),
+    ]);
+  });
+
+  it("keeps the java package available to generated field initializers", () => 
{
+    const edit = parser.computeParameterInsertion(udf(""), "java", "string", 
language);
+    expect(edit.text).toContain("private String java_;");
+  });
+
+  it("reports missing and ambiguous UDF classes", () => {
+    expect(() => parser.computeParameterInsertion("class Other {}", "x", 
"integer", language)).toThrow("JavaUDFOpExec");
+    expect(() => parser.parse(udf("") + udf(""), language)).toThrow("Only 
one");
+  });
+});
diff --git 
a/frontend/src/app/workspace/service/code-editor/java-ui-udf-parameters-parser.ts
 
b/frontend/src/app/workspace/service/code-editor/java-ui-udf-parameters-parser.ts
new file mode 100644
index 0000000000..787be75829
--- /dev/null
+++ 
b/frontend/src/app/workspace/service/code-editor/java-ui-udf-parameters-parser.ts
@@ -0,0 +1,144 @@
+/**
+ * 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.
+ */
+
+import { parser } from "@lezer/java";
+type SyntaxNode = ReturnType<typeof parser.parse>["topNode"];
+import {
+  createUiParameter,
+  JAVA_UI_PARAMETER_TYPES,
+  UiUdfParameter,
+  UiUdfParametersEditError,
+  UiUdfParametersParseError,
+} from "./ui-udf-parameter";
+
+const ANNOTATION = "org.apache.texera.amber.operator.udf.java.UiParameter";
+const JAVA_KEYWORDS = new Set(
+  "abstract assert boolean break byte case catch char class const continue 
default do double else enum extends final finally float for goto if implements 
import instanceof int interface long native new package private protected 
public return short static strictfp super switch synchronized this throw throws 
transient try void volatile while true false null _ var yield record sealed 
permits".split(
+    " "
+  )
+);
+const JAVA_ESCAPES: Readonly<Record<string, string>> = {
+  b: "\b",
+  t: "\t",
+  n: "\n",
+  f: "\f",
+  r: "\r",
+  '"': '"',
+  "'": "'",
+  "\\": "\\",
+  s: " ",
+};
+
+function children(node: SyntaxNode): SyntaxNode[] {
+  const result: SyntaxNode[] = [];
+  for (let child = node.firstChild; child; child = child.nextSibling) 
result.push(child);
+  return result;
+}
+
+function udfBody(code: string): SyntaxNode | undefined {
+  const classes = children(parser.parse(code).topNode).filter(
+    node =>
+      node.name === "ClassDeclaration" &&
+      code.slice(node.getChild("Definition")?.from, 
node.getChild("Definition")?.to) === "JavaUDFOpExec"
+  );
+  if (classes.length > 1)
+    throw new UiUdfParametersParseError("Only one JavaUDFOpExec class can 
declare UiParameter values.");
+  return classes[0]?.getChild("ClassBody") ?? undefined;
+}
+
+function javaString(text: string): string | undefined {
+  if (!/^"(?:[^"\\\r\n]|\\[\s\S])*"$/.test(text)) return undefined;
+  let valid = true;
+  const value = text
+    .slice(1, -1)
+    .replace(/\\(u+[\da-fA-F]{4}|[0-3][0-7]{0,2}|[4-7][0-7]?|[\s\S])/g, (_, 
escape: string) => {
+      if (escape.startsWith("u")) return 
String.fromCharCode(parseInt(escape.replace(/^u+/, ""), 16));
+      if (/^[0-7]/.test(escape)) return String.fromCharCode(parseInt(escape, 
8));
+      if (Object.hasOwn(JAVA_ESCAPES, escape)) return JAVA_ESCAPES[escape];
+      valid = false;
+      return "";
+    });
+  return valid ? value : undefined;
+}
+
+export function parseJavaUiParameters(code: string): UiUdfParameter[] {
+  const body = udfBody(code);
+  const result: UiUdfParameter[] = [];
+  for (const field of body ? children(body) : []) {
+    if (field.name !== "FieldDeclaration") continue;
+    const modifiers = field.getChild("Modifiers");
+    if (modifiers?.getChild("static")) continue;
+    const declarations = field.getChildren("VariableDeclarator");
+    if (declarations.length !== 1 || children(declarations[0]).some(node => 
node.name !== "Definition")) continue;
+    const annotations =
+      modifiers?.getChildren("Annotation").filter(annotation => {
+        const name = annotation.firstChild;
+        return name && ["UiParameter", 
ANNOTATION].includes(code.slice(name.from, name.to));
+      }) ?? [];
+    if (annotations.length !== 1) continue;
+    const args = annotations[0].getChild("AnnotationArgumentList");
+    const values = new Map<string, string>();
+    let invalid = !args;
+    for (const argument of args ? children(args) : []) {
+      if (["(", ")", ","].includes(argument.name)) continue;
+      const key =
+        argument.name === "StringLiteral" ? "value" : 
code.slice(argument.firstChild?.from, argument.firstChild?.to);
+      const literal = argument.name === "StringLiteral" ? argument : 
argument.getChild("StringLiteral");
+      const value = literal ? javaString(code.slice(literal.from, literal.to)) 
: undefined;
+      if (!["value", "resource"].includes(key) || value === undefined || 
values.has(key)) invalid = true;
+      else values.set(key, value);
+    }
+    if (invalid) continue;
+    const typeNode = children(field).find(node => ["PrimitiveType", 
"TypeName", "ScopedTypeName"].includes(node.name));
+    const nativeType = typeNode ? code.slice(typeNode.from, 
typeNode.to).replace(/\s/g, "") : "";
+    const type = Object.entries(JAVA_UI_PARAMETER_TYPES).find(([, names]) =>
+      (names as string[]).includes(nativeType)
+    )?.[0] as keyof typeof JAVA_UI_PARAMETER_TYPES | undefined;
+    const parameter = createUiParameter(values.get("value")?.trim(), type, 
values.get("resource"));
+    if (parameter) result.push(parameter);
+  }
+  return result;
+}
+
+export function computeJavaParameterInsertion(
+  code: string,
+  name: string,
+  token: string
+): Readonly<{ offset: number; text: string }> {
+  const body = udfBody(code);
+  if (!body || body.lastChild?.name !== "}")
+    throw new UiUdfParametersEditError("A complete JavaUDFOpExec class is 
required to add UI parameters.");
+  let identifier = name.replace(/[^\p{L}\p{N}_$]/gu, "_");
+  if (!/^[\p{L}_$]/u.test(identifier)) identifier = `parameter_${identifier}`;
+  // Generated initializers refer to the java package.
+  if (JAVA_KEYWORDS.has(identifier) || ["UiParameter", 
"java"].includes(identifier)) identifier += "_";
+  // Reserve every identifier in the class, including locals, to avoid 
generating shadowed fields.
+  const names = new Set<string>();
+  body.cursor().iterate(node => {
+    if (["Definition", "Identifier"].includes(node.name)) 
names.add(code.slice(node.from, node.to));
+  });
+  const base = identifier;
+  for (let suffix = 2; names.has(identifier); suffix++) identifier = 
`${base}_${suffix}`;
+  const nativeType = JAVA_UI_PARAMETER_TYPES[token as keyof typeof 
JAVA_UI_PARAMETER_TYPES][0];
+  const newline = code.includes("\r\n") ? "\r\n" : "\n";
+  return {
+    offset: body.from + 1,
+    text: `${newline}    @${ANNOTATION}(${JSON.stringify(name)})${newline}    
private ${nativeType} ${identifier};${newline}`,
+  };
+}
diff --git a/frontend/src/app/workspace/service/code-editor/ui-udf-parameter.ts 
b/frontend/src/app/workspace/service/code-editor/ui-udf-parameter.ts
index 9e2196fe06..d3f64d23d3 100644
--- a/frontend/src/app/workspace/service/code-editor/ui-udf-parameter.ts
+++ b/frontend/src/app/workspace/service/code-editor/ui-udf-parameter.ts
@@ -21,7 +21,7 @@ import contract from 
"../../../../../../common/workflow-operator/src/main/resour
 import type { AttributeType, SchemaAttribute } from 
"../../types/workflow-compiling.interface";
 
 export type UiUdfParameter = Readonly<{ attribute: SchemaAttribute; value: 
string; inputType?: string }>;
-export type UiUdfLanguage = "python" | "r";
+export type UiUdfLanguage = "python" | "r" | "java";
 export class UiUdfParametersParseError extends Error {}
 export class UiUdfParametersEditError extends Error {}
 
@@ -61,3 +61,5 @@ export function assertUniqueParameterNames(parameters: 
UiUdfParameter[]): UiUdfP
   }
   return parameters;
 }
+
+export const JAVA_UI_PARAMETER_TYPES = contract.javaTypes;
diff --git 
a/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-contract.spec.ts
 
b/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-contract.spec.ts
index a5c231dae2..038f654727 100644
--- 
a/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-contract.spec.ts
+++ 
b/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-contract.spec.ts
@@ -18,16 +18,19 @@
  */
 
 import fixture from 
"../../../../../../common/workflow-operator/src/test/resources/udf/ui-parameter-contract.json";
+import { JAVA_UI_PARAMETER_TYPES } from "./ui-udf-parameter";
 import { UiUdfParametersParserService } from 
"./ui-udf-parameters-parser.service";
 
 const parser = new UiUdfParametersParserService();
-for (const language of ["python", "r"] as const) {
+for (const language of ["python", "r", "java"] as const) {
   describe(`${language} declaration contract`, () => {
     it("validates new names and types before parsing existing declarations", 
() => {
       const code =
-        language === "python"
-          ? 'class ProcessTupleOperator(UDFOperatorV2):\n    def open(self):\n 
       self.UiParameter("x", AttributeType.INT)\n        self.UiParameter("x", 
AttributeType.INT)'
-          : 'UiParameter("x", AttributeType$INT); UiParameter("x", 
AttributeType$INT)';
+        language === "java"
+          ? 'class JavaUDFOpExec { @UiParameter("x") int a; @UiParameter("x") 
int b; }'
+          : language === "python"
+            ? 'class ProcessTupleOperator(UDFOperatorV2):\n    def 
open(self):\n        self.UiParameter("x", AttributeType.INT)\n        
self.UiParameter("x", AttributeType.INT)'
+            : 'UiParameter("x", AttributeType$INT); UiParameter("x", 
AttributeType$INT)';
       expect(() => parser.computeParameterInsertion(code, "", "string", 
language)).toThrow("name is required");
       expect(() => parser.computeParameterInsertion(code, "name", "binary", 
language)).toThrow("not supported");
     });
@@ -36,10 +39,15 @@ for (const language of ["python", "r"] as const) {
         const separator = language === "python" ? "." : "$";
         const resource = example.resource ? `, 
value=Resource${separator}${example.resource}` : "";
         const call = `${language === "python" ? "self." : 
""}UiParameter(${JSON.stringify(example.name)}, 
AttributeType${separator}${example.token}${resource})`;
+        const nativeType = example.attributeType
+          ? JAVA_UI_PARAMETER_TYPES[example.attributeType as keyof typeof 
JAVA_UI_PARAMETER_TYPES][0]
+          : "byte[]";
         const code =
-          language === "python"
-            ? `class ProcessTupleOperator(UDFOperatorV2):\n    def 
open(self):\n        ${call}\n`
-            : `function() { ${call} }`;
+          language === "java"
+            ? `class JavaUDFOpExec { 
@UiParameter(value=${JSON.stringify(example.name)}${example.resource ? `, 
resource="${example.inputType ?? "unknown"}"` : ""}) ${nativeType} parameter; }`
+            : language === "python"
+              ? `class ProcessTupleOperator(UDFOperatorV2):\n    def 
open(self):\n        ${call}\n`
+              : `function() { ${call} }`;
         const expected = example.attributeType
           ? [
               {
@@ -54,9 +62,11 @@ for (const language of ["python", "r"] as const) {
     });
     it("rejects duplicate names through the shared validation contract", () => 
{
       const code =
-        language === "python"
-          ? 'class ProcessTupleOperator(UDFOperatorV2):\n    def open(self):\n 
       self.UiParameter("x", AttributeType.INT)\n        self.UiParameter("x", 
AttributeType.INT)'
-          : 'UiParameter("x", AttributeType$INT); UiParameter("x", 
AttributeType$INT)';
+        language === "java"
+          ? 'class JavaUDFOpExec { @UiParameter("x") int a; @UiParameter("x") 
int b; }'
+          : language === "python"
+            ? 'class ProcessTupleOperator(UDFOperatorV2):\n    def 
open(self):\n        self.UiParameter("x", AttributeType.INT)\n        
self.UiParameter("x", AttributeType.INT)'
+            : 'UiParameter("x", AttributeType$INT); UiParameter("x", 
AttributeType$INT)';
       expect(() => parser.parse(code, language)).toThrow("UiParameter name 'x' 
is declared more than once.");
     });
   });
diff --git 
a/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-parser.service.ts
 
b/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-parser.service.ts
index 3d48d78570..a1b6010197 100644
--- 
a/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-parser.service.ts
+++ 
b/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-parser.service.ts
@@ -20,6 +20,7 @@
 import { Injectable } from "@angular/core";
 import type { AttributeType } from "../../types/workflow-compiling.interface";
 import { PythonUiUdfParametersParser } from 
"./python-ui-udf-parameters-parser";
+import { parseJavaUiParameters, computeJavaParameterInsertion } from 
"./java-ui-udf-parameters-parser";
 import { parseRUiParameters, computeRParameterInsertion } from 
"./r-ui-udf-parameters-parser";
 import type { UiUdfLanguage, UiUdfParameter } from "./ui-udf-parameter";
 import { assertUniqueParameterNames, UI_PARAMETER_TOKENS, 
UiUdfParametersEditError } from "./ui-udf-parameter";
@@ -37,7 +38,13 @@ export class UiUdfParametersParserService {
   private readonly python = new PythonUiUdfParametersParser();
 
   parse(code: string, language: UiUdfLanguage): UiUdfParameter[] {
-    return assertUniqueParameterNames(language === "r" ? 
parseRUiParameters(code) : this.python.parse(code));
+    return assertUniqueParameterNames(
+      language === "java"
+        ? parseJavaUiParameters(code)
+        : language === "r"
+          ? parseRUiParameters(code)
+          : this.python.parse(code)
+    );
   }
 
   computeParameterInsertion(
@@ -53,6 +60,7 @@ export class UiUdfParametersParserService {
       throw new UiUdfParametersEditError(`UiParameter type '${type}' is not 
supported.`);
     if (this.parse(code, language).some(parameter => 
parameter.attribute.attributeName === attributeName))
       throw new UiUdfParametersEditError(`UiParameter name '${attributeName}' 
is declared already.`);
+    if (language === "java") return computeJavaParameterInsertion(code, 
attributeName, type);
     return language === "r"
       ? computeRParameterInsertion(code, attributeName, token!)
       : this.python.computeParameterInsertion(code, attributeName, token!);
diff --git 
a/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-sync.service.spec.ts
 
b/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-sync.service.spec.ts
index bc2c12a83c..916b744566 100644
--- 
a/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-sync.service.spec.ts
+++ 
b/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-sync.service.spec.ts
@@ -408,6 +408,28 @@ describe("R parameter synchronization with the real 
parser", () => {
   });
 });
 
+describe("Java parameter synchronization with the real parser", () => {
+  it("adds declarations through Yjs and preserves saved values", () => {
+    const operator = {
+      operatorType: "JavaUDF",
+      operatorProperties: { uiParameters: [parameter("count", "integer", 
"42")] },
+    };
+    const sharedOperator = sharedOperatorType('class JavaUDFOpExec { 
@UiParameter("count") int count; }');
+    const graph = { getOperator: () => operator, getSharedOperatorType: () => 
sharedOperator };
+    const service = new UiUdfParametersSyncService(
+      { getTexeraGraph: () => graph } as unknown as WorkflowActionService,
+      new UiUdfParametersParserService()
+    );
+    service.uiParametersChanged$.subscribe(change => 
(operator.operatorProperties.uiParameters = change.parameters));
+    service.addParameter("java-operator", "label", "string");
+    expect(operator.operatorProperties.uiParameters).toEqual([
+      parameter("label", "string"),
+      parameter("count", "integer", "42"),
+    ]);
+    expect(() => service.addParameter("java-operator", "label", 
"string")).toThrow("declared already");
+  });
+});
+
 function parameter(
   attributeName: string,
   attributeType: UiUdfParameter["attribute"]["attributeType"],
@@ -421,7 +443,7 @@ function sharedOperatorType(code: string): Yjs.Map<unknown> 
{
   const sharedOperator = yjsDocument.getMap<unknown>("operator");
   const operatorProperties = new Yjs.Map<unknown>();
 
-  operatorProperties.set("code", sharedText(code));
+  operatorProperties.set("code", new Yjs.Text(code));
   sharedOperator.set("operatorProperties", operatorProperties);
   return sharedOperator;
 }
diff --git 
a/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-sync.service.ts
 
b/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-sync.service.ts
index b262896f6e..7be4904920 100644
--- 
a/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-sync.service.ts
+++ 
b/frontend/src/app/workspace/service/code-editor/ui-udf-parameters-sync.service.ts
@@ -40,7 +40,7 @@ type SharedOperatorProperties = Readonly<{ code?: string; 
[key: string]: unknown
  */
 const UI_PARAMETER_SYNC_DEBOUNCE_TIME_MS = 200;
 
-/** Keeps Python and R UDF UI parameters in sync with the shared code and 
workflow graph. */
+/** Keeps UDF UI parameters in sync with the shared code and workflow graph. */
 @Injectable({ providedIn: "root" })
 export class UiUdfParametersSyncService {
   private readonly uiParametersChangedSubject = new Subject<{ operatorId: 
string; parameters: UiUdfParameter[] }>();
@@ -79,7 +79,7 @@ export class UiUdfParametersSyncService {
   }
 
   /**
-   * Parses Python or R UDF code and emits merged parameter rows when the 
shape changes.
+   * Parses UDF code and emits merged parameter rows when the shape changes.
    * If codeFromEditor is omitted, reads from Yjs; does nothing if the 
operator or code is unavailable.
    */
   syncStructureFromCode(operatorId: string, codeFromEditor?: string): void {
@@ -130,7 +130,7 @@ export class UiUdfParametersSyncService {
 
   /**
    * Inserts a declaration into the operator's shared code and immediately 
re-syncs the rows.
-   * Python declarations go in open(); R declarations precede the script's 
final function.
+   * Python declarations go in open(); R declarations precede the script's 
final function; Java declarations become instance fields.
    * Throws UiUdfParametersEditError or UiUdfParametersParseError when the 
code cannot be edited.
    */
   addParameter(operatorId: string, attributeName: string, attributeType: 
AttributeType): void {
diff --git 
a/frontend/src/app/workspace/service/workflow-graph/model/workflow-graph.ts 
b/frontend/src/app/workspace/service/workflow-graph/model/workflow-graph.ts
index bde3038bbf..195c050139 100644
--- a/frontend/src/app/workspace/service/workflow-graph/model/workflow-graph.ts
+++ b/frontend/src/app/workspace/service/workflow-graph/model/workflow-graph.ts
@@ -88,6 +88,7 @@ export function isPythonUdf(operator: OperatorPredicate): 
boolean {
 
 export function getUiUdfLanguage(operator: OperatorPredicate | undefined): 
UiUdfLanguage | undefined {
   if (!operator) return undefined;
+  if (operator.operatorType === "JavaUDF") return "java";
   if (isPythonUdf(operator)) return "python";
   if (["RUDF", "RUDFSource"].includes(operator.operatorType)) return "r";
   return undefined;
diff --git a/frontend/yarn.lock b/frontend/yarn.lock
index 3e5244eaf9..899f39fdd8 100644
--- a/frontend/yarn.lock
+++ b/frontend/yarn.lock
@@ -3812,6 +3812,17 @@ __metadata:
   languageName: node
   linkType: hard
 
+"@lezer/java@npm:1.1.5":
+  version: 1.1.5
+  resolution: "@lezer/java@npm:1.1.5"
+  dependencies:
+    "@lezer/common": "npm:^1.2.0"
+    "@lezer/highlight": "npm:^1.0.0"
+    "@lezer/lr": "npm:^1.0.0"
+  checksum: 
10c0/46e7d74751abf6589c1905bcab2c034773ffa95b87c4bf77c6624c38a53c42e8fa0a7b3fc10be510b44c2b1a29882d8457e2375a42761f80c3bd7e9031ab86b4
+  languageName: node
+  linkType: hard
+
 "@lezer/lr@npm:^1.0.0":
   version: 1.4.10
   resolution: "@lezer/lr@npm:1.4.10"
@@ -10737,6 +10748,7 @@ __metadata:
     "@auth0/angular-jwt": "npm:5.1.0"
     "@codingame/monaco-vscode-java-default-extension": "npm:37.6.1"
     "@codingame/monaco-vscode-python-default-extension": "npm:37.6.1"
+    "@lezer/java": "npm:1.1.5"
     "@lezer/python": "npm:1.1.19"
     "@ngneat/until-destroy": "npm:10.0.0"
     "@ngx-formly/core": "npm:7.1.0"

Reply via email to