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.
The 'break' out of switch case should be on next line in this example. (It is semantically correct (at least in this case)) if(VISUAL_MODE_LAYER.equals(name)) { if(h != visualSelectHighlighter) { if(visualSelectHighlighter != null) { discarded = visualSelectHighlighter; } visualSelectHighlighter = h; installed = h; } } else if(SEARCH_RESULTS_LAYER.equals(name)) { if(h != searchResultsHighlighter) { if(searchResultsHighlighter != null) { discarded = searchResultsHighlighter; } searchResultsHighlighter = h; installed = h; } } Gets converted to switch(name) { case VISUAL_MODE_LAYER: if(h != visualSelectHighlighter) { if(visualSelectHighlighter != null) { discarded = visualSelectHighlighter; } visualSelectHighlighter = h; installed = h; } break; case SEARCH_RESULTS_LAYER: if(h != searchResultsHighlighter) { if(searchResultsHighlighter != null) { discarded = searchResultsHighlighter; } searchResultsHighlighter = h; installed = h; } break; } Product Version: NetBeans IDE 7.4 (Build 201310111528) Java: 1.7.0_45; Java HotSpot(TM) Client VM 24.45-b08 Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18 System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
reproducible if the to-be-switch case entire statement list is wrapped in a block, as in the example in the if-true block. If the last statement stands alone, break is correctly aligned under it. Will solve as time permits, does not break the code / semantics.
This seems to be more extensive problem than you first indicate. I've marked with XXX some lines of interest. === converted === switch(evt.getPropertyName()) { case TopComponent.Registry.PROP_ACTIVATED: { TopComponent tc = (TopComponent) evt.getOldValue(); if(tc != null) { tcDumpInfo(tc, "activated oldTC"); for (NbAppView av : NbAppView.fetchAvFromTC(tc)) { AppViews.deactivate(av); } XXX } tc = (TopComponent) evt.getNewValue(); XXX INDENT if(tc != null) { if(!tcChecked.containsKey(tc)) { // After first activation, look through the // GUI hierarchy again for jVi editors. Sigh. getOpenedPanes(tc); // force instantiation of editor panes boolean isEditor = isEditor(tc); List<JEditorPane> l = getDescendentJviJep(tc); for (JEditorPane ep : l) { NbAppView av = NbAppView.updateAppViewForTC( "P_ACTV", tc, ep, !isEditor); } tcChecked.put(tc, null); } tcDumpInfo(tc, "activated newTC"); } break; } case TopComponent.Registry.PROP_TC_OPENED: { TopComponent tc = (TopComponent) evt.getNewValue(); boolean isEditor = isEditor(tc); tcDumpInfo(tc, "open"); if(tc != null && "Output".equals(tc.getName())) { refOutput = new WeakReference<TopComponent>(tc); } boolean createdAppView = false; // When opened, traverse the GUI hierarchy looking for // JEP that have jVi installed. XXX List<JEditorPane> l = getDescendentJviJep(tc); for (JEditorPane ep : l) { // if TC is not an editor then start out like a nomad NbAppView av = NbAppView.updateAppViewForTC( "P_OPEN", tc, ep, !isEditor); createdAppView = true; XXX } if(isEditor && !createdAppView) { XXX NbAppView av = NbAppView.updateAppViewForTC( "P_OPEN_LAZY", tc, null); } break; } case TopComponent.Registry.PROP_TC_CLOSED: { TopComponent tc = (TopComponent) evt.getNewValue(); for (NbAppView av : NbAppView.fetchAvFromTC(tc)) { tcDumpInfo(tc, "close"); KeyBindings.removeKnownEditor(av.getEditor()); AppViews.close(av); } NbAppView.closeTC(tc); break; } } === original === if(evt.getPropertyName() .equals(TopComponent.Registry.PROP_ACTIVATED)) { TopComponent tc = (TopComponent) evt.getOldValue(); if(tc != null) { tcDumpInfo(tc, "activated oldTC"); for (NbAppView av : NbAppView.fetchAvFromTC(tc)) { AppViews.deactivate(av); } } tc = (TopComponent) evt.getNewValue(); if(tc != null) { if(!tcChecked.containsKey(tc)) { // After first activation, look through the // GUI hierarchy again for jVi editors. Sigh. getOpenedPanes(tc); // force instantiation of editor panes boolean isEditor = isEditor(tc); List<JEditorPane> l = getDescendentJviJep(tc); for (JEditorPane ep : l) { NbAppView av = NbAppView.updateAppViewForTC( "P_ACTV", tc, ep, !isEditor); } tcChecked.put(tc, null); } tcDumpInfo(tc, "activated newTC"); } } else if(evt.getPropertyName() .equals(TopComponent.Registry.PROP_TC_OPENED)) { TopComponent tc = (TopComponent) evt.getNewValue(); boolean isEditor = isEditor(tc); tcDumpInfo(tc, "open"); if(tc != null && "Output".equals(tc.getName())) { refOutput = new WeakReference<TopComponent>(tc); } boolean createdAppView = false; // When opened, traverse the GUI hierarchy looking for // JEP that have jVi installed. List<JEditorPane> l = getDescendentJviJep(tc); for (JEditorPane ep : l) { // if TC is not an editor then start out like a nomad NbAppView av = NbAppView.updateAppViewForTC( "P_OPEN", tc, ep, !isEditor); createdAppView = true; } if(isEditor && !createdAppView) { NbAppView av = NbAppView.updateAppViewForTC( "P_OPEN_LAZY", tc, null); } } else if(evt.getPropertyName() .equals(TopComponent.Registry.PROP_TC_CLOSED)) { TopComponent tc = (TopComponent) evt.getNewValue(); for (NbAppView av : NbAppView.fetchAvFromTC(tc)) { tcDumpInfo(tc, "close"); KeyBindings.removeKnownEditor(av.getEditor()); AppViews.close(av); } NbAppView.closeTC(tc); }
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue. Thanks for your cooperation, NetBeans IDE 8.2 Release Boss