Remove Lombok @RequiredArgsConstructor and manually implement constructor#3467
Remove Lombok @RequiredArgsConstructor and manually implement constructor#3467yashvinjasani wants to merge 2 commits intoiluwatar:masterfrom
Conversation
…ctor for Troll initialization
PR SummaryRemoved Lombok @requiredargsconstructor and implemented manual constructor for Troll initialization. Implemented Iterable in Changes
autogenerated by presubmit.ai |
Updated TreasureChest class to implement Iterable interface and override iterator method.
There was a problem hiding this comment.
🚨 Pull request needs attention.
Review Summary
Commits Considered (1)
- 11a03dc: Implement Iterable in TreasureChest class
Updated TreasureChest class to implement Iterable interface and override iterator method.
Files Processed (1)
- iterator/README.md (2 hunks)
Actionable Comments (2)
-
iterator/README.md [47-47]
possible bug: "Iterable contract not fulfilled in example"
-
iterator/README.md [65-67]
possible bug: "Incorrect override and signature for iterator()"
Skipped Comments (0)
|
|
||
| ```java | ||
| public class TreasureChest { | ||
| public class TreasureChest implements Iterable<Item> { //marking Iterable or overriding to get Iterator<Item> |
There was a problem hiding this comment.
Declares the class as Iterable but the example snippet does not include the required iterator() method with no parameters. Iterable contract requires public Iterator iterator(). The current snippet will not compile as-is.
| public Iterator<Item> iterator(ItemType itemType) { | ||
| return new TreasureChestItemIterator(this, itemType); | ||
| } |
There was a problem hiding this comment.
This method signature does not override the Iterable.iterator() contract. Using @OverRide on a method with a parameter will fail to compile. If you want a type-filtered iterator, provide a separate method with a different name (e.g., iteratorByType) and keep a parameterless iterator() for the Iterable interface.
|



Pull Request Template
What does this PR do?
Explaining Use-case for lombok here in decorator.