GP-7104: More removal of stuff marked deprecated since 10.x (and

old
This commit is contained in:
Ryan Kurtz
2026-07-31 04:57:43 -04:00
parent efacab1c15
commit 6653f65a82
35 changed files with 67 additions and 888 deletions
@@ -124,12 +124,6 @@ public interface DBTraceDefinedDataAdapter extends DBTraceDataAdapter {
}
}
@Deprecated
@Override
default DBTraceDefinedDataAdapter getComponentAt(int offset) {
return getComponentContaining(offset);
}
@Override
default DBTraceDefinedDataAdapter getComponentContaining(int offset) {
// We may write to the cache
@@ -216,11 +210,11 @@ public interface DBTraceDefinedDataAdapter extends DBTraceDataAdapter {
@Override
default DBTraceDefinedDataAdapter getPrimitiveAt(int offset) {
// We may write to the cache
try (LockHold hold = LockHold.lock(getTrace().getReadWriteLock().writeLock())) {
try (LockHold _ = LockHold.lock(getTrace().getReadWriteLock().writeLock())) {
if (offset < 0 || offset >= getLength()) {
return null;
}
DBTraceDefinedDataAdapter component = getComponentAt(offset);
DBTraceDefinedDataAdapter component = getComponentContaining(offset);
if (component == null || component == this) {
return this;
}
@@ -244,11 +244,6 @@ public class UndefinedDBTraceData implements DBTraceDataAdapter, TraceSpaceMixin
return 0;
}
@Override
public TraceData getComponentAt(int offset) {
return null;
}
@Override
public TraceData getComponentContaining(int offset) {
return null;
@@ -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,9 +26,6 @@ public interface TraceData extends TraceCodeUnit, Data {
@Override
TraceData getComponent(int index);
@Override
TraceData getComponentAt(int offset);
@Override
TraceData getComponentContaining(int offset);
@@ -200,7 +200,7 @@ public enum TraceRegisterUtils {
}
// we know data contains register, and data cannot exceed Integer.MAX_VALUE in length
int offset = (int) range.getMinAddress().subtract(data.getMinAddress());
TraceData component = data.getComponentAt(offset);
TraceData component = data.getComponentContaining(offset);
if (component == null) { // TODO: I'm not sure this can happen
return null;
}
@@ -1687,41 +1687,41 @@ public class DBTraceCodeUnitTest extends AbstractGhidraHeadlessIntegrationTest {
assertEquals("tac", d400c.getComponent(2).getValue());
assertEquals("toe", d400c.getComponent(3).getValue());
assertNull(u3fff.getComponentAt(0));
assertNull(d4000.getComponentAt(0));
assertNull(u3fff.getComponentContaining(0));
assertNull(d4000.getComponentContaining(0));
assertNull(d4004.getComponentAt(-1));
assertEquals(d4004.getComponent(0), d4004.getComponentAt(0));
assertEquals(d4004.getComponent(0), d4004.getComponentAt(1));
assertEquals(d4004.getComponent(1), d4004.getComponentAt(2));
assertEquals(d4004.getComponent(1), d4004.getComponentAt(3));
assertEquals(d4004.getComponent(2), d4004.getComponentAt(4));
assertNull(d4004.getComponentAt(5));
assertNull(d4004.getComponentContaining(-1));
assertEquals(d4004.getComponent(0), d4004.getComponentContaining(0));
assertEquals(d4004.getComponent(0), d4004.getComponentContaining(1));
assertEquals(d4004.getComponent(1), d4004.getComponentContaining(2));
assertEquals(d4004.getComponent(1), d4004.getComponentContaining(3));
assertEquals(d4004.getComponent(2), d4004.getComponentContaining(4));
assertNull(d4004.getComponentContaining(5));
assertEquals(d400c.getComponent(0), d400c.getComponentAt(0));
assertEquals(d400c.getComponent(0), d400c.getComponentAt(1));
assertEquals(d400c.getComponent(1), d400c.getComponentAt(2));
assertEquals(d400c.getComponent(1), d400c.getComponentAt(3));
assertEquals(d400c.getComponent(1), d400c.getComponentAt(4));
assertEquals(d400c.getComponent(1), d400c.getComponentAt(5));
assertEquals(d400c.getComponent(2), d400c.getComponentAt(6));
assertEquals(d400c.getComponent(2), d400c.getComponentAt(7));
assertEquals(d400c.getComponent(2), d400c.getComponentAt(8));
assertEquals(d400c.getComponent(2), d400c.getComponentAt(9));
assertEquals(d400c.getComponent(3), d400c.getComponentAt(10));
assertEquals(d400c.getComponent(3), d400c.getComponentAt(11));
assertEquals(d400c.getComponent(3), d400c.getComponentAt(12));
assertEquals(d400c.getComponent(3), d400c.getComponentAt(13));
assertEquals(d400c.getComponent(0), d400c.getComponentContaining(0));
assertEquals(d400c.getComponent(0), d400c.getComponentContaining(1));
assertEquals(d400c.getComponent(1), d400c.getComponentContaining(2));
assertEquals(d400c.getComponent(1), d400c.getComponentContaining(3));
assertEquals(d400c.getComponent(1), d400c.getComponentContaining(4));
assertEquals(d400c.getComponent(1), d400c.getComponentContaining(5));
assertEquals(d400c.getComponent(2), d400c.getComponentContaining(6));
assertEquals(d400c.getComponent(2), d400c.getComponentContaining(7));
assertEquals(d400c.getComponent(2), d400c.getComponentContaining(8));
assertEquals(d400c.getComponent(2), d400c.getComponentContaining(9));
assertEquals(d400c.getComponent(3), d400c.getComponentContaining(10));
assertEquals(d400c.getComponent(3), d400c.getComponentContaining(11));
assertEquals(d400c.getComponent(3), d400c.getComponentContaining(12));
assertEquals(d400c.getComponent(3), d400c.getComponentContaining(13));
assertNull(d401c.getComponentAt(0));
assertNull(d401c.getComponentAt(1));
assertNull(d401c.getComponentAt(2));
assertNull(d401c.getComponentAt(3));
assertNull(d401c.getComponentContaining(0));
assertNull(d401c.getComponentContaining(1));
assertNull(d401c.getComponentContaining(2));
assertNull(d401c.getComponentContaining(3));
assertEquals(d4020.getComponent(0), d4020.getComponentAt(0));
assertEquals(d4020.getComponent(1), d4020.getComponentAt(1));
assertEquals(d4020.getComponent(2), d4020.getComponentAt(2));
assertEquals(d4020.getComponent(3), d4020.getComponentAt(3));
assertEquals(d4020.getComponent(0), d4020.getComponentContaining(0));
assertEquals(d4020.getComponent(1), d4020.getComponentContaining(1));
assertEquals(d4020.getComponent(2), d4020.getComponentContaining(2));
assertEquals(d4020.getComponent(3), d4020.getComponentContaining(3));
assertNull(u3fff.getComponentsContaining(-1));
assertTrue(u3fff.getComponentsContaining(0).isEmpty());
@@ -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.
@@ -252,11 +252,6 @@ public class ProgramMergeManagerPlugin extends MergeManagerPlugin implements Pro
// not supported
}
@Override
public void releaseProgram(Program program, Object persistentOwner) {
// not supported
}
@Override
public void saveProgram() {
// not supported
@@ -282,11 +277,6 @@ public class ProgramMergeManagerPlugin extends MergeManagerPlugin implements Pro
// not supported
}
@Override
public boolean setPersistentOwner(Program program, Object owner) {
return false;
}
public void setSearchPriority(Program p, int priority) {
// not supported
}
@@ -486,16 +486,6 @@ public class ListingMergePanel extends JPanel
return false;
}
@Override
public GoToOverrideService getOverrideService() {
return null;
}
@Override
public void setOverrideService(GoToOverrideService override) {
// no-op
}
@Override
public Navigatable getDefaultNavigatable() {
return null;
@@ -63,35 +63,6 @@ public abstract class ProgramPlugin extends Plugin {
internalRegisterEventConsumed(ProgramClosedPluginEvent.class);
}
/**
* Calling this constructor is works the same as calling {@link ProgramPlugin}.
*
* @deprecated call {@link #ProgramPlugin(PluginTool)} instead
* @param plugintool the tool
* @param consumeLocationChange not used
* @param consumeSelectionChange not used
*/
@Deprecated(forRemoval = true, since = "10.2")
public ProgramPlugin(PluginTool plugintool, boolean consumeLocationChange,
boolean consumeSelectionChange) {
this(plugintool);
}
/**
* Calling this constructor is works the same as calling {@link ProgramPlugin}.
*
* @deprecated call {@link #ProgramPlugin(PluginTool)} instead
* @param plugintool the tool
* @param consumeLocationChange not used
* @param consumeSelectionChange not used
* @param consumeHighlightChange not used
*/
@Deprecated(forRemoval = true, since = "10.2")
public ProgramPlugin(PluginTool plugintool, boolean consumeLocationChange,
boolean consumeSelectionChange, boolean consumeHighlightChange) {
this(plugintool);
}
/**
* Process the plugin event.
* <p>
@@ -45,8 +45,7 @@ public class DWARFAnalyzer extends AbstractAnalyzer {
*/
public static boolean isAlreadyImported(Program program) {
Options options = program.getOptions(Program.PROGRAM_INFO);
return options.getBoolean(DWARF_LOADED_OPTION_NAME, false) ||
oldCheckIfDWARFImported(program);
return options.getBoolean(DWARF_LOADED_OPTION_NAME, false);
}
private DWARFImportOptions importOptions = new DWARFImportOptions();
@@ -132,15 +131,6 @@ public class DWARFAnalyzer extends AbstractAnalyzer {
return false;
}
@Deprecated(forRemoval = true, since = "10.0")
private static boolean oldCheckIfDWARFImported(Program prog) {
// this was the old way of checking if the DWARF analyzer had already been run. Keep
// it around for a little bit so existing programs that have already imported DWARF data
// don't get re-run. Remove after a release or two.
return DWARFFunctionImporter.hasDWARFProgModule(prog, DWARFProgram.DWARF_ROOT_NAME);
}
@Override
public boolean canAnalyze(Program program) {
return DWARFProgram.isDWARF(program);
@@ -37,7 +37,6 @@ import ghidra.app.util.HelpTopics;
import ghidra.app.util.NamespaceUtils;
import ghidra.app.util.task.OpenProgramRequest;
import ghidra.app.util.task.OpenProgramTask;
import ghidra.framework.client.ClientUtil;
import ghidra.framework.main.OpenVersionedFileDialog;
import ghidra.framework.model.*;
import ghidra.framework.options.*;
@@ -1081,20 +1080,6 @@ public class ProgramManagerPlugin extends Plugin implements ProgramManager, Opti
return programMgr.isVisible(program);
}
@Override
public void releaseProgram(Program program, Object owner) {
if (programMgr.contains(program)) {
programMgr.releaseProgram(program, owner);
Msg.info(ClientUtil.class,
"Released program from " + tool.getName() + " tool: " + program.getDomainFile());
}
}
@Override
public boolean setPersistentOwner(Program program, Object owner) {
return programMgr.setPersistentOwner(program, owner);
}
public boolean isManaged(Program program) {
return programMgr.contains(program);
}
@@ -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.
@@ -29,10 +29,10 @@ import ghidra.app.services.*;
* a ".sng" model file to score strings.
*/
public class TrigramStringValidator implements StringValidatorService {
/**
* Remove this flag when the trigram model thresholds have been recalculated
*/
@Deprecated(forRemoval = true, since = "10.3")
// !-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!
// TODO: Remove this flag when the trigram model thresholds have been recalculated
// !-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!
private static final boolean PRESERVE_BUG_SKIP_TRIGRAM = true;
// "Bad" log to be used as default score when we know the string is bad
@@ -223,10 +223,4 @@ public interface GoToService {
* @return the navigatable
*/
public Navigatable getDefaultNavigatable();
@Deprecated(forRemoval = true, since = "10.2")
public GoToOverrideService getOverrideService();
@Deprecated(forRemoval = true, since = "10.2")
public void setOverrideService(GoToOverrideService override);
}
@@ -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.
@@ -189,36 +189,6 @@ public interface ProgramManager {
*/
public void saveProgramAs(Program program);
/**
* Establish a persistent owner on an open program. This will cause the program manager to imply
* make a program hidden if it is closed.
*
* @param program the program
* @param owner the owner
* @return true if program is open and another object is not already the owner, or the specified
* owner is already the owner.
* @see #releaseProgram(Program, Object)
* @deprecated this method is no longer used by the system
*/
@Deprecated(forRemoval = true, since = "10.2")
public boolean setPersistentOwner(Program program, Object owner);
/**
* Release the persistent ownership of a program.
* <p>
* The program will automatically be closed if it is hidden or was marked as temporary. If any
* of these closures corresponds to a program with changes the user will be given an opportunity
* to save or keep the program open.
* <p>
* If persistentOwner is not the correct owner, the method will have no affect.
*
* @param program the program
* @param persistentOwner the owner defined by {@link #setPersistentOwner(Program, Object)}
* @deprecated this method is no longer used by the system
*/
@Deprecated(forRemoval = true, since = "10.2")
public void releaseProgram(Program program, Object persistentOwner);
/**
* Closes the given program with the option of saving any changes. The exact behavior of this
* method depends on several factors. First of all, if any other tool has this program open,
@@ -106,13 +106,6 @@ public class GoToAddressLabelDialog extends ReusableDialogComponentProvider
this.navigatable = nav;
currentAddress = addr;
clearStatusText();
GoToOverrideService override = goToService.getOverrideService();
if (override != null) {
JComponent comp = override.getOverrideComponent();
if (comp != null) {
mainPanel.add(comp, BorderLayout.SOUTH);
}
}
setDialogEnabled(true);
tool.showDialog(this);
}
@@ -38,11 +38,6 @@ public class GoToServiceImpl implements GoToService {
helper = new GoToHelper(plugin.getTool());
}
@Override
public GoToOverrideService getOverrideService() {
return override;
}
@Override
public boolean goTo(ProgramLocation loc) {
return helper.goTo(defaultNavigatable, loc, loc.getProgram());
@@ -155,11 +150,6 @@ public class GoToServiceImpl implements GoToService {
return goToQuery(defaultNavigatable, fromAddr, queryData, listener, monitor);
}
@Override
public void setOverrideService(GoToOverrideService override) {
this.override = override;
}
@Override
public Navigatable getDefaultNavigatable() {
return defaultNavigatable;
@@ -391,7 +391,7 @@ public class ProgramBigListingModel implements ListingModel, FormatModelListener
int length = dt.getLength();
for (; offset < length; offset++) {
// If not beyond structure's end, check for non-filler.
data = parent.getComponentAt(offset);
data = parent.getComponentContaining(offset);
if (data != null) { // Found non filler address so return it.
return data.getMinAddress();
}
@@ -540,7 +540,6 @@ public class ProgramBigListingModel implements ListingModel, FormatModelListener
private void addUnionPostOpenData(List<Data> list, Data data, Address addr) {
DataType dt = data.getBaseDataType();
if (dt instanceof Union) {
Address dataAddr = data.getMinAddress();
if (openCloseMgr.isDataOpen(data)) {
int openIndex = openCloseMgr.getOpenDataIndex(data);
int i = openIndex;
@@ -46,11 +46,6 @@ class ListingDisplayGoToService implements GoToService {
this.listingPanel = listingPanel;
}
@Override
public GoToOverrideService getOverrideService() {
return null;
}
@Override
public boolean goTo(ProgramLocation loc) {
return doGoTo(loc);
@@ -121,11 +116,6 @@ class ListingDisplayGoToService implements GoToService {
"Go To Address or Label Query is not allowed in a dual listing view.");
}
@Override
public void setOverrideService(GoToOverrideService override) {
// ignored
}
@Override
public Navigatable getDefaultNavigatable() {
return new ListingDisplayNavigator(listingPanel, this);
@@ -72,21 +72,6 @@ public class FileCache {
private FileCacheMaintenanceDaemon cleanDaemon;
private ReferenceMap<String, FileCacheEntry> memCache = new ReferenceMap<>();
/**
* Backwards compatible with previous cache directories to age off the files located
* therein.
*
* @param oldCacheDir the old 2-level cache directory
* @deprecated Marked as deprecated to ensure this is removed in a few versions after most
* user's old-style cache dirs have been cleaned up.
*/
@Deprecated(forRemoval = true, since = "10.1")
public static void performCacheMaintOnOldDirIfNeeded(File oldCacheDir) {
if (oldCacheDir.isDirectory()) {
performCacheMaintIfNeeded(oldCacheDir, 2 /* old nesting level */);
}
}
/**
* Creates a new {@link FileCache} instance where files are stored under the specified
* {@code cacheDir}
@@ -154,10 +154,6 @@ public class FileSystemService {
*/
public FileSystemService() {
this(new File(Application.getUserCacheDirectory(), "fscache2"));
// age off files in old cache dir. Remove this after a few versions
FileCache.performCacheMaintOnOldDirIfNeeded(
new File(Application.getUserCacheDirectory(), "fscache"));
}
/**
@@ -47,27 +47,6 @@ public class MakeProgramSelectionAction extends DockingAction {
private Navigatable navigatable;
private GhidraTable table;
/**
* Special constructor for clients that do not have a plugin.
* <p>
* Clients using this constructor must override
* {@link #makeProgramSelection(ProgramSelection, ActionContext)}.
*
* <p>
* Update: the preferred constructor for clients without a plugin is
* {@link #MakeProgramSelectionAction(Navigatable, String, GhidraTable)}.
*
* @param owner the action's owner
* @param table the table needed for this action
* @deprecated use either of the other constructors
*/
@Deprecated(forRemoval = true, since = "10.2")
public MakeProgramSelectionAction(String owner, GhidraTable table) {
super("Make Selection", owner, KeyBindingType.SHARED);
this.table = Objects.requireNonNull(table);
init(null);
}
/**
* Special constructor for clients that do not have a plugin.
* <p>
@@ -105,18 +105,6 @@ public class TestDummyGoToService implements GoToService {
return false;
}
@Override
public GoToOverrideService getOverrideService() {
// stub
return null;
}
@Override
public void setOverrideService(GoToOverrideService override) {
// stub
}
@Override
public Navigatable getDefaultNavigatable() {
// stub
@@ -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.
@@ -111,17 +111,6 @@ public class TestDummyProgramManager implements ProgramManager {
// stub
}
@Override
public boolean setPersistentOwner(Program program, Object owner) {
// stub
return false;
}
@Override
public void releaseProgram(Program program, Object persistentOwner) {
// stub
}
@Override
public boolean closeProgram(Program program, boolean ignoreChanges) {
// stub
@@ -1,113 +0,0 @@
/* ###
* IP: GHIDRA
*
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.test;
import java.io.*;
/**
* Compile a java file; deletes the java file and the class file when the
* junit exits.
*
*
*/
@Deprecated(forRemoval = true, since = "10.2") // This is not used
public class JavaCompiler {
private IOThread cmdOut;
private IOThread cmdErr;
public void compile(File javaFile) {
String name = javaFile.getName();
String className = name.substring(0, name.indexOf(".")) + ".class";
File parent = javaFile.getParentFile();
String parentPath = parent.getAbsolutePath();
int pos = parentPath.lastIndexOf("ghidra");
String destPath = parentPath.substring(0, pos - 1);
javaFile.deleteOnExit();
File classFile = new File(parent, className);
classFile.deleteOnExit();
String classpath = System.getProperty("java.class.path");
String javaLoc = System.getProperty("java.home");
if (javaLoc.endsWith("jre")) {
javaLoc = javaLoc.substring(0, javaLoc.indexOf("jre") - 1);
}
String argV[] = new String[6];
argV[0] = javaLoc + File.separator + "bin" + File.separator + "javac";
argV[1] = "-classpath";
argV[2] = classpath;
argV[3] = "-d";
argV[4] = destPath;
argV[5] = javaFile.getAbsolutePath();
try {
Process p = Runtime.getRuntime().exec(argV);
for (String element : argV) {
System.out.print(element + " ");
}
System.out.println();
InputStream stderrStream = p.getErrorStream();
InputStream stdinStream = p.getInputStream();
setupIO(stdinStream, stderrStream);
p.waitFor();
cmdOut.join();
cmdErr.join();
}
catch (Exception e) {
e.printStackTrace();
}
}
private void setupIO(InputStream stdin, InputStream stderr) {
cmdOut = new IOThread(stdin); //
cmdErr = new IOThread(stderr);
cmdOut.start();
cmdErr.start();
}
/**
*
* Thread to read from an input stream and write it to stdout.
*/
private class IOThread extends Thread {
private BufferedReader shellOutput;
public IOThread(InputStream input) {
shellOutput = new BufferedReader(new InputStreamReader(input));
}
@Override
public void run() {
String line = null;
try {
while ((line = shellOutput.readLine()) != null) {
System.out.println(line);
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
}
@@ -15,16 +15,13 @@
*/
package datagraph.data.graph.panel.model.row;
import docking.widgets.table.GTable;
import docking.widgets.table.RowObject;
import ghidra.program.model.listing.Data;
/**
* Abstract class for displaying rows in a Data GTrable model. Similar to a {@link RowObject} in
* a {@link GTable}. The big difference is that each row maintains its indent level and whether
* or not is is expanded. GTrables are like tables, but with a tree like structure. Each row that is
* a child of another row has its indent level set to one more than its parent. The expanded flag is
* used to indicate if a given row has visible child rows showing or not.
* Abstract class for displaying rows in a Data GTrable model. Each row maintains its indent level
* and whether or not is is expanded. GTables are like tables, but with a tree like structure. Each
* row that is a child of another row has its indent level set to one more than its parent. The
* expanded flag is used to indicate if a given row has visible child rows showing or not.
*/
public abstract class DataRowObject {
@@ -78,7 +75,7 @@ public abstract class DataRowObject {
}
/**
* @{return the Data object associated with this row.}
* {@return the Data object associated with this row.}
*/
public abstract Data getData();
@@ -49,11 +49,6 @@ public class DiffGoToService implements GoToService {
helper = new GoToHelper(diffPlugin.getTool());
}
@Override
public GoToOverrideService getOverrideService() {
return goToService.getOverrideService();
}
@Override
public boolean goTo(ProgramLocation loc) {
return diffGoTo(loc);
@@ -161,11 +156,6 @@ public class DiffGoToService implements GoToService {
return goToService.goToQuery(navigatable, fromAddr, queryData, listener, monitor);
}
@Override
public void setOverrideService(GoToOverrideService override) {
// Do nothing. (May need to change this later if there is reason to override Diff.)
}
@Override
public Navigatable getDefaultNavigatable() {
return goToService.getDefaultNavigatable();
@@ -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.
@@ -113,11 +113,6 @@ public class DiffProgramManager implements ProgramManager {
// stub
}
@Override
public void releaseProgram(Program program, Object persistentOwner) {
// stub
}
@Override
public void saveProgram() {
// stub
@@ -142,9 +137,4 @@ public class DiffProgramManager implements ProgramManager {
public void setCurrentProgram(Program p) {
// stub
}
@Override
public boolean setPersistentOwner(Program program, Object owner) {
return false;
}
}
@@ -1,138 +0,0 @@
/* ###
* IP: GHIDRA
*
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package docking.widgets.dialogs;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Arrays;
import java.util.List;
import javax.swing.*;
import docking.DialogComponentProvider;
import docking.widgets.table.*;
/**
* @param <T> the type
*
*
* @deprecated This class has been replaced by {@link TableSelectionDialog}. At the time of
* writing, both classes are identical. This version introduced a naming conflict with another
* API. Thus, the new version better matches the existing dialog choosing API.
*/
@Deprecated(forRemoval = true, since = "9.3")
public class TableChooserDialog<T> extends DialogComponentProvider {
private RowObjectTableModel<T> model;
private GFilterTable<T> gFilterTable;
private List<T> selectedItems;
/**
* Create a new Dialog for displaying and choosing table row items
*
* @param title The title for the dialog
* @param model a {@link RowObjectTableModel} that has the tRable data
* @param allowMultipleSelection if true, the dialog allows the user to select more
* than one row; otherwise, only single selection is allowed
* @deprecated see the class header
*/
@Deprecated(forRemoval = true, since = "9.3")
public TableChooserDialog(String title, RowObjectTableModel<T> model,
boolean allowMultipleSelection) {
super(title);
this.model = model;
addWorkPanel(buildTable(allowMultipleSelection));
addOKButton();
addCancelButton();
}
/**
* Returns the list of selected items or null if the dialog was cancelled.
* @return the list of selected items or null if the dialog was cancelled.
* @deprecated see the class header
*/
@Deprecated(forRemoval = true, since = "9.3")
public List<T> getSelectionItems() {
return selectedItems;
}
private void initializeTable(boolean allowMultipleSelection) {
GTable table = gFilterTable.getTable();
table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
int selectionMode = allowMultipleSelection ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
: ListSelectionModel.SINGLE_SELECTION;
table.getSelectionModel().setSelectionMode(selectionMode);
}
protected void processMouseClicked(MouseEvent e) {
if (e.getClickCount() != 2) {
return;
}
int rowAtPoint = gFilterTable.getTable().rowAtPoint(e.getPoint());
if (rowAtPoint < 0) {
return;
}
T selectedRowObject = gFilterTable.getSelectedRowObject();
selectedItems = Arrays.asList(selectedRowObject);
close();
}
@Override
protected void okCallback() {
selectedItems = gFilterTable.getSelectedRowObjects();
close();
gFilterTable.dispose();
}
@Override
protected void cancelCallback() {
selectedItems = null;
close();
gFilterTable.dispose();
}
@Override
protected void dialogShown() {
gFilterTable.focusFilter();
}
private JComponent buildTable(boolean allowMultipleSelection) {
gFilterTable = new GFilterTable<>(model);
initializeTable(allowMultipleSelection);
gFilterTable.getTable().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (!e.isShiftDown()) {
processMouseClicked(e);
}
updateOkEnabled();
}
});
setOkEnabled(false);
gFilterTable.getAccessibleContext().setAccessibleName("Table Chooser");
return gFilterTable;
}
protected void updateOkEnabled() {
setOkEnabled(gFilterTable.getSelectedRowObject() != null);
}
}
@@ -1,128 +0,0 @@
/* ###
* IP: GHIDRA
*
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package docking.widgets.table;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.TableModel;
import ghidra.util.SystemUtilities;
/**
* An object that represents a row in a table. Most tables used in the system create models that
* use their own row objects (see {@link AbstractSortedTableModel}). This class exists to
* compensate for those models that do not do this, but instead rely on the classic Java
* {@link TableModel} method {@link TableModel#getValueAt(int, int)}.
* <p>
* For the best behavior, a table model implementation should extend
* {@link AbstractSortedTableModel}, as the system is written to work for those models. Use of
* this class as a workaround is a suitable default, but will not always result in the desired
* behavior. A major reason for this is that if any of the table's cell values change, the
* row objects that created for non-{@link AbstractSortedTableModel}s will not be equal to
* those created before the data change. This causes some features to break, such as selection
* restoration after user edits.
*
* @deprecated this class is no longer used and will be removed
*/
@Deprecated(forRemoval = true, since = "10.1")
public class RowObject {
/**
* Factory method to create and initialize a row object.
*
* @param model the model required to gather data for the row object.
* @param row the row for which to create a row object
* @return the row object
*/
public static RowObject createRowObject(TableModel model, int row) {
RowObject rowObject = new RowObject();
int columns = model.getColumnCount();
for (int i = 0; i < columns; i++) {
rowObject.addElement(model.getValueAt(row, i));
}
return rowObject;
}
List<Object> values = new ArrayList<>();
int hash = -1;
void addElement(Object object) {
values.add(object);
hash = -1;
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
RowObject other = (RowObject) obj;
if (values.size() != other.values.size()) {
return false;
}
for (int i = 0; i < values.size(); i++) {
Object object = values.get(i);
if (!SystemUtilities.isEqual(object, other.values.get(i))) {
return false;
}
}
return true;
}
@Override
public int hashCode() {
if (hash != -1) {
return hash;
}
computeHash();
return hash;
}
private void computeHash() {
int result = 17;
result = 31 * result + values.hashCode();
hash = result;
}
@Override
public String toString() {
return "RowObject: " + getValuesAsString();
}
private String getValuesAsString() {
StringBuilder buildy = new StringBuilder();
for (Object object : values) {
if (buildy.length() > 0) {
buildy.append(", ");
}
buildy.append(object == null ? "" : object.toString());
}
return buildy.toString();
}
}
@@ -16,121 +16,14 @@
package ghidra.util;
/**
* Helper methods for converting between
* number data types without negative
* promotion.
* <p>
* Consider using java built-in methods for conversion instead of methods from this
* class.
* Legacy methods for converting between number data types without negative promotion. Most methods
* have been deprecated off in favor of built-in Java methods.
*/
public class Conv {
private Conv() {
// prevent instantiation
}
/**
* A byte mask.
*
* @deprecated {@link Byte#toUnsignedInt(byte)} will handle most use cases of this constant
*/
@Deprecated(forRemoval = true, since = "10.2")
public static final int BYTE_MASK = 0xff;
/**
* A short mask.
* @deprecated {@link Short#toUnsignedInt(short)} will handle most use cases of this constant
*/
@Deprecated(forRemoval = true, since = "10.2")
public static final int SHORT_MASK = 0xffff;
/**
* An integer mask.
* @deprecated {@link Integer#toUnsignedLong(int)} will handle most use cases of this constant
*/
@Deprecated(forRemoval = true, since = "10.2")
public static final long INT_MASK = 0x00000000ffffffffL;
/**
* @param b the byte
* @return the short equivalent of the byte
* @deprecated Use other built-ins like {@link Byte#toUnsignedInt(byte)}
*/
@Deprecated(forRemoval = true, since = "10.2")
public static short byteToShort(byte b) {
return (short) (b & 0xff);
}
/**
* Converts a byte to an integer.
*
* @param b the byte
* @return the integer equivalent of the byte
* @deprecated Use {@link Byte#toUnsignedInt(byte)} instead
*/
@Deprecated(forRemoval = true, since = "10.2")
public static int byteToInt(byte b) {
return Byte.toUnsignedInt(b);
}
/**
* Converts a byte to a long.
* @param b the byte
* @return the long equivalent of the byte
* @deprecated Use {@link Byte#toUnsignedLong(byte)} instead
*/
@Deprecated(forRemoval = true, since = "10.2")
public static long byteToLong(byte b) {
return Byte.toUnsignedLong(b);
}
/**
* Converts a short to an integer.
* @param s the short
* @return the integer equivalent of the short
* @deprecated Use {@link Short#toUnsignedInt(short)} instead
*/
@Deprecated(forRemoval = true, since = "10.2")
public static int shortToInt(short s) {
return Short.toUnsignedInt(s);
}
/**
* Converts a short to a long.
* @param s the short
* @return the long equivalent of the short
* @deprecated Use {@link Short#toUnsignedLong(short)} instead
*/
@Deprecated(forRemoval = true, since = "10.2")
public static long shortToLong(short s) {
return Short.toUnsignedLong(s);
}
/**
* Converts an integer to a long.
* @param i the integer
* @return the long equivalent of the long
* @deprecated Use {@link Integer#toUnsignedLong(int)} instead
*/
@Deprecated(forRemoval = true, since = "10.2")
public static long intToLong(int i) {
return Integer.toUnsignedLong(i);
}
/**
* Old and <b>incorrect</b> way to convert bytes to a String by casting their
* values to chars. Do not use. Does not seem to be used in current codebase.
*
* @param array The bytes to convert
* @return The converted bytes
* @deprecated Use {@link String#String(byte[], java.nio.charset.Charset) new String(bytes, StandardCharSets.US_ASCII)}
* instead
*/
@Deprecated(forRemoval = true, since = "10.2")
public static String toString(byte [] array) {
StringBuilder builder = new StringBuilder();
for (byte b : array) {
builder.append((char) b);
}
return builder.toString();
}
/**
* Consider using {@link String#format(String, Object...) String.format("%02x", b)} instead.
@@ -141,7 +34,7 @@ public class Conv {
* @return the padded hex string
*/
public static String toHexString(byte b) {
return zeropad(Integer.toHexString(Byte.toUnsignedInt(b)), 2);
return String.format("%02x", b);
}
/**
@@ -153,7 +46,7 @@ public class Conv {
* @return the padded hex string
*/
public static String toHexString(short s) {
return zeropad(Integer.toHexString(Short.toUnsignedInt(s)), 4);
return String.format("%04x", s);
}
/**
@@ -165,7 +58,7 @@ public class Conv {
* @return the padded hex string
*/
public static String toHexString(int i) {
return zeropad(Integer.toHexString(i), 8);
return String.format("%08x", i);
}
/**
@@ -177,7 +70,7 @@ public class Conv {
* @return the padded hex string
*/
public static String toHexString(long l) {
return zeropad(Long.toHexString(l), 16);
return String.format("%016x", l);
}
/**
@@ -196,5 +89,4 @@ public class Conv {
}
return builder.toString();
}
}
@@ -1,58 +0,0 @@
/* ###
* IP: GHIDRA
*
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.util.graph;
import ghidra.util.datastruct.LongDoubleHashtable;
import ghidra.util.exception.NoValueException;
/**
*
* This class modifies the behavior of LongDoubleHashtable. May add
* to the value stored with the key rather than replacing the value.
*
*/
@Deprecated(forRemoval = true, since = "10.2")
public class AddableLongDoubleHashtable extends LongDoubleHashtable {
public AddableLongDoubleHashtable() {
super();
}
/** Constructor creates a table with an initial given capacity. The capacity
* will be adjusted to the next highest prime in the PRIMES table.
*/
public AddableLongDoubleHashtable(int capacity) {
super(capacity);
}
/** Adds the value to the stored value rather than replacing it. */
public void add(long key, double value) {
try {
if (this.contains(key)) {
double oldValue = this.get(key);
double newValue = oldValue + value;
this.put(key, newValue);
}
else {
this.put(key, value);
}
}
catch (NoValueException e) {
//can't happen do nothing
}
}
}
@@ -123,14 +123,6 @@ public class AbstractGuiTest extends AbstractGenericTest {
waitForSwing();
}
/**
* @deprecated Use {@link #waitForSwing()} instead
*/
@Deprecated(forRemoval = true, since = "10.3")
public static void waitForPostedSwingRunnables() {
waitForSwing();
}
public static <T extends Component> T findComponent(Container parent, Class<T> desiredClass) {
return findComponent(parent, desiredClass, false);
}
@@ -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.
@@ -276,12 +276,6 @@ public class PseudoData extends PseudoCodeUnit implements Data {
return (component == null ? null : component.getComponent(componentPath));
}
@Deprecated
@Override
public Data getComponentAt(int offset) {
return getComponentContaining(offset);
}
@Override
public Data getComponentContaining(int offset) {
if (offset < 0 || offset > length) {
@@ -426,7 +420,7 @@ public class PseudoData extends PseudoCodeUnit implements Data {
if (offset < 0 || offset >= length) {
return null;
}
Data dc = getComponentAt(offset);
Data dc = getComponentContaining(offset);
if (dc == null || dc == this) {
return this;
}
@@ -456,11 +456,6 @@ class DataDB extends CodeUnitDB implements Data {
}
}
@Override
public Data getComponentAt(int offset) {
return getComponentContaining(offset);
}
@Override
public Data getComponentContaining(int offset) {
try (Closeable c = lock.read()) {
@@ -232,20 +232,6 @@ public interface Data extends CodeUnit, Settings {
*/
public int getNumComponents();
/**
* Return the first immediate child component that contains the byte at the given offset. It
* is important to note that with certain datatypes there may be more than one component
* containing the specified offset (see {@link #getComponentsContaining(int)}).
*
* @param offset the amount to add to this data items address to get the address of the
* requested data item.
* @return first data component containing offset or null
* @deprecated method name has been changed to better reflect behavior. The method
* {@link #getComponentContaining(int)} should be used instead.
*/
@Deprecated(forRemoval = true, since = "10.1")
public Data getComponentAt(int offset);
/**
* Return the first immediate child component that contains the byte at the given offset. It
* is important to note that with certain datatypes there may be more than one component
@@ -512,11 +512,6 @@ public class DataStub implements Data {
throw new UnsupportedOperationException();
}
@Override
public Data getComponentAt(int offset) {
throw new UnsupportedOperationException();
}
@Override
public Data getComponentContaining(int offset) {
throw new UnsupportedOperationException();