This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I'd like to be able to transform this: @ServiceLocator private myServiceLocator; to this @ServiceLocator private transient myServiceLocator; Currently this does not seem to be possible maybe it could be sth like $mods$ $type $name; :: $mod$ contains @ServiceLoctor && $mod$ not contains transient ==> $mod$ transient $type $name;
This should work: --- $mods$ @test2.ServiceLocator $type $name = $init$; :: !matchesAny($_, "$mods2$ transient $type2 $name2 = $init2$;") => $mods$ @test2.ServiceLocator transient $type $name = $init$; ;; --- Some notes: -partial matching of modifiers should (AFAIK) work for a few releases now (since NB 7.3, as far as I can tell). I was convinced it is documented, but seems it is not. It is necessary to start with $mods$ (the name itself is not important of course) and then provide the modifiers and annotations that must be present - that is needed so that the pattern can be parsed correctly. -sadly, specifying which modifiers should not be present is harder - above, matchesAny is used for that (note the varibles used by the embedded pattern are not the same as the variables used in the base pattern; that is done intentionally to avoid interferrence between the base and the embedded pattern).
COOL!Could you add this example (and other ones) to http://wiki.netbeans.org/JavaDeclarativeHintsFormat, since from there it was not easy to see how you use these conditions in this context... :)
Another question: I mixed the @.. a little around and wanted to have different messages shown on the hint, so I tried this: @com.infonova.base.context.annotation.ByServiceLocator $mods$ $type $name = $init$; :: !matchesAny($_, "$mods2$ transient $type2 $name2 = $init2$;") => @com.infonova.base.context.annotation.ByServiceLocator $mods$ transient $type $name = $init$; => <!hint='Add transient'> => <!description="convert @ByServiceLocator private var to @ByServiceLocator private transient var"> ;; But whenever I click on the hint over @ByServiceLocator private Service service; I get: 'Rewrite to @ByServiceLocator private@com.mypackage.ByServiceLocator transient @ByServiceLocator private Service service: = $init$;' which is kinda ugly. Is there a nicer way to show what it actually creates?
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue. Thanks for your cooperation, NetBeans IDE 8.2 Release Boss