-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
14
A DESCRIPTION OF THE PROBLEM :
The use case:
would like to be able to call LogRecord.getSourceClassName() and LogRecord.getSourceMethodName() but only to retrieve values set via the Setters (not trigger inference). (setSourceClassName and setSourceMethodName)
this is currently not possible cleanly, since the getters will call inferCaller, and that has a performance cost and might not be possible in the context it is called (see https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4515935)
Currently the only way to do this is via reflective access to LogRecord.needToInferCaller and and call when false of LogRecord.getSourceClassName() and LogRecord.getSourceMethodName()...
Now since JDK 11+ the reflective access causes:
WARNING: An illegal reflective access operation has occurred
...
WARNING: All illegal access operations will be denied in a future release
The simplest way would be to add aditional getters that do not trigger inferCaller().
The use case:
would like to be able to call LogRecord.getSourceClassName() and LogRecord.getSourceMethodName() but only to retrieve values set via the Setters (not trigger inference). (setSourceClassName and setSourceMethodName)
this is currently not possible cleanly, since the getters will call inferCaller, and that has a performance cost and might not be possible in the context it is called (see https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4515935)
Currently the only way to do this is via reflective access to LogRecord.needToInferCaller and and call when false of LogRecord.getSourceClassName() and LogRecord.getSourceMethodName()...
Now since JDK 11+ the reflective access causes:
WARNING: An illegal reflective access operation has occurred
...
WARNING: All illegal access operations will be denied in a future release
The simplest way would be to add aditional getters that do not trigger inferCaller().