United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-8021946 : Disabling sun.reflect.Reflection.getCallerCaller(int) by default breaks several frameworks and libraries

Details
Type:
Bug
Submit Date:
2013-07-31
Status:
Resolved
Updated Date:
2013-08-06
Project Name:
JDK
Resolved Date:
2013-08-01
Component:
core-libs
OS:
Sub-Component:
java.lang
CPU:
Priority:
P1
Resolution:
Fixed
Affected Versions:
7u40
Fixed Versions:
7u40 (b37)

Related Reports
Backport:
Backport:

Sub Tasks

Description
See JDK-8014925 (and CCR http://oracleplan.oracle.com/gotoEntity?entityType=FEATURE&entityId=1080598) for background.

In 7u40 we have disabled the JDK private method sun.reflect.Reflection.getCallerCaller(int). It turns out that there are several frameworks and libraries that have ignored the warning not to use JDK private methods and now broken by the change in 7u40. This includes Groovy, Log4J and others. The solution in 7u40 includes a system property to re-enable this method but it turns out that this is too awkward to use (the Groovy folks are saying that they cannot ask their users to set this property).

This bug is submitted to re-examine this issue for 7u40 only. Separate enhancement issues have been submitted for 8 to explore API solutions to cover some of the use-cases where the caller class is required.  For 7u40 then we need to explore whether it would make sense to re-enable it to allow existing code to continue to work even through they are making use of a JDK private method.
                                    

Comments
I think it's pretty clear what we need to do here: Remove the system property controlling the behavior of this method and re-enable the method to work correctly by default.  If we ship 7u40 without this change then we run a high risk of serious adoption problems.
                                     
2013-07-31
The method can remained deprecated in the 7 update train though. That would preserve binary compatibility while providing a warning for source-level usage.
                                     
2013-07-31
in today's 7u40 Triage meeting - we all agreed that this is a must fix and everyone agreed to mark this as critical approved. - DONE

I have also sent the CCR out - since the work was added via CCR and will now need to be backed out and therefore the CCR will need to be rejected.  16956642	ccr: disable sun.reflect.reflection.getcallerclass() by default 
                                     
2013-07-31
URL:   http://hg.openjdk.java.net/jdk7u/jdk7u40-dev/jdk/rev/244dbaeab45e
User:  alanb
Date:  2013-08-01 17:08:37 +0000

                                     
2013-08-01
URL:   http://hg.openjdk.java.net/jdk7u/jdk7u40/jdk/rev/244dbaeab45e
User:  lana
Date:  2013-08-01 23:43:23 +0000

                                     
2013-08-01



Hardware and Software, Engineered to Work Together