Throwable: java.lang.LinkageError: loader constraint violation: when resolving method

I am trying to build a robocode robot based on diamond and the code works when running using the .class file, but not work when I am trying to start a battle with a robot imported by the jar file built on the same source file.
(Robocode 1.9.5.1,java 11)
Could you help take a look at this issue?


voidious.Diamond 1.0: Throwable: java.lang.LinkageError: loader constraint violation: 
when resolving method 'java.awt.geom.Point2D$Double voidious.utils.MovementPredictor.nextLocation(voidious.Diamond)' 
the class loader net.sf.robocode.host.security.RobotClassLoader @37d889de of 
the current class, voidious/radar/DiamondEyes, 
and the class loader 'app' for the method's defining class, 

voidious/utils/MovementPredictor, have different Class objects for the type voidious/Diamond used in the signature 
(voidious.radar.DiamondEyes is in unnamed module of loader net.sf.robocode.host.security.RobotClassLoader @37d889de, parent loader 'app'; 
voidious.utils.MovementPredictor is in unnamed module of loader 'app')

Why are there two different class loader for same class? And how could I resolve it?

Leave a Comment