Skip to content

Commit be7db4c

Browse files
committed
fix(lombok): Refine Lombok annotations
1 parent 5b893e7 commit be7db4c

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/main/java/com/mycmd/ShellContext.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public ShellContext() {
3232
loadAliases();
3333
}
3434

35+
3536
public void addToHistory(String command) {
3637
history.add(command);
3738
commandHistory.add(command);
@@ -40,20 +41,16 @@ public void addToHistory(String command) {
4041
}
4142
}
4243

43-
/** * OVERRIDES Lombok's generated getter to return a DEFENSIVE COPY
44-
* to prevent external code from modifying the shell directly.
45-
*/
46-
@Override
44+
45+
/** * RETAINED FOR SAFETY: Returns a DEFENSIVE COPY instead of the raw Map. */
4746
public List<String> getHistory() {
4847
return new ArrayList<>(history);
4948
}
5049

51-
@Override
5250
public Map<String, String> getAliases() {
5351
return new HashMap<>(aliases);
5452
}
5553

56-
@Override
5754
public Map<String, String> getEnvVars() {
5855
return new HashMap<>(envVars);
5956
}
@@ -63,7 +60,6 @@ public void clearHistory() {
6360
history.clear();
6461
}
6562

66-
// Alias management methods
6763
public void addAlias(String name, String command) {
6864
aliases.put(name, command);
6965
saveAliases();
@@ -82,7 +78,6 @@ public boolean hasAlias(String name) {
8278
return aliases.containsKey(name);
8379
}
8480

85-
// Environmental variable accessors
8681
public void setEnvVar(String key, String value) {
8782
envVars.put(key, value);
8883
}
@@ -92,7 +87,6 @@ public String getEnvVar(String key) {
9287
}
9388

9489

95-
// --- Private Persistence Methods ---
9690

9791
private void loadAliases() {
9892
File aliasFile = new File(System.getProperty("user.home"), ALIAS_FILE);

0 commit comments

Comments
 (0)