[ 
https://issues.apache.org/jira/browse/CXF-5066?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Simon Gerber updated CXF-5066:
------------------------------

    Description: 
Consider an annotated interface and implementation as follows

{noformat}
@Path("example")
public interface Example {
     
    @GET
    ExampleResponse get();
}

public class ExampleImpl implements Example {

    @Override
    public ExampleResponse get() { // ... }
}
{noformat}

In the above example CXF will reject this resource 
ResourceUtils.createClassResourceInfo() fails to find any dispatcher methods. 

The reason for this is that AnnotationUtils.doGetAnnotatedMethod() returns the 
concrete class method because it has an Override annotation on it. Therefore it 
does not find the method annotation.

The workaround is to remove the Override annotation - however since many IDEs 
(such as Eclipse) are configured to add this by default it could be considered 
a case where user expectations will not be met. This caveat was not documented 
anywhere and it required debugging into the CXF source code to isolate the 
issue.

  was:
Consider an annotated interface and implementation as follows

{noformat}
@Path("example")
public interface Example {
     
    @GET
    ExampleResponse get();
}

public class ExampleImpl {

    @Override
    public ExampleResponse get() { // ... }
}
{noformat}

In the above example CXF will reject this resource 
ResourceUtils.createClassResourceInfo() fails to find any dispatcher methods. 

The reason for this is that AnnotationUtils.doGetAnnotatedMethod() returns the 
concrete class method because it has an Override annotation on it. Therefore it 
does not find the method annotation.

The workaround is to remove the Override annotation - however since many IDEs 
(such as Eclipse) are configured to add this by default it could be considered 
a case where user expectations will not be met. This caveat was not documented 
anywhere and it required debugging into the CXF source code to isolate the 
issue.

    
> Annotation inheritance does not work if a non JAX-RS annotation is present on 
> an implementation method
> ------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-5066
>                 URL: https://issues.apache.org/jira/browse/CXF-5066
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.7.5
>            Reporter: Simon Gerber
>            Priority: Minor
>
> Consider an annotated interface and implementation as follows
> {noformat}
> @Path("example")
> public interface Example {
>      
>     @GET
>     ExampleResponse get();
> }
> public class ExampleImpl implements Example {
>     @Override
>     public ExampleResponse get() { // ... }
> }
> {noformat}
> In the above example CXF will reject this resource 
> ResourceUtils.createClassResourceInfo() fails to find any dispatcher methods. 
> The reason for this is that AnnotationUtils.doGetAnnotatedMethod() returns 
> the concrete class method because it has an Override annotation on it. 
> Therefore it does not find the method annotation.
> The workaround is to remove the Override annotation - however since many IDEs 
> (such as Eclipse) are configured to add this by default it could be 
> considered a case where user expectations will not be met. This caveat was 
> not documented anywhere and it required debugging into the CXF source code to 
> isolate the issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to