RFR: 8371470: Java Launcher does not fail when running compact java-file with private no-arg constructor [v2]
Jaikiran Pai
jpai at openjdk.org
Thu Nov 20 09:05:15 UTC 2025
On Thu, 13 Nov 2025 16:20:38 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);
>> }
>
> Christian Stein has updated the pull request incrementally with one additional commit since the last revision:
>
> Remove unused method
This looks reasonable to me.
-------------
Marked as reviewed by jpai (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/28291#pullrequestreview-3486471312
More information about the compiler-dev
mailing list