사용자 도구

사이트 도구


java:lombok

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
다음 판 양쪽 다음 판
java:lombok [2020/07/09 15:38]
kwon37xi [Gradle-Lombok]
java:lombok [2021/02/02 18:44]
kwon37xi [1.16.20]
줄 81: 줄 81:
   * 1.4 이하 Ant 태스크 : ''lombok.delombok.ant.DelombokTask''   * 1.4 이하 Ant 태스크 : ''lombok.delombok.ant.DelombokTask''
   * 1.6 이상 Ant 태스크 : ''lombok.delombok.ant.Tasks$Delombok''   * 1.6 이상 Ant 태스크 : ''lombok.delombok.ant.Tasks$Delombok''
 +
 +===== Upgrade 주의점 =====
 +  * [[https://projectlombok.org/changelog|lombok changelog]]
 +
 +==== 1.16.20 ====
 +  * 이 시점 이후부터 ''@AllArgsConstructor'', ''@RequiredArgsConstructor'' 등에서 자동으로 생성해주던 ''@ConstructorProperties(필드정보)'' 가 자동으로 생성이 안되게 바뀐다.
 +  * [[https://docs.oracle.com/javase/7/docs/api/java/beans/ConstructorProperties.html|@ConstructorProperties]]
 +  * 기본 생성자가 없을 경우, [[java:jackson|Java Jackson JSON Library]] 등이 
 +  * ''lombok.config''에서 ''lombok.anyConstructor.addConstructorProperties=true''를 명시적으로 주면 자동 생성된다.
 +
 +==== 1.18.4 field annotation 들이 getter/setter 로 복제됨 ====
 +  * 1.18.4 이상 버전은 field 에 지정한 ''@JsonProperty'' 를 비롯한 여러 annotation이 getter/setter 로 복제가 된다.
 +  * 문제는 기존에 복제를 안해주는 버전으로 응답을 내려줄때, ''@JsonProperty''값과 getter 의 이름이 다를 경우 두개가 다 외부 응답으로 나갔었는데, getter 의 이름으로 나가던 필드를 사용하는 타 팀이 존재할 경우 값자기 getter 이름쪽 응답이 사라져버린다.
 +
 +>> BREAKING CHANGE: Lombok will now always copy specific annotations around (from field to getter, from field to builder 'setter', etcetera): A specific curated list of known annotations where that is the right thing to do (generally, @NonNull style annotations from various libraries), as well as any annotations you explicitly list in the lombok.copyableAnnotations config key in your lombok.config file. Also, lombok is more consistent about copying these annotations. (Previous behaviour: Lombok used to copy any annotation whose simple name was NonNull, Nullable, or CheckForNull). Issue #1570 and Issue #1634
 +
 +=== 구버전 ===
 +
 +<code java>
 +@JsonProperty("xxx")
 +private int yyy;
 +
 +-> 진짜 생성은
 +
 +@JsonProperty("xxx")
 +private int yyy;
 +
 +public void setYyy(int yyy) {
 +    this.yyy = yyy;
 +}
 +
 +-> 이로 인해서 JSON 에 XXX, yyy 두개의 필드가 존재하게 됨.
 +</code>
 +
 +=== 신 버전 Lombok ===
 +<code java>
 +@JsonProperty("xxx")
 +private int yyy;
 +
 +-> 진짜 생성은
 +
 +@JsonProperty("xxx")
 +private int yyy;
 +
 +// 아래 setter 에도 @JsonProperty 가 붙어버림
 +@JsonProperty("xxx")
 +public void setYyy(int yyy) {
 +    this.yyy = yyy;
 +}
 +</code>
java/lombok.txt · 마지막으로 수정됨: 2022/06/23 11:10 저자 kwon37xi