atteo / classindex

Index classes, do not scan them!
Apache License 2.0
263 stars 42 forks source link

fix mistake in class name #73

Closed igor-makarov closed 1 year ago

igor-makarov commented 1 year ago

@sentinelt I'm very sorry, but I had the class name wrong!

sentinelt commented 1 year ago

@igor-makarov ok, this is also my bad, I usually never accept pull requests without proper automated tests

Would you be able to add minimal Gradle project to the example/ directory? This will allow to quickly check whether this and any future versions of ClassIndex work correctly with Gradle.

igor-makarov commented 1 year ago

@sentinelt please note I've made an additional change, since apparently having a broad * supported annotation type makes Gradle think that Lombok annotations may interfere with ClassIndex and Lombok annotations are source-retained, resulting in the following message:

Full recompilation is required because '@AllArgsConstructor' has source retention. Aggregating annotation processors require class or runtime retention.

As to having a sample Gradle project, I would love to, but I don't know how, really - my knowledge is more in the incremental build area, I've stumbled onto Gradle only circumstantially, working on a project I normally do not.

Is it possible that you add it?

igor-makarov commented 1 year ago

@sentinelt I'm sorry again, it appears that I'm in too deep into this incremental annotation processing thing.

Running ClassIndex incrementally with the annotation types constrained, it somehow makes the index be deleted. My guess is something in the runtime environment is different when running incrementally, but this is difficult for me to figure out because my familiarity with Java annotations is very little.

I'm very sorry, again, I think I need to close this. As it now stands, I don't know how to make ClassIndex support incremental Gradle builds.

igor-makarov commented 1 year ago

FYI There seems to be a good impl here but I've got limited comprehension of it.

sentinelt commented 1 year ago

I can try to analyze it, but I'm not a Gradle user. Would you be able to provide me a minimal example project using ClassIndex in Gradle and some instructions how to check whether incremental compilation works?

igor-makarov commented 1 year ago

@sentinelt I will try, though I'm not really a Gradle user myself 🙃

Seems like there are 2 interrelated problems:

  1. The wildcard * match on the annotation type causes the build system to match annotations that are incompatible with an aggregate processor type.
  2. Narrowing down the list to just the two annotations causes subsequent incremental builds to delete the index files. This might be related to one of the annotations being a meta-annotation (inheritance?).

There could be two solutions in theory:

  1. Figure out the incremental build troubles and the non-wildcard match (hard).
  2. Rewrite the index format to enable the processor to run in isolation (each input produces an independent output) this would avoid problem 1, I think.

I'll try to set up a test project but I'm having trouble linking everything up, and I don't even know how to debug a Gradle build step.

igor-makarov commented 1 year ago

@sentinelt opened https://github.com/atteo/classindex/issues/74