-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- type variable is not a legal injection point type - also validate type params of types related to programmatic lookup, i.e. Instance<> and List<> with All qualifier
- Loading branch information
Showing
11 changed files
with
443 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...ons/arc/deployment/src/test/java/io/quarkus/arc/test/lookup/ListInvalidTypeParamTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package io.quarkus.arc.test.lookup; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import javax.enterprise.inject.spi.DeploymentException; | ||
import javax.inject.Inject; | ||
import javax.inject.Singleton; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.arc.All; | ||
import io.quarkus.runtime.util.ExceptionUtil; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class ListInvalidTypeParamTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot(root -> root.addClasses(Foo.class)).assertException(t -> { | ||
Throwable rootCause = ExceptionUtil.getRootCause(t); | ||
assertTrue(rootCause instanceof DeploymentException); | ||
String suppressedMessage = Arrays.stream(rootCause.getSuppressed()).map(Throwable::getMessage) | ||
.collect(Collectors.joining("::")); | ||
assertTrue(suppressedMessage.contains("Type variable is not a legal type parameter"), rootCause.toString()); | ||
assertTrue(suppressedMessage.contains("Wildcard is not a legal type parameter"), rootCause.toString()); | ||
}); | ||
|
||
@Test | ||
public void testFailure() { | ||
fail(); | ||
} | ||
|
||
@Singleton | ||
static class Foo<T> { | ||
|
||
@Inject | ||
@All | ||
List<T> services; | ||
|
||
@All | ||
List<?> counters; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.