How "exclude attribute" can resolve "No source code is available" issue?

63 views
Skip to first unread message

Richard

unread,
Sep 22, 2011, 10:38:50 AM9/22/11
to Google Web Toolkit
Hi,

I have model classes shared by server side and client side, so I can
not remove JAXB, JPA etc annotations and class.

By either including source code (in an extra jar) or binary jar file
has compiled class files, the "No source code is available" issue can
be resolved for *most* of classes like "javax.persistence.Entity" or
"javax.xml.bind.annotation.XmlElement". But there are some classes
like "javax.xml.bind.annotation.adapters.XmlAdapter",
"javax.xml.bind.Unmarshaller" still cause trouble.

I had a workaround by including source code of "XmlAdapter" and a fake
*empty* file of "Unmarshaller" (using empty file due to Unmarshaller
is too complex and it refers to *a lot* of other classes) in the GWT
project directly. But this is kind of hack.

My question is is there any *proper* way to resolve this issue?

It seem "exclude attribute" is one of the solutions from the following
link:

"...You can fix your issue by excluding CollapsedStringAdapter from
being considered by the GWT compiler.
Use the exclude attribute on the source element in you GWT module
file..."

http://code.google.com/p/google-web-toolkit/issues/detail?id=4020

But I could not make it work. Is there more information or example?

Thanks,
Richard

Thomas Broyer

unread,
Sep 22, 2011, 12:19:24 PM9/22/11
to google-we...@googlegroups.com
See http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuidePathFiltering (and there was examples linked from the issue; AntLR.gwt.xml for instance)

Richard

unread,
Sep 22, 2011, 6:38:36 PM9/22/11
to Google Web Toolkit
Thanks for the reply.

I read the link but still do not get it.

Does "exclude attribute" exclude files match the pattern or exclude
the file from the compile list? What I want is to tell gwtc to
*ignore* XmlAdapter or Unmarshaller even they are referenced in the
code.

BTW, I could not find the examples you mentioned linked from the
issue.

Thanks,
Richard

On Sep 22, 12:19 pm, Thomas Broyer <t.bro...@gmail.com> wrote:
> Seehttp://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjec...(and

Thomas Broyer

unread,
Sep 23, 2011, 4:05:12 AM9/23/11
to google-we...@googlegroups.com


On Friday, September 23, 2011 12:38:36 AM UTC+2, Richard wrote:
Thanks for the reply.

I read the link but still do not get it.

Does "exclude attribute" exclude files match the pattern or exclude
the file from the compile list? What I want is to tell gwtc to
*ignore* XmlAdapter or Unmarshaller even they are referenced in the
code.

That won't work.

But you can provide an "emulated" version that is a no-op. See “Overriding one package implementation with another” in http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html
 

BTW, I could not find the examples you mentioned linked from the
issue.

Thanks,
Richard

Alexandre Dupriez

unread,
Sep 23, 2011, 6:51:32 AM9/23/11
to Google Web Toolkit
You cannot exclude XmlAdapter or Unmarshaller if they are transitively
refereed to in your client code (ie, if a class in your client code
depends on it), since, as you might guess, every classes in your graph
hierarchy must be translatable in JavaScript on client side.

However, to ignore a class which is not refereed to in your code, you
can just write for instance

<source path="client">
<exclude name="ObjectFactory.java"/>
</source>

Alexandre

Richard

unread,
Sep 23, 2011, 1:09:22 PM9/23/11
to Google Web Toolkit
Yes, that is my workaround. :-) But it is a hack, we want to have a
*proper* way to fix it.

On Sep 23, 4:05 am, Thomas Broyer <t.bro...@gmail.com> wrote:
> On Friday, September 23, 2011 12:38:36 AM UTC+2, Richard wrote:
>
> > Thanks for the reply.
>
> > I read the link but still do not get it.
>
> > Does "exclude attribute" exclude files match the pattern or exclude
> > the file from the compile list? What I want is to tell gwtc to
> > *ignore* XmlAdapter or Unmarshaller even they are referenced in the
> > code.
>
> That won't work.
>
> But you can provide an "emulated" version that is a no-op. See “Overriding
> one package implementation with another” inhttp://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjec...

Richard

unread,
Sep 23, 2011, 1:18:06 PM9/23/11
to Google Web Toolkit
Could you clarify your example?

For example,

Let's say I have "com.test.gwt_client.Client.java" which refers
"javax.xml.bind.Unmarshaller", but Unmarshaller is *NOT* really used -
it only exists in method signature.

What does XML look like?

<source path="bind">
  <exclude name="Unmarshaller.java"/>
</source>

or

<source path="gwt_client">
  <exclude name="Client.java"/>
</source>

or something else?

Thanks,
Richard

On Sep 23, 6:51 am, Alexandre Dupriez <alexandre.dupr...@gmail.com>
wrote:

Alexandre Dupriez

unread,
Sep 23, 2011, 3:54:00 PM9/23/11
to Google Web Toolkit
See my last answer. If the class is in your method signature, and thus
your code contains a reference to it, you cannot get rid of the class
with an "exclude".

This directive works only if you want to ignore classes which are on
the path of the client side of the application (ie translated in JS)
but not referred to in other classes of the client side.

Alexandre.

Richard

unread,
Sep 23, 2011, 4:36:34 PM9/23/11
to Google Web Toolkit
Got it. Thanks very much!

On Sep 23, 3:54 pm, Alexandre Dupriez <alexandre.dupr...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages