Compiling call to 'for' method can fail
Mark Mahieu
mark at twistedbanana.demon.co.uk
Wed Jun 25 02:07:35 PDT 2008
I guess this is likely to be a known 'to do' item, but just in case
it isn't...
It seems that compiling a call to a method declared with the 'for'
modifier only succeeds if that method is being compiled at the same
time. For example, given these two source files:
// foo/ForCaller.java
package foo;
import static foo.ForEver.*;
class ForCaller {
public static void main(String[] args) {
for ever() {}
}
}
// foo/ForEver.java
package foo;
class ForEver {
static for void ever({==>void} block) {}
}
Then this succeeds:
$ rm foo/*.class
$ $BGGA_HOME/bin/javac foo/ForCaller.java
$
But this doesn't:
$ rm foo/*.class
$ $BGGA_HOME/bin/javac foo/ForEver.java
$ $BGGA_HOME/bin/javac foo/ForCaller.java
foo/ForCaller.java:7: for may only be used on an invocation if the
method was declared with the 'for' modifier
for ever() {}
^
1 error
$
Regards,
Mark
More information about the closures-dev
mailing list