- 
    Bug 
- 
    Resolution: Unresolved
- 
     P4 P4
- 
    19, 20
                    The following run-time exception is raised
> Exception in thread "main" java.lang.IllegalAccessError:
> failed to access class pkg.Exceptions$EBase from class ExceptionsTest
> (pkg.Exceptions$EBase and ExceptionsTest are in unnamed module of loader 'app')
> at ExceptionsTest.main(ExceptionsTest.java:8)
when running "java ExceptionsTest" program with
> package pkg;
> public class Exceptions {
> private static class EBase extends Exception {
> public void m() {}
> }
> public static class E1 extends EBase {}
> public static class E2 extends EBase {}
> }
and
> import pkg.Exceptions;
> public class ExceptionsTest {
> public static void main(String[] args) {
> try {
> m1();
> } catch (Exceptions.E1 | Exceptions.E2 e) {
> e.m();
> }
> }
> private static void m1() throws Exceptions.E1, Exceptions.E2 {
> throw new Exceptions.E1();
> }
> }
Source(s):
- https://gist.github.com/DasBrain/61d2859a66183d29cb2eb9bf4cc1c81b
- https://twitter.com/lukaseder/status/1544713480024068098
> Exception in thread "main" java.lang.IllegalAccessError:
> failed to access class pkg.Exceptions$EBase from class ExceptionsTest
> (pkg.Exceptions$EBase and ExceptionsTest are in unnamed module of loader 'app')
> at ExceptionsTest.main(ExceptionsTest.java:8)
when running "java ExceptionsTest" program with
> package pkg;
> public class Exceptions {
> private static class EBase extends Exception {
> public void m() {}
> }
> public static class E1 extends EBase {}
> public static class E2 extends EBase {}
> }
and
> import pkg.Exceptions;
> public class ExceptionsTest {
> public static void main(String[] args) {
> try {
> m1();
> } catch (Exceptions.E1 | Exceptions.E2 e) {
> e.m();
> }
> }
> private static void m1() throws Exceptions.E1, Exceptions.E2 {
> throw new Exceptions.E1();
> }
> }
Source(s):
- https://gist.github.com/DasBrain/61d2859a66183d29cb2eb9bf4cc1c81b
- https://twitter.com/lukaseder/status/1544713480024068098
- is blocked by
- 
                    JDK-8289980 14.20.3: Check access to the inferred type of a multi-catch exception -           
- Open
 
-         
- relates to
- 
                    JDK-6999635 Multicatch: crash while compiling simple code with a multicatch parameter -           
- Closed
 
-         
- 
                    JDK-8264696 Multi-catch clause causes compiler exception because it uses the package-private supertype -           
- Closed
 
-         
- 
                    JDK-6943289 Project Coin: Improved Exception Handling for Java (aka 'multicatch') -           
- Closed
 
-         
- 
                    JDK-8289980 14.20.3: Check access to the inferred type of a multi-catch exception -           
- Open
 
-