One idea:

def receive = { case => ... } : Receive

(On my phone so may not work)
-- 
Cheers,
√
On 15 Jan 2015 23:06, "javierg" <javierg1...@gmail.com> wrote:

> Hi Konrad,
> Adding the type signature doesn't seem to have any effect
>
> *Error:(31, 26) Inferred type containing Any*
> *  def receive: Receive = {*
> *                         ^*
>
> I'm aware that WartRemover can be configured.
> I could set this particular wart to be reported as a *warning* and not an
> *error* but that will also make any other (valid) instances to marked as
> such and it's my experience that warnings get, more often than not, "swept
> under the rug" (something I was trying to avoid.)
> Still, like you mentioned, there doesn't seem to be a solution for this at
> the moment. I just wanted to be sure I wasn't missing something obvious.
> Many thanks for the prompt reply.
>
>
>
> On Thursday, January 15, 2015 at 4:32:47 PM UTC-5, Konrad Malawski wrote:
>>
>> Hello there,
>> As I understand it, wart-remover is configurable to which "warts” it
>> should be reporting.
>>
>> In the case of Actor.Receive it’s not happy because it is an alias to Any
>> => Unit.
>> Without a large philosophical dive why it is such and not a different
>> signature (and btw. Roland will soon soon get a new impl ot akka.typed out
>> for preview ;-)),
>> let’s address your problem and question at hand.
>>
>> Two solutions come to mind:
>> 1) Since the wart is triggered for “inferred type contains Any”, you can
>> write the type explicitly (def receive: Receive = …) instead of it being
>> inferred I assume? (Did not try that though)
>>
>> 2) As seen on: https://github.com/puffnfresh/wartremover these warts can
>> be enabled / disabled at will.
>> warts can be configured and in your case you’d like to keep all “except
>> inferred type contains Any”,
>> so you could use:
>>
>>     wartremoverErrors := Warts.allBut(Wart.Any)
>>
>> which should make it happy on receive methods.
>>
>>
>> Hope this helps!
>> Disclaimer: I did not try this, but it seems to all logically fall into
>> place :-)
>>
>> --
>> Konrad 'ktoso’ Malawski
>> Akka <http://akka.io> @ Typesafe <http://typesafe.com>
>>
>> On 15 January 2015 at 22:24:00, javierg (javie...@gmail.com) wrote:
>>
>> Hi all,
>> Apologies for the more than slightly offtopic question.
>> I recently started using WartRemover and one of the first things that I
>> encountered is a barrage of error notifications like what follows (for, as
>> long as I can see, every receive method in my codebase)
>>
>> *Error:(31, 7) Inferred type containing Any*
>> *  def receive = {*
>> *      ^*
>>  Before WartRemover this code used to compile (and run) without issues.
>> WartRemover claims it doesn't report false positives, but I'm getting this
>> error on cases as simple and trivial as the following (admittedly
>> contrived) example
>>
>> *def receive = {*
>> *    case a:String => log.info <http://log.info>(a)*
>>     *case _ => log.info <http://log.info>("Unexpected input")*
>> *} *
>>
>> Is there a way to solve this (other than asking WartRemover to not report
>> this)?
>> Thanks in advance,
>>
>> Javier
>>
>>
>>  --
>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/
>> current/additional/faq.html
>> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to akka-user+...@googlegroups.com.
>> To post to this group, send email to akka...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>  --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to