contrib/jwrapper: implement == and hash in JavaClass and JavaMethod
authorAlexis Laferrière <alexis.laf@xymus.net>
Sat, 1 Aug 2015 13:05:04 +0000 (09:05 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Wed, 5 Aug 2015 01:37:53 +0000 (21:37 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

contrib/jwrapper/src/model.nit

index 50d54f1..021c319 100644 (file)
@@ -230,6 +230,9 @@ class JavaClass
                        end
                end
        end
+
+       redef fun hash do return class_type.hash
+       redef fun ==(o) do return o isa JavaClass and o.class_type == class_type
 end
 
 # Model of all the Java class analyzed in one run
@@ -334,6 +337,9 @@ class JavaMethod
 
        # Generic parameters of this method
        var generic_params: Array[JavaType]
+
+       redef fun ==(o) do return o isa JavaMethod and o.is_static == is_static and o.params == params
+       redef fun hash do return params.hash
 end
 
 # An attribute in a Java class