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.

Bug 15319 - The Annotation class is poorly written.
Summary: The Annotation class is poorly written.
Status: CLOSED INVALID
Alias: None
Product: platform
Classification: Unclassified
Component: Text (show other bugs)
Version: 3.x
Hardware: Sun SunOS
: P4 blocker (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-09-10 12:29 UTC by anovak
Modified: 2008-12-22 19:43 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description anovak 2001-09-10 12:29:45 UTC
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.
Comment 1 anovak 2001-09-10 12:31:11 UTC
Repriotizing this bug.
Comment 2 David Konecny 2001-09-10 12:52:28 UTC
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;
 }
}

??
Comment 3 anovak 2001-09-10 13:06:46 UTC
Why it was written without setters? I think that you could make this
method non abstract and with setters.
Comment 4 anovak 2001-09-10 13:09:33 UTC
Oops, should be "make this class non abstract and with setters"
Comment 5 David Konecny 2001-09-10 15:52:40 UTC
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.
Comment 6 anovak 2001-09-10 15:57:19 UTC
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?
Comment 7 David Konecny 2001-09-10 17:01:37 UTC
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.
Comment 8 David Konecny 2001-09-19 14:38:12 UTC
As designed. I'm closing the issue. (was discussed by Yarda, Ales and 
me)
Comment 9 Quality Engineering 2003-07-01 15:56:53 UTC
Resolved for 3.4.x or earlier, no new info since then -> verified
Comment 10 Quality Engineering 2003-07-01 16:31:49 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.