[erlang-questions] Dialyzer, Callback info about the behaviour is not available

Kostis Sagonas kostis@REDACTED
Thu Jan 5 11:40:34 CET 2012


On 01/05/12 03:57, Jeremy Raymond wrote:
> Hi,
>
> I'm running dialyzer on an app. I've built the plt for the apps I'm using one of which is cowboy. I've implemented cowboy's cowboy_http_handler behaviour. When I run dialyzer is outputs the warning, "my_http_handler:10: Callback info about the cowboy_http_handler behaviour is not available". How can I teach dialyzer about the cowboy_http_handler behaviour?

Dialyzer's message means that this particular behaviour module has not 
been adapted to specify type information about its callbacks. (This is 
of course understandable given that this is a new language addition.)

I've taken a look at the source code of this particular module:

https://github.com/extend/cowboy/blob/master/src/cowboy_http_handler.erl

and it appears to be very minimal. (As a matter of fact, I am a bit 
baffled by its minimality.) To avoid this warning the developers of 
cowboy need to adapt its code so that it contains -callback attributes 
instead of a behaviour_info/1 function. (This function will be generated 
automatically if callback attributes are present.) But of course this 
will mean that cowboy will require R15B. Until this change is done, you 
can either create your own version of this module with proper callback 
information in it, or use the -Wno_behaviours command line option of 
dialyzer.

Kostis



More information about the erlang-questions mailing list