Commit 61903dd
committed
First full implementation of fully qualified names, including methods
Clazz.$new, Clazz.newMethod$, and Clazz.newInstance$
Basic idea:
0) SAEM (Search and Execute Method) deprecated. All method names
qualified with full parameter names. Thus, no more issues with
overloading or overriding.
1) All cla$$ (old c$, new C$) reference localized with "var" within
Clazz.load or anonymous JavaScript function.
2) Clazz.newInstance$ replaces Clazz.prepareFields() and
Clazz.initialize()
3) All constructors now are static methods of a class.
4) Constructor calls to super(...) are simply calls to
cla$$.superClazz.construct$....apply(this, args) followed immediately by
a call to cla$$.$init$(), which initializes all fields, exactly
duplicating Java <init>, in the proper order.
5) Constructor calls to this(...) are simply calls to
cla$$.construct$....apply(this, args) without any call to
cla$$.$init$().
6) No skipping of default constructors. Default constructor added
automatically if none is present.
7) No skipping calls to default superconstructors -- provided
automatically if not present. TODO -- recognition of construct(int...)
as default constructor.
8) Clazz.newMethod$ allows for creation of all methods, including
constructors, static methods, and $init$.
9) Clazz.$new(Foo.construct$..., args) replaces all calls to new Foo()
and utilizes new (Function.prototype.bind.apply(c.exClazz, arguments));
10) super.foo() replaced by cla$$.superClazz.prototype.apply(this,[...])
11) overridden private methods still accessible to owner class by using
the same mechanism, namely cla$$.prototype.apply(foo, [...])
12) inner classes and anonymous classes created similarly.
13) Clazz.declareAnonymous and Clazz.innerTypeInstance deprecated.1 parent b1a88e2 commit 61903dd
File tree
1 file changed
+64
-59
lines changed- sources/net.sf.j2s.core/src/net/sf/j2s/core/astvisitors
1 file changed
+64
-59
lines changed
0 commit comments