Sneaky abuse of labels, eh?
I've had crazier ideas. Big problem with that is that you can use any
given label only once in any given method. That's a pretty big
negative to that plan.
Parser hack to allow annotating lone code blocks is probably the
easiest way out of the dilemma. It's not a big dilemma though -
remember, that field that lombok makes is accessible to you, so you
can write:
public void foo() {
synchronized ($lock) {
//whatever
}
//code outside of the lock
}
as long as you have one @Synchronized in there, '$lock' will exist.
On Sep 8, 11:04 pm, John Nilsson <[email protected]> wrote:
> On Mon, Sep 7, 2009 at 1:08 PM, Fabrizio
>
> Giudici<[email protected]> wrote:
>
> > I was looking at the @Synchronized annotation of Lombok - I've already
> > said many times that I like the annotation way to enhance the language,
> > so that's good. There's only an obvious problem, that we can't annotate
> > a inner block of code, a thing that would be indeed possible with the
> > synchronized keyword.
>
> OTOH with Lombok I guess named blocks would be enough, no?
>
> Synchronized: {
> //do shit...
>
> }
>
> I can live without the @ ;-)
>
> BR,
> John
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---