juneau-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Bognar (JIRA)" <j...@apache.org>
Subject [jira] [Created] (JUNEAU-131) REST annotations need type() annotation.
Date Sun, 18 Aug 2019 18:41:00 GMT
James Bognar created JUNEAU-131:

             Summary: REST annotations need type() annotation.
                 Key: JUNEAU-131
                 URL: https://issues.apache.org/jira/browse/JUNEAU-131
             Project: Juneau
          Issue Type: Task
          Components: Code
    Affects Versions: 8.1.0
            Reporter: James Bognar

Because Spring uses CGLIB which recompiles classes at runtime (ugh), and since CGLIB was written
before Java annotations were around and is an unsupported library (ugh #2), if you expose
the following REST method as a Spring bean, the generics information in the following information
get stripped and we can no longer determine that we should parse a list of beans:
{{public void postFoo(@Body List<MyBean> beans) \{...}}}

The behavior is that we'll end up creating a list of ObjectMaps which will almost always result
in a ClassCastException when you try to interact with the list.

To help alleviate this issue, we can introduce an annotation to explicitly specify the parsed

{{public void postFoo(@Body(type=\{List.class,MyBean.class}) List<MyBean> beans) \{...}}}

This message was sent by Atlassian JIRA

View raw message