Skip to content

Remove Lombok @RequiredArgsConstructor and manually implement constructor#3467

Open
yashvinjasani wants to merge 2 commits intoiluwatar:masterfrom
yashvinjasani:master
Open

Remove Lombok @RequiredArgsConstructor and manually implement constructor#3467
yashvinjasani wants to merge 2 commits intoiluwatar:masterfrom
yashvinjasani:master

Conversation

@yashvinjasani
Copy link
Copy Markdown

Pull Request Template

What does this PR do?

Explaining Use-case for lombok here in decorator.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2026

PR Summary

Removed Lombok @requiredargsconstructor and implemented manual constructor for Troll initialization. Implemented Iterable in TreasureChest and updated its README to reflect iterable design and usage.

Changes

File Summary
ClubbedTroll.java Adds a new ClubbedTroll class with two immutable fields name and level and an explicit constructor.
iterator/README.md Docs updated to reflect that TreasureChest implements Iterable<Item> and provides an iterator, demonstrating iterable design pattern usage.

autogenerated by presubmit.ai

Updated TreasureChest class to implement Iterable interface and override iterator method.
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 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)

Comment thread iterator/README.md

```java
public class TreasureChest {
public class TreasureChest implements Iterable<Item> { //marking Iterable or overriding to get Iterator<Item>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread iterator/README.md
Comment on lines +65 to 67
public Iterator<Item> iterator(ItemType itemType) {
return new TreasureChestItemIterator(this, itemType);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant