Method must have signature “String method() …[etc]…” but has signature “void method()”

Ignore it. Eclipse is a jerk. You can tone it by setting Window > Preferences > Web > JavaServer Faces Tools > Validation > Type Assignment Problems > Method expression signature incompatibility to Warning or Ignore (it defaults to Error).

enter image description here

Image borrowed from this blog in all courtesy.

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 😉

This is fixed in Eclipse Luna SR1, nearly 6 years after the issue was reported. The severity has been decreased from Error to Warning. You may still want to put it yet lower to Ignore.

See also:

Leave a Comment