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.
The current design of the Annotation class forces users to create their own subclasses - getAnnotationType, getShortDescription. It would be much easier to add also setter for those properties so that one would need only instantiate it and set some values.
Repriotizing this bug.
It was written this way (without setters) intentionally. However you might be right that in some cases when annotation type and short description are not changing, the implementation which returns values which are passed into the instance in constructor might be sufficient. Should I define (question on Jarda) something like: class AnnotationSupport extends Annotation { private String annoType; private String shortDecription; public AnnotationSupport(annoType, shortDecription) { this.annoType = annoType; this.shortDecription = shortDecription; } String getAnnotationType() { return annoType; } String getShortDescription() { return shortDescription; } } ??
Why it was written without setters? I think that you could make this method non abstract and with setters.
Oops, should be "make this class non abstract and with setters"
The annotation type represent how the annotation looks like - whether it is breakpoint or bookmark. Only the module which implemented the annotation should be able to change this type (e.g. debugger can change annotation from enabled breakpoint to disabled breakpoint) and from this point of view (from API point of view) it make no sense for annotation to have public setter for annotation type. Nobody should want to call this public method. That was the reason - it is private property of the annotation and so only getter is available in the API.
To use a setter on an instance you must have the instance first. So is there a way how can I get all/some instances of modules annotations?
Editor implementations of NbDocument.Annotatable.addAnnotation() get Annotation instance. I think it was the main reason. Yes, it is a bit paranoid, but from some point of view it make sense.
As designed. I'm closing the issue. (was discussed by Yarda, Ales and me)
Resolved for 3.4.x or earlier, no new info since then -> verified
Resolved for 3.4.x or earlier, no new info since then -> closing.