-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Issue Description
The getItems() method in Menu.java performs an unsafe cast from Collections.unmodifiableSet() to HashSet<SlotItem>. This could cause ClassCastException at runtime.
Location
Menu.java line 148
Current Code
public HashSet<SlotItem> getItems() {
return (HashSet<SlotItem>) Collections.unmodifiableSet(this.items);
}Suggested Fix
Change the return type to Set<SlotItem>:
public Set<SlotItem> getItems() {
return Collections.unmodifiableSet(this.items);
}Impact
This is a bug waiting to happen - users expecting a mutable HashSet might get unexpected runtime errors when trying to use HashSet-specific methods.