code-disaster / steamworks4j

A thin Java wrapper to access the Steamworks API
https://code-disaster.github.io/steamworks4j/
MIT License
468 stars 64 forks source link

should we make every functions in the Callback interfaces have a default empty method? #110

Closed XenoAmess closed 2 years ago

XenoAmess commented 2 years ago

As the current code cause adding a function into a Callback interface will make every user must change codes.

Thus might cause dependency hell.

XenoAmess commented 2 years ago

example : https://github.com/cyanpotion/cyan_potion/runs/5523216193?check_suite_focus=true

I tried to upgrade from 1.8.0 to 1.9.0 and failed because you added a function into interface SteamUserStatsCallback.

2022-03-12T18:08:41.7062113Z [INFO] -------------------------------------------------------------
2022-03-12T18:08:41.7063614Z [ERROR] /home/runner/work/cyan_potion/cyan_potion/src/base/src/main/java/com/xenoamess/cyan_potion/base/steam/SteamCallbacks.java:[91,75] <anonymous com.xenoamess.cyan_potion.base.steam.SteamCallbacks$1> is not abstract and does not override abstract method onAuthSessionTicket(com.codedisaster.steamworks.SteamAuthTicket,com.codedisaster.steamworks.SteamResult) in com.codedisaster.steamworks.SteamUserCallback
2022-03-12T18:08:41.7067996Z [ERROR] /home/runner/work/cyan_potion/cyan_potion/src/base/src/main/java/com/xenoamess/cyan_potion/base/steam/SteamCallbacks.java:[115,90] <anonymous com.xenoamess.cyan_potion.base.steam.SteamCallbacks$2> is not abstract and does not override abstract method onNumberOfCurrentPlayersReceived(boolean,int) in com.codedisaster.steamworks.SteamUserStatsCallback

If we make default empty functions in such interfaces, then user codes would need not change.

XenoAmess commented 2 years ago

If you are interested I can make the pr for you.

code-disaster commented 2 years ago

I've seen some advantage in breaking user code (so that you are aware that there's been changes in the interface after a version update), but I see your point. Had to tell the Maven project to upgrade from Java 7 to Java 8 though. 😱