Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client:3.3.3'
//runtimeOnly 'mysql:mysql-connector-java:8.0.33'
//implementation 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/umc/linkyou/domain/mapping/UsersLinku.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@ public class UsersLinku extends BaseEntity {

@Builder.Default
@Column(name = "is_ai_exist", nullable = false)
private Boolean isAiExist = false;
private Boolean aiExist = false;

public Boolean getAiExist() {
return this.aiExist;
}
Comment on lines +43 to +47
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -type f -name "UsersLinku.java" -path "*/domain/mapping/*"

Repository: LinkYou-2025/LinkU_backend

Length of output: 132


🏁 Script executed:

cat -n ./src/main/java/com/umc/linkyou/domain/mapping/UsersLinku.java | head -60

Repository: LinkYou-2025/LinkU_backend

Length of output: 1617


🌐 Web query:

Lombok @Getter boolean field naming convention isXxx getXxx

💡 Result:

Short answer: Lombok follows JavaBean rules — for primitive boolean fields it generates isXxx(); for Boolean it generates getXxx(); and if the field name already starts with "is" followed by an uppercase letter Lombok will not prefix another "is" (it will generate a method matching the field name). Lombok also avoids generating duplicate accessors when names conflict. (projectlombok.org)

Citations:


🌐 Web query:

Lombok duplicate method error explicit getter @Getter conflict

💡 Result:

Cause

  • Lombok generates methods (getters/constructors/delegates). A "duplicate method" error appears when Lombok would generate a method that already exists (you wrote it, it exists in a superclass, or another Lombok annotation also generates it). Examples: @Getter on a field named like a superclass method (getModel), combining @NoArgsConstructor/@AllArgsConstructor/@requiredargsconstructor that both produce a no-arg constructor, or @DeleGate copying the same method twice. [1][2][3]

How to fix (pick the one that fits)

  • Remove the explicit method (let Lombok generate it) or remove the Lombok annotation (keep your explicit method). [2]
  • Suppress Lombok generation for a specific field: annotate the field with @Getter(AccessLevel.NONE) (or use @Setter(AccessLevel.NONE)) so Lombok won't generate that accessor. Or put @Getter on the class but @Getter(AccessLevel.NONE) on the specific field. [1]
  • Rename the field so the generated accessor name doesn't clash with a superclass method. [3]
  • For constructor conflicts: avoid combining annotations that produce identical constructors (write the constructor yourself, or use @SuperBuilder for inheritance-aware constructors). Use @NoArgsConstructor(force=true) only if appropriate. [2]
  • For @DeleGate conflicts: use @DeleGate(excludes=...) or delegate to a narrower interface to avoid copying duplicate methods. [1][4]
  • If your IDE shows the error but javac/build succeeds, ensure annotation processing is enabled and the Lombok IDE plugin is installed; sometimes IDE tooling reports false duplicates. [2]

References

  • Lombok @DeleGate docs — explains delegation and excludes. [1]
  • StackOverflow threads on duplicate constructors and Lombok-generated methods. [2]
  • Example of getter name clash with superclass (rename/suppress solution). [3]
  • VSCode/@DeleGate duplicate-method discussion. [4]

Remove duplicate getter or suppress Lombok generation for aiExist field.

The explicit getAiExist() method on lines 45-47 duplicates the getter that Lombok's @Getter annotation (line 11) generates. For Boolean wrapper type fields, Lombok generates getXxx() methods, not isXxx().

To resolve: either remove the explicit getAiExist() method and let Lombok generate it, or annotate the field with @Getter(AccessLevel.NONE) to suppress Lombok generation for this field.

Note: The field naming aiExist with getter getAiExist() follows valid Java conventions for boolean properties; the database column name is_ai_exist is also appropriate.

🤖 Prompt for AI Agents
In src/main/java/com/umc/linkyou/domain/mapping/UsersLinku.java around lines 43
to 47, there is a duplicate getter for the Boolean field aiExist that conflicts
with Lombok's @Getter on the class; remove the explicit getAiExist() method so
Lombok generates it, OR suppress Lombok for this field by adding
@Getter(AccessLevel.NONE) to the aiExist field and keep the custom getAiExist()
implementation; if you choose suppression, add the lombok.AccessLevel import and
ensure only one getter exists after the change.

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.umc.linkyou.repository.userRepository;

import com.querydsl.core.types.Projections;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.NumberExpression;
import com.querydsl.jpa.JPAExpressions;
import com.querydsl.jpa.JPQLQuery;
Expand Down Expand Up @@ -39,12 +40,20 @@ public UserResponseDTO.UserProfileSummaryDto findUserProfileSummary(Long userId)
.from(uf)
.where(uf.user.id.eq(u.id));

