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

Evaristo Wychoski Benfatti updated CXF-7545:
--------------------------------------------
    Description: 
When we have the following scenario, the the wadl is not properly generated.

{code:java}
public abstract class BaseEntity { ... }
public class Entity extends BaseEntity { ... }

public abstract class SuperResource<T extends BaseEntity>
{
    @POST
    @Path("/method")
    public T resourceMethod(T param){ ... }
}

@Path("/resource")
public class ChildResource extends SuperResource<Entity> { ... }
{code}

The generation to ChildResource only exposes the methods to `BaseEntity` 
instead of exposing correctly the specialized type `Entity`.

This problem occurs on 
`rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java`
 file when it evaluates generic types. The solution is considering the 
TypeVariable to specialized types as follow:

{code:java}
                // Line 1047 instead of this
-                if (theActualType == Object.class && !(genericType instanceof 
Class)) {
                 // using the following lines
+                if ((theActualType == Object.class && !(genericType instanceof 
Class))
+                                       || (genericType instanceof 
TypeVariable)) {
{code}



  was:
When we have the following scenario, the process to generate the wadl is not 
properly generated.

{code:java}
public abstract class BaseEntity { ... }
public class Entity extends BaseEntity { ... }

public abstract class SuperResource<T extends BaseEntity>
{
    @POST
    @Path("/method")
    public T resourceMethod(T param){ ... }
}

@Path("/resource")
public class ChildResource extends SuperResource<Entity> { ... }
{code}

The generation to ChildResource only exposes the methods to `BaseEntity` 
instead of exposing correctly the specialized type `Entity`.

This problem occurs on 
`rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java`
 file when it evaluates generic types. The solution is considering the 
TypeVariable to specialized types as follow:

{code:java}
                // Line 1047 instead of this
-                if (theActualType == Object.class && !(genericType instanceof 
Class)) {
                 // using the following lines
+                if ((theActualType == Object.class && !(genericType instanceof 
Class))
+                                       || (genericType instanceof 
TypeVariable)) {
{code}




> Problem to generate WADL when a implementattion of generic type is used
> -----------------------------------------------------------------------
>
>                 Key: CXF-7545
>                 URL: https://issues.apache.org/jira/browse/CXF-7545
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.9, 3.2.0
>         Environment: All plataforms
>            Reporter: Evaristo Wychoski Benfatti
>            Priority: Minor
>              Labels: patch
>             Fix For: 3.2.0
>
>
> When we have the following scenario, the the wadl is not properly generated.
> {code:java}
> public abstract class BaseEntity { ... }
> public class Entity extends BaseEntity { ... }
> public abstract class SuperResource<T extends BaseEntity>
> {
>     @POST
>     @Path("/method")
>     public T resourceMethod(T param){ ... }
> }
> @Path("/resource")
> public class ChildResource extends SuperResource<Entity> { ... }
> {code}
> The generation to ChildResource only exposes the methods to `BaseEntity` 
> instead of exposing correctly the specialized type `Entity`.
> This problem occurs on 
> `rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java`
>  file when it evaluates generic types. The solution is considering the 
> TypeVariable to specialized types as follow:
> {code:java}
>                 // Line 1047 instead of this
> -                if (theActualType == Object.class && !(genericType 
> instanceof Class)) {
>                  // using the following lines
> +                if ((theActualType == Object.class && !(genericType 
> instanceof Class))
> +                                     || (genericType instanceof 
> TypeVariable)) {
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to