Browse Source

[java/cs] Fixed some @:overload overrides that weren't validated by typeload

Cauê Waneck 11 years ago
parent
commit
e7dcf40841
5 changed files with 23 additions and 8 deletions
  1. 2 0
      gencs.ml
  2. 14 1
      genjava.ml
  3. 1 1
      libs
  4. 2 2
      std/haxe/Timer.hx
  5. 4 4
      typeload.ml

+ 2 - 0
gencs.ml

@@ -3232,6 +3232,8 @@ let convert_ilmethod ctx p m is_explicit_impl =
 		| name -> name
 	in
 	let acc = match m.mflags.mf_access with
+		| _ when List.mem SGetter m.msemantics || List.mem SSetter m.msemantics ->
+			APrivate
 		| FAFamily | FAFamOrAssem -> APrivate
 		(* | FAPrivate -> APrivate *)
 		| FAPublic -> APublic

+ 14 - 1
genjava.ml

@@ -2429,8 +2429,21 @@ let mk_type_path ctx path params =
 		with | Invalid_string ->
 			jname_to_hx (snd path), None
 	in
+	let pack = fst (jpath_to_hx path) in
+	let pack, sub, name = match path with
+		| [], ("Float" as c)
+		| [], ("Int" as c)
+		| [], ("Single" as c)
+		| [], ("Bool" as c)
+		| [], ("Dynamic" as c)
+		| [], ("Iterator" as c)
+		| [], ("Iterable" as c) ->
+			[], Some c, "StdTypes"
+		| _ ->
+			pack, sub, name
+	in
 	CTPath {
-		tpackage = fst (jpath_to_hx path);
+		tpackage = pack;
 		tname = name;
 		tparams = params;
 		tsub = sub;

+ 1 - 1
libs

@@ -1 +1 @@
-Subproject commit 99fff320911ee1cc513f473fc32b68a5cbaddc36
+Subproject commit 78d07983447744bab7095c4e57f290b950d3cf04

+ 2 - 2
std/haxe/Timer.hx

@@ -185,8 +185,8 @@ private class TimerTask extends java.util.TimerTask {
 		this.timer = timer;
 	}
 
-	@:overload public function run():Void {
+	@:overload override public function run():Void {
 		timer.run();
 	}
 }
-#end
+#end

+ 4 - 4
typeload.ml

@@ -873,7 +873,7 @@ let check_overriding ctx c =
 							same_overload_args f.cf_type (apply_params csup.cl_params params t) f f2
 						) overloads
 					) true
-				) f.cf_overloads
+				) (f :: f.cf_overloads)
 			end else
 				check_field f (fun csup i ->
 					let _, t, f2 = raw_class_field (fun f -> f.cf_type) csup params i in
@@ -2253,9 +2253,9 @@ let init_class ctx c p context_init herits fields =
 					| None ->
 							c.cl_constructor <- Some f
 					| Some ctor when ctx.com.config.pf_overload ->
-			  if Meta.has Meta.Overload f.cf_meta && Meta.has Meta.Overload ctor.cf_meta then
-							ctor.cf_overloads <- f :: ctor.cf_overloads
-			  else if Meta.has Meta.Overload f.cf_meta <> Meta.has Meta.Overload ctor.cf_meta then
+							if Meta.has Meta.Overload f.cf_meta && Meta.has Meta.Overload ctor.cf_meta then
+								ctor.cf_overloads <- f :: ctor.cf_overloads
+							else
 								display_error ctx ("If using overloaded constructors, all constructors must be declared with @:overload") (if Meta.has Meta.Overload f.cf_meta then ctor.cf_pos else f.cf_pos)
 					| Some ctor ->
 								display_error ctx "Duplicate constructor" p