On 20/03/2017 12:37, David Holmes wrote:
What about those API's says there has to be a Java frame higher up. Why
can't an attached thread request a reference to the logger?
Hi David,
Did you look at the webrev?
1582 * @throws IllegalCallerException if there is no caller frame, i.e.
1583 * when this {@code getLogger} method is called from JNI
1584 * and there is no Java frame on the stack.
This says there must be a frame higher up.
In the case of System.getLogger then the reason is that this
method eventually calls LoggerFinder.getLogger(name, module),
which requires a non null module.
I don't see any reason why we should accept null or why we should
substitute 'null' with a (randomly picked?) module, especially
since this looks like a pretty unusual corner case which can be
easily worked around (in this case) when the behavior of the method
in the presence of a null caller is known.
best regards,
-- daniel