matteobaccan / owner

Get rid of the boilerplate code in properties based configuration.

Home Page:https://matteobaccan.github.io/owner/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incompatibility between @Spy annotation and java.util.Properties in OpenJDK17

pgrt opened this issue · comments

commented

Hello,

I am the Debian maintainer of owner. In Debian unstable with OpenJDK 17.0.5 and mockito 2.23.0, I get

[ERROR] testListPrintStream(org.aeonbits.owner.PropertiesInvocationHandlerTest) Time elapsed: 0.542 s <<< ERROR!
java.lang.NullPointerException: Cannot invoke "java.util.concurrent.ConcurrentHashMap.putAll(java.util.Map)" because "this.map" is null
at org.aeonbits.owner.PropertiesInvocationHandlerTest.before(PropertiesInvocationHandlerTest.java:46)

[ERROR] testListPrintWriter(org.aeonbits.owner.PropertiesInvocationHandlerTest) Time elapsed: 0.002 s <<< ERROR!
java.lang.NullPointerException: Cannot invoke "java.util.concurrent.ConcurrentHashMap.putAll(java.util.Map)" because "this.map" is null
at org.aeonbits.owner.PropertiesInvocationHandlerTest.before(PropertiesInvocationHandlerTest.java:46)

Interestingly, it seems there is an issue with properties in the before method being declared with the @SPY annotation. Indeed, changing slightly the test file to the enclosed one (see lines 31, 32, 46, 47) causes an error on line 46 but not on line 47.
PropertiesInvocationHandlerTest.java.txt

Honestly I cannot explain what causes this, but if you can then I am interested in knowing.

Bye,
Pierre