Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-0: Cleaning up AutoAnalysisManager.getTaskTime()

Ryan Kurtzafa15c785950
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisManager.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisManager.java
index 64894473c3..1a0a9fb586 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisManager.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisManager.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -1183,18 +1183,15 @@ public class AutoAnalysisManager {
}
/**
- * Get the time taken by a named task
- * The names of tasks that have run can be retrieved using getTimedTasks
+ * {@return the time taken by a named task, or {@code -1} if the named task could not be found}
+ * <p>
+ * The names of tasks that have run can be retrieved using {@link #getTimedTasks()}.
+ *
* @param map the times by task names
* @param taskName the task name
- * @return the time taken by a named task
*/
public long getTaskTime(Map<String, Long> map, String taskName) {
- Long time = map.get(taskName);
- if (time == null) {
- return -1;
- }
- return time.longValue();
+ return map.getOrDefault(taskName, -1L);
}
/**