java

emccue 2022-01-26T20:29:18.556059Z

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

Ben Sless 2022-01-26T20:39:16.888959Z

What kind of annotation processing do you need?

Ben Sless 2022-01-26T20:39:32.242489Z

I wrote an annotation parser recently

emccue 2022-01-26T20:40:13.397849Z

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

emccue 2022-01-26T20:40:59.076019Z

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

emccue 2022-01-26T20:41:36.876209Z

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

emccue 2022-01-26T20:43:16.268339Z

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

emccue 2022-01-26T20:43:56.998429Z

but currently turns into

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

Ben Sless 2022-01-26T20:44:42.126649Z

Sorry, I messed with the parsing part, not generation

emccue 2022-01-26T20:30:17.817139Z

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

emccue 2022-01-26T20:30:19.319559Z

https://github.com/bowbahdoe/magic-bean

emccue 2022-01-26T20:31:09.325659Z

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 🤷

emccue 2022-01-26T20:33:36.194129Z

(seriously, education feels busted)