You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "Hyeon-moGu (via GitHub)" <gi...@apache.org> on 2026/02/25 15:50:27 UTC
[PR] Refactor: Replace Whitebox with standard reflection in library, core and configuration [skywalking]
Hyeon-moGu opened a new pull request, #13713:
URL: https://github.com/apache/skywalking/pull/13713
- [ ] If this pull request closes/resolves/fixes an existing issue, replace the issue number.
Part of #13709 .
- [x] Update the [`CHANGES` log](https://github.com/apache/skywalking/blob/master/docs/en/changes/changes.md).
#### Description
This PR is the first part of the migration from PowerMock's `Whitebox` to the standard Java Reflection API to ensure compatibility with JDK 25+ and support for virtual threads.
In this phase, the following modules have been refactored and verified:
- `server-library`
- `server-core`
- `server-configuration`
I have divided the migration into phases to ensure stability and to facilitate a more focused code review. All 250+ tests in these modules have passed successfully. The remaining modules (Analyzer, Receiver, etc..) will be submitted in a subsequent PR.
---
#### ⚠️ Note for Reviewers: Modification in MetricsStreamProcessor.java
In `MetricsStreamProcessor.java`, I have removed the `final` keyword from the `PROCESSOR` field.
**Reason:**
Since modern JDKs strictly prohibit modifying `static final` fields via reflection, this change was necessary to maintain the existing test logic in `MeterSystemTest`, which requires mocking the singleton instance by injecting a `Mockito.spy`.
I would appreciate your guidance on this:
1. Is removing `final` for testability acceptable in this project?
2. Or would you prefer an alternative approach, such as refactoring the `MeterSystem` design to avoid static mocking in the future?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Refactor: Replace Whitebox with standard reflection in library, core and configuration [skywalking]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on PR #13713:
URL: https://github.com/apache/skywalking/pull/13713#issuecomment-3960361288
> Is removing final for testability acceptable in this project?
Or would you prefer an alternative approach, such as refactoring the MeterSystem design to avoid static mocking in the future?
Meter system would be changed to remove static, they have caches and critical as kernel. No point to risk for testing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Refactor: Replace Whitebox with standard reflection in library, core and configuration [skywalking]
Posted by "Hyeon-moGu (via GitHub)" <gi...@apache.org>.
Hyeon-moGu commented on PR #13713:
URL: https://github.com/apache/skywalking/pull/13713#issuecomment-3960946023
> Meter system would be changed to remove static, they have caches and critical as kernel. No point to risk for testing.
Thank you for your valuable feedback., @wu-sheng.
I have updated the PR to address your concerns:
- Restored the final keyword in MetricsStreamProcessor.java to keep the kernel stable.
- Used MockedStatic in MeterSystemTest to inject the mock without modifying the production code.
- Verified that all tests pass in the server-library, server-core, and server-configuration modules locally.
I really appreciate your guidance on this. Please take another look when you have a moment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org