sk7725/BetaMindy

stack overflow error (omg programming reference?!?)

Closed this issue · 10 comments

Platform: macOS 13 Ventura (yeah i know)

Build: 141.3

Mod Version: 1.09

Issue: literally just crashes (foregoing the error template because i know code [hopefully])

Mindustry has crashed. How unfortunate.
Version: release build 141.3
OS: Mac OS X x64 (x86_64)
Java Version: 1.8.0_361
Runtime Available Memory: 1820mb
Cores: 4
Mods: adc:15.0, betamindy:1.09, cyber-io:5.1, exogenesis:[blue]1.9.1, fooinstaller:1.2.4, informatis:1.7, me:2.1, new-horizon:0.2.7, ol:0.6f, pictologic:1.6.0, prog-mats:26.6, revision:13.3, rtfm:3.15.1, schematics-pack:9, scheme-size:2.7.34, shar:0.2v, time-control:0.2, uaw:v0.8.3, unity:0.2-youngcha.3.3, ui-lib:4.18.0

java.lang.RuntimeException: Error loading mod betamindy
	at mindustry.mod.Mods.contextRun(Mods.java:773)
	at mindustry.mod.Mods.lambda$eachClass$30(Mods.java:761)
	at arc.struct.Seq.each(Seq.java:182)
	at mindustry.mod.Mods.eachClass(Mods.java:761)
	at mindustry.ClientLauncher.update(ClientLauncher.java:215)
	at arc.backend.sdl.SdlApplication.listen(SdlApplication.java:204)
	at arc.backend.sdl.SdlApplication.loop(SdlApplication.java:192)
	at arc.backend.sdl.SdlApplication.<init>(SdlApplication.java:54)
	at mindustry.desktop.DesktopLauncher.main(DesktopLauncher.java:39)
Caused by: java.lang.StackOverflowError
	at betamindy.util.UnitLib.calcCost(UnitLib.java:66)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)
	at betamindy.util.UnitLib.calcCost(UnitLib.java:71)

this goes on for a while uh like hundreds of lines

this is the line in question


Place an X (no spaces) between the brackets to confirm that you have read the line below.

  • I have searched the closed and open issues to make sure that this problem has not already been reported.
  • I have updated to the latest release (https://github.com/sk7725/BetaMindy/releases) to make sure my issue has not been fixed.

The original template is by Anuke, modified by sk7725.

the line references itself what the heck

public static ItemStack[] calcCost(UnitType u){
...
for(Reconstructor b : recons){
...
if(r != null){
ItemStack[] cost = calcCost(r[0]);
...
}
...
}

so like

might add this was on startup of the game

am i just using the wrong version of java

the code is 18 months old what

so i think a different mod is doing this but its still probably not good practice to call something inside itself

okay this happens in other places #166

so i think a different mod is doing this but its still probably not good practice to call something inside itself

recursion is good practice
people hated recursion because they hate concepts they don't understand

recursive methods are pretty good as long as you know what you're doing

i mean yeah, that sounds about right. i dont know what im doing.
but like shouldnt there be a thing to prevent the recursiveness? because i dont know how but a different mod somehow interfaced with this mod

im just gonna close this because im stupid and opened this issue on 3 hours of sleep