projects
/
hs-java.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cabal: bump data-default dependency to 0.5.0.
[hs-java.git]
/
TestGen.hs
diff --git
a/TestGen.hs
b/TestGen.hs
index f21912c58e863481124923c72bbb70eddac2dea5..9d1bcd8caa43ae249056e1978970aee27106c8eb 100644
(file)
--- a/
TestGen.hs
+++ b/
TestGen.hs
@@
-1,23
+1,25
@@
-{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE OverloadedStrings
, FlexibleContexts
#-}
+import Control.Monad.Exception
import qualified Data.ByteString.Lazy as B
import JVM.ClassFile
import JVM.Converter
import JVM.Assembler
import JVM.Builder
import qualified Data.ByteString.Lazy as B
import JVM.ClassFile
import JVM.Converter
import JVM.Assembler
import JVM.Builder
+import JVM.Exceptions
import Java.ClassPath
import qualified Java.Lang
import qualified Java.IO
import Java.ClassPath
import qualified Java.Lang
import qualified Java.IO
-test ::
Generat
e ()
+test ::
(Throws ENotFound e, Throws ENotLoaded e, Throws UnexpectedEndMethod e) => GenerateIO
e ()
test = do
withClassPath $ do
-- Add current directory (with Hello.class) to ClassPath
addDirectory "."
test = do
withClassPath $ do
-- Add current directory (with Hello.class) to ClassPath
addDirectory "."
- -- Load method signature: Hello.hello()
+ -- Load method signature: Hello.hello()
from Hello.class
helloJava <- getClassMethod "./Hello" "hello"
-- Initializer method. Just calls java.lang.Object.<init>
helloJava <- getClassMethod "./Hello" "hello"
-- Initializer method. Just calls java.lang.Object.<init>
@@
-63,6
+65,6
@@
test = do
main :: IO ()
main = do
main :: IO ()
main = do
- testClass <- generate [] "Test" test
+ testClass <- generate
IO
[] "Test" test
B.writeFile "Test.class" (encodeClass testClass)
B.writeFile "Test.class" (encodeClass testClass)