Bug 429877 - JSON JAXB marshalling issue with generic map adapters
Summary: JSON JAXB marshalling issue with generic map adapters
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-07 08:37 EST by Gunnar Wagenknecht CLA
Modified: 2022-06-09 10:06 EDT (History)
0 users

See Also:


Attachments
Maven project containing JUnit test to replicate the issue. (8.88 KB, application/zip)
2014-03-07 08:37 EST, Gunnar Wagenknecht CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gunnar Wagenknecht CLA 2014-03-07 08:37:37 EST
Created attachment 240648 [details]
Maven project containing JUnit test to replicate the issue.

Please have a look at the attached project containing the MoxyIssue1 test. It's a maven project which replicates some of the issues I'm seeing with marshalling maps to JSON using the approach document here:
http://blog.bdoughan.com/2013/06/moxys-xmlvariablenode-using-maps-key-as.html

I tried developing a generic map adapter because I have multiple maps that I'd like to serialize to JSON. However, the generic adapter always fails with IllegalArgumentException: Can not set java.lang.String field abc to ...MapToListAdapter$AdaptedMap

Here is what I've tried:
- Using sub-classes of a generic adapter (A.java)
- Using the same generic adapter twice (B.java)

The only thing which works is:
- Using a non-generic version (AAdapter.java in RootObj.java)

However, if I create a second non-generic version (which really duplicates a lot of code), it fails again (see RootObj2.java).

All tests are collected in MoxyIssue1.java.

(Note, the maven project uses Moxy 2.5.2. But it also fails with Moxy 2.6.0 nighty from end of February.)
Comment 1 Eclipse Webmaster CLA 2022-06-09 10:06:17 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink