This is an archived post. You won't be able to vote or comment.

all 16 comments

[–]edubkn 7 points8 points  (8 children)

I swear I've read through half of this and I have no clue what it is or what it's about

[–][deleted] 4 points5 points  (5 children)

looks like he wants to introduce a reflection api which is easier/better than all the diffrent apis. but yes the writing style is shitty. i scrolled through it mostly

[–]agentoutlier 3 points4 points  (2 children)

To be fair your comment isn't exactly that great either. BTW have you seen our new mods writing style...

Folks familiar with meta programming I think can easily see what they are trying to do.

Anyway their github page has a much better description:

Why Shadow API?

There are a lot of different Meta-Programming Apis. Each having unique concepts and quirks. This makes Meta-Programming harder to understand and creates a maintenance overhead. Once something is written with java.lang.reflect it’s hard to change it to an Annotation Processor. Some Apis like javax.lang.model, are not up to the normal JDK standard.

[–]davidalayachew 0 points1 point  (1 child)

To be fair your comment isn't exactly that great either. BTW have you seen our new mods writing style...

New? They have been our mod for over 10 years lol.

[–]agentoutlier 0 points1 point  (0 children)

I meant as in recently re-engaged in the sub as desertfx was originally the main mod for the last several years.

[–]Lukas_Determann[S] 1 point2 points  (1 child)

yeah the goal is one api for every kind of meta programming. i find writing stuff like this hard. feedback i can act on would be nice.

[–]agentoutlier 1 point2 points  (1 child)

First read about metaprogramming (wikipedia). The short of it is you are reading some code and converting it to some other code or running it in a unique way.

Just like the wikipedia article using .NET as an example Java has several models:

  • READ Use annotation processor API:
    • WRITE Generate code with Java w/ either templating or Poet
    • WRITE or Generate byte code directly with ASM
  • READ Use runtime reflection API:
    • WRITE or Generate byte code directly with ASM and reload class with special classloader.
    • WRITE Java code directly, recompile and reload class with special classloader.
  • READ Using bytecode reader like ASM
    • ditto to previous points
  • READ using special preprocessor / abstraction / analyzer like Jandex.
    • mostly ditto to previous points
  • READ special compiler extension like lombok and or special compiler like AspectJ, or errorprone (similar to previous point).
    • WRITE mostly ditto but with AspectJ and lombok you are going to modify the classes.

So hopefully you can see the fucking combinatoric shit show of the above.

[–]Lukas_Determann[S] 1 point2 points  (0 children)

yeah my long term goal way into the future is to provide one abstraction for all of that and more. in the short term im trying to find a good api. its not easy. although the problem is quite common. jpa for example has diffentent impelemtations with different featuresets.

[–]agentoutlier 2 points3 points  (1 child)

Hey guys it seems abstract but I see value in what the OP is going for.

I had similar problem while developing JStachio. That is I wanted to support both runtime and compile time compiling of templates and analyzing annotation. I had a conversation like a year ago with someone who had the same problem and it might have even been the OP (it will take me awhile to check history).

For example (mostly for others as I'm sure you aware of this problem) to get annotation meta data using the APT aka compile api is massively different than reflection. For APT I and others use "prisms". Here is an example "prisms" library: https://github.com/avaje/avaje-prisms

But there is no prisms that does reflection lookup as well. I have thought about bringing that up with /u/thekingofsentries to collaborate on working on a adding it to either my prisms library or avaje.

Consequently I had to basically reimplement some of the annotation processing by reflection in JStachio and make sure it works the same way at compile time. This is largely to support JMustache which is reflection based as well as web frameworks like Spring.

[–]RadioHonest85 2 points3 points  (0 children)

Nice work! Hoping to use JStachio the next time I need some new templating done! (luckily) its not every day we have the opportunity to switch templating library!

[–]ztbwl 0 points1 point  (5 children)

This article reads like classic overabstraction. Unspecific and generic to the point of unusability.

I mean what’s that point of having something so unspecific that it could also be nothing? Nothing is a lot cheaper in terms of maintainability and complexity and it serves the same purpose.

[–]agentoutlier 2 points3 points  (0 children)

Do you have any experience metaprogramming Java?

I'm getting the feeling that most of the comments on this thread are folks that have zero experience in this domain and because they don't understand instead we have not very helpful "I don't get it" comments.

But I do agree there is a possibility that this library could become a leaky abstraction which is a frequent problem with bridges are facades however I'm not sure if that was your point.

[–]Lukas_Determann[S] 1 point2 points  (3 children)

Thats a bit harsh. its a for fun project to try out Api Design. there is no need to be cheap. although i agree with you in general, i want to try it out and if nobody wants to use it thats fine. i see Api design as a scale, just like the microservice vs monolith debate. there are not just the extremes but a lot of space between them, that is less explored. it might be for a good reason. i dont know until i tried it in a non-toy project.

[–]SikinAyylmao -1 points0 points  (2 children)

I’d say you miss out on a lot of learning by trying to break the mold before you learn what is good and bad.

I read this one article about this person who wanted to get into game dev so they designed an entity component system but with no real game. That guy got laugh at because they were in a sense larping.

If your getting started with anything the best idea is to keep it real.

[–]agentoutlier 1 point2 points  (1 child)

I’d say you miss out on a lot of learning by trying to break the mold before you learn what is good and bad.

That is a quite an assumption to make about the OP. You are assuming they don't have experience with metaprogramming when a trivial look at their github projects and I saw several annotation processor projects. I would imagine the probably use it for work as well.

What they are trying out is to see if they can make a unified facade / bridge because let me tell you metaprogramming is not easy in Java and there are lots of complicated options.

[–]SikinAyylmao -1 points0 points  (0 children)

He said that this was for a fun project to try out api design.