์ด ์ฝ๋๋ javac๋ก ์ปดํ์ผํ ๋ ๊ฒฝ๊ณ ๋ฅผ ์์ฑํฉ๋๋ค.
public class WarningDemo {
List<Integer> makeList() {
return null;
}
@Getter(lazy=true) private final List<Integer> list = makeList();
}
-Xlint
ํ๋ฉด
src/WarningDemo.java:10: warning: [unchecked] unchecked cast
@Getter(lazy=true) private final List<Integer> list = makeList();
^
required: List<Integer>
found: Object
delomboked ์ฝ๋์๋ @java.lang.SuppressWarnings("all")
๊ฐ ์์ง๋ง ๋์์ด ๋์ง ์๊ฑฐ๋ ์ปดํ์ผ์ด ๋ค๋ฅด๊ฒ ์๋ํฉ๋๋ค.
์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ๋ฐฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
@Getter(lazy = true, onMethod = @__({@SuppressWarnings("unchecked")}))
์ด๊ฒ์ ์ค์ ๋ก ๋์์ด ๋์ง๋ง
@Getter(lazy = true, onMethod = @__({@SuppressWarnings("all")}))
ํ์ง ์์ต๋๋ค. ๋ฐ๋ผ์ "๋ชจ๋"๋ "๋ชจ๋"๋ฅผ ์๋ฏธํ์ง ์์ต๋๋ค. ์ด๊ฒ๋ ๋์์ด ๋ฉ๋๋ค.
@Getter(lazy = true, onMethod = @__({@SuppressWarnings({"unchecked", "all"})}))
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ด๊ฒ์ ์ค์ ๋ก ๋์์ด ๋์ง๋ง
ํ์ง ์์ต๋๋ค. ๋ฐ๋ผ์ "๋ชจ๋"๋ "๋ชจ๋"๋ฅผ ์๋ฏธํ์ง ์์ต๋๋ค. ์ด๊ฒ๋ ๋์์ด ๋ฉ๋๋ค.