GP-0: More deprecation updates

This commit is contained in:
Ryan Kurtz
2026-08-03 12:21:19 -04:00
parent 264130231b
commit 721faeff71
42 changed files with 119 additions and 117 deletions
@@ -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.
@@ -17,18 +17,17 @@
//@category Update
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import ghidra.app.script.GhidraScript;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressIterator;
import ghidra.program.model.listing.CommentType;
import ghidra.program.model.listing.Listing;
import ghidra.program.model.mem.Memory;
public class FindAndReplaceCommentScript extends GhidraScript {
private static final String[] COMMENT_TYPES = { "EOL", "Pre", "Post", "Plate", "Repeatable" };
@Override
public void run() throws Exception {
Listing listing = currentProgram.getListing();
@@ -43,14 +42,14 @@ public class FindAndReplaceCommentScript extends GhidraScript {
while (commentAddresses.hasNext()) {
Address address = commentAddresses.next();
for (int i = 0; i < COMMENT_TYPES.length; i++) {
String commentValue = listing.getComment(i, address);
for (CommentType type : CommentType.values()) {
String commentValue = listing.getComment(type, address);
if (commentValue != null && commentValue.contains(toFind)) {
replaced = true;
listing.setComment(address, i, StringUtils.replace(commentValue, toFind, toReplace));
printf("\nChanged %s Comment at address %s.\n", COMMENT_TYPES[i],
address.toString());
listing.setComment(address, type,
Strings.CS.replace(commentValue, toFind, toReplace));
printf("\nChanged %s Comment at address %s.\n", type, address.toString());
}
}
}
@@ -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.
@@ -18,7 +18,7 @@
//@category Functions
import ghidra.app.script.GhidraScript;
import ghidra.program.model.data.DataType;
import ghidra.program.model.data.VoidDataType;
import ghidra.program.model.listing.Function;
import ghidra.program.model.listing.FunctionIterator;
import ghidra.program.model.symbol.SourceType;
@@ -52,6 +52,6 @@ public class MakeFunctionsInlineVoidScript extends GhidraScript {
private void updateFunction(Function func) throws InvalidInputException {
func.setInline(true);
func.setReturnType(DataType.VOID, SourceType.USER_DEFINED);
func.setReturnType(VoidDataType.dataType, SourceType.USER_DEFINED);
}
}
@@ -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,7 +27,7 @@ import ghidra.util.exception.InvalidInputException;
* it unique.
* @deprecated The need for this class is now unnecessary since duplicate labels are permitted
*/
@Deprecated
@Deprecated(since = "9.1")
public class AddUniqueLabelCmd implements Command<Program> {
private Address address;
private String name;
@@ -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 java.util.Map.Entry;
import javax.swing.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import docking.DialogComponentProvider;
import docking.DockingUtils;
@@ -184,7 +185,7 @@ class DataWindowFilterDialog extends DialogComponentProvider {
for (String type : filteredList) {
Boolean enabled = typeEnabledMap.get(type);
StringBuilder html = new StringBuilder(type);
int firstIndex = StringUtils.indexOfIgnoreCase(type, filteredText, 0);
int firstIndex = Strings.CI.indexOf(type, filteredText, 0);
int lastIndex = firstIndex + filteredText.length();
html.insert(lastIndex, "</b>"); // do before first index (for no math on index)
html.insert(firstIndex, "<b>");
@@ -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.
@@ -82,7 +82,7 @@ class CreateArrayAction extends ListingContextAction {
Function fun = plugin.getFunction(context);
if (loc instanceof FunctionSignatureFieldLocation) {
DataType dt = fun.getReturnType();
if (dt == DataType.VOID) {
if (dt == VoidDataType.dataType) {
dt = DataType.DEFAULT;
}
if (dt.getLength() < 1) {
@@ -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.
@@ -478,7 +478,7 @@ public class FunctionPlugin extends Plugin implements DataService {
return false;
}
if (dataType != DataType.DEFAULT && dataType != DataType.VOID) {
if (dataType != DataType.DEFAULT && dataType != VoidDataType.dataType) {
dtmService.setRecentlyUsed(dataType);
}
@@ -652,7 +652,8 @@ public class FunctionPlugin extends Plugin implements DataService {
// Add Favorite data actions
List<DataType> favorites = dtmService.getFavorites();
for (DataType dataType : favorites) {
if (dataType.isEquivalent(POINTER_DATA_TYPE) || dataType.isEquivalent(DataType.VOID)) {
if (dataType.isEquivalent(POINTER_DATA_TYPE) ||
dataType.isEquivalent(VoidDataType.dataType)) {
continue;
}
action = new DataAction(dataType, this);
@@ -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,16 +15,16 @@
*/
package ghidra.app.plugin.core.function;
import ghidra.program.model.data.DataType;
import java.awt.event.KeyEvent;
import javax.swing.KeyStroke;
import ghidra.program.model.data.VoidDataType;
public class VoidDataAction extends DataAction {
public VoidDataAction(FunctionPlugin plugin) {
super(DataType.VOID, plugin);
super(VoidDataType.dataType, plugin);
setPopupMenu(FunctionPlugin.SET_RETURN_TYPE_MENU_PATH, true);
}
@@ -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.
@@ -17,7 +17,7 @@ package ghidra.app.plugin.core.navigation.locationreferences;
import java.awt.Color;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import docking.widgets.fieldpanel.support.Highlight;
import ghidra.app.services.FieldMatcher;
@@ -119,7 +119,7 @@ public class GenericCompositeDataTypeLocationDescriptor extends GenericDataTypeL
else if (OperandFieldFactory.class.isAssignableFrom(fieldFactoryClass)) {
// Not sure how to get the correct part of the text. This is a hack for now.
int offset = StringUtils.indexOfIgnoreCase(text, typeDisplayString, 0);
int offset = Strings.CI.indexOf(text, typeDisplayString, 0);
if (offset != -1) {
return new Highlight[] { new Highlight(offset,
offset + typeDisplayString.length() - 1, highlightColor) };
@@ -405,7 +405,7 @@ public class GhidraScriptUtil {
* @param name the name of the script
* @return the name as a file path
*/
@Deprecated
@Deprecated(since = "9.2.3")
static String fixupName(String name) {
GhidraScriptProvider provider = findProvider(name);
// assume Java if no provider matched
@@ -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.
@@ -133,7 +133,7 @@ public interface BlockModelService {
* @return new Subroutine Block model instance or null if program is not open
* @deprecated use getActiveSubroutineModel(Program) instead
*/
@Deprecated
@Deprecated(since = "9.0")
public CodeBlockModel getActiveSubroutineModel();
/**
@@ -142,7 +142,7 @@ public interface BlockModelService {
* @return new Subroutine Block model instance or null if program is not open
* @deprecated use getActiveSubroutineModel(Program) instead
*/
@Deprecated
@Deprecated(since = "9.0")
public CodeBlockModel getActiveSubroutineModel(boolean includeExternals);
/**
@@ -19,6 +19,7 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import ghidra.app.plugin.core.datamgr.util.DataTypeUtils;
import ghidra.app.services.DataTypeQueryService;
@@ -540,7 +541,7 @@ public class DataTypeParser {
throw new NumberFormatException();
}
size = size.trim();
if (StringUtils.startsWithIgnoreCase(size, "0x")) {
if (Strings.CI.startsWith(size, "0x")) {
return Integer.parseInt(size.substring(2), 16);
}
return Integer.parseInt(size);
@@ -85,7 +85,7 @@ public class GhidraTable extends GTable {
* @deprecated use {@link #installNavigation(ServiceProvider)} or
* {@link #installNavigation(ServiceProvider,Navigatable)}
*/
@Deprecated
@Deprecated(since = "10.4")
public void installNavigation(GoToService goToService, Navigatable nav) {
installNavigation(new GoToServiceProvider(goToService), nav);
}
@@ -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 @@ public class TutorialScreenShotGenerator extends AbstractScreenShotGenerator {
* NOTE: Please do not remove this until we have decided how to create a showImage() method
* that is compatible with screenshots NOT in Help (ahem, Tutorial!!!).
*/
@Deprecated
@Deprecated(since = "9.0")
public void showImage() {
ImageDialogProvider dialog = new ImageDialogProvider(null, null, image);
tool.showDialog(dialog);
@@ -196,7 +196,7 @@ public class OverridePrototypeAction extends AbstractDecompilerAction {
buf.append(dt.getDisplayName());
}
else {
buf.append(DataType.VOID.getDisplayName());
buf.append(VoidDataType.dataType.getDisplayName());
}
buf.append(' ').append(name).append('(');
@@ -659,7 +659,7 @@ public class FormatStringParser {
case 'X':
return new UnsignedIntegerDataType(dataTypeManager);
case 'p':
return dataTypeManager.getPointer(DataType.VOID);
return dataTypeManager.getPointer(VoidDataType.dataType);
case 's':
return dataTypeManager.getPointer(new CharDataType(dataTypeManager));
case 'n':
@@ -23,6 +23,7 @@ import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@@ -602,7 +603,7 @@ public class GnuDemanglerParser {
private String replaceStdLibraryTypes(String demangled) {
String d = demangled;
for (GnuDemanglerReplacement replacement : REPLACEMENTS) {
d = StringUtils.replace(d, replacement.find(), replacement.replace());
d = Strings.CS.replace(d, replacement.find(), replacement.replace());
}
return d;
}
@@ -20,8 +20,7 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.*;
import ghidra.app.util.SymbolPath;
import ghidra.app.util.SymbolPathParser;
@@ -273,7 +272,7 @@ public class MDMangUtils {
for (int i = 0; i < parts.size(); i++) {
String part = parts.get(i);
// These anonymous namespaces are those that come in the clear (non-mangled)
StringUtils.replace(part, "`anonymous-namespace'", "`anonymous namespace'");
Strings.CS.replace(part, "`anonymous-namespace'", "`anonymous namespace'");
StringBuilder sb = new StringBuilder();
Matcher m = LOCAL_NS_PATTERN.matcher(part);
if (m.find()) {
@@ -306,7 +305,7 @@ public class MDMangUtils {
for (int i = 0; i < parts.size(); i++) {
String part = parts.get(i);
// These anonymous namespaces are those that come in the clear (non-mangled)
StringUtils.replace(part, "`anonymous-namespace'", "`anonymous namespace'");
Strings.CS.replace(part, "`anonymous-namespace'", "`anonymous namespace'");
StringBuilder sb = new StringBuilder();
Matcher m = DEMANGLED_LOCAL_NS_PATTERN.matcher(part);
if (m.find()) {
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.pdb;
import java.util.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import ghidra.app.services.DataTypeManagerService;
import ghidra.program.database.data.DataTypeUtilities;
@@ -195,7 +195,7 @@ class PdbDataTypeParser {
}
// Deal with other unrecognized types
dataTypeName = StringUtils.replace(dataTypeName, "<NoType>", "undefined");
dataTypeName = Strings.CS.replace(dataTypeName, "<NoType>", "undefined");
// Example type representations:
// char *[2][3] pointer(array(array(char,3),2))
@@ -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.
@@ -81,7 +81,7 @@ class IndexField extends Field {
* @deprecated this method serves no real purpose since the non-truncated
* indexed field value is not retained within the index table.
*/
@Deprecated
@Deprecated(since = "9.2")
Field getNonTruncatedIndexField() {
return nonTruncatedIndexedField;
}
@@ -93,7 +93,7 @@ class IndexField extends Field {
* @deprecated this method serves no real purpose since the truncation
* status is not retained within the index table.
*/
@Deprecated
@Deprecated(since = "9.2")
boolean usesTruncatedFieldValue() {
return isTruncated;
}
@@ -22,6 +22,7 @@ import javax.swing.JButton;
import javax.swing.KeyStroke;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import docking.action.DockingActionIf;
import ghidra.docking.util.LookAndFeelUtils;
@@ -63,7 +64,7 @@ public class DockingToolBarUtils {
StringBuilder buffy = new StringBuilder(toolTipText);
if (StringUtilities.startsWithIgnoreCase(toolTipText, "<html>")) {
String endHTMLTag = "</html>";
int closeTagIndex = StringUtils.indexOfIgnoreCase(toolTipText, endHTMLTag);
int closeTagIndex = Strings.CI.indexOf(toolTipText, endHTMLTag);
if (closeTagIndex < 0) {
// no closing tag, which is acceptable
buffy.append(START_KEYBINDING_TEXT)
@@ -255,7 +255,7 @@ public abstract class AbstractDockingTest extends AbstractGuiTest {
* (we are standardizing timeouts). The timeouts passed to this method will
* be ignored in favor of the standard value.
*/
@Deprecated
@Deprecated(since = "9.1")
public static Window waitForWindow(String title, int timeoutMS) {
return waitForWindow(title);
}
@@ -610,7 +610,7 @@ public abstract class AbstractDockingTest extends AbstractGuiTest {
* (we are standardizing timeouts). The timeouts passed to this method will
* be ignored in favor of the standard value.
*/
@Deprecated
@Deprecated(since = "9.1")
public static <T extends DialogComponentProvider> T waitForDialogComponent(Window parentWindow,
Class<T> clazz, int timeoutMS) {
if (!DialogComponentProvider.class.isAssignableFrom(clazz)) {
@@ -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,7 +19,7 @@ import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.util.function.Predicate;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
/**
* A class that holds the logic and state for finding matching rows in a widget when a user types
@@ -183,7 +183,7 @@ public abstract class AutoLookup {
private boolean textMatches(String text, int row, int col) {
String value = getValueString(row, col);
return StringUtils.startsWithIgnoreCase(value, text);
return Strings.CI.startsWith(value, text);
}
private boolean isIgnorableKeyEvent(KeyEvent event) {
@@ -17,7 +17,7 @@ package docking.widgets;
import javax.swing.JComponent;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import docking.widgets.label.GLabel;
import ghidra.util.Msg;
@@ -57,7 +57,7 @@ public interface GComponent {
*/
public static void warnAboutHtmlText(String text) {
// #ifdef still_finding_html_labels_in_our_huge_codebase
if (StringUtils.startsWithIgnoreCase(text, "<html>")) {
if (Strings.CI.startsWith(text, "<html>")) {
Msg.warn(GLabel.class, "HTML text detected in non-HTML component: " + text,
ReflectionUtilities.createJavaFilteredThrowable());
}
@@ -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 @@ public class MessageLog {
* @param message the message
* @deprecated use {@link #appendMsg(String)}
*/
@Deprecated
@Deprecated(since = "9.2")
public void error(String originator, String message) {
appendMsg(originator, message);
}
@@ -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,7 +15,8 @@
*/
package util;
import static org.hamcrest.collection.IsIn.*;
import static org.hamcrest.Matchers.*;
import static org.hamcrest.collection.IsIn.oneOf;
import static org.junit.Assert.*;
import java.util.*;
@@ -300,7 +301,7 @@ public class CollectionUtilsTest {
Collection<String> c = Arrays.asList("One", "Two");
String any = CollectionUtils.any(c);
assertNotNull(any);
assertThat(any, isOneOf("One", "Two"));
assertThat(any, is(oneOf("One", "Two")));
}
@Test
@@ -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.
@@ -17,7 +17,7 @@ package generic.theme;
import java.awt.Color;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import ghidra.util.Msg;
import ghidra.util.WebColors;
@@ -77,7 +77,7 @@ public class ColorValue extends ThemeValue<Color> {
* @return true if the given key string is a valid external key for a color value
*/
public static boolean isColorKey(String key) {
return StringUtils.startsWithAny(key, COLOR_ID_PREFIX, EXTERNAL_PREFIX,
return Strings.CS.startsWithAny(key, COLOR_ID_PREFIX, EXTERNAL_PREFIX,
EXTERNAL_LAF_ID_PREFIX);
}
@@ -18,7 +18,7 @@ package generic.theme;
import java.awt.Font;
import java.text.ParseException;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import ghidra.util.Msg;
@@ -110,7 +110,7 @@ public class FontValue extends ThemeValue<Font> {
* @return true if the given key string is a valid external key for a font value
*/
public static boolean isFontKey(String key) {
return StringUtils.startsWithAny(key, FONT_ID_PREFIX, EXTERNAL_PREFIX,
return Strings.CS.startsWithAny(key, FONT_ID_PREFIX, EXTERNAL_PREFIX,
EXTERNAL_LAF_ID_PREFIX);
}
@@ -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,7 +19,7 @@ import java.text.ParseException;
import javax.swing.Icon;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import ghidra.util.Msg;
import resources.ResourceManager;
@@ -102,7 +102,7 @@ public class IconValue extends ThemeValue<Icon> {
* @return true if the given key string is a valid external key for an icon value
*/
public static boolean isIconKey(String key) {
return StringUtils.startsWithAny(key, ICON_ID_PREFIX, EXTERNAL_PREFIX,
return Strings.CS.startsWithAny(key, ICON_ID_PREFIX, EXTERNAL_PREFIX,
EXTERNAL_LAF_ID_PREFIX);
}
@@ -15,8 +15,6 @@
*/
package gui.event;
import static org.apache.commons.lang3.StringUtils.*;
import java.awt.Toolkit;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
@@ -25,6 +23,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import ghidra.util.Msg;
@@ -139,20 +138,20 @@ public class MouseBinding {
int modifiers = 0;
for (Iterator<String> iterator = pieces.iterator(); iterator.hasNext();) {
String piece = iterator.next();
if (indexOfIgnoreCase(piece, SHIFT) != -1) {
if (Strings.CI.indexOf(piece, SHIFT) != -1) {
modifiers |= InputEvent.SHIFT_DOWN_MASK;
iterator.remove();
}
else if (indexOfIgnoreCase(piece, CTRL) != -1) {
else if (Strings.CI.indexOf(piece, CTRL) != -1) {
// This is the cross platform way to get the control key
modifiers |= Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx();
iterator.remove();
}
else if (indexOfIgnoreCase(piece, ALT) != -1) {
else if (Strings.CI.indexOf(piece, ALT) != -1) {
modifiers |= InputEvent.ALT_DOWN_MASK;
iterator.remove();
}
else if (indexOfIgnoreCase(piece, META) != -1) {
else if (Strings.CI.indexOf(piece, META) != -1) {
modifiers |= InputEvent.META_DOWN_MASK;
iterator.remove();
}
@@ -1321,7 +1321,7 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
}
// TODO: We need a more global solution for this.
@Deprecated
@Deprecated(since = "10.2")
public void setEffectiveImageBase(Address imageBase) {
effectiveImageBase = imageBase;
}
@@ -21,8 +21,7 @@ import db.DBRecord;
import ghidra.program.database.function.FunctionDB;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.OldGenericNamespaceAddress;
import ghidra.program.model.data.DataType;
import ghidra.program.model.data.Undefined;
import ghidra.program.model.data.*;
import ghidra.program.model.listing.*;
import ghidra.program.model.symbol.*;
import ghidra.program.util.ProgramLocation;
@@ -241,7 +240,7 @@ public class VariableSymbolDB extends SymbolDB {
dt = DataType.DEFAULT;
}
else if (storage.isVoidStorage()) {
dt = DataType.VOID;
dt = VoidDataType.dataType;
}
else {
dt = Undefined.getUndefinedDataType(storage.size());
@@ -47,7 +47,7 @@ public interface DataType {
*
* @deprecated should use {@link VoidDataType#dataType} instead
*/
@Deprecated
@Deprecated(since = "10.1")
public static final DataType VOID = VoidDataType.dataType;
/**
@@ -26,6 +26,7 @@ import ghidra.program.model.lang.CompilerSpec;
* {@link CompilerSpec} provides constants for those included in this enumeration and other
* setter/getter methods exist for using the string form.
*/
@Deprecated(since = "10.3")
public enum GenericCallingConvention {
/**
@@ -248,7 +248,7 @@ public class PrototypeModel {
* @return return location or {@link VariableStorage#UNASSIGNED_STORAGE} if
* unable to determine suitable location
*/
@Deprecated
@Deprecated(since = "12.2")
public VariableStorage getReturnLocation(DataType dataType, Program program) {
DataType clone = dataType.clone(program.getDataTypeManager());
PrototypePieces proto = new PrototypePieces(this, clone);
@@ -286,7 +286,7 @@ public class PrototypeModel {
* @deprecated This method does not apply any storage rules specific to varags functions.
* Use {@link #getStorageLocations(Program,DataType[],boolean,boolean)} instead.
*/
@Deprecated
@Deprecated(since = "12.2")
public VariableStorage getNextArgLocation(Parameter[] params, DataType dataType,
Program program) {
return getArgLocation(params != null ? params.length : 0, params, dataType, program);
@@ -322,7 +322,7 @@ public class PrototypeModel {
* @deprecated This method does not apply any storage rules specific to varags functions.
* Use {@link #getStorageLocations(Program,DataType[],boolean,boolean)} instead.
*/
@Deprecated
@Deprecated(since = "12.2")
public VariableStorage getArgLocation(int argIndex, Parameter[] params, DataType dataType,
Program program) {
if (dataType != null) {
@@ -336,7 +336,7 @@ public interface Function extends Namespace {
* which are easily overlooked when considering parameter ordinal. The function signature should generally be
* adjusted with a single call to {@link #updateFunction(String, Variable, List, FunctionUpdateType, boolean, SourceType)}
*/
@Deprecated
@Deprecated(since = "9.0")
public Parameter addParameter(Variable var, SourceType source)
throws DuplicateNameException, InvalidInputException;
@@ -361,7 +361,7 @@ public interface Function extends Namespace {
* which are easily overlooked when considering parameter ordinal. The function signature should generally be
* adjusted with a single call to {@link #updateFunction(String, Variable, List, FunctionUpdateType, boolean, SourceType)}
*/
@Deprecated
@Deprecated(since = "9.0")
public Parameter insertParameter(int ordinal, Variable var, SourceType source)
throws DuplicateNameException, InvalidInputException;
@@ -467,7 +467,7 @@ public interface Function extends Namespace {
* @deprecated The use of this method is discouraged. The function signature should generally be
* adjusted with a single call to {@link #updateFunction(String, Variable, List, FunctionUpdateType, boolean, SourceType)}
*/
@Deprecated
@Deprecated(since = "9.0")
public void removeParameter(int ordinal);
/**
@@ -481,7 +481,7 @@ public interface Function extends Namespace {
* @deprecated The use of this method is discouraged. The function signature should generally be
* adjusted with a single call to {@link #updateFunction(String, Variable, List, FunctionUpdateType, boolean, SourceType)}
*/
@Deprecated
@Deprecated(since = "9.0")
public Parameter moveParameter(int fromOrdinal, int toOrdinal) throws InvalidInputException;
/**
@@ -682,7 +682,7 @@ public interface Function extends Namespace {
* a recursive search is generally needed (see {@link #getFunctionThunkAddresses(boolean)}).
* This method form may be removed in a future release.
*/
@Deprecated
@Deprecated(since = "10.2")
public default Address[] getFunctionThunkAddresses() {
return getFunctionThunkAddresses(false);
}
@@ -99,7 +99,7 @@ public interface Program extends DataTypeManagerDomainObject, ProgramArchitectur
* @deprecated Method intended for internal ProgramDB use and is not intended for general use.
* This method may be removed from this interface in a future release.
*/
@Deprecated(forRemoval = true)
@Deprecated(since = "10.3", forRemoval = true)
public AddressMap getAddressMap();
/**
@@ -745,11 +745,11 @@ public class VariableUtilities {
DataType dt = findOrCreateClassStruct(function);
if (dt == null) {
dt = DataType.VOID;
dt = VoidDataType.dataType;
}
dt = new PointerDataType(dt);
DataType[] arr = new DataType[2];
arr[0] = DataType.VOID;
arr[0] = VoidDataType.dataType;
arr[1] = dt;
VariableStorage thisStorage =
convention.getStorageLocations(function.getProgram(), arr, true,
@@ -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.
@@ -125,7 +125,7 @@ public interface PcodeOverride {
* Get the primary call reference address from the current instruction
* @return call reference address or null
*/
@Deprecated
@Deprecated(since = "9.0")
Address getPrimaryCallReference();
}
@@ -101,7 +101,7 @@ public interface GraphDisplay {
* @throws CancelledException thrown if the graphing operation was cancelled
* @deprecated You should now use the form that takes in a {@link GraphDisplayOptions}
*/
@Deprecated
@Deprecated(since = "10.1")
public default void setGraph(AttributedGraph graph, String title, boolean append,
TaskMonitor monitor) throws CancelledException {
setGraph(graph, new GraphDisplayOptions(graph.getGraphType()), title, append, monitor);
@@ -307,7 +307,7 @@ public class DescriptorDecoder {
case BASE_TYPE_LONG:
return LongDataType.dataType;
case BASE_TYPE_VOID: //void (only for return types)
return DataType.VOID;
return VoidDataType.dataType;
default:
throw new IllegalArgumentException("Invalid type descriptor: " + descriptor);
}
@@ -271,7 +271,7 @@ public class DescriptorDecoderTest extends AbstractGenericTest {
String voidDescriptor = "V";
computedType = DescriptorDecoder.getDataTypeOfDescriptor(voidDescriptor, dtm);
assertTrue(computedType.equals(DataType.VOID));
assertTrue(computedType.equals(VoidDataType.dataType));
}
@Test
@@ -450,7 +450,7 @@ public class DescriptorDecoderTest extends AbstractGenericTest {
String voidTovoid = "()V";
type = DescriptorDecoder.getReturnTypeOfMethodDescriptor(voidTovoid, dtm);
assertEquals(DataType.VOID, type);
assertEquals(VoidDataType.dataType, type);
String ItoI = "(I)I";
type = DescriptorDecoder.getReturnTypeOfMethodDescriptor(ItoI, dtm);
@@ -26,7 +26,7 @@ import ghidra.framework.options.Options;
import ghidra.framework.plugintool.PluginTool;
import ghidra.program.database.ProgramBuilder;
import ghidra.program.model.data.DWordDataType;
import ghidra.program.model.data.DataType;
import ghidra.program.model.data.VoidDataType;
import ghidra.program.model.listing.*;
import ghidra.program.model.symbol.Reference;
import ghidra.test.AbstractGhidraHeadedIntegrationTest;
@@ -116,7 +116,7 @@ public class CreateFunctionThunkTest extends AbstractGhidraHeadedIntegrationTest
builder.setBytes("0x466050", "3c 0f 00 47 8d f9 72 24 03 20 00 08 25 f8 72 24");
builder.setBytes("0x477224", "00 47 99 c0");
builder.createEmptyFunction("chdir", "0x4799c0", 1, DataType.VOID);
builder.createEmptyFunction("chdir", "0x4799c0", 1, VoidDataType.dataType);
builder.disassemble("0x466050", 27, true);
builder.createFunction("0x466050");