logo       

annotated blocks in Java method code: msg#00035

java.findbugs.general

Subject: annotated blocks in Java method code

Hi,

I'd like to toss some idea that will require heavy community support and in a long run can open some new possibilities to the FindBugs tool.

A while ago I've tried to suggest to allow to annotate code blocks in Java and preserve this into in the bytecode. [1]

The syntax in Java could be like this:

@SomeAnnotation(...) {...}

synchronized(...) @SomeAnnotation(...) {...}

for(...) @SomeAnnotation(...) {...}

if() @SomeAnnotation(...) {...}
else @AnotherAnnotation(...) {...}

try @SomeAnnotation(...) {
...
} catch() @AnotherAnnotation(...) {
...
}

This is easy to represent in the bytecode. More over similar construct is already used to specify scopes for the local variables.

Such constructs would make contract verification tools like JML [2] truly 1st class citizens on both, source and the bytecode level.

Does anyone else think, that something like that should be added to the Java language and the bytecode?

regards,
Eugene

[1] http://forums.java.net/jive/thread.jspa?threadID=988

[2] http://www.cs.iastate.edu/~leavens/JML/




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise