gcewing Posted October 26, 2014 Posted October 26, 2014 I'm developing an add-on for Project Red, and weird things are happening with the way Java and Scala interact. Everything compiles fine, but some things misbehave at run time. 1) I have a subclass of JItemMultiPart written in Java that overrides some Item methods, such as registerIcons. But my overrides are never called -- it calls the base methods defined in class Item instead. If I replace JItemMultiPart with a re-implementation of it in pure Java, my overrides are called as expected. 2) Calling methods of a TileMultipart that are defined in TileEntity, e.g. getBlockType and markDirty, causes a Method Not Found exception at run time. These calls work if I explicitly cast the TileMultipart to TileEntity, however. It seems like the runtime is not recognising that these Scala-implemented classes inherit from java base classes. There is no Scala in my own code, only Java. I've tried compiling with two different versions of javac, javac 1.6.0_51 and javac 1.7.0-b222, with the same result. I'm on MacOSX 10.6.8. None of this was happening when I first started working on the mod a few months ago, but back then I was using my own custom builds of ForgeMultipart and Project Red for 1.7. The only thing I can think of that's changed is that I'm now compiling against the official 1.7.10 releases. Anyone have any idea what might be happening? I can work around these problems for now, but they're disconcerting and I'd like to get to the bottom of them. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.