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

Exception with jdk-11.0.1+13-openj9

mseele opened this issue · comments

Hi,
we get an exception when we use owner with openjdk11 and openj9 (https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=openj9):

Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
	at com.sun.proxy.$Proxy7.screenSize(Unknown Source)
	at Test.main(Test.java:13)
Caused by: java.lang.IllegalAccessException: org.aeonbits.owner.util.Java8SupportImpl could not access com.automation.remarks.video.recorder.VideoConfiguration - private access required
	at java.base/java.lang.invoke.MethodHandles$Lookup.checkSpecialAccess(MethodHandles.java:493)
	at java.base/java.lang.invoke.MethodHandles$Lookup.findSpecial(MethodHandles.java:517)
	at org.aeonbits.owner.util.Java8SupportImpl.invokeDefaultMethod(Java8SupportImpl.java:47)
	at org.aeonbits.owner.util.Reflection.invokeDefaultMethod(Reflection.java:68)
	at org.aeonbits.owner.PropertiesInvocationHandler.invoke(PropertiesInvocationHandler.java:61)
	... 2 more

Here is a snippet to reproduce the error:

import org.aeonbits.owner.ConfigFactory;

import com.automation.remarks.video.SystemUtils;
import com.automation.remarks.video.recorder.VideoConfiguration;

public class Test {

	public static void main(String[] args) {
		ConfigFactory.setProperty("os.type", SystemUtils.getOsType()); //$NON-NLS-1$
		VideoConfiguration videoConfiguration = ConfigFactory.create(VideoConfiguration.class, System.getProperties());
		System.err.println(videoConfiguration.screenSize());
	}

}

...and here is the maven dependencies to run this code:

	<dependencies>
		<dependency>
			<groupId>com.automation-remarks</groupId>
			<artifactId>video-recorder-core</artifactId>
			<version>1.8</version>
		</dependency>
		<dependency>
			<groupId>org.aeonbits.owner</groupId>
			<artifactId>owner</artifactId>
			<version>1.0.10</version>
		</dependency>
		<dependency>
			<groupId>org.aeonbits.owner</groupId>
			<artifactId>owner-java8</artifactId>
			<version>1.0.10</version>
		</dependency>
	</dependencies>

It work's well with openjdk-11 hotspot (https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=hotspot) and java 8.

@mseele Hi.

I think that the problem might be with the VideoConfiguration class declaration. Can you include in the bug the class declaration and the method screenSize() declaration?

@mseele That looks fine to me.

I need to check if there is some open bug on calling default methods on interfaces with openj9.
The code that does the invokation is located in module owner-java8, class Java8SupportImpl. It may be also an issue in openj9.

Issue is fixed with openj9 0.12.0

@mseele Thanks.