This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I'm using NetBeans 7 GA and I've configured it to use a recent build (b145) of JDK 7. I've created a new project, configured it to use my JDK 7 platform, and have set its source-level to 7. Enter the following code: ========== import java.io.IOException; import java.net.MalformedURLException; public class MultiCatchTest { public static void main(String[] args) { try { if (args.length % 2 == 0) throw new IOException(); else throw new MalformedURLException(); } catch (MalformedURLException|IOException e) { // ... } System.out.println("hello"); } } ========== This is illegal, and it should not run. However, the IDE does not show an error (no red squiggly line), and it will succeed and print "hello" if you choose the "Run" command. It will still succeed if even if you choose "Clean" and then "Run". However, it will fail (correctly) with the following error if you choose "Build" or "Clean And Build". error: Alternatives in a multi-catch statement cannot be related by subclassing } catch (MalformedURLException|IOException e) { Alternative MalformedURLException is a subclass of alternative IOException This inconsistent behavior disappears if "Compile On Save" is disabled in the project's properties. As a user, I have to say that it is incredibly confusing to have "Clean and Build" then "Run" behave radically different from "Clean" then "Run". This totally breaks my mental model of what NetBeans is doing when you choose the Clean And Build, Clean, Build, and Run commands.
Should be fixed in the current dev build. Error is correctly shown in the recent builds.