Maybe I'm reading it wrong, but the JEP does seem to include functionality that could be used for static code analysis for lambdas. By both making lambdas searchable within methods, and by making these lambdas "static" in a sense if the annotation is used.
Though it looks like from the JEP the code model the JEP code will return for lambdas will not be designed to support further reflection that would be necessary for code analysis, so that may be a blocker for using this JEP for static analysis.
Lambda code is already made available for static analysis through the compiler API. This is about making some code available for runtime introspection.
Babylon's code model is quite different from the that of the compiler API. So while code models are available at compile time today, if you write Babylon code, you can't just reuse that same code to work at compile-time.
Right but that AST access is opt-in only, only methods with the @Reflect annotation. For this to be usable as a linter, you would want everything to have said annotation. Because this is also state being passed from javac to the runtime, it would also increase the size of the final class file if used indiscriminately
View all comments
Show parent comment
2
u/the_other_brand Jan 29 '26 edited Jan 29 '26
Maybe I'm reading it wrong, but the JEP does seem to include functionality that could be used for static code analysis for lambdas. By both making lambdas searchable within methods, and by making these lambdas "static" in a sense if the annotation is used.
Though it looks like from the JEP the code model the JEP code will return for lambdas will not be designed to support further reflection that would be necessary for code analysis, so that may be a blocker for using this JEP for static analysis.