Railcraft

Railcraft

34M Downloads

Build Error (1.10.2)

brisingraerowing opened this issue ยท 3 comments

commented

When trying to build using gradle (I applied fixes from #989) I get the following errors:

C:\Users\Zachary\Desktop\tmp-mc\Railcraft\build\sources\main\java\mods\railcraft\common\plugins\forge\DataManagerPlugin.java:52: error: read(PacketBuffer) in DataSerializerIO cannot implement read(PacketBuffer) in DataSerializer
        public final T read(PacketBuffer buf) throws IOException {
                       ^
  overridden method does not throw IOException
  where T#1,T#2 are type-variables:
    T#1 extends Object declared in class DataSerializerIO
    T#2 extends Object declared in interface DataSerializer
C:\Users\Zachary\Desktop\tmp-mc\Railcraft\build\sources\main\java\mods\railcraft\common\plugins\forge\DataManagerPlugin.java:67: error: read(PacketBuffer) in DataSerializerIO cannot implement read(PacketBuffer) in DataSerializer
    public static final DataSerializer<OptionalFluidStack> OPTIONAL_FLUID_STACK = new DataSerializerIO<OptionalFluidStack>() {
                                                                                                                             ^
  overridden method does not throw IOException
  where T#1,T#2 are type-variables:
    T#1 extends Object declared in class DataSerializerIO
    T#2 extends Object declared in interface DataSerializer
C:\Users\Zachary\Desktop\tmp-mc\Railcraft\build\sources\main\java\mods\railcraft\common\plugins\forge\DataManagerPlugin.java:81: error: read(PacketBuffer) in DataSerializerIO cannot implement read(PacketBuffer) in DataSerializer
    public static final DataSerializer<EnumColor> ENUM_COLOR = new DataSerializerIO<EnumColor>() {
                                                                                                 ^
  overridden method does not throw IOException
  where T#1,T#2 are type-variables:
    T#1 extends Object declared in class DataSerializerIO
    T#2 extends Object declared in interface DataSerializer

This is because the base interface methods don't throw IOException, and Java prohibits adding checked exceptions to overridden methods (which is a very stupid design decision, IMHO).

I am using Java 1.8 u102 to build.

commented

It appears that Java is rather retarded when matching these things, as the overridden method cannot use an imported version of an exception that is thrown.

Basically, removing the java.io.IOException import and replacing all the throws IOException with throws java.io.IOException fixed it.

Dammit java. Y U No make sense?!?

commented

I cannot reproduce this. Are you using oraclejdk?

commented

Yes. I am on Windows 10. I guess I will chalk it up to Java being screwy again, as a rebuild without the import change worked. I get the most random failures with it.