#1344 fansh doesn't handle Java FFI variables

jlist Wed 1 Dec 2010

Hi, so I'm trying to create two java.io.File objects. It seems like the it works the first time but fails the second time. Both files exist and switching file names doesn't make a difference. Similar code works in a .fan file (tested with fanide.) I wonder what I'm missing? Thanks.

D:\Java\fantom-1.0.56\bin>fansh
Fantom Shell v1.0.56 ('?' for help)
fansh> using [java]java.io::File as JFile
Add using: using [java]java.io::File as JFile
fansh> f1 := JFile("c:\\autoLog.txt")
c:\autoLog.txt
fansh> f2 := JFile("c:\\autoexec.bat")
ERROR(16): Expected ')', not 'java'

vkuzkokov Wed 1 Dec 2010

here's code fansh tries to compile

using [java]java.io::File as JFile
class FanshEval {
new make(Str:Obj s) { _scope = s }
Str:Obj? _scope
Obj? _eval() {
  f1 := ([java]java.io::File?)_scope["f1"];
f2 := JFile("c:\\autoexec.bat"); return "__void__"; } }

Actually, anything except using after f1 := JFile("c:\\autoLog.txt") will fail. Seems like cast operator doesn't work with FFI types.

brian Wed 1 Dec 2010

Renamed from fansh error to fansh doesn't handle Java FFI variables

brian Wed 1 Dec 2010

Promoted to ticket #1344 and assigned to brian

brian Thu 6 Jan 2011

Ticket resolved in 1.0.57

Fixed - fansh should handle using and using as for the Java FFI correctly now

Login or Signup to reply.