Seems the cause of this issue is located here. It marks as internal one in 2 cases:
The class name contains .internal. or
There is no translation and no Javadoc resource found
For $services.model, the implementation class is in an internal package, but the code already tries to switch to a public interface; the deciding factor ends up being no translation / doc link, so isInternal remains true and it only appears when "Internals" is enabled.
What I debugged and AI with 3 agents (Claude, Gemini and OpenAI) points that it could be fix with this trick
Declare $services.model as a public script service by adding a non-internal translation and doc link. Add these lines to ApplicationResources.properties in the Scripting Documentation app:
scriptdoc.service.model.description=Provides access to the XWiki Model API (wikis, spaces, documents, objects, and their references).
scriptdoc.service.model.docLink=https://extensions.xwiki.org/xwiki/bin/view/Extension/Model%20Module
Otherwise, fix has to be done in 2 places
In xwiki-platform (model module)
Ensure the script service is implemented / exposed through a public, non.internal. interface or class, e.g.:
org.xwiki.model.script.ModelScriptService as the role / API type
The internal implementation (org.xwiki.model.internal.scripting.ModelScriptService) should implement that type, but the Scripting Documentation should "see" the public one.
If not already done, adjust the component descriptor so that the role type is the public class/interface, and the internal class is only the implementation.
In Scripting Documentation (current repo you have)
Extend AbstractTypeInformationFinder.newBinding() (or ServiceScriptBindingsFinder) to:
Prefer the role type (public API) when resolved, instead of the raw implementation:
e.g. lookup a ?public API class? from the ComponentDescriptor (role type or a known public interface) and pass that to newBinding.
Only fall back to the implementation class when no better public type exists.
This way, isInternal(Class<?>) is computed against the public package, not .internal.*, and you don't have to special-case $services.model.
I tried to test easiest fix, but I can't build extension in the end, Maven returns error
[INFO] API checks completed without failures.
[INFO]
[INFO] --- spoon:3.5:check (spoon-main) @ scripting-documentation-api ---
java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.net.URLClassLoader.addURL(java.net.URL) accessible: module java.base does not "opens java.net" to unnamed module @47d7f6a7
at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:391)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:367)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:315)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:203)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:197)
at fr.inria.gforge.spoon.util.ClasspathHacker.addURL(ClasspathHacker.java:19)
at fr.inria.gforge.spoon.SpoonMojoGenerate.addArtifactsInClasspathOfTargetClassLoader(SpoonMojoGenerate.java:265)
at fr.inria.gforge.spoon.SpoonMojoGenerate.initMojo(SpoonMojoGenerate.java:199)
at fr.inria.gforge.spoon.SpoonMojoGenerate.execute(SpoonMojoGenerate.java:222)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:919)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:285)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:207)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Scripting Documentation - Parent POM 1.5.1-SNAPSHOT:
[INFO]
[INFO] Scripting Documentation - Parent POM ............... SUCCESS [01:41 min]
[INFO] Scripting Documentation - API ...................... FAILURE [ 43.641 s]
[INFO] Scripting Documentation - UI ....................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:26 min
[INFO] Finished at: 2026-04-01T16:14:20+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal fr.inria.gforge.spoon:spoon-maven-plugin:3.5:check (spoon-main) on project scripting-documentation-api: Error, could not add URL to system classloader -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :scripting-documentation-api
This message was sent by Atlassian Jira (v9.3.0#930000-sha1:287aeb6)
If image attachments aren't displayed, see this article.