Re: replacements for Unsafe

2020-04-29 Thread Jochen Theodorou
On 29.04.20 13:37, Remi Forax wrote: Hi Jochen, Per the Java spec, calling an empty static method of the inner class works. but it has to work for any arbitrary inner class. The Class.forName variant Kasper mentioned and I thought I tired already (but did not) works for me. Thanks bye Jochen

Re: replacements for Unsafe

2020-04-29 Thread Jochen Theodorou
On 29.04.20 13:39, Kasper Nielsen wrote: Hi Jochen, Is there anything stopping you for doing something like: try { Class.forName(innerClassName, true, initalizeClass.getClassLoader()); } catch (ClassNotFoundException e) { throw new ExceptionInInitializerError(e); // Should never happe

Re: replacements for Unsafe

2020-04-29 Thread Kasper Nielsen
Hi Jochen, Is there anything stopping you for doing something like: try { Class.forName(innerClassName, true, initalizeClass.getClassLoader()); } catch (ClassNotFoundException e) { throw new ExceptionInInitializerError(e); // Should never happen } I know it is not pretty. /Kasper On

Re: replacements for Unsafe

2020-04-29 Thread Remi Forax
Hi Jochen, Per the Java spec, calling an empty static method of the inner class works. Rémi - Mail original - > De: "Jochen Theodorou" > À: "jigsaw-dev" > Envoyé: Mercredi 29 Avril 2020 13:23:47 > Objet: replacements for Unsafe > Hi, > > wh

replacements for Unsafe

2020-04-29 Thread Jochen Theodorou
Hi, when jigsaw started there was a lot of talk about providing alternatives to what Unsafe offers. Today I am facing a problem I cannot solve anymore it seems with this. My problem is that I need to ensure the static block of an inner class has been executed before I do something, because the s