diff --git a/core/commons/che-core-commons-inject/src/main/java/org/eclipse/che/inject/lifecycle/LifecycleModule.java b/core/commons/che-core-commons-inject/src/main/java/org/eclipse/che/inject/lifecycle/LifecycleModule.java index 1c0d86268fe..92bf3689d8e 100644 --- a/core/commons/che-core-commons-inject/src/main/java/org/eclipse/che/inject/lifecycle/LifecycleModule.java +++ b/core/commons/che-core-commons-inject/src/main/java/org/eclipse/che/inject/lifecycle/LifecycleModule.java @@ -67,7 +67,7 @@ private Key(Class type, Class annotationType) { @SuppressWarnings("unchecked") LifecycleModule() { cache = - CacheBuilder.newBuilder() + CacheBuilder.newBuilder() .maximumSize(1_000) .expireAfterWrite(1, TimeUnit.HOURS) .build( diff --git a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/event/ng/EditorFileStatusNotificationOperation.java b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/event/ng/EditorFileStatusNotificationOperation.java index 63c49afed40..87f9cb76602 100644 --- a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/event/ng/EditorFileStatusNotificationOperation.java +++ b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/event/ng/EditorFileStatusNotificationOperation.java @@ -118,6 +118,7 @@ public void accept(String endpointId, FileStateUpdateDto params) { break; } + default: } } diff --git a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/event/ng/FileOpenCloseEventListener.java b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/event/ng/FileOpenCloseEventListener.java index f8452de85bd..a2079a7c48b 100644 --- a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/event/ng/FileOpenCloseEventListener.java +++ b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/event/ng/FileOpenCloseEventListener.java @@ -63,6 +63,7 @@ public void onFileOperation(FileEvent event) { break; } + default: } } diff --git a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/machine/events/DevMachineStateEvent.java b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/machine/events/DevMachineStateEvent.java index 3f9e7a64929..1408d30fc5f 100755 --- a/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/machine/events/DevMachineStateEvent.java +++ b/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/machine/events/DevMachineStateEvent.java @@ -18,7 +18,9 @@ * Event that describes the fact that dev machine state has been changed. * * @author Roman Nikitenko + * @deprecated in favor of {@link MachineStateEvent} */ +@Deprecated public class DevMachineStateEvent extends GwtEvent { public interface Handler extends EventHandler { @@ -94,6 +96,7 @@ protected void dispatch(DevMachineStateEvent.Handler handler) { case DESTROYED: handler.onDevMachineDestroyed(this); break; + default: } } } diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/client/ConnectionClosedInformerImpl.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/client/ConnectionClosedInformerImpl.java index fdf658821fc..b5cb72a37de 100644 --- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/client/ConnectionClosedInformerImpl.java +++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/client/ConnectionClosedInformerImpl.java @@ -10,6 +10,8 @@ */ package org.eclipse.che.ide.client; +import static com.google.common.base.Strings.isNullOrEmpty; +import static java.util.Arrays.asList; import static org.eclipse.che.ide.websocket.events.WebSocketClosedEvent.CLOSE_ABNORMAL; import static org.eclipse.che.ide.websocket.events.WebSocketClosedEvent.CLOSE_FAILURE_TLS_HANDSHAKE; import static org.eclipse.che.ide.websocket.events.WebSocketClosedEvent.CLOSE_GOING_AWAY; @@ -24,6 +26,8 @@ import static org.eclipse.che.ide.websocket.events.WebSocketClosedEvent.CLOSE_VIOLATE_POLICY; import com.google.inject.Inject; +import java.util.HashSet; +import java.util.Set; import org.eclipse.che.ide.CoreLocalizationConstant; import org.eclipse.che.ide.api.ConnectionClosedInformer; import org.eclipse.che.ide.api.dialogs.DialogFactory; @@ -39,6 +43,22 @@ public class ConnectionClosedInformerImpl implements ConnectionClosedInformer { private DialogFactory dialogFactory; private CoreLocalizationConstant localizationConstant; + private static final Set CLOSE_CODES = + new HashSet<>( + asList( + CLOSE_ABNORMAL, + CLOSE_NORMAL, + CLOSE_GOING_AWAY, + CLOSE_PROTOCOL_ERROR, + CLOSE_UNSUPPORTED, + CLOSE_NO_STATUS, + CLOSE_INCONSISTENT_DATA, + CLOSE_VIOLATE_POLICY, + CLOSE_TOO_LARGE, + CLOSE_NEGOTIATE_EXTENSION, + CLOSE_UNEXPECTED_CONDITION, + CLOSE_FAILURE_TLS_HANDSHAKE)); + @Inject public ConnectionClosedInformerImpl( DialogFactory dialogFactory, CoreLocalizationConstant localizationConstant) { @@ -48,31 +68,20 @@ public ConnectionClosedInformerImpl( @Override public void onConnectionClosed(WebSocketClosedEvent event) { - switch (event.getCode()) { - case CLOSE_ABNORMAL: - String reason = event.getReason(); - if (reason == null || reason.isEmpty()) { - break; - } - case CLOSE_NORMAL: - case CLOSE_GOING_AWAY: - case CLOSE_PROTOCOL_ERROR: - case CLOSE_UNSUPPORTED: - case CLOSE_NO_STATUS: - case CLOSE_INCONSISTENT_DATA: - case CLOSE_VIOLATE_POLICY: - case CLOSE_TOO_LARGE: - case CLOSE_NEGOTIATE_EXTENSION: - case CLOSE_UNEXPECTED_CONDITION: - case CLOSE_FAILURE_TLS_HANDSHAKE: - showMessageDialog( - localizationConstant.connectionClosedDialogTitle(), - localizationConstant.messagesServerFailure()); + Integer code = event.getCode(); + String reason = event.getReason(); + + if (CLOSE_ABNORMAL == code && isNullOrEmpty(reason)) { + return; } - } - /** Displays dialog using title and message. */ - private void showMessageDialog(String title, String message) { - dialogFactory.createMessageDialog(title, message, null).show(); + if (CLOSE_CODES.contains(code)) { + dialogFactory + .createMessageDialog( + localizationConstant.connectionClosedDialogTitle(), + localizationConstant.messagesServerFailure(), + null) + .show(); + } } } diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/MachineStatusHandler.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/MachineStatusHandler.java index fa21518879a..098fe4774ce 100644 --- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/MachineStatusHandler.java +++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/machine/MachineStatusHandler.java @@ -91,6 +91,7 @@ public void onMachineStatusChanged(final MachineStatusChangedEvent event) { case ERROR: handleMachineError(event); break; + default: } }); } diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/processes/panel/ProcessesPanelViewImpl.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/processes/panel/ProcessesPanelViewImpl.java index 10106d34cc6..b7c27824b49 100644 --- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/processes/panel/ProcessesPanelViewImpl.java +++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/processes/panel/ProcessesPanelViewImpl.java @@ -125,6 +125,7 @@ public void onCloseProcessOutputClick(ProcessTreeNode node) { case TERMINAL_NODE: delegate.onCloseTerminal(node); break; + default: } } }); @@ -290,6 +291,7 @@ public void onWidgetRemoving(SubPanel.RemoveCallback removeCallback) { case MACHINE_NODE: removeCallback.remove(); break; + default: } } }); diff --git a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/workspace/perspectives/general/AbstractPerspective.java b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/workspace/perspectives/general/AbstractPerspective.java index ce25351f0ea..dcc538eae85 100644 --- a/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/workspace/perspectives/general/AbstractPerspective.java +++ b/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/workspace/perspectives/general/AbstractPerspective.java @@ -386,6 +386,7 @@ public Promise loadState(@NotNull JsonObject state) { loadPartStackState( partStacks.get(TOOLING), rightPartController, partStackState, perspectiveMaximized); break; + default: } } } diff --git a/ide/che-core-ide-app/src/test/java/org/eclipse/che/ide/command/editor/page/goal/GoalPageTest.java b/ide/che-core-ide-app/src/test/java/org/eclipse/che/ide/command/editor/page/goal/GoalPageTest.java index 2c8a34a7b4d..2d7881182cc 100644 --- a/ide/che-core-ide-app/src/test/java/org/eclipse/che/ide/command/editor/page/goal/GoalPageTest.java +++ b/ide/che-core-ide-app/src/test/java/org/eclipse/che/ide/command/editor/page/goal/GoalPageTest.java @@ -12,6 +12,7 @@ import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anySet; import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.eq; import static org.mockito.Matchers.isNull; @@ -35,7 +36,6 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.InjectMocks; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; @@ -77,7 +77,7 @@ public void shouldSetViewDelegate() throws Exception { @Test public void shouldInitializeView() throws Exception { verify(goalRegistry).getAllGoals(); - verify(view).setAvailableGoals(Matchers.anySet()); + verify(view).setAvailableGoals(anySet()); verify(view).setGoal(eq(COMMAND_GOAL_ID)); } diff --git a/ide/commons-gwt/src/main/java/org/eclipse/che/ide/ui/Tooltip.java b/ide/commons-gwt/src/main/java/org/eclipse/che/ide/ui/Tooltip.java index cc2bf53a280..3510eb9a1f6 100644 --- a/ide/commons-gwt/src/main/java/org/eclipse/che/ide/ui/Tooltip.java +++ b/ide/commons-gwt/src/main/java/org/eclipse/che/ide/ui/Tooltip.java @@ -255,6 +255,7 @@ private void setPositionStyle() { Elements.addClassName(css.tooltipRight(), contentElement); } break; + default: } } diff --git a/ide/commons-gwt/src/main/java/org/eclipse/che/ide/util/UnicodeUtils.java b/ide/commons-gwt/src/main/java/org/eclipse/che/ide/util/UnicodeUtils.java index f084f0395a7..6b9de0e6ae2 100644 --- a/ide/commons-gwt/src/main/java/org/eclipse/che/ide/util/UnicodeUtils.java +++ b/ide/commons-gwt/src/main/java/org/eclipse/che/ide/util/UnicodeUtils.java @@ -515,6 +515,7 @@ public CharacterClass build(String... characterClass) { case ZERO_OR_MORE: strBuilder.append('*'); break; + default: } return new CharacterClass(strBuilder.toString()); diff --git a/plugins/plugin-docker/che-plugin-docker-client/src/main/java/org/eclipse/che/plugin/docker/client/LogMessageFormatter.java b/plugins/plugin-docker/che-plugin-docker-client/src/main/java/org/eclipse/che/plugin/docker/client/LogMessageFormatter.java index ee1488927fe..ff193d9ca02 100644 --- a/plugins/plugin-docker/che-plugin-docker-client/src/main/java/org/eclipse/che/plugin/docker/client/LogMessageFormatter.java +++ b/plugins/plugin-docker/che-plugin-docker-client/src/main/java/org/eclipse/che/plugin/docker/client/LogMessageFormatter.java @@ -35,6 +35,7 @@ public String format(LogMessage logMessage) { case DOCKER: sb.append("[DOCKER]"); break; + default: } final String content = logMessage.getContent(); if (content != null) { diff --git a/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftPvcHelper.java b/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftPvcHelper.java index d19831c76fe..0bbc89b48e5 100644 --- a/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftPvcHelper.java +++ b/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftPvcHelper.java @@ -183,6 +183,7 @@ protected boolean createJobPod( switch (phase) { case POD_PHASE_FAILED: LOG.info("Pod command {} failed", Arrays.toString(jobCommand)); + // fall through case POD_PHASE_SUCCEEDED: openShiftClient.resource(pod).delete(); updateCreatedDirs(command, phase, allDirsArray); diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/compare/changespanel/ChangedFileNode.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/compare/changespanel/ChangedFileNode.java index 716f858a9fb..30930503d02 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/compare/changespanel/ChangedFileNode.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/compare/changespanel/ChangedFileNode.java @@ -105,6 +105,8 @@ public void updatePresentation(@NotNull NodePresentation presentation) { return; case COPIED: presentation.setPresentableTextCss("color: purple;"); + return; + default: } } diff --git a/plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/che/jdt/core/resources/ResourceDeltaImpl.java b/plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/che/jdt/core/resources/ResourceDeltaImpl.java index 7bd6a154e3e..a1b38c9884a 100644 --- a/plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/che/jdt/core/resources/ResourceDeltaImpl.java +++ b/plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/che/jdt/core/resources/ResourceDeltaImpl.java @@ -32,7 +32,7 @@ public class ResourceDeltaImpl implements IResourceDelta { public ResourceDeltaImpl(File workspace, ProjectItemModifiedEvent event) { this.workspace = workspace; path = event.getPath(); - // status|= KIND_MASK; + switch (event.getType()) { case UPDATED: status |= CHANGED | CONTENT; @@ -42,6 +42,8 @@ public ResourceDeltaImpl(File workspace, ProjectItemModifiedEvent event) { break; case DELETED: status |= REMOVED; + break; + default: } } diff --git a/plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/jdt/internal/corext/refactoring/reorg/ReorgUtils.java b/plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/jdt/internal/corext/refactoring/reorg/ReorgUtils.java index 90119102bd5..180c6cc22b2 100644 --- a/plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/jdt/internal/corext/refactoring/reorg/ReorgUtils.java +++ b/plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/jdt/internal/corext/refactoring/reorg/ReorgUtils.java @@ -261,7 +261,7 @@ public static boolean hasSourceAvailable(IMember member) throws JavaModelExcepti public static IResource[] setMinus(IResource[] setToRemoveFrom, IResource[] elementsToRemove) { Set setMinus = - new HashSet(setToRemoveFrom.length - setToRemoveFrom.length); + new HashSet(setToRemoveFrom.length - elementsToRemove.length); setMinus.addAll(Arrays.asList(setToRemoveFrom)); setMinus.removeAll(Arrays.asList(elementsToRemove)); return setMinus.toArray(new IResource[setMinus.size()]); @@ -270,7 +270,7 @@ public static IResource[] setMinus(IResource[] setToRemoveFrom, IResource[] elem public static IJavaElement[] setMinus( IJavaElement[] setToRemoveFrom, IJavaElement[] elementsToRemove) { Set setMinus = - new HashSet(setToRemoveFrom.length - setToRemoveFrom.length); + new HashSet(setToRemoveFrom.length - elementsToRemove.length); setMinus.addAll(Arrays.asList(setToRemoveFrom)); setMinus.removeAll(Arrays.asList(elementsToRemove)); return setMinus.toArray(new IJavaElement[setMinus.size()]); diff --git a/plugins/plugin-java/che-plugin-java-ext-lang-client/src/main/java/org/eclipse/che/ide/ext/java/client/refactoring/RefactoringUpdater.java b/plugins/plugin-java/che-plugin-java-ext-lang-client/src/main/java/org/eclipse/che/ide/ext/java/client/refactoring/RefactoringUpdater.java index e3c43d6f27c..ebb3634b082 100644 --- a/plugins/plugin-java/che-plugin-java-ext-lang-client/src/main/java/org/eclipse/che/ide/ext/java/client/refactoring/RefactoringUpdater.java +++ b/plugins/plugin-java/che-plugin-java-ext-lang-client/src/main/java/org/eclipse/che/ide/ext/java/client/refactoring/RefactoringUpdater.java @@ -117,6 +117,7 @@ public Promise updateAfterRefactoring(List changes) { pathChanged.add(change.getPath()); registerRemovedFile(change); } + continue; default: continue; } diff --git a/plugins/plugin-java/che-plugin-java-ext-lang-client/src/main/java/org/eclipse/che/ide/ext/java/client/tree/library/JarFileNode.java b/plugins/plugin-java/che-plugin-java-ext-lang-client/src/main/java/org/eclipse/che/ide/ext/java/client/tree/library/JarFileNode.java index 9cd1adb27a7..b51bf493326 100644 --- a/plugins/plugin-java/che-plugin-java-ext-lang-client/src/main/java/org/eclipse/che/ide/ext/java/client/tree/library/JarFileNode.java +++ b/plugins/plugin-java/che-plugin-java-ext-lang-client/src/main/java/org/eclipse/che/ide/ext/java/client/tree/library/JarFileNode.java @@ -238,6 +238,7 @@ public void onFileOperation(FileEvent event) { break; } + default: } } diff --git a/plugins/plugin-java/che-plugin-java-ext-lang-client/src/test/java/org/eclipse/che/ide/ext/java/client/action/OrganizeImportsActionTest.java b/plugins/plugin-java/che-plugin-java-ext-lang-client/src/test/java/org/eclipse/che/ide/ext/java/client/action/OrganizeImportsActionTest.java index 75cc21b25f1..ca1ed1d510f 100644 --- a/plugins/plugin-java/che-plugin-java-ext-lang-client/src/test/java/org/eclipse/che/ide/ext/java/client/action/OrganizeImportsActionTest.java +++ b/plugins/plugin-java/che-plugin-java-ext-lang-client/src/test/java/org/eclipse/che/ide/ext/java/client/action/OrganizeImportsActionTest.java @@ -49,6 +49,7 @@ public void setUp() throws Exception { when(editorAgent.getActiveEditor()).thenReturn(editor); } + @Test public void prepareAction() throws Exception { verify(locale).organizeImportsName(); verify(locale).organizeImportsDescription(); diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/quickassist/LanguageServerQuickAssistProcessor.java b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/quickassist/LanguageServerQuickAssistProcessor.java index 18beedd2924..3e0f20d6f48 100644 --- a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/quickassist/LanguageServerQuickAssistProcessor.java +++ b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/quickassist/LanguageServerQuickAssistProcessor.java @@ -120,6 +120,7 @@ public void computeQuickAssistProposals( QueryAnnotationsEvent.QueryCallback annotationCallback = new QueryAnnotationsEvent.QueryCallback() { + @SuppressWarnings("ReturnValueIgnored") @Override public void respond( Map annotations) { diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/navigation/symbol/SymbolKindHelper.java b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/navigation/symbol/SymbolKindHelper.java index f82265f22cd..87c82ed8ea7 100644 --- a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/navigation/symbol/SymbolKindHelper.java +++ b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/navigation/symbol/SymbolKindHelper.java @@ -95,7 +95,8 @@ public String from(SymbolKind kind) { return "number"; case Boolean: return "boolean"; + default: + return "property"; } - return "property"; } }