In the process of writing a Java program doing a lot of logging using java.util.logging (keeping it simple) I was wondering if I could generate the (MyJavaFile.java:123)
bit with the java annotation processor at compile time creating static strings containing this information to be used for logging. I am not interested in throwing and investigating an exception at runtime.
I would therefore like to be able to get the line number for an Element found by the annotation processor code eventually written by me to do this (generate a class with string constants including method+line number) but was not able to identify the proper way to do this.
How should "get line number for current source" be done when processing annotations?