The only way I'm aware of ispublic static int lineNumber() {
int line = 0;
try {
throw new RuntimeException();
} catch (RuntimeException re) {
lineNumber = re.getStackTrace()[1].getLineNumber();
}
return line;
}
And you need 1.4 for this to work...
It's probably easier to write your own macro expansion preprocessor.
I think you could do it with a one-liner in perl, something like:
perl -pe 's/#LINE#/$./;' MyProg.jv > MyProg.java
I don't suppose the new annotation feature helps out at all? It seems strange that something this commonly needed is so awkward to do.