Be sure to check Guava and Apache collection utils before using this class, as they are
- * standard utilities and often more efficient.
+ *
Be sure to check Apache collection utils before using this class, as it's a
+ * standard utility and often more efficient.
*
*
- * - {@link Iterators}
- * - {@link Iterables}
* - {@link org.apache.commons.collections4.CollectionUtils}
* - {@link IterableUtils}
* - {@link IteratorUtils}
- * - {@link Maps}
- * - {@link Sets}
* - {@link StringUtils#join(Iterable, char)} - for pretty printing collections with newlines
* Apache CollectionUtils.collect(Collection, Transformer)
- to turn a
* collection in to collection of strings when the default toString()
is lacking
@@ -404,21 +398,6 @@ public class CollectionUtils {
return () -> iterator;
}
- /**
- * Combines all collections passed-in, using {@link Iterables}, into a pass-through
- * (not creating a new collection) Iterable.
- *
- * This is just a convenience method for {@link Iterables#concat(Iterable)}
- *
- * @param iterables the iterables to combine
- * @return the iterable
- */
- @SafeVarargs
- public static Iterable asIterable(Iterable... iterables) {
- Iterable concat = Iterables.concat(iterables);
- return concat;
- }
-
/**
* Turns the given iterator into a stream
*
@@ -430,16 +409,15 @@ public class CollectionUtils {
}
/**
- * Combines all iterables passed-in, using {@link Iterables}, into a pass-through
- * (not creating a new collection) Stream.
+ * Combines all iterables passed-in into a pass-through (not creating a new collection) Stream.
*
* @param iterables the iterables to combine
* @return the stream
*/
@SafeVarargs
public static Stream asStream(Iterable... iterables) {
- Iterable concat = Iterables.concat(iterables);
- Stream s = StreamSupport.stream(concat.spliterator(), false);
+ Stream s = Stream.of(iterables)
+ .flatMap(e -> StreamSupport.stream(e.spliterator(), false));
return s;
}
diff --git a/Ghidra/Framework/Generic/src/test/java/util/CollectionUtilsTest.java b/Ghidra/Framework/Generic/src/test/java/util/CollectionUtilsTest.java
index 6f47eca37a..6d3da36ef6 100644
--- a/Ghidra/Framework/Generic/src/test/java/util/CollectionUtilsTest.java
+++ b/Ghidra/Framework/Generic/src/test/java/util/CollectionUtilsTest.java
@@ -15,7 +15,7 @@
*/
package util;
-import static org.hamcrest.collection.IsIn.isOneOf;
+import static org.hamcrest.collection.IsIn.*;
import static org.junit.Assert.*;
import java.util.*;
@@ -225,21 +225,6 @@ public class CollectionUtilsTest {
assertEquals("One", iterator.next());
}
- @Test
- public void testAsIterable_Collections() {
-
- List original = Arrays.asList("One", "Two", "Three", "Four");
- Collection a = Arrays.asList(original.get(0), original.get(1));
- Collection b = Arrays.asList(original.get(2));
- Collection c = Collections.emptyList();
- Collection d = Arrays.asList(original.get(3));
- Iterable iterable = CollectionUtils.asIterable(a, b, c, d);
-
- List result = new ArrayList<>();
- iterable.forEach(s -> result.add(s));
- assertEquals(original, result);
- }
-
@Test
public void testAsList_UnknownToType() {
List list = new ArrayList<>();
diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/ImportGhidraToolsDialog.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/ImportGhidraToolsDialog.java
index b8c7f30a44..f755211924 100644
--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/ImportGhidraToolsDialog.java
+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/ImportGhidraToolsDialog.java
@@ -20,12 +20,11 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.*;
import java.util.List;
+import java.util.stream.Stream;
import javax.swing.*;
import javax.swing.border.TitledBorder;
-import com.google.common.collect.Iterables;
-
import docking.DialogComponentProvider;
import docking.options.editor.ButtonPanelFactory;
import docking.tool.ToolConstants;
@@ -163,9 +162,8 @@ class ImportGhidraToolsDialog extends DialogComponentProvider {
Set defaultTools = ToolUtils.getDefaultApplicationTools();
Set extraTools = ToolUtils.getExtraApplicationTools();
- Iterable defaultToolNames =
- Iterables.transform(defaultTools, ToolTemplate::getPath);
- Iterable extraToolNames = Iterables.transform(extraTools, ToolTemplate::getPath);
+ Stream defaultToolNames = defaultTools.stream().map(ToolTemplate::getPath);
+ Stream extraToolNames = extraTools.parallelStream().map(ToolTemplate::getPath);
int elementCount = defaultTools.size() + extraTools.size();
tools = new String[elementCount];
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/expr/OperandValueSolver.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/expr/OperandValueSolver.java
index a471a3f4e1..23add124ca 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/expr/OperandValueSolver.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/expr/OperandValueSolver.java
@@ -15,10 +15,7 @@
*/
package ghidra.app.plugin.assembler.sleigh.expr;
-import java.util.Map;
-import java.util.Set;
-
-import com.google.common.collect.ImmutableList;
+import java.util.*;
import ghidra.app.plugin.assembler.sleigh.sem.*;
import ghidra.app.plugin.processors.sleigh.Constructor;
@@ -79,7 +76,7 @@ public class OperandValueSolver extends AbstractExpressionSolver {
AssemblyResolvedError err = (AssemblyResolvedError) result;
return AssemblyResolution.error(err.getError(),
"Solution to " + sym.getName() + " := " + goal + " = " + patexp,
- ImmutableList.of(result));
+ List.of(result));
}
// TODO: Shifting here seems like a hack to me.
// I assume this only comes at the top of an expression
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/expr/RecursiveDescentSolver.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/expr/RecursiveDescentSolver.java
index 32761ab058..e2d785f45a 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/expr/RecursiveDescentSolver.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/expr/RecursiveDescentSolver.java
@@ -17,8 +17,6 @@ package ghidra.app.plugin.assembler.sleigh.expr;
import java.util.*;
-import com.google.common.collect.ImmutableSet;
-
import ghidra.app.plugin.assembler.sleigh.sem.AssemblyResolution;
import ghidra.app.plugin.assembler.sleigh.sem.AssemblyResolvedConstructor;
import ghidra.app.plugin.assembler.sleigh.util.DbgTimer;
@@ -157,7 +155,7 @@ public class RecursiveDescentSolver {
public AssemblyResolution solve(PatternExpression exp, MaskedLong goal, Map vals,
Map res, AssemblyResolvedConstructor cur, String description)
throws NeedsBackfillException {
- return solve(exp, goal, vals, res, cur, ImmutableSet.of(), description);
+ return solve(exp, goal, vals, res, cur, Set.of(), description);
}
/**
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/expr/SolverHint.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/expr/SolverHint.java
index e915330f98..8ec0067a98 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/expr/SolverHint.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/expr/SolverHint.java
@@ -15,9 +15,7 @@
*/
package ghidra.app.plugin.assembler.sleigh.expr;
-import java.util.Set;
-
-import com.google.common.collect.ImmutableSet;
+import java.util.*;
/**
* A type for solver hints
@@ -34,9 +32,8 @@ import com.google.common.collect.ImmutableSet;
*/
public interface SolverHint {
static Set with(Set set, SolverHint... plus) {
- ImmutableSet.Builder hints = ImmutableSet.builder();
- hints.addAll(set);
- hints.add(plus);
- return hints.build();
+ Set hints = new HashSet<>(set);
+ hints.addAll(Set.of(plus));
+ return Collections.unmodifiableSet(hints);
}
}
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyConstructorSemantic.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyConstructorSemantic.java
index 4c37c2e4ba..ac2c5e1350 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyConstructorSemantic.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyConstructorSemantic.java
@@ -17,9 +17,6 @@ package ghidra.app.plugin.assembler.sleigh.sem;
import java.util.*;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-
import ghidra.app.plugin.assembler.sleigh.expr.MaskedLong;
import ghidra.app.plugin.assembler.sleigh.expr.RecursiveDescentSolver;
import ghidra.app.plugin.assembler.sleigh.grammars.AssemblyProduction;
@@ -42,10 +39,10 @@ public class AssemblyConstructorSemantic implements Comparable patterns = new HashSet<>();
protected final Constructor cons;
- protected final ImmutableList indices;
+ protected final List indices;
// A set initialized on first access with forbidden patterns added
- protected ImmutableSet upatterns;
+ protected Set upatterns;
/**
* Build a new SLEIGH constructor semantic
@@ -55,7 +52,7 @@ public class AssemblyConstructorSemantic implements Comparable indices) {
this.cons = cons;
- this.indices = ImmutableList.copyOf(indices);
+ this.indices = Collections.unmodifiableList(indices);
}
public void addPattern(DisjointPattern pat) {
@@ -106,7 +103,7 @@ public class AssemblyConstructorSemantic implements Comparable getOperandIndices() {
+ public List getOperandIndices() {
return indices;
}
@@ -135,7 +132,7 @@ public class AssemblyConstructorSemantic implements Comparable vals, Map opvals) {
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyResolution.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyResolution.java
index 86c171c0f8..19464d47b3 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyResolution.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyResolution.java
@@ -18,8 +18,6 @@ package ghidra.app.plugin.assembler.sleigh.sem;
import java.util.List;
import java.util.Map;
-import com.google.common.collect.ImmutableList;
-
import ghidra.app.plugin.assembler.sleigh.expr.MaskedLong;
import ghidra.app.plugin.processors.sleigh.expression.PatternExpression;
import ghidra.app.plugin.processors.sleigh.pattern.DisjointPattern;
@@ -34,7 +32,7 @@ import ghidra.app.plugin.processors.sleigh.pattern.DisjointPattern;
*/
public abstract class AssemblyResolution implements Comparable {
protected final String description;
- protected final ImmutableList extends AssemblyResolution> children;
+ protected final List extends AssemblyResolution> children;
private boolean hashed = false;
private int hash;
@@ -55,9 +53,9 @@ public abstract class AssemblyResolution implements Comparable children) {
+ AssemblyResolution(String description, List extends AssemblyResolution> children) {
this.description = description;
- this.children = children == null ? ImmutableList.of() : children;
+ this.children = children == null ? List.of() : children;
}
/* ********************************************************************************************
@@ -77,33 +75,33 @@ public abstract class AssemblyResolution implements Comparable sel) {
+ List extends AssemblyResolution> sel) {
return new AssemblyResolvedConstructor(description, sel, ins, ctx, null, null);
}
/**
* Build an instruction-only successful resolution result
- * @see #resolved(AssemblyPatternBlock, AssemblyPatternBlock, String, ImmutableList)
+ * @see #resolved(AssemblyPatternBlock, AssemblyPatternBlock, String, List)
* @param ins the instruction pattern block
* @param description a description of the resolution
* @param children the children selected to resolve this constructor, or null
* @return the new resolution
*/
public static AssemblyResolvedConstructor instrOnly(AssemblyPatternBlock ins,
- String description, ImmutableList children) {
+ String description, List children) {
return resolved(ins, AssemblyPatternBlock.nop(), description, children);
}
/**
* Build a context-only successful resolution result
- * @see #resolved(AssemblyPatternBlock, AssemblyPatternBlock, String, ImmutableList)
+ * @see #resolved(AssemblyPatternBlock, AssemblyPatternBlock, String, List)
* @param ctx the context pattern block
* @param description a description of the resolution
* @param children the children selected to resolve this constructor, or null
* @return the new resolution
*/
public static AssemblyResolvedConstructor contextOnly(AssemblyPatternBlock ctx,
- String description, ImmutableList children) {
+ String description, List children) {
return resolved(AssemblyPatternBlock.nop(), ctx, description, children);
}
@@ -141,7 +139,7 @@ public abstract class AssemblyResolution implements Comparable sel) {
+ List extends AssemblyResolution> sel) {
return resolved(AssemblyPatternBlock.nop(), AssemblyPatternBlock.nop(), description, sel);
}
@@ -153,7 +151,7 @@ public abstract class AssemblyResolution implements Comparable children) {
+ List extends AssemblyResolution> children) {
return new AssemblyResolvedError(description, children, error);
}
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyResolvedConstructor.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyResolvedConstructor.java
index 4c410c0ab4..f7ca45bb80 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyResolvedConstructor.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyResolvedConstructor.java
@@ -24,15 +24,11 @@ import org.apache.commons.collections4.IteratorUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.commons.lang3.StringUtils;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-
import ghidra.app.plugin.assembler.AssemblySelector;
import ghidra.app.plugin.assembler.sleigh.expr.MaskedLong;
import ghidra.app.plugin.assembler.sleigh.expr.RecursiveDescentSolver;
import ghidra.app.plugin.processors.sleigh.ConstructState;
import ghidra.app.plugin.processors.sleigh.ContextOp;
-import ghidra.util.StringUtilities;
/**
* A {@link AssemblyResolution} indicating successful application of a constructor
@@ -57,8 +53,8 @@ public class AssemblyResolvedConstructor extends AssemblyResolution {
protected final AssemblyPatternBlock ins;
protected final AssemblyPatternBlock ctx;
- protected final ImmutableSet backfills;
- protected final ImmutableSet forbids;
+ protected final Set backfills;
+ protected final Set forbids;
@Override
protected int computeHash() {
@@ -98,14 +94,14 @@ public class AssemblyResolvedConstructor extends AssemblyResolution {
* @see AssemblyResolution#resolved(AssemblyPatternBlock, AssemblyPatternBlock, String, List)
*/
AssemblyResolvedConstructor(String description,
- ImmutableList extends AssemblyResolution> children, AssemblyPatternBlock ins,
- AssemblyPatternBlock ctx, ImmutableSet backfills,
- ImmutableSet forbids) {
+ List extends AssemblyResolution> children, AssemblyPatternBlock ins,
+ AssemblyPatternBlock ctx, Set backfills,
+ Set forbids) {
super(description, children);
this.ins = ins;
this.ctx = ctx;
- this.backfills = backfills == null ? ImmutableSet.of() : backfills;
- this.forbids = forbids == null ? ImmutableSet.of() : forbids;
+ this.backfills = backfills == null ? Set.of() : backfills;
+ this.forbids = forbids == null ? Set.of() : forbids;
}
/**
@@ -120,7 +116,7 @@ public class AssemblyResolvedConstructor extends AssemblyResolution {
* @return the decoded resolution
*/
public static AssemblyResolvedConstructor fromString(String str, String description,
- ImmutableList children) {
+ List children) {
AssemblyPatternBlock ins = null;
if (str.startsWith(INS)) {
int end = str.indexOf(SEP);
@@ -172,7 +168,7 @@ public class AssemblyResolvedConstructor extends AssemblyResolution {
newForbids.add(f.shift(amt));
}
return new AssemblyResolvedConstructor(description, children, newIns, ctx,
- ImmutableSet.copyOf(newBackfills), ImmutableSet.copyOf(newForbids));
+ Collections.unmodifiableSet(newBackfills), Collections.unmodifiableSet(newForbids));
}
/**
@@ -214,7 +210,7 @@ public class AssemblyResolvedConstructor extends AssemblyResolution {
}
}
return new AssemblyResolvedConstructor(description, children, ins, ctx, backfills,
- ImmutableSet.copyOf(newForbids));
+ Collections.unmodifiableSet(newForbids));
}
/**
@@ -270,7 +266,7 @@ public class AssemblyResolvedConstructor extends AssemblyResolution {
Set newForbids = new HashSet<>(this.forbids);
newForbids.addAll(that.forbids);
return new AssemblyResolvedConstructor(description, children, newIns, newCtx,
- ImmutableSet.copyOf(newBackfills), ImmutableSet.copyOf(newForbids));
+ Collections.unmodifiableSet(newBackfills), Collections.unmodifiableSet(newForbids));
}
/**
@@ -282,7 +278,7 @@ public class AssemblyResolvedConstructor extends AssemblyResolution {
Set newBackfills = new HashSet<>(this.backfills);
newBackfills.add(bf);
return new AssemblyResolvedConstructor(description, children, ins, ctx,
- ImmutableSet.copyOf(newBackfills), forbids);
+ Collections.unmodifiableSet(newBackfills), forbids);
}
/**
@@ -294,7 +290,7 @@ public class AssemblyResolvedConstructor extends AssemblyResolution {
Set combForbids = new HashSet<>(this.forbids);
combForbids.addAll(more);
return new AssemblyResolvedConstructor(description, children, ins, ctx, backfills,
- ImmutableSet.copyOf(more));
+ Collections.unmodifiableSet(more));
}
/**
@@ -446,7 +442,7 @@ public class AssemblyResolvedConstructor extends AssemblyResolution {
newForbids.add((AssemblyResolvedConstructor) t);
}
return new AssemblyResolvedConstructor(description, children, ins, ctx, backfills,
- ImmutableSet.copyOf(newForbids));
+ Collections.unmodifiableSet(newForbids));
}
/**
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyResolvedError.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyResolvedError.java
index d606ca3962..24517fc328 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyResolvedError.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyResolvedError.java
@@ -17,8 +17,6 @@ package ghidra.app.plugin.assembler.sleigh.sem;
import java.util.List;
-import com.google.common.collect.ImmutableList;
-
/**
* A {@link AssemblyResolution} indicating the occurrence of a (usually semantic) error
*
@@ -49,7 +47,7 @@ public class AssemblyResolvedError extends AssemblyResolution {
/**
* @see AssemblyResolution#error(String, String, List)
*/
- AssemblyResolvedError(String description, ImmutableList extends AssemblyResolution> children,
+ AssemblyResolvedError(String description, List extends AssemblyResolution> children,
String error) {
super(description, children);
AssemblyTreeResolver.dbg.println(error);
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyTreeResolver.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyTreeResolver.java
index 40e6c0fc59..7498971747 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyTreeResolver.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyTreeResolver.java
@@ -19,7 +19,6 @@ import java.util.*;
import org.apache.commons.collections4.IteratorUtils;
-import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
import ghidra.app.plugin.assembler.sleigh.SleighAssemblerBuilder;
@@ -109,7 +108,7 @@ public class AssemblyTreeResolver {
if (rc.hasBackfills()) {
ret.add(AssemblyResolution.error("Solution is incomplete", "failed backfill",
- ImmutableList.of(rc)));
+ List.of(rc)));
continue;
}
AssemblyResolvedConstructor ctx =
@@ -117,7 +116,7 @@ public class AssemblyTreeResolver {
AssemblyResolvedConstructor check = rc.combine(ctx);
if (null == check) {
ret.add(AssemblyResolution.error("Incompatible context", "resolving",
- ImmutableList.of(rc)));
+ List.of(rc)));
continue;
}
rc = check;
@@ -178,12 +177,11 @@ public class AssemblyTreeResolver {
intoNext.add(child);
while (!path.isEmpty()) {
AssemblyConstructorSemantic sem = path.pollLast();
- ImmutableList substs =
- ImmutableList.of((AssemblyParseTreeNode) branch);
+ List substs = List.of((AssemblyParseTreeNode) branch);
// 1
for (final AssemblyResolvedConstructor res : intoNext) {
- ImmutableList sel = ImmutableList.of(res);
- collected.absorb(resolveSelectedChildren(rec, substs, sel, ImmutableList.of(sem)));
+ List sel = List.of(res);
+ collected.absorb(resolveSelectedChildren(rec, substs, sel, List.of(sem)));
}
intoNext.clear();
// 2
@@ -249,7 +247,7 @@ public class AssemblyTreeResolver {
* @return the results
*/
protected AssemblyResolutionResults resolveSelectedChildren(AssemblyProduction prod,
- List substs, ImmutableList sel,
+ List substs, List sel,
Collection semantics) {
try (DbgCtx dc = dbg.start("Selecting: " + IteratorUtils.toString(sel.iterator(),
@@ -503,12 +501,12 @@ public class AssemblyTreeResolver {
// This is also where the shifting will happen.
Collection semantics = grammar.getSemantics(prod);
for (List sel : Sets.cartesianProduct(childRes)) {
- results.absorb(
- resolveSelectedChildren(prod, substs, ImmutableList.copyOf(sel), semantics));
+ results.absorb(resolveSelectedChildren(prod, substs,
+ Collections.unmodifiableList(sel), semantics));
}
if (!childErr.isEmpty()) {
results.add(AssemblyResolution.error("Child errors", "Resolving " + prod,
- ImmutableList.copyOf(childErr)));
+ Collections.unmodifiableList(childErr)));
}
return results;
}
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/code/StringDiff.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/code/StringDiff.java
index f96f4a6032..ec9bb7062a 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/code/StringDiff.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/code/StringDiff.java
@@ -15,7 +15,7 @@
*/
package ghidra.program.database.code;
-import com.google.common.base.Objects;
+import java.util.Objects;
/**
* Container object that holds a start and end position within a string. A list of StringDiffs
@@ -105,7 +105,7 @@ public class StringDiff {
}
StringDiff other = (StringDiff) obj;
- if (!Objects.equal(text, other.text)) {
+ if (!Objects.equals(text, other.text)) {
return false;
}
if (start != other.start) {
diff --git a/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/app/plugin/assembler/sleigh/parse/ParserTest.java b/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/app/plugin/assembler/sleigh/parse/ParserTest.java
index 91ad1aaf8a..d3f237f542 100644
--- a/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/app/plugin/assembler/sleigh/parse/ParserTest.java
+++ b/Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/app/plugin/assembler/sleigh/parse/ParserTest.java
@@ -15,8 +15,7 @@
*/
package ghidra.app.plugin.assembler.sleigh.parse;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
import java.io.PrintStream;
import java.util.*;
@@ -25,8 +24,6 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
-import com.google.common.collect.ImmutableSet;
-
import ghidra.app.plugin.assembler.sleigh.grammars.*;
import ghidra.app.plugin.assembler.sleigh.symbol.*;
import ghidra.app.plugin.assembler.sleigh.tree.*;
@@ -522,7 +519,7 @@ public class ParserTest {
assertTrue(res instanceof AssemblyParseErrorResult);
AssemblyParseErrorResult err = (AssemblyParseErrorResult) res;
Collection sug = err.getSuggestions();
- assertEquals(ImmutableSet.builder().add("b").build(), sug);
+ assertEquals(Set.of("b"), sug);
}
}
@@ -542,7 +539,7 @@ public class ParserTest {
assertTrue(res instanceof AssemblyParseErrorResult);
AssemblyParseErrorResult err = (AssemblyParseErrorResult) res;
Collection sug = err.getSuggestions();
- assertEquals(ImmutableSet.builder().add(" ").build(), sug);
+ assertEquals(Set.of(" "), sug);
}
}