개발/Java 4

[Lombok][Warning] @Builder will ignore the initializing expression entirely.

warning: @Builder will ignore the initializing expression entirely. If you want the initializing expression to serve as default, add @Builder. Default. If it is not supposed to be settable during building, make the field final. 빌드 시에 위 warning이 뜨는 케이스에 대해 알아보자. @Builder @Data @NoArgsConstructor public class Worker { private Long workerId; private WorkerType type = WorkerType.BASIC; } 만약 위와 같은 코드..

개발/Java 2023.01.15

[Lombok][Warning] 상속받은 클래스에 @Data만 사용하면 Warning이 뜨는 이유

프로젝트를 빌드할 때 종종 보이는 warning이 거슬려서 정리하는겸 블로그에 정리해본다. warning: Generating equals/hashCode implementation but without a call to superclass, even though this class does not extend java.lang.Object. If this is intentional, add '@EqualsAndHashCode(callSuper=false)' to your type. @Data 위 에러가 빌드할 때 종종 에러로 올라오는 것을 보았는데, IntelliJ를 통해 수정하면 @EqualsAndHashCode(callSuper=true) 어노테이션을 붙여주며 해결하지만, 왜 필요한지 한번 알아보자..

개발/Java 2023.01.14

[Java] AssertJ 사용법

Introduction to AssertJ | Baeldung AssertJ is an open-source library for writing fluent and rich assertions in Java tests. This article focuses on tools available in the basic AssertJ-core module. www.baeldung.com 해당 게시글은 위 글을 번역 및 테스트한 글이다. 1. AssertJ란? Java Test를 다양하게 사용할 수 있는 오픈 소스 커뮤니티 중심 라이브러리 2. 소개 AssertJ의 클래스 및 유틸리티 메소드 Standard Java Java 8 Guava Joda Time Neo4J and Swing components 예시 코..

개발/Java 2022.10.23

[Java] 인터페이스(Interface)란?

인터페이스(interface)란? 인터페이스(Interface) 인터페이스가 무엇인지 알아보고 인터페이스의 요소와 인터페이스를 활용한 다형성 구현에 대해 알아보자. 인터페이스의 역할 인터페이스는 클라이언트 프로그램에 어떤 메서드를 제공하는지 알려주는 명세(specification) 또는 약속이다. 한 객체가 어떤 인터페이스의 타입이라 함은 그 인터페이스의 메서드를 구현했다는 의미이며 클라이언트 프로그램은 실제 구현내용을 몰라도 인터페이스의 정의만 알면 그 객체를 사용할 수 있다. 인터페이스를 구현해 놓은 다양한 객체를 사용하는 것을 다형성이라고 하는데 예를 들면, JDBC를 구현한 오라클, MySQL라이브러리 등에서 어떤 인터페이스에 대한 구현을 각각 했을 때, 사용자는 인터페이스의 정의만을 보고 JDB..

개발/Java 2020.07.14