From 9b3c9335c4c21924a43443077a0a06ed7a24f955 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Tue, 28 Jul 2015 09:22:21 -0400 Subject: [PATCH] contrib/jwrapper: intro `JavaType::clone` MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- contrib/jwrapper/src/model.nit | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/contrib/jwrapper/src/model.nit b/contrib/jwrapper/src/model.nit index 3e89d2e..656d092 100644 --- a/contrib/jwrapper/src/model.nit +++ b/contrib/jwrapper/src/model.nit @@ -24,6 +24,8 @@ import opts import jtype_converter class JavaType + super Cloneable + var identifier = new Array[String] var generic_params: nullable Array[JavaType] = null @@ -121,6 +123,18 @@ class JavaType end end + # Get a copy of `self` + redef fun clone + do + var jtype = new JavaType + jtype.identifier = identifier + jtype.generic_params = generic_params + jtype.is_void = is_void + jtype.is_vararg = is_vararg + jtype.array_dimension = array_dimension + return jtype + end + # Comparison based on fully qualified named redef fun ==(other) do return other isa JavaType and self.full_id == other.full_id and -- 1.7.9.5