Skip to content

Commit

Permalink
working on java interop
Browse files Browse the repository at this point in the history
  • Loading branch information
phlegmaticprogrammer committed Jul 12, 2011
1 parent 049e9d3 commit 891768a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
Expand Up @@ -377,6 +377,10 @@ class Evaluator(val maxNumThreads : Int, val fileCentral : FileCentral,
classname = s.v
classDescr = JavaInterop.getClassDescr(classname)
args = tuple.tail.toList
case JavaInterop.NativeValue(c:Class[_]) =>
classname = c.getCanonicalName
classDescr = JavaInterop.getClassDescr(classname)
args = tuple.tail.toList
case _ =>
}
}
Expand All @@ -385,6 +389,9 @@ class Evaluator(val maxNumThreads : Int, val fileCentral : FileCentral,
case s: StringValue =>
classname = s.v
classDescr = JavaInterop.getClassDescr(classname)
case JavaInterop.NativeValue(c:Class[_]) =>
classname = c.getCanonicalName
classDescr = JavaInterop.getClassDescr(classname)
case vect: VectorValue => analyze(vect)
case _ =>
val w = v.typeConvert(true, Values.TYPE_VECT)
Expand Down
2 changes: 1 addition & 1 deletion Babel17_Netbeans_Module/manifest.mf
@@ -1,5 +1,5 @@
Manifest-Version: 1.0
OpenIDE-Module: com.babel17.netbeans
OpenIDE-Module-Implementation-Version: 73
OpenIDE-Module-Implementation-Version: 74
OpenIDE-Module-Layer: com/babel17/netbeans/layer.xml
OpenIDE-Module-Localizing-Bundle: com/babel17/netbeans/Bundle.properties
1 change: 1 addition & 0 deletions Babel17_Netbeans_Module/nbproject/project.properties
@@ -1,6 +1,7 @@
file.reference.antlr-runtime-3.1.3.jar=release/modules/ext/antlr-runtime-3.1.3.jar
file.reference.Babel17_Antlr_Parser.jar=release/modules/ext/Babel17_Antlr_Parser.jar
file.reference.Babel17_ANTLR_Parser.jar=release/modules/ext/Babel17_ANTLR_Parser.jar
file.reference.Babel17_Interpreter.jar=release/modules/ext/Babel17_Interpreter.jar
file.reference.functionaljava.jar=release/modules/ext/functionaljava.jar
file.reference.scala-library.jar=release/modules/ext/scala-library.jar
javac.source=1.5
Expand Down
20 changes: 19 additions & 1 deletion Babel17_Spec_Unittests/babel17_src/nativeinterop.b17
@@ -1,8 +1,18 @@
module lang.unittest.spec.nativeinterop

if native Platform == Java then
val h = native New ("com.babel17.java.JavaInteropUnittestHelper",
val h_class = native Class "com.babel17.java.JavaInteropUnittestHelper"
#assert h_class.getCanonicalName () == "com.babel17.java.JavaInteropUnittestHelper"

val h = native New (h_class,
"hello world", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
val g = native New ("com.babel17.java.JavaInteropUnittestHelper",
"hello world", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

#assert h.msg () == g.msg ()
#assert h <> g

#assert h.getClass () == h_class

#assert h.a == 2
#assert h.msg <> "hello world"
Expand All @@ -17,6 +27,7 @@ module lang.unittest.spec.nativeinterop
#assert h.pick 5 == (6,)
#assert h.b <> 2
#assert h.b () == 3
#assert h.nothing () == nil

def test_num (f, numbits, signed, limited) =
begin
Expand Down Expand Up @@ -75,6 +86,13 @@ module lang.unittest.spec.nativeinterop

#assert h.ambi_int nil == "Integer: null"
#assert h.ambi_int 2 == "Integer: 2"

#assert h.test_a () == "test_a"
#assert h.test_A () == "test_a"

#assert h.a_mul 7 == 7 * h.a

#assert h_class.a_mul 7 == 7 * h_class.a
else
#assert false
end
Expand Down

0 comments on commit 891768a

Please sign in to comment.