Abstract Problems [Solved]

Ok, I think I know how abstract classes work… but maybe not? I have an abstract class called entity that has an abstract kill method…

/**
 * Kills the this entity.
 */
public abstract void kill();

and I override that method in a sub class called Zombie and another called Player…

/**
     * Kills the player.
     */
    @Override
    public void kill() {
        System.err.println("PLAYER KILLED");//Test test test :(
    }

However the console spits out this…

java.lang.ExceptionInInitializerError
	at mygame.Main.simpleInitApp(Main.java:124)
	at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:220)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Uncompilable source code - mygame.Player is not abstract and does not override abstract method kill() in mygame.Entity
	at mygame.InteractiveObject.<clinit>(InteractiveObject.java:19)
	... 5 more

Also InteractveObject (super class of entity) line 19 is just this line…

float mass = 1f;

I have no idea what is going on here. My abstract entity class was working fine with one abstract method but I added in another and it just freaked out. I even tried doing a clean build. I really hope someone knows whats going on here. Until I find out whats wrong I’ll just change entity class to be non abstract and just override the empty methods.

Can you copy the complete code of the abstract class and the class that inherits it

Thanks

THOCED

My guess:

Go into your project settings in Netbeans/JME SDK. Turn off compile on save because the netbeans compiler is cow excrement. Clean-build your project.

…and never see these sorts of errors gain.

edit: and for the record, any time you see an exception like: “Caused by: java.lang.RuntimeException: Uncompilable source code”… it’s probably the netbeans compiler dropping a big stinking load into your byte code.

2 Likes

It worked just as you said pspeed. :slight_smile:

Thanks for the help once again :thumbsup:

1 Like