Generator - The import com.google.gwt.core.ext cannot be resolved

524 views
Skip to first unread message

dominik_steiner

unread,
Dec 4, 2006, 3:46:32 AM12/4/06
to Google Web Toolkit
Hi there,

I already have this error for quite a while and asked the forum a few
times, till now it remains unresolved, so I'll have another try. When I
compile my source I get following error:

[gwtcompile] Compiling com.bar.Foo
[gwtcompile] Analyzing source in module 'com.bar.Foo'
[gwtcompile] [ERROR] Errors in
'C:\workspace\foo\src\com\bar\foo\client\rebind\ProxyGenerator.java'
[gwtcompile] [ERROR] Line 3: The import java.io.PrintWriter cannot be
resolved
[gwtcompile] [ERROR] Line 5: The import com.google.gwt.core.ext cannot
be resolved
[gwtcompile] [ERROR] Line 6: The import com.google.gwt.core.ext cannot
be resolved
[gwtcompile] [ERROR] Line 7: The import com.google.gwt.core.ext cannot
be resolved
[gwtcompile] [ERROR] Line 8: The import com.google.gwt.core.ext cannot
be resolved
[gwtcompile] [ERROR] Line 9: The import com.google.gwt.core.ext cannot
be resolved
[gwtcompile] [ERROR] Line 10: The import com.google.gwt.core.ext
cannot be resolved
[gwtcompile] [ERROR] Line 11: The import com.google.gwt.core.ext
cannot be resolved
[gwtcompile] [ERROR] Line 12: The import com.google.gwt.user.rebind
cannot be resolved
[gwtcompile] [ERROR] Line 13: The import com.google.gwt.user.rebind
cannot be resolved
[gwtcompile] [ERROR] Line 15: Generator cannot be resolved to a type
[gwtcompile] [ERROR] Line 16: TreeLogger cannot be resolved to a type
[gwtcompile] [ERROR] Line 16: GeneratorContext cannot be resolved to a
type
[gwtcompile] [ERROR] Line 17: UnableToCompleteException cannot be
resolved to a type
[gwtcompile] [ERROR] Line 19: TypeOracle cannot be resolved to a type
[gwtcompile] [ERROR] Line 20: JClassType cannot be resolved to a type
[gwtcompile] [ERROR] Line 27: SourceWriter cannot be resolved to a
type
[gwtcompile] [ERROR] Line 33: NotFoundException cannot be resolved to
a type
[gwtcompile] [ERROR] Line 34: TreeLogger cannot be resolved
[gwtcompile] [ERROR] Line 35: e cannot be resolved
[gwtcompile] [ERROR] Line 36: UnableToCompleteException cannot be
resolved to a type
[gwtcompile] [ERROR] Line 40: SourceWriter cannot be resolved to a
type
[gwtcompile] [ERROR] Line 40: TreeLogger cannot be resolved to a type
[gwtcompile] [ERROR] Line 41: GeneratorContext cannot be resolved to a
type
[gwtcompile] [ERROR] Line 43: PrintWriter cannot be resolved to a type
[gwtcompile] [ERROR] Line 47: ClassSourceFileComposerFactory cannot be
resolved to a type
[gwtcompile] [ERROR] Line 47: ClassSourceFileComposerFactory cannot be
resolved to a type
[gwtcompile] [ERROR] Line 54: SourceWriter cannot be resolved to a
type

The weird thing is that my ProxyGenerator works nonetheless. In my
classpath I have gwt-dev-windows.jar included, where obviously the
classes and the sources of the package com.google.gwt.core.ext are.

In my *gwt.xml file I have

<inherits name='com.google.gwt.user.User'/>
<inherits name="com.google.gwt.i18n.I18N"/>
<inherits name="com.google.gwt.core.Core"/>

I'm not sure if i need to inherit the Core module explicitly, as the
User.gwt.xml already inherits it.
So I'm wondering why the compiler is complaining? If I look into other
Generators, eg in the i18n module, there's even not an inherit of the
Core module, and it evidently works.

I suppose that I perhaps have to add a
<source path="path"/> to the com.google.gwt.core.ext, but I have no
idea how to do that and if this is the way to go.

Have some of you already successfully used generators without having a
complaining compiler?

Thanks for any hints.

Dominik

Mat Gessel

unread,
Dec 4, 2006, 5:51:29 PM12/4/06
to Google-We...@googlegroups.com
The way I read this error is: GWTCompiler cannot compile your
generator because your generator depends on classes which are not
available in the GWT emulated library.

Note that you can put any number of non-compiling classes in your
client source path and the application will still compile
successfully. GWTCompiler will log an error for each problem it
encounters, but compilation will succeed if the compiler can process
all the classes on which the entry point depends.

So, to answer your question explicitly: your generator should not be
in the client source path.

-= Mat

P.S. as I understand it, the compiled generator class file just needs
to be in the java classpath when launching GWTCompiler. Perhaps this
is why ApplicationCreator includes the "/bin" directory in the
classpath of the compile script it creates.

--
Mat Gessel
http://www.asquare.net

mP

unread,
Dec 4, 2006, 7:32:51 PM12/4/06
to Google Web Toolkit
This is prolly a dumb question but if one just wants to
serialize/deserialize an vanilla object way not just left the default
mechanism kick in ? I can understand wanting to do something different
like what happens within i18n related classes, but in other cases i am
unsure.

I was just wondering what is your use case ?

dominik_steiner

unread,
Dec 5, 2006, 3:01:07 AM12/5/06
to Google Web Toolkit
Thanks Mat and mP for your responses,

one problem less in my world at least!!!

You were right Mat, the Generator class didn't have to be under the
client package.

I moved it to com.foo.rebind instead of com.foo.client.rebind and the
compiler didn't complain any more.

But the class for whom the Generator is checking has to be under the
client package. So in my gwt.xml I have following rule

<generate-with class="com.foo.rebind.ProxyGenerator">
<when-type-assignable class="com.foo.client.HelloWorld"/>
</generate-with>

Right now it's only wrapping a class to implement toString() in putting
out HelloWorld, from class <class name> as found in one of the threads
written by claude.

I'm wondering if someone already is using custom generators in doing
some cool stuff?

Thanks again for your help... :-)

Dominik

Reply all
Reply to author
Forward
0 new messages