diff options
author | Eduardo Julian | 2022-03-14 17:03:38 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-03-14 17:03:38 -0400 |
commit | 62299ecdc93b39f6a22b1f89779f55dfa735fb3c (patch) | |
tree | 5456440c78bbdb1cd51e9156a7cd47ebf73b7edd /stdlib/source/library | |
parent | 792f88d0640831f426728b41d62d94fdcc4959d3 (diff) |
Made JVM "import:" syntax consistent with the other "import:"s.
Diffstat (limited to 'stdlib/source/library')
23 files changed, 382 insertions, 366 deletions
diff --git a/stdlib/source/library/lux/control/concurrency/atom.lux b/stdlib/source/library/lux/control/concurrency/atom.lux index 5ce90157e..b15cecead 100644 --- a/stdlib/source/library/lux/control/concurrency/atom.lux +++ b/stdlib/source/library/lux/control/concurrency/atom.lux @@ -16,10 +16,10 @@ abstract]]]) (with_expansions [<jvm> (as_is (ffi.import: (java/util/concurrent/atomic/AtomicReference a) - ["[1]::[0]" - (new [a]) - (get [] "io" a) - (compareAndSet [a a] boolean)]))] + "[1]::[0]" + (new [a]) + (get [] "io" a) + (compareAndSet [a a] boolean)))] (for @.old <jvm> @.jvm <jvm> (as_is))) diff --git a/stdlib/source/library/lux/control/concurrency/thread.lux b/stdlib/source/library/lux/control/concurrency/thread.lux index 5f164eaae..6c2a36ebc 100644 --- a/stdlib/source/library/lux/control/concurrency/thread.lux +++ b/stdlib/source/library/lux/control/concurrency/thread.lux @@ -24,30 +24,35 @@ [// ["[0]" atom {"+" Atom}]]) -(with_expansions [<jvm> (as_is (ffi.import: java/lang/Object) - (ffi.import: java/lang/Long) +(with_expansions [<jvm> (as_is (ffi.import: java/lang/Object + "[1]::[0]") + + (ffi.import: java/lang/Long + "[1]::[0]") (ffi.import: java/lang/Runtime - ["[1]::[0]" - ("static" getRuntime [] java/lang/Runtime) - (availableProcessors [] int)]) + "[1]::[0]" + ("static" getRuntime [] java/lang/Runtime) + (availableProcessors [] int)) - (ffi.import: java/lang/Runnable) + (ffi.import: java/lang/Runnable + "[1]::[0]") (ffi.import: java/util/concurrent/TimeUnit - ["[1]::[0]" - ("enum" MILLISECONDS)]) + "[1]::[0]" + ("enum" MILLISECONDS)) (ffi.import: java/util/concurrent/Executor - ["[1]::[0]" - (execute [java/lang/Runnable] "io" void)]) + "[1]::[0]" + (execute [java/lang/Runnable] "io" void)) - (ffi.import: (java/util/concurrent/ScheduledFuture a)) + (ffi.import: (java/util/concurrent/ScheduledFuture a) + "[1]::[0]") (ffi.import: java/util/concurrent/ScheduledThreadPoolExecutor - ["[1]::[0]" - (new [int]) - (schedule [java/lang/Runnable long java/util/concurrent/TimeUnit] "io" (java/util/concurrent/ScheduledFuture java/lang/Object))]))] + "[1]::[0]" + (new [int]) + (schedule [java/lang/Runnable long java/util/concurrent/TimeUnit] "io" (java/util/concurrent/ScheduledFuture java/lang/Object))))] (for @.old (as_is <jvm>) @.jvm (as_is <jvm>) diff --git a/stdlib/source/library/lux/data/text/buffer.lux b/stdlib/source/library/lux/data/text/buffer.lux index 78652d3fe..98526e286 100644 --- a/stdlib/source/library/lux/data/text/buffer.lux +++ b/stdlib/source/library/lux/data/text/buffer.lux @@ -19,21 +19,22 @@ abstract]]] ["[0]" //]) -(with_expansions [<jvm> (as_is (import: java/lang/CharSequence) +(with_expansions [<jvm> (as_is (import: java/lang/CharSequence + "[1]::[0]") (import: java/lang/Appendable - ["[1]::[0]" - (append [java/lang/CharSequence] java/lang/Appendable)]) + "[1]::[0]" + (append [java/lang/CharSequence] java/lang/Appendable)) (import: java/lang/String - ["[1]::[0]" - (new [int]) - (toString [] java/lang/String)]) + "[1]::[0]" + (new [int]) + (toString [] java/lang/String)) (import: java/lang/StringBuilder - ["[1]::[0]" - (new [int]) - (toString [] java/lang/String)]))] + "[1]::[0]" + (new [int]) + (toString [] java/lang/String)))] (`` (for @.old (as_is <jvm>) @.jvm (as_is <jvm>) @.js (as_is (import: (JS_Array a) diff --git a/stdlib/source/library/lux/data/text/encoding/utf8.lux b/stdlib/source/library/lux/data/text/encoding/utf8.lux index 9b13114a4..a1627c8d2 100644 --- a/stdlib/source/library/lux/data/text/encoding/utf8.lux +++ b/stdlib/source/library/lux/data/text/encoding/utf8.lux @@ -12,9 +12,9 @@ ["[0]" //]) (with_expansions [<jvm> (as_is (ffi.import: java/lang/String - ["[1]::[0]" - (new [[byte] java/lang/String]) - (getBytes [java/lang/String] [byte])]))] + "[1]::[0]" + (new [[byte] java/lang/String]) + (getBytes [java/lang/String] [byte])))] (for @.old (as_is <jvm>) @.jvm (as_is <jvm>) diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index ef90dc663..a6d04ca55 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -41,31 +41,32 @@ [month {"+" Month}] [day {"+" Day}]]]]) -(with_expansions [<jvm> (as_is (import: java/lang/String) +(with_expansions [<jvm> (as_is (import: java/lang/String + "[1]::[0]") (import: (java/lang/Class a) - ["[1]::[0]" - (getCanonicalName [] java/lang/String)]) + "[1]::[0]" + (getCanonicalName [] java/lang/String)) (import: java/lang/Object - ["[1]::[0]" - (new []) - (toString [] java/lang/String) - (getClass [] (java/lang/Class java/lang/Object))]) + "[1]::[0]" + (new []) + (toString [] java/lang/String) + (getClass [] (java/lang/Class java/lang/Object))) (import: java/lang/Integer - ["[1]::[0]" - (longValue [] long)]) + "[1]::[0]" + (longValue [] long)) (import: java/lang/Long - ["[1]::[0]" - (intValue [] int)]) + "[1]::[0]" + (intValue [] int)) (import: java/lang/Number - ["[1]::[0]" - (intValue [] int) - (longValue [] long) - (doubleValue [] double)]))] + "[1]::[0]" + (intValue [] int) + (longValue [] long) + (doubleValue [] double)))] (for @.old (as_is <jvm>) @.jvm (as_is <jvm>) diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index 5720c4dff..3a53efeb9 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -999,13 +999,6 @@ #import_field_type gtype]}))) )) -(def: bundle - (-> (List (Type Var)) (Parser [Text (List Import_Member_Declaration)])) - (|>> ..import_member_decl^ - <>.some - (<>.and <code>.text) - <code>.tuple)) - (def: (privacy_modifier$ pm) (-> Privacy Code) (case pm @@ -1668,13 +1661,12 @@ (syntax: .public (import: [declaration ..declaration^ .let [[class_name class_type_vars] (parser.declaration declaration)] - bundles (<>.some (..bundle class_type_vars))]) + import_format <code>.text + members (<>.some (..import_member_decl^ class_type_vars))]) (do [! meta.monad] [kind (class_kind declaration) - =members (|> bundles - (list#each (function (_ [import_format members]) - (list#each (|>> [import_format]) members))) - list.together + =members (|> members + (list#each (|>> [import_format])) (monad.each ! (member_import$ class_type_vars kind declaration)))] (in (list& (class_import$ declaration) (list#conjoint =members))))) diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux index 43a327049..caff78c66 100644 --- a/stdlib/source/library/lux/ffi.old.lux +++ b/stdlib/source/library/lux/ffi.old.lux @@ -968,13 +968,6 @@ #import_field_type gtype]}))) )) -(def: bundle - (-> (List Type_Parameter) (Parser [Text (List Import_Member_Declaration)])) - (|>> ..import_member_decl^ - <>.some - (<>.and <code>.text) - <code>.tuple)) - ... Generators (def: with_parens (-> JVM_Code JVM_Code) @@ -1618,13 +1611,12 @@ error))))) (syntax: .public (import: [class_decl ..class_decl^ - bundles (<>.some (..bundle (product.right class_decl)))]) + import_format <code>.text + members (<>.some (..import_member_decl^ (product.right class_decl)))]) (do [! meta.monad] [kind (class_kind class_decl) - =members (|> bundles - (list#each (function (_ [import_format members]) - (list#each (|>> [import_format]) members))) - list.together + =members (|> members + (list#each (|>> [import_format])) (monad.each ! (member_import$ (product.right class_decl) kind class_decl)))] (in (list& (class_import$ class_decl) (list#conjoint =members))))) diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux index 29d93fad0..c104eb74a 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode.lux @@ -560,12 +560,12 @@ (..bytecode $0 $1 @_ _.ldc_w/string [index])))) (import: java/lang/Float - ["[1]::[0]" - ("static" floatToRawIntBits "manual" [float] int)]) + "[1]::[0]" + ("static" floatToRawIntBits "manual" [float] int)) (import: java/lang/Double - ["[1]::[0]" - ("static" doubleToRawLongBits "manual" [double] long)]) + "[1]::[0]" + ("static" doubleToRawLongBits "manual" [double] long)) (template [<name> <type> <constructor> <constant> <wide> <to_lux> <specializations>] [(def: .public (<name> value) diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux index 2dddcee7b..101e723fd 100644 --- a/stdlib/source/library/lux/target/jvm/constant.lux +++ b/stdlib/source/library/lux/target/jvm/constant.lux @@ -62,8 +62,8 @@ ) (import: java/lang/Float - ["[1]::[0]" - ("static" floatToRawIntBits "manual" [float] int)]) + "[1]::[0]" + ("static" floatToRawIntBits "manual" [float] int)) (implementation: .public float_equivalence (Equivalence java/lang/Float) @@ -78,8 +78,8 @@ ("jvm object cast" subject))))) (import: java/lang/Double - ["[1]::[0]" - ("static" doubleToRawLongBits [double] long)]) + "[1]::[0]" + ("static" doubleToRawLongBits [double] long)) (abstract: .public (Value kind) kind diff --git a/stdlib/source/library/lux/target/jvm/loader.lux b/stdlib/source/library/lux/target/jvm/loader.lux index ce31e2e12..5b0a65bb5 100644 --- a/stdlib/source/library/lux/target/jvm/loader.lux +++ b/stdlib/source/library/lux/target/jvm/loader.lux @@ -37,31 +37,32 @@ ["Error" error])) (import: java/lang/Object - ["[1]::[0]" - (getClass [] (java/lang/Class java/lang/Object))]) + "[1]::[0]" + (getClass [] (java/lang/Class java/lang/Object))) -(import: java/lang/String) +(import: java/lang/String + "[1]::[0]") (import: java/lang/reflect/Method - ["[1]::[0]" - (invoke [java/lang/Object [java/lang/Object]] "try" java/lang/Object)]) + "[1]::[0]" + (invoke [java/lang/Object [java/lang/Object]] "try" java/lang/Object)) (import: (java/lang/Class a) - ["[1]::[0]" - (getDeclaredMethod [java/lang/String [(java/lang/Class [? < java/lang/Object])]] java/lang/reflect/Method)]) + "[1]::[0]" + (getDeclaredMethod [java/lang/String [(java/lang/Class [? < java/lang/Object])]] java/lang/reflect/Method)) (import: java/lang/Integer - ["[1]::[0]" - ("static" TYPE (java/lang/Class java/lang/Integer))]) + "[1]::[0]" + ("static" TYPE (java/lang/Class java/lang/Integer))) (import: java/lang/reflect/AccessibleObject - ["[1]::[0]" - (setAccessible [boolean] void)]) + "[1]::[0]" + (setAccessible [boolean] void)) (import: java/lang/ClassLoader - ["[1]::[0]" - (loadClass [java/lang/String] - "io" "try" (java/lang/Class java/lang/Object))]) + "[1]::[0]" + (loadClass [java/lang/String] + "io" "try" (java/lang/Class java/lang/Object))) (with_expansions [<elemT> (as_is (java/lang/Class java/lang/Object))] (def: java/lang/ClassLoader::defineClass diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux index 6d170ac6b..98896184c 100644 --- a/stdlib/source/library/lux/target/jvm/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/reflection.lux @@ -30,65 +30,69 @@ ["[1][0]" reflection] ["[1][0]" parser]]]) -(import: java/lang/String) +(import: java/lang/String + "[1]::[0]") (import: java/lang/Object - ["[1]::[0]" - (toString [] java/lang/String) - (getClass [] (java/lang/Class java/lang/Object))]) + "[1]::[0]" + (toString [] java/lang/String) + (getClass [] (java/lang/Class java/lang/Object))) (import: java/lang/reflect/Type - ["[1]::[0]" - (getTypeName [] java/lang/String)]) + "[1]::[0]" + (getTypeName [] java/lang/String)) (import: java/lang/reflect/GenericArrayType - ["[1]::[0]" - (getGenericComponentType [] java/lang/reflect/Type)]) + "[1]::[0]" + (getGenericComponentType [] java/lang/reflect/Type)) (import: java/lang/reflect/ParameterizedType - ["[1]::[0]" - (getRawType [] java/lang/reflect/Type) - (getActualTypeArguments [] [java/lang/reflect/Type])]) + "[1]::[0]" + (getRawType [] java/lang/reflect/Type) + (getActualTypeArguments [] [java/lang/reflect/Type])) (import: (java/lang/reflect/TypeVariable d) - ["[1]::[0]" - (getName [] java/lang/String) - (getBounds [] [java/lang/reflect/Type])]) + "[1]::[0]" + (getName [] java/lang/String) + (getBounds [] [java/lang/reflect/Type])) (import: (java/lang/reflect/WildcardType d) - ["[1]::[0]" - (getLowerBounds [] [java/lang/reflect/Type]) - (getUpperBounds [] [java/lang/reflect/Type])]) + "[1]::[0]" + (getLowerBounds [] [java/lang/reflect/Type]) + (getUpperBounds [] [java/lang/reflect/Type])) (import: java/lang/reflect/Modifier - ["[1]::[0]" - ("static" isStatic [int] boolean) - ("static" isFinal [int] boolean) - ("static" isInterface [int] boolean) - ("static" isAbstract [int] boolean)]) + "[1]::[0]" + ("static" isStatic [int] boolean) + ("static" isFinal [int] boolean) + ("static" isInterface [int] boolean) + ("static" isAbstract [int] boolean)) -(import: java/lang/annotation/Annotation) +(import: java/lang/annotation/Annotation + "[1]::[0]") -(import: java/lang/Deprecated) +(import: java/lang/Deprecated + "[1]::[0]") (import: java/lang/reflect/Field - ["[1]::[0]" - (getDeclaringClass [] (java/lang/Class java/lang/Object)) - (getModifiers [] int) - (getGenericType [] java/lang/reflect/Type) - (getDeclaredAnnotations [] [java/lang/annotation/Annotation])]) + "[1]::[0]" + (getDeclaringClass [] (java/lang/Class java/lang/Object)) + (getModifiers [] int) + (getGenericType [] java/lang/reflect/Type) + (getDeclaredAnnotations [] [java/lang/annotation/Annotation])) -(import: java/lang/ClassLoader) +(import: java/lang/ClassLoader + "[1]::[0]") (import: (java/lang/Class c) - ["[1]::[0]" - ("static" forName [java/lang/String boolean java/lang/ClassLoader] "try" (java/lang/Class java/lang/Object)) - (getName [] java/lang/String) - (isAssignableFrom [(java/lang/Class java/lang/Object)] boolean) - (getTypeParameters [] [(java/lang/reflect/TypeVariable (java/lang/Class c))]) - (getDeclaredField [java/lang/String] "try" java/lang/reflect/Field) - (isArray [] boolean) - (getComponentType [] (java/lang/Class java/lang/Object))]) + "[1]::[0]" + ("static" forName [java/lang/String boolean java/lang/ClassLoader] "try" (java/lang/Class java/lang/Object)) + (getName [] java/lang/String) + (isAssignableFrom [(java/lang/Class java/lang/Object)] boolean) + (getTypeParameters [] [(java/lang/reflect/TypeVariable (java/lang/Class c))]) + (getDeclaredField [java/lang/String] "try" java/lang/reflect/Field) + (isArray [] boolean) + (getComponentType [] (java/lang/Class java/lang/Object))) (exception: .public (unknown_class [class External]) (exception.report diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux index 2e991c91f..0f25e6eb2 100644 --- a/stdlib/source/library/lux/target/python.lux +++ b/stdlib/source/library/lux/target/python.lux @@ -34,10 +34,12 @@ (-> Text Text) (text.enclosed ["(" ")"])) -(for @.old (as_is (ffi.import: java/lang/CharSequence) +(for @.old (as_is (ffi.import: java/lang/CharSequence + "[1]::[0]") + (ffi.import: java/lang/String - ["[1]::[0]" - (replace [java/lang/CharSequence java/lang/CharSequence] java/lang/String)])) + "[1]::[0]" + (replace [java/lang/CharSequence java/lang/CharSequence] java/lang/String))) (as_is)) ... Added the carriage return for better Windows compatibility. diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux index ea13344ed..18e485a46 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -81,70 +81,73 @@ [module [descriptor {"+" Module}]]]]]]]]]) -(import: java/lang/ClassLoader) +(import: java/lang/ClassLoader + "[1]::[0]") (import: java/lang/Object - ["[1]::[0]" - (equals [java/lang/Object] boolean)]) + "[1]::[0]" + (equals [java/lang/Object] boolean)) -(import: java/lang/reflect/Type) +(import: java/lang/reflect/Type + "[1]::[0]") (import: (java/lang/reflect/TypeVariable d) - ["[1]::[0]" - (getName [] java/lang/String) - (getBounds [] [java/lang/reflect/Type])]) + "[1]::[0]" + (getName [] java/lang/String) + (getBounds [] [java/lang/reflect/Type])) (import: java/lang/reflect/Modifier - ["[1]::[0]" - ("static" isStatic [int] boolean) - ("static" isFinal [int] boolean) - ("static" isInterface [int] boolean) - ("static" isAbstract [int] boolean) - ("static" isPublic [int] boolean) - ("static" isProtected [int] boolean)]) + "[1]::[0]" + ("static" isStatic [int] boolean) + ("static" isFinal [int] boolean) + ("static" isInterface [int] boolean) + ("static" isAbstract [int] boolean) + ("static" isPublic [int] boolean) + ("static" isProtected [int] boolean)) -(import: java/lang/annotation/Annotation) +(import: java/lang/annotation/Annotation + "[1]::[0]") (import: java/lang/reflect/Method - ["[1]::[0]" - (getName [] java/lang/String) - (getModifiers [] int) - (getDeclaringClass [] (java/lang/Class java/lang/Object)) - (getTypeParameters [] [(java/lang/reflect/TypeVariable java/lang/reflect/Method)]) - (getGenericParameterTypes [] [java/lang/reflect/Type]) - (getDeclaredAnnotations [] [java/lang/annotation/Annotation]) - - (getReturnType [] (java/lang/Class java/lang/Object)) - (getGenericReturnType [] "?" java/lang/reflect/Type) - - (getExceptionTypes [] [(java/lang/Class java/lang/Object)]) - (getGenericExceptionTypes [] [java/lang/reflect/Type])]) + "[1]::[0]" + (getName [] java/lang/String) + (getModifiers [] int) + (getDeclaringClass [] (java/lang/Class java/lang/Object)) + (getTypeParameters [] [(java/lang/reflect/TypeVariable java/lang/reflect/Method)]) + (getGenericParameterTypes [] [java/lang/reflect/Type]) + (getDeclaredAnnotations [] [java/lang/annotation/Annotation]) + + (getReturnType [] (java/lang/Class java/lang/Object)) + (getGenericReturnType [] "?" java/lang/reflect/Type) + + (getExceptionTypes [] [(java/lang/Class java/lang/Object)]) + (getGenericExceptionTypes [] [java/lang/reflect/Type])) (import: (java/lang/reflect/Constructor c) - ["[1]::[0]" - (getModifiers [] int) - (getDeclaringClass [] (java/lang/Class c)) - (getTypeParameters [] [(java/lang/reflect/TypeVariable (java/lang/reflect/Constructor c))]) - (getGenericParameterTypes [] [java/lang/reflect/Type]) - (getExceptionTypes [] [(java/lang/Class java/lang/Object)]) - (getGenericExceptionTypes [] [java/lang/reflect/Type]) - (getDeclaredAnnotations [] [java/lang/annotation/Annotation])]) + "[1]::[0]" + (getModifiers [] int) + (getDeclaringClass [] (java/lang/Class c)) + (getTypeParameters [] [(java/lang/reflect/TypeVariable (java/lang/reflect/Constructor c))]) + (getGenericParameterTypes [] [java/lang/reflect/Type]) + (getExceptionTypes [] [(java/lang/Class java/lang/Object)]) + (getGenericExceptionTypes [] [java/lang/reflect/Type]) + (getDeclaredAnnotations [] [java/lang/annotation/Annotation])) (import: (java/lang/Class c) - ["[1]::[0]" - ("static" forName [java/lang/String] "try" (java/lang/Class java/lang/Object)) - (getName [] java/lang/String) - (getModifiers [] int) - (isAssignableFrom [(java/lang/Class java/lang/Object)] boolean) - (getTypeParameters [] [(java/lang/reflect/TypeVariable (java/lang/Class c))]) - (getGenericInterfaces [] [java/lang/reflect/Type]) - (getGenericSuperclass [] "?" java/lang/reflect/Type) - (getDeclaredField [java/lang/String] "try" java/lang/reflect/Field) - (getConstructors [] [(java/lang/reflect/Constructor java/lang/Object)]) - (getDeclaredMethods [] [java/lang/reflect/Method]) - (getDeclaredAnnotations [] [java/lang/annotation/Annotation]) - (getSuperclass [] "?" (java/lang/Class java/lang/Object)) - (getInterfaces [] [(java/lang/Class java/lang/Object)])]) + "[1]::[0]" + ("static" forName [java/lang/String] "try" (java/lang/Class java/lang/Object)) + (getName [] java/lang/String) + (getModifiers [] int) + (isAssignableFrom [(java/lang/Class java/lang/Object)] boolean) + (getTypeParameters [] [(java/lang/reflect/TypeVariable (java/lang/Class c))]) + (getGenericInterfaces [] [java/lang/reflect/Type]) + (getGenericSuperclass [] "?" java/lang/reflect/Type) + (getDeclaredField [java/lang/String] "try" java/lang/reflect/Field) + (getConstructors [] [(java/lang/reflect/Constructor java/lang/Object)]) + (getDeclaredMethods [] [java/lang/reflect/Method]) + (getDeclaredAnnotations [] [java/lang/annotation/Annotation]) + (getSuperclass [] "?" (java/lang/Class java/lang/Object)) + (getInterfaces [] [(java/lang/Class java/lang/Object)])) (template [<name>] [(exception: .public (<name> [class External @@ -551,7 +554,8 @@ {.#None} (in (jvm.class ..object_class (list))))) - {.#Ex id} + (^or {.#Ex id} + {.#Parameter id}) (phase#in (jvm.class ..object_class (list))) (^template [<tag>] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux index a69d511f3..8c314121a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux @@ -961,7 +961,8 @@ _ (generation.log! (format "JVM Interface " (%.text name)))] (in directive.no_requirements))))])) -(import: java/lang/ClassLoader) +(import: java/lang/ClassLoader + "[1]::[0]") (def: .public (bundle class_loader extender) (-> java/lang/ClassLoader Extender (Bundle Anchor (Bytecode Any) Definition)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux index d4c947953..dc3e63e85 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux @@ -49,18 +49,19 @@ ) (import: java/lang/reflect/Field - ["[1]::[0]" - (get ["?" java/lang/Object] "try" "?" java/lang/Object)]) + "[1]::[0]" + (get ["?" java/lang/Object] "try" "?" java/lang/Object)) (import: (java/lang/Class a) - ["[1]::[0]" - (getField [java/lang/String] "try" java/lang/reflect/Field)]) + "[1]::[0]" + (getField [java/lang/String] "try" java/lang/reflect/Field)) (import: java/lang/Object - ["[1]::[0]" - (getClass [] (java/lang/Class java/lang/Object))]) + "[1]::[0]" + (getClass [] (java/lang/Class java/lang/Object))) -(import: java/lang/ClassLoader) +(import: java/lang/ClassLoader + "[1]::[0]") (def: value::modifier ($_ modifier#composite field.public field.final field.static)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux index 27cba044c..c1b79618b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux @@ -79,8 +79,8 @@ (_.invokestatic $Double "valueOf" (type.method [(list) (list type.double) $Double (list)]))) (import: java/lang/Double - ["[1]::[0]" - ("static" doubleToRawLongBits "manual" [double] int)]) + "[1]::[0]" + ("static" doubleToRawLongBits "manual" [double] int)) (def: d0_bits Int diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux index 4e1c841b5..1e27186b1 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux @@ -48,73 +48,75 @@ [jvm ["[0]" runtime {"+" Definition}]]]]]]]]]) -(import: java/lang/Object) +(import: java/lang/Object + "[1]::[0]") -(import: java/lang/String) +(import: java/lang/String + "[1]::[0]") (import: java/util/jar/Attributes - ["[1]::[0]" - (put [java/lang/Object java/lang/Object] "?" java/lang/Object)]) + "[1]::[0]" + (put [java/lang/Object java/lang/Object] "?" java/lang/Object)) (import: java/util/jar/Attributes$Name - ["[1]::[0]" - ("static" MAIN_CLASS java/util/jar/Attributes$Name) - ("static" MANIFEST_VERSION java/util/jar/Attributes$Name)]) + "[1]::[0]" + ("static" MAIN_CLASS java/util/jar/Attributes$Name) + ("static" MANIFEST_VERSION java/util/jar/Attributes$Name)) (import: java/util/jar/Manifest - ["[1]::[0]" - (new []) - (getMainAttributes [] java/util/jar/Attributes)]) + "[1]::[0]" + (new []) + (getMainAttributes [] java/util/jar/Attributes)) (import: java/io/Flushable - ["[1]::[0]" - (flush [] void)]) + "[1]::[0]" + (flush [] void)) (import: java/io/Closeable - ["[1]::[0]" - (close [] void)]) + "[1]::[0]" + (close [] void)) (import: java/io/OutputStream - ["[1]::[0]" - (write [[byte] int int] void)]) + "[1]::[0]" + (write [[byte] int int] void)) (import: java/io/ByteArrayOutputStream - ["[1]::[0]" - (new [int]) - (toByteArray [] [byte])]) + "[1]::[0]" + (new [int]) + (toByteArray [] [byte])) (import: java/util/zip/ZipEntry - ["[1]::[0]" - (getName [] java/lang/String) - (isDirectory [] boolean) - (getSize [] long)]) + "[1]::[0]" + (getName [] java/lang/String) + (isDirectory [] boolean) + (getSize [] long)) (import: java/util/zip/ZipOutputStream - ["[1]::[0]" - (write [[byte] int int] void) - (closeEntry [] void)]) + "[1]::[0]" + (write [[byte] int int] void) + (closeEntry [] void)) (import: java/util/jar/JarEntry - ["[1]::[0]" - (new [java/lang/String])]) + "[1]::[0]" + (new [java/lang/String])) (import: java/util/jar/JarOutputStream - ["[1]::[0]" - (new [java/io/OutputStream java/util/jar/Manifest]) - (putNextEntry [java/util/zip/ZipEntry] "try" void)]) + "[1]::[0]" + (new [java/io/OutputStream java/util/jar/Manifest]) + (putNextEntry [java/util/zip/ZipEntry] "try" void)) (import: java/io/ByteArrayInputStream - ["[1]::[0]" - (new [[byte]])]) + "[1]::[0]" + (new [[byte]])) (import: java/io/InputStream - ["[1]::[0]" - (read [[byte] int int] int)]) + "[1]::[0]" + (read [[byte] int int] int)) (import: java/util/jar/JarInputStream - ["[1]::[0]" - (new [java/io/InputStream]) - (getNextJarEntry [] "try" "?" java/util/jar/JarEntry)]) + "[1]::[0]" + (new [java/io/InputStream]) + (getNextJarEntry [] "try" "?" java/util/jar/JarEntry)) (def: byte 1) diff --git a/stdlib/source/library/lux/world/console.lux b/stdlib/source/library/lux/world/console.lux index b8f3f6cbc..5f0fef818 100644 --- a/stdlib/source/library/lux/world/console.lux +++ b/stdlib/source/library/lux/world/console.lux @@ -42,25 +42,26 @@ (exception: .public cannot_close) -(with_expansions [<jvm> (as_is (import: java/lang/String) +(with_expansions [<jvm> (as_is (import: java/lang/String + "[1]::[0]") (import: java/io/Console - ["[1]::[0]" - (readLine [] "io" "try" java/lang/String)]) + "[1]::[0]" + (readLine [] "io" "try" java/lang/String)) (import: java/io/InputStream - ["[1]::[0]" - (read [] "io" "try" int)]) + "[1]::[0]" + (read [] "io" "try" int)) (import: java/io/PrintStream - ["[1]::[0]" - (print [java/lang/String] "io" "try" void)]) + "[1]::[0]" + (print [java/lang/String] "io" "try" void)) (import: java/lang/System - ["[1]::[0]" - ("static" console [] "io" "?" java/io/Console) - ("static" in java/io/InputStream) - ("static" out java/io/PrintStream)]) + "[1]::[0]" + ("static" console [] "io" "?" java/io/Console) + ("static" in java/io/InputStream) + ("static" out java/io/PrintStream)) (exception: .public cannot_open) diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux index 63fa2e88b..e3f87b053 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -157,47 +157,48 @@ [cannot_find_directory] ) -(with_expansions [<for_jvm> (as_is (ffi.import: java/lang/String) +(with_expansions [<for_jvm> (as_is (ffi.import: java/lang/String + "[1]::[0]") (`` (ffi.import: java/io/File - ["[1]::[0]" - (new [java/lang/String]) - (~~ (template [<name>] - [(<name> [] "io" "try" boolean)] - - [createNewFile] [mkdir] - [delete] - [isFile] [isDirectory] - [canRead] [canWrite] [canExecute])) - - (length [] "io" "try" long) - (listFiles [] "io" "try" "?" [java/io/File]) - (getAbsolutePath [] "io" "try" java/lang/String) - (renameTo [java/io/File] "io" "try" boolean) - (lastModified [] "io" "try" long) - (setLastModified [long] "io" "try" boolean) - ("static" separator java/lang/String)])) + "[1]::[0]" + (new [java/lang/String]) + (~~ (template [<name>] + [(<name> [] "io" "try" boolean)] + + [createNewFile] [mkdir] + [delete] + [isFile] [isDirectory] + [canRead] [canWrite] [canExecute])) + + (length [] "io" "try" long) + (listFiles [] "io" "try" "?" [java/io/File]) + (getAbsolutePath [] "io" "try" java/lang/String) + (renameTo [java/io/File] "io" "try" boolean) + (lastModified [] "io" "try" long) + (setLastModified [long] "io" "try" boolean) + ("static" separator java/lang/String))) (ffi.import: java/lang/AutoCloseable - ["[1]::[0]" - (close [] "io" "try" void)]) + "[1]::[0]" + (close [] "io" "try" void)) (ffi.import: java/io/OutputStream - ["[1]::[0]" - (write [[byte]] "io" "try" void) - (flush [] "io" "try" void)]) + "[1]::[0]" + (write [[byte]] "io" "try" void) + (flush [] "io" "try" void)) (ffi.import: java/io/FileOutputStream - ["[1]::[0]" - (new [java/io/File boolean] "io" "try")]) + "[1]::[0]" + (new [java/io/File boolean] "io" "try")) (ffi.import: java/io/InputStream - ["[1]::[0]" - (read [[byte]] "io" "try" int)]) + "[1]::[0]" + (read [[byte]] "io" "try" int)) (ffi.import: java/io/FileInputStream - ["[1]::[0]" - (new [java/io/File] "io" "try")]) + "[1]::[0]" + (new [java/io/File] "io" "try")) (`` (implementation: .public default (System IO) diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux index a5828f116..65a75d232 100644 --- a/stdlib/source/library/lux/world/file/watch.lux +++ b/stdlib/source/library/lux/world/file/watch.lux @@ -262,14 +262,16 @@ [fs (..polling fs)])) -(with_expansions [<jvm> (as_is (import: java/lang/Object) +(with_expansions [<jvm> (as_is (import: java/lang/Object + "[1]::[0]") - (import: java/lang/String) + (import: java/lang/String + "[1]::[0]") (import: (java/util/List a) - ["[1]::[0]" - (size [] int) - (get [int] a)]) + "[1]::[0]" + (size [] int) + (get [int] a)) (def: (default_list list) (All (_ a) (-> (java/util/List a) (List a))) @@ -282,24 +284,26 @@ output}) output)))) - (import: (java/nio/file/WatchEvent$Kind a)) + (import: (java/nio/file/WatchEvent$Kind a) + "[1]::[0]") (import: (java/nio/file/WatchEvent a) - ["[1]::[0]" - (kind [] (java/nio/file/WatchEvent$Kind a))]) + "[1]::[0]" + (kind [] (java/nio/file/WatchEvent$Kind a))) - (import: java/nio/file/Watchable) + (import: java/nio/file/Watchable + "[1]::[0]") (import: java/nio/file/Path - ["[1]::[0]" - (register [java/nio/file/WatchService [(java/nio/file/WatchEvent$Kind [? < java/lang/Object])]] "io" "try" java/nio/file/WatchKey) - (toString [] java/lang/String)]) + "[1]::[0]" + (register [java/nio/file/WatchService [(java/nio/file/WatchEvent$Kind [? < java/lang/Object])]] "io" "try" java/nio/file/WatchKey) + (toString [] java/lang/String)) (import: java/nio/file/StandardWatchEventKinds - ["[1]::[0]" - ("static" ENTRY_CREATE (java/nio/file/WatchEvent$Kind java/nio/file/Path)) - ("static" ENTRY_MODIFY (java/nio/file/WatchEvent$Kind java/nio/file/Path)) - ("static" ENTRY_DELETE (java/nio/file/WatchEvent$Kind java/nio/file/Path))]) + "[1]::[0]" + ("static" ENTRY_CREATE (java/nio/file/WatchEvent$Kind java/nio/file/Path)) + ("static" ENTRY_MODIFY (java/nio/file/WatchEvent$Kind java/nio/file/Path)) + ("static" ENTRY_DELETE (java/nio/file/WatchEvent$Kind java/nio/file/Path))) (def: (default_event_concern event) (All (_ a) @@ -323,11 +327,11 @@ ))) (import: java/nio/file/WatchKey - ["[1]::[0]" - (reset [] "io" boolean) - (cancel [] "io" void) - (watchable [] java/nio/file/Watchable) - (pollEvents [] "io" (java/util/List (java/nio/file/WatchEvent ?)))]) + "[1]::[0]" + (reset [] "io" boolean) + (cancel [] "io" void) + (watchable [] java/nio/file/Watchable) + (pollEvents [] "io" (java/util/List (java/nio/file/WatchEvent ?)))) (def: default_key_concern (-> java/nio/file/WatchKey (IO Concern)) @@ -337,21 +341,21 @@ (list#mix ..also ..none))))) (import: java/nio/file/WatchService - ["[1]::[0]" - (poll [] "io" "try" "?" java/nio/file/WatchKey)]) + "[1]::[0]" + (poll [] "io" "try" "?" java/nio/file/WatchKey)) (import: java/nio/file/FileSystem - ["[1]::[0]" - (newWatchService [] "io" "try" java/nio/file/WatchService)]) + "[1]::[0]" + (newWatchService [] "io" "try" java/nio/file/WatchService)) (import: java/nio/file/FileSystems - ["[1]::[0]" - ("static" getDefault [] java/nio/file/FileSystem)]) + "[1]::[0]" + ("static" getDefault [] java/nio/file/FileSystem)) (import: java/io/File - ["[1]::[0]" - (new [java/lang/String]) - (toPath [] java/nio/file/Path)]) + "[1]::[0]" + (new [java/lang/String]) + (toPath [] java/nio/file/Path)) (type: Watch_Event (java/nio/file/WatchEvent$Kind java/lang/Object)) diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux index 9ce51d32a..973ad7ca2 100644 --- a/stdlib/source/library/lux/world/net/http/client.lux +++ b/stdlib/source/library/lux/world/net/http/client.lux @@ -69,42 +69,44 @@ (-> Binary [Nat Binary]) [(binary.size data) data]) -(with_expansions [<jvm> (as_is (ffi.import: java/lang/String) +(with_expansions [<jvm> (as_is (ffi.import: java/lang/String + "[1]::[0]") (ffi.import: java/lang/AutoCloseable - ["[1]::[0]" - (close [] "io" "try" void)]) + "[1]::[0]" + (close [] "io" "try" void)) - (ffi.import: java/io/InputStream) + (ffi.import: java/io/InputStream + "[1]::[0]") (ffi.import: java/io/OutputStream - ["[1]::[0]" - (flush [] "io" "try" void) - (write [[byte]] "io" "try" void)]) + "[1]::[0]" + (flush [] "io" "try" void) + (write [[byte]] "io" "try" void)) (ffi.import: java/net/URLConnection - ["[1]::[0]" - (setDoOutput [boolean] "io" "try" void) - (setRequestProperty [java/lang/String java/lang/String] "io" "try" void) - (getInputStream [] "io" "try" java/io/InputStream) - (getOutputStream [] "io" "try" java/io/OutputStream) - (getHeaderFieldKey [int] "io" "try" "?" java/lang/String) - (getHeaderField [int] "io" "try" "?" java/lang/String)]) + "[1]::[0]" + (setDoOutput [boolean] "io" "try" void) + (setRequestProperty [java/lang/String java/lang/String] "io" "try" void) + (getInputStream [] "io" "try" java/io/InputStream) + (getOutputStream [] "io" "try" java/io/OutputStream) + (getHeaderFieldKey [int] "io" "try" "?" java/lang/String) + (getHeaderField [int] "io" "try" "?" java/lang/String)) (ffi.import: java/net/HttpURLConnection - ["[1]::[0]" - (setRequestMethod [java/lang/String] "io" "try" void) - (getResponseCode [] "io" "try" int)]) + "[1]::[0]" + (setRequestMethod [java/lang/String] "io" "try" void) + (getResponseCode [] "io" "try" int)) (ffi.import: java/net/URL - ["[1]::[0]" - (new [java/lang/String]) - (openConnection [] "io" "try" java/net/URLConnection)]) + "[1]::[0]" + (new [java/lang/String]) + (openConnection [] "io" "try" java/net/URLConnection)) (ffi.import: java/io/BufferedInputStream - ["[1]::[0]" - (new [java/io/InputStream]) - (read [[byte] int int] "io" "try" int)]) + "[1]::[0]" + (new [java/io/InputStream]) + (read [[byte] int int] "io" "try" int)) (def: jvm_method (-> //.Method Text) diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux index c3870d14d..3da3c779f 100644 --- a/stdlib/source/library/lux/world/program.lux +++ b/stdlib/source/library/lux/world/program.lux @@ -115,27 +115,28 @@ ... Do not trust the values of environment variables ... https://wiki.sei.cmu.edu/confluence/display/java/ENV02-J.+Do+not+trust+the+values+of+environment+variables -(with_expansions [<jvm> (as_is (import: java/lang/String) +(with_expansions [<jvm> (as_is (import: java/lang/String + "[1]::[0]") (import: (java/util/Iterator a) - ["[1]::[0]" - (hasNext [] boolean) - (next [] a)]) + "[1]::[0]" + (hasNext [] boolean) + (next [] a)) (import: (java/util/Set a) - ["[1]::[0]" - (iterator [] (java/util/Iterator a))]) + "[1]::[0]" + (iterator [] (java/util/Iterator a))) (import: (java/util/Map k v) - ["[1]::[0]" - (keySet [] (java/util/Set k))]) + "[1]::[0]" + (keySet [] (java/util/Set k))) (import: java/lang/System - ["[1]::[0]" - ("static" getenv [] (java/util/Map java/lang/String java/lang/String)) - ("static" getenv "as" resolveEnv [java/lang/String] "io" "?" java/lang/String) - ("static" getProperty [java/lang/String] "?" java/lang/String) - ("static" exit [int] "io" void)]) + "[1]::[0]" + ("static" getenv [] (java/util/Map java/lang/String java/lang/String)) + ("static" getenv "as" resolveEnv [java/lang/String] "io" "?" java/lang/String) + ("static" getProperty [java/lang/String] "?" java/lang/String) + ("static" exit [int] "io" void)) (def: (jvm##consume iterator) (All (_ a) (-> (java/util/Iterator a) (List a))) diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux index 154fb6290..d77f1aa2f 100644 --- a/stdlib/source/library/lux/world/shell.lux +++ b/stdlib/source/library/lux/world/shell.lux @@ -171,8 +171,8 @@ (..policy safe_command safe_argument))) (with_expansions [<jvm> (as_is (import: java/lang/String - ["[1]::[0]" - (toLowerCase [] java/lang/String)]) + "[1]::[0]" + (toLowerCase [] java/lang/String)) (def: (jvm::arguments_array arguments) (-> (List Argument) (Array java/lang/String)) @@ -185,8 +185,8 @@ arguments))) (import: (java/util/Map k v) - ["[1]::[0]" - (put [k v] v)]) + "[1]::[0]" + (put [k v] v)) (def: (jvm::load_environment input target) (-> Environment @@ -202,31 +202,32 @@ (dictionary.entries input))) (import: java/io/Reader - ["[1]::[0]" - (read [] "io" "try" int)]) + "[1]::[0]" + (read [] "io" "try" int)) (import: java/io/BufferedReader - ["[1]::[0]" - (new [java/io/Reader]) - (readLine [] "io" "try" "?" java/lang/String)]) + "[1]::[0]" + (new [java/io/Reader]) + (readLine [] "io" "try" "?" java/lang/String)) - (import: java/io/InputStream) + (import: java/io/InputStream + "[1]::[0]") (import: java/io/InputStreamReader - ["[1]::[0]" - (new [java/io/InputStream])]) + "[1]::[0]" + (new [java/io/InputStream])) (import: java/io/OutputStream - ["[1]::[0]" - (write [[byte]] "io" "try" void)]) + "[1]::[0]" + (write [[byte]] "io" "try" void)) (import: java/lang/Process - ["[1]::[0]" - (getInputStream [] "io" "try" java/io/InputStream) - (getErrorStream [] "io" "try" java/io/InputStream) - (getOutputStream [] "io" "try" java/io/OutputStream) - (destroy [] "io" "try" void) - (waitFor [] "io" "try" int)]) + "[1]::[0]" + (getInputStream [] "io" "try" java/io/InputStream) + (getErrorStream [] "io" "try" java/io/InputStream) + (getOutputStream [] "io" "try" java/io/OutputStream) + (destroy [] "io" "try" void) + (waitFor [] "io" "try" int)) (exception: .public no_more_output) @@ -269,19 +270,19 @@ )))))))) (import: java/io/File - ["[1]::[0]" - (new [java/lang/String])]) + "[1]::[0]" + (new [java/lang/String])) (import: java/lang/ProcessBuilder - ["[1]::[0]" - (new [[java/lang/String]]) - (environment [] "try" (java/util/Map java/lang/String java/lang/String)) - (directory [java/io/File] java/lang/ProcessBuilder) - (start [] "io" "try" java/lang/Process)]) + "[1]::[0]" + (new [[java/lang/String]]) + (environment [] "try" (java/util/Map java/lang/String java/lang/String)) + (directory [java/io/File] java/lang/ProcessBuilder) + (start [] "io" "try" java/lang/Process)) (import: java/lang/System - ["[1]::[0]" - ("static" getProperty [java/lang/String] "io" "try" java/lang/String)]) + "[1]::[0]" + ("static" getProperty [java/lang/String] "io" "try" java/lang/String)) ... https://en.wikipedia.org/wiki/Code_injection#Shell_injection (def: windows? |