Skip to content

260630_13_김진용#94

Open
KJY-1204 wants to merge 3 commits into
SurvivalCodingCampus:student/13_김진용from
KJY-1204:master
Open

260630_13_김진용#94
KJY-1204 wants to merge 3 commits into
SurvivalCodingCampus:student/13_김진용from
KJY-1204:master

Conversation

@KJY-1204

Copy link
Copy Markdown

260630_13_김진용

📝 과제 정보

  • 교육 주제: 인스턴스 기본조작

📋 체크리스트

  • 코드 컨벤션 준수 (Formatter 적용)
  • 모든 테스트 케이스 통과 (JUnit)

📷 실행 결과 (또는 테스트 결과)

image

❓질문 및 어려웠던 점

복사랑 정렬이 어려웠다

🔄 자체 평가 & 회고

  • 이번 과제를 통해 새롭게 알게 된 점이나 아쉬운 점을 기록합니다.
  • 오늘 수업이랑 연습문제는 어려웠다

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@KJY-1204, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 13 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fe38561e-8877-48fa-9f28-c2d6ff66f0b7

📥 Commits

Reviewing files that changed from the base of the PR and between ba47e9e and bea3593.

📒 Files selected for processing (2)
  • post-oop/src/main/java/com/survivalcoding/Book.java
  • post-oop/src/test/java/com/survivalcoding/BookTest.java

Walkthrough

Gradle 멀티프로젝트에 post-oop 모듈을 신규 등록하고, Comparable<Book>Cloneable을 구현한 Book 클래스(equals/hashCode/compareTo/clone)와 JUnit5 테스트, PlantUML 다이어그램, TIL 마크다운 문서를 추가한다.

Changes

post-oop 모듈 신규 추가

Layer / File(s) Summary
Gradle 모듈 등록 및 빌드 설정
settings.gradle, post-oop/build.gradle
settings.gradlepost-oop를 포함시키고, build.gradlejava 플러그인과 JUnit5(BOM 6.0.0, Jupiter, launcher) 의존성을 구성한다.
Book 클래스 구현
post-oop/src/main/java/com/survivalcoding/Book.java, post-oop/src/main/java/com/survivalcoding/Main.java
Comparable<Book>, Cloneable을 구현한 Book 클래스를 추가한다. equals/hashCodetitle·publishDate 기준, compareTopublishDate 역순(null이면 0 반환), clonepublishDateDate.clone()으로 깊은 복사한다. Main은 기본 진입점 역할을 한다.
JUnit5 테스트, PlantUML 다이어그램, TIL 문서
post-oop/src/test/java/com/survivalcoding/BookTest.java, post-oop/06_30.puml, TIL/sample/2026-06-30-인스턴스기본조작.md
BookTest에서 equals/hashCode(HashSet 중복 제거), compareTo(정렬 순서), clone(제목·publishDate 시간값 일치)을 검증한다. PlantUML 파일과 TIL 마크다운으로 설계를 문서화한다.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive 제목이 변경 내용을 설명하지 않고 식별자만 있어, PR의 핵심 변경을 파악하기 어렵습니다. 인스턴스 기본조작 예제 추가, Book 클래스 구현, TIL 작성 등 주요 변경을 요약한 짧은 제목으로 바꾸세요.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed 템플릿의 필수 섹션을 대부분 갖추고 있으며, 과제 정보·체크리스트·실행 결과·어려웠던 점·회고가 모두 포함됩니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
post-oop/src/test/java/com/survivalcoding/BookTest.java (1)

36-57: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

정렬 테스트에 동률/null 날짜 케이스를 추가해 주세요.

지금 테스트는 날짜가 서로 다른 경우만 검증해서, Book.compareTo()가 같은 날짜의 다른 책을 0으로 처리하는 버그를 잡지 못합니다. 같은 publishDate + 다른 title, 그리고 publishDate == null 케이스를 하나씩 추가해 두는 편이 안전합니다.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@post-oop/src/test/java/com/survivalcoding/BookTest.java` around lines 36 -
57, The Book.compareTo() test only covers different publishDate values, so it
misses tie and null-handling behavior. Extend BookTest.compareTo() to add one
case where two Book instances share the same publishDate but have different
titles and verify the ordering/comparison is not collapsed to 0, and another
case where publishDate is null to confirm the method handles null dates safely;
use the existing compareTo() test and Book setup patterns to locate and expand
the assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@post-oop/src/main/java/com/survivalcoding/Book.java`:
- Around line 66-70: `Book.compareTo()`가 `equals()`와 일치하지 않아 같은 `publishDate`이거나
`null`일 때 모두 0을 반환합니다. `compareTo(Book other)`에서 `publishDate`만으로 동등 처리하지 말고,
`publishDate`가 같거나 둘 다 null인 경우에는 `title`이나 식별자 같은 다른 필드로 2차 비교를 추가해 서로 다른
`Book`이 0으로 묶이지 않도록 수정하세요. `Book` 클래스의 `compareTo()`, `equals()`, `publishDate`
처리 로직이 일관되게 정렬되도록 맞추면 됩니다.

In `@TIL/sample/2026-06-30-인스턴스기본조작.md`:
- Around line 54-67: 복사 설명과 `clone()` 예제가 서로 다른 수준의 복사를 설명하고 있습니다. `clone()`이
`publishDate`를 새 `Date`로 복제하는 현재 동작에 맞게 문서의 “얕은 복사” 설명을 수정하거나, 반대로 예제를 완전한 얕은
복사로 바꿔서 `clone()`과 설명이 일치하도록 정리하세요. `clone()`과 “얕은 복사/깊은 복사” 섹션이 같은 의미를 가리키도록
맞추면 됩니다.

