Program Tip

메서드에는 "String method ()… [etc]…"서명이 있어야하지만 "void method ()"서명이 있어야합니다.

programtip 2020. 11. 20. 09:29
반응형

메서드에는 "String method ()… [etc]…"서명이 있어야하지만 "void method ()"서명이 있어야합니다.


각 행에 버튼이있는 데이터 테이블이 있습니다.

<ice:dataTable ... var="item">
  <ice:column>
    <h:commandButton value="Download" action="#{mybean.downloadItem(item)}" />
  </ice:column>
</ice:dataTable>

backing bean에는 다음 방법이 있습니다.

public void downloadItem(Item item) {
    // ...
}

모든 것이 잘 작동하지만 (클릭하면 메서드가 실행 됨) Eclipse 유효성 검사가 다음과 같은 이상한 메시지와 함께 실패합니다.

메소드에는 "문자열 메소드 (), 문자열 메소드 (), 문자열 메소드 (문자열), 문자열 메소드 (문자열, 문자열), 문자열 메소드 (문자열, 문자열), 문자열 메소드 (문자열, 문자열, 문자열, 문자열)이 있어야합니다. , String 메서드 (String, String, String, String, String), String 메서드 (String, String, String, String, String, String), String method (String, String, String, String, String, String, String), String method (String, String, String, String, String, String, String, String), String method (String, String, String, String, String, String, String, String, String), String method (String, String, String, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열), 문자열 메서드 (String, String, String, String, String, String, String, String, String, String, String), String method (String, String, String, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열,String, String), String method (String, String, String, String, String, String, String, String, String, String, String, String, String), String method (String, String, String, String, String, String, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열), 문자열 메서드 (문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열) , String 메서드 (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method (String, String, String, String, String, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열), 문자열 메서드 (문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열, 문자열),String method (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String) "이지만 시그니처"void method () "

어떡해?

관련이 있다면 Tomcat 7에서 Eclipse Indigo SR1을 사용하고 있습니다.


무시해. Eclipse는 바보입니다. Window> Preferences> Web> JavaServer Faces Tools> Validation> Type Assignment Problems> Method expression signature incompatibility to Warning or Ignore (기본값은 Error ) 로 설정하여 톤을 지정할 수 있습니다 .

여기에 이미지 설명 입력

이 블로그 에서 빌린 이미지 는 모두 무료입니다.

The reason is, Eclipse expect the action attribute to always return String, not void. Whilst indeed unspecified in JSF action attribute, the EL method expressions themselves actually also support void methods. The overzealous message in turn suggests that the underlying logic responsible for this validation is incapable of determining the individual method arguments and thus it tries to compare the raw method signature against a collection of allowed signatures, which ultimately get shown in the message if no match was found. Based on the message, this problem may also disappear when the method has 20 or more arguments ;)

이 문제는 문제가보고 된 지 거의 6 년 후인 Eclipse Luna SR1에서 수정되었습니다. 심각도가 오류 에서 경고 로 감소했습니다 . 여전히 Ignore로 낮추고 싶을 수 있습니다 .

또한보십시오:

참고 URL : https://stackoverflow.com/questions/8083469/method-must-have-signature-string-method-etc-but-has-signature-void

반응형