eclipse-archived/ceylon

Importing javax.javaeeapi inside imported module causes late value to return null

Opened this issue · 0 comments

As the title says, importing javax.javaeeapi inside imported module causes late value to return null. From the follwing case you can actually see the anonymous method isn't even called and if you remove the javax.javaeeapi import it works again printing the value.

Test project:

  • module.ceylon:
native("jvm")
module test "1.0.0" {
	import javax.javaeeapi "7.0";
	shared import java.desktop "8";
}
  • LateValue.ceylon:
shared final class LateValue<Type>(Type construct()) {
	shared late Type val = (() {
		print("about to retrieve value from generator");
		value result = construct();
		print("returning value = '``result else "null"``' from generator");
		return result;
	})();
}

Test2 project:

  • module.ceylon:
native("jvm")
module test2 "1.0.0" {
	shared import test "1.0.0";
}
  • run.ceylon:
import javax.swing {
	JFrame
}
import test {
	LateValue
}
JFrame f() => JFrame();
shared void run() {
	value lv = LateValue(`function f`.apply<JFrame, []>());
	print("value = '``lv.val else "null"``'");
}

This is what get printed:

value = 'null'

and removing the javax.javaeeapi import:

about to retrieve value from generator
returning value = 'javax.swing.JFrame[frame0,0,0,0x0,invalid,hidden,layout=java.awt.BorderLayout,title=,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,0,0,0x0,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]' from generator
value = 'javax.swing.JFrame[frame0,0,0,0x0,invalid,hidden,layout=java.awt.BorderLayout,title=,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,0,0,0x0,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]'