December 27, 20195 yr For reference, that list came from here: https://blogs.msdn.microsoft.com/ericlippert/2008/09/10/vexing-exceptions/ Note that Vexing is for things like int.Parse(str) that throws an exception when str isn't a valid integer (so use int.TryToParse(str) instead), but Java doesn't have a non-exception throwing version, hence, vexing. Someone, somewhere, made a design decision to throw an exception and now you have to deal with it. 1 hour ago, Issac29 said: 1. what about runtime, null pointer, arraystore, array out of index, and index out of bounds. Null check first, you bonehead. Check your types first, you bonehead. Check your bounds first, you bonehead. Quote ...these are all problems that you could have prevented very easily in the first place, so prevent the mess in the first place rather than trying to clean it up. Edited December 27, 20195 yr by Draco18s Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 28, 20195 yr 1 hour ago, Issac29 said: So try and catch isn't reliable. There is simply no need for try and catch. Try and catch should not be used as a fix for bad coding. Edited December 28, 20195 yr by DavidM Some tips: Spoiler Modder Support: Spoiler 1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code. 2. Always post your code. 3. Never copy and paste code. You won't learn anything from doing that. 4. Quote Programming via Eclipse's hotfixes will get you nowhere 5. Learn to use your IDE, especially the debugger. 6. Quote The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it. Support & Bug Reports: Spoiler 1. Read the EAQ before asking for help. Remember to provide the appropriate log(s). 2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.
December 28, 20195 yr Author 10 hours ago, diesieben07 said: Absolutely not true. If you tell Java to catch an exception, it will be caught. What we said above has nothing to do with reliability of try-catch. Well for the useless number 4 exceptions. also known as the unnecessary exceptions which doesn't throw a compile error, unlike IO exceptions which do throw a compile unless there is a try and catch or a "throws" statement. 18 hours ago, DavidM said: There is simply no need for try and catch. Try and catch should not be used as a fix for bad coding. Well not true. Well this is getting well off topic.
December 29, 20195 yr 1 hour ago, Issac29 said: Well not true. In program design in languages like Java, try and catch should be avoided "at all costs". To illustrate, this: if (foo instanceof Bar) { Bar baz = (Bar) foo; } is much and always superior to this: try { Bar baz = (Bar) foo; } catch (ClassCatchException e) { // Do stuff. } both performance-wise and readability-wise. Unlike some dynamic languages nowadays which greatly encourage try-catch over anything else (*cough* python *cough*), try-catch carries special connotation in languages like Java, and should not be used to 1) silence an unexpected error 2) fix bad coding. Your usage of try and catch fall under both of those category, so in your case, there is no need for try and catch. Some tips: Spoiler Modder Support: Spoiler 1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code. 2. Always post your code. 3. Never copy and paste code. You won't learn anything from doing that. 4. Quote Programming via Eclipse's hotfixes will get you nowhere 5. Learn to use your IDE, especially the debugger. 6. Quote The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it. Support & Bug Reports: Spoiler 1. Read the EAQ before asking for help. Remember to provide the appropriate log(s). 2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.
December 29, 20195 yr 2 hours ago, Issac29 said: Well not true. Very much true. I have first hand experience on just how costly a try-catch block is. I had code at one point that had the possibility of generating an error (a Vexing type) and wrapped it in a try-catch--because that was the right things to do. And the code was called so often that it ground Minecraft to a halt. We're talking two minutes per tick levels of slow for what was a few tens of thousands of calls. Performing bounds-checks and null-checks on the other hand takes nano seconds, virtually zero time. I ended up just letting the exception be thrown and bypassing the compiler's check for exception handling, as it was an exception that could never occur unless something went very wrong indeed (better to let the game crash than catch the exception). Code correctly and don't catch boneheaded exceptions. Boneheaded exceptions are the result of bugs. Don't intentionally hide bugs in your code. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 29, 20195 yr Author 2 hours ago, Issac29 said: Well this is getting well off topic. Although those unnecessary tries and catches, we might be getting too off topic with this title. Quote Entity hands not rendering via an inventory Where do the custom packets used at.
December 29, 20195 yr Author 47 minutes ago, diesieben07 said: Where do the custom packets used at. The interface IPacket. If a class implementing an IPacket then where does the it gets used for client networking?
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.