mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
GP-0 Completed cleanup of unused AbstractDataType DuplicateNameException
use
This commit is contained in:
parent
f080fb70a1
commit
52eed79cc8
9 changed files with 22 additions and 330 deletions
|
@ -146,8 +146,7 @@ public abstract class AbstractDataType implements DataType {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setNameAndCategory(CategoryPath path, String name)
|
||||
throws InvalidNameException, DuplicateNameException {
|
||||
public void setNameAndCategory(CategoryPath path, String name) throws InvalidNameException {
|
||||
// default is immutable
|
||||
}
|
||||
|
||||
|
@ -260,7 +259,7 @@ public abstract class AbstractDataType implements DataType {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setCategoryPath(CategoryPath path) throws DuplicateNameException {
|
||||
public void setCategoryPath(CategoryPath path) {
|
||||
// not-applicable
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import ghidra.docking.settings.SettingsDefinition;
|
|||
import ghidra.program.database.data.DataTypeUtilities;
|
||||
import ghidra.program.model.mem.MemBuffer;
|
||||
import ghidra.util.InvalidNameException;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
||||
/**
|
||||
* Basic implementation of the Array interface.
|
||||
|
@ -305,17 +304,6 @@ public class ArrayDataType extends DataTypeImpl implements Array {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCategoryPath(CategoryPath path) throws DuplicateNameException {
|
||||
// unsupported - ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNameAndCategory(CategoryPath path, String name)
|
||||
throws InvalidNameException, DuplicateNameException {
|
||||
// unsupported - ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategoryPath getCategoryPath() {
|
||||
DataType dt = getDataType();
|
||||
|
|
|
@ -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,9 +19,7 @@ import ghidra.app.plugin.core.datamgr.archive.BuiltInSourceArchive;
|
|||
import ghidra.docking.settings.Settings;
|
||||
import ghidra.docking.settings.SettingsDefinition;
|
||||
import ghidra.program.model.lang.DecompilerLanguage;
|
||||
import ghidra.util.InvalidNameException;
|
||||
import ghidra.util.UniversalID;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
||||
/**
|
||||
* NOTE: ALL DATATYPE CLASSES MUST END IN "DataType". If not,
|
||||
|
@ -92,27 +90,6 @@ public abstract class BuiltIn extends DataTypeImpl implements BuiltInDataType {
|
|||
return getClass() == dt.getClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dataTypeSizeChanged(DataType dt) {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setCategoryPath(CategoryPath path) throws DuplicateNameException {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setName(String name) throws InvalidNameException {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setNameAndCategory(CategoryPath path, String name)
|
||||
throws InvalidNameException, DuplicateNameException {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void addParent(DataType dt) {
|
||||
// Default implementation does nothing.
|
||||
|
@ -123,35 +100,6 @@ public abstract class BuiltIn extends DataTypeImpl implements BuiltInDataType {
|
|||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dataTypeNameChanged(DataType dt, String oldName) {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dataTypeReplaced(DataType oldDt, DataType newDt) {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dataTypeDeleted(DataType dt) {
|
||||
// Default implementation does nothing.
|
||||
}
|
||||
|
||||
// /* (non-Javadoc)
|
||||
// * @see ghidra.program.model.data.BuiltInDataType#clone(ghidra.program.model.data.DataTypeManager)
|
||||
// */
|
||||
// public BuiltInDataType clone(DataTypeManager dataManager) {
|
||||
// BuiltIn dt = (BuiltIn)copy(false);
|
||||
// dt.dataMgr = dataManager;
|
||||
// return dt;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean dependsOn(DataType dt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UniversalID getUniversalID() {
|
||||
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.
|
||||
|
@ -19,8 +19,6 @@ import ghidra.docking.settings.Settings;
|
|||
import ghidra.program.model.mem.MemBuffer;
|
||||
import ghidra.program.model.mem.MemoryAccessException;
|
||||
import ghidra.program.model.scalar.Scalar;
|
||||
import ghidra.util.InvalidNameException;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
||||
/**
|
||||
* Provides an implementation of a byte that has not been defined yet as a
|
||||
|
@ -35,37 +33,21 @@ public class DefaultDataType extends DataTypeImpl {
|
|||
super(CategoryPath.ROOT, "undefined", null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see ghidra.program.model.data.DataType#getMnemonic(Settings)
|
||||
*/
|
||||
@Override
|
||||
public String getMnemonic(Settings settings) {
|
||||
return "??";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see ghidra.program.model.data.DataType#getLength()
|
||||
*/
|
||||
@Override
|
||||
public int getLength() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see ghidra.program.model.data.DataType#getDescription()
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Undefined Byte";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see ghidra.program.model.data.DataType#getRepresentation(MemBuffer, Settings, int)
|
||||
*/
|
||||
@Override
|
||||
public String getRepresentation(MemBuffer buf, Settings settings, int length) {
|
||||
try {
|
||||
|
@ -112,83 +94,16 @@ public class DefaultDataType extends DataTypeImpl {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.data.DataType#dataTypeSizeChanged(ghidra.program.model.data.DataType)
|
||||
*/
|
||||
@Override
|
||||
public void dataTypeSizeChanged(DataType dt) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.data.DataType#isEquivalent(ghidra.program.model.data.DataType)
|
||||
*/
|
||||
@Override
|
||||
public boolean isEquivalent(DataType dt) {
|
||||
return dt == this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.data.DataType#setCategoryPath(ghidra.program.model.data.CategoryPath)
|
||||
*/
|
||||
@Override
|
||||
public void setCategoryPath(CategoryPath path) throws DuplicateNameException {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.data.DataType#setName(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.data.DataType#setNameAndCategory(ghidra.program.model.data.CategoryPath, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setNameAndCategory(CategoryPath path, String name)
|
||||
throws InvalidNameException, DuplicateNameException {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.data.DataType#dataTypeDeleted(ghidra.program.model.data.DataType)
|
||||
*/
|
||||
@Override
|
||||
public void dataTypeDeleted(DataType dt) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.data.DataType#dataTypeNameChanged(ghidra.program.model.data.DataType, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void dataTypeNameChanged(DataType dt, String oldName) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.data.DataType#dataTypeReplaced(ghidra.program.model.data.DataType, ghidra.program.model.data.DataType)
|
||||
*/
|
||||
@Override
|
||||
public void dataTypeReplaced(DataType oldDt, DataType newDt) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.data.DataType#dependsOn(ghidra.program.model.data.DataType)
|
||||
*/
|
||||
@Override
|
||||
public boolean dependsOn(DataType dt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.data.DataType#addParent(ghidra.program.model.data.DataType)
|
||||
*/
|
||||
@Override
|
||||
public void addParent(DataType dt) {
|
||||
// this datatype is STATIC, don't hold on to parents
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.data.DataType#removeParent(ghidra.program.model.data.DataType)
|
||||
*/
|
||||
@Override
|
||||
public void removeParent(DataType dt) {
|
||||
// this datatype is STATIC, don't hold on to parents
|
||||
|
|
|
@ -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,6 @@ package ghidra.program.model.data;
|
|||
|
||||
import ghidra.util.InvalidNameException;
|
||||
import ghidra.util.UniversalID;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
||||
/**
|
||||
* Base implementation for a generic data type.
|
||||
|
@ -42,9 +41,7 @@ public abstract class GenericDataType extends DataTypeImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setNameAndCategory(CategoryPath path, String name)
|
||||
throws InvalidNameException, DuplicateNameException {
|
||||
|
||||
public void setNameAndCategory(CategoryPath path, String name) throws InvalidNameException {
|
||||
doSetName(name);
|
||||
doSetCategoryPath(path);
|
||||
}
|
||||
|
|
|
@ -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,9 +18,7 @@ package ghidra.program.model.data;
|
|||
import ghidra.app.plugin.core.datamgr.archive.BuiltInSourceArchive;
|
||||
import ghidra.docking.settings.Settings;
|
||||
import ghidra.program.model.mem.MemBuffer;
|
||||
import ghidra.util.InvalidNameException;
|
||||
import ghidra.util.classfinder.ClassSearcher;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
||||
/**
|
||||
* Provides an implementation of a data type that stands-in for a missing Built-In data type.
|
||||
|
@ -37,6 +35,7 @@ public class MissingBuiltInDataType extends DataTypeImpl implements Dynamic {
|
|||
* @param path category path
|
||||
* @param missingBuiltInName name of missing built-in datatype for which this will standin for.
|
||||
* @param missingBuiltInClassPath classpath of missing built-in datatype for which this will standin for.
|
||||
* @param dtm datatype manager
|
||||
*/
|
||||
public MissingBuiltInDataType(CategoryPath path, String missingBuiltInName,
|
||||
String missingBuiltInClassPath, DataTypeManager dtm) {
|
||||
|
@ -54,30 +53,24 @@ public class MissingBuiltInDataType extends DataTypeImpl implements Dynamic {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns name of missing built-in datatype for which this type is standing-in for
|
||||
* {@return name of missing built-in datatype for which this type is standing-in for}
|
||||
*/
|
||||
public String getMissingBuiltInName() {
|
||||
return missingBuiltInName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns classpath of missing built-in datatype for which this type is standing-in for
|
||||
* {@return classpath of missing built-in datatype for which this type is standing-in for}
|
||||
*/
|
||||
public String getMissingBuiltInClassPath() {
|
||||
return missingBuiltInClassPath;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ghidra.program.model.data.DataType#getMnemonic(ghidra.program.model.data.Settings)
|
||||
*/
|
||||
@Override
|
||||
public String getMnemonic(Settings settings) {
|
||||
return getName();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ghidra.program.model.data.DataType#getLength()
|
||||
*/
|
||||
@Override
|
||||
public int getLength() {
|
||||
return -1;
|
||||
|
@ -88,33 +81,21 @@ public class MissingBuiltInDataType extends DataTypeImpl implements Dynamic {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.data.Dynamic#getLength(ghidra.program.model.mem.MemBuffer, int)
|
||||
*/
|
||||
@Override
|
||||
public int getLength(MemBuffer buf, int maxLength) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ghidra.program.model.data.DataType#getDescription()
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Missing Built-In Data Type: " + missingBuiltInClassPath;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ghidra.program.model.data.DataType#getRepresentation(ghidra.program.model.mem.MemBuffer, ghidra.program.model.lang.ProcessorContext, ghidra.program.model.data.Settings, int)
|
||||
*/
|
||||
@Override
|
||||
public String getRepresentation(MemBuffer buf, Settings settings, int length) {
|
||||
return missingBuiltInClassPath;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ghidra.program.model.data.DataType#getValue(ghidra.program.model.mem.MemBuffer, ghidra.program.model.lang.ProcessorContext, ghidra.program.model.data.Settings, int)
|
||||
*/
|
||||
@Override
|
||||
public Object getValue(MemBuffer buf, Settings settings, int length) {
|
||||
return missingBuiltInClassPath;
|
||||
|
@ -129,35 +110,11 @@ public class MissingBuiltInDataType extends DataTypeImpl implements Dynamic {
|
|||
dtm);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.data.DataType#copy(ghidra.program.model.data.DataTypeManager)
|
||||
*/
|
||||
@Override
|
||||
public final DataType copy(DataTypeManager dtm) {
|
||||
return clone(dtm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dataTypeDeleted(DataType dt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dataTypeNameChanged(DataType dt, String oldName) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dataTypeReplaced(DataType oldDt, DataType newDt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dataTypeSizeChanged(DataType dt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dependsOn(DataType dt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEquivalent(DataType dt) {
|
||||
if (dt == null) {
|
||||
|
@ -169,21 +126,8 @@ public class MissingBuiltInDataType extends DataTypeImpl implements Dynamic {
|
|||
if (!(dt instanceof MissingBuiltInDataType)) {
|
||||
return false;
|
||||
}
|
||||
return missingBuiltInClassPath.equals(
|
||||
((MissingBuiltInDataType) dt).missingBuiltInClassPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCategoryPath(CategoryPath path) throws DuplicateNameException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) throws InvalidNameException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNameAndCategory(CategoryPath path, String name)
|
||||
throws InvalidNameException, DuplicateNameException {
|
||||
return missingBuiltInClassPath
|
||||
.equals(((MissingBuiltInDataType) dt).missingBuiltInClassPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -191,9 +135,6 @@ public class MissingBuiltInDataType extends DataTypeImpl implements Dynamic {
|
|||
return NO_SOURCE_SYNC_TIME;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.program.model.data.BuiltInDataType#getCTypeDeclaration(ghidra.program.model.data.DataOrganization)
|
||||
*/
|
||||
@Override
|
||||
public String getCTypeDeclaration(DataOrganization dataOrganization) {
|
||||
return null; // missing type
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue