> Consider these classes:
> 
> package p;
> public class Lib {
>     void main(String... args) {
>         System.err.println("Lib!");
>     }
> }
> 
> and:
> 
> import p.Lib;
> public class Main extends Lib {
>     public void main() {
>         System.err.println("Main!");
>     }
> }
> 
> 
> Note the classes are in different packages. Running this on JDK 26 yields:
> 
> $ jdk-26/bin/java Main.java
> Lib!
> 
> 
> that is not correct - the method `Lib.main(String[])` is package private, and 
> is not inherited to `Main`, i.e. not a member of `Main`, and hence the 
> launcher should not use it. The launcher should only inspect methods that are 
> members (direct or inherited) of `Main`.
> 
> This PR fixes that by only using package-private methods in they are declared 
> in the same class as is the main class. Testing is enhanced to cover all 
> related cases I/we were able to find.
> 
> Also please review the corresponding CSR:
> https://bugs.openjdk.org/browse/JDK-8378555

Jan Lahoda has updated the pull request incrementally with one additional 
commit since the last revision:

  Not using ClassLoader.equals, as suggested.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/30221/files
  - new: https://git.openjdk.org/jdk/pull/30221/files/c49db477..dcc393f3

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

  Stats: 83 lines in 2 files changed: 82 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/30221.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/30221/head:pull/30221

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

Reply via email to