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 207959 - @MIMEResolver.Registration and related should specify @Target(ElementType.PACKAGE)
Summary: @MIMEResolver.Registration and related should specify @Target(ElementType.PAC...
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 7.2
Hardware: All All
: P2 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: API_REVIEW
Depends on:
Blocks: 207960 191777
  Show dependency tree
 
Reported: 2012-01-31 16:31 UTC by Jesse Glick
Modified: 2012-04-17 15:37 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2012-01-31 16:31:45 UTC
See bug #191777 comment #13 JG01.
Comment 1 Jaroslav Tulach 2012-02-01 17:35:28 UTC
I see no reason for this restriction other than consistency. And that is a weak reason. All other aspects - usability, co-location to @DataObject.Registration, no need for @Registrations, @NamespaceRegistrations and @ExtensionRegistrations - speak in favor of flexible target.

Btw. is not it a bit too late for a TCR? That might have come as a result of comment #12. What I am supposed to do with a TCR I don't agree with now? Call a meeting, revert all the code!?

Moreover I am not going to go through all the NetBeans sources and rewrite them again to place the annotations to package-info.java. I'd be willing to do it after comment #10, but not later.
Comment 2 Jesse Glick 2012-02-01 18:10:30 UTC
(In reply to comment #1)
> no reason for this restriction other than consistency. And that is a weak
> reason.

I think consistency is a rather strong reason. The other reason, and the reason all other annotations which are not bound to a Java object (e.g. @OptionsPanelController.ContainerRegistration) specify @Target(PACKAGE), is that it is misleading to have an annotation on an element which is not actually related to the handling of that annotation.

> is not it a bit too late for a TCR? That might have come as a result of
> comment #12.

Sorry, but reviews are there so changes can be reviewed. There are a lot of API reviews going on at once and there is barely time to read them all before feature freeze.

> What I am supposed to do with a TCR I don't agree with now? Call a
> meeting, revert all the code!?

No need to revert all the code, just fix it; or assign to me to fix it; or find some other opinions; or call a meeting to discuss.

> I am not going to go through all the NetBeans sources and rewrite them
> again to place the annotations to package-info.java.

Then assign to me to do so.
Comment 3 Jaroslav Tulach 2012-02-02 07:50:55 UTC
Let's do it like this: bug 191777 is finished. This is new review, you are proposing a change, I am a reviewer. I vote no. I'll try to find next three reviewers to express a vote.
Comment 4 Jaroslav Tulach 2012-02-02 07:54:26 UTC
Need three reviewers...
Comment 5 Jesse Glick 2012-02-24 19:56:38 UTC
Related to bug #207219 comment #15 (JG11): registration processors should be written to reject annotations on non-PACKAGE targets when the Element is not being used by the layer entry except perhaps as a source of an arbitrary name. In other words, all registering annotation usages should be classifiable as one of

1. Purely static data, on a package-info.java.

2. An object assignable to an API supertype - on a concrete class with a no-arg ctor, or a static @NonNull no-arg method, or (if supported by XMLFileSystem) a static final @NonNull field.

3. A non-package element meeting processor-specific structural constraints, such as @ProjectServiceProvider, or context-sensitive @ActionRegistration.

where #2 should be favored over #3 in general.
Comment 6 Jesse Glick 2012-04-17 15:37:04 UTC
No other opinions gathered, no action on part of assignee before feature freeze, so I guess we are stuck with the inconsistent/confused design.