RFR: 8371470: Java Launcher does not fail when running compact java-file with private no-arg constructor [v2]

Christian Stein cstein at openjdk.org
Thu Nov 13 16:20:38 UTC 2025


> 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

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/28291/files
  - new: https://git.openjdk.org/jdk/pull/28291/files/5e53ac85..2508305a

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=28291&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28291&range=00-01

  Stats: 8 lines in 1 file changed: 0 ins; 8 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/28291.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28291/head:pull/28291

PR: https://git.openjdk.org/jdk/pull/28291


More information about the compiler-dev mailing list