Skip to content

Commit c608b20

Browse files
authored
Merge pull request #74 from BobHanson/yadav1
Yadav1
2 parents 07b5163 + e973d3c commit c608b20

File tree

9 files changed

+39
-8
lines changed

9 files changed

+39
-8
lines changed

sources/net.sf.j2s.core/dist/README.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,37 @@ This is the main README file for the Java2Script/SwingJS distribution
22

33
https://github.com/BobHanson/java2script/blob/master/sources/net.sf.j2s.core/dist/README.txt
44

5+
8/14/2018 Bob Hanson hansonr@stolaf.edu
6+
7+
- allows for no-package applets and applications (which is quite common in the Java applet world).
8+
9+
- totally refactored, streamlined Java-to-JavaScript class name conversion, including the "j2s/_" (single underscore) package, which contains (originally) package-less applets and applications. All Java2ScriptVisitor "getFinal..." methods return JavaScript-ready names that are intended for immediate appending to the output buffer. Prior to that moment, all class names are maintained as their Java values.
10+
11+
- more efficient anonymous class creation (including lambda methods, constructors, and expressions).
12+
13+
- full support for method-local named classes.
14+
15+
- full, efficient support for default interface methods.
16+
17+
- fully qualified methods [ excluding Math.* and *.toString() ], so no conflict with any standard JavaScript objects.
18+
19+
- bullet-proof "final or effectively final" variables.
20+
21+
- strongly anonymous-function scoped for "private" methods.
22+
23+
- corrects several issues with java.util.function.* and java.util.stream.*.
24+
25+
- adds ?j2sverbose option (former standard logging all class loading), with the default being "quiet" mode, which gives no indication of file loading. (Also settable as J2S._quiet = [true|false]
26+
27+
- adds hooks into Clazz object loading, allowing page intervention just after Clazz itself has been loaded, but the core files have not been loaded, and also just after core files have been loaded. This could be useful for customization of the loading process -- for example, dynamically settable core file configuration.
28+
29+
- adds System.getProperty("user.home"), which defaults to https://./ (which isn't a standard protocol, but is passed through the Java system and interpreted in JavaScript as the document base).
30+
31+
- reorganizes java2script project files for better version control.
32+
33+
- adds {project}/resources/ and {project}/libjs as standard places for non-Java resources and zip-equivalents of JAR files that are automatically copied into the {project}/site directory.
34+
35+
536
8/12/2018 Bob Hanson hansonr@stolaf.edu
637

738
The dist/dropins folder has been renamed dist/swingjs
118 Bytes
Binary file not shown.
10 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20180814211809
1+
20180815205622
118 Bytes
Binary file not shown.
10 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20180814211809
1+
20180815205622

sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptVisitor.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ public boolean visit(ClassInstanceCreation node) {
526526

527527
private void addConstructor(Type type, IMethodBinding constructorMethodBinding, List<?> arguments,
528528
int lambdaArity) {
529-
String javaClassName = getClassJavaNameForClass(type);
529+
String javaClassName = getClassJavaNameForType(type);
530530
if ("java.lang.Object".equals(javaClassName)) {
531531
buffer.append(" Clazz.new_()");
532532
return;
@@ -603,19 +603,19 @@ private void openNew(String javaClassName, String anonJavaName, IMethodBinding c
603603
* @param type
604604
* @return
605605
*/
606-
private String getClassJavaNameForClass(Type type) {
606+
private String getClassJavaNameForType(Type type) {
607607
if (type instanceof QualifiedType) {
608608
QualifiedType qualType = (QualifiedType) type;
609-
return getClassJavaNameForClass(qualType.getQualifier()) + "." + qualType.getName().getIdentifier();
609+
return getClassJavaNameForType(qualType.getQualifier()) + "." + qualType.getName().getIdentifier();
610610
}
611611
// if (type instanceof NameQualifiedType) {
612612
// NameQualifiedType nType = (NameQualifiedType) type;
613613
// return getClassJavaNameForClass(nType.getQualifier()) + "." + nType.getName().getIdentifier();
614614
// }
615615
if (type instanceof ArrayType)
616-
return getClassJavaNameForClass(((ArrayType) type).getElementType());
616+
return getClassJavaNameForType(((ArrayType) type).getElementType());
617617
if (type instanceof ParameterizedType)
618-
return getClassJavaNameForClass(((ParameterizedType) type).getType());
618+
return getClassJavaNameForType(((ParameterizedType) type).getType());
619619
if (type instanceof SimpleType) {
620620
ITypeBinding binding = ((SimpleType) type).resolveBinding();
621621
return getJavaClassNameQualified(binding);
@@ -1515,7 +1515,7 @@ public boolean visit(TryStatement node) {
15151515
}
15161516
buffer.append(haveType ? " || " : "if (");
15171517
buffer.append("Clazz.exceptionOf(" + catchEName + ",\"");
1518-
type.accept(this);
1518+
buffer.append(getFinalJ2SClassName(getClassJavaNameForType(type), FINAL_RAW));
15191519
buffer.append("\")");
15201520
haveType = true;
15211521
}
118 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)