Expose the StackWalker APIs from OpenJDK 17

The new APIs provide a way to
1. Retrive more details of each frame, e.g. StackFrame.getMethodType(),
   getDeclaringClass(), getByteCodeIndex()
2. Filter frames via Option.SHOW_REFLECT_FRAMES
3. Retrieve frames lazily by returning a Stream<StackFrame>

The upstream proposal has more details about the motivation.

Option.SHOW_HIDDEN_FRAMES has the same effect as SHOW_REFLECT_FRAMES,
but is exposed because
1. in favour of portaiblity if 3rd-party library needs to be compiled on
   Android
2. If ART module is updated to support hidden frames, existing app
   can use the option on the existing platform.
3. The existing javadoc has stated that the implementation can choose to
   support hidden frames or not. We don't violate the API contract even
   though the option has no extra effect.
4. The option isn't really hidden from app anyway, because it's exposed via
   Option.values().

All new APIs have the existing CTS test coverage.
See the below test commands

Bug: 191862780
Test: atest CtsLibcoreOjTestCases:test.java.lang
Test: atest CtsLibcoreTestCases:libcore.java.lang.StackWalkerTest
Change-Id: I43fbe4a596d6fa94692de424fb370d52c3722fc2
5 files changed