diff options
author | Eduardo Julian | 2019-05-19 23:51:28 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-05-19 23:51:28 -0400 |
commit | 814d5e86f6475e18d671be5149c9a9747e93d455 (patch) | |
tree | d28cac241d670dbae6e1730dc7e847e8b0bcb264 /luxc | |
parent | 46ed1ed24d6c9366264dbca3f108d1ecc3042c94 (diff) |
Now testing the methods implemented in anonymous classes to make sure all abstract methods are implemented, and no new methods (that is to say, non-overriden methods) are introduced.
Diffstat (limited to '')
-rw-r--r-- | luxc/src/lux/host.clj | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/luxc/src/lux/host.clj b/luxc/src/lux/host.clj index 5b93f5b49..562d582f6 100644 --- a/luxc/src/lux/host.clj +++ b/luxc/src/lux/host.clj @@ -27,8 +27,9 @@ (def ->package ->module-class) -(defn unfold-array [type] +(defn unfold-array "(-> Type (, Int Type))" + [type] (|case type (&/$Primitive "#Array" (&/$Cons param (&/$Nil))) (|let [[count inner] (unfold-array param)] @@ -39,8 +40,9 @@ (let [ex-type-class (str "L" (&host-generics/->bytecode-class-name "java.lang.Object") ";") object-array (str "[" "L" (&host-generics/->bytecode-class-name "java.lang.Object") ";")] - (defn ->java-sig [^objects type] + (defn ->java-sig "(-> Type (Lux Text))" + [^objects type] (|case type (&/$Primitive ?name params) (cond (= &host-type/array-data-tag ?name) (|do [:let [[level base] (unfold-array type)] @@ -145,8 +147,9 @@ (return (&/T [exs gvars gargs]))) (&/fail-with-loc (str "[Host Error] Constructor does not exist: " target " " (->> args &/->seq print-str)))))) -(defn abstract-methods [class-loader super-class] +(defn abstract-methods "(-> ClassLoader SuperClassDecl (Lux (List (, Text (List Text)))))" + [class-loader super-class] (|let [[super-name super-params] super-class] (return (&/->list (for [^Method =method (.getDeclaredMethods (Class/forName super-name true class-loader)) :when (Modifier/isAbstract (.getModifiers =method))] @@ -362,8 +365,9 @@ (assert false (println-str 'compile-dummy-method (&/adt->text method-def))) )) -(defn privacy-modifier->flag [privacy-modifier] +(defn privacy-modifier->flag "(-> PrivacyModifier Int)" + [privacy-modifier] (|case privacy-modifier (&/$PublicPM) Opcodes/ACC_PUBLIC (&/$PrivatePM) Opcodes/ACC_PRIVATE @@ -371,15 +375,17 @@ (&/$DefaultPM) 0 )) -(defn state-modifier->flag [state-modifier] +(defn state-modifier->flag "(-> StateModifier Int)" + [state-modifier] (|case state-modifier (&/$DefaultSM) 0 (&/$VolatileSM) Opcodes/ACC_VOLATILE (&/$FinalSM) Opcodes/ACC_FINAL)) -(defn inheritance-modifier->flag [inheritance-modifier] +(defn inheritance-modifier->flag "(-> InheritanceModifier Int)" + [inheritance-modifier] (|case inheritance-modifier (&/$DefaultIM) 0 (&/$AbstractIM) Opcodes/ACC_ABSTRACT |