Skip to content

fix(javaactions): write the class javadoc from the action's documentation - #1657

Open
kris-bom wants to merge 1 commit into
mendixlabs:mainfrom
kris-bom:fix/java-action-javadoc
Open

kris-bom wants to merge 1 commit into
mendixlabs:mainfrom
kris-bom:fix/java-action-javadoc

Conversation

@kris-bom

Copy link
Copy Markdown

Closes #1653

What does it do?

The .java file mxcli writes for a Java action now has the javadoc block that Studio Pro and mxbuild
generate from the action's documentation, directly above the class:

import com.mendix.systemwideinterfaces.core.UserAction;

/**
 * Formats an amount as text with two decimals.
 */
public class FormatAmount extends UserAction<java.lang.String>

Before this change a new action got no block, and every create or modify java action removed the one
Studio Pro wrote; the next build put it back, so each rewrite produced a pair of unrelated diffs.

Root cause: javaactions.GenerateSource had no documentation argument and wrote the imports, a
blank line, then public class …. WriteJavaSourceFile (backend interface, model SDK backend, mock,
generated stubs) did not pass it either, although the executor had ja.Documentation at hand.

Change: GenerateSource and WriteJavaSourceFile take a documentation argument; the executor
passes ja.Documentation, which is already the result of the carry rule (the stated doc comment, else
the stored documentation, an explicitly empty one clears it). writeClassJavadoc writes the format
measured on generated files: /**, one * <line> per line (an empty line is * with the trailing
space), */, CRLF like the rest of the file. No documentation, no block, so the existing mxbuild
goldens are unchanged. unimplemented_gen.go and unsupported_gen.go are regenerated, not edited.

Not covered: a */ inside the documentation would end the comment early; how mxbuild writes that is not
measured, so it is written as is. The JavaScript action generator is not touched.

Files

  • sdk/javaactions/source.go: documentation argument, writeClassJavadoc
  • mdl/backend/java.go, mdl/backend/modelsdk/java_write.go, mdl/backend/mock/{backend,mock_java}.go:
    the argument through WriteJavaSourceFile
  • mdl/backend/modelsdk/unimplemented_gen.go, mdl/backend/mcp/unsupported_gen.go: regenerated
  • mdl/executor/cmd_javaactions.go: passes ja.Documentation
  • sdk/javaactions/javadoc_test.go, mdl/executor/cmd_javaactions_javadoc_test.go: new tests;
    existing callers in tests get the extra argument
  • CHANGELOG.md: entry under Unreleased / Fixed
  • .claude/skills/fix-issue/findings/sdk/2026-10-25-java-action-source-without-class-javadoc.json

Testing

  • TestGenerateSource_WritesTheDocumentationAsClassJavadoc: "Line one.\n\nLine three." gives
    /**, * Line one., *, * Line three., */ directly above the class, CRLF.
  • TestGenerateSource_JavadocFromCRLFDocumentation: CRLF documentation gives the same file.
  • TestGenerateSource_NoDocumentationNoJavadoc: no block without documentation (control; the mxbuild
    goldens still match byte for byte).
  • TestGenerateSource_RegeneratesOverAFileWithJavadoc: regenerating over a file with the block gives
    it back unchanged.
  • TestCreateJavaAction_WritesTheSourceWithItsDocumentation: the executor hands WriteJavaSourceFile
    the stated doc comment, the stored documentation when the statement has none, and "" for an
    explicitly empty doc comment.
  • Fix proven to be the cause: with only the writeClassJavadoc call and the executor argument
    reverted, the generator test and two executor cases fail; restored, they pass.
  • End to end with the branch binary on a copy of testdata/testapp-views (11.14.0): the issue's
    create java action writes the block above; create or modify from describe leaves the file byte
    for byte unchanged; changing the doc comment changes only the javadoc line.
  • make build, make test and make lint (lint-go, lint-ts, check-conformance,
    check-test-timeouts) pass; make check-findings passes. (On macOS, cmd/mxcli/docker's
    TestSyncJavaDependencies_* need a setsid on PATH, on main as here; unrelated.)

Checklist

🤖 Generated with Claude Code

…tion

Studio Pro and mxbuild write a Java action's documentation as a javadoc
block directly above `public class <Action>`. mxcli stored the
documentation but wrote the .java file without the block, so a new
action had none and every `create or modify java action` removed the
one Studio Pro wrote; the next build put it back.

GenerateSource and WriteJavaSourceFile now take the documentation, and
the executor passes the action's documentation after the carry rule (the
stated doc comment, else the stored one). It is written as mxbuild does:
`/**`, one ` * <line>` per line (an empty line keeps the trailing
space), ` */`, CRLF. No documentation, no block. The generated backend
stubs are regenerated for the new signature.

Closes mendixlabs#1653

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create [or modify] java action writes the .java file without the class javadoc that Studio Pro and mxbuild generate from the documentation

1 participant