Allows the semantics of Java annotations to place them somewhere inside the body of functions , for example. annotate a specific function call, statement, or expression?
For instance:
class MyClass { void theFunc(Thing thing) { String s = null; @Catching(NullPointerException)
Shorten the often written (too often, definitely!):
class MyClass { void theFunc(Thing thing) { String s = null; try { s = thing.getProp().getSub().getElem().getItem(); } catch(NullPointerException ex) { } if(s==null) System.out.println("null, you fool"); } }
If the concept of this inline annotation is even possible? Or something similar?
source share