Skip to content

fix: 단일 메뉴 리뷰 작성 시 menuLike null 방지#504

Merged
HI-JIN2 merged 4 commits intodevelopfrom
fix/write-menu-review-npe
Mar 27, 2026
Merged

fix: 단일 메뉴 리뷰 작성 시 menuLike null 방지#504
HI-JIN2 merged 4 commits intodevelopfrom
fix/write-menu-review-npe

Conversation

@HI-JIN2
Copy link
Copy Markdown
Member

@HI-JIN2 HI-JIN2 commented Mar 26, 2026

Summary

스낵코너와 같은 단일메뉴에 대한 리뷰작성 api 호출시
메뉴에 대한 좋아요를 하지 않으면 menuLike가 null로 반환됨
해당 api는 별도로 menuId필드가 없고 menuLike(menuid, isLike)를 풀어서 쓰는 구조이기에
menuId가 없어서 리뷰가 db에 기록될 수 없음 => NPE 발생

Describe your changes

추적

  • 서버에서는 POST /v2/reviews/menu에서 menuLike=null를 받으면, menu리뷰 작성 API인데, menuId가 없어서 NPE이 발생합니다.
  • 안드로이드에서는 java.util.NoSuchElementException: List is empty. 이 발생하고 앱이 터집니다.

해결

FIXED(단일 메뉴) 리뷰는 menuLike를 항상 보내고, 좋아요를 안 눌렀으면 IsLike=false로 내려가도록 바꿨습니다.

인간 테스트 결과

수정 전 수정 후
NoSuchElementException와 함께 앱 터짐 잘 작성됨

Issue

To reviewers

빌드가 안되는 문제를 겪어서 관련 트러블슈팅 기록을 함께 남깁니다.

연쇄적 빌드 실패 문제 해결 관련

1. Kotlin 메타데이터 버전 불일치로 인한 빌드 실패

  • Kotlin 2.1 환경에서 빌드 시
    kotlinx-metadata-jvm이 2.0까지만 지원하여 메타데이터 버전 불일치 문제 발생
  • 이로 인해 Hilt/KSP 단계에서 컴파일 실패 발생
    → Hilt 및 관련 의존성을 최신 버전으로 업그레이드하여 해결
  • 향후 안정적인 호환성을 위해 AGP 9.0+ 업데이트 필요

2. Hilt DI 주입 실패 (protected visibility 이슈)

Dagger injector does not have access to kotlin protected fields

  • Kotlin의 protected는 같은 패키지 접근을 허용하지 않으며,
    Dagger(Hilt)의 코드 생성 클래스에서 접근 불가
    @Inject 필드를 protectedpublic(default)으로 변경하여 해결

한 줄 요약

Kotlin 메타데이터 버전 불일치와 Kotlin visibility 특성으로 인해 Hilt DI가 실패했고, 의존성 업데이트와 접근 제어 수정으로 해결했습니다.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the writeMenuReview method across the repository, use case, and test layers to include a menuId parameter. This change ensures that the review and its 'like' status are correctly associated with a specific menu item, replacing the previous logic that relied on the first element of a list. A suggestion was made to use the Elvis operator for a more idiomatic Boolean conversion in the repository implementation.

HI-JIN2 and others added 3 commits March 27, 2026 01:35
Kotlin 메타데이터 버전 불일치로 빌드 불가 문제를 해결하기 위함
…viewRepositoryImpl.kt

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@HI-JIN2 HI-JIN2 self-assigned this Mar 26, 2026
@HI-JIN2 HI-JIN2 marked this pull request as ready for review March 26, 2026 16:36
@HI-JIN2 HI-JIN2 requested a review from PeraSite March 26, 2026 16:36
Copy link
Copy Markdown
Member

@PeraSite PeraSite left a comment

Choose a reason for hiding this comment

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

갑자기 빌드 오류가 왜 생겼나 했더니 이런 이유였군용 👍

@HI-JIN2 HI-JIN2 merged commit ffe737d into develop Mar 27, 2026
2 checks passed
@HI-JIN2 HI-JIN2 deleted the fix/write-menu-review-npe branch March 27, 2026 00:33
@HI-JIN2 HI-JIN2 mentioned this pull request Mar 27, 2026
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.

단일 메뉴 리뷰v2 작성시 메뉴에 좋아요 안하면 NPE 터짐

2 participants