Skip to content

Commit 6ba90d2

Browse files
committed
1.3
1 parent ca8616f commit 6ba90d2

File tree

3 files changed

+18
-77
lines changed

3 files changed

+18
-77
lines changed

inject-generator/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<dependency>
2626
<groupId>io.avaje</groupId>
2727
<artifactId>avaje-prisms</artifactId>
28-
<version>1.1</version>
28+
<version>1.3</version>
2929
<optional>true</optional>
3030
<scope>provided</scope>
3131
</dependency>
@@ -55,7 +55,7 @@
5555
<path>
5656
<groupId>io.avaje</groupId>
5757
<artifactId>avaje-prisms</artifactId>
58-
<version>1.1</version>
58+
<version>1.3</version>
5959
</path>
6060
</annotationProcessorPaths>
6161
</configuration>

inject-generator/src/main/java/io/avaje/inject/generator/AspectAnnotationReader.java

Lines changed: 0 additions & 71 deletions
This file was deleted.

inject-generator/src/main/java/io/avaje/inject/generator/TypeExtendsInjection.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.avaje.inject.generator;
22

3+
import javax.lang.model.element.AnnotationMirror;
34
import javax.lang.model.element.Element;
45
import javax.lang.model.element.ExecutableElement;
56
import javax.lang.model.element.Modifier;
@@ -34,9 +35,7 @@ final class TypeExtendsInjection {
3435
this.baseType = baseType;
3536
this.context = context;
3637
this.factory = factory;
37-
38-
AspectAnnotationReader reader = new AspectAnnotationReader(context, baseType, baseType);
39-
this.typeAspects = reader.read();
38+
this.typeAspects = readAspects(baseType);
4039
}
4140

4241
void read(TypeElement type) {
@@ -55,6 +54,19 @@ void read(TypeElement type) {
5554
}
5655
}
5756

57+
/** Read the annotations on the type. */
58+
List<AspectPair> readAspects(Element element) {
59+
final List<AspectPair> aspects = new ArrayList<>();
60+
for (final AnnotationMirror annotationMirror : element.getAnnotationMirrors()) {
61+
final var anElement = annotationMirror.getAnnotationType().asElement();
62+
final var aspect = AspectPrism.getInstanceOn(anElement);
63+
if (aspect != null) {
64+
aspects.add(new AspectPair(anElement, aspect.ordering()));
65+
}
66+
}
67+
return aspects;
68+
}
69+
5870
private void readField(Element element) {
5971
InjectPrism inject = InjectPrism.getInstanceOn(element);
6072
if (inject != null) {
@@ -133,7 +145,7 @@ private void checkForAspect(ExecutableElement methodElement) {
133145
return;
134146
}
135147
int nameIndex = methodNameIndex(methodElement.getSimpleName().toString());
136-
List<AspectPair> aspectPairs = new AspectAnnotationReader(context, baseType, methodElement).read();
148+
List<AspectPair> aspectPairs = readAspects(methodElement);
137149
aspectPairs.addAll(typeAspects);
138150

139151
if (!aspectPairs.isEmpty()) {

0 commit comments

Comments
 (0)