From a1801ee3fedb84b52bd9b41e720c25b4b629a5b0 Mon Sep 17 00:00:00 2001 From: Ladislav Thon Date: Wed, 3 Jan 2024 11:49:45 +0100 Subject: [PATCH] ArC: improve description of injection points that are parameters The improvement is twofold: - it highlights that the injection point is a parameter by putting the parameter name at the beginning instead of the end; - it uses the word "constructor" explicitly in case the parameter belongs to a constructor. --- .../java/io/quarkus/arc/processor/InjectionPointInfo.java | 6 +++--- .../illegal/TypeVariableInitializerInjectionPointTest.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java index 3174b2976989fd..e79adfdaa8da4d 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java @@ -292,11 +292,11 @@ public String getTargetInfo() { } String method = target.asMethod().name(); if (method.equals(Methods.INIT)) { - method = ""; + method = " constructor"; } else { - method = "#" + method; + method = "#" + method + "()"; } - return target.asMethod().declaringClass().name() + method + "()" + ":" + param; + return "parameter '" + param + "' of " + target.asMethod().declaringClass().name() + method; default: return target.toString(); } diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/illegal/TypeVariableInitializerInjectionPointTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/illegal/TypeVariableInitializerInjectionPointTest.java index a82cd637dce020..76224e6c4b102a 100644 --- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/illegal/TypeVariableInitializerInjectionPointTest.java +++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/illegal/TypeVariableInitializerInjectionPointTest.java @@ -24,7 +24,7 @@ public void testError() { assertNotNull(failure); assertTrue(failure instanceof DefinitionException); assertEquals( - "Type variable is not a legal injection point type: io.quarkus.arc.test.injection.illegal.TypeVariableInitializerInjectionPointTest$Head#setIt():it", + "Type variable is not a legal injection point type: parameter 'it' of io.quarkus.arc.test.injection.illegal.TypeVariableInitializerInjectionPointTest$Head#setIt()", failure.getMessage()); }