From 5a4a0a49f8e39d4317129bf5ccedbdcefee0d134 Mon Sep 17 00:00:00 2001 From: Vlad Dumitrescu Date: Thu, 8 Mar 2018 14:43:32 +0100 Subject: [PATCH 01/19] properly compare strings with literal --- .../GraphResultingInspectionHandler.java | 12 ++-- .../SimpleCodeInspectionHandler.java | 30 ++++----- .../view/PushActionDelegate.java | 12 ++-- .../core/DuplicateDetectionAction.java | 3 +- .../core/ExpressionSearchParser.java | 2 +- .../core/SimilarExpressionSearchParser.java | 2 +- .../backend/WranglerSyntaxBackend.java | 4 +- .../internal/ExpressionPosRpcMessage.java | 2 +- .../internal/GenFunRefactoringMessage.java | 10 +-- .../backend/internal/ProcessRpcMessage.java | 4 +- .../internal/RefactoringRpcMessage.java | 6 +- .../internal/StateDataToRecordRpcMessage.java | 4 +- .../internal/WranglerRefactoringBackend.java | 2 +- .../refactoring/ui/AddRefacHandler.java | 4 +- .../refactoring/ui/RefactoringHandler.java | 62 ++++++++----------- .../refactoring/ui/WranglerTester.java | 2 +- .../ui/validator/NonEmptyStringValidator.java | 2 +- .../otp/erlang/AbstractConnection.java | 4 +- .../ericsson/otp/erlang/OtpInputStream.java | 2 +- .../src/com/ericsson/otp/erlang/OtpNode.java | 2 +- .../org/erlide/backend/api/BackendData.java | 2 +- .../org/erlide/backend/debug/ErlideDebug.java | 2 +- .../debug/events/DebuggerEventFactory.java | 10 +-- .../backend/debug/events/NewStatusEvent.java | 8 +-- .../erlide/backend/internal/ErlangCode.java | 2 +- .../backend/launch/ErlangLaunchDelegate.java | 2 +- .../internal/builder/ErlcMessageParser.java | 2 +- .../internal/builder/InternalBuilder.java | 2 +- .../erlide/cover/core/EUnitEventHandler.java | 8 +-- .../erlide/cover/ui/launch/CoverTabGroup.java | 2 +- .../engine/model/erlang/SourceKind.java | 6 +- .../engine/services/parsing/ErlToken.java | 2 +- .../org/erlide/engine/util/CommonUtils.java | 2 +- .../erlide/engine/util/ErlideTestUtils.java | 2 +- .../engine/internal/model/root/ErlFolder.java | 2 +- .../engine/internal/model/root/ErlModule.java | 2 +- .../ErlOtpExternalReferenceEntryList.java | 2 +- .../codeassist/ErlangCompletionService.java | 6 +- .../internal/services/search/ErlideOpen.java | 2 +- .../org/erlide/runtime/api/RuntimeData.java | 2 +- .../erlide/runtime/internal/EventParser.java | 2 +- .../org/erlide/tracing/core/TraceBackend.java | 2 +- .../core/mvc/view/MatchSpecCellEditor.java | 8 +-- .../erlide/ui/editors/erl/ErlangEditor.java | 6 +- .../handlers/ExpandCollapseAllHandler.java | 10 ++- .../src/org/erlide/ui/launch/RuntimeTab.java | 2 +- .../org/erlide/ui/prefs/AddRuntimeDialog.java | 2 +- .../ui/prefs/plugin/ErlidePreferencePage.java | 2 +- .../org/erlide/ui/util/ErlideSelection.java | 2 +- .../ui/wizards/ErlangFileWizardPage.java | 2 +- .../org/erlide/ui/wizards/ProjectCreator.java | 2 +- .../src/org/erlide/util/DebugStream.java | 2 +- .../src/org/erlide/util/erlang/OtpErlang.java | 2 +- .../org/erlide/util/erlang/TypeConverter.java | 10 +-- .../engine/model/erlang/IErlElementTest.java | 2 +- 55 files changed, 134 insertions(+), 161 deletions(-) diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/GraphResultingInspectionHandler.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/GraphResultingInspectionHandler.java index 5ca0b50d2c..93be8e2267 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/GraphResultingInspectionHandler.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/GraphResultingInspectionHandler.java @@ -67,8 +67,7 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { final IErlSelection wranglerSelection = GlobalParameters .getWranglerSelection(); - if (actionId.equals( - "org.erlide.wrangler.refactoring.codeinspection.cyclicdependencies")) { + if ("org.erlide.wrangler.refactoring.codeinspection.cyclicdependencies".equals(actionId)) { final Boolean answer = MessageDialog.openQuestion( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Labels", "Label edges with function names called?"); @@ -76,16 +75,14 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { "There is no cyclic dependent modules in the project!", tmpFile, "cyclic_dependent_modules", "ssx", tmpFile.getAbsolutePath(), wranglerSelection.getSearchPath(), new OtpErlangBoolean(answer)); - } else if (actionId.equals( - "org.erlide.wrangler.refactoring.codeinspection.generatefunctioncallgraph")) { + } else if ("org.erlide.wrangler.refactoring.codeinspection.generatefunctioncallgraph".equals(actionId)) { runInspection("Function callgraph", FUNCTION_CALL_GRAPH_VIEW_ID, "There is no dependent functions in the module!", tmpFile, "gen_function_callgraph", "sss", tmpFile.getAbsolutePath(), wranglerSelection.getFilePath(), wranglerSelection.getSearchPath()); - } else if (actionId.equals( - "org.erlide.wrangler.refactoring.codeinspection.generatemodulegraph")) { + } else if ("org.erlide.wrangler.refactoring.codeinspection.generatemodulegraph".equals(actionId)) { final Boolean answer = MessageDialog.openQuestion( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Labels", "Label edges with function names called?"); @@ -94,8 +91,7 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { "gen_module_graph", "ssx", tmpFile.getAbsolutePath(), wranglerSelection.getSearchPath(), new OtpErlangBoolean(answer)); - } else if (actionId.equals( - "org.erlide.wrangler.refactoring.codeinspection.improperdependecies")) { + } else if ("org.erlide.wrangler.refactoring.codeinspection.improperdependecies".equals(actionId)) { runInspection("Improper module dependencies", IMPROPER_DEPENDECIES_VIEW_ID, "There is no improper module dependecies!", tmpFile, diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/SimpleCodeInspectionHandler.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/SimpleCodeInspectionHandler.java index ef260a867f..ae89741f83 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/SimpleCodeInspectionHandler.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/SimpleCodeInspectionHandler.java @@ -91,33 +91,25 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getShell(); - if (actionId - .equals("org.erlide.wrangler.refactoring.codeinspection.largemodules")) { + if ("org.erlide.wrangler.refactoring.codeinspection.largemodules".equals(actionId)) { handleLargeModulesCall(wranglerSelection, shell); - } else if (actionId - .equals("org.erlide.wrangler.refactoring.codeinspection.dependencies")) { + } else if ("org.erlide.wrangler.refactoring.codeinspection.dependencies".equals(actionId)) { handleDepenenciesCall(wranglerSelection, shell); - } else if (actionId.equals( - "org.erlide.wrangler.refactoring.codeinspection.nontailrecursive")) { + } else if ("org.erlide.wrangler.refactoring.codeinspection.nontailrecursive".equals(actionId)) { handleNonTailRecursiveCall(wranglerSelection, shell); - } else if (actionId - .equals("org.erlide.wrangler.refactoring.codeinspection.notflush")) { + } else if ("org.erlide.wrangler.refactoring.codeinspection.notflush".equals(actionId)) { handleNotFlushUnknownMessages(wranglerSelection, shell); - } else if (actionId - .equals("org.erlide.wrangler.refactoring.codeinspection.nestedif")) { + } else if ("org.erlide.wrangler.refactoring.codeinspection.nestedif".equals(actionId)) { handleNested(wranglerSelection, shell, "if"); - } else if (actionId - .equals("org.erlide.wrangler.refactoring.codeinspection.nestedcase")) { + } else if ("org.erlide.wrangler.refactoring.codeinspection.nestedcase".equals(actionId)) { handleNested(wranglerSelection, shell, "case"); - } else if (actionId - .equals("org.erlide.wrangler.refactoring.codeinspection.nestedreceive")) { + } else if ("org.erlide.wrangler.refactoring.codeinspection.nestedreceive".equals(actionId)) { handleNested(wranglerSelection, shell, "receive"); - } else if (actionId - .equals("org.erlide.wrangler.refactoring.codeinspection.longfunctions")) { + } else if ("org.erlide.wrangler.refactoring.codeinspection.longfunctions".equals(actionId)) { handleLongFunctions(wranglerSelection, shell); } @@ -264,7 +256,7 @@ private ArrayList processFunctionResult(final Shell shell, final OtpErlangObject obj = result.getValue(); final OtpErlangTuple restuple = (OtpErlangTuple) obj; final OtpErlangAtom resindicator = (OtpErlangAtom) restuple.elementAt(0); - if (resindicator.atomValue().equals("ok")) { + if ("ok".equals(resindicator.atomValue())) { final OtpErlangList erlangFunctionList = (OtpErlangList) restuple .elementAt(1); for (int i = 0; i < erlangFunctionList.arity(); ++i) { @@ -359,7 +351,7 @@ private void handleDepenenciesCall(final IErlSelection wranglerSelection, final OtpErlangObject obj = res.getValue(); final OtpErlangTuple restuple = (OtpErlangTuple) obj; final OtpErlangAtom resindicator = (OtpErlangAtom) restuple.elementAt(0); - if (resindicator.atomValue().equals("ok")) { + if ("ok".equals(resindicator.atomValue())) { final OtpErlangTuple listtuple = (OtpErlangTuple) restuple.elementAt(1); final OtpErlangList modList1 = (OtpErlangList) listtuple.elementAt(0); final OtpErlangList modList2 = (OtpErlangList) listtuple.elementAt(1); @@ -441,7 +433,7 @@ private void handleLargeModulesCall(final IErlSelection wranglerSelection, final OtpErlangObject obj = res.getValue(); final OtpErlangTuple restuple = (OtpErlangTuple) obj; final OtpErlangAtom resindicator = (OtpErlangAtom) restuple.elementAt(0); - if (resindicator.atomValue().equals("ok")) { + if ("ok".equals(resindicator.atomValue())) { final OtpErlangList modList = (OtpErlangList) restuple.elementAt(1); modules = createErlModuleList(modList); diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/PushActionDelegate.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/PushActionDelegate.java index 802aae0cb1..4ea029faf9 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/PushActionDelegate.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.codeinspection/src/org/erlide/wrangler/refactoring/codeinspection/view/PushActionDelegate.java @@ -46,23 +46,23 @@ public void init(final IViewPart viewPart) { public void run(final IAction action) { final String myId = action.getId(); final SWTImageCanvas imageCanvas = view.imageCanvas; - if (myId.equals("toolbar.open")) { + if ("toolbar.open".equals(myId)) { imageCanvas.onFileOpen(); return; } if (imageCanvas.getSourceImage() == null) { return; } - if (myId.equals("toolbar.zoomin")) { + if ("toolbar.zoomin".equals(myId)) { imageCanvas.zoomIn(); return; - } else if (myId.equals("toolbar.zoomout")) { + } else if ("toolbar.zoomout".equals(myId)) { imageCanvas.zoomOut(); return; - } else if (myId.equals("toolbar.fit")) { + } else if ("toolbar.fit".equals(myId)) { imageCanvas.fitCanvas(); return; - } else if (myId.equals("toolbar.rotate")) { + } else if ("toolbar.rotate".equals(myId)) { /* rotate image anti-clockwise */ final ImageData src = imageCanvas.getImageData(); if (src == null) { @@ -88,7 +88,7 @@ public void run(final IAction action) { } imageCanvas.setImageData(dest); return; - } else if (myId.equals("toolbar.original")) { + } else if ("toolbar.original".equals(myId)) { imageCanvas.showOriginal(); return; } diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/DuplicateDetectionAction.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/DuplicateDetectionAction.java index 4ca1a2d29f..bc6e2e0ee8 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/DuplicateDetectionAction.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/DuplicateDetectionAction.java @@ -94,8 +94,7 @@ private String getSuffixPath() throws IOException { } Bundle fragment = null; for (int i = 0; i < bs.length; ++i) { - if (bs[i].getSymbolicName() - .equals("org.erlide.wrangler.refactoring.duplicatedcode")) { + if ("org.erlide.wrangler.refactoring.duplicatedcode".equals(bs[i].getSymbolicName())) { fragment = bs[i]; break; } diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/ExpressionSearchParser.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/ExpressionSearchParser.java index 316b6318bb..3a3e2363aa 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/ExpressionSearchParser.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/ExpressionSearchParser.java @@ -48,7 +48,7 @@ public void parse(final OtpErlangObject object) { try { final OtpErlangTuple res = (OtpErlangTuple) object; - if (!res.elementAt(0).toString().equals("ok")) { + if (!"ok".equals(res.elementAt(0).toString())) { setUnSuccessful(((OtpErlangString) res.elementAt(1)).stringValue()); return; } diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/SimilarExpressionSearchParser.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/SimilarExpressionSearchParser.java index 1a58166845..562ebd536b 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/SimilarExpressionSearchParser.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring.duplicatedcode/src/org/erlide/wrangler/refactoring/duplicatedcode/core/SimilarExpressionSearchParser.java @@ -60,7 +60,7 @@ public SimilarExpressionSearchParser(final OtpErlangObject obj) { public void parse(final OtpErlangObject object) { try { final OtpErlangTuple res = (OtpErlangTuple) object; - if (!res.elementAt(0).toString().equals("ok")) { + if (!"ok".equals(res.elementAt(0).toString())) { setUnSuccessful(((OtpErlangString) res.elementAt(1)).stringValue()); return; } diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/WranglerSyntaxBackend.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/WranglerSyntaxBackend.java index 0fae316057..9dedc9631f 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/WranglerSyntaxBackend.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/WranglerSyntaxBackend.java @@ -55,7 +55,7 @@ protected OtpErlangTuple parseFile(final IFile f) { protected OtpErlangTuple parseParserResult(final OtpErlangObject value) { final OtpErlangTuple backendResult = (OtpErlangTuple) value; - if (!((OtpErlangAtom) backendResult.elementAt(0)).atomValue().equals("ok")) { + if (!"ok".equals(((OtpErlangAtom) backendResult.elementAt(0)).atomValue())) { return null; } final OtpErlangTuple wranglerResult = (OtpErlangTuple) backendResult.elementAt(1); @@ -77,7 +77,7 @@ protected SyntaxInfo varToPos(final OtpErlangTuple syntaxTree, final int line, private SyntaxInfo parseVarInfo(final OtpErlangObject value) { try { final OtpErlangTuple result = (OtpErlangTuple) value; - if (!((OtpErlangAtom) result.elementAt(0)).atomValue().equals("ok")) { + if (!"ok".equals(((OtpErlangAtom) result.elementAt(0)).atomValue())) { return new SyntaxInfo(Type.NONE, -1, -1); } SyntaxInfo ret; diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/ExpressionPosRpcMessage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/ExpressionPosRpcMessage.java index 1258b5a2ff..6023aacd78 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/ExpressionPosRpcMessage.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/ExpressionPosRpcMessage.java @@ -45,7 +45,7 @@ protected void parseRefactoringMessage(final OtpErlangTuple resultTuple) throws WranglerException { try { final OtpErlangObject wranglerResult = resultTuple.elementAt(1); - if (resultTuple.elementAt(0).toString().equals("ok")) { + if ("ok".equals(resultTuple.elementAt(0).toString())) { OtpErlangList posDefList; if (wranglerResult instanceof OtpErlangTuple) { syntaxTree = ((OtpErlangTuple) wranglerResult).elementAt(0); diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/GenFunRefactoringMessage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/GenFunRefactoringMessage.java index ef19a1ac6e..06a07b2dc0 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/GenFunRefactoringMessage.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/GenFunRefactoringMessage.java @@ -57,19 +57,19 @@ protected void parseRefactoringMessage(final OtpErlangTuple resultTuple) throws WranglerException { final OtpErlangObject wranglerResult = resultTuple.elementAt(1); final String state = resultTuple.elementAt(0).toString(); - if (state.equals("ok")) { + if ("ok".equals(state)) { if (wranglerResult instanceof OtpErlangList) { changedFiles = parseFileList((OtpErlangList) wranglerResult); setSuccessful(); return; } - } else if (state.equals("error")) { + } else if ("error".equals(state)) { final OtpErlangString msg = (OtpErlangString) wranglerResult; setUnsuccessful(msg.stringValue()); return; - } else if (state.equals("multiple_instances")) { + } else if ("multiple_instances".equals(state)) { parameters = new HashMap<>(); final OtpErlangTuple pars = (OtpErlangTuple) wranglerResult; setState("", RefactoringState.MULTI_INSTANCES); @@ -82,7 +82,7 @@ protected void parseRefactoringMessage(final OtpErlangTuple resultTuple) parameters.put(GenFunReturnParameterName.dupsInFun, pars.elementAt(6)); parameters.put(GenFunReturnParameterName.logCmd, pars.elementAt(7)); - } else if (state.equals("unknown_side_effect")) { + } else if ("unknown_side_effect".equals(state)) { parameters = new HashMap<>(); final OtpErlangTuple pars = (OtpErlangTuple) wranglerResult; setState("", RefactoringState.UNKNOWN_SIDE_EFFECT); @@ -97,7 +97,7 @@ protected void parseRefactoringMessage(final OtpErlangTuple resultTuple) parameters.put(GenFunReturnParameterName.dupsInClause, pars.elementAt(7)); parameters.put(GenFunReturnParameterName.logCmd, pars.elementAt(8)); - } else if (state.equals("more_than_one_clause")) { + } else if ("more_than_one_clause".equals(state)) { parameters = new HashMap<>(); final OtpErlangTuple pars = (OtpErlangTuple) wranglerResult; setState("", RefactoringState.MORE_THAN_ONE_CLAUSE); diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/ProcessRpcMessage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/ProcessRpcMessage.java index 510defd374..2b6ba301e4 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/ProcessRpcMessage.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/ProcessRpcMessage.java @@ -31,14 +31,14 @@ public class ProcessRpcMessage extends AbstractRefactoringRpcMessage { protected void parseRefactoringMessage(final OtpErlangTuple resultTuple) throws WranglerException { final OtpErlangObject wranglerResult = resultTuple.elementAt(1); - if (resultTuple.elementAt(0).toString().equals("ok")) { + if ("ok".equals(resultTuple.elementAt(0).toString())) { if (wranglerResult instanceof OtpErlangList) { changedFiles = parseFileList((OtpErlangList) wranglerResult); setSuccessful(); return; } - } else if (resultTuple.elementAt(0).toString().equals("undecidables")) { + } else if ("undecidables".equals(resultTuple.elementAt(0).toString())) { hasUndecidables = true; } diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/RefactoringRpcMessage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/RefactoringRpcMessage.java index 91724f6d79..eced31f451 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/RefactoringRpcMessage.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/RefactoringRpcMessage.java @@ -39,7 +39,7 @@ protected void parseRefactoringMessage(final OtpErlangTuple tuple) resultTuple = tuple; final OtpErlangObject wranglerResult = tuple.elementAt(1); - if (tuple.elementAt(0).toString().equals("ok")) { + if ("ok".equals(tuple.elementAt(0).toString())) { if (wranglerResult instanceof OtpErlangList) { changedFiles = parseFileList((OtpErlangList) wranglerResult); @@ -48,9 +48,9 @@ protected void parseRefactoringMessage(final OtpErlangTuple tuple) } } else { final OtpErlangString msg = (OtpErlangString) wranglerResult; - if (tuple.elementAt(0).toString().equals("warning")) { + if ("warning".equals(tuple.elementAt(0).toString())) { setWarning(msg.stringValue()); - } else if (tuple.elementAt(0).toString().equals("question")) { + } else if ("question".equals(tuple.elementAt(0).toString())) { setQuestion(msg.stringValue()); } else { setUnsuccessful(msg.stringValue()); diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/StateDataToRecordRpcMessage.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/StateDataToRecordRpcMessage.java index 7fe7d5835d..b6c0bd3bf4 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/StateDataToRecordRpcMessage.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/StateDataToRecordRpcMessage.java @@ -34,11 +34,11 @@ protected void parseRefactoringMessage(final OtpErlangTuple resultTuple) throws WranglerException { final OtpErlangObject wranglerResult = resultTuple.elementAt(1); - if (!resultTuple.elementAt(0).toString().equals("ok")) { + if (!"ok".equals(resultTuple.elementAt(0).toString())) { final OtpErlangString msg = (OtpErlangString) wranglerResult; setUnsuccessful(msg.stringValue()); } else { - if (wranglerResult.toString().equals("non_tuple")) { + if ("non_tuple".equals(wranglerResult.toString())) { fieldCount = 1; } else { try { diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/WranglerRefactoringBackend.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/WranglerRefactoringBackend.java index 2c4cdd49b0..90ecb793ac 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/WranglerRefactoringBackend.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/backend/internal/WranglerRefactoringBackend.java @@ -159,7 +159,7 @@ public boolean callSimpleInspection(final String functionName, final String sign try { if (res.isOk()) { final OtpErlangAtom b = (OtpErlangAtom) res.getValue(); - return b.atomValue().equals("true") || b.atomValue().equals("ok"); + return "true".equals(b.atomValue()) || "ok".equals(b.atomValue()); } } catch (final Exception e) { ErlLogger.error(e); diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/AddRefacHandler.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/AddRefacHandler.java index fe8f904715..705489b781 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/AddRefacHandler.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/AddRefacHandler.java @@ -114,8 +114,8 @@ private RefacType checkType(final String callbackModule) { for (final IErlElement el : module .getChildrenOfKind(ErlElementKind.ATTRIBUTE)) { final IErlAttribute attr = (IErlAttribute) el; - if (attr.getName().equals("behaviour") - || attr.getName().equals("behavior")) { + if ("behaviour".equals(attr.getName()) + || "behavior".equals(attr.getName())) { if (attr.getValue().toString().contains("gen_refac")) { return RefacType.ELEMENTARY; } else if (attr.getValue().toString() diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/RefactoringHandler.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/RefactoringHandler.java index cbb95a65fe..739844fad7 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/RefactoringHandler.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/RefactoringHandler.java @@ -123,7 +123,7 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { final ArrayList pages = new ArrayList<>(); // apply ad hoc refactoring - if (actionId.equals("org.erlide.wrangler.refactoring.adhoc")) { + if ("org.erlide.wrangler.refactoring.adhoc".equals(actionId)) { final InputDialog dialog = getModuleInput("Apply ad hoc refactoring", "Please type the gen_refac module name!"); @@ -151,7 +151,7 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { } // apply user-defined refactoring - } else if (actionId.equals("org.erlide.wrangler.refactoring.gen_refac")) { + } else if ("org.erlide.wrangler.refactoring.gen_refac".equals(actionId)) { final String callbackModule = event .getParameter("org.erlide.wrangler.refactoring.gen_refac.callback"); final String name = event @@ -170,7 +170,7 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { } // run rename variable refactoring - } else if (actionId.equals("org.erlide.wrangler.refactoring.renamevariable")) { + } else if ("org.erlide.wrangler.refactoring.renamevariable".equals(actionId)) { refactoring = new RenameVariableRefactoring(); final SimpleInputPage page = new SimpleInputPage("Rename variable", "Please type the new variable name!", "New variable name:", @@ -180,8 +180,7 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { pages.add(page); // introduce new variable refactoring - } else if (actionId - .equals("org.erlide.wrangler.refactoring.introducenewvariable")) { + } else if ("org.erlide.wrangler.refactoring.introducenewvariable".equals(actionId)) { pages.add(new SimpleInputPage("Introduce new variable", "Please type the new variable name!", "New variable name:", "New name must be a valid Erlang variable name!", @@ -189,7 +188,7 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { refactoring = new IntroduceNewVariableRefactoring(); // run rename function refactoring - } else if (actionId.equals("org.erlide.wrangler.refactoring.renamefunction")) { + } else if ("org.erlide.wrangler.refactoring.renamefunction".equals(actionId)) { refactoring = new RenameFunctionRefactoring(); final CostumworkFlowInputPage page = new CostumworkFlowInputPage( "Rename function", "Please type the new function name!", @@ -199,14 +198,14 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { pages.add(page); // run extract function refactoring - } else if (actionId.equals("org.erlide.wrangler.refactoring.extractfunction")) { + } else if ("org.erlide.wrangler.refactoring.extractfunction".equals(actionId)) { pages.add(new CostumworkFlowInputPage("Extract function", "Please type a function name!", "Function name:", "Function name must be a valid Erlang atom!", new AtomValidator())); refactoring = new ExtractFunctionRefactoring(); // run rename module refactoring - } else if (actionId.equals("org.erlide.wrangler.refactoring.renamemodule")) { + } else if ("org.erlide.wrangler.refactoring.renamemodule".equals(actionId)) { final boolean answer = MessageDialog.openQuestion( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Warning!", @@ -225,7 +224,7 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { pages.add(page); // run move function refactoring - } else if (actionId.equals("org.erlide.wrangler.refactoring.movefunction")) { + } else if ("org.erlide.wrangler.refactoring.movefunction".equals(actionId)) { final IProject project = ErlangEngine.getInstance().getModelUtilService() .getProject(GlobalParameters.getWranglerSelection().getErlElement()) @@ -241,8 +240,7 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { refactoring = new MoveFunctionRefactoring(); // run fold expression against a local function - } else if (actionId - .equals("org.erlide.wrangler.refactoring.foldlocalexpression")) { + } else if ("org.erlide.wrangler.refactoring.foldlocalexpression".equals(actionId)) { refactoring = new FoldLocalExpressionRefactoring(); @@ -255,7 +253,7 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { } else { final Shell activeShell = PlatformUI.getWorkbench().getDisplay() .getActiveShell(); - if (actionId.equals("org.erlide.wrangler.refactoring.foldremoteexpression")) { + if ("org.erlide.wrangler.refactoring.foldremoteexpression".equals(actionId)) { // must store the selection, because, the user through the // dialog @@ -283,34 +281,31 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { } // run introduce macro refactoring - } else if (actionId - .equals("org.erlide.wrangler.refactoring.introducemacro")) { + } else if ("org.erlide.wrangler.refactoring.introducemacro".equals(actionId)) { refactoring = new IntroduceMacroRefactoring(); pages.add(new SimpleInputPage("Introduce macro definition", "Please type the new macro name!", "New macro name:", "Macro name cannot be empty!", new NonEmptyStringValidator())); // run rename process refactoring - } else if (actionId.equals("org.erlide.wrangler.refactoring.renameprocess")) { + } else if ("org.erlide.wrangler.refactoring.renameprocess".equals(actionId)) { refactoring = new RenameProcessRefactoring(); pages.add(new SimpleInputPage("Rename process", "Please type the new process name!", "New process name:", "New process name must be an Erlang atom!", new AtomValidator())); // run function to process refactoring - } else if (actionId - .equals("org.erlide.wrangler.refactoring.functiontoprocess")) { + } else if ("org.erlide.wrangler.refactoring.functiontoprocess".equals(actionId)) { refactoring = new FunctionToProcessRefactoring(); pages.add(new SimpleInputPage("Convert function to process", "Please type the new process name!", "New process name:", "New process name must be an Erlang atom!", new AtomValidator())); // run tuple function parameters refactoring - } else if (actionId - .equals("org.erlide.wrangler.refactoring.tuplefunctonparameters")) { + } else if ("org.erlide.wrangler.refactoring.tuplefunctonparameters".equals(actionId)) { refactoring = new TupleFunctionParametersRefactoring(); // run generalise function refactoring - } else if (actionId.equals("org.erlide.wrangler.refactoring.generalise")) { + } else if ("org.erlide.wrangler.refactoring.generalise".equals(actionId)) { /* * pages.add(new CostumworkFlowInputPage("Generalise function", * "Please type the new parameter name!", "New parameter name:", @@ -329,8 +324,7 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { } // fold against macro definition - } else if (actionId - .equals("org.erlide.wrangler.refactoring.foldagainstmacro")) { + } else if ("org.erlide.wrangler.refactoring.foldagainstmacro".equals(actionId)) { refactoring = new FoldAgainstMacro(); pages.add(new SelectionInputPage("Fold against macro definition", @@ -339,52 +333,46 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { (CostumWorkflowRefactoringWithPositionsSelection) refactoring)); // normalize record expression - } else if (actionId.equals( - "org.erlide.wrangler.refactoring.normalizerecordexpression")) { + } else if ("org.erlide.wrangler.refactoring.normalizerecordexpression".equals(actionId)) { final boolean showDefaultFields = MessageDialog.openQuestion(activeShell, "Showing defaults", "Show record fields with default values?"); refactoring = new NormalizeRecordExpression(showDefaultFields); - } else if (actionId.equals("org.erlide.wrangler.refactoring.introducelet")) { + } else if ("org.erlide.wrangler.refactoring.introducelet".equals(actionId)) { pages.add(new CostumworkFlowInputPage("Introduce ?LET", "Please type the pattern variable name!", "Pattern variable name:", "New name must be a valid Erlang atom!", new VariableNameValidator())); refactoring = new IntroduceLetRefactoring(); - } else if (actionId.equals("org.erlide.wrangler.refactoring.mergelet")) { + } else if ("org.erlide.wrangler.refactoring.mergelet".equals(actionId)) { refactoring = new MergeLetRefactoring(); pages.add(new SelectionInputPage("Merge ?LET expressions", "Please select expressions which whould be merged!", "Select expressions which should be merged", (CostumWorkflowRefactoringWithPositionsSelection) refactoring)); - } else if (actionId.equals("org.erlide.wrangler.refactoring.mergeforall")) { + } else if ("org.erlide.wrangler.refactoring.mergeforall".equals(actionId)) { refactoring = new MergeForAllRefactoring(); pages.add(new SelectionInputPage("Merge ?FORALL expressions", "Please select expressions which should be merged!", "Select expressions which should be merged", (CostumWorkflowRefactoringWithPositionsSelection) refactoring)); - } else if (actionId - .equals("org.erlide.wrangler.refactoring.eqc_statemtorecord")) { + } else if ("org.erlide.wrangler.refactoring.eqc_statemtorecord".equals(actionId)) { refactoring = new EqcStatemStateDataToRecordRefactoring(); pages.add(new RecordDataInputPage("eqc_statem State Data To Record")); - } else if (actionId - .equals("org.erlide.wrangler.refactoring.eqc_fsmtorecord")) { + } else if ("org.erlide.wrangler.refactoring.eqc_fsmtorecord".equals(actionId)) { refactoring = new EqcFsmStateDataToRecordRefactoring(); pages.add(new RecordDataInputPage("eqc_fsm State Data To Record")); - } else if (actionId - .equals("org.erlide.wrangler.refactoring.gen_fsmtorecord")) { + } else if ("org.erlide.wrangler.refactoring.gen_fsmtorecord".equals(actionId)) { refactoring = new GenFsmStateDataToRecordRefactoring(); pages.add(new RecordDataInputPage("gen_fsm State Data To Record")); - } else if (actionId.equals( - "org.erlide.wrangler.refactoring.unfoldfunctionapplication")) { + } else if ("org.erlide.wrangler.refactoring.unfoldfunctionapplication".equals(actionId)) { refactoring = new UnfoldFunctionApplicationRefactoring(); - } else if (actionId - .equals("org.erlide.wrangler.refactoring.partitionexports")) { + } else if ("org.erlide.wrangler.refactoring.partitionexports".equals(actionId)) { refactoring = new PartitionExportsRefactoring(); final SimpleInputPage page = new SimpleInputPage("Partition exports", "Please input the the distance treshould between 0.1 and 1.0", diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/WranglerTester.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/WranglerTester.java index c75d0daacb..87efc6c0c8 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/WranglerTester.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/WranglerTester.java @@ -32,7 +32,7 @@ public WranglerTester() { @Override public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) { - if (property.equals("hasQuickCheck")) { + if ("hasQuickCheck".equals(property)) { return true;// GlobalParameters.hasQuickCheck(); } else if ("hasGraphViz".equals(property)) { diff --git a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/NonEmptyStringValidator.java b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/NonEmptyStringValidator.java index 240070e82c..85b5f8f978 100644 --- a/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/NonEmptyStringValidator.java +++ b/extras/wrangler/plugins/org.erlide.wrangler.refactoring/src/org/erlide/wrangler/refactoring/ui/validator/NonEmptyStringValidator.java @@ -20,7 +20,7 @@ public class NonEmptyStringValidator implements IValidator { @Override public boolean isValid(final String text) { - return !text.equals(""); + return !"".equals(text); } } diff --git a/libs/com.ericsson.otp.jinterface/src/com/ericsson/otp/erlang/AbstractConnection.java b/libs/com.ericsson.otp.jinterface/src/com/ericsson/otp/erlang/AbstractConnection.java index fc668a883f..0368df15d8 100644 --- a/libs/com.ericsson.otp.jinterface/src/com/ericsson/otp/erlang/AbstractConnection.java +++ b/libs/com.ericsson.otp.jinterface/src/com/ericsson/otp/erlang/AbstractConnection.java @@ -565,7 +565,7 @@ public void run() { cookieError(localNode, cookie); } } else { - if (!cookie.atomValue().equals("")) { + if (!"".equals(cookie.atomValue())) { cookieError(localNode, cookie); } } @@ -607,7 +607,7 @@ public void run() { cookieError(localNode, cookie); } } else { - if (!cookie.atomValue().equals("")) { + if (!"".equals(cookie.atomValue())) { cookieError(localNode, cookie); } } diff --git a/libs/com.ericsson.otp.jinterface/src/com/ericsson/otp/erlang/OtpInputStream.java b/libs/com.ericsson.otp.jinterface/src/com/ericsson/otp/erlang/OtpInputStream.java index f4ddbb796c..be4b178a13 100644 --- a/libs/com.ericsson.otp.jinterface/src/com/ericsson/otp/erlang/OtpInputStream.java +++ b/libs/com.ericsson.otp.jinterface/src/com/ericsson/otp/erlang/OtpInputStream.java @@ -529,7 +529,7 @@ public double read_double() throws OtpErlangDecodeException { // remove the sign from the exponent, if positive String estr = str.substring(epos + 1).trim(); - if (estr.substring(0, 1).equals("+")) { + if ("+".equals(estr.substring(0, 1))) { estr = estr.substring(1); } diff --git a/libs/com.ericsson.otp.jinterface/src/com/ericsson/otp/erlang/OtpNode.java b/libs/com.ericsson.otp.jinterface/src/com/ericsson/otp/erlang/OtpNode.java index 86636ccef1..70078674ad 100644 --- a/libs/com.ericsson.otp.jinterface/src/com/ericsson/otp/erlang/OtpNode.java +++ b/libs/com.ericsson.otp.jinterface/src/com/ericsson/otp/erlang/OtpNode.java @@ -515,7 +515,7 @@ boolean deliver(final OtpMsg m) { if (t == OtpMsg.regSendTag) { final String name = m.getRecipientName(); /* special case for netKernel requests */ - if (name.equals("net_kernel")) { + if ("net_kernel".equals(name)) { return netKernel(m); } mbox = mboxes.get(name); diff --git a/plugins/org.erlide.backend/src/org/erlide/backend/api/BackendData.java b/plugins/org.erlide.backend/src/org/erlide/backend/api/BackendData.java index d4066adc6d..186bbe64f5 100644 --- a/plugins/org.erlide.backend/src/org/erlide/backend/api/BackendData.java +++ b/plugins/org.erlide.backend/src/org/erlide/backend/api/BackendData.java @@ -92,7 +92,7 @@ public BackendData(@NonNull final RuntimeInfo info, runtimeInfo = new RuntimeInfo.Builder(info).withArgs(extraArgs).build(); } try { - if (config.getAttribute(ErlRuntimeAttributes.EXTRA_ARGS, "").equals("")) { + if ("".equals(config.getAttribute(ErlRuntimeAttributes.EXTRA_ARGS, ""))) { setExtraArgs(info.getArgs()); } } catch (final CoreException e) { diff --git a/plugins/org.erlide.backend/src/org/erlide/backend/debug/ErlideDebug.java b/plugins/org.erlide.backend/src/org/erlide/backend/debug/ErlideDebug.java index b9879711ad..8c028c6238 100644 --- a/plugins/org.erlide.backend/src/org/erlide/backend/debug/ErlideDebug.java +++ b/plugins/org.erlide.backend/src/org/erlide/backend/debug/ErlideDebug.java @@ -132,7 +132,7 @@ public static boolean interpret(final IOtpRpc backend, final String moduleName, final OtpErlangObject o = t.elementAt(0); if (o instanceof OtpErlangAtom) { final OtpErlangAtom moduleAtom = (OtpErlangAtom) o; - return moduleAtom.atomValue().equals("module"); + return "module".equals(moduleAtom.atomValue()); } } return Util.isOk(res); diff --git a/plugins/org.erlide.backend/src/org/erlide/backend/debug/events/DebuggerEventFactory.java b/plugins/org.erlide.backend/src/org/erlide/backend/debug/events/DebuggerEventFactory.java index 49edc9c4da..ebde64f2e7 100644 --- a/plugins/org.erlide.backend/src/org/erlide/backend/debug/events/DebuggerEventFactory.java +++ b/plugins/org.erlide.backend/src/org/erlide/backend/debug/events/DebuggerEventFactory.java @@ -97,15 +97,15 @@ private static DebuggerEvent buildIntEvent(final OtpBindings b) { try { final OtpErlangObject[] cmds = b.getTuple("Cmd"); final String cmd = ((OtpErlangAtom) cmds[0]).atomValue(); - if (cmd.equals("new_break")) { + if ("new_break".equals(cmd)) { return new NewBreakEvent(cmds); - } else if (cmd.equals("new_status")) { + } else if ("new_status".equals(cmd)) { return new NewStatusEvent(cmds); - } else if (cmd.equals("new_process")) { + } else if ("new_process".equals(cmd)) { return new NewProcessEvent(cmds); - } else if (cmd.equals("interpret")) { + } else if ("interpret".equals(cmd)) { return new InterpretEvent(cmds); - } else if (cmd.equals("no_interpret")) { + } else if ("no_interpret".equals(cmd)) { return new NoInterpretEvent(cmds); } else { return new IntEvent(cmds); diff --git a/plugins/org.erlide.backend/src/org/erlide/backend/debug/events/NewStatusEvent.java b/plugins/org.erlide.backend/src/org/erlide/backend/debug/events/NewStatusEvent.java index 85b3e56551..40a473338a 100644 --- a/plugins/org.erlide.backend/src/org/erlide/backend/debug/events/NewStatusEvent.java +++ b/plugins/org.erlide.backend/src/org/erlide/backend/debug/events/NewStatusEvent.java @@ -20,13 +20,13 @@ public void execute(final ErlangDebugTarget debugTarget) { final ErlangProcess erlangProcess = debugTarget.getOrCreateErlangProcess(pid); final OtpErlangAtom sa = (OtpErlangAtom) cmds[2]; final String status = sa.atomValue(); - if (status.equals("break")) { + if ("break".equals(status)) { handleBreakStatus(erlangProcess, status); - } else if (status.equals("exit")) { + } else if ("exit".equals(status)) { handleExitStatus(erlangProcess, status); - } else if (status.equals("running")) { + } else if ("running".equals(status)) { handleRunningStatus(erlangProcess, status); - } else if (status.equals("idle")) { + } else if ("idle".equals(status)) { handleIdleStatus(erlangProcess, status); } else { erlangProcess.setStatus(status); diff --git a/plugins/org.erlide.backend/src/org/erlide/backend/internal/ErlangCode.java b/plugins/org.erlide.backend/src/org/erlide/backend/internal/ErlangCode.java index e171aed2dd..18a32a6da1 100644 --- a/plugins/org.erlide.backend/src/org/erlide/backend/internal/ErlangCode.java +++ b/plugins/org.erlide.backend/src/org/erlide/backend/internal/ErlangCode.java @@ -82,7 +82,7 @@ public static boolean isEmbedded(final IOtpRpc backend) { final OtpErlangObject r = backend.call(CODE, "ensure_loaded", "a", "funny_module_name_that_nobody_would_use"); final OtpBindings b = OtpErlang.match("{error, What}", r); - if (b.getAtom("What").equals("embedded")) { + if ("embedded".equals(b.getAtom("What"))) { return true; } } catch (final Exception e) { diff --git a/plugins/org.erlide.backend/src/org/erlide/backend/launch/ErlangLaunchDelegate.java b/plugins/org.erlide.backend/src/org/erlide/backend/launch/ErlangLaunchDelegate.java index 815aa66d81..2edd5880ca 100644 --- a/plugins/org.erlide.backend/src/org/erlide/backend/launch/ErlangLaunchDelegate.java +++ b/plugins/org.erlide.backend/src/org/erlide/backend/launch/ErlangLaunchDelegate.java @@ -93,7 +93,7 @@ private String getDefaultNodeNameFromProjects(ILaunchConfiguration config, Strin */ protected BackendData configureBackend(final BackendData data, final String mode, final ILaunch launch) { data.setLaunch(launch); - if (mode.equals("debug")) { + if ("debug".equals(mode)) { data.setContext(CodeContext.DEBUGGER); } return data; diff --git a/plugins/org.erlide.core/src/org/erlide/core/internal/builder/ErlcMessageParser.java b/plugins/org.erlide.core/src/org/erlide/core/internal/builder/ErlcMessageParser.java index b600c06a69..dead5edb16 100644 --- a/plugins/org.erlide.core/src/org/erlide/core/internal/builder/ErlcMessageParser.java +++ b/plugins/org.erlide.core/src/org/erlide/core/internal/builder/ErlcMessageParser.java @@ -28,7 +28,7 @@ public ErlcMessageParser(final IProject project) { public boolean createMarkers(final String msg) { boolean result = false; final Iterable pars = Splitter.on(':').limit(3).split(msg); - if (pars.iterator().next().equals("ERROR")) { + if ("ERROR".equals(pars.iterator().next())) { MarkerUtils.createProblemMarker(project, null, pars.iterator().next(), -1, IMarker.SEVERITY_ERROR); result = true; diff --git a/plugins/org.erlide.core/src/org/erlide/core/internal/builder/InternalBuilder.java b/plugins/org.erlide.core/src/org/erlide/core/internal/builder/InternalBuilder.java index 0d7ec8cfbb..25b38a14ed 100644 --- a/plugins/org.erlide.core/src/org/erlide/core/internal/builder/InternalBuilder.java +++ b/plugins/org.erlide.core/src/org/erlide/core/internal/builder/InternalBuilder.java @@ -326,7 +326,7 @@ private boolean ignoreModule(final IErlProject erlangProject, final IErlModule m boolean result = false; result |= m.getSourceKind() != SourceKind.ERL; result |= !isModuleOnDirectSourcePath(erlangProject, m); - result |= m.getResource().getProjectRelativePath().segment(0).equals("deps"); + result |= "deps".equals(m.getResource().getProjectRelativePath().segment(0)); if (result) { ErlLogger.debug(".app: ignore " + m.getResource().getProjectRelativePath()); } diff --git a/plugins/org.erlide.cover.core/src/org/erlide/cover/core/EUnitEventHandler.java b/plugins/org.erlide.cover.core/src/org/erlide/cover/core/EUnitEventHandler.java index 5b9c8ed7f4..6ce7c34487 100644 --- a/plugins/org.erlide.cover.core/src/org/erlide/cover/core/EUnitEventHandler.java +++ b/plugins/org.erlide.cover.core/src/org/erlide/cover/core/EUnitEventHandler.java @@ -93,7 +93,7 @@ private void handle_group_begin(final OtpErlangTuple msg) { final String group = msg.elementAt(1).toString(); final String description = msg.elementAt(2).toString(); - if (group != null && !group.equals("[]") && !group.equals("undefined")) { + if (group != null && !"[]".equals(group) && !"undefined".equals(group)) { TestTreeObject node = model.findNode(description); TestTreeObject parent = model.findNode(group); @@ -122,8 +122,8 @@ private void handle_group_canceled(final OtpErlangTuple msg) { final String description = msg.elementAt(1).toString(); final String reason = msg.elementAt(2).toString(); - if (description != null && !description.equals("[]") - && !description.equals("undefined")) { + if (description != null && !"[]".equals(description) + && !"undefined".equals(description)) { final TestTreeObject node = model.findNode(description); node.setDescription( String.format("%s ... canceled: %s", node.getDescription(), reason)); @@ -279,7 +279,7 @@ private String makeTestShortDescription(final String module, final String functi private String makeTestFullDescription(final String module, final String function, final int arity, final String description, final int line, final String status) { - if (description != null && !description.equals("undefined")) { + if (description != null && !"undefined".equals(description)) { return String.format("%s:%s/%d (%s) at line %d - %s", module, function, arity, description, line, status); } diff --git a/plugins/org.erlide.cover.ui/src/org/erlide/cover/ui/launch/CoverTabGroup.java b/plugins/org.erlide.cover.ui/src/org/erlide/cover/ui/launch/CoverTabGroup.java index 1bca8ff91a..b5cf8305e4 100644 --- a/plugins/org.erlide.cover.ui/src/org/erlide/cover/ui/launch/CoverTabGroup.java +++ b/plugins/org.erlide.cover.ui/src/org/erlide/cover/ui/launch/CoverTabGroup.java @@ -34,7 +34,7 @@ public void createTabs(final ILaunchConfigurationDialog dialog, final String mod private Collection createMyTabs( final ILaunchConfigurationDialog dialog, final String mode) { ILaunchConfigurationTab[] tabs; - if (mode.equals("debug")) { + if ("debug".equals(mode)) { tabs = new ILaunchConfigurationTab[] { new CoverMainTab(), new DebugTab(), new CodepathTab() }; } else { diff --git a/plugins/org.erlide.model.api/src/org/erlide/engine/model/erlang/SourceKind.java b/plugins/org.erlide.model.api/src/org/erlide/engine/model/erlang/SourceKind.java index 58f2138fcb..c878059c5f 100644 --- a/plugins/org.erlide.model.api/src/org/erlide/engine/model/erlang/SourceKind.java +++ b/plugins/org.erlide.model.api/src/org/erlide/engine/model/erlang/SourceKind.java @@ -10,13 +10,13 @@ public static SourceKind extensionToModuleKind(final String ext) { if (ext == null) { return BAD; } - if (ext.equalsIgnoreCase("hrl")) { + if ("hrl".equalsIgnoreCase(ext)) { return HRL; } - if (ext.equalsIgnoreCase("erl")) { + if ("erl".equalsIgnoreCase(ext)) { return ERL; } - if (ext.equalsIgnoreCase("yrl")) { + if ("yrl".equalsIgnoreCase(ext)) { return YRL; } return BAD; diff --git a/plugins/org.erlide.model.api/src/org/erlide/engine/services/parsing/ErlToken.java b/plugins/org.erlide.model.api/src/org/erlide/engine/services/parsing/ErlToken.java index 4a03bd9f2f..a2ce775e2a 100644 --- a/plugins/org.erlide.model.api/src/org/erlide/engine/services/parsing/ErlToken.java +++ b/plugins/org.erlide.model.api/src/org/erlide/engine/services/parsing/ErlToken.java @@ -65,7 +65,7 @@ public ErlToken(final OtpErlangTuple e) { } final OtpErlangObject[] parts = e.elements(); - if (((OtpErlangAtom) parts[0]).atomValue().equals("token") && parts.length == 9) { + if ("token".equals(((OtpErlangAtom) parts[0]).atomValue()) && parts.length == 9) { // -record(token, {kind, line, offset, length, value, text}). kind = KIND_OTHER; diff --git a/plugins/org.erlide.model.api/src/org/erlide/engine/util/CommonUtils.java b/plugins/org.erlide.model.api/src/org/erlide/engine/util/CommonUtils.java index d0592620fa..fbd671a254 100644 --- a/plugins/org.erlide.model.api/src/org/erlide/engine/util/CommonUtils.java +++ b/plugins/org.erlide.model.api/src/org/erlide/engine/util/CommonUtils.java @@ -24,7 +24,7 @@ public static boolean isErlangFileContentFileName(final String fileName) { final IContentType[] contentTypes = contentTypeManager .findContentTypesFor(fileName); for (final IContentType contentType : contentTypes) { - if (contentType.getId().equals("org.erlide.core.content.erlang")) { + if ("org.erlide.core.content.erlang".equals(contentType.getId())) { return true; } } diff --git a/plugins/org.erlide.model.api/src/org/erlide/engine/util/ErlideTestUtils.java b/plugins/org.erlide.model.api/src/org/erlide/engine/util/ErlideTestUtils.java index 332b46e59c..460a567d75 100644 --- a/plugins/org.erlide.model.api/src/org/erlide/engine/util/ErlideTestUtils.java +++ b/plugins/org.erlide.model.api/src/org/erlide/engine/util/ErlideTestUtils.java @@ -135,7 +135,7 @@ private static void buildPaths(final IWorkspaceRoot root, final IProject project final IPath projectPath = project.getFullPath(); for (final IPath pp : list) { // only create in-project paths - if (!pp.isAbsolute() && !pp.toString().equals(".") && !pp.isEmpty()) { + if (!pp.isAbsolute() && !".".equals(pp.toString()) && !pp.isEmpty()) { final IPath path = projectPath.append(pp); final IFolder folder = root.getFolder(path); createFolderHelper(folder); diff --git a/plugins/org.erlide.model/src/org/erlide/engine/internal/model/root/ErlFolder.java b/plugins/org.erlide.model/src/org/erlide/engine/internal/model/root/ErlFolder.java index e5db8aa9fc..21a23f01a4 100644 --- a/plugins/org.erlide.model/src/org/erlide/engine/internal/model/root/ErlFolder.java +++ b/plugins/org.erlide.model/src/org/erlide/engine/internal/model/root/ErlFolder.java @@ -114,7 +114,7 @@ public static boolean isOnPaths(final IContainer container, final IContainer pro final Collection paths) { final IPath containerPath = container.getFullPath(); for (final IPath path : paths) { - if (path.toString().equals(".")) { + if (".".equals(path.toString())) { if (project.getFullPath().equals(containerPath)) { return true; } diff --git a/plugins/org.erlide.model/src/org/erlide/engine/internal/model/root/ErlModule.java b/plugins/org.erlide.model/src/org/erlide/engine/internal/model/root/ErlModule.java index 99a92cfeb3..a38265e7ad 100644 --- a/plugins/org.erlide.model/src/org/erlide/engine/internal/model/root/ErlModule.java +++ b/plugins/org.erlide.model/src/org/erlide/engine/internal/model/root/ErlModule.java @@ -580,7 +580,7 @@ public boolean exportsAllFunctions() { for (final IErlElement e : getChildrenOfKind(ErlElementKind.ATTRIBUTE)) { if (e instanceof IErlAttribute) { final IErlAttribute attr = (IErlAttribute) e; - if (attr.getName().equals("compile")) { + if ("compile".equals(attr.getName())) { final OtpErlangObject value = attr.getValue(); if (value != null && value.equals(EXPORT_ALL)) { return true; diff --git a/plugins/org.erlide.model/src/org/erlide/engine/internal/model/root/ErlOtpExternalReferenceEntryList.java b/plugins/org.erlide.model/src/org/erlide/engine/internal/model/root/ErlOtpExternalReferenceEntryList.java index 497b460395..9514e5fc71 100644 --- a/plugins/org.erlide.model/src/org/erlide/engine/internal/model/root/ErlOtpExternalReferenceEntryList.java +++ b/plugins/org.erlide.model/src/org/erlide/engine/internal/model/root/ErlOtpExternalReferenceEntryList.java @@ -118,7 +118,7 @@ private void mkOtpStructureMap(final OtpErlangList input) { private final boolean includePath(final String path) { final IPath p = new Path(path); - return p.lastSegment().equals("include"); + return "include".equals(p.lastSegment()); } private String getLibName(final String libDir) { diff --git a/plugins/org.erlide.model/src/org/erlide/engine/internal/services/codeassist/ErlangCompletionService.java b/plugins/org.erlide.model/src/org/erlide/engine/internal/services/codeassist/ErlangCompletionService.java index e6e1748862..dfe92b022d 100644 --- a/plugins/org.erlide.model/src/org/erlide/engine/internal/services/codeassist/ErlangCompletionService.java +++ b/plugins/org.erlide.model/src/org/erlide/engine/internal/services/codeassist/ErlangCompletionService.java @@ -155,9 +155,9 @@ public List computeCompletions(final IOtpRpc backend, } break; case ATTRIBUTE: - if (element.getName().equals("include")) { + if ("include".equals(element.getName())) { flags = EnumSet.of(CompletionFlag.INCLUDES); - } else if (element.getName().equals("include_lib")) { + } else if ("include_lib".equals(element.getName())) { flags = EnumSet.of(CompletionFlag.INCLUDE_LIBS); } break; @@ -550,7 +550,7 @@ private void addParametersFromFunctionParameters(final List parameters, final List result) { final int n = Math.min(parameters.size(), result.size()); for (int i = 0; i < n; ++i) { - if (result.get(i).equals("_")) { + if ("_".equals(result.get(i))) { final String var = parameters.get(i).trim(); if (looksLikeParameter(var)) { result.set(i, fixVarName(var)); diff --git a/plugins/org.erlide.model/src/org/erlide/engine/internal/services/search/ErlideOpen.java b/plugins/org.erlide.model/src/org/erlide/engine/internal/services/search/ErlideOpen.java index b83bb45a2c..8e00ea7501 100644 --- a/plugins/org.erlide.model/src/org/erlide/engine/internal/services/search/ErlideOpen.java +++ b/plugins/org.erlide.model/src/org/erlide/engine/internal/services/search/ErlideOpen.java @@ -123,7 +123,7 @@ public List getExternalModuleTree(final IOtpRpc backend, final String path = Util.stringValue(t.elementAt(1)); final OtpErlangAtom isModuleA = (OtpErlangAtom) t.elementAt(2); result.add(new ExternalTreeEntry(new Path(parentPath), new Path(path), - isModuleA.atomValue().equals("module"))); + "module".equals(isModuleA.atomValue()))); } final String msg = "open:external_module_tree <- " + stopwatch; if (stopwatch.elapsed(TimeUnit.SECONDS) > 5) { diff --git a/plugins/org.erlide.runtime/src/org/erlide/runtime/api/RuntimeData.java b/plugins/org.erlide.runtime/src/org/erlide/runtime/api/RuntimeData.java index 4ed911db63..03b41caeb2 100644 --- a/plugins/org.erlide.runtime/src/org/erlide/runtime/api/RuntimeData.java +++ b/plugins/org.erlide.runtime/src/org/erlide/runtime/api/RuntimeData.java @@ -240,7 +240,7 @@ public String[] getCmdLine() { result.add("-noshell"); } - if (!getNodeName().equals("")) { + if (!"".equals(getNodeName())) { final String nameTag = hasLongName() ? "-name" : "-sname"; String nameOption = getNodeName(); if (!nameOption.contains("@")) { diff --git a/plugins/org.erlide.runtime/src/org/erlide/runtime/internal/EventParser.java b/plugins/org.erlide.runtime/src/org/erlide/runtime/internal/EventParser.java index 65c2d1e5e1..d94dd3bfea 100644 --- a/plugins/org.erlide.runtime/src/org/erlide/runtime/internal/EventParser.java +++ b/plugins/org.erlide.runtime/src/org/erlide/runtime/internal/EventParser.java @@ -27,7 +27,7 @@ public boolean isEventMessage(final OtpErlangObject msg) { try { final OtpErlangTuple tmsg = (OtpErlangTuple) msg; final OtpErlangObject el0 = tmsg.elementAt(0); - return ((OtpErlangAtom) el0).atomValue().equals("event") && tmsg.arity() == 4; + return "event".equals(((OtpErlangAtom) el0).atomValue()) && tmsg.arity() == 4; } catch (final Exception e) { return false; } diff --git a/plugins/org.erlide.tracing.core/src/org/erlide/tracing/core/TraceBackend.java b/plugins/org.erlide.tracing.core/src/org/erlide/tracing/core/TraceBackend.java index 777db18d0a..c521c547ec 100644 --- a/plugins/org.erlide.tracing.core/src/org/erlide/tracing/core/TraceBackend.java +++ b/plugins/org.erlide.tracing.core/src/org/erlide/tracing/core/TraceBackend.java @@ -212,7 +212,7 @@ public TracingStatus start() { private TracingStatus processResult(final OtpErlangObject callResult) { final OtpErlangTuple tuple = (OtpErlangTuple) callResult; - if (((OtpErlangAtom) tuple.elementAt(0)).atomValue().equals("error")) { + if ("error".equals(((OtpErlangAtom) tuple.elementAt(0)).atomValue())) { errorObject = tuple.elementAt(1); return TracingStatus.ERROR; } diff --git a/plugins/org.erlide.tracing.core/src/org/erlide/tracing/core/mvc/view/MatchSpecCellEditor.java b/plugins/org.erlide.tracing.core/src/org/erlide/tracing/core/mvc/view/MatchSpecCellEditor.java index 799209b771..bb1798ea3b 100644 --- a/plugins/org.erlide.tracing.core/src/org/erlide/tracing/core/mvc/view/MatchSpecCellEditor.java +++ b/plugins/org.erlide.tracing.core/src/org/erlide/tracing/core/mvc/view/MatchSpecCellEditor.java @@ -78,7 +78,7 @@ public String isValid(final String newText) { final OtpErlangTuple tuple = (OtpErlangTuple) backend.call( Constants.ERLANG_HELPER_MODULE, Constants.FUN_STR2MS, "s", new OtpErlangString(newText)); - if (((OtpErlangAtom) tuple.elementAt(0)).atomValue().equals("ok")) { + if ("ok".equals(((OtpErlangAtom) tuple.elementAt(0)).atomValue())) { // correct match spec - update ((MatchSpec) getValue()).setFunctionString(newText); ((MatchSpec) getValue()).setMsObject(tuple.elementAt(1)); @@ -86,7 +86,7 @@ public String isValid(final String newText) { } // incorrect match spec final OtpErlangAtom errorType = (OtpErlangAtom) tuple.elementAt(1); - if (errorType.atomValue().equals("standard_info")) { + if ("standard_info".equals(errorType.atomValue())) { final OtpErlangTuple errorTuple = (OtpErlangTuple) tuple.elementAt(2); final StringBuilder builder = new StringBuilder("Line "); builder.append(errorTuple.elementAt(0)).append(": "); @@ -99,9 +99,9 @@ public String isValid(final String newText) { ((OtpErlangString) errorList.elementAt(1)).stringValue()); } return builder.toString(); - } else if (errorType.atomValue().equals("not_fun")) { + } else if ("not_fun".equals(errorType.atomValue())) { return "Given expression is not a function"; - } else if (errorType.atomValue().equals("unbound_var")) { + } else if ("unbound_var".equals(errorType.atomValue())) { final StringBuilder builder = new StringBuilder("Unbound variable: "); builder.append(tuple.elementAt(2)); return builder.toString(); diff --git a/plugins/org.erlide.ui/src/org/erlide/ui/editors/erl/ErlangEditor.java b/plugins/org.erlide.ui/src/org/erlide/ui/editors/erl/ErlangEditor.java index ec99ce75a3..8d8d20698d 100644 --- a/plugins/org.erlide.ui/src/org/erlide/ui/editors/erl/ErlangEditor.java +++ b/plugins/org.erlide.ui/src/org/erlide/ui/editors/erl/ErlangEditor.java @@ -222,7 +222,7 @@ class PreferenceChangeListener implements IPreferenceChangeListener { public void preferenceChange(final PreferenceChangeEvent event) { final String key = event.getKey(); if ("markingOccurences".equals(key)) { - final boolean newBooleanValue = event.getNewValue().equals("true"); + final boolean newBooleanValue = "true".equals(event.getNewValue()); markOccurencesHandler.setEnabled(newBooleanValue); } } @@ -933,8 +933,8 @@ private IllegalArgumentException filterUTF8Exception(final IllegalArgumentExcept if (filterIt) { break; } - if (!element.getClassName().equals("org.eclipse.swt.SWT")) { - filterIt = element.getClassName().equals("org.eclipse.swt.custom.StyledText") && element.getMethodName().equals("setStyleRanges"); + if (!"org.eclipse.swt.SWT".equals(element.getClassName())) { + filterIt = "org.eclipse.swt.custom.StyledText".equals(element.getClassName()) && "setStyleRanges".equals(element.getMethodName()); } } if (filterIt) { diff --git a/plugins/org.erlide.ui/src/org/erlide/ui/editors/erl/handlers/ExpandCollapseAllHandler.java b/plugins/org.erlide.ui/src/org/erlide/ui/editors/erl/handlers/ExpandCollapseAllHandler.java index 2c64652dd2..01d68df329 100644 --- a/plugins/org.erlide.ui/src/org/erlide/ui/editors/erl/handlers/ExpandCollapseAllHandler.java +++ b/plugins/org.erlide.ui/src/org/erlide/ui/editors/erl/handlers/ExpandCollapseAllHandler.java @@ -16,12 +16,10 @@ public Object execute(final ExecutionEvent event) throws ExecutionException { return null; } final ErlangEditor editor = (ErlangEditor) activeEditor; - final boolean collapse = event - .getParameter("org.erlide.ui.commands.expandCollapseParameter") - .equals("collapse"); - final boolean comments = event - .getParameter("org.erlide.ui.commands.foldWhatParameter") - .equals("comments"); + final boolean collapse = "collapse".equals(event + .getParameter("org.erlide.ui.commands.expandCollapseParameter")); + final boolean comments = "comments".equals(event + .getParameter("org.erlide.ui.commands.foldWhatParameter")); editor.expandCollapseFunctionsOrComments(collapse, comments); return null; } diff --git a/plugins/org.erlide.ui/src/org/erlide/ui/launch/RuntimeTab.java b/plugins/org.erlide.ui/src/org/erlide/ui/launch/RuntimeTab.java index ccbfd1eec7..adc050dd9a 100644 --- a/plugins/org.erlide.ui/src/org/erlide/ui/launch/RuntimeTab.java +++ b/plugins/org.erlide.ui/src/org/erlide/ui/launch/RuntimeTab.java @@ -351,7 +351,7 @@ public boolean isValid(final ILaunchConfiguration config) { return false; } String workingDir = workingDirText.getText(); - if (workingDir.equals(".")) { + if (".".equals(workingDir)) { workingDir = ""; } final File d = new File(workingDir); diff --git a/plugins/org.erlide.ui/src/org/erlide/ui/prefs/AddRuntimeDialog.java b/plugins/org.erlide.ui/src/org/erlide/ui/prefs/AddRuntimeDialog.java index 43e48600d3..15fe6d4597 100644 --- a/plugins/org.erlide.ui/src/org/erlide/ui/prefs/AddRuntimeDialog.java +++ b/plugins/org.erlide.ui/src/org/erlide/ui/prefs/AddRuntimeDialog.java @@ -412,7 +412,7 @@ protected void browseForInstallDir() { if (newPath != null) { fOtpHome.setText(newPath); final File f = new File(newPath); - if (fName.getText().equals("")) { + if ("".equals(fName.getText())) { fName.setText(f.getName()); } } diff --git a/plugins/org.erlide.ui/src/org/erlide/ui/prefs/plugin/ErlidePreferencePage.java b/plugins/org.erlide.ui/src/org/erlide/ui/prefs/plugin/ErlidePreferencePage.java index 3f664c8e71..0686001eb2 100644 --- a/plugins/org.erlide.ui/src/org/erlide/ui/prefs/plugin/ErlidePreferencePage.java +++ b/plugins/org.erlide.ui/src/org/erlide/ui/prefs/plugin/ErlidePreferencePage.java @@ -170,7 +170,7 @@ protected void putBooleanPreferences(final String[] keys, protected void setToDefaults(final String[] keys, final String[] defaults, final List