I'm still having trouble getting super-source to work. Right now, I'm
trying to come up with the simplest, most reduced example that uses
super-source, because the more complicated examples I have been
working from have failed to work. To this end, I have started with an
empty workspace, and created a new example GWT project. I then created
a new GWT Java project, created a new source folder src/gwt, and
created a new package java.io. In the package, I created
OutputStreamReader.java. To keep things as simple as possible, I
actually copy-pasted the minimal source code from the GWT
implementation:
I created a minimal, top-level module in src/gwt called
TestSuper.gwt.xml, which contains only a single empty super-source
tag. Finally, I added the super-source project to the example
project's build path, and added a line to the example project module
to inherit the super-source project's module.
To recap, my projects have the following structure:
test/
src/
foo.bar.test/
Test.gwt.xml
foo.bar.test.client/
foo.bar.test.server/
testsuper/
src/gwt/
TestSuper.gwt.xml
java.io/
OutputStream.java
When I try to run the example project in hosted mode, I get about 300
lines of errors. Here are the first few:
[ERROR] Errors in
'jar:file:/home/jacob/apps/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.linux_1.6.4.v200904062334/gwt-linux-1.6.4/gwt-dev-linux.jar!/com/google/gwt/dev/jjs/impl/Pruner.java'
[ERROR] Line 1041: The method subList(int, int) is undefined
for the type List<JExpression>
[ERROR] Errors in
'jar:file:/home/jacob/apps/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.linux_1.6.4.v200904062334/gwt-linux-1.6.4/gwt-user.jar!/com/google/gwt/junit/JUnitShell.java'
[ERROR] Line 42: The import junit cannot be resolved
[ERROR] Line 42: The import junit cannot be resolved
[ERROR] Line 44: The import junit cannot be resolved
[ERROR] Line 49: The import java.util.regex cannot be resolved
[ERROR] Line 50: The import java.util.regex cannot be resolved
[ERROR] Line 92: TestCase cannot be resolved to a type
[ERROR] Line 288: The type JUnitShell.JUnitStrategy must
implement the inherited abstract method
JUnitShell.Strategy.processResult(TestCase, JUnitResult)
[ERROR] Line 297: TestCase cannot be resolved to a type
[ERROR] Line 344: TestCase cannot be resolved to a type
...
[ERROR] Errors in
'jar:file:/home/jacob/apps/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.linux_1.6.4.v200904062334/gwt-linux-1.6.4/gwt-dev-linux.jar!/com/google/gwt/dev/ApplicationCreator.java'
[ERROR] Line 27: The method exit(int) is undefined for the type System
And it continues like. All errors originate in the GWT SDK.
When I attempt to compile it, I get a lot of warnings, and finally a NPE.
[WARN]
jar:file:/home/jacob/apps/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.linux_1.6.4.v200904062334/gwt-linux-1.6.4/gwt-user.jar!/com/google/gwt/event/dom/client/DomEvent.java
[WARN] Compilation unit
'jar:file:/home/jacob/apps/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.linux_1.6.4.v200904062334/gwt-linux-1.6.4/gwt-user.jar!/com/google/gwt/event/dom/client/HasMouseOutHandlers.java'
is removed due to invalid reference(s):
[WARN]
jar:file:/home/jacob/apps/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.linux_1.6.4.v200904062334/gwt-linux-1.6.4/gwt-user.jar!/com/google/gwt/event/shared/HasHandlers.java
[WARN] Compilation unit
'jar:file:/home/jacob/apps/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.linux_1.6.4.v200904062334/gwt-linux-1.6.4/gwt-user.jar!/com/google/gwt/i18n/client/impl/plurals/DefaultRule_ln.java'
is removed due to invalid reference(s):
[WARN]
jar:file:/home/jacob/apps/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.linux_1.6.4.v200904062334/gwt-linux-1.6.4/gwt-user.jar!/com/google/gwt/i18n/client/PluralRule.java
[WARN] Compilation unit
'jar:file:/home/jacob/apps/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.linux_1.6.4.v200904062334/gwt-linux-1.6.4/gwt-user.jar!/com/google/gwt/i18n/client/impl/plurals/DefaultRule_en.java'
is removed due to invalid reference(s):
[WARN]
jar:file:/home/jacob/apps/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.linux_1.6.4.v200904062334/gwt-linux-1.6.4/gwt-user.jar!/com/google/gwt/i18n/client/PluralRule.java
...
Refreshing TypeOracle
Processing types in compilation unit:
jar:file:/home/jacob/apps/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.linux_1.6.4.v200904062334/gwt-linux-1.6.4/gwt-dev-linux.jar!/com/google/gwt/dev/js/ast/JsSourceInfo.java
Found type 'JsSourceInfo'
[WARN] Unable to resolve type: java.lang.Object
binding: org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding
[ERROR] Unexpected
java.lang.NullPointerException
at com.google.gwt.core.ext.typeinfo.JRealClassType.setSuperclass(JRealClassType.java:402)
at com.google.gwt.dev.javac.TypeOracleMediator.resolveTypeDeclaration(TypeOracleMediator.java:1407)
at com.google.gwt.dev.javac.TypeOracleMediator.addNewUnits(TypeOracleMediator.java:389)
at com.google.gwt.dev.javac.TypeOracleMediator.refresh(TypeOracleMediator.java:417)
at com.google.gwt.dev.javac.CompilationState.refresh(CompilationState.java:179)
at com.google.gwt.dev.javac.CompilationState.<init>(CompilationState.java:93)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:264)
at com.google.gwt.dev.Precompile.precompile(Precompile.java:283)
at com.google.gwt.dev.Compiler.run(Compiler.java:170)
at com.google.gwt.dev.Compiler$1.run(Compiler.java:124)
at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:84)
at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:78)
at com.google.gwt.dev.Compiler.main(Compiler.java:131)
It is clear that my understanding of super-source is still
insufficient to construct even a reduced sample. Could anyone tell me
what it is I am doing that is causing my reduced example to fail to
compile?
Please let me know. Thanks,
Jake
Thanks again for the responses. See my replies below:
On Fri, May 15, 2009 at 5:51 AM, Thomas Broyer <t.br...@gmail.com> wrote:
>
>
>
> On 15 mai, 03:06, Alyxandor <a.revolution.ultra.b...@gmail.com> wrote:
>> Are you getting a "wrong package error"? Because if you aren't, you
>> should!
>
> Actually, I'd rather say you shouldn't add your "super" to the
> projects build path (no need to compile the classes to Java .class,
> with the risk of having them used in place of the Java runtime's ones;
> only the source is needed, and only for the GWT Compiler, so what's
> needed is that the "super" is in the classpath, not the build path!)
OK, that's very interesting! The distinction between the classpath and
the build path was not something that was clear to me before. Now, I
believe it is, but I'm not sure, how do you add a path to the
classpath without adding it to the build path in Eclipse? The GWT
module still needs to be found on the classpath. I took a look at the
.classpath from gwt-in-the-air:
It doesn't appear to reference super. Is this because .classpath sets
the project build path in Eclipse? How do you then set the classpath
so that the Emulation.gwt.xml module is finable, but not on the build
path?
> (however, adding it to the build path in Eclipse brings you better
> editing, with better code completion, etc.)
>
> Finally, it's more a matter of taste than a "rule" or even "best
> practice"; but you have to understand what it means when you add the
> "super" to the build path or not.
I still don't have a clear sense of this. What would you say it means
to add "super" to the build path?
>
>> Also, you've got to make your java.io hack-pack-age another level
>> deeper...
>
> Not necessarily. GWT's Emul package uses <super-source/>, and so do I
> in GWT-in-the-AIR (cf. http://code.google.com/p/gwt-in-the-air/source/browse/trunk/super/net/ltgt/gwt/air/emul/
> )
I still can't seem to get that to work :(
Not sure why, but my use of the empty <super-source/> tag always
causes GWT to fail. This is unfortunate, as it seems like it would be
the best way to make both GWT and the IDE happy. So, for example, with
gwt-in-the-air, my approach would have been to add
/super/net/ltgt/gwt/air/emul/ as a source folder (so, on the build
path). Then the emulated packages would be of the form java.*, which
would correspond to the declared package names in the *.java files.
This makes the IDE happy, and in my mind, it seems like GWT shouldn't
have a problem with it either. But, so far, this approach has always
failed for me, and I cannot see the reason for this, or where the
problem is originating. If someone can see it, and could point it out
to me, I would be extremely grateful.
Also, maybe if, as Thomas suggested, super wasn't on the build path,
then GWT won't freak out. But then, as Thomas said, you don't get the
IDE's help with these classes. I'll have to try this and see if it
makes a difference, but I'd really like to understand why the above
approach is failing.
Thanks,
Jake