Better error reporting when snippet methods can't be found
Snippets are matched against methods using reflection. If a method cannot be found, it is sometimes because of a signature mismatch, and useful information about this can be conveyed to the user.
The mismatch is typically either the wrong arguments, or wrong return type. (The latter can easily happen if is not declared explicitly, but inferenced by the compiler!)
Error cases can be tricky to report, because of overloading. However, if there is only a single method by the matching name, the user would benefit greatly from an error message saying that the method WAS in fact found, but it could not be used, for this reason. Simply saying that the method wasn't found is slightly misleading, and suggests that a rebuild is needed, or something.
The case of the wrong return type should be easier to report, since methods cannot be overloaded by return type only. Hence, if there is a method with the correct argument list (which should be checked for first) it could be reported as "the method you probably wanted to use".
The mismatch is typically either the wrong arguments, or wrong return type. (The latter can easily happen if is not declared explicitly, but inferenced by the compiler!)
Error cases can be tricky to report, because of overloading. However, if there is only a single method by the matching name, the user would benefit greatly from an error message saying that the method WAS in fact found, but it could not be used, for this reason. Simply saying that the method wasn't found is slightly misleading, and suggests that a rebuild is needed, or something.
The case of the wrong return type should be easier to report, since methods cannot be overloaded by return type only. Hence, if there is a method with the correct argument list (which should be checked for first) it could be reported as "the method you probably wanted to use".
Leave a comment
on 2010-02-06 19:48 *
By github.importer
Imported from GitHub: http://github.com/dpp/liftweb/issues/75/find