#1271 Java FFI mixin routers with primitives

DanielFath Thu 28 Oct 2010

Anyway here is the thing. I have a class MigPane : Pane once I change it to MigPane : Pane, MigContainer (MigContainer is a mixin that extends MigComponent and implements ComponentWrapper from Java FFI) I get below exception. I thought FFI could extend/implement interface regardless the level.

java.lang.NullPointerException
  at fan.sys.Type.podName(Type.java:53)
  at fanx.util.FanUtil.toJavaTypeSig(FanUtil.java:326)
  at fanx.util.FanUtil.toJavaMemberSig(FanUtil.java:335)
  at fanx.emit.FMethodEmit.signature(FMethodEmit.java:441)
  at fanx.emit.FMethodEmit.emitMixinRouter(FMethodEmit.java:300)
  at fanx.emit.FTypeEmit.emitMixinRouters(FTypeEmit.java:332)
  at fanx.emit.FTypeEmit.emitMixinRouters(FTypeEmit.java:300)
  at fanx.emit.FTypeEmit.emit(FTypeEmit.java:89)
  at fanx.emit.FTypeEmit.emit(FTypeEmit.java:57)
  at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:215)
  at fan.sys.ClassType.emit(ClassType.java:466)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.mig.Main.main(Main.fan:29)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)	
  at java.lang.reflect.Method.invoke(Unknown Source)
  at fan.sys.Method.invoke(Method.java:536)
  at fan.sys.Method$MethodFunc.callList(Method.java:182)
  at fan.sys.Method.callList(Method.java:147)
  at fanx.tools.Fan.callMain(Fan.java:135)
  at fanx.tools.Fan.executeType(Fan.java:102)
  at fanx.tools.Fan.execute(Fan.java:38)
  at fanx.tools.Fan.run(Fan.java:236)
  at fanx.tools.Fan.main(Fan.java:274)
java.lang.RuntimeException: java.lang.NullPointerException
  at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:227)
  at fan.sys.ClassType.emit(ClassType.java:466)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.mig.Main.main(Main.fan:29)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at fan.sys.Method.invoke(Method.java:536)
  at fan.sys.Method$MethodFunc.callList(Method.java:182)
  at fan.sys.Method.callList(Method.java:147)
  at fanx.tools.Fan.callMain(Fan.java:135)
  at fanx.tools.Fan.executeType(Fan.java:102)
  at fanx.tools.Fan.execute(Fan.java:38)
  at fanx.tools.Fan.run(Fan.java:236)
  at fanx.tools.Fan.main(Fan.java:274)
sys::Err: Cannot emit: mig::MigPane
  fan.sys.ClassType.emit (ClassType.java:474)
  fan.sys.FanClassLoader.findFanClass (FanClassLoader.java:164)
  fan.sys.FanClassLoader.findClass (FanClassLoader.java:92)
  java.lang.ClassLoader.loadClass (Unknown)
  java.lang.ClassLoader.loadClass (Unknown)
  mig::Main.main (Main.fan:29)
  java.lang.reflect.Method.invoke (Unknown)
  fan.sys.Method.invoke (Method.java:536)
  fan.sys.Method$MethodFunc.callList (Method.java:182)
  fan.sys.Method.callList (Method.java:147)
  fanx.tools.Fan.callMain (Fan.java:135)
  fanx.tools.Fan.executeType (Fan.java:102)
  fanx.tools.Fan.execute (Fan.java:38)
  fanx.tools.Fan.run (Fan.java:236)
  fanx.tools.Fan.main (Fan.java:274)
Cause:
  sys::Err: java.lang.RuntimeException: java.lang.NullPointerException
    fan.sys.BootEnv.loadTypeClasses (BootEnv.java:227)
    fan.sys.ClassType.emit (ClassType.java:466)
    fan.sys.FanClassLoader.findFanClass (FanClassLoader.java:164)
    fan.sys.FanClassLoader.findClass (FanClassLoader.java:92)
    java.lang.ClassLoader.loadClass (Unknown)
    java.lang.ClassLoader.loadClass (Unknown)
    mig::Main.main (Main.fan:29)
    java.lang.reflect.Method.invoke (Unknown)
    fan.sys.Method.invoke (Method.java:536)
    fan.sys.Method$MethodFunc.callList (Method.java:182)
    fan.sys.Method.callList (Method.java:147)
    fanx.tools.Fan.callMain (Fan.java:135)
    fanx.tools.Fan.executeType (Fan.java:102)
    fanx.tools.Fan.execute (Fan.java:38)
    fanx.tools.Fan.run (Fan.java:236)
    fanx.tools.Fan.main (Fan.java:274)

