Serialization of subclasses

21 views
Skip to first unread message

Ahmed

unread,
Jun 22, 2010, 10:53:33 AM6/22/10
to GWT-Ent Developer Forum
Hi,
I have a parent class that is

@Reflectable(assignableClasses = true)
class A {}

and I have an anonymous child class that I am trying to serialize into
json like this:

A a = new A()
{
{
// ....
}
}

Now, when I try to serialize the child, I get a
ReflectionRequiredException for the anonymous class. Does the library
support this scenario?

James Luo

unread,
Jun 22, 2010, 9:05:36 PM6/22/10
to gwt...@googlegroups.com
Hi, Ahmed

  I checked whole process, actually GWT didn't give me any information about this anonymous class.

  In this case, which reflection information you want to be returned? The Class A, or the anonymous class?

  Or other question. Are there any added field in anonymous class and you want serialize into JSON?

James


--
You received this message because you are subscribed to the Google Groups "GWT-Ent Developer Forum" group.
To post to this group, send email to gwt...@googlegroups.com.
To unsubscribe from this group, send email to gwt-ent+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gwt-ent?hl=en.




--
Regards
James Luo

Ahmed

unread,
Jun 23, 2010, 1:51:11 AM6/23/10
to GWT-Ent Developer Forum
Well, I have a little confession...

I only use java on daily basis in GWT, no desktop or server java at
all...
So, when I first started with gwt about a year ago, I thought that the
sub class declaration using the {{ }} are just a special syntax to
set the values of the class, I didn't know I was declaring a
subclass!!!
And I only knew that fact yesterday!!!
After a quick search in my code base It turned out that I have about
400 subclass I didn't know I declared!!
And the reason I did't find out is that I was using a javascript
library for serialization...

Anyway, I thought instead of having to fix the 400 subclass It would
be great if I could tell the gwtent serialzer to serialize the parent
values and not throw the exception, I naturally didn't add anything in
the subclass...


all I need is to be able to send the subclass to the serializer and
get the values of the parent...

Is there a way to do that? Or should I begin fixing?
> > gwt-ent+u...@googlegroups.com<gwt-ent%2Bunsu...@googlegroups.com >
> > .

Ahmed

unread,
Jun 23, 2010, 3:04:38 AM6/23/10
to GWT-Ent Developer Forum
I have just checked out a new copy of the source, and it still fails
to compile throwing this exception:

Compilation failure

/home/ahmed/gwtent/gwt-ent-read-only/gwtent/src/main/java/com/gwtent/
aop/matcher/AspectJExpress.java:[280,22] matches(capture#552 of ?
super java.lang.Class<?>) in
com.gwtent.aop.matcher.Matcher<capture#552 of ? super java.lang.Class<?
>> cannot be applied to (java.lang.Class)

/home/ahmed/gwtent/gwt-ent-read-only/gwtent/src/main/java/com/gwtent/
aop/matcher/AspectJExpress.java:[285,22] matches(capture#398 of ?
super java.lang.Class<?>) in
com.gwtent.aop.matcher.Matcher<capture#398 of ? super java.lang.Class<?
>> cannot be applied to (java.lang.Class)

Do you face this error? or is it something wrong in my setup?

James Luo

unread,
Jun 23, 2010, 3:10:48 AM6/23/10
to gwt...@googlegroups.com
No, I didn't get it.

How about change your compiler version to Java 6?

About the anonymous issue, could you please put a issue in here : http://code.google.com/p/gwt-ent/issues/list

I will fix it.

Thanks.

--
You received this message because you are subscribed to the Google Groups "GWT-Ent Developer Forum" group.
To post to this group, send email to gwt...@googlegroups.com.
To unsubscribe from this group, send email to gwt-ent+u...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/gwt-ent?hl=en.




--
Regards
James Luo

Ahmed

unread,
Jun 23, 2010, 2:21:23 PM6/23/10
to GWT-Ent Developer Forum
Thanks a lot....

I am using the java 6 compiler and I still get the issue....
everything else maven took care of installing ...

Do you have any ideas?

Fred

unread,
Jul 7, 2010, 8:01:56 PM7/7/10
to GWT-Ent Developer Forum
I just checked out the code and am also getting almost the identical
error:

/home/fbrier/Projects/gwt-ent/gwtent/src/main/java/com/gwtent/aop/
matcher/AspectJExpress.java:[280,22] matches(capture#654 of ? super
java.lang.Class<?>) in com.gwtent.aop.matcher.Matcher<capture#654 of ?
super java.lang.Class<?>> cannot be applied to (java.lang.Class)

/home/fbrier/Projects/gwt-ent/gwtent/src/main/java/com/gwtent/aop/
matcher/AspectJExpress.java:[285,22] matches(capture#369 of ? super
java.lang.Class<?>) in com.gwtent.aop.matcher.Matcher<capture#369 of ?
super java.lang.Class<?>> cannot be applied to (java.lang.Class)

My platform and tools are:

Apache Maven 2.2.1 (r801777; 2009-08-06 15:16:01-0400)
Java version: 1.6.0_18
Java home: /usr/java/jdk1.6.0_18/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.30.10-105.2.23.fc11.x86_64" arch:
"amd64" Family: "unix"

James Luo

unread,
Jul 7, 2010, 8:22:15 PM7/7/10
to gwt...@googlegroups.com
I just made some change, Could you give it a try? Thanks.

--
You received this message because you are subscribed to the Google Groups "GWT-Ent Developer Forum" group.
To post to this group, send email to gwt...@googlegroups.com.
To unsubscribe from this group, send email to gwt-ent+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gwt-ent?hl=en.




--
Regards
James Luo

Fred

unread,
Jul 7, 2010, 9:52:34 PM7/7/10
to GWT-Ent Developer Forum
It fixed the aop package. The orm package is now getting "package
javax.persistence.spi does not exist" messages. Thank you.
> > gwt-ent+u...@googlegroups.com<gwt-ent%2Bunsu...@googlegroups.com >
> > .

James Luo

unread,
Jul 7, 2010, 10:12:00 PM7/7/10
to gwt...@googlegroups.com
Thanks, the orm not finish yet, if any error there that's normal. :)

To unsubscribe from this group, send email to gwt-ent+u...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/gwt-ent?hl=en.




--
Regards
James Luo
Reply all
Reply to author
Forward
0 new messages