question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ARC interferes with Smallrye ConfigProducer

See original GitHub issue

Describe the bug

Language: Kotlin

I want to inject a config property of a list of custom types:

@Provider
class TestClass {
    @ConfigProperty(name = "property.list")
    private lateinit var typeList: List<MyType>

    @ConfigProperty(name = "property.single")
    private lateinit var singleType: MyType
}

While Smallrye can resolve and fill singleType, it fails on the list. The cause in the stack trace is:

Caused by: java.lang.IllegalArgumentException: SRCFG02005: Type has no raw type class: io.quarkus.arc.impl.WildcardTypeImpl@2d198533
	at io.smallrye.config.inject.ConfigProducerUtil.rawTypeOf(ConfigProducerUtil.java:224)
	at io.smallrye.config.inject.ConfigProducerUtil.resolveConverter(ConfigProducerUtil.java:155)
	at io.smallrye.config.inject.ConfigProducerUtil.resolveConverter(ConfigProducerUtil.java:149)
	at io.smallrye.config.inject.ConfigProducerUtil.resolveConverter(ConfigProducerUtil.java:160)
	at io.smallrye.config.inject.ConfigProducerUtil.resolveConverter(ConfigProducerUtil.java:149)
	at io.smallrye.config.inject.ConfigProducerUtil.convertValues(ConfigProducerUtil.java:106)
	at io.smallrye.config.inject.ConfigProducerUtil.getValue(ConfigProducerUtil.java:76)
	at io.smallrye.config.inject.ConfigProducerUtil.getValue(ConfigProducerUtil.java:58)
	at io.smallrye.config.inject.ConfigProducer.producesListConfigProperty(ConfigProducer.java:136)
	at io.smallrye.config.inject.ConfigProducer_ProducerMethod_producesListConfigProperty_1258131a638f518025054697883e1874162124ce_Bean.create(Unknown Source)
	at io.smallrye.config.inject.ConfigProducer_ProducerMethod_producesListConfigProperty_1258131a638f518025054697883e1874162124ce_Bean.get(Unknown Source)
	at io.smallrye.config.inject.ConfigProducer_ProducerMethod_producesListConfigProperty_1258131a638f518025054697883e1874162124ce_Bean.get(Unknown Source)
	at io.quarkus.arc.impl.CurrentInjectionPointProvider.get(CurrentInjectionPointProvider.java:60)
	... 89 more

From what I see, WildcardTypeImpl provides java.util.List as rawType - should it provide the upper bound of actualTypeArgument?

I tried mitigating it by providing an explizit Converter for List<MyType> but the result is the same.

Screenshot 2022-09-30 at 07 42 58

Expected behavior

Config Converter for generic type of List<T> is used.

Actual behavior

Exception and quarkus fails to start.

java.lang.RuntimeException: java.lang.ExceptionInInitializerError

Caused by: java.lang.ExceptionInInitializerError

Caused by: java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.runner.ApplicationImpl.<clinit>(Unknown Source)
	... 48 more
Caused by: java.lang.RuntimeException: Error injecting java.util.List<? extends de.test.MyType> de.test.TestClass. typeList
Caused by: java.lang.IllegalArgumentException: SRCFG02005: Type has no raw type class: io.quarkus.arc.impl.WildcardTypeImpl@2d198533
	at io.smallrye.config.inject.ConfigProducerUtil.rawTypeOf(ConfigProducerUtil.java:224)
	at io.smallrye.config.inject.ConfigProducerUtil.resolveConverter(ConfigProducerUtil.java:155)
	at io.smallrye.config.inject.ConfigProducerUtil.resolveConverter(ConfigProducerUtil.java:149)
	at io.smallrye.config.inject.ConfigProducerUtil.resolveConverter(ConfigProducerUtil.java:160)
	at io.smallrye.config.inject.ConfigProducerUtil.resolveConverter(ConfigProducerUtil.java:149)
	at io.smallrye.config.inject.ConfigProducerUtil.convertValues(ConfigProducerUtil.java:106)
	at io.smallrye.config.inject.ConfigProducerUtil.getValue(ConfigProducerUtil.java:76)
	at io.smallrye.config.inject.ConfigProducerUtil.getValue(ConfigProducerUtil.java:58)
	at io.smallrye.config.inject.ConfigProducer.producesListConfigProperty(ConfigProducer.java:136)
	at io.smallrye.config.inject.ConfigProducer_ProducerMethod_producesListConfigProperty_1258131a638f518025054697883e1874162124ce_Bean.create(Unknown Source)
	at io.smallrye.config.inject.ConfigProducer_ProducerMethod_producesListConfigProperty_1258131a638f518025054697883e1874162124ce_Bean.get(Unknown Source)
	at io.smallrye.config.inject.ConfigProducer_ProducerMethod_producesListConfigProperty_1258131a638f518025054697883e1874162124ce_Bean.get(Unknown Source)
	at io.quarkus.arc.impl.CurrentInjectionPointProvider.get(CurrentInjectionPointProvider.java:60)
	... 89 more


How to Reproduce?

  1. Create custom type
  2. Create Type Converter and add is to org.eclipse.microprofile.config.spi.Converter
  3. Create Bean using this type as generic parameter of a list
  4. Start Quarkus (or a QuarkusTest)

Output of uname -a or ver

Darwin mymac.local 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:25:27 PDT 2022; root:xnu-8020.141.5~2/RELEASE_X86_64 x86_64

Output of java -version

openjdk version “11.0.16” 2022-07-19 OpenJDK Runtime Environment Temurin-11.0.16+8 (build 11.0.16+8) OpenJDK 64-Bit Server VM Temurin-11.0.16+8 (build 11.0.16+8, mixed mode)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.12.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)

Additional information

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Ladicekcommented, Sep 30, 2022

I think it would make sense for SmallRye Config’s ConfigProducerUtil.rawTypeOf() to consider an upper bound of a wildcard type as its “raw” type.

0reactions
radcortezcommented, Sep 30, 2022

I’ll have a look.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Package io.quarkus.arc.runtime - javadoc.io
This class is the same as io.smallrye.config.inject.ConfigProducer but uses the proper Quarkus way of obtaining org.eclipse.microprofile.config.Config ...
Read more >
Showing posts for tag "java" - frostillic.us
When compiling remotely, the local Maven plugin ZIPs up the ODP and related support files (OSGi sites, etc.) for transfer to the server,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found