brian Thu 28 Oct 2010

Try this patch and see if that fixes your problem

DanielFath Thu 28 Oct 2010

Thanks for a quick patch brian. Will try to see if that work as soon as I get home.

DanielFath Fri 29 Oct 2010

Hmm that didn't do the trick. Here is a brief structure of my classes

class  MigPane : Pane, MigContainer
class  PaneWrapper : MigContainer
class  WidgetWrapper : MigComponent
mixin MigContainer : MigComponent, [FFI]ContainerWrapper 
mixin MigComponent : [FFI]ComponentWrapper

Am I doing here something I shouldn't be doing?

I still get an error albeit a different one.

java.lang.IllegalStateException: F
  at fanx.emit.FCodeEmit.returnOp(FCodeEmit.java:848)
  at fanx.emit.FCodeEmit.returnOp(FCodeEmit.java:836)
  at fanx.emit.FCodeEmit.returnOp(FCodeEmit.java:834)
  at fanx.emit.FCodeEmit.emitInstructions(FCodeEmit.java:125)
  at fanx.emit.FCodeEmit.emit(FCodeEmit.java:59)
  at fanx.emit.FMethodEmit.doEmit(FMethodEmit.java:400)
  at fanx.emit.FMethodEmit.emitMixinBody(FMethodEmit.java:277)
  at fanx.emit.FMixinBodyEmit.emit(FMixinBodyEmit.java:74)
  at fanx.emit.FMixinBodyEmit.emit(FMixinBodyEmit.java:41)
  at fanx.emit.FTypeEmit.emit(FTypeEmit.java:40)
  at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:215)
  at fan.sys.ClassType.emit(ClassType.java:466)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClassCond(Unknown Source)
  at java.lang.ClassLoader.defineClass(Unknown Source)
  at java.security.SecureClassLoader.defineClass(Unknown Source)
  at fan.sys.FanClassLoader.findPendingClass(FanClassLoader.java:118)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:88)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.sys.FanClassLoader.loadFan(FanClassLoader.java:57)
  at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:220)
  at fan.sys.ClassType.emit(ClassType.java:466)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClassCond(Unknown Source)
  at java.lang.ClassLoader.defineClass(Unknown Source)
  at java.security.SecureClassLoader.defineClass(Unknown Source)
  at fan.sys.FanClassLoader.findPendingClass(FanClassLoader.java:118)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:88)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.sys.FanClassLoader.loadFan(FanClassLoader.java:57)
  at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:220)
  at fan.sys.ClassType.emit(ClassType.java:466)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.mig.Main.main(Main.fan:19)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at fan.sys.Method.invoke(Method.java:536)
  at fan.sys.Method$MethodFunc.callList(Method.java:182)
  at fan.sys.Method.callList(Method.java:147)
  at fanx.tools.Fan.callMain(Fan.java:135)
  at fanx.tools.Fan.executeType(Fan.java:102)
  at fanx.tools.Fan.execute(Fan.java:38)
  at fanx.tools.Fan.run(Fan.java:236)
  at fanx.tools.Fan.main(Fan.java:274)
java.lang.RuntimeException: java.lang.IllegalStateException: F
  at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:227)
  at fan.sys.ClassType.emit(ClassType.java:466)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClassCond(Unknown Source)
  at java.lang.ClassLoader.defineClass(Unknown Source)
  at java.security.SecureClassLoader.defineClass(Unknown Source)
  at fan.sys.FanClassLoader.findPendingClass(FanClassLoader.java:118)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:88)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.sys.FanClassLoader.loadFan(FanClassLoader.java:57)
  at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:220)
  at fan.sys.ClassType.emit(ClassType.java:466)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClassCond(Unknown Source)
  at java.lang.ClassLoader.defineClass(Unknown Source)
  at java.security.SecureClassLoader.defineClass(Unknown Source)
  at fan.sys.FanClassLoader.findPendingClass(FanClassLoader.java:118)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:88)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.sys.FanClassLoader.loadFan(FanClassLoader.java:57)
  at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:220)
  at fan.sys.ClassType.emit(ClassType.java:466)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.mig.Main.main(Main.fan:19)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at fan.sys.Method.invoke(Method.java:536)
  at fan.sys.Method$MethodFunc.callList(Method.java:182)
  at fan.sys.Method.callList(Method.java:147)
  at fanx.tools.Fan.callMain(Fan.java:135)
  at fanx.tools.Fan.executeType(Fan.java:102)
  at fanx.tools.Fan.execute(Fan.java:38)
  at fanx.tools.Fan.run(Fan.java:236)
  at fanx.tools.Fan.main(Fan.java:274)
