/JDK1.9/src/jdk.unsupported/sun/reflect/Reflection.java

https://github.com/zxiaofan/JDK · Java · 46 lines · 11 code · 5 blank · 30 comment · 1 complexity · 272ba89770c6910d7e71522e94ae30f9 MD5 · raw file

  1. /*
  2. * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
  3. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  4. *
  5. *
  6. *
  7. *
  8. *
  9. *
  10. *
  11. *
  12. *
  13. *
  14. *
  15. *
  16. *
  17. *
  18. *
  19. *
  20. *
  21. *
  22. *
  23. *
  24. */
  25. package sun.reflect;
  26. public class Reflection {
  27. private Reflection() { }
  28. /**
  29. * @deprecated This method is an internal API and will be removed.
  30. * Use {@link StackWalker} to walk the stack and obtain the caller class
  31. * with {@link StackWalker.StackFrame#getDeclaringClass} instead.
  32. */
  33. @Deprecated(forRemoval=true)
  34. @SuppressWarnings("removal") // Reflection.getCallerClass
  35. public static Class<?> getCallerClass(int depth) {
  36. if (depth < 0)
  37. throw new InternalError("depth must be positive");
  38. // increase depth to account for delegation to the internal impl
  39. return jdk.internal.reflect.Reflection.getCallerClass(depth + 1);
  40. }
  41. }