NB 21 (and 20 too) focused profiler does not work with project source level > 11
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 935
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 17
Description
### Apache NetBeans version
Apache NetBeans 21
### What happened
The focused (instrumented) profiler over selected classes & selected methods does not works with source level > 11 (tested with 17 & 21).
No profiler data is collected, no threads are catched by profiler tool.
General (sampled) profiler works fine.
### Language / Project Type / NetBeans Component
Java (ant or maven tested) based application
### How to reproduce
Create a sample application (eg: anagram game in NB Ant samples) with NB 21 (or 20) and installed JDK >= 17 (I've tested the problem with both 17 and 21).
Keep (in case of anagram game) source level to 8, run profiler in "methods" mode, go to "focused (instrumented) mode" and select "selected classes" or "selected methods" to profile.
Profile (run) project.
Invoke the profiled selected class or method: you can see collected data in profiler. The running thread is catched and profiled.
Switch source level to 11 and run the same steps with the profiler: all fine.
Finally, repeat the same steps with source level to 11 or 21: failed!
No classes/methods will be profiled and profiler cannot find any thread in thread selection.
Some screenshots about settings:



### Did this work correctly in an earlier version?
Apache NetBeans 16 or earlier
### Operating System
FEDORA 39
### JDK
OpenJDK 64-Bit Server VM (Red_Hat-17.0.9.0.9-4) (build 17.0.9+9, mixed mode, sharing)
### Apache NetBeans packaging
Apache NetBeans binary zip
### Anything else
Tested with vanilla NB 20 & 21: no customization & no external plugins.
Tested with vanilla Fedora 39 builtin rpm java (17 & 21) packages too.
Tested with external (Oracle, Adoptium) JDKs.
The problem seems related to the inability of profiler to catch the running thread (IMHO).
### Are you willing to submit a pull request?
No
Contributor guide
Research direction
Start by reproducing the focused (instrumented) profiler workflow with the NetBeans Anagram sample, comparing source levels 11, 17, and 21 and selected classes or methods. Done means the selected code produces profiler data and the running thread appears in thread selection, while sampled profiling remains unaffected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100