[9] RFR: 8177136: Caller sensitive method System.getLogger should specify what happens if there is no caller on the stack.

Daniel Fuchs daniel.fuchs at oracle.com
Wed Mar 22 17:07:15 UTC 2017


Hi David,

This is a good suggestion. Here is an updated webrev, that also
incorporates Brent's feedback.

http://cr.openjdk.java.net/~dfuchs/webrev_8177136/webrev.03

Best regards,

-- daniel

On 22/03/2017 00:09, David Holmes wrote:
> Hi Daniel,
>
> On 22/03/2017 4:41 AM, Daniel Fuchs wrote:
>> Hi Brent,
>>
>> Here is an updated webrev that incorporates your feedback:
>>
>> http://cr.openjdk.java.net/~dfuchs/webrev_8177136/webrev.02
>
> You could move all the detail to the @implSpec method as a clarification
> on the use of the caller e.g.:
>
>      * @implSpec
>      * Instances returned by this method route messages to loggers
>      * obtained by calling {@link LoggerFinder#getLogger(java.lang.String,
>      * java.lang.reflect.Module) LoggerFinder.getLogger(name, module)},
> where
>      * {@code module} is the caller's module. In cases where there is
>      * no Java caller on the stack (e.g when called directly from a JNI
>      * attached thread) an IllegalCallerException is thrown. To obtain
>      * a logger in such a context ...
>
> then just:
>
>    * @throws IllegalCallerException if there is no {@linkplain
>    *         StackWalker#getCallerClass() caller} frame, i.e. this method
>      *         is called from JNI and there is no Java frame on the stack.
>
> Up to you.
>
> Thanks,
> David



More information about the core-libs-dev mailing list