Integrated: 8371470: Java Launcher does not fail when running compact java-file with private no-arg constructor
Christian Stein
cstein at openjdk.org
Tue Dec 2 13:35:51 UTC 2025
On Thu, 13 Nov 2025 11:46:45 GMT, Christian Stein <cstein at openjdk.org> wrote:
> Please review this change to synchronize the behaviour in `java`'s source launch mode to fail when a non-arg constructor with `private` access modifier is defined - like it does in class launch mode.
>
> Find the prior-art check performed in class launch mode at [LauncherHelper.java#L958-L961](https://github.com/openjdk/jdk/blob/8102f436f5586253302cd8cef49bfe2b4af41693/src/java.base/share/classes/sun/launcher/LauncherHelper.java#L958-L961):
>
>
> Constructor<?> constructor = mainClass.getDeclaredConstructor();
> if (Modifier.isPrivate(constructor.getModifiers())) {
> abort(null, "java.launcher.cls.error6", className);
> }
This pull request has now been integrated.
Changeset: c97d53a9
Author: Christian Stein <cstein at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/c97d53a9529d9148aacd85a3b31d694f04df0758
Stats: 45 lines in 3 files changed: 34 ins; 9 del; 2 mod
8371470: Java Launcher does not fail when running compact java-file with private no-arg constructor
Reviewed-by: jpai
-------------
PR: https://git.openjdk.org/jdk/pull/28291
More information about the compiler-dev
mailing list