Skip to content

Fix TYPE_USE annotated dependencies #823

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

Merged
merged 5 commits into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions blackbox-test-inject/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-jsonb</artifactId>
<version>3.4</version>
<version>3.5</version>
</dependency>

<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-config</artifactId>
<version>4.0</version>
<version>4.1</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import java.util.List;

import org.jspecify.annotations.Nullable;

import io.avaje.inject.AssistFactory;
import io.avaje.inject.Assisted;
import io.avaje.lang.Nullable;
import jakarta.inject.Inject;
import jakarta.inject.Named;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import java.util.List;

import org.jspecify.annotations.Nullable;

import io.avaje.inject.AssistFactory;
import io.avaje.inject.Assisted;
import io.avaje.lang.Nullable;
import jakarta.inject.Named;

@Named("tomato")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.example.myapp.config;

import org.jspecify.annotations.Nullable;
import org.other.one.SomeOptionalDep;

import io.avaje.inject.Component;
import io.avaje.lang.Nullable;

@Component
public class SomeOptionalUser {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package org.example.myapp.config;

import io.avaje.inject.Component;
import io.avaje.lang.Nullable;

import java.util.Optional;

import org.other.one.SomeOptionalDep;

import io.avaje.inject.Component;

@Component
public class SomeOptionalUser2 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import java.util.concurrent.atomic.AtomicBoolean;

import org.jspecify.annotations.Nullable;

import io.avaje.inject.BeanScope;
import io.avaje.inject.Lazy;
import io.avaje.inject.PostConstruct;
import io.avaje.lang.Nullable;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.inject.Singleton;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import java.util.concurrent.atomic.AtomicBoolean;

import org.jspecify.annotations.Nullable;

import io.avaje.inject.Bean;
import io.avaje.inject.Factory;
import io.avaje.inject.Lazy;
import io.avaje.lang.Nullable;
import jakarta.inject.Named;

@Lazy
Expand Down
1 change: 1 addition & 0 deletions inject-aop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<version>11.6-RC1</version>
</parent>
<artifactId>avaje-inject-aop</artifactId>
<name>avaje inject aspect orient programming</name>
<dependencies>
<!-- test dependencies -->
<dependency>
Expand Down
20 changes: 10 additions & 10 deletions inject-generator/src/main/java/io/avaje/inject/generator/Util.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package io.avaje.inject.generator;

import static java.util.function.Predicate.not;
import static java.util.stream.Collectors.toList;

import java.util.List;
import java.util.Optional;
import java.util.regex.Pattern;
import java.util.stream.Stream;

import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
Expand All @@ -9,14 +17,6 @@
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;

import static java.util.function.Predicate.not;
import static java.util.stream.Collectors.toList;

import java.util.List;
import java.util.Optional;
import java.util.regex.Pattern;
import java.util.stream.Stream;

final class Util {
static final String ASPECT_PROVIDER_PREFIX = "io.avaje.inject.aop.AspectProvider<";
static final String PROVIDER_PREFIX = "jakarta.inject.Provider";
Expand Down Expand Up @@ -150,7 +150,7 @@ static String shortName(String fullType) {
char firstChar = part.charAt(0);
if (foundClass
|| Character.isUpperCase(firstChar)
|| (!Character.isAlphabetic(firstChar) && Character.isJavaIdentifierStart(firstChar))) {
|| !Character.isAlphabetic(firstChar) && Character.isJavaIdentifierStart(firstChar)) {
foundClass = true;
result += (result.isEmpty() ? "" : ".") + part;
}
Expand Down Expand Up @@ -223,7 +223,7 @@ static String extractMap(String rawType) {
}

static UtilType determineType(TypeMirror rawType, boolean beanMap) {
return UtilType.of(rawType.toString(), beanMap, rawType);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

problem was that we weren't sanitizing the type mirror to string

return UtilType.of(beanMap, rawType);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ private UtilType(Type type, String rawType, UType uType) {
this.uType = uType;
}

static UtilType of(String rawType, boolean beanMap, TypeMirror mirror) {
static UtilType of(boolean beanMap, TypeMirror mirror) {
var uType = UType.parse(mirror);
var rawType = uType.fullWithoutAnnotations().replace(" ", "");
if (rawType.startsWith("java.util.List<")) {
return new UtilType(Type.LIST, rawType, uType.param0());
} else if (rawType.startsWith("java.util.Set<")) {
Expand Down
1 change: 1 addition & 0 deletions inject-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<artifactId>avaje-inject-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>avaje inject maven plugin</name>

<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion inject-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-jsonb</artifactId>
<version>3.4</version>
<version>3.5</version>
<scope>test</scope>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion inject/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<dependency>
<groupId>io.avaje</groupId>
<artifactId>avaje-config</artifactId>
<version>4.0</version>
<version>4.1</version>
<optional>true</optional>
</dependency>

Expand Down