Suspicious Indentation After If Statement Triggers Among Us Emergency Meeting
Description
A two-part meme combining a Java code snippet with an Among Us 'Emergency Meeting' scene. The top portion shows Java code in a dark IDE: 'arr.clear();' followed by 'if(arr.isEmpty()) System.out.println("The list is empty!");' and then 'ArrayList<Integer> l = new ArrayList<Integer>(List.of(1,2,3,4)); // From a...' with a yellow lightbulb IDE warning tooltip reading 'Suspicious indentation after if statement'. The code has a classic indentation trap where the second line after the if-statement appears to be inside the if-block due to indentation but is actually unconditional. Below is the iconic red Among Us crewmate character slamming the emergency meeting button with large white text reading 'EMERGENCY MEETING'. The devme.me watermark appears in the bottom right
Comments
20Comment deleted
Apple's goto fail; bug cost them a CVE. This developer's goto fail is costing them an emergency meeting. At least in Among Us, the impostor is easier to identify than a braceless if-block
Don't Understand Shit Comment deleted
Java Comment deleted
java? not Zig? Comment deleted
ahhh yess PeePee<PooPoo> peePeePooPoo = new PeePee<PooPoo>(pee, pee, poo, poo); so eXpLiCiT Comment deleted
I love explicit language! (pun intended) Comment deleted
Java generics is the only thing that scares me every time I touch it Comment deleted
implicit types 👻 Comment deleted
Does java not have var or new()? Comment deleted
they did add it very late Comment deleted
i think linters consider it bad practice for java Comment deleted
Java 10. we're at 25 or smth this is intentional for the meme, "List.of()" didn't exist in that way back in like, java 6 Comment deleted
It has var, I don't get what you mean by "new()" It's just that in the code snippet from the post var isn't used Comment deleted
It has, but type inference in Java isn't a good one, so usually you use var just to avoid writing the same long type name twice in a line where you create a variable Comment deleted
imo Comment deleted
Join the curly braces in code protection program. Do not let them disappear. They save lives. Comment deleted
So java had brackets and decided to go the pyhton way ? Comment deleted
Java allows you to omit them (as many other languages) but it's more prone to bugs. Remember Heartbleed security issue... something curly braces easily would avoid if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) goto fail; goto fail; Comment deleted
... as would -Wmisleading-indentation Comment deleted
they are the same as c: the cf statements have one substatement (or two in case of if ... else ...), but that statement may be a block-statement Comment deleted