-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArC generates a lot of AnnotationLiteral resources #525
Comments
This is an attempt to share literals per target package: But we should probably come up with something more efficient. |
The |
The problem with class loader is that we cannot share one annotation literal class for both an application consumer class and a framework consumer class. If I understand it correctly we use two class loaders because of the hot deployment feature (only app class loader is discarded if needed). |
We should be able to share them, it should just use the ClassLoader of whatever is defining the Annotation itself. |
I was curious if is necessary to generate an entire class per annotation instance? Wouldn't it be better to generate a single class per annotation with fields and equals/hashCode? |
@dmlloyd Yes, I'm just working on this. Basically we will generate something like this: public class ConfigProperty5_AnnotationLiteral extends AnnotationLiteral<ConfigProperty> implements ConfigProperty {
private final String name;
private final String defaultValue;
public ConfigProperty5_AnnotationLiteral(String name, String defaultValue) {
this.name = name;
this.defaultValue = defaultValue;
}
public String name() {
return name;
}
public String defaultValue() {
return defaultValue;
}
} And the "client side" will provide the values. The original approach was just simpler to implement ;-) |
Ah, great. A nice thing about the fields approach is that you have a 1:1 mapping of |
ArC needs to generate annotation literals for:
E.g. for the following injection point:
ArC generates the following class:
ArC can generate shared literals for an annotation type and values but this optimization must be disabled in shamrock because we have two classloaders there - one for app classes and one for framework classes.
We should try to improve this.
The text was updated successfully, but these errors were encountered: