cast at call site problem (original) (raw)
Anna Kozlova Anna.Kozlova at jetbrains.com
Mon Apr 1 07:59:52 PDT 2013
- Previous message: cast at call site problem
- Next message: cast at call site problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The call foo(Collections.emptySet()); is much more clean I suppose. I just wonder why the redundant cast leads to compilation error.
Thanks
From: paulus.benedictus at gmail.com [mailto:paulus.benedictus at gmail.com] On Behalf Of Paul Benedict Sent: Monday, April 01, 2013 4:51 PM To: Anna Kozlova Cc: lambda-dev at openjdk.java.net Subject: Re: cast at call site problem
I believe you want to write this: foo(Collections.emptySet());
On Mon, Apr 1, 2013 at 9:48 AM, Anna Kozlova <Anna.Kozlova at jetbrains.com> wrote:
Hello all,
Is it a bug or is it an intentional behavior: This code compiles {code} void foo(Set s) {}
void bar() {
foo(Collections.emptySet());
}
{code}
but this code doesn't: {code} void foo(Set s) {}
void bar() {
foo((Set<String>)Collections.emptySet());
}
{code}
Lambda build 83.
Thanks Anna
!DSPAM:35,51599ede145491173217933!
- Previous message: cast at call site problem
- Next message: cast at call site problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]