Other |
---|
tbdUnresolved |
Blocks :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
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
|