sys::Err: Cannot emit: mig::MigComponent
  at fan.sys.Err.make(Err.java:78)
  at fan.sys.Err.make(Err.java:68)
  at fan.sys.ClassType.emit(ClassType.java:474)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClassCond(Unknown Source)
  at java.lang.ClassLoader.defineClass(Unknown Source)
  at java.security.SecureClassLoader.defineClass(Unknown Source)
  at fan.sys.FanClassLoader.findPendingClass(FanClassLoader.java:118)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:88)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.sys.FanClassLoader.loadFan(FanClassLoader.java:57)
  at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:220)
  at fan.sys.ClassType.emit(ClassType.java:466)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClassCond(Unknown Source)
  at java.lang.ClassLoader.defineClass(Unknown Source)
  at java.security.SecureClassLoader.defineClass(Unknown Source)
  at fan.sys.FanClassLoader.findPendingClass(FanClassLoader.java:118)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:88)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.sys.FanClassLoader.loadFan(FanClassLoader.java:57)
  at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:220)
  at fan.sys.ClassType.emit(ClassType.java:466)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.mig.Main.main(Main.fan:19)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at fan.sys.Method.invoke(Method.java:536)
  at fan.sys.Method$MethodFunc.callList(Method.java:182)
  at fan.sys.Method.callList(Method.java:147)
  at fanx.tools.Fan.callMain(Fan.java:135)
  at fanx.tools.Fan.executeType(Fan.java:102)
  at fanx.tools.Fan.execute(Fan.java:38)
  at fanx.tools.Fan.run(Fan.java:236)
  at fanx.tools.Fan.main(Fan.java:274)
java.lang.RuntimeException: sys::Err: Cannot emit: mig::MigComponent
  at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:227)
  at fan.sys.ClassType.emit(ClassType.java:466)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClassCond(Unknown Source)
  at java.lang.ClassLoader.defineClass(Unknown Source)
  at java.security.SecureClassLoader.defineClass(Unknown Source)
  at fan.sys.FanClassLoader.findPendingClass(FanClassLoader.java:118)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:88)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.sys.FanClassLoader.loadFan(FanClassLoader.java:57)
  at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:220)
  at fan.sys.ClassType.emit(ClassType.java:466)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.mig.Main.main(Main.fan:19)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at fan.sys.Method.invoke(Method.java:536)
  at fan.sys.Method$MethodFunc.callList(Method.java:182)
  at fan.sys.Method.callList(Method.java:147)
  at fanx.tools.Fan.callMain(Fan.java:135)
  at fanx.tools.Fan.executeType(Fan.java:102)
  at fanx.tools.Fan.execute(Fan.java:38)
  at fanx.tools.Fan.run(Fan.java:236)
  at fanx.tools.Fan.main(Fan.java:274)
sys::Err: Cannot emit: mig::MigContainer
  at fan.sys.Err.make(Err.java:78)
  at fan.sys.Err.make(Err.java:68)
  at fan.sys.ClassType.emit(ClassType.java:474)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClassCond(Unknown Source)
  at java.lang.ClassLoader.defineClass(Unknown Source)
  at java.security.SecureClassLoader.defineClass(Unknown Source)
  at fan.sys.FanClassLoader.findPendingClass(FanClassLoader.java:118)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:88)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.sys.FanClassLoader.loadFan(FanClassLoader.java:57)
  at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:220)
  at fan.sys.ClassType.emit(ClassType.java:466)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.mig.Main.main(Main.fan:19)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at fan.sys.Method.invoke(Method.java:536)
  at fan.sys.Method$MethodFunc.callList(Method.java:182)
  at fan.sys.Method.callList(Method.java:147)
  at fanx.tools.Fan.callMain(Fan.java:135)
  at fanx.tools.Fan.executeType(Fan.java:102)
  at fanx.tools.Fan.execute(Fan.java:38)
  at fanx.tools.Fan.run(Fan.java:236)
  at fanx.tools.Fan.main(Fan.java:274)
