United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-8014925 Disable sun.reflect.Reflection.getCallerClass(int) with a temporary switch to re-enable it
JDK-8014925 : Disable sun.reflect.Reflection.getCallerClass(int) with a temporary switch to re-enable it

Details
Type:
Enhancement
Submit Date:
2013-05-20
Status:
Closed
Updated Date:
2013-07-11
Project Name:
JDK
Resolved Date:
2013-07-02
Component:
core-libs
OS:
Sub-Component:
java.lang:reflect
CPU:
Priority:
P2
Resolution:
Fixed
Affected Versions:
7u40
Fixed Versions:
7u40 (b33)

Related Reports
Backport:
Backport:
Relates:
Relates:
Relates:

Sub Tasks

Description
JEP-176 proposes to remove sun.reflect.Reflection.getCallerClass(int) that has incompatibility concern since there are existing applications depending on this private API such as Oracle Diagnostic Logging and jidesoft library that breaks Oracle Primavera.

The jdk part of JEP-176 has been backported to 7u25 but keep sun.reflect.Reflection.getCallerClass(int) as the mitigration plan (JDK-8014745) in 7u25.

The following describes the transition plan to allow customers to migrate their applications away from this private API:
1. Disable sun.reflect.Reflection.getCallerClass(int) in 7u40 and provide a flag to re-enable it
2. Determine how this private API is being used and the use cases
3. Remove this private API if there is no valid use case or there is a proper replacement for it. Allow at least 2 CPU releases to allow customers to make appropriate change.  So the earliest for the removal is 7u55.  If there are valid use cases but no proper replacement, we may keep this private API in jdk7u for longer.


                                    

Comments
Ingrid, Marvin,

We can inform CAPS members, licensees, internal and external customers about this change and gather the information how they are using this private API.  The above suggested release note can be used for your communication.

The JDK team would also like to know how the sun.reflect.Reflection.getCallerClass(int depth) method is being used in their applications and whether they can update their code properly without the dependency of sun.* API.

Thanks

                                     
2013-06-19
I know this is work for an approved CCR - but please get SQE-OK and then I will approve this request.  I want to make sure SQE is aware of this fix.
                                     
2013-06-20
Suggested release note:

In 7u40, sun.reflect.Reflection.getCallerClass(int depth) is disabled by default and throw an UnsupportedOperationException.   This method is in the sun.* namespace.  Such methods are not a supported, public interface [1].  This method has been removed in JDK8  to implement JEP 176 [2] [3] and will be removed in a future 7 update release. There is no replacement.  Existing code depending on this private API will need to updated properly to work on future 7 update releases. As a temporary measure to allow applications migrate away from it, you can re-enable the previous behavior by adding the following in the command line:
    -Djdk.reflect.allowGetCallerClass
or -Djdk.reflect.allowGetCallerClass=true

[1] http://www.oracle.com/technetwork/java/faq-sun-packages-142232.html 
[2] http://openjdk.java.net/jeps/176
[3] http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/da6addef956e




                                     
2013-06-13
SQE is OK with this fix
                                     
2013-06-20
URL:   http://hg.openjdk.java.net/jdk7u/jdk7u40-dev/jdk/rev/6bf5fa233df0
User:  mchung
Date:  2013-07-02 20:25:28 +0000

                                     
2013-07-02
Verified with 7u40/b32 by provided test.
                                     
2013-07-05
URL:   http://hg.openjdk.java.net/jdk7u/jdk7u40/jdk/rev/6bf5fa233df0
User:  lana
Date:  2013-07-05 06:51:16 +0000

                                     
2013-07-05



Hardware and Software, Engineered to Work Together