From 0174ed5beb7669ab68786c4c7a2e6e0ec94dcbef Mon Sep 17 00:00:00 2001 From: Francesco Galgani <1997316+jsfan3@users.noreply.github.com> Date: Fri, 29 May 2026 16:14:46 +0200 Subject: [PATCH] Update Lifecycle.java getCurrentForm javadoc I am clarifying this JavaDoc primarily for AI agents rather than humans. In one of my applications, the generative AI confused Lifecycle.getCurrentForm() with CN.getCurrentForm(). Clearly specifying the difference in the JavaDoc can help prevent this issue. Signed-off-by: Francesco Galgani <1997316+jsfan3@users.noreply.github.com> --- .../src/com/codename1/system/Lifecycle.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/CodenameOne/src/com/codename1/system/Lifecycle.java b/CodenameOne/src/com/codename1/system/Lifecycle.java index 410a5b7cac..842f611adc 100644 --- a/CodenameOne/src/com/codename1/system/Lifecycle.java +++ b/CodenameOne/src/com/codename1/system/Lifecycle.java @@ -146,8 +146,19 @@ public void stop() { /// Callback when the app is destroyed public void destroy() { } - - /// The current form within the application lifecycle which possibly differs from the one in the implementation + + /// Returns the form currently stored by this `Lifecycle` instance for + /// application resume handling. + /// + /// In most application code, use `CN.getCurrentForm()` instead, as it returns + /// the form that is actually displayed on the screen. This method is only useful + /// when subclassing `Lifecycle` and you need to inspect or customize the form + /// remembered by `stop()` and restored by `start()`, which may differ from the + /// form currently displayed by the Codename One implementation. + /// + /// #### Returns + /// + /// the form stored in this lifecycle, or `null` if no form has been stored protected Form getCurrentForm() { return current; }