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 244172 - NetBeans overly restricts the @Target types of CDI @Qualifiers.
Summary: NetBeans overly restricts the @Target types of CDI @Qualifiers.
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: CDI (show other bugs)
Version: 8.0
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Assignee: Sergey Petrov
URL:
Keywords:
: 243155 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-04-29 13:21 UTC by chrisjr
Modified: 2014-07-09 15:09 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 chrisjr 2014-04-29 13:21:35 UTC
NetBeans only allows @Qualifiers to have:

@Target({ FIELD, PARAMETER })

or

@Target({ METHOD, FIELD, PARAMETER, TYPE })

This is too restrictive, because it fails to consider (e.g.) @Produces methods.

    @Produces
    @MyQualifier
    String getValue() {
        return "foo";
    }

This @Produces method might reasonably expect to satisfy a field and/or parameter injection point, but that would require that @MyQualifier be applicable to a METHOD as well. However, NetBeans rejects a qualifier that wants to use:

@Target({ METHOD, FIELD, PARAMETER })

It is therefore forced to include TYPE as well, despite @MyQualifier *not* being applicable to a type declaration.

Conversely, I also have previously also had reason to create qualifiers that have wanted to use only:

@Target(TYPE)

NetBeans doesn't like these either, although they are perfectly legal and accepted by WELD. Even worse, once NetBeans decides it doesn't like the @Target types on a qualifier, it refuses to use that qualifier for type-safe bean resolution.

I strongly suspect that this is what bug #225556 was trying to raise.
Comment 1 Sergey Petrov 2014-07-03 09:48:04 UTC
http://hg.netbeans.org/web-main/rev/d86437089d04
Comment 2 Sergey Petrov 2014-07-04 09:24:42 UTC
*** Bug 243155 has been marked as a duplicate of this bug. ***