---

Nitpick comments:
In `@post-oop/src/test/java/com/survivalcoding/BookTest.java`:
- Around line 36-57: The Book.compareTo() test only covers different publishDate
values, so it misses tie and null-handling behavior. Extend BookTest.compareTo()
to add one case where two Book instances share the same publishDate but have
different titles and verify the ordering/comparison is not collapsed to 0, and
another case where publishDate is null to confirm the method handles null dates
safely; use the existing compareTo() test and Book setup patterns to locate and
expand the assertions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 287a7e81-2580-4ab5-bbdc-f144fd6fe6e7

📥 Commits

Reviewing files that changed from the base of the PR and between 39a341a and ba47e9e.

📒 Files selected for processing (7)
  • TIL/sample/2026-06-30-인스턴스기본조작.md
  • post-oop/06_30.puml
  • post-oop/build.gradle
  • post-oop/src/main/java/com/survivalcoding/Book.java
  • post-oop/src/main/java/com/survivalcoding/Main.java
  • post-oop/src/test/java/com/survivalcoding/BookTest.java
  • settings.gradle

Comment on lines +66 to +70
public int compareTo(Book other) {
if (this.publishDate == null || other.publishDate == null) {
return 0;
}
return other.publishDate.compareTo(this.publishDate);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

compareTo()가 현재 equals()와 충돌합니다.

같은 publishDate를 가진 서로 다른 책이거나, 둘 중 하나의 날짜가 null인 경우에도 0을 반환해서 서로 다른 객체가 같은 정렬 키로 취급됩니다. 이 상태로 TreeSet/TreeMap에 넣으면 데이터가 누락될 수 있습니다.

수정 예시
 `@Override`
 public int compareTo(Book other) {
-    if (this.publishDate == null || other.publishDate == null) {
-        return 0;
-    }
-    return other.publishDate.compareTo(this.publishDate);
+    int byPublishDate = java.util.Comparator
+            .nullsLast(java.util.Comparator.<Date>reverseOrder())
+            .compare(this.publishDate, other.publishDate);
+    if (byPublishDate != 0) {
+        return byPublishDate;
+    }
+    return java.util.Comparator
+            .nullsFirst(String::compareTo)
+            .compare(this.title, other.title);
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public int compareTo(Book other) {
if (this.publishDate == null || other.publishDate == null) {
return 0;
}
return other.publishDate.compareTo(this.publishDate);
public int compareTo(Book other) {
int byPublishDate = java.util.Comparator
.nullsLast(java.util.Comparator.<Date>reverseOrder())
.compare(this.publishDate, other.publishDate);
if (byPublishDate != 0) {
return byPublishDate;
}
return java.util.Comparator
.nullsFirst(String::compareTo)
.compare(this.title, other.title);
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@post-oop/src/main/java/com/survivalcoding/Book.java` around lines 66 - 70,
`Book.compareTo()`가 `equals()`와 일치하지 않아 같은 `publishDate`이거나 `null`일 때 모두 0을
반환합니다. `compareTo(Book other)`에서 `publishDate`만으로 동등 처리하지 말고, `publishDate`가 같거나
둘 다 null인 경우에는 `title`이나 식별자 같은 다른 필드로 2차 비교를 추가해 서로 다른 `Book`이 0으로 묶이지 않도록
수정하세요. `Book` 클래스의 `compareTo()`, `equals()`, `publishDate` 처리 로직이 일관되게 정렬되도록
맞추면 됩니다.

Comment on lines +54 to +67
### 복사를 지원하기 위해 다음 메서드를 작성한다.

- Cloneable 인터페이스를 구현하여 얕은 복사를 구현하기로 한다

### 얕은 복사

- 객체 자체는 새로 생성되지만, 객체 내의 참조 타입 필드(다른 객체에 대한 참조)는 원본과 동일한 객체를 참조합니다.
- 즉, 중첩된 객체는 복사되지 않고 주소만 복사됩니다.
- 원본 객체의 참조 타입 필드를 변경하면 복사본의 해당 필드도 함께 변경됩니다.

### 깊은 복사

- 객체 자체뿐만 아니라, 객체 내의 모든 참조 타입 필드(중첩된 객체들)까지도 재귀적으로 완전히 새로 생성하여 복사합니다.
- 원본 객체와 복사본 객체는 완전히 독립적입니다. 한쪽을 변경해도 다른 쪽에는 영향을 주지 않습니다.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

복사 설명이 현재 구현과 맞지 않습니다.

Line 56은 “얕은 복사”라고 적혀 있지만, 아래 코드의 clone()publishDate를 별도 Date로 복제해서 부분적인 깊은 복사를 하고 있습니다. TIL 내용과 예제 코드가 서로 다르게 읽히니 한쪽으로 맞춰 주세요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@TIL/sample/2026-06-30-인스턴스기본조작.md` around lines 54 - 67, 복사 설명과 `clone()` 예제가
서로 다른 수준의 복사를 설명하고 있습니다. `clone()`이 `publishDate`를 새 `Date`로 복제하는 현재 동작에 맞게 문서의
“얕은 복사” 설명을 수정하거나, 반대로 예제를 완전한 얕은 복사로 바꿔서 `clone()`과 설명이 일치하도록 정리하세요. `clone()`과
“얕은 복사/깊은 복사” 섹션이 같은 의미를 가리키도록 맞추면 됩니다.

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