diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/utils/BackgroundUtils.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/utils/BackgroundUtils.java index dde7f01ec0..42348d9874 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/utils/BackgroundUtils.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/utils/BackgroundUtils.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -233,7 +233,8 @@ public enum BackgroundUtils { } protected void executeBackground(Runnable command) { - BackgroundCommand cmd = new BackgroundCommand(name, opts.contains(TaskOpt.HAS_PROGRESS), + BackgroundCommand cmd = + new BackgroundCommand<>(name, opts.contains(TaskOpt.HAS_PROGRESS), opts.contains(TaskOpt.CAN_CANCEL), opts.contains(TaskOpt.IS_MODAL)) { @Override public boolean applyTo(DomainObject obj, TaskMonitor monitor) { diff --git a/Ghidra/Features/Base/ghidra_scripts/AutoRenameLabelsScript.java b/Ghidra/Features/Base/ghidra_scripts/AutoRenameLabelsScript.java index 9af7b67f5b..3a0fc8c388 100644 --- a/Ghidra/Features/Base/ghidra_scripts/AutoRenameLabelsScript.java +++ b/Ghidra/Features/Base/ghidra_scripts/AutoRenameLabelsScript.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,6 +21,7 @@ import ghidra.app.cmd.label.RenameLabelCmd; import ghidra.app.script.GhidraScript; import ghidra.framework.cmd.CompoundCmd; import ghidra.program.model.address.*; +import ghidra.program.model.listing.Program; import ghidra.program.model.symbol.*; public class AutoRenameLabelsScript extends GhidraScript { @@ -45,7 +46,7 @@ public class AutoRenameLabelsScript extends GhidraScript { SymbolTable symbolTable = currentProgram.getSymbolTable(); AddressIterator it = view.getAddresses(true); - CompoundCmd cmd = new CompoundCmd("Auto Rename Labels"); + CompoundCmd cmd = new CompoundCmd<>("Auto Rename Labels"); while (it.hasNext()) { Address address = it.next(); Symbol primary = symbolTable.getPrimarySymbol(address); diff --git a/Ghidra/Features/Base/ghidra_scripts/SetEquateScript.java b/Ghidra/Features/Base/ghidra_scripts/SetEquateScript.java index bc6aad7afb..f289e628bb 100644 --- a/Ghidra/Features/Base/ghidra_scripts/SetEquateScript.java +++ b/Ghidra/Features/Base/ghidra_scripts/SetEquateScript.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -83,7 +83,7 @@ public class SetEquateScript extends GhidraScript { // looking for was found // Sets the equate to the user defined name and execute - Command cmd = + Command cmd = new SetEquateCmd(equateName, tempValue.getAddress(), i, scalarValue); state.getTool().execute(cmd, currentProgram); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clear/ClearPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clear/ClearPlugin.java index bdd9ab1002..32a0e9a658 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clear/ClearPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clear/ClearPlugin.java @@ -113,7 +113,7 @@ public class ClearPlugin extends Plugin { } CodeUnit cu = program.getListing().getCodeUnitContaining(location.getAddress()); - Command cmd = new ClearCmd(cu, options); + Command cmd = new ClearCmd(cu, options); tool.execute(cmd, program); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/colorizer/ColorizingPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/colorizer/ColorizingPlugin.java index dd94d6e4c8..2490e77a0a 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/colorizer/ColorizingPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/colorizer/ColorizingPlugin.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,8 +34,7 @@ import ghidra.app.plugin.ProgramPlugin; import ghidra.app.plugin.core.navigation.NavigationOptions; import ghidra.app.services.*; import ghidra.framework.cmd.Command; -import ghidra.framework.model.DomainObjectChangedEvent; -import ghidra.framework.model.DomainObjectListener; +import ghidra.framework.model.*; import ghidra.framework.options.SaveState; import ghidra.framework.plugintool.PluginInfo; import ghidra.framework.plugintool.PluginTool; @@ -191,7 +190,7 @@ public class ColorizingPlugin extends ProgramPlugin implements DomainObjectListe return; } - Command command = null; + Command command = null; ProgramSelection selection = listingContext.getSelection(); if (selection != null && !selection.isEmpty()) { command = new SetColorCommand(color, service, selection); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/CreateArrayAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/CreateArrayAction.java index e92fee9641..49226e9897 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/CreateArrayAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/CreateArrayAction.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -112,7 +112,7 @@ class CreateArrayAction extends ListingContextAction { int maxNoConflictElements = getMaxNoConflictElements(struct, comp.getComponentIndex(), dt); int numElements = getNumElements(dt, maxNoConflictElements, maxElements); - Command cmd = new CreateArrayInStructureCmd(addr, numElements, dt, compPath); + Command cmd = new CreateArrayInStructureCmd(addr, numElements, dt, compPath); if (!tool.execute(cmd, program)) { tool.setStatusInfo(cmd.getStatusMsg()); } @@ -144,7 +144,7 @@ class CreateArrayAction extends ListingContextAction { // Arrays currently use aligned-length only int numElements = length / dt.getAlignedLength(); - Command cmd = new CreateArrayInStructureCmd(from.getAddress(), numElements, dt, + Command cmd = new CreateArrayInStructureCmd(from.getAddress(), numElements, dt, from.getComponentPath()); if (!tool.execute(cmd, program)) { tool.setStatusInfo(cmd.getStatusMsg()); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/CycleGroupAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/CycleGroupAction.java index c225ab8b4f..1c5d52d22e 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/CycleGroupAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/CycleGroupAction.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,8 +26,7 @@ import ghidra.framework.cmd.BackgroundCommand; import ghidra.program.model.address.Address; import ghidra.program.model.data.CycleGroup; import ghidra.program.model.data.DataType; -import ghidra.program.model.listing.Data; -import ghidra.program.model.listing.Listing; +import ghidra.program.model.listing.*; import ghidra.program.util.*; import ghidra.util.Msg; @@ -83,7 +82,7 @@ public class CycleGroupAction extends ListingContextAction { // Handle selection case if (selection != null && !selection.isEmpty()) { - BackgroundCommand cmd = null; + BackgroundCommand cmd = null; DataType dt = null; Address addr = selection.getMinAddress(); Data data = listing.getDataContaining(addr); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/EquateTablePlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/EquateTablePlugin.java index 68a5850d8f..ad76c3a1a8 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/EquateTablePlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/EquateTablePlugin.java @@ -206,7 +206,7 @@ public class EquateTablePlugin extends ProgramPlugin implements DomainObjectList } if (isValid(oldEquate, newEquateName)) { - Command cmd = new RenameEquatesCmd(oldEquateName, newEquateName); + Command cmd = new RenameEquatesCmd(oldEquateName, newEquateName); tool.execute(cmd, currentProgram); } } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/fallthrough/FallThroughModel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/fallthrough/FallThroughModel.java index 43e5022fd4..dabc33aa82 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/fallthrough/FallThroughModel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/fallthrough/FallThroughModel.java @@ -15,6 +15,9 @@ */ package ghidra.app.plugin.core.fallthrough; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + import ghidra.app.cmd.refs.ClearFallThroughCmd; import ghidra.app.cmd.refs.SetFallThroughCmd; import ghidra.app.util.viewer.field.BrowserCodeUnitFormat; @@ -23,9 +26,6 @@ import ghidra.framework.plugintool.PluginTool; import ghidra.program.model.address.*; import ghidra.program.model.listing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - /** * This class is really a model for the FallThroughDialog state. However, it is used as a * convenience for executing the auto-override and clear-fallthrough actions. @@ -187,7 +187,7 @@ class FallThroughModel implements ChangeListener { * @param currentSelection */ void autoOverride(AddressSetView view) { - CompoundCmd cmd = new CompoundCmd("Auto-Override"); + CompoundCmd cmd = new CompoundCmd<>("Auto-Override"); AddressRangeIterator iter = view.getAddressRanges(); while (iter.hasNext()) { override(iter.next(), cmd); @@ -200,7 +200,7 @@ class FallThroughModel implements ChangeListener { } void clearOverride(AddressSetView view) { - CompoundCmd cmd = new CompoundCmd("Clear FallThroughs"); + CompoundCmd cmd = new CompoundCmd<>("Clear FallThroughs"); InstructionIterator it = program.getListing().getInstructions(view, true); while(it.hasNext()) { Instruction inst = it.next(); @@ -225,7 +225,7 @@ class FallThroughModel implements ChangeListener { return program; } - private void override(AddressRange range, CompoundCmd cmd) { + private void override(AddressRange range, CompoundCmd cmd) { Address min = range.getMinAddress(); Address max = range.getMaxAddress(); Listing listing = program.getListing(); @@ -248,7 +248,7 @@ class FallThroughModel implements ChangeListener { } } - private void setFallThrough(Address addr, CompoundCmd cmd) { + private void setFallThrough(Address addr, CompoundCmd cmd) { Instruction inst = program.getListing().getInstructionAfter(addr); if (inst != null) { cmd.add(new SetFallThroughCmd(addr, inst.getMinAddress())); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/AddVarArgsAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/AddVarArgsAction.java index 42b6de4a6b..5d4a31e56f 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/AddVarArgsAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/AddVarArgsAction.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -60,7 +60,7 @@ public class AddVarArgsAction extends ListingContextAction { Function function = functionPlugin.getFunction(context); if ((function != null) && (!function.hasVarArgs())) { - Command command = new SetFunctionVarArgsCommand(function, true); + Command command = new SetFunctionVarArgsCommand(function, true); PluginTool tool = functionPlugin.getTool(); Program program = context.getProgram(); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/AnalyzeStackRefsAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/AnalyzeStackRefsAction.java index d9ce4d025a..eceefb4643 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/AnalyzeStackRefsAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/AnalyzeStackRefsAction.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -103,7 +103,7 @@ class AnalyzeStackRefsAction extends ListingContextAction { doParameterAnalysis = options.getBoolean("Create Param Variables", doParameterAnalysis); - BackgroundCommand cmd = null; + BackgroundCommand cmd = null; if (doNewStackAnalysis) { cmd = new NewFunctionStackAnalysisCmd(funcSet, doParameterAnalysis, doLocalAnalysis, true); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/CreateExternalFunctionAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/CreateExternalFunctionAction.java index 2b5e66e925..0047b04c12 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/CreateExternalFunctionAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/CreateExternalFunctionAction.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -95,7 +95,7 @@ public class CreateExternalFunctionAction extends ProgramContextAction { @Override protected void actionPerformed(ProgramActionContext context) { - CompoundCmd compoundCmd = null; + CompoundCmd compoundCmd = null; CreateExternalFunctionCmd cmd = null; if (context instanceof ListingActionContext) { ListingActionContext listingContext = (ListingActionContext) context; @@ -107,7 +107,7 @@ public class CreateExternalFunctionAction extends ProgramContextAction { CreateExternalFunctionCmd extFuncCmd = new CreateExternalFunctionCmd(s); if (cmd != null) { if (compoundCmd == null) { - compoundCmd = new CompoundCmd("Create External Functions"); + compoundCmd = new CompoundCmd<>("Create External Functions"); compoundCmd.add(cmd); } compoundCmd.add(extFuncCmd); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/CreateFunctionAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/CreateFunctionAction.java index a7eeeddd7a..945567894f 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/CreateFunctionAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/CreateFunctionAction.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -139,7 +139,7 @@ class CreateFunctionAction extends ListingContextAction { funcPlugin.getTool().clearStatusInfo(); } - BackgroundCommand cmd; + BackgroundCommand cmd; if (createThunk) { cmd = getCreateThunkFunctionCmd(context.getProgram(), entry, body); if (cmd == null) { diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/DeleteVarArgsAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/DeleteVarArgsAction.java index 48cf490ba1..ca0642d6ed 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/DeleteVarArgsAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/DeleteVarArgsAction.java @@ -1,13 +1,12 @@ /* ### * IP: GHIDRA - * REVIEWED: YES * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,6 +15,7 @@ */ package ghidra.app.plugin.core.function; +import docking.action.MenuData; import ghidra.app.cmd.function.SetFunctionVarArgsCommand; import ghidra.app.context.ListingActionContext; import ghidra.app.context.ListingContextAction; @@ -25,7 +25,6 @@ import ghidra.program.model.listing.Function; import ghidra.program.model.listing.Program; import ghidra.program.util.*; import ghidra.util.HelpLocation; -import docking.action.MenuData; /** * Action that changes a Function so that it has VarArgs (a variable argument list). @@ -62,7 +61,7 @@ public class DeleteVarArgsAction extends ListingContextAction { public void actionPerformed(ListingActionContext context) { Function function = functionPlugin.getFunction(context); if ((function != null) && (function.hasVarArgs())) { - Command command = new SetFunctionVarArgsCommand(function, false); + Command command = new SetFunctionVarArgsCommand(function, false); PluginTool tool = functionPlugin.getTool(); Program program = context.getProgram(); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/EditFunctionPurgeAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/EditFunctionPurgeAction.java index 4cf41408cb..1e4e9e008e 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/EditFunctionPurgeAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/EditFunctionPurgeAction.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -84,7 +84,7 @@ public class EditFunctionPurgeAction extends ListingContextAction { int newFunctionPurgeSize = numberInputDialog.getValue(); if (newFunctionPurgeSize != currentFunctionPurgeSize) { - Command command = new SetFunctionPurgeCommand(function, newFunctionPurgeSize); + Command command = new SetFunctionPurgeCommand(function, newFunctionPurgeSize); PluginTool tool = functionPlugin.getTool(); Program program = function.getProgram(); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/X86FunctionPurgeAnalyzer.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/X86FunctionPurgeAnalyzer.java index 23182f7fcc..b6e735048d 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/X86FunctionPurgeAnalyzer.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/X86FunctionPurgeAnalyzer.java @@ -1,13 +1,12 @@ /* ### * IP: GHIDRA - * REVIEWED: YES * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -38,7 +37,7 @@ public class X86FunctionPurgeAnalyzer extends AbstractAnalyzer { @Override public boolean added(Program program, AddressSetView set, TaskMonitor monitor, MessageLog log) { - BackgroundCommand cmd; + BackgroundCommand cmd; cmd = new FunctionPurgeAnalysisCmd(set); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/tags/TargetTagsPanel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/tags/TargetTagsPanel.java index b3e76648fd..7026a6ccf9 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/tags/TargetTagsPanel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/tags/TargetTagsPanel.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,8 +20,7 @@ import java.util.Set; import ghidra.app.cmd.function.RemoveFunctionTagCmd; import ghidra.framework.cmd.Command; import ghidra.framework.plugintool.PluginTool; -import ghidra.program.model.listing.Function; -import ghidra.program.model.listing.FunctionTag; +import ghidra.program.model.listing.*; /** * Displays a list of tags that have been assigned to the current function @@ -73,7 +72,8 @@ public class TargetTagsPanel extends TagListPanel { public void removeSelectedTags() { Set selectedTags = getSelectedTags(); for (FunctionTag tag : selectedTags) { - Command cmd = new RemoveFunctionTagCmd(tag.getName(), function.getEntryPoint()); + Command cmd = + new RemoveFunctionTagCmd(tag.getName(), function.getEntryPoint()); tool.execute(cmd, program); } } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/label/LabelMgrPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/label/LabelMgrPlugin.java index b124ccef73..396031052b 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/label/LabelMgrPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/label/LabelMgrPlugin.java @@ -115,7 +115,8 @@ public class LabelMgrPlugin extends Plugin { protected void removeLabelCallback(ListingActionContext context) { Symbol s = getSymbol(context); if (s != null) { - Command cmd = new DeleteLabelCmd(s.getAddress(), s.getName(), s.getParentNamespace()); + Command cmd = + new DeleteLabelCmd(s.getAddress(), s.getName(), s.getParentNamespace()); if (!tool.execute(cmd, context.getProgram())) { tool.setStatusInfo(cmd.getStatusMsg()); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/label/OperandLabelDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/label/OperandLabelDialog.java index 9df7898e7a..2912c5b421 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/label/OperandLabelDialog.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/label/OperandLabelDialog.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -94,7 +94,7 @@ public class OperandLabelDialog extends DialogComponentProvider { Address symAddr = sym.getAddress(); Reference ref = refMgr.getReference(addr, symAddr, opIndex); - CompoundCmd cmd = new CompoundCmd("Set Label"); + CompoundCmd cmd = new CompoundCmd<>("Set Label"); Namespace scope = null; Symbol newSym = findSymbol(symTable, currentLabel, symAddr); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/module/AutoRenamePlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/module/AutoRenamePlugin.java index e6fe4d06a9..325bf44877 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/module/AutoRenamePlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/module/AutoRenamePlugin.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,6 +15,11 @@ */ package ghidra.app.plugin.core.module; +import javax.swing.tree.TreePath; + +import docking.ActionContext; +import docking.action.DockingAction; +import docking.action.MenuData; import ghidra.app.CorePluginPackage; import ghidra.app.cmd.module.RenameCmd; import ghidra.app.context.ListingActionContext; @@ -26,8 +31,9 @@ import ghidra.app.services.ProgramTreeService; import ghidra.framework.cmd.CompoundCmd; import ghidra.framework.plugintool.PluginInfo; import ghidra.framework.plugintool.PluginTool; -import ghidra.framework.plugintool.util.*; +import ghidra.framework.plugintool.util.PluginStatus; import ghidra.program.model.address.Address; +import ghidra.program.model.listing.Program; import ghidra.program.model.listing.ProgramFragment; import ghidra.program.model.symbol.Symbol; import ghidra.program.model.symbol.SymbolTable; @@ -35,12 +41,6 @@ import ghidra.program.util.LabelFieldLocation; import ghidra.program.util.ProgramLocation; import ghidra.util.HelpLocation; -import javax.swing.tree.TreePath; - -import docking.ActionContext; -import docking.action.DockingAction; -import docking.action.MenuData; - /** * Plugin provides the following Fragment rename actions: * 1. Automatically rename selected Program Fragments to match the @@ -113,7 +113,7 @@ public class AutoRenamePlugin extends ProgramPlugin { if (obj instanceof ProgramNode) { ProgramNode node = (ProgramNode) obj; - CompoundCmd cmd = new CompoundCmd("Auto Rename Fragment(s)"); + CompoundCmd cmd = new CompoundCmd<>("Auto Rename Fragment(s)"); SymbolTable symTable = currentProgram.getSymbolTable(); // Find selected Fragments diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/DeleteReferencesAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/DeleteReferencesAction.java index 226bd34d00..bf619e66d7 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/DeleteReferencesAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/DeleteReferencesAction.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,6 +24,7 @@ import ghidra.app.context.ListingActionContext; import ghidra.app.context.ListingContextAction; import ghidra.framework.cmd.Command; import ghidra.program.model.address.Address; +import ghidra.program.model.listing.Program; import ghidra.program.model.symbol.Reference; import ghidra.program.model.symbol.ReferenceManager; import ghidra.program.util.*; @@ -58,7 +59,7 @@ public class DeleteReferencesAction extends ListingContextAction { if (loc instanceof OperandFieldLocation) { opIndex = ((OperandFieldLocation) loc).getOperandIndex(); } - Command cmd = new RemoveAllReferencesCmd(loc.getAddress(), opIndex); + Command cmd = new RemoveAllReferencesCmd(loc.getAddress(), opIndex); plugin.getTool().execute(cmd, context.getProgram()); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditReferencesModel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditReferencesModel.java index 7cef91ffb8..6b891b5d26 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditReferencesModel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditReferencesModel.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -173,13 +173,13 @@ class EditReferencesModel extends AbstractSortedTableModel { case REF_TYPE_COL: if (ref.getReferenceType() != value) { - Command cmd = new EditRefTypeCmd(ref, (RefType) value); + Command cmd = new EditRefTypeCmd(ref, (RefType) value); plugin.getTool().execute(cmd, cu.getProgram()); } break; case IS_PRIMARY_COL: - Command cmd = new SetPrimaryRefCmd(ref, ((Boolean) value).booleanValue()); + Command cmd = new SetPrimaryRefCmd(ref, ((Boolean) value).booleanValue()); plugin.getTool().execute(cmd, cu.getProgram()); break; diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ExternalReferencesProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ExternalReferencesProvider.java index ffd3605433..883bdcf452 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ExternalReferencesProvider.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ExternalReferencesProvider.java @@ -212,7 +212,7 @@ public class ExternalReferencesProvider extends ComponentProviderAdapter { private void deleteExternalProgram() { ExternalManager externalManager = program.getExternalManager(); StringBuilder buf = new StringBuilder(); - CompoundCmd cmd = new CompoundCmd("Delete External Program Name"); + CompoundCmd cmd = new CompoundCmd<>("Delete External Program Name"); for (String externalName : getSelectedExternalNames()) { boolean hasLocations = externalManager.getExternalLocations(externalName).hasNext(); if (hasLocations) { @@ -251,7 +251,8 @@ public class ExternalReferencesProvider extends ComponentProviderAdapter { ExternalManager externalManager = program.getExternalManager(); String externalLibraryPath = externalManager.getExternalLibraryPath(externalName); if (!pathName.equals(externalLibraryPath)) { - Command cmd = new SetExternalNameCmd(externalName, domainFile.getPathname()); + Command cmd = + new SetExternalNameCmd(externalName, domainFile.getPathname()); getTool().execute(cmd, program); } }); @@ -260,7 +261,7 @@ public class ExternalReferencesProvider extends ComponentProviderAdapter { } private void clearExternalAssociation() { - CompoundCmd cmd = new CompoundCmd("Clear External Program Associations"); + CompoundCmd cmd = new CompoundCmd<>("Clear External Program Associations"); for (String externalName : getSelectedExternalNames()) { cmd.add(new ClearExternalNameCmd(externalName)); } @@ -435,7 +436,8 @@ public class ExternalReferencesProvider extends ComponentProviderAdapter { rowToHighlightDuringNextReload = newName; String oldName = path.getName(); - Command cmd = new UpdateExternalNameCmd(oldName, newName, SourceType.USER_DEFINED); + Command cmd = + new UpdateExternalNameCmd(oldName, newName, SourceType.USER_DEFINED); if (!tool.execute(cmd, program)) { tool.setStatusInfo(cmd.getStatusMsg()); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ReferencesPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ReferencesPlugin.java index 68a0f0c779..7c7a657125 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ReferencesPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/ReferencesPlugin.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -525,25 +525,27 @@ public class ReferencesPlugin extends Plugin { } } - BackgroundCommand cmd = + BackgroundCommand cmd = new AddMemRefsCmd(cuAddr, set, rt, SourceType.USER_DEFINED, opIndex); tool.executeBackgroundCommand(cmd, cu.getProgram()); } boolean addDefaultReference(Program program, Address fromAddr, int opIndex, Address toAddr, RefType refType) { - Command cmd = + Command cmd = new AddMemRefCmd(fromAddr, toAddr, refType, SourceType.USER_DEFINED, opIndex, true); return tool.execute(cmd, program); } boolean addDefaultReference(Program program, Address fromAddr, int opIndex, int stackOffset) { - Command cmd = new AddStackRefCmd(fromAddr, opIndex, stackOffset, SourceType.USER_DEFINED); + Command cmd = + new AddStackRefCmd(fromAddr, opIndex, stackOffset, SourceType.USER_DEFINED); return tool.execute(cmd, program); } boolean addDefaultReference(Program program, Address fromAddr, int opIndex, Register reg) { - Command cmd = new AddRegisterRefCmd(fromAddr, opIndex, reg, SourceType.USER_DEFINED); + Command cmd = + new AddRegisterRefCmd(fromAddr, opIndex, reg, SourceType.USER_DEFINED); return tool.execute(cmd, program); } @@ -559,7 +561,7 @@ public class ReferencesPlugin extends Plugin { * Remove specified set of references */ void deleteReferences(Program program, Reference[] refs) { - CompoundCmd cmd = new CompoundCmd("Remove Reference(s)"); + CompoundCmd cmd = new CompoundCmd<>("Remove Reference(s)"); for (Reference ref : refs) { cmd.add(new RemoveReferenceCmd(ref)); } @@ -573,7 +575,7 @@ public class ReferencesPlugin extends Plugin { */ boolean updateReference(Reference editRef, CodeUnit fromCodeUnit, Address toAddr, boolean isOffsetRef, long offset, RefType refType) { - CompoundCmd cmd = new CompoundCmd("Update Memory Reference"); + CompoundCmd cmd = new CompoundCmd<>("Update Memory Reference"); int opIndex = editRef.getOperandIndex(); cmd.add(new RemoveReferenceCmd(editRef)); if (isOffsetRef) { @@ -610,7 +612,7 @@ public class ReferencesPlugin extends Plugin { return false; } - Command cmd; + Command cmd; if (isOffsetRef) { cmd = new AddOffsetMemRefCmd(fromAddr, toAddr, false, refType, SourceType.USER_DEFINED, opIndex, offset); @@ -632,7 +634,7 @@ public class ReferencesPlugin extends Plugin { return false; } - CompoundCmd cmd = new CompoundCmd("Update Register Reference"); + CompoundCmd cmd = new CompoundCmd<>("Update Register Reference"); cmd.add(new RemoveReferenceCmd(editRef)); cmd.add(new AddRegisterRefCmd(fromAddr, editRef.getOperandIndex(), reg, refType, SourceType.USER_DEFINED)); @@ -670,7 +672,7 @@ public class ReferencesPlugin extends Plugin { return false; } - CompoundCmd cmd = new CompoundCmd("Update Stack Reference"); + CompoundCmd cmd = new CompoundCmd<>("Update Stack Reference"); cmd.add(new RemoveReferenceCmd(editRef)); cmd.add(new AddStackRefCmd(fromAddr, editRef.getOperandIndex(), stackOffset, refType, SourceType.USER_DEFINED)); @@ -699,7 +701,8 @@ public class ReferencesPlugin extends Plugin { return tool.execute(cmd, p); } - private void buildAddExtRefCmd(CompoundCmd cmd, Program p, Address fromAddr, int opIndex, + private void buildAddExtRefCmd(CompoundCmd cmd, Program p, Address fromAddr, + int opIndex, String extName, String path, Address addr, String label, RefType refType) { cmd.add(new SetExternalRefCmd(fromAddr, opIndex, extName, label, addr, refType, @@ -721,7 +724,7 @@ public class ReferencesPlugin extends Plugin { ExternalLocation oldExtLoc = editRef.getExternalLocation(); String oldExtName = oldExtLoc.getLibraryName(); - CompoundCmd cmd = new CompoundCmd("Update External Reference"); + CompoundCmd cmd = new CompoundCmd<>("Update External Reference"); // TODO: Add RefType entry to External Reference editor panel (assume unchanged to avoid merge conflict) @@ -790,7 +793,7 @@ public class ReferencesPlugin extends Plugin { } } - CompoundCmd cmd = new CompoundCmd("Add External Reference"); + CompoundCmd cmd = new CompoundCmd<>("Add External Reference"); buildAddExtRefCmd(cmd, p, fromCodeUnit.getMinAddress(), opIndex, extName, path, addr, label, refType); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterPlugin.java index c9bcd500a9..206322376d 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterPlugin.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -231,7 +231,7 @@ public class RegisterPlugin extends ProgramPlugin { while (it.hasNext()) { AddressRange range = it.next(); if (range.contains(addr)) { - Command cmd = new SetRegisterCmd(register, range.getMinAddress(), + Command cmd = new SetRegisterCmd(register, range.getMinAddress(), range.getMaxAddress(), null); if (!tool.execute(cmd, context.getProgram())) { Msg.showError(this, tool.getToolFrame(), "Register Context Error", @@ -246,7 +246,7 @@ public class RegisterPlugin extends ProgramPlugin { RegisterFieldLocation location = (RegisterFieldLocation) context.getLocation(); Register register = location.getRegister(); Address addr = location.getAddress(); - Command cmd = new SetRegisterCmd(register, addr, addr, null); + Command cmd = new SetRegisterCmd(register, addr, addr, null); if (!tool.execute(cmd, context.getProgram())) { Msg.showError(this, tool.getToolFrame(), "Register Context Error", cmd.getStatusMsg()); } @@ -377,7 +377,7 @@ public class RegisterPlugin extends ProgramPlugin { return; } - CompoundCmd cmd = new CompoundCmd("Set Register Values"); + CompoundCmd cmd = new CompoundCmd<>("Set Register Values"); for (AddressRange range : addressSet) { SetRegisterCmd regCmd = new SetRegisterCmd(register, range.getMinAddress(), range.getMaxAddress(), value); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterValuesPanel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterValuesPanel.java index ad13415478..b999e1d746 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterValuesPanel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/register/RegisterValuesPanel.java @@ -102,9 +102,9 @@ class RegisterValuesPanel extends JPanel { private void updateValue(Address start, Address end, Address newStart, Address newEnd, BigInteger newValue) { - CompoundCmd cmd = new CompoundCmd("Update Register Range"); - Command cmd1 = new SetRegisterCmd(selectedRegister, start, end, null); - Command cmd2 = new SetRegisterCmd(selectedRegister, newStart, newEnd, newValue); + CompoundCmd cmd = new CompoundCmd<>("Update Register Range"); + Command cmd1 = new SetRegisterCmd(selectedRegister, start, end, null); + Command cmd2 = new SetRegisterCmd(selectedRegister, newStart, newEnd, newValue); cmd.add(cmd1); cmd.add(cmd2); tool.execute(cmd, currentProgram); @@ -250,7 +250,7 @@ class RegisterValuesPanel extends JPanel { } void deleteSelectedRanges() { - CompoundCmd cmd = new CompoundCmd("Delete Register Value Ranges"); + CompoundCmd cmd = new CompoundCmd<>("Delete Register Value Ranges"); int[] rows = table.getSelectedRows(); boolean containsDefaultValues = false; for (int row : rows) { diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/SetExternalProgramAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/SetExternalProgramAction.java index a0d63e9d83..d6030511ee 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/SetExternalProgramAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/SetExternalProgramAction.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -95,7 +95,8 @@ public class SetExternalProgramAction extends SymbolTreeContextAction { String pathName = domainFile.toString(); dialog.close(); if (!pathName.equals(externalLibraryPath)) { - Command cmd = new SetExternalNameCmd(externalName, domainFile.getPathname()); + Command cmd = + new SetExternalNameCmd(externalName, domainFile.getPathname()); plugin.getTool().execute(cmd, plugin.getProgram()); } }); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/debug/propertymanager/PropertyManagerProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/debug/propertymanager/PropertyManagerProvider.java index 221e5195da..9bd994279f 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/debug/propertymanager/PropertyManagerProvider.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/debug/propertymanager/PropertyManagerProvider.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -73,7 +73,7 @@ public class PropertyManagerProvider extends ComponentProviderAdapter { String propName = (String) model.getValueAt(row, PropertyManagerTableModel.PROPERTY_NAME_COLUMN); model.removeRow(row); - Command cmd = new PropertyDeleteCmd(propName, restrictedView); + Command cmd = new PropertyDeleteCmd(propName, restrictedView); PropertyManagerProvider.this.plugin.getTool().execute(cmd, currentProgram); } } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/objectiveC/ObjectiveC1_Utilities.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/objectiveC/ObjectiveC1_Utilities.java index 2b2ab540d1..1d2021ff7a 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/objectiveC/ObjectiveC1_Utilities.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/objectiveC/ObjectiveC1_Utilities.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -121,7 +121,7 @@ public final class ObjectiveC1_Utilities { if (state.thumbCodeLocations.contains(address)) { Register tmodeRegister = state.program.getLanguage().getRegister("TMode"); if (tmodeRegister != null) { - Command c = + Command c = new SetRegisterCmd(tmodeRegister, address, address, BigInteger.valueOf(1)); c.applyTo(state.program); } @@ -300,7 +300,7 @@ public final class ObjectiveC1_Utilities { ObjectiveC1_Utilities.setThumbBit(state, address); - BackgroundCommand command = null; + BackgroundCommand command = null; command = new DisassembleCommand(address, null, true); command.applyTo(state.program, state.monitor); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/MarkupXmlMgr.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/MarkupXmlMgr.java index ec7ac60957..afcdf01706 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/MarkupXmlMgr.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/MarkupXmlMgr.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -218,7 +218,7 @@ class MarkupXmlMgr { RefType refType = getDefaultRefType(fromAddr, toAddr, opIndex); - Command cmd = null; + Command cmd = null; if (baseAddr != null) { long offset = toAddr.subtract(baseAddr); cmd = new AddOffsetMemRefCmd(fromAddr, toAddr, false, refType, diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/PropertiesXmlMgr.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/PropertiesXmlMgr.java index 02a8d77947..65b9631edb 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/PropertiesXmlMgr.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/xml/PropertiesXmlMgr.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -124,7 +124,7 @@ class PropertiesXmlMgr { } if (!overwrite && !"bookmarks".equals(type)) { - PropertyMap map = propMapMgr.getPropertyMap(name); + PropertyMap map = propMapMgr.getPropertyMap(name); if (map != null && map.hasProperty(addr)) { log.appendMsg("Conflicting '" + name + "' PROPERTY ignored at: " + addr); return; // skip - property conflicts diff --git a/Ghidra/Features/Base/src/main/java/ghidra/base/project/GhidraProject.java b/Ghidra/Features/Base/src/main/java/ghidra/base/project/GhidraProject.java index ec2194cc5f..586741aff1 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/base/project/GhidraProject.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/base/project/GhidraProject.java @@ -573,7 +573,7 @@ public class GhidraProject { * @param program * the program on which the command is to be applied. */ - public void execute(Command cmd, Program program) { + public void execute(Command cmd, Program program) { AutoAnalysisManager mgr = AutoAnalysisManager.getAnalysisManager(program); cmd.applyTo(program); mgr.initializeOptions(); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/bookmark/BookmarkEditCmdTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/bookmark/BookmarkEditCmdTest.java index e415b442fc..c7d318a379 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/bookmark/BookmarkEditCmdTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/bookmark/BookmarkEditCmdTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -58,7 +58,7 @@ public class BookmarkEditCmdTest extends AbstractGhidraHeadedIntegrationTest { private Address[] createBookmarks(ProgramLocation[] locs) { - CompoundCmd compoundCmd = new CompoundCmd("Create Bookmarks"); + CompoundCmd compoundCmd = new CompoundCmd<>("Create Bookmarks"); Address[] addrs = new Address[locs.length]; for (int i = 0; i < locs.length; i++) { diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/bookmark/BookmarkPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/bookmark/BookmarkPluginTest.java index b640697696..55f9bb9e1a 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/bookmark/BookmarkPluginTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/bookmark/BookmarkPluginTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -484,7 +484,7 @@ public class BookmarkPluginTest extends AbstractGhidraHeadedIntegrationTest { // note: we want to test a specific code path, so we must delete more than 20 items // add more to our current set - CompoundCmd addCmd = new CompoundCmd("Add Bookmarks"); + CompoundCmd addCmd = new CompoundCmd<>("Add Bookmarks"); addCmd.add(new BookmarkEditCmd(addr("01001110"), "Type1", "Cat1a", "Cmt1A")); addCmd.add(new BookmarkEditCmd(addr("01001120"), "Type1", "Cat1a", "Cmt1B")); addCmd.add(new BookmarkEditCmd(addr("01001120"), "Type1", "Cat1b", "Cmt1C")); @@ -545,7 +545,7 @@ public class BookmarkPluginTest extends AbstractGhidraHeadedIntegrationTest { assertFalse(addressSet.contains(addr("01001100"))); assertFalse(addressSet.contains(addr("01001120"))); - CompoundCmd addCmd = new CompoundCmd("Add Bookmarks"); + CompoundCmd addCmd = new CompoundCmd<>("Add Bookmarks"); addCmd.add(new BookmarkEditCmd(addr("01001100"), "Type1", "Cat1a", "Cmt1A")); addCmd.add(new BookmarkEditCmd(addr("01001120"), "Type1", "Cat1a", "Cmt1B")); applyCmd(program, addCmd); @@ -558,7 +558,7 @@ public class BookmarkPluginTest extends AbstractGhidraHeadedIntegrationTest { @Test public void testDeleteOffcutBookmarks() throws Exception { - CompoundCmd addCmd = new CompoundCmd("Add Bookmarks"); + CompoundCmd addCmd = new CompoundCmd<>("Add Bookmarks"); Address a = addr("0100b6db"); for (int i = 0; i < 20; i++) { addCmd.add(new BookmarkEditCmd(a, "Type1", "Cat1a", "Cmt1A")); @@ -706,7 +706,7 @@ public class BookmarkPluginTest extends AbstractGhidraHeadedIntegrationTest { applyCmd(program, delCmd); // Add specific bookmarks - CompoundCmd addCmd = new CompoundCmd("Add Bookmarks"); + CompoundCmd addCmd = new CompoundCmd<>("Add Bookmarks"); addCmd.add(new BookmarkEditCmd(addr("01001010"), "Type1", "Cat1a", "Cmt1A")); addCmd.add(new BookmarkEditCmd(addr("01001020"), "Type1", "Cat1a", "Cmt1B")); addCmd.add(new BookmarkEditCmd(addr("01001020"), "Type1", "Cat1b", "Cmt1C")); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserOptionsTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserOptionsTest.java index 89675664f3..e812946360 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserOptionsTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserOptionsTest.java @@ -789,8 +789,8 @@ public class CodeBrowserOptionsTest extends AbstractGhidraHeadedIntegrationTest //--- Verify register variable markup options - Command cmd = new AddRegisterRefCmd(addr("0x1002d0b"), 0, program.getRegister("EDI"), - SourceType.USER_DEFINED); + Command cmd = new AddRegisterRefCmd(addr("0x1002d0b"), 0, + program.getRegister("EDI"), SourceType.USER_DEFINED); applyCmd(program, cmd); cb.updateNow(); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/data/DataReferencesTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/data/DataReferencesTest.java index e1a22dd4a2..55d736c2cf 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/data/DataReferencesTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/data/DataReferencesTest.java @@ -91,7 +91,7 @@ public class DataReferencesTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(EXT_POINTERS_OFFSET); clearSymbols(addr, addr(EXT_POINTERS_OFFSET + 23)); - Command cmd = new CreateStructureCmd(addr, 24); + Command cmd = new CreateStructureCmd(addr, 24); cmd.applyTo(program); Data d = program.getListing().getDataAt(addr); @@ -127,7 +127,7 @@ public class DataReferencesTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(EXT_POINTERS_OFFSET); clearSymbols(addr, addr(EXT_POINTERS_OFFSET + 23)); - Command cmd = new CreateArrayCmd(addr, 6, new Pointer32DataType(), 4); + Command cmd = new CreateArrayCmd(addr, 6, new Pointer32DataType(), 4); cmd.applyTo(program); Symbol s = createLabel(addr, "ArrayA"); @@ -161,7 +161,7 @@ public class DataReferencesTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(EXT_POINTERS_OFFSET); clearSymbols(addr, addr(EXT_POINTERS_OFFSET + (4 * 24))); - Command cmd = new CreateStructureCmd(addr, 24); + Command cmd = new CreateStructureCmd(addr, 24); cmd.applyTo(program); Data d = program.getListing().getDataAt(addr); @@ -207,11 +207,11 @@ public class DataReferencesTest extends AbstractGhidraHeadedIntegrationTest { for (int i = 0; i < 4; i++) { Address a = addr(EXT_POINTERS_OFFSET + (i * 24)); - Command cmd = new CreateArrayCmd(a, 6, new Pointer32DataType(), 4); + Command cmd = new CreateArrayCmd(a, 6, new Pointer32DataType(), 4); cmd.applyTo(program); } - Command cmd = new CreateStructureCmd(addr, 4 * 24); + Command cmd = new CreateStructureCmd(addr, 4 * 24); cmd.applyTo(program); Data d = program.getListing().getDataAt(addr); @@ -254,7 +254,7 @@ public class DataReferencesTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(EXT_POINTERS_OFFSET); clearSymbols(addr, addr(EXT_POINTERS_OFFSET + (4 * 24))); - Command cmd = new CreateArrayCmd(addr, 6, new Pointer32DataType(), 4); + Command cmd = new CreateArrayCmd(addr, 6, new Pointer32DataType(), 4); cmd.applyTo(program); Data d = program.getListing().getDataAt(addr); @@ -294,7 +294,7 @@ public class DataReferencesTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(EXT_POINTERS_OFFSET); clearSymbols(addr, addr(EXT_POINTERS_OFFSET + (4 * 24))); - Command cmd = new CreateStructureCmd(addr, 24); + Command cmd = new CreateStructureCmd(addr, 24); cmd.applyTo(program); Data d = program.getListing().getDataAt(addr); @@ -349,7 +349,7 @@ public class DataReferencesTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(EXT_POINTERS_OFFSET); clearSymbols(addr, addr.add(23)); - Command cmd = new ClearCmd(new AddressSet(addr, addr.add(23))); + Command cmd = new ClearCmd(new AddressSet(addr, addr.add(23))); cmd.applyTo(program); addr = addr(EXT_POINTERS_OFFSET + 2); @@ -407,7 +407,7 @@ public class DataReferencesTest extends AbstractGhidraHeadedIntegrationTest { Address structAddr = addr(EXT_POINTERS_OFFSET); clearSymbols(structAddr, structAddr.add(23)); - Command cmd = new ClearCmd(new AddressSet(structAddr, structAddr.add(23))); + Command cmd = new ClearCmd(new AddressSet(structAddr, structAddr.add(23))); cmd.applyTo(program); structAddr = addr(EXT_POINTERS_OFFSET + 2); @@ -443,7 +443,7 @@ public class DataReferencesTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(EXT_POINTERS_OFFSET); clearSymbols(addr, addr.add(23)); - Command cmd = new ClearCmd(new AddressSet(addr, addr.add(23))); + Command cmd = new ClearCmd(new AddressSet(addr, addr.add(23))); cmd.applyTo(program); addr = addr(EXT_POINTERS_OFFSET + 2); @@ -488,7 +488,7 @@ public class DataReferencesTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(EXT_POINTERS_OFFSET); clearSymbols(addr, addr.add(7)); - Command cmd = new ClearCmd(new AddressSet(addr, addr.add(7))); + Command cmd = new ClearCmd(new AddressSet(addr, addr.add(7))); cmd.applyTo(program); addr = addr(EXT_POINTERS_OFFSET + 2); @@ -508,7 +508,7 @@ public class DataReferencesTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(EXT_POINTERS_OFFSET); clearSymbols(addr, addr.add(7)); - Command cmd = new ClearCmd(new AddressSet(addr, addr.add(7))); + Command cmd = new ClearCmd(new AddressSet(addr, addr.add(7))); cmd.applyTo(program); addr = addr(EXT_POINTERS_OFFSET + 2); @@ -528,7 +528,7 @@ public class DataReferencesTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(EXT_POINTERS_OFFSET); clearSymbols(addr, addr.add(7)); - Command cmd = new ClearCmd(new AddressSet(addr, addr.add(7))); + Command cmd = new ClearCmd(new AddressSet(addr, addr.add(7))); cmd.applyTo(program); addr = addr(EXT_POINTERS_OFFSET + 2); @@ -551,7 +551,7 @@ public class DataReferencesTest extends AbstractGhidraHeadedIntegrationTest { Address addr = addr(EXT_POINTERS_OFFSET); clearSymbols(addr, addr.add(7)); - Command cmd = new ClearCmd(new AddressSet(addr, addr.add(7))); + Command cmd = new ClearCmd(new AddressSet(addr, addr.add(7))); cmd.applyTo(program); addr = addr(EXT_POINTERS_OFFSET + 2); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/marker/MarkerTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/marker/MarkerTest.java index c44ff03dc9..191cc82beb 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/marker/MarkerTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/marker/MarkerTest.java @@ -287,7 +287,7 @@ public class MarkerTest extends AbstractGhidraHeadedIntegrationTest { @Test public void testToolTipMaxLines() throws Exception { tool.addPlugin(BookmarkPlugin.class.getName()); - CompoundCmd addCmd = new CompoundCmd("Add Bookmarks"); + CompoundCmd addCmd = new CompoundCmd<>("Add Bookmarks"); Address a = addr("0x0100b6db"); for (int i = 0; i < 20; i++) { addCmd.add(new BookmarkEditCmd(a, "Type1", "Cat1a", "Cmt1A_" + (i + 1))); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/NextPrevCodeUnitPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/NextPrevCodeUnitPluginTest.java index b1dcd7c546..f40cd0a7fb 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/NextPrevCodeUnitPluginTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/NextPrevCodeUnitPluginTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -637,7 +637,7 @@ public class NextPrevCodeUnitPluginTest extends AbstractGhidraHeadedIntegrationT clearExisingBookmarks(); // add more to our current set - CompoundCmd addCmd = new CompoundCmd("Add Bookmarks"); + CompoundCmd addCmd = new CompoundCmd<>("Add Bookmarks"); addCmd.add(new BookmarkEditCmd(addr("01001110"), BookmarkType.ERROR, "Cat1a", "Cmt1A")); addCmd.add(new BookmarkEditCmd(addr("01001118"), BookmarkType.NOTE, "Cat1a", "Cmt1B")); addCmd.add(new BookmarkEditCmd(addr("01001120"), BookmarkType.ERROR, "Cat1a", "Cmt1B")); @@ -736,7 +736,7 @@ public class NextPrevCodeUnitPluginTest extends AbstractGhidraHeadedIntegrationT clearExisingBookmarks(); // add more to our current set - CompoundCmd addCmd = new CompoundCmd("Add Bookmarks"); + CompoundCmd addCmd = new CompoundCmd<>("Add Bookmarks"); addCmd.add(new BookmarkEditCmd(addr("01003e2c"), BookmarkType.WARNING, "Cat1a", "Cmt1A")); addCmd.add(new BookmarkEditCmd(addr("01003e2e"), BookmarkType.NOTE, "Cat1a", "Cmt1B")); addCmd.add(new BookmarkEditCmd(addr("01003e30"), BookmarkType.WARNING, "Cat1a", "Cmt1B")); @@ -803,7 +803,7 @@ public class NextPrevCodeUnitPluginTest extends AbstractGhidraHeadedIntegrationT String typeString = bob.getTypeString(); // add more to our current set - CompoundCmd addCmd = new CompoundCmd("Add Bookmarks"); + CompoundCmd addCmd = new CompoundCmd<>("Add Bookmarks"); addCmd.add(new BookmarkEditCmd(addr("0100529b"), typeString, "Cat1a", "Cmt1A")); addCmd.add(new BookmarkEditCmd(addr("0100529d"), BookmarkType.NOTE, "Cat1a", "Cmt1B")); addCmd.add(new BookmarkEditCmd(addr("0100529e"), typeString, "Cat1a", "Cmt1B")); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/scalartable/ScalarSearchTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/scalartable/ScalarSearchTest.java index 4d43a52d39..231f6990a3 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/scalartable/ScalarSearchTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/scalartable/ScalarSearchTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,9 +15,7 @@ */ package ghidra.app.plugin.core.scalartable; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; import java.util.ArrayList; import java.util.List; @@ -818,7 +816,7 @@ public class ScalarSearchTest extends AbstractGhidraHeadedIntegrationTest { assertTrue("Unable to apply data type at address: " + address, apply(createDataCommand)); } - private boolean apply(Command cmd) throws RollbackException { + private boolean apply(Command cmd) throws RollbackException { return cmd.applyTo(program); } diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreeNavigationTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreeNavigationTest.java index 9abc09db87..97e6e708f3 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreeNavigationTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreeNavigationTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -558,7 +558,7 @@ public class SymbolTreeNavigationTest extends AbstractProgramBasedTest { assertNull("Found a selected node when there should be no selection", node); } - public void applyCmd(Command cmd) throws RollbackException { + public void applyCmd(Command cmd) throws RollbackException { boolean success = applyCmd(program, cmd); assertTrue("Command failed - " + cmd.getName() + "; status = " + cmd.getStatusMsg(), success); diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symtable/SymbolTablePluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symtable/SymbolTablePluginTest.java index ffa864b539..f622fa444d 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symtable/SymbolTablePluginTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symtable/SymbolTablePluginTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -1438,7 +1438,8 @@ public class SymbolTablePluginTest extends AbstractGhidraHeadedIntegrationTest { private void addLabel(String label, String namespaceName, Address address) throws Exception { Namespace namespace = null; if (namespaceName != null) { - Command command = new CreateNamespacesCmd(namespaceName, SourceType.USER_DEFINED); + Command command = + new CreateNamespacesCmd(namespaceName, SourceType.USER_DEFINED); if (tool.execute(command, program)) { List namespaces = NamespaceUtils.getNamespaceByPath(program, null, namespaceName); @@ -1450,7 +1451,8 @@ public class SymbolTablePluginTest extends AbstractGhidraHeadedIntegrationTest { } } - Command command = new AddLabelCmd(address, label, namespace, SourceType.USER_DEFINED); + Command command = + new AddLabelCmd(address, label, namespace, SourceType.USER_DEFINED); tool.execute(command, program); waitForNotBusy(); } @@ -1700,7 +1702,7 @@ public class SymbolTablePluginTest extends AbstractGhidraHeadedIntegrationTest { waitForSwing(); int max = symbolTable.getRowCount(); for (int i = 0; i < max; i++) { - Symbol s = (Symbol) symbolTable.getValueAt(i, SymbolTableModel.LABEL_COL); + Symbol s = (Symbol) symbolTable.getValueAt(i, AbstractSymbolTableModel.LABEL_COL); if (s == null) { continue; // symbol deleted } diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/OperandFieldFactoryTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/OperandFieldFactoryTest.java index af158966c5..f483d6cc46 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/OperandFieldFactoryTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/viewer/field/OperandFieldFactoryTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -294,7 +294,7 @@ public class OperandFieldFactoryTest extends AbstractGhidraHeadedIntegrationTest structure.add(IntegerDataType.dataType, "field3", "Comment 3"); Address arrayAddr = addr("01001888"); - Command cmd = new CreateArrayCmd(arrayAddr, 3, structure, 12); + Command cmd = new CreateArrayCmd(arrayAddr, 3, structure, 12); applyCmd(program, cmd); String arrayName = "ArrayOfStructures"; @@ -330,7 +330,7 @@ public class OperandFieldFactoryTest extends AbstractGhidraHeadedIntegrationTest structure.add(IntegerDataType.dataType, "field3", "Comment 3"); Address structAddr = addr("01001888"); - Command cmd = new CreateStructureCmd(structure, structAddr); + Command cmd = new CreateStructureCmd(structure, structAddr); applyCmd(program, cmd); String structName = "Structure"; @@ -358,7 +358,7 @@ public class OperandFieldFactoryTest extends AbstractGhidraHeadedIntegrationTest //================================================================================================== protected void disassembleAt(Address addr) { - Command cmd = new DisassembleCommand(addr, null, false); + Command cmd = new DisassembleCommand(addr, null, false); applyCmd(program, cmd); waitForSwing(); } diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/program/model/data/StructureFactoryTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/program/model/data/StructureFactoryTest.java index d488458bca..1eaea7680d 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/program/model/data/StructureFactoryTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/program/model/data/StructureFactoryTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -256,7 +256,8 @@ public class StructureFactoryTest extends AbstractGhidraHeadedIntegrationTest { // create a valid structure... int defaultPtrLen = program.getAddressFactory().getDefaultAddressSpace().getPointerSize(); - Command cmd = new CreateStructureCmd("TestStructA", addr(startOffset), structureLength); + Command cmd = + new CreateStructureCmd("TestStructA", addr(startOffset), structureLength); cmd.applyTo(program); Data d = program.getListing().getDataAt(addr(startOffset)); diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateArrayInStructureCmdTest.java b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateArrayInStructureCmdTest.java index 290036226b..9f7c28cb9b 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateArrayInStructureCmdTest.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateArrayInStructureCmdTest.java @@ -72,7 +72,7 @@ public class CreateArrayInStructureCmdTest extends AbstractGenericTest { Address addr = addr(UNDEFINED_AREA); int structLen = 30; - Command cmd = new CreateStructureCmd(addr, structLen); + Command cmd = new CreateStructureCmd(addr, structLen); cmd.applyTo(program); DataType dt = new Pointer16DataType(new ByteDataType()); @@ -120,7 +120,7 @@ public class CreateArrayInStructureCmdTest extends AbstractGenericTest { struct1.add(new DWordDataType()); struct1.add(new QWordDataType()); - Command cmd = new CreateDataCmd(addr(startOffset + 1), struct1); + Command cmd = new CreateDataCmd(addr(startOffset + 1), struct1); cmd.applyTo(program); Data dataAt = program.getListing().getDataAt(addr(startOffset + 1)); struct1 = (Structure) dataAt.getDataType(); diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateDataInStructureBackgroundCmdTest.java b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateDataInStructureBackgroundCmdTest.java index 1cbf0851f6..4d8d76bd8d 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateDataInStructureBackgroundCmdTest.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateDataInStructureBackgroundCmdTest.java @@ -69,7 +69,7 @@ public class CreateDataInStructureBackgroundCmdTest extends AbstractGenericTest int structLen = (2 * defaultPtrLen) + 2; - Command cmd = new CreateStructureCmd(addr(startOffset), structLen); + Command cmd = new CreateStructureCmd(addr(startOffset), structLen); cmd.applyTo(program); cmd = new CreateDataInStructureBackgroundCmd(addr(startOffset), new int[] { 0 }, 2, @@ -126,7 +126,7 @@ public class CreateDataInStructureBackgroundCmdTest extends AbstractGenericTest int structLen = (2 * defaultPtrLen) + (2 * structA.getLength()); - Command cmd = new CreateStructureCmd(addr(startOffset), structLen); + Command cmd = new CreateStructureCmd(addr(startOffset), structLen); cmd.applyTo(program); cmd = new CreateDataInStructureBackgroundCmd(addr(startOffset), new int[] { 0 }, @@ -175,7 +175,7 @@ public class CreateDataInStructureBackgroundCmdTest extends AbstractGenericTest long startOffset = UNDEFINED_AREA; int structLen = 4; - Command cmd = new CreateStructureCmd(addr(startOffset), structLen); + Command cmd = new CreateStructureCmd(addr(startOffset), structLen); cmd.applyTo(program); cmd = new CreateDataInStructureBackgroundCmd(addr(startOffset), new int[] { 0 }, 4, diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateDataInStructureCmdTest.java b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateDataInStructureCmdTest.java index fe0ef4000d..7e5ebdaf16 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateDataInStructureCmdTest.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateDataInStructureCmdTest.java @@ -69,7 +69,7 @@ public class CreateDataInStructureCmdTest extends AbstractGenericTest { int structLen = defaultPtrLen + 1; - Command cmd = new CreateStructureCmd(addr(startOffset), structLen); + Command cmd = new CreateStructureCmd(addr(startOffset), structLen); cmd.applyTo(program); cmd = new CreateDataInStructureCmd(addr(startOffset), new int[] { 0 }, new ByteDataType()); @@ -116,7 +116,7 @@ public class CreateDataInStructureCmdTest extends AbstractGenericTest { int structLen = defaultPtrLen + structA.getLength(); - Command cmd = new CreateStructureCmd(addr(startOffset), structLen); + Command cmd = new CreateStructureCmd(addr(startOffset), structLen); cmd.applyTo(program); cmd = new CreateDataInStructureCmd(addr(startOffset), new int[] { 0 }, structA); @@ -155,7 +155,7 @@ public class CreateDataInStructureCmdTest extends AbstractGenericTest { long startOffset = UNDEFINED_AREA; int structLen = 1; - Command cmd = new CreateStructureCmd(addr(startOffset), structLen); + Command cmd = new CreateStructureCmd(addr(startOffset), structLen); cmd.applyTo(program); cmd = new CreateDataInStructureCmd(addr(startOffset), new int[] { 0 }, new ByteDataType()); @@ -203,7 +203,7 @@ public class CreateDataInStructureCmdTest extends AbstractGenericTest { struct1.add(adt); struct1.add(new WordDataType()); - Command cmd = new CreateDataCmd(addr(startOffset + 1000), struct1); + Command cmd = new CreateDataCmd(addr(startOffset + 1000), struct1); cmd.applyTo(program); Data dataAt = program.getListing().getDataAt(addr(startOffset + 1000)); struct1 = (Structure) dataAt.getDataType(); diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateStructureInStructureCmdTest.java b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateStructureInStructureCmdTest.java index 39d4c500a5..11c1e9c623 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateStructureInStructureCmdTest.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/data/CreateStructureInStructureCmdTest.java @@ -102,7 +102,7 @@ public class CreateStructureInStructureCmdTest extends AbstractGenericTest { offset = createArray(offset, 8, 4, stringPtr); int structLen = (int) (offset - startOffset); - Command cmd = new CreateStructureCmd("TestStructA", addr(startOffset), structLen); + Command cmd = new CreateStructureCmd("TestStructA", addr(startOffset), structLen); cmd.applyTo(program); Data d = program.getListing().getDataAt(addr(startOffset)); @@ -179,7 +179,7 @@ public class CreateStructureInStructureCmdTest extends AbstractGenericTest { offset = createArray(offset, 8, 4, stringPtr); int structLen = (int) (offset - startOffset); - Command cmd = new CreateStructureCmd("TestStructA", addr(startOffset), structLen); + Command cmd = new CreateStructureCmd("TestStructA", addr(startOffset), structLen); cmd.applyTo(program); Data d = program.getListing().getDataAt(addr(startOffset)); diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/function/CreateFunctionCmdWithFlowTest.java b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/function/CreateFunctionCmdWithFlowTest.java index b07a2634d4..e20c473a88 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/function/CreateFunctionCmdWithFlowTest.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/function/CreateFunctionCmdWithFlowTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,6 @@ import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; -import generic.test.AbstractGenericTest; import ghidra.app.plugin.core.analysis.AnalysisBackgroundCommand; import ghidra.app.plugin.core.analysis.AutoAnalysisManager; import ghidra.framework.cmd.Command; @@ -30,7 +29,6 @@ import ghidra.program.database.ProgramBuilder; import ghidra.program.database.function.OverlappingFunctionException; import ghidra.program.model.address.*; import ghidra.program.model.listing.*; -import ghidra.program.model.symbol.SourceType; import ghidra.test.AbstractGhidraHeadedIntegrationTest; import ghidra.test.TestEnv; @@ -78,7 +76,7 @@ public class CreateFunctionCmdWithFlowTest extends AbstractGhidraHeadedIntegrati AutoAnalysisManager analysisMgr = AutoAnalysisManager.getAnalysisManager(program); analysisMgr.reAnalyzeAll(null); - Command cmd = new AnalysisBackgroundCommand(analysisMgr, false); + Command cmd = new AnalysisBackgroundCommand(analysisMgr, false); tool.execute(cmd, program); waitForBusyTool(tool); } diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/label/AddLabelCmdTest.java b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/label/AddLabelCmdTest.java index f8ab6715de..5e3a91f7fb 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/label/AddLabelCmdTest.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/label/AddLabelCmdTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -263,7 +263,7 @@ public class AddLabelCmdTest extends AbstractGenericTest { return p.getSymbolTable().getPrimarySymbol(addr); } - private boolean execute(Command cmd) { + private boolean execute(Command cmd) { int txId = notepad.startTransaction("Transaction"); boolean result = cmd.applyTo(notepad); notepad.endTransaction(txId, true); diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/label/CreateNamespacesCmdTest.java b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/label/CreateNamespacesCmdTest.java index c6d1485b0e..117bf9c4c6 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/label/CreateNamespacesCmdTest.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/label/CreateNamespacesCmdTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -68,7 +68,8 @@ public class CreateNamespacesCmdTest extends AbstractGenericTest { String[] namespaces1 = new String[] { "Global", "child1", "child2" }; String namespaceString1 = createNamespaceStringFromArray(namespaces1); - Command command = new CreateNamespacesCmd(namespaceString1, SourceType.USER_DEFINED); + Command command = + new CreateNamespacesCmd(namespaceString1, SourceType.USER_DEFINED); boolean success = execute(command); assertTrue("Failed to create namespaces from string: " + namespaceString1 + "\nMessage: " + command.getStatusMsg(), success); @@ -348,7 +349,7 @@ public class CreateNamespacesCmdTest extends AbstractGenericTest { } } - private boolean execute(Command cmd) { + private boolean execute(Command cmd) { int txId = program.startTransaction("Transaction"); boolean result = cmd.applyTo(program); program.endTransaction(txId, true); diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/memory/AddMemoryBlockCmdTest.java b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/memory/AddMemoryBlockCmdTest.java index 36c4fb80f5..7f3f11f679 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/memory/AddMemoryBlockCmdTest.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/app/cmd/memory/AddMemoryBlockCmdTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,7 +34,7 @@ import ghidra.util.exception.RollbackException; public class AddMemoryBlockCmdTest extends AbstractGenericTest { private Program notepad; private Program x08; - private Command command; + private Command command; public AddMemoryBlockCmdTest() { super(); @@ -73,7 +73,7 @@ public class AddMemoryBlockCmdTest extends AbstractGenericTest { assertEquals(block.getName(), f.getName()); } - private boolean applyCmd(Program p, Command c) { + private boolean applyCmd(Program p, Command c) { int txId = p.startTransaction(c.getName()); boolean commit = true; try { diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/plugin/core/comments/EolCommentsTest.java b/Ghidra/Features/Base/src/test/java/ghidra/app/plugin/core/comments/EolCommentsTest.java index 7901707024..25ed5fa493 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/plugin/core/comments/EolCommentsTest.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/app/plugin/core/comments/EolCommentsTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,8 +33,7 @@ import ghidra.program.database.ProgramBuilder; import ghidra.program.database.ProgramDB; import ghidra.program.model.address.Address; import ghidra.program.model.address.AddressFactory; -import ghidra.program.model.listing.CodeUnit; -import ghidra.program.model.listing.Listing; +import ghidra.program.model.listing.*; import ghidra.program.model.symbol.RefType; import ghidra.program.model.symbol.SourceType; import ghidra.test.AbstractGhidraHeadlessIntegrationTest; @@ -96,7 +95,7 @@ public class EolCommentsTest extends AbstractGenericTest { @Test public void testReferenceToStringData() throws Exception { - Command cmd = new AddMemRefCmd(addr("0x1001000"), addr("0x1001234"), + Command cmd = new AddMemRefCmd(addr("0x1001000"), addr("0x1001234"), SourceType.USER_DEFINED, 0, true); applyCmd(cmd); @@ -115,7 +114,7 @@ public class EolCommentsTest extends AbstractGenericTest { Address dataStartAddress = addr("0x1001234"); Address offcutAddress = dataStartAddress.add(2); - Command cmd = + Command cmd = new AddMemRefCmd(addr("0x1001000"), offcutAddress, SourceType.USER_DEFINED, 0, true); applyCmd(cmd); @@ -138,7 +137,7 @@ public class EolCommentsTest extends AbstractGenericTest { Address dataStartAddress = addr("0x1001234"); Address offcutAddress = dataStartAddress.add(2); - Command cmd = + Command cmd = new AddMemRefCmd(addr("0x1001000"), offcutAddress, SourceType.USER_DEFINED, 0, true); applyCmd(cmd); @@ -165,7 +164,7 @@ public class EolCommentsTest extends AbstractGenericTest { // Address dataStartAddress = addr("0x1001234"); Address offcutAddress = dataStartAddress.add(4); - Command cmd = + Command cmd = new AddMemRefCmd(addr("0x1001000"), offcutAddress, SourceType.USER_DEFINED, 0, true); applyCmd(cmd); @@ -226,7 +225,7 @@ public class EolCommentsTest extends AbstractGenericTest { assertEquals(0, comments.size()); } - public boolean applyCmd(Command cmd) throws RollbackException { + public boolean applyCmd(Command cmd) throws RollbackException { return AbstractGhidraHeadlessIntegrationTest.applyCmd(program, cmd); } diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RemoveLabelAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RemoveLabelAction.java index 0e93d19d56..e809aea9ee 100644 --- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RemoveLabelAction.java +++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/RemoveLabelAction.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,6 +27,7 @@ import ghidra.app.plugin.core.decompile.DecompilerActionContext; import ghidra.app.util.HelpTopics; import ghidra.framework.cmd.Command; import ghidra.framework.plugintool.PluginTool; +import ghidra.program.model.listing.Program; import ghidra.program.model.symbol.SourceType; import ghidra.program.model.symbol.Symbol; import ghidra.util.HelpLocation; @@ -64,7 +65,8 @@ public class RemoveLabelAction extends AbstractDecompilerAction { @Override protected void decompilerActionPerformed(DecompilerActionContext context) { Symbol s = getSymbol(context); - Command cmd = new DeleteLabelCmd(s.getAddress(), s.getName(), s.getParentNamespace()); + Command cmd = + new DeleteLabelCmd(s.getAddress(), s.getName(), s.getParentNamespace()); PluginTool tool = context.getTool(); if (!tool.execute(cmd, context.getProgram())) { tool.setStatusInfo(cmd.getStatusMsg()); diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/TagFilterEditorDialog.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/TagFilterEditorDialog.java index 606303fc2b..127d26c218 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/TagFilterEditorDialog.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/TagFilterEditorDialog.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -157,7 +157,7 @@ public class TagFilterEditorDialog extends DialogComponentProvider implements Ta // Inner Classes //================================================================================================== - private class TagListModel extends DefaultListModel { + private class TagListModel extends DefaultListModel { TagListModel(Map allTags, Map excludedTags) { for (Map.Entry entry : allTags.entrySet()) { boolean isExcluded = excludedTags.containsKey(entry.getKey()); diff --git a/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/layout/LayoutLocationMap.java b/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/layout/LayoutLocationMap.java index 1ceab2a107..c21a661abc 100644 --- a/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/layout/LayoutLocationMap.java +++ b/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/layout/LayoutLocationMap.java @@ -180,7 +180,7 @@ public class LayoutLocationMap { return row; } - public int gridX(Column col) { + public int gridX(Column col) { return col.index; } diff --git a/Ghidra/Processors/ARM/src/test.slow/java/ghidra/app/plugin/core/analysis/ArmBranchReturnDetectionTest.java b/Ghidra/Processors/ARM/src/test.slow/java/ghidra/app/plugin/core/analysis/ArmBranchReturnDetectionTest.java index b6237856c3..edb3e6088d 100644 --- a/Ghidra/Processors/ARM/src/test.slow/java/ghidra/app/plugin/core/analysis/ArmBranchReturnDetectionTest.java +++ b/Ghidra/Processors/ARM/src/test.slow/java/ghidra/app/plugin/core/analysis/ArmBranchReturnDetectionTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,17 +19,12 @@ import static org.junit.Assert.*; import org.junit.*; -import ghidra.app.plugin.core.analysis.AnalysisBackgroundCommand; -import ghidra.app.plugin.core.analysis.AutoAnalysisManager; import ghidra.framework.cmd.Command; import ghidra.framework.options.Options; import ghidra.framework.plugintool.PluginTool; import ghidra.program.database.ProgramBuilder; -import ghidra.program.model.address.AddressSet; -import ghidra.program.model.data.DWordDataType; -import ghidra.program.model.data.DataType; -import ghidra.program.model.listing.*; -import ghidra.program.model.symbol.SourceType; +import ghidra.program.model.listing.Instruction; +import ghidra.program.model.listing.Program; import ghidra.test.AbstractGhidraHeadedIntegrationTest; import ghidra.test.TestEnv; @@ -67,7 +62,7 @@ public class ArmBranchReturnDetectionTest extends AbstractGhidraHeadedIntegratio AutoAnalysisManager analysisMgr = AutoAnalysisManager.getAnalysisManager(program); analysisMgr.reAnalyzeAll(null); - Command cmd = new AnalysisBackgroundCommand(analysisMgr, false); + Command cmd = new AnalysisBackgroundCommand(analysisMgr, false); tool.execute(cmd, program); waitForBusyTool(tool); } diff --git a/Ghidra/Processors/JVM/src/main/java/ghidra/javaclass/analyzers/JavaAnalyzer.java b/Ghidra/Processors/JVM/src/main/java/ghidra/javaclass/analyzers/JavaAnalyzer.java index d5be33d38f..8bdb79e4ba 100644 --- a/Ghidra/Processors/JVM/src/main/java/ghidra/javaclass/analyzers/JavaAnalyzer.java +++ b/Ghidra/Processors/JVM/src/main/java/ghidra/javaclass/analyzers/JavaAnalyzer.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -433,7 +433,7 @@ public class JavaAnalyzer extends AbstractJavaAnalyzer implements AnalysisWorker Data referredData = constantPoolData.getComponent(indexMap.get(index)); instruction.addOperandReference(0, referredData.getAddress(), RefType.DATA, SourceType.ANALYSIS); - CompoundCmd cmd = new CompoundCmd("Add constant pool reference"); + CompoundCmd cmd = new CompoundCmd<>("Add constant pool reference"); String constantPoolLabel = "CPOOL[" + index + "]"; cmd.add( new AddLabelCmd(referredData.getAddress(), constantPoolLabel, SourceType.ANALYSIS)); diff --git a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/cmd/function/CreateFunctionThunkTest.java b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/cmd/function/CreateFunctionThunkTest.java index d81677c609..da283cee29 100644 --- a/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/cmd/function/CreateFunctionThunkTest.java +++ b/Ghidra/Test/IntegrationTest/src/test.slow/java/ghidra/app/cmd/function/CreateFunctionThunkTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,12 +25,10 @@ import ghidra.framework.cmd.Command; import ghidra.framework.options.Options; import ghidra.framework.plugintool.PluginTool; import ghidra.program.database.ProgramBuilder; -import ghidra.program.model.address.AddressSet; import ghidra.program.model.data.DWordDataType; import ghidra.program.model.data.DataType; import ghidra.program.model.listing.*; import ghidra.program.model.symbol.Reference; -import ghidra.program.model.symbol.SourceType; import ghidra.test.AbstractGhidraHeadedIntegrationTest; import ghidra.test.TestEnv; @@ -69,7 +67,7 @@ public class CreateFunctionThunkTest extends AbstractGhidraHeadedIntegrationTest AutoAnalysisManager analysisMgr = AutoAnalysisManager.getAnalysisManager(program); analysisMgr.reAnalyzeAll(null); - Command cmd = new AnalysisBackgroundCommand(analysisMgr, false); + Command cmd = new AnalysisBackgroundCommand(analysisMgr, false); tool.execute(cmd, program); waitForBusyTool(tool); }