MatchExpression on server side not working

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

Moderators: Lapo, Bax

initfusion
Posts: 6
Joined: 11 Sep 2018, 11:22

MatchExpression on server side not working

Postby initfusion » 11 Sep 2018, 11:28

Hi,

I am trying to filter room list using MatchExpression but it throws an error

my code looks like this

Code: Select all

// Prepare match expression
 MatchExpression exp = new MatchExpression(RoomProperties.IS_GAME, BoolMatch.EQUALS, true).and
                                        (RoomProperties.HAS_FREE_PLAYER_SLOTS, BoolMatch.EQUALS, true).and
                                        ("isGameStarted", BoolMatch.EQUALS, false);
 
 // Search Rooms
 List<Rooms> joinableRooms = sfsApi.findRooms(zone.getRoomListFromGroup("chess"), exp, 0);



Exception

Code: Select all

java.lang.IllegalAccessError: tried to access class com.smartfoxserver.v2.entities.match.IMatcher from class com.company.game.common.ZoneExtension
   com.company.game.common.ZoneExtension.joinAnyLiveTableTeenPatti(ZoneExtension.kt:138)
   com.company.game.common.ZoneExtension.handleClientRequest(ZoneExtension.kt:127)
   com.smartfoxserver.v2.controllers.v290.ExtensionReqController.processRequest(ExtensionReqController.java:174)
   com.smartfoxserver.v2.controllers.v290.ExtensionReqController$1.run(ExtensionReqController.java:68)
   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   java.lang.Thread.run(Thread.java:745)


The class ZoneExtension is Zone level extension.
Please help me.

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

Re: MatchExpression on server side not working

Postby Lapo » 11 Sep 2018, 14:39

Hi,
your code looks fine, however this is quite strange.
I would expect your compiler to warn you about permission issues like that, instead you're receive a runtime error, which seems to indicate the code has bypassed the compiler.

I think there might be an issue with Kotlin, but I would have to test the scenario to better understand.

What version of SFS2X and kotlin are you using?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
initfusion
Posts: 6
Joined: 11 Sep 2018, 11:22

Re: MatchExpression on server side not working

Postby initfusion » 05 Oct 2018, 12:17

SmartFoxServer 2X (2.13.3)
Kotlin Version 1.2.60
initfusion
Posts: 6
Joined: 11 Sep 2018, 11:22

Re: MatchExpression on server side not working

Postby initfusion » 05 Oct 2018, 12:56

Hi Lapo.

Can you give me a temporary solution for filtering rooms until you solve this problem?

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

Re: MatchExpression on server side not working

Postby Lapo » 05 Oct 2018, 14:51

Hi,
we don't work with Kotlin that much. We can check if the problem is confirmed in Kotlin. However, if that's the case, I don't think we'll be able to do much as the Java code works fine and it looks like this is a problem created by Kotlin at byte code level.

We'll check with a Kotlin IDE and see what happens.
Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
initfusion
Posts: 6
Joined: 11 Sep 2018, 11:22

Re: MatchExpression on server side not working

Postby initfusion » 25 Oct 2018, 09:36

Hi,

Do you check with Kotlin?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: MatchExpression on server side not working

Postby Lapo » 25 Oct 2018, 14:18

Hi,
yes I was able to reproduce the error under Kotlin. Unfortunately there's not much we can do. This seems just a problem with Kotlin itself.

According to the Java doc the IllegalAccessError is caused by:
Thrown if an application attempts to access or modify a field, or to call a method that it does not have access to.
Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed.

It looks like the Kotlin compiler is messing things up, somehow.

Also, I am no Kotlin expert, so I can't help in troubleshooting this further.
Sorry.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 63 guests