Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8016814

sun.reflect.Reflection.getCallerClass returns the wrong stack frame

XMLWordPrintable

    • b31
    • generic
    • generic
    • Verified

        Problem Description
        -------------------
        sun.reflect.Reflection.getCallerClass(int) has changed its behaviour such
        that a different Class is now returned for a given integer. It looks like
        getCallerClass is now calling another method on Reflection, which has changed
        the call stack. Attached is a test class that exhibits the problem.

        For jdk7u21, its output is:

        sun.reflect.Reflection
        sunreflect.ReflectionCaller$Inner2
        sunreflect.ReflectionCaller$Inner1
        sunreflect.ReflectionCaller

        But for 7u25, its output is:
        sun.reflect.Reflection
        sun.reflect.Reflection
        sunreflect.ReflectionCaller$Inner2
        sunreflect.ReflectionCaller$Inner1

              mchung Mandy Chung
              tyao Ting-Yun Ingrid Yao (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: