Fork me on GitHub
#java
<
2022-01-26
>
emccue20:01:18

Working through the nonsense above i made an example annotation processor to use as a demo

Ben Sless20:01:16

What kind of annotation processing do you need?

Ben Sless20:01:32

I wrote an annotation parser recently

emccue20:01:13

i didn’t need any - i just wanted to have an example project that compiled and packaged one up right

emccue20:01:59

still a long way out from that - this is just the one i wrote for that purpose

emccue20:01:36

but I do need help if you know how to properly carry over annotations in generated code, just to make that library workable

emccue20:01:16

the most basic one is TYPE_USE annotations like

@Target(TYPE_USE)
@interface ABC {}

class Ex {
    @ABC List<@ABC String> fieldName;
}
Which needs to turn in to
java.util.@ABC List<java.lang.@ABC String>
In my generated code

emccue20:01:56

but currently turns into

@ABC java.util.List<@ABC java.lang.String>
Which is wrong and doesnt compile

Ben Sless20:01:42

Sorry, I messed with the parsing part, not generation

emccue20:01:17

but i turns out something is broken in the universe and there weren’t like a million hello world annotation processors like this

emccue20:01:09

so there you go i guess. if anyone is using hibernate/jpa or whatever xml library that requires classes like this and doesn’t want to depend on lombok 🤷

emccue20:01:36

(seriously, education feels busted)