Better tools for adjusting to strong encapsulation

Peter Levart peter.levart at gmail.com
Fri Mar 24 12:01:42 UTC 2017



On 03/23/2017 08:04 PM, Alan Bateman wrote:
> On 23/03/2017 18:44, Alan Snyder wrote:
>
>> If I understand JEP 264 correctly, it should be possible to direct 
>> platform generated error messages to locations other than the 
>> standard error stream (System.err).
>>
>> Is that correct?
>>
>> If so, would it not make sense for the default to be the (platform 
>> dependent) console log rather than System.err, which is used by 
>> applications for their own error messages?
> System.Logger can be configured to send log messages to whatever 
> logging library you are using. However, is is not appropriate here, 
> ditto for several other areas where you don't want arbitrary code to 
> execute.
>
> -Alan

Just a reminder that System.err field is "writable" and therefore 
System.setErr(PrintStream) can be used to redirect output to execute 
arbitrary code...

But I think that anyone using this technique has already been faced with 
re-entrancy issues and has already put checks into place to handle them 
(I know I have).

So I would recommend anyone using System.err redirection to test code 
running with '--permit-illegal-access' option.

Regards, Peter


More information about the jigsaw-dev mailing list