浏览代码

[java] Make sure that the class instances have priorty over abstracts

Closes #6598
Caue Waneck 7 年之前
父节点
当前提交
c848dca2a1
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/codegen/gencommon/gencommon.ml

+ 6 - 1
src/codegen/gencommon/gencommon.ml

@@ -550,7 +550,12 @@ let new_ctx con =
 			| TClassDecl cl -> Hashtbl.add types cl.cl_path mt
 			| TEnumDecl e -> Hashtbl.add types e.e_path mt
 			| TTypeDecl t -> Hashtbl.add types t.t_path mt
-			| TAbstractDecl a -> Hashtbl.add types a.a_path mt
+			| TAbstractDecl a ->
+				(* There are some cases where both an abstract and a class
+				   have the same name (e.g. java.lang.Double/Integer/etc)
+				   in this case we generally want the class to have priority *)
+				if not (Hashtbl.mem types a.a_path) then
+					Hashtbl.add types a.a_path mt
 	) con.types;
 
 	let get_type path =