5

So compile-time annotation processing is as old as the annotations themselves in Java. Yet most of the useful libraries were developed with the runtime approach in mind – at least at first.

Now, however, I notice a recent rise in interest in the compile-time approach. Where until now we only had runtime annotation libraries like Spring, Guice, Dozer we now have compile-time equivalents: immutables, MapStruct, Dagger 2 any many more for some specific use-cases.

One reason may be that Spring and Dozer, e.g., started out with the XML approach, wherein parsing the XML data and then doing something with it is quite similar to reading the annotations metadata and then doing virtually the same.

But are there some other reasons, maybe? Did developers only recently notice the advantages of ensuring the application correctness at compile-time? Or maybe Java 8 made the compile-time annotation processing / code-generation somewhat easier?

Michal M
  • 159
  • 5
  • see [On discussions and why they don't make good questions](https://softwareengineering.meta.stackexchange.com/q/6742/31260) – gnat Jun 25 '18 at 07:38
  • maybe the way I asked the question makes it sound too biased, but what I ask for is not really a discussion – rather the reason for sudden appearance of said compile-time libraries, which is a fact I actually gave examples for; or is it the question summary? I'll try to to improve it – Michal M Jun 25 '18 at 07:39
  • It may just be my impression, but I think that for something so closely attached to the actual usage of the class, it makes no sense to have a completely separate configuration file for it as you'd have to constantly check back and forth. It makes sense to have all the information you require to know how it works in one place. – Neil Jun 25 '18 at 08:49
  • Please, could someone explain to me how this question is considered opinion-based? Is it the "only recently notice..." phrase? I am not saying there are no advantages to the runtime approach. I don't want to discuss if there are. I'd just like to know if there are any technical (or otherwise?) reasons for the recent sprout of compile-time annotation processing libraries. The sprout of whose is a fact. There were next to none before, now there are some. This is purely a question about facts. – Michal M Jun 25 '18 at 10:18
  • 1
    Some "related" questions that were not considered "opinion based": - _Are XML schemas bad..._ - _Is it viable to..._ - _Using a strong type system in the real world (...)?_ - _Is it a good practice to suppress warnings in your code?_ - _What is the best use of @Deprecated Java annotation (...)?_ How those are considered not _primarily opinion-based_ while mine is, is truly beyond me. – Michal M Jun 25 '18 at 10:23
  • Analyzing this a bit further: there is probably a room for an opinion if one was to decide what is the most important fact that made the sprout happen. This is not the question. I'd like to know of any possible facts that could have enabled this, not to put them on an opinion-based scale. I may realize this may be a weird *and* hard question, but surely it is not opinion based. This site may also not be good for such a question, but definitely not because it is opinion based. – Michal M Jun 25 '18 at 10:26
  • 1
    looking for stuff like _any possible facts_ wouldn't be a good fit over here I'm afraid, see [Why do 'some examples' and 'list of things' questions get closed?](https://softwareengineering.meta.stackexchange.com/a/7538/31260) – gnat Jun 25 '18 at 11:45
  • SO aka CO, invented to kill the inferior forums, but hey if you want to discuss some technical topics please use already-dead forums. I feel your pain Michal. – greenoldman Jun 26 '18 at 15:25

0 Answers0