Monday, December 16, 2024

Re: Possible to have super sources in a common package in a library?

You only have to super-source something in GWT if the Java code is not compatible with GWT. That means if the Java code uses for example reflection or a class that GWT itself does not emulate. Super-source means you override a given Java class with different source code that is compatible with GWT compiler. So basically super sourcing is what GWT itself does to let you use all the (super sourced / emulated) Java classes from the Java SDK. For example java.util.Date in Java SDK uses Java Calendar and TimeZone but the super sourced version of it in GWT delegates to the native JavaScript Date provided by browsers. So the implementation of the API is very different.

If you have a 3rd party library and you are using some classes of it then you should first check if the source code of these classes is actually GWT compatible. If it is compatible (no reflection, no usage of classes that GWT does not emulate) then you only need the 3rd party library and  3rd party library sources as "compile" dependency. In your own code you create a /com/jme3/math/Jme3Math.gwt.xml file and add <source path="."/>. This would make everything below com.jme3.math package visible to GWT compiler once you inherit that GWT module. If you only want to include certain classes of that library you can use include/exclude patterns as well. Alternatively you can create your own Jme3Math-gwt project/module (in a multi-module build setup) with just the *.gwt.xml file and the correct classes+sources dependencies and then you use that project as a dependency. 

If you really have to super source the Vector3f class then you pretty much do the same as above but instead of <super-source> and provide a GWT compiler compatible implementation of Vector3f.

--- J.

Neil Aggarwal schrieb am Sonntag, 15. Dezember 2024 um 22:35:58 UTC+1:
Hello all:

I am using references to some external libraries in my data classes.

For example, the base class for my puzzle objects is
com.propfinancing.puzzle.Puzzle

I created a module for it by creating a Puzzle.gwt.xml
file in the same directory as its source code.

The entire com.propfinancing hierarchy is packaged into
two jars, one with the compiled code and another with the
sources.

I am using those jars in a different project so I put an
<inherits name="com.propfinancing.puzzle.Puzzle"/>
in that project's gwt.xml file.

One of the classes in that library is com.propfinancing.puzzle.Point
which is referenced by a subclass of com.propfinancing.puzzle.Puzzle.
It uses a class com.jme3.math.Vector3f which is from an external library.
I don't control that library and they did not package it for GWT.

So, I want to create a super source version of Vector3f for GWT.
I can create it in
com.propfinancing.puzzle.superSource.com.jme3.math.Vector3f
and put <super-source path="superSource"/> in the Puzzle.gwt.xml file.

But that is specific to the Puzzle.gwt.xml module. I can imagine in the
future
that I might have another module which references Vector3f and then I will
have to create a separate Vector3f file for it.

I think it would be better to create one file as
com.propfinancing.gwt.superSource.com.jme3.math.Vector3f
which I can then use in multiple modules.

This looks like it currently falls outside the scope of GWT.
Is that correct?

Thank you,
Neil

--
Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
We offer 30 year loans on single family houses!

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-web-toolkit/2587dcf3-fa36-4ab0-a0ea-6a6ee9750b37n%40googlegroups.com.

No comments:

Post a Comment