where is com.smartfoxserver.grid package?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Boorik
Posts: 14
Joined: 02 Dec 2014, 15:01
Contact:

where is com.smartfoxserver.grid package?

Postby Boorik » 20 Nov 2017, 17:37

Hi,

I compile server side code with haxe. I'm facing an issue where compiler doesn't find any of the com.smartfoxserver.grid package files. In most of the cases I just have to add the matching jar file as dependency. But I can't find in what jar file is this package.
Can you help me on this?

Best regards
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: where is com.smartfoxserver.grid package?

Postby Lapo » 20 Nov 2017, 17:58

Hi,
does Haxe compile into Java? Cool, I didn't know :)

Can you tell me exactly what SFS2X version are you using? Also what is exactly the class(es) that are not found?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
Boorik
Posts: 14
Joined: 02 Dec 2014, 15:01
Contact:

Re: where is com.smartfoxserver.grid package?

Postby Boorik » 22 Nov 2017, 08:20

Hi!

I use sfs2x 2.13

In haxe compilation we can add command like :
-java-lib whatever.jar
It creates extern definitions of classes and look recursively for dependencies.

The class it doesn't find :
Type not found : com.smartfoxserver.grid.events.IGridEvent
and everything in the grid package. I don't know why. Maybe the classes are protected or are located in another jar file.
When I look at the javadoc I don't find a definition for these classes.

Is there a definition somewhere?

Thanks
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: where is com.smartfoxserver.grid package?

Postby Lapo » 22 Nov 2017, 09:11

Sorry, those classes are not included in SFS2X because they are not used by the server.

You may "fool" the compiler by creating a jar with that package an interface inside it.
The interface could be defined like this:

Code: Select all

public interface IGridEvent
{
   String getName();
   ISFSObject getParams();
}


Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
Boorik
Posts: 14
Joined: 02 Dec 2014, 15:01
Contact:

Re: where is com.smartfoxserver.grid package?

Postby Boorik » 22 Nov 2017, 11:42

Ok thank you,

I solved it by stopping the compiler earlier :
getGridManager return a com.smartfoxserver.v2.grid.IGridManager
so the compiler go to this direction and stuck on missing definitions.
I made a handmade extern that solve the issue, changing the IGridManager to Dynamic prevent the compiler to go further.
https://github.com/boorik/smartfox-haxe-server/blob/master/com/smartfoxserver/v2/SmartFoxServer.hx#L9

I wonder how the java compiler handle this lack of definition.

Best regards.
Boorik
Posts: 14
Joined: 02 Dec 2014, 15:01
Contact:

Re: where is com.smartfoxserver.grid package?

Postby Boorik » 22 Nov 2017, 14:32

I mean how are you able to compile an extension the "normal" way just using sfs2x and sfs2x-core jars without the same exception?

Haxe compiler generate .java files and then do :
javac "-sourcepath" "src" "-d" "obj" "-g" "-classpath" "./lib/sfs2x.jar:./lib/sfs2x-core.jar:./lib/slf4j-api-1.7.5.jar:./lib/geoip2-2.8.0.jar:./lib/mailapi.jar" "@cmd"

That seems to be like "normal" way but generate errors without using my extern fix.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: where is com.smartfoxserver.grid package?

Postby Lapo » 22 Nov 2017, 16:31

Boorik wrote:I mean how are you able to compile an extension the "normal" way just using sfs2x and sfs2x-core jars without the same exception?

Haxe compiler generate .java files and then do :
javac "-sourcepath" "src" "-d" "obj" "-g" "-classpath" "./lib/sfs2x.jar:./lib/sfs2x-core.jar:./lib/slf4j-api-1.7.5.jar:./lib/geoip2-2.8.0.jar:./lib/mailapi.jar" "@cmd"

That seems to be like "normal" way but generate errors without using my extern fix.

Hi,
the java compiler looks for classes that are referenced in your code. Other than that it won't complain.

For instance, I am not sure why you need to reference the "geopip" jar ... unless you're importing some of those classes directly in code?
For extensions you typically just need to tartget "sfs2x" and "sfs2x-core"

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
Boorik
Posts: 14
Joined: 02 Dec 2014, 15:01
Contact:

Re: where is com.smartfoxserver.grid package?

Postby Boorik » 23 Nov 2017, 11:49

Ok,

The issue comes when haxe generate java classes. It's a pure haxe issue. That will be fixed in the future version.
Here is the related thread : https://github.com/HaxeFoundation/haxe/issues/3397
I will say when problem will be fixed. Meanwhile I will publish some externs that fix this issue.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: where is com.smartfoxserver.grid package?

Postby Lapo » 23 Nov 2017, 12:52

Thanks for the feedback. Good to know.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 59 guests