Skip to content

Commit 42d31a1

Browse files
committed
ArC: improve the invoker API
1 parent aa64bb2 commit 42d31a1

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InvocationTransformer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public String toString() {
2020
case EXCEPTION -> "exception transformer ";
2121
case WRAPPER -> "invocation wrapper ";
2222
};
23-
return kind + clazz.getName() + "#" + method;
23+
return kind + clazz.getName() + "." + method + "()";
2424
}
2525

2626
public boolean isInputTransformer() {

independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InvokerBuilder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@
110110
* <p>
111111
* For the purpose of the specification of transformers and wrappers below, the term
112112
* <em>any-type</em> is recursively defined as: the {@code java.lang.Object} class type,
113-
* or a type variable that has no bound, or a type variable whose first bound is
114-
* <em>any-type</em>.
113+
* or a type variable that has no bound, or a type variable whose first bound (including
114+
* an implicitly declared {@code java.lang.Object} bound in case all declared bounds are
115+
* interface types) is <em>any-type</em>.
115116
*
116117
* <h2>Input transformations</h2>
117118
*

independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InvokerInfo.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.quarkus.arc.processor;
22

3+
import java.lang.constant.ClassDesc;
34
import java.util.ArrayList;
45
import java.util.Arrays;
56
import java.util.List;
@@ -13,6 +14,7 @@
1314
* Opaque token that stands in for an invoker built using {@link InvokerBuilder}.
1415
*
1516
* @see #getClassName()
17+
* @see #getClassDesc()
1618
*/
1719
public class InvokerInfo implements InjectionTargetInfo {
1820
private final BeanDeployment beanDeployment;
@@ -94,7 +96,10 @@ private static String methodHash(InvokerBuilder builder) {
9496
/**
9597
* Returns the class name of the built invoker. It is guaranteed to have a {@code public}
9698
* zero-parameter constructor.
99+
*
100+
* @deprecated use {@link #getClassDesc()}
97101
*/
102+
@Deprecated(forRemoval = true, since = "3.30")
98103
public String getClassName() {
99104
if (lazyClassName != null) {
100105
return lazyClassName;
@@ -105,6 +110,14 @@ public String getClassName() {
105110
}
106111
}
107112

113+
/**
114+
* Returns the class of the built invoker. It is guaranteed to have a {@code public}
115+
* zero-parameter constructor.
116+
*/
117+
public ClassDesc getClassDesc() {
118+
return ClassDesc.of(getClassName());
119+
}
120+
108121
@Override
109122
public String toString() {
110123
return "invoker of " + targetBeanClass.name() + "#" + method.name();

independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/SyntheticComponentsUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,11 @@ static void addParamsFieldAndInit_2(io.quarkus.gizmo2.creator.ClassCreator cc, B
352352
bc.set(value.elem(i), annotationLiterals.create(bc, annotationClass, annotationInstance));
353353
}
354354
} else if (entry.getValue() instanceof InvokerInfo val) {
355-
value = bc.localVar("value", bc.new_(ClassDesc.of(val.getClassName())));
355+
value = bc.localVar("value", bc.new_(val.getClassDesc()));
356356
} else if (entry.getValue() instanceof InvokerInfo[] array) {
357357
value = bc.localVar("value", bc.newEmptyArray(Invoker.class, array.length));
358358
for (int i = 0; i < array.length; i++) {
359-
bc.set(value.elem(i), bc.new_(ClassDesc.of(array[i].getClassName())));
359+
bc.set(value.elem(i), bc.new_(array[i].getClassDesc()));
360360
}
361361
} else {
362362
throw new IllegalArgumentException("Unsupported parameter type: " + entry.getValue());

0 commit comments

Comments
 (0)