Repository: quarkusio/quarkus
Issue: Arc Ignoring injected field

### Describe the bug

When building the project we get the following warning:

```java
[io.qua.arc.pro.Injection] (build-56) An injection field must be non-static and non-final - ignoring
```

with the given class

```java
package //s.service;

package // omitted

import java.time.LocalDate;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.inject.Named;
import javax.ws.rs.BadRequestException;
import //.GlobalConstants;
import //.KeycloackService;
import //r.BasicUserWithHistoriesDto;
import //.UserHistory;
import //.HistoryRepository;
import //.HistoryUpdateHandler;
import //.HttpCacheHandler;

@ApplicationScoped
@RequiredArgsConstructor(onConstructor = @__(@Inject))
@Slf4j
public class HistoryService {

    private final KeycloackService keycloackService;
    private final HistoryRepository historyRepository;

    @Named(GlobalConstants.POST_HISTORY_HANDLERS_NAME)
    private final List<HistoryUpdateHandler> historyHooks;

    private final HttpCacheHandler<Collection<BasicUserWithHistoriesDto>, Long> userHistoriesCache;


  // rest of the code omitted

}
```


and the given lombok conf


```
config.stopBubbling = true

lombok.addLombokGeneratedAnnotation = true

lombok.copyableAnnotations += javax.inject.Named

```

producing the given source:


```java
// Generated by delombok at Tue Aug 09 11:28:41 CEST 2022
package // omitted

import java.time.LocalDate;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.inject.Named;
import javax.ws.rs.BadRequestException;
import //.GlobalConstants;
import //.KeycloackService;
import //r.BasicUserWithHistoriesDto;
import //.UserHistory;
import //.HistoryRepository;
import //.HistoryUpdateHandler;
import //.HttpCacheHandler;

@ApplicationScoped
public class HistoryService {
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(HistoryService.class);
    private final KeycloackService keycloackService;
    private final HistoryRepository historyRepository;
    @Named(GlobalConstants.POST_HISTORY_HANDLERS_NAME)
    private final List<HistoryUpdateHandler> historyHooks;
    private final HttpCacheHandler<Collection<BasicUserWithHistoriesDto>, Long> userHistoriesCache;

   // rest of the code omitted
    @Inject
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public HistoryService(final KeycloackService keycloackService, final HistoryRepository historyRepository, @Named(GlobalConstants.POST_HISTORY_HANDLERS_NAME) final List<HistoryUpdateHandler> historyHooks, final HttpCacheHandler<Collection<BasicUserWithHistoriesDto>, Long> userHistoriesCache) {
        this.keycloackService = keycloackService;
        this.historyRepository = historyRepository;
        this.historyHooks = historyHooks;
        this.userHistoriesCache = userHistoriesCache;
    }
}

```

### Expected behavior

No warning as we use the constructor to inject the value in the field and not `@Inject`

### Actual behavior

We get the warning

[io.qua.arc.pro.Injection] (build-56) An injection field must be non-static and non-final - ignoring

### How to Reproduce?

1. Use Quarkus 2.11.2.Final
2. Use Lombok with the given configuration
3. Build the project

### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

11

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.11.2.Final

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

maven

### Additional information

_No response_

Changed files:
extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcConfig.java
extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AutoInjectFieldProcessor.java
extensions/arc/deployment/src/test/java/io/quarkus/arc/test/autoinject/AutoFieldInjectionTest.java

diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcConfig.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcConfig.java
index ffaa6bca3f6..35159793b75 100644
--- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcConfig.java
+++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcConfig.java
@@ -48,7 +48,7 @@ public class ArcConfig {
     public String removeUnusedBeans;
 
     /**
-     * If set to true {@code @Inject} is automatically added to all non-static fields that are annotated with
+     * If set to true {@code @Inject} is automatically added to all non-static non-final fields that are annotated with
      * one of the annotations defined by {@link AutoInjectAnnotationBuildItem}.
      */
     @ConfigItem(defaultValue = "true")
diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AutoInjectFieldProcessor.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AutoInjectFieldProcessor.java
index 861dd020650..2da0e5b6d9c 100644
--- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AutoInjectFieldProcessor.java
+++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AutoInjectFieldProcessor.java
@@ -11,6 +11,7 @@
 import org.jboss.jandex.AnnotationInstance;
 import org.jboss.jandex.AnnotationTarget;
 import org.jboss.jandex.DotName;
+import org.jboss.jandex.FieldInfo;
 import org.jboss.logging.Logger;
 
 import io.quarkus.arc.processor.AnnotationsTransformer;
@@ -69,7 +70,10 @@ public int getPriority() {
             @Override
             public void transform(TransformationContext ctx) {
                 Collection<AnnotationInstance> fieldAnnotations = ctx.getAnnotations();
-                if (Modifier.isStatic(ctx.getTarget().asField().flags()) || contains(fieldAnnotations, DotNames.INJECT)
+                FieldInfo field = ctx.getTarget().asField();
+                if (Modifier.isStatic(field.flags())
+                        || Modifier.isFinal(field.flags())
+                        || contains(fieldAnnotations, DotNames.INJECT)
                         || contains(fieldAnnotations, DotNames.PRODUCES)) {
                     return;
                 }
diff --git a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/autoinject/AutoFieldInjectionTest.java b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/autoinject/AutoFieldInjectionTest.java
index 69333fcd13e..96b10acffdb 100644
--- a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/autoinject/AutoFieldInjectionTest.java
+++ b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/autoinject/AutoFieldInjectionTest.java
@@ -6,6 +6,7 @@
 import static java.lang.annotation.ElementType.TYPE;
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
 
 import java.lang.annotation.Inherited;
 import java.lang.annotation.Retention;
@@ -35,11 +36,17 @@ public class AutoFieldInjectionTest {
     public void testInjectionWorks() {
         assertEquals("ok", bean.foo);
         assertEquals(1l, bean.bar);
+        assertNull(Client.staticFoo);
+        assertNull(bean.baz);
     }
 
     @Dependent
     static class Client {
 
+        // @Inject should not be added here
+        @MyQualifier
+        static String staticFoo;
+
         // @Inject is added automatically
         @MyQualifier
         String foo;
@@ -47,6 +54,14 @@ static class Client {
         @MyQualifier
         Long bar;
 
+        // @Inject should not be added here
+        @MyQualifier
+        final Long baz;
+
+        Client() {
+            this.baz = null;
+        }
+
     }
 
     static class Producer {