Erroneous try .. catch in PacketSyncBauble.java?
Opened this issue ยท 16 comments
I get this when compiling:
/home/user/projects/experiments/Baubles/build/sources/java/baubles/common/network/PacketSyncBauble.java:37: error: exception IOException is never thrown in body of corresponding try statement
try { pb.writeItemStackToBuffer(bauble); } catch (IOException e) {}
^
/home/user/projects/experiments/Baubles/build/sources/java/baubles/common/network/PacketSyncBauble.java:46: error: exception IOException is never thrown in body of corresponding try statement
try { bauble = pb.readItemStackFromBuffer(); } catch (IOException e) {}
Not sure why this happens, just curious if it is a bug or if I did something wrong. Removing the try statement seems to not have any bad effects, in my small tests.
UPDATE:
Turns out the problem is stranger. My commands and their results can be found here: http://paste.ubuntu.com/7984700/.
Strange, not sure why you are getting that. readItemStackFromBuffer definitely throws IOExceptions and without it the code won't compile due to an UnhandledException error.
Hrm. If it helps, I am using OpenJDK 7 as my java, and 6 doesn't work either. Going to try Oracle's java in a few hours or so.
I re-cloned the repo, removed the gradle cache, and used Oracle's java 7. It still don't work.
I can confirm this issue also, building using Gradle on Oracle JDK 7. Command used gradle build
.
Can you check your version of Forge is 10.13.0.1177
, and your netty version is 4.0.10
.
Yup, I'm using JDK 7, forge 1177 and netty 4.0.10. I build using gradle build as well.
@Azanor does removing the try-catch statement break the build for you? The compiler can be instructed to ignore this and maybe that is what is happening.
Checking the method signature in your ide might reveal that the method does not have a throws
statement after all.
Removing it does indeed break the build and my version of those methods do indeed throw an IOException. And by my version of those methods I mean MC 1.7.10 since they are both in net.minecraft.network.PacketBuffer.
If I'm reading that right it failed the first time, but after you setup a decomp workspace the build worked?
Interesting...
That's what it looks like. Does this need reporting to Forge or ForgeGradle? Or is it an MCP problem?
Just created a ForgeGradle issue (MinecraftForge/ForgeGradle#145), see that for info on my debugging session.
Aside: God I hate the way Java handles exceptions, though that's not the problem. Coming from .NET (which is better IMHO) it just seems a farce.