Skip to content

Commit 870ed64

Browse files
committed
Fixed bug that super constructor is not found should be acceptable
Fixed bug that "$wt" is not accepted in casting parameters
1 parent 27ad92b commit 870ed64

File tree

1 file changed

+8
-4
lines changed
  • sources/net.sf.j2s.java.core/src/java/lang

1 file changed

+8
-4
lines changed

sources/net.sf.j2s.java.core/src/java/lang/Class.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -830,8 +830,12 @@ Clazz.castNullAs = function (asClazz) {
830830
/* protcted */
831831
Clazz.CastedObject = function (obj, asClazz) {
832832
if (asClazz != null) {
833-
if (asClazz instanceof String) {
834-
this.clazzName = asClazz;
833+
if (asClazz instanceof String || typeof asClazz == "string") {
834+
if (asClazz.indexOf ("$wt.") == 0) {
835+
this.clazzName = "org.eclipse.swt." + asClazz.substring(4);
836+
} else {
837+
this.clazzName = asClazz;
838+
}
835839
} else if (asClazz instanceof Function) {
836840
this.clazzName = Clazz.getClassName (asClazz, true);
837841
} else {
@@ -1010,9 +1014,9 @@ Clazz.searchAndExecuteMethod = function (objThis, claxxRef, fxName, funParams) {
10101014
* exceptions. In Java codes, extending Object can call super
10111015
* default Object#constructor, which is not defined in JS.
10121016
*/
1013-
// return; // ub: ignoring the above comment and throw an execption
1017+
return; // ub: ignoring the above comment and throw an execption
10141018
// when not found.
1015-
throw new java.lang.NoSuchMethodException ();
1019+
// throw new java.lang.NoSuchMethodException ();
10161020
}
10171021
// TODO: should be java.lang.NoSuchMethodException
10181022
throw new Clazz.MethodNotFoundException (objThis, claxxRef,

0 commit comments

Comments
 (0)