JPQLQuery<Long> aiLinkCountSub = JPAExpressions
.select(a.count())
// JPQLQuery<Long> aiLinkCountSub = JPAExpressions
// .select(a.count())
// .from(ul)
// .join(ul.linku, l)
// .join(l.aiArticle, a)
// .where(ul.user.id.eq(u.id));

BooleanExpression aiExistSub = JPAExpressions
.selectOne()
.from(ul)
.join(ul.linku, l)
.join(l.aiArticle, a)
.where(ul.user.id.eq(u.id));
.where(ul.user.id.eq(u.id)
.and(ul.aiExist.isTrue())
)
.exists();

return queryFactory
.select(Projections.constructor(
Expand All @@ -55,7 +64,7 @@ public UserResponseDTO.UserProfileSummaryDto findUserProfileSummary(Long userId)
u.job,
linkCountSub,
folderCountSub,
aiLinkCountSub
aiExistSub
))
.from(u)
.where(u.id.eq(userId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public AiArticleResponsetDTO.AiArticleResultDTO saveAiArticle(Long linkuId, Long

//ai 생성여부
if (usersLinku != null) {
usersLinku.setIsAiExist(true);
usersLinku.setAiExist(true);
usersLinkuRepository.save(usersLinku);
}

Expand Down Expand Up @@ -179,7 +179,7 @@ public AiArticleResponsetDTO.AiArticleResultDTO showAiArticle(Long linkuId, Long
.orElse(null);

// UsersLinku가 없거나 isAiExist가 false인 경우 false로 처리
if (usersLinku == null || usersLinku.getIsAiExist() == null || !usersLinku.getIsAiExist()) {
if (usersLinku == null || usersLinku.getAiExist() == null || !usersLinku.getAiExist()) {
// UsersLinku가 없으면 false로 처리하여 반환
// usersLinku가 null이면 null로 전달하고, Converter에서 null 처리를 하도록 함
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private List<LinkuResponseDTO.LinkuSimpleDTO> mapPagedListToDto(List<LinkuIntern
Linku linku = userLinku.getLinku();
Domain domain = linku.getDomain();

boolean aiArticleExists = Boolean.TRUE.equals(userLinku.getIsAiExist());
boolean aiArticleExists = Boolean.TRUE.equals(userLinku.getAiExist());

return LinkuConverter.toLinkuSimpleDTO(
linku,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public ApiResponse<LinkuResponseDTO.LinkuResultDTO> detailGetLinku(Long userId,
LinkuFolder linkuFolder =
linkuFolderRepository.findFirstByUsersLinku_UserLinkuIdOrderByLinkuFolderIdDesc(usersLinku.getUserLinkuId()).orElse(null);
AiArticle aiArticle = aiArticleRepository.findByLinku(linku).orElse(null);
boolean aiArticleExists = Boolean.TRUE.equals(usersLinku.getIsAiExist());
boolean aiArticleExists = Boolean.TRUE.equals(usersLinku.getAiExist());

String keyword = null;
String summary = null;
Expand Down Expand Up @@ -179,7 +179,7 @@ public List<LinkuResponseDTO.LinkuSimpleDTO> getRecentViewedLinkus(Long userId,
.orElseThrow(() -> new GeneralException(ErrorStatus._USER_LINKU_NOT_FOUND));


boolean aiArticleExists = Boolean.TRUE.equals(usersLinku.getIsAiExist());
boolean aiArticleExists = Boolean.TRUE.equals(usersLinku.getAiExist());
Domain domain = linku.getDomain();

LinkuResponseDTO.LinkuSimpleDTO dto = toLinkuSimpleDTO(linku, usersLinku, domain, aiArticleExists);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/umc/linkyou/web/dto/UserResponseDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static class UserInfoDTO{
Long myFolder; // 나의 폴더

// 내가 만든 ai 링크
Long myAiLinku;
Boolean myAiLinku;

}
@Builder
Expand All @@ -83,7 +83,7 @@ public static class UserProfileSummaryDto {
private final Job job;
private final Long myLinku;
private final Long myFolder;
private final Long myAiLinku;
private final Boolean myAiLinku;
private List<String> purposes;
private List<String> interests;

Expand All @@ -94,15 +94,15 @@ public UserProfileSummaryDto(
Job job,
Long linkCount,
Long folderCount,
Long aiLinkCount
Boolean isAiExist
) {
this.nickName = nickName;
this.email = email;
this.gender = gender;
this.job = job;
this.myLinku = linkCount;
this.myFolder= folderCount;
this.myAiLinku= aiLinkCount;
this.myAiLinku= isAiExist;
this.purposes = java.util.Collections.emptyList();
this.interests = java.util.Collections.emptyList();
}
Expand Down