@SuppressWarning("")

컴파일러경고를 억제 시킬 때 사용하는 이클립스 내장 어노테이션이다

변수명이나 메서드명 클래스명 위에 작성하면 된다

 

	@SuppressWarnings({"unchecked", "null"})//2개를 선언할 때
	public JSONObject JSONStudy(){
    
    	@SuppressWarnings("null")//1개만 선언할 때
        String str = null;
    }
  • all : 모든 경고 제외
  • cast : 캐스트 연산자 관련 경고 억제
  • dep-ann : 주석관련 경고 억제
  • deprecation : 메서드 관련 경고 억제
  • fallthrough : switch문에서 break 누락 관련 경고 억제
  • finally : finally 블럭 관련 경고 억제
  • null : null 관련 경고 억제
  • rawtypes : 제네릭을 사용하는 클래스 매개변수가 불특정할때 경고 억제
  • unchecked : 검증되지 않은 연산자 관련 경고 억제
  • unused : 사용하지 않는 코드 관련 경고 억제
  • serial : 직렬화 클래스에 serialVersionUID가 누락됐을 때 경고 억제
  • static-method : static으로 선언될 수 있는 메서드와 관련된 경고 억제

www.ibm.com/support/knowledgecenter/ko/SS8PJ7_9.5.0/org.eclipse.jdt.doc.user/tasks/task-suppress_warnings.htm

 

IBM Knowledge Center

Please note that DISQUS operates this forum. When you sign in to comment, IBM will provide your email, first name and last name to DISQUS. That information, along with your comments, will be governed by DISQUS’ privacy policy. By commenting, you are acce

www.ibm.com

 

하지만 현업에서는 사용하는걸 권장하지 않는다

컴파일 경고를 무시하고 컴파일을하면 오류가 터질 확률이 다분하기 때문에

+ Recent posts