java.lang.RuntimeException: sys::Err: Cannot emit: mig::MigContainer
  at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:227)
  at fan.sys.ClassType.emit(ClassType.java:466)
  at fan.sys.FanClassLoader.findFanClass(FanClassLoader.java:164)
  at fan.sys.FanClassLoader.findClass(FanClassLoader.java:92)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at fan.mig.Main.main(Main.fan:19)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at fan.sys.Method.invoke(Method.java:536)
  at fan.sys.Method$MethodFunc.callList(Method.java:182)
  at fan.sys.Method.callList(Method.java:147)
  at fanx.tools.Fan.callMain(Fan.java:135)
  at fanx.tools.Fan.executeType(Fan.java:102)
  at fanx.tools.Fan.execute(Fan.java:38)
  at fanx.tools.Fan.run(Fan.java:236)
  at fanx.tools.Fan.main(Fan.java:274)

BTW What would Map<ContainerWrapper,CC> map to in Fantom?

brian Sat 30 Oct 2010

Well there is an obvious problem there that I didn't have FRETURN.

You can try this patch.

However, the more worrying thing is that you have code path to cause that I don't have in my test suite.

If that patch doesn't work can you email me your test case so we can work on the issue? Thanks.

DanielFath Sat 30 Oct 2010

Actually that's not the test case causing problems, it's simple class instantation. I still haven't made test for the components because I'm a bit busy atm (also I have a bad habit of making tests post-festum) with exams. Maybe this can be of any help (note: you require one of MigLayout jars in lib/java/ext).

DanielFath Thu 4 Nov 2010

Hmm well it seems most of problems is removed. Now I get this error:

sys::Err: java.lang.VerifyError: (class: fan/mig/MigPane, method: getPreferredHeight   
signature: (I)I) Register 1 contains wrong type
  mig::Main.main (Main.fan:19)
  java.lang.reflect.Method.invoke (Unknown)
  fan.sys.Method.invoke (Method.java:536)
  fan.sys.Method$MethodFunc.callList (Method.java:182)
  fan.sys.Method.callList (Method.java:147)
  fanx.tools.Fan.callMain (Fan.java:135)
  fanx.tools.Fan.executeType (Fan.java:102)
  fanx.tools.Fan.execute (Fan.java:38)
  fanx.tools.Fan.run (Fan.java:236)
  fanx.tools.Fan.main (Fan.java:274)

Seems the generated .class file is inconsistent. Any luck making tests for this brian?

brian Thu 4 Nov 2010

No doubt there is a bug there, but I really need some simple test case to really dig into it.

DanielFath Thu 4 Nov 2010

How simple is simple? I was able to replicate the bug by copying the interface and I have a pretty good idea where the bug lies, so I might reduce it down a bit.

EDIT: Scratch that, from what I can tell I'll might need a lot of time to diagnose the first fault, but so far the only thing causing problems is abstract float getPreferredHeight() which I overriden with Float getPreferredHeight().

EDIT2: How fine grained you want this Mixin override tests (One big interface that tests all or a huge ass number of small test that test each java construct)?

DanielFath Thu 4 Nov 2010

Brian I finished the work on the test case and lucky as I was I detected several other faults. It seems most basic type ( byte, char, float, short) cause my test case to break.

Do you want it (it is java interface jar + test classes)? And if so how do you want it distributed?

brian Thu 4 Nov 2010

If you have a stand alone test case, please just email me directly

DanielFath Thu 4 Nov 2010

EDIT: Nvm found it.

DanielFath Thu 4 Nov 2010

BTW brian, is there a way to make Map<ContainerWrapper,CC> (in Java) in Fantom?

brian Fri 5 Nov 2010

BTW brian, is there a way to make Map<ContainerWrapper,CC> (in Java) in Fantom?

Not sure I fully follow that question, but since generics are erased it would just be java.util.Map in Fantom side. Fantom doesn't do anything with Java's generic system.

DanielFath Fri 5 Nov 2010

Ah, ok I thought it had some special syntax for generics.

brian Fri 5 Nov 2010

Renamed from Possible problems with FFI to Java FFI mixin routers with primitives

brian Fri 5 Nov 2010

Promoted to ticket #1271 and assigned to brian

brian Fri 5 Nov 2010

Ticket resolved in 1.0.56

This problem was caused by:

  1. Java interface which used primitives (byte, chart, short, int, float)
  2. Fantom mixin which implemented Java interface
  3. Class which implemented Fantom Mixin
  4. Mixin method routers used wrong bytecode to copy parameters to implementation method

Fix was to ensure that these types are handled by toJavaStackType method.

changeset

Login or Signup to reply.