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 238882 - @AroundInvoke interceptor bindings with @Target({TYPE, METHOD}) shows as an error.
Summary: @AroundInvoke interceptor bindings with @Target({TYPE, METHOD}) shows as an e...
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: CDI (show other bugs)
Version: 7.4
Hardware: PC Linux
: P3 normal (vote)
Assignee: Petr Hejl
URL:
Keywords:
: 242610 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-11-27 13:46 UTC by Birk
Modified: 2015-06-14 04:49 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 Birk 2013-11-27 13:46:01 UTC
Netbeans (7.4) shows an error (red wavy line and icon) if a interceptor binding with @Target({TYPE, METHOD}) is used on a bean with a @PostConstruct method, even if the interceptor is not a lifecycle callback interceptor (doesn't have a @PostConstruct or any other lifecycle methods).


An interceptor binding like this

@InterceptorBinding
@Retention(RUNTIME)
@Target({TYPE, METHOD})
public @interface MyBinding {}

and an interceptor like this:

@Interceptor
@MyBinding
public class MyInterceptor implements Serializable {

    @AroundInvoke
    public Object interceptInvoke(InvocationContext ctx) throws Exception {
        //something
        return ctx.proceed()
    }
}

Results in an errormessage on the @PostConstruct method when this binding is applied to a bean:

@Named
@MyBinding
public class SomeBean {

    @PostConstruct
    public void init() {
    }
}

Message is "Interceptor for lifecycle callbacks may only declare interceptor binding types that are defined as @Target(TYPE)".

But MyInterceptor is not a lifecycle callback interceptor, and doesn't apply to the init() method as it doesn't have a @PostConstruct method. 

The error message is correct for lifecycle interceptors, but @AroundInvoke interceptors are allowed to have @Target({TYPE, METHOD}).
Comment 1 Petr Hejl 2015-06-11 14:50:33 UTC
*** Bug 242610 has been marked as a duplicate of this bug. ***
Comment 2 Petr Hejl 2015-06-12 14:45:09 UTC
Fixed in web-main 3c8ffefdd7ea.
Comment 3 Quality Engineering 2015-06-14 04:49:30 UTC
Integrated into 'main-silver', will be available in build *201506140001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/3c8ffefdd7ea
User: Petr Hejl <phejl@netbeans.org>
Log: #238882 - @AroundInvoke interceptor bindings with @Target({TYPE, METHOD}) shows as an error.