Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
yupp. Basically, you write code that will be run by the compiler to generate java code moments before the actual compilation.
The problem is, that Java's MirrorAPI is a PITA to work with 😅 And long outdated (~java5) docs don't make it any easier.
e.g. There are several ways to reference a type/class (4 or 5?) and they all have different properties and can be obtained through different builders/factories/other sources. And some of them one piece of data and the others have some other data and it's quite a pain to orchestrate them all in a single annotation processor :) -
@netikras Oh boy, I just learned about it's existence and have to use it for a uni assignment so sounds like I'm in for a world of fun 🙃
-
@12bitfloat at keast you know now it won't be a breeze and can plan your time ahead. Also, you have a good hint that took me a while to dig up - the keyword 'Mirror API' :)
-
Btw another cool thing Java can do is javaagent :) not related to the annot. processor, but related to 'cool things java can do' ;)
it's a security risk if mishandled, but also hell of a feature for an sre/middleware/perf team -
@netikras Java agent I already knew about, and it's actually even cooler IMO :D
Minecraft core modding for dayys
Related Rants
TIL vanilla Java has the facilities to do (some form) of arbitrary compile time metaprogramming via annotation processors
rant
java
til