netbeans
netbeans copied to clipboard
Navigate to source does not work for annotation with default value of type Class
Apache NetBeans version
Apache NetBeans latest daily build
What happened
When I have code e.g.:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Inherited
public @interface RunWith {
Class<?> value();
}
@RunWith(String.class)
public class Runner {}
Pressing key Ctrl and click mouse on String.class, netbeans opens source of RunWith.java instead of String.java. Also JavaDoc shows RunWith.java.
How to reproduce
See the description above.
Did this work correctly in an earlier version?
No
Operating System
Linux 5.17.9-1-default, openSUSE Tumbleweed, x86_64
JDK
18.0.1
Apache NetBeans packaging
Own source build
Anything else
No response
Are you willing to submit a pull request?
Yes
Code of Conduct
Yes
good catch. thanks for the compact reproducer.
It is really annoying mainly if you heavily work with annotations e.g. Spring Boot, Quarkus...
@hlavki @Saljack could you please test the nightly build available from PR #7378?
Direct link: https://github.com/apache/netbeans/suites/23738068067/artifacts/1498621505
It works like a charm 👍 Thank you so much. I tested these combinations:
@Import(Something.class)
@Import(value = {Something.class} )
@Import(value = {Something.class, Object.class} )
@Import
@SpringBootApplication(scanBasePackageClasses = Something.class, exclude = Object.class)
and in all cases, it is linked to a correct annotation or a class parameter. I assume it is too late for NetBeans 22 😢
@Saljack thank you for the quick check.
I assume it is too late for NetBeans 22 😢
NB22 is still in RC phase. While I wanted to wait for CI/CD to complete and then decide, @mbien beat me to it and went ahead, reviewed and added to NB22 milestone. Meanwhile @ebarboni also merged the change to delivery for the next RC. So yes, it should be released with next version.