diff --git a/sources/net.sf.j2s.core/dist/libjs/README.txt b/sources/net.sf.j2s.core/dist/libjs/README.txt
deleted file mode 100644
index c515db26d..000000000
--- a/sources/net.sf.j2s.core/dist/libjs/README.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-SwingJS distribution -- libjs directory
-
-This directory can be used to hold pre-compiled *.zip files that
-have root directories swingjs and swingjs/j2s. They will be
-unzipped into the site/ directory by build-site.xml.
-
-Generally these files would be derived from .jar files that your
-program uses. If your program has jar dependencies, you will need to
-find the source for those, compile it, and then zip the resulting
-.js files into xxxx.zip. The ANT task that might do this should look
-something like this:
-
-
-
-
- Zipping up ${json.zip}
-
-
-
diff --git a/sources/net.sf.j2s.core/dist/resources/README.txt b/sources/net.sf.j2s.core/dist/resources/README.txt
deleted file mode 100644
index 9c540809b..000000000
--- a/sources/net.sf.j2s.core/dist/resources/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-SwingJS distribution -- resources directory
-
-This directory can be used to hold non-Java files that your program
-needs to run -- data files, for instance. Files in it will be copied to
-the site/swingjs/j2s directory by build-site.xml.
-
diff --git a/sources/net.sf.j2s.core/dist/site-resources/README.txt b/sources/net.sf.j2s.core/dist/site-resources/README.txt
deleted file mode 100644
index f43548c13..000000000
--- a/sources/net.sf.j2s.core/dist/site-resources/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-SwingJS distribution -- site-resources directory
-
-This directory can be used to hold non-Java files that your program
-needs to run -- data files, for instance. Files in it will be copied to
-the site/ directory by build-site.xml.
-
diff --git a/sources/net.sf.j2s.core/dist/swingjs/j2s.core.jar b/sources/net.sf.j2s.core/dist/swingjs/j2s.core.jar
index 969a5cc0b..e6f92de1b 100644
Binary files a/sources/net.sf.j2s.core/dist/swingjs/j2s.core.jar and b/sources/net.sf.j2s.core/dist/swingjs/j2s.core.jar differ
diff --git a/sources/net.sf.j2s.core/dist/swingjs/timestamp b/sources/net.sf.j2s.core/dist/swingjs/timestamp
index 0adb3e635..6d083b830 100644
--- a/sources/net.sf.j2s.core/dist/swingjs/timestamp
+++ b/sources/net.sf.j2s.core/dist/swingjs/timestamp
@@ -1 +1 @@
-20231113160352
+20231115195339
diff --git a/sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/SwingJS-site.zip b/sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/SwingJS-site.zip
index 1155a2eee..b80c5291c 100644
Binary files a/sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/SwingJS-site.zip and b/sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/SwingJS-site.zip differ
diff --git a/sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/j2s.core.jar b/sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/j2s.core.jar
index 969a5cc0b..e6f92de1b 100644
Binary files a/sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/j2s.core.jar and b/sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/j2s.core.jar differ
diff --git a/sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/timestamp b/sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/timestamp
index 0adb3e635..6d083b830 100644
--- a/sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/timestamp
+++ b/sources/net.sf.j2s.core/dist/swingjs/ver/5.0.1/timestamp
@@ -1 +1 @@
-20231113160352
+20231115195339
diff --git a/sources/net.sf.j2s.core/src/j2s/core/Java2ScriptCompiler.java b/sources/net.sf.j2s.core/src/j2s/core/Java2ScriptCompiler.java
index c08f2c4f4..87546df8f 100644
--- a/sources/net.sf.j2s.core/src/j2s/core/Java2ScriptCompiler.java
+++ b/sources/net.sf.j2s.core/src/j2s/core/Java2ScriptCompiler.java
@@ -146,7 +146,7 @@ static File checkJ2SDir(String dir) {
/**
* Entry point from compilation participant when Java build is complete and it is our turn.
- *
+ * e
* @param project
* @param files
* @return
@@ -500,11 +500,32 @@ protected String fixPackageName(String name) {
if (packageFixes == null)
return name;
for (int i = 0; i < packageFixes.length; i++) {
- name = name.replaceAll(packageFixes[i++], packageFixes[i]);
+ name = rep(name, packageFixes[i++], packageFixes[i]);
}
return name;
}
+ /**
+ * Does a clean ITERATIVE replace of strFrom in str with strTo.
+ * Thus, rep("Testttt", "tt","t") becomes "Test".
+ *
+ * @param str
+ * @param strFrom
+ * @param strTo
+ * @return replaced string
+ */
+ protected static String rep(String str, String strFrom, String strTo) {
+ if (str == null || strFrom.length() == 0 || str.indexOf(strFrom) < 0)
+ return str;
+ boolean isOnce = (strTo.indexOf(strFrom) >= 0);
+ do {
+ str = str.replace(strFrom, strTo);
+ } while (!isOnce && str.indexOf(strFrom) >= 0);
+ return str;
+ }
+
+
+
}
diff --git a/sources/net.sf.j2s.core/src/j2s/jmol/Java2ScriptLegacyCompiler.java b/sources/net.sf.j2s.core/src/j2s/jmol/Java2ScriptLegacyCompiler.java
index 49fd95dee..afd0fd828 100644
--- a/sources/net.sf.j2s.core/src/j2s/jmol/Java2ScriptLegacyCompiler.java
+++ b/sources/net.sf.j2s.core/src/j2s/jmol/Java2ScriptLegacyCompiler.java
@@ -12,8 +12,8 @@
import j2s.CorePlugin;
import j2s.core.Java2ScriptCompiler;
-import j2s.jmol.common.ASTScriptVisitor;
-import j2s.jmol.common.DependencyASTVisitor;
+import j2s.jmol.common.Java2ScriptScriptVisitor;
+import j2s.jmol.common.Java2ScriptDependencyVisitor;
public class Java2ScriptLegacyCompiler extends Java2ScriptCompiler {
@@ -25,6 +25,15 @@ public class Java2ScriptLegacyCompiler extends Java2ScriptCompiler {
private int nResources;
+ private static String[] myStringFixes = { //
+ "cla$$", "c$" //
+ ,"innerThis", "i$" //
+ ,"finalVars", "v$" //
+ ,".callbacks", ".b$" //
+ ,".$finals", ".f$" //
+ ,"Class.forName", "Clazz._4Name"//
+ };
+
public Java2ScriptLegacyCompiler(File f) {
super(false, f);
}
@@ -33,18 +42,13 @@ public Java2ScriptLegacyCompiler(File f) {
public boolean initializeProject(IJavaProject project, boolean isCleanBuild) {
if (!super.initializeProject(project, isCleanBuild, AST.JLS4)) {
return false;
- }
-
+ }
String s = getProperty(J2S_STRING_FIXES, null);
- if (s != null) {
- stringFixes = s.split(",");
- fixRegex(stringFixes);
- System.out.println(stringFixes.length + " string fixes");
- }
+ stringFixes = getFixes(s, myStringFixes);
+ System.out.println(stringFixes.length + " string fixes");
s = getProperty(J2S_PACKAGE_FIXES, null);
if (s != null) {
- packageFixes = s.split(",");
- fixRegex(packageFixes);
+ packageFixes = getFixes(s, null);
System.out.println(packageFixes.length + " package fixes");
}
nResources = 0;
@@ -53,10 +57,22 @@ public boolean initializeProject(IJavaProject project, boolean isCleanBuild) {
return true;
}
- private void fixRegex(String[] a) {
+ @SuppressWarnings("null")
+ private String[] getFixes(String s, String[] myFixes) {
+ String[] a = (s == null || s.length() == 0 ? new String[0] : rep(s, "\\,", "\1").split(","));
+ int pt = (myFixes == null ? 0 : myFixes.length);
+ if (pt == 0 && a.length == 0)
+ return null;
+ String[] b = new String[pt + a.length];
+ for (int i = 0; i < pt; i++) {
+ b[i] = myFixes[i]; // no escaped commas here
+ System.out.print((i%2) == 0 ? b[i] : " -> " + b[i] + "\n");
+ }
for (int i = 0; i < a.length; i++) {
- a[i] = a[i].replaceAll("\\.", "\\\\.");
+ System.out.print((i%2) == 0 ? a[i] : " -> " + a[i] + "\n");
+ b[pt++] = a[i].replace('\1', ',');
}
+ return b;
}
public void startBuild(boolean isClean) {
@@ -78,7 +94,7 @@ public boolean compileToJavaScript(IFile javaSource, String trailer) {
astParser.setResolveBindings(true);
astParser.setSource(createdUnit);
CompilationUnit root = (CompilationUnit) astParser.createAST(null);
- DependencyASTVisitor dvisitor = new DependencyASTVisitor();
+ Java2ScriptDependencyVisitor dvisitor = new Java2ScriptDependencyVisitor(this);
boolean errorOccurs = false;
try {
root.accept(dvisitor);
@@ -95,8 +111,7 @@ public boolean compileToJavaScript(IFile javaSource, String trailer) {
String packageName = dvisitor.getPackageName();
if (packageName != null) {
File folder = new File(outputPath, packageName.replace('.', File.separatorChar));
- outputPath = folder.getAbsolutePath();
- File jsFile = new File(outputPath, elementName + ".js"); //$NON-NLS-1$
+ File jsFile = new File(folder, elementName + ".js"); //$NON-NLS-1$
if (jsFile.exists()) {
jsFile.delete();
}
@@ -104,13 +119,10 @@ public boolean compileToJavaScript(IFile javaSource, String trailer) {
return false;
}
- ASTScriptVisitor visitor = new ASTScriptVisitor();
+ Java2ScriptScriptVisitor visitor = new Java2ScriptScriptVisitor();
isDebugging = "debug".equals(props.getProperty("j2s.compiler.mode"));
visitor.setDebugging(isDebugging);
dvisitor.setDebugging(isDebugging);
-// boolean toCompress = "release".equals(props.getProperty("j2s.compiler.mode"));
-// ((ASTVariableVisitor) visitor.getAdaptable(ASTVariableVisitor.class)).setToCompileVariableName(toCompress);
-// dvisitor.setToCompileVariableName(false);
errorOccurs = false;
try {
root.accept(visitor);
@@ -122,17 +134,12 @@ public boolean compileToJavaScript(IFile javaSource, String trailer) {
outputJavaScript(visitor, dvisitor, root, outputPath, trailer, sourceLocation);
return true;
}
- String folderPath = outputPath;
String elementName = root.getJavaElement().getElementName();
- // if (elementName.endsWith(".class") || elementName.endsWith(".java")) {
- // //$NON-NLS-1$//$NON-NLS-2$
elementName = elementName.substring(0, elementName.lastIndexOf('.'));
- // } /* maybe ended with other customized extension
String packageName = visitor.getPackageName();
if (packageName != null) {
- File folder = new File(folderPath, packageName.replace('.', File.separatorChar));
- folderPath = folder.getAbsolutePath();
- File jsFile = new File(folderPath, elementName + ".js"); //$NON-NLS-1$
+ File folder = new File(outputPath, packageName.replace('.', File.separatorChar));
+ File jsFile = new File(folder.getAbsolutePath(), elementName + ".js"); //$NON-NLS-1$
if (jsFile.exists()) {
jsFile.delete();
}
@@ -140,7 +147,7 @@ public boolean compileToJavaScript(IFile javaSource, String trailer) {
return false;
}
- private void outputJavaScript(ASTScriptVisitor visitor, DependencyASTVisitor dvisitor, CompilationUnit fRoot,
+ private void outputJavaScript(Java2ScriptScriptVisitor visitor, Java2ScriptDependencyVisitor dvisitor, CompilationUnit fRoot,
String outputPath, String trailer, String sourceLocation) {
String js = finalFixes(dvisitor.getDependencyScript(visitor.getBuffer()));
String elementName = fRoot.getJavaElement().getElementName();
@@ -168,14 +175,8 @@ private void outputJavaScript(ASTScriptVisitor visitor, DependencyASTVisitor dvi
}
private String finalFixes(String js) {
- js = js.replaceAll("cla\\$\\$", "c\\$").replaceAll("innerThis", "i\\$").replaceAll("finalVars", "v\\$")
- .replaceAll("\\.callbacks", "\\.b\\$").replaceAll("\\.\\$finals", "\\.f\\$")
- // BH 2023.11.10 added
- .replaceAll("Class\\.forName", "Clazz\\._4Name");
- if (stringFixes != null) {
- for (int i = 0; i < stringFixes.length; i++) {
- js = js.replaceAll(stringFixes[i++], stringFixes[i]);
- }
+ for (int i = 0; i < stringFixes.length; i++) {
+ js = rep(js, stringFixes[i++], stringFixes[i]);
}
return js;
}
diff --git a/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTEmptyVisitor.java b/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTEmptyVisitor.java
index 67a0bc67f..1ca599368 100644
--- a/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTEmptyVisitor.java
+++ b/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTEmptyVisitor.java
@@ -103,7 +103,7 @@ public class ASTEmptyVisitor extends ASTVisitor {
/**
* Buffer that keep all compiled *.js.
- * @see ASTScriptVisitor#laterBuffer
+ * @see Java2ScriptScriptVisitor#laterBuffer
*/
protected StringBuffer buffer = new StringBuffer();
@@ -117,7 +117,7 @@ public StringBuffer getBuffer() {
/**
* Buffer may be set to other buffer.
- * @see ASTScriptVisitor#visit(TypeDeclaration)
+ * @see Java2ScriptScriptVisitor#visit(TypeDeclaration)
* @param buffer
*/
public void setBuffer(StringBuffer buffer) {
diff --git a/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTJ2SDocVisitor.java b/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTJ2SDocVisitor.java
index 8109523d1..43b8856ae 100644
--- a/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTJ2SDocVisitor.java
+++ b/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTJ2SDocVisitor.java
@@ -153,18 +153,18 @@ boolean visitNativeJavadoc(Javadoc javadoc, Block node, boolean superVisit) {
}
}
}
- boolean toCompileVariableName = false;//((ASTVariableVisitor) getAdaptable(ASTVariableVisitor.class)).isToCompileVariableName();
-
- if (!toCompileVariableName) {
- for (Iterator iter = tags.iterator(); iter.hasNext();) {
- TagElement tagEl = (TagElement) iter.next();
- if ("@j2sNativeSrc".equals(tagEl.getTagName())) {
- if (superVisit) super.visit(node);
- visitJavadocJ2SSource(tagEl);
- return false;
- }
- }
- }
+// boolean toCompileVariableName = false;//((ASTVariableVisitor) getAdaptable(ASTVariableVisitor.class)).isToCompileVariableName();
+//
+// if (!toCompileVariableName) {
+// for (Iterator iter = tags.iterator(); iter.hasNext();) {
+// TagElement tagEl = (TagElement) iter.next();
+// if ("@j2sNativeSrc".equals(tagEl.getTagName())) {
+// if (superVisit) super.visit(node);
+// visitJavadocJ2SSource(tagEl);
+// return false;
+// }
+// }
+// }
for (Iterator iter = tags.iterator(); iter.hasNext();) {
TagElement tagEl = (TagElement) iter.next();
if ("@j2sNative".equals(tagEl.getTagName())) {
diff --git a/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTTypeVisitor.java b/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTTypeVisitor.java
index 9d65ee074..fee90309b 100644
--- a/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTTypeVisitor.java
+++ b/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTTypeVisitor.java
@@ -125,51 +125,52 @@ public String shortenQualifiedName(String name) {
name = Bindings.removeBrackets(name);
int index = name.indexOf("java.lang.");
char ch = 0;
- if (index == 0
- && (name.indexOf('.', index + 10) == -1 || ((ch = name
- .charAt(index + 10)) >= 'A' && ch <= 'Z'))) {
- if (!name.startsWith("java.lang.ref")
- && !name.startsWith("java.lang.annotaion")
- && !name.startsWith("java.lang.instrument")
- && !name.startsWith("java.lang.management")) {
+ if (index == 0
+ && (name.indexOf('.', 10) == -1 || ((ch = name
+ .charAt(10)) >= 'A' && ch <= 'Z'))) {
+ // java.lang.String or java.lang.String.Xxx but not java.lang.xxx....
+// if (!name.startsWith("java.lang.ref") // as in "reflection"
+// && !name.startsWith("java.lang.annotaion") // spelled wrong?
+// && !name.startsWith("java.lang.instrument")
+// && !name.startsWith("java.lang.management")) {
name = name.substring(10);
- }
- }
- String swt = "org.eclipse.swt.SWT";
- index = name.indexOf(swt);
- if (index != -1) {
- String after = name.substring(swt.length());
- if (after.length() == 0 || after.startsWith(".")) {
- name = "$WT" + after;
- }
- } else {
- String os = "org.eclipse.swt.internal.browser.OS";
- index = name.indexOf(os);
- if (index != -1) {
- String after = name.substring(os.length());
- if (after.length() == 0 || after.startsWith(".")) {
- name = "O$" + after;
- }
- }
- }
- String xhtml = "org.eclipse.swt.internal.xhtml.";
- index = name.indexOf(xhtml);
- if (index != -1) {
- String after = name.substring(xhtml.length());
- name = after;
- }
- xhtml = "net.sf.j2s.html.";
- index = name.indexOf(xhtml);
- if (index != -1) {
- String after = name.substring(xhtml.length());
- name = after;
- }
- swt = "org.eclipse.swt";
- index = name.indexOf(swt);
- if (index != -1) {
- String after = name.substring(swt.length());
- name = "$wt" + after;
+// }
}
+// String swt = "org.eclipse.swt.SWT";
+// index = name.indexOf(swt);
+// if (index != -1) {
+// String after = name.substring(swt.length());
+// if (after.length() == 0 || after.startsWith(".")) {
+// name = "$WT" + after;
+// }
+// } else {
+// String os = "org.eclipse.swt.internal.browser.OS";
+// index = name.indexOf(os);
+// if (index != -1) {
+// String after = name.substring(os.length());
+// if (after.length() == 0 || after.startsWith(".")) {
+// name = "O$" + after;
+// }
+// }
+// }
+// String xhtml = "org.eclipse.swt.internal.xhtml.";
+// index = name.indexOf(xhtml);
+// if (index != -1) {
+// String after = name.substring(xhtml.length());
+// name = after;
+// }
+// xhtml = "net.sf.j2s.html.";
+// index = name.indexOf(xhtml);
+// if (index != -1) {
+// String after = name.substring(xhtml.length());
+// name = after;
+// }
+// swt = "org.eclipse.swt";
+// index = name.indexOf(swt);
+// if (index != -1) {
+// String after = name.substring(swt.length());
+// name = "$wt" + after;
+// }
return name;
}
diff --git a/sources/net.sf.j2s.core/src/j2s/jmol/common/IExtendedVisitor.java b/sources/net.sf.j2s.core/src/j2s/jmol/common/IExtendedVisitor.java
index 4360c3adf..00bdf0c9b 100644
--- a/sources/net.sf.j2s.core/src/j2s/jmol/common/IExtendedVisitor.java
+++ b/sources/net.sf.j2s.core/src/j2s/jmol/common/IExtendedVisitor.java
@@ -11,8 +11,8 @@
package j2s.jmol.common;
-import j2s.jmol.common.ASTScriptVisitor;
-import j2s.jmol.common.DependencyASTVisitor;
+import j2s.jmol.common.Java2ScriptScriptVisitor;
+import j2s.jmol.common.Java2ScriptDependencyVisitor;
/**
* @author zhou renjian
@@ -24,11 +24,11 @@ public interface IExtendedVisitor {
* Return visitor that generate scripts.
* @return
*/
- public ASTScriptVisitor getScriptVisitor();
+ public Java2ScriptScriptVisitor getScriptVisitor();
/**
* Return visitor for class dependencies.
* @return
*/
- public DependencyASTVisitor getDependencyVisitor();
+ public Java2ScriptDependencyVisitor getDependencyVisitor();
}
diff --git a/sources/net.sf.j2s.core/src/j2s/jmol/common/DependencyASTVisitor.java b/sources/net.sf.j2s.core/src/j2s/jmol/common/Java2ScriptDependencyVisitor.java
similarity index 79%
rename from sources/net.sf.j2s.core/src/j2s/jmol/common/DependencyASTVisitor.java
rename to sources/net.sf.j2s.core/src/j2s/jmol/common/Java2ScriptDependencyVisitor.java
index 075a1cc14..6a42164b6 100644
--- a/sources/net.sf.j2s.core/src/j2s/jmol/common/DependencyASTVisitor.java
+++ b/sources/net.sf.j2s.core/src/j2s/jmol/common/Java2ScriptDependencyVisitor.java
@@ -58,285 +58,663 @@
import org.eclipse.jdt.core.dom.TypeLiteral;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import j2s.core.Java2ScriptCompiler;
+
/**
+ * This class is called by root.accept(me) in the first pass of the
+ * transpiler to catalog all the references to classes and then later
+ * called by Java2ScriptVisitor to process those.
*
* @author zhou renjian
*
* 2006-5-2
*/
-public class DependencyASTVisitor extends ASTEmptyVisitor {
+public class Java2ScriptDependencyVisitor extends ASTEmptyVisitor {
+
+ private static class QNTypeBinding {
+ String qualifiedName;
+ ITypeBinding binding;
+
+ public boolean equals(Object obj) {
+ if (obj == null/* || !(obj instanceof QNTypeBinding)*/) {
+ return false;
+ }
+ if (obj instanceof String) {
+ return qualifiedName.equals(obj);
+ } else if (obj instanceof QNTypeBinding) {
+ QNTypeBinding b = (QNTypeBinding) obj;
+ return /*binding == b.binding &&*/ qualifiedName.equals(b.qualifiedName);
+ } else {
+ return false;
+ }
+ }
+
+ public int hashCode() {
+ return qualifiedName.hashCode();
+ }
+ }
+
+ private Java2ScriptCompiler compiler;
// BH 2023.11.10 interfaces as well must be ignored
+ public Java2ScriptDependencyVisitor(Java2ScriptCompiler compiler) {
+ this.compiler = compiler;
+ }
protected Set classNameSet = new HashSet();
protected Set classBindingSet = new HashSet();
- protected Set musts = new HashSet();
+ protected Set imports = new HashSet();
- protected Set requires = new HashSet();
+ protected Set j2sRequireImport = new HashSet();
- protected Set optionals = new HashSet();
+ protected Set j2sOptionalImport = new HashSet();
- protected Set ignores = new HashSet();
+ protected Set j2sIgnoreImport = new HashSet();
private boolean isDebugging = false;
+ public boolean isDebugging() {
+ return isDebugging;
+ }
+
+ public void setDebugging(boolean isDebugging) {
+ this.isDebugging = isDebugging;
+ }
+
private Javadoc[] nativeJavadoc = null;
private ASTNode javadocRoot = null;
- protected boolean toCompileVariableName = false; // BH 2023.11.12
-
- public String discardGenericType(String name) {
- return ((ASTTypeVisitor) getAdaptable(ASTTypeVisitor.class)).discardGenericType(name);
- }
+
+ ///////// initialization methods - from root.accept(me) ////////////
- public String getPackageName() {
- return ((ASTPackageVisitor) getAdaptable(ASTPackageVisitor.class)).getPackageName();
+ public boolean visit(PackageDeclaration node) {
+ ASTPackageVisitor packageVisitor = ((ASTPackageVisitor) getAdaptable(ASTPackageVisitor.class));
+ packageVisitor.setPackageName("" + node.getName());
+ return false;
}
- /**
- * @return Returns the thisClassName.
- */
- public String[] getClassNames() {
- return (String[]) classNameSet.toArray(new String[0]);
+
+
+ public boolean visit(ImportDeclaration node) {
+ return false;
}
- protected void checkSuperType(Set set) {
- Set removed = new HashSet();
- Set reseted = new HashSet();
- for (Iterator iter = set.iterator(); iter.hasNext();) {
- Object n = iter.next();
- if (n instanceof QNTypeBinding) {
- QNTypeBinding qn = (QNTypeBinding) n;
- boolean isRemoved = false;
- for (Iterator iterator = classBindingSet.iterator(); iterator
- .hasNext();) {
- ITypeBinding binding = (ITypeBinding) iterator.next();
- if (qn.binding != null && Bindings.isSuperType(binding, qn.binding)) {
- removed.add(qn);
- isRemoved = true;
- break;
- }
- }
- if (!isRemoved) {
- reseted.add(qn);
+ public void endVisit(ImportDeclaration node) {
+ super.endVisit(node);
+ if(node.isStatic()&&node.isOnDemand()) {
+ String qnameStr = node.getName().getFullyQualifiedName();
+ if(qnameStr!=null && !qnameStr.equals("") && isQualifiedNameOK(qnameStr, node)) {
+ if(!imports.contains(qnameStr)) {
+ imports.add(qnameStr);
}
}
}
- set.removeAll(removed);
- set.removeAll(reseted);
- for (Iterator i = reseted.iterator(); i.hasNext();) {
- QNTypeBinding qn = (QNTypeBinding) i.next();
- set.add(qn.qualifiedName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TypeDeclaration)
+ */
+ public boolean visit(TypeDeclaration node) {
+ ITypeBinding resolveBinding = node.resolveBinding();
+ if (resolveBinding != null && resolveBinding.isTopLevel()) {
+ String thisClassName = resolveBinding.getQualifiedName();
+ classNameSet.add(thisClassName);
+ classBindingSet.add(resolveBinding);
}
+ readTags(node);
+
+ visitForMusts(node);
+ visitForRequires(node);
+ visitForOptionals(node);
+ return super.visit(node);
}
-
- protected void remedyDependency(Set set) {
- String[] classNames = getClassNames();
- for (int i = 0; i < classNames.length; i++) {
- if ("net.sf.j2s.ajax.ASWTClass".equals(classNames[i])) {
- return;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TypeDeclaration)
+ */
+ public boolean visit(EnumDeclaration node) {
+ ITypeBinding resolveBinding = node.resolveBinding();
+ if (resolveBinding.isTopLevel()) {
+ String thisClassName = resolveBinding.getQualifiedName();
+ classNameSet.add(thisClassName);
+ classBindingSet.add(resolveBinding);
}
- List toRemoveList = new ArrayList();
- boolean needRemedy = false;;
- for (Iterator iterator = set.iterator(); iterator.hasNext();) {
- Object next = iterator.next();
- String name = null;
- if (next instanceof QNTypeBinding) {
- QNTypeBinding qn = (QNTypeBinding) next;
- name = qn.qualifiedName;
- } else {
- name = (String) next;
- }
- if ("net.sf.j2s.ajax.AClass".equals(name)
- || "net.sf.j2s.ajax.ASWTClass".equals(name)) {
- needRemedy = true;
- //break;
- }
- for (Iterator itr = classNameSet.iterator(); itr.hasNext();) {
- String className = (String) itr.next();
- if (name.startsWith(className + ".")) { // inner class dependency
- toRemoveList.add(next);
+ readTags(node);
+
+ imports.add("java.lang.Enum");
+ visitForMusts(node);
+ visitForRequires(node);
+ visitForOptionals(node);
+ return super.visit(node);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ClassInstanceCreation)
+ */
+ public boolean visit(ClassInstanceCreation node) {
+ ITypeBinding resolveTypeBinding = node.resolveTypeBinding();
+ QNTypeBinding qn = new QNTypeBinding();
+ String qualifiedName = null;
+ if (resolveTypeBinding != null && resolveTypeBinding.isAnonymous()) {
+ qualifiedName = node.getType().resolveBinding().getQualifiedName();
+ qn.binding = node.getType().resolveBinding();
+ } else if(resolveTypeBinding != null){
+ ITypeBinding declaringClass = resolveTypeBinding.getDeclaringClass();
+ if (declaringClass != null) {
+ ITypeBinding dclClass = null;
+ while ((dclClass = declaringClass.getDeclaringClass()) != null) {
+ declaringClass = dclClass;
}
+ qualifiedName = declaringClass.getQualifiedName();
+ qn.binding = declaringClass;
+ } else {
+ qualifiedName = resolveTypeBinding.getQualifiedName();
+ qn.binding = resolveTypeBinding;
}
+ }else{
+ return super.visit(node);
}
- if (needRemedy) {
- set.add("java.lang.reflect.Constructor");
- }
- for (Iterator iterator = toRemoveList.iterator(); iterator.hasNext();) {
- set.remove(iterator.next());
+ qualifiedName = discardGenericType(qualifiedName);
+ qn.qualifiedName = qualifiedName;
+ if (isQualifiedNameOK(qualifiedName, node)
+ && !imports.contains(qn)
+ && !j2sRequireImport.contains(qn)) {
+ j2sOptionalImport.add(qn);
}
+ return super.visit(node);
}
-
- public String getDependencyScript(StringBuffer mainJS) {
- checkSuperType(musts);
- checkSuperType(requires);
- checkSuperType(optionals);
- remedyDependency(musts);
- remedyDependency(requires);
- remedyDependency(optionals);
-
- musts.remove("");
- requires.remove("");
- optionals.remove("");
-
- for (Iterator iter = ignores.iterator(); iter.hasNext();) {
- String s = (String) iter.next();
- if (musts.contains(s)) {
- musts.remove(s);
- }
- if (requires.contains(s)) {
- requires.remove(s);
- }
- if (optionals.contains(s)) {
- optionals.remove(s);
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TypeLiteral)
+ *
+ * Foo.class
+ *
+ */
+ public boolean visit(TypeLiteral node) {
+ ITypeBinding resolveTypeBinding = node.getType().resolveBinding();
+ ITypeBinding declaringClass = resolveTypeBinding.getDeclaringClass();
+ QNTypeBinding qn = new QNTypeBinding();
+ String qualifiedName = null;
+ if (declaringClass != null) {
+ ITypeBinding dclClass = null;
+ while ((dclClass = declaringClass.getDeclaringClass()) != null) {
+ declaringClass = dclClass;
}
+ qualifiedName = declaringClass.getQualifiedName();
+ qn.binding = declaringClass;
+ } else {
+ qualifiedName = resolveTypeBinding.getQualifiedName();
+ qn.binding = resolveTypeBinding;
}
- for (Iterator iter = musts.iterator(); iter.hasNext();) {
- String s = (String) iter.next();
- if (requires.contains(s)) {
- requires.remove(s);
- }
- if (optionals.contains(s)) {
- optionals.remove(s);
- }
+ qualifiedName = discardGenericType(qualifiedName);
+ qn.qualifiedName = qualifiedName;
+ if (isQualifiedNameOK(qualifiedName, node)
+ && !imports.contains(qn)
+ && !j2sRequireImport.contains(qn)) {
+ j2sOptionalImport.add(qn);
}
- for (Iterator iter = requires.iterator(); iter.hasNext();) {
- String s = (String) iter.next();
- if (optionals.contains(s)) {
- optionals.remove(s);
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.FieldAccess)
+ *
+ * xxxx.Foo
+ *
+ */
+ public boolean visit(FieldAccess node) {
+ Object constValue = node.resolveConstantExpressionValue();
+ IVariableBinding resolveFieldBinding = node.resolveFieldBinding();
+ Expression exp = node.getExpression();
+ if (resolveFieldBinding != null && constValue == null && Modifier.isStatic(resolveFieldBinding.getModifiers())) {
+ Expression expression = exp;
+ if (expression instanceof Name) {
+ Name name = (Name) expression;
+ ITypeBinding resolveTypeBinding = name.resolveTypeBinding();
+ ITypeBinding declaringClass = resolveTypeBinding.getDeclaringClass();
+ QNTypeBinding qn = new QNTypeBinding();
+ String qualifiedName = null;
+ if (declaringClass != null) {
+ ITypeBinding dclClass = null;
+ while ((dclClass = declaringClass.getDeclaringClass()) != null) {
+ declaringClass = dclClass;
+ }
+ qualifiedName = declaringClass.getQualifiedName();
+ qn.binding = declaringClass;
+ } else {
+ qualifiedName = resolveTypeBinding.getQualifiedName();
+ qn.binding = resolveTypeBinding;
+ }
+ qualifiedName = discardGenericType(qualifiedName);
+ qn.qualifiedName = qualifiedName;
+ if (isQualifiedNameOK(qualifiedName, node)
+ && !imports.contains(qn)
+ && !j2sRequireImport.contains(qn)) {
+ j2sOptionalImport.add(qn);
+ }
+ }
+ } else if (constValue != null && (constValue instanceof Number
+ || constValue instanceof Character
+ || constValue instanceof Boolean)) {
+ if ((exp instanceof QualifiedName)
+ || (exp instanceof QualifiedName && isSimpleQualified((QualifiedName) exp))) {
+ return false;
}
}
- String js = mainJS.toString();
- if (musts.size() == 0 && requires.size() == 0 && optionals.size() == 0) {
- return js;
+ return super.visit(node);
+ }
+
+ public boolean visit(FieldDeclaration node) {
+ if (getJ2STag(node, "@j2sIgnore") != null) {
+ return false;
}
- StringBuffer buf = new StringBuffer();
- if (js.startsWith("Clazz.declarePackage")) {
- int index = js.indexOf("\r\n");
- buf.append(js.substring(0, index + 2));
- js = js.substring(index + 2);
+ return super.visit(node);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.
+ * MethodInvocation)
+ */
+ public boolean visit(MethodInvocation node) {
+ /*
+ * sgurin: last fix: returning to original version of the method because
+ * a bug was introduced in my last modifications.
+ */
+ IMethodBinding resolveMethodBinding = node.resolveMethodBinding();
+ if (resolveMethodBinding != null
+ && Modifier.isStatic(resolveMethodBinding.getModifiers())) {
+ Expression expression = node.getExpression();
+ if (expression instanceof Name) {
+ Name name = (Name) expression;
+ ITypeBinding resolveTypeBinding = name.resolveTypeBinding();
+ ITypeBinding declaringClass = resolveTypeBinding
+ .getDeclaringClass();
+ QNTypeBinding qn = new QNTypeBinding();
+ String qualifiedName = null;
+ if (declaringClass != null) {
+ ITypeBinding dclClass = null;
+ while ((dclClass = declaringClass.getDeclaringClass()) != null) {
+ declaringClass = dclClass;
+ }
+ qualifiedName = declaringClass.getQualifiedName();
+ qn.binding = declaringClass;
+ } else {
+ qualifiedName = resolveTypeBinding.getQualifiedName();
+ qn.binding = resolveTypeBinding;
+ }
+ qualifiedName = discardGenericType(qualifiedName);
+ qn.qualifiedName = qualifiedName;
+ if (isQualifiedNameOK(qualifiedName, node)
+ && !imports.contains(qn) && !j2sRequireImport.contains(qn)) {
+ j2sOptionalImport.add(qn);
+ }
+ }
}
+ return super.visit(node);
+ }
- if (ignores.size() > 0) {
- // BH 2023.11.10 interfaces as well and remove javax.sound.sampled.LineListener in the following case:
- // Clazz.instantialize (this, arguments);
- //}, org.jmol.util, "JmolAudio", null, [javax.sound.sampled.LineListener, org.jmol.api.JmolAudioPlayer]);
-
-
- int pt = js.indexOf("Clazz.instantialize");
- pt = (pt < 0 ? -1 : js.indexOf("},", pt));
- int pt1 = (pt < 0 ? -1 : js.indexOf("\r\n", pt + 2));
- if (pt1 > 0) {
- String js1 = js.substring(0, pt1);
- boolean fixed = false;
- for (Iterator iter = ignores.iterator(); iter.hasNext();) {
- String s = (String) iter.next();
- pt = js1.indexOf(s);
- if (pt > 2) {
- fixed = true;
- int len = s.length();
- if (js1.charAt(pt + len) == ',') {
- len += 2;
- } else if (js1.charAt(pt - 2) == ',') {
- len += 2;
- pt -= 2;
+ public boolean visit(Initializer node) {
+ if (getJ2STag(node, "@j2sIgnore") != null) {
+ return false;
+ }
+ return super.visit(node);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.QualifiedName)
+ */
+ public boolean visit(QualifiedName node) {
+ Object constValue = node.resolveConstantExpressionValue();
+ if (constValue != null && (constValue instanceof Number
+ || constValue instanceof Character
+ || constValue instanceof String
+ || constValue instanceof Boolean)
+ && isSimpleQualified(node)) {
+ //buffer.append(constValue);
+ return false;
+ }
+ return super.visit(node);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SimpleName)
+ */
+ public boolean visit(SimpleName node) {
+ Object constValue = node.resolveConstantExpressionValue();
+ if (constValue != null && (constValue instanceof Number
+ || constValue instanceof Character
+ || constValue instanceof Boolean)) {
+ return false;
+ }
+ ITypeBinding typeBinding = node.resolveTypeBinding();
+ IBinding binding = node.resolveBinding();
+ boolean isCasting = false;
+ boolean isQualified = false;
+ ASTNode nodeParent = node.getParent();
+ while (nodeParent != null && nodeParent instanceof QualifiedName) {
+ isQualified = true;
+ nodeParent = nodeParent.getParent();
+ }
+ if (nodeParent != null && nodeParent instanceof SimpleType) {
+ isCasting = true;
+ }
+ if (typeBinding != null && !isCasting && isQualified
+ && !(binding instanceof IVariableBinding)) {
+ QNTypeBinding qn = new QNTypeBinding();
+ String qualifiedName = null;
+ if (!typeBinding.isPrimitive()) {
+ if (typeBinding.isArray()) {
+ ITypeBinding elementType = typeBinding.getElementType();
+ while (elementType.isArray()) {
+ elementType = elementType.getElementType();
+ }
+ if (!elementType.isPrimitive()) {
+ ITypeBinding declaringClass = elementType.getDeclaringClass();
+ if (declaringClass != null) {
+ ITypeBinding dclClass = null;
+ while ((dclClass = declaringClass.getDeclaringClass()) != null) {
+ declaringClass = dclClass;
+ }
+ qualifiedName = declaringClass.getQualifiedName();
+ qn.binding = declaringClass;
+ } else {
+ qualifiedName = elementType.getQualifiedName();
+ qn.binding = elementType;
}
- js1 = js1.substring(0, pt) + js1.substring(pt + len);
+ }
+ } else {
+ ITypeBinding declaringClass = typeBinding.getDeclaringClass();
+ if (declaringClass != null) {
+ ITypeBinding dclClass = null;
+ while ((dclClass = declaringClass.getDeclaringClass()) != null) {
+ declaringClass = dclClass;
+ }
+ qualifiedName = declaringClass.getQualifiedName();
+ qn.binding = declaringClass;
+ } else {
+ qualifiedName = typeBinding.getQualifiedName();
+ qn.binding = typeBinding;
}
}
- if (fixed) {
- js = js1 + js.substring(pt1);
+ }
+ if (isQualifiedNameOK(qualifiedName, node)
+ && !imports.contains(qualifiedName)
+ && !j2sRequireImport.contains(qualifiedName)) {
+ qn.qualifiedName = qualifiedName;
+ j2sOptionalImport.add(qn);
+ }
+ } else if (binding instanceof IVariableBinding) {
+ IVariableBinding varBinding = (IVariableBinding) binding;
+ if ((varBinding.getModifiers() & Modifier.STATIC) != 0) {
+ QNTypeBinding qn = new QNTypeBinding();
+ String qualifiedName = null;
+
+ IVariableBinding variableDeclaration = varBinding.getVariableDeclaration();
+ ITypeBinding declaringClass = variableDeclaration.getDeclaringClass();
+
+ ITypeBinding dclClass = null;
+ while ((dclClass = declaringClass.getDeclaringClass()) != null) {
+ declaringClass = dclClass;
}
+ qualifiedName = declaringClass.getQualifiedName();
+ if (isQualifiedNameOK(qualifiedName, node)
+ && !imports.contains(qualifiedName)
+ && !j2sRequireImport.contains(qualifiedName)) {
+ qn.qualifiedName = qualifiedName;
+ j2sOptionalImport.add(qn);
+ }
+
}
+
}
- buf.append("Clazz.load (");
- if (musts.size() != 0 || requires.size() != 0) {
- buf.append("[");
- String[] ss = (String[]) musts.toArray(new String[0]);
- Arrays.sort(ss);
- String lastClassName = joinArrayClasses(buf, ss, null);
- if (musts.size() != 0 && requires.size() != 0) {
- buf.append(", ");
+ return super.visit(node);
+ }
+
+ public boolean visit(InstanceofExpression node) {
+ Type type = node.getRightOperand();
+ ITypeBinding resolveTypeBinding = type.resolveBinding();
+ QNTypeBinding qn = new QNTypeBinding();
+ String qualifiedName = resolveTypeBinding.getQualifiedName();
+ qn.binding = resolveTypeBinding;
+ qualifiedName = discardGenericType(qualifiedName);
+ qn.qualifiedName = qualifiedName;
+ if (isQualifiedNameOK(qualifiedName, node)
+ && !imports.contains(qn)
+ && !j2sRequireImport.contains(qn)) {
+ j2sOptionalImport.add(qn);
+ }
+ return super.visit(node);
+ }
+
+ public boolean visit(MethodDeclaration node) {
+ IMethodBinding mBinding = node.resolveBinding();
+ if (Bindings.isMethodInvoking(mBinding, "net.sf.j2s.ajax.SimplePipeRunnable", "deal")) {
+ ITypeBinding[] parameterTypes = mBinding.getParameterTypes();
+ if (parameterTypes != null && parameterTypes.length == 1) {
+ ITypeBinding paramType = parameterTypes[0];
+ ITypeBinding declaringClass = paramType.getDeclaringClass();
+ QNTypeBinding qn = new QNTypeBinding();
+ String qualifiedName = null;
+ if (declaringClass != null) {
+ qn.binding = declaringClass;
+ qualifiedName = declaringClass.getQualifiedName();
+ } else {
+ qn.binding = paramType;
+ qualifiedName = paramType.getQualifiedName();
+ }
+ qn.qualifiedName = discardGenericType(qualifiedName);
+ j2sOptionalImport.add(qn);
}
- ss = (String[]) requires.toArray(new String[0]);
- Arrays.sort(ss);
- joinArrayClasses(buf, ss, lastClassName);
- buf.append("], ");
- } else {
- buf.append("null, ");
}
- if (classNameSet.size() > 1) {
- buf.append("[");
+ boolean toBeIgnored = false;
+// if (Bindings.isMethodInvoking(mBinding, "net.sf.j2s.ajax.SimpleRPCRunnable", "ajaxRun")) {
+// toBeIgnored = true;
+// }
+// if (!toBeIgnored) {
+// String[] pipeMethods = new String[] {
+// "pipeSetup",
+// "pipeThrough",
+// "through",
+// "pipeMonitoring",
+// "pipeMonitoringInterval",
+// "pipeWaitClosingInterval",
+// "setPipeHelper"
+// };
+// for (int i = 0; i < pipeMethods.length; i++) {
+// if (Bindings.isMethodInvoking(mBinding, "net.sf.j2s.ajax.SimplePipeRunnable", pipeMethods[i])) {
+// toBeIgnored = true;
+// break;
+// }
+// }
+// }
+// if (!toBeIgnored) {
+// if (Bindings.isMethodInvoking(mBinding, "net.sf.j2s.ajax.CompoundPipeSession", "convert")) {
+// toBeIgnored = true;
+// }
+// }
+// if (toBeIgnored && getJ2STag(node, "@j2sKeep") == null) {
+// return false;
+// }
+
+ if (getJ2STag(node, "@j2sNative") != null) {
+ return false;
}
- joinArrayClasses(buf, getClassNames(), null);
- if (classNameSet.size() > 1) {
- buf.append("]");
+// if (getJ2STag(node, "@j2sNativeSrc") != null) {
+// return false;
+// }
+
+ if (getJ2STag(node, "@j2sIgnore") != null) {
+ return false;
}
- buf.append(", ");
- if (optionals.size() != 0) {
- buf.append("[");
- String[] ss = (String[]) optionals.toArray(new String[0]);
- Arrays.sort(ss);
- joinArrayClasses(buf, ss, null);
- buf.append("], ");
- } else {
- buf.append("null, ");
+
+ if (node.getBody() == null) {
+ /*
+ * Abstract or native method
+ */
+ return false;
}
- buf.append("function () {\r\n");
- buf.append(js);
- buf.append("});\r\n");
- return buf.toString();
- }
-
- public static String joinArrayClasses(StringBuffer buf, String[] ss, String last) {
- return joinArrayClasses(buf, ss, last, ", ");
+ return super.visit(node);
}
- public static String joinArrayClasses(StringBuffer buf, String[] ss, String last, String seperator) {
- String lastClassName = last;
- for (int i = 0; i < ss.length; i++) {
- buf.append("\"");
- boolean dollared = true;
- if (lastClassName == null) {
- dollared = false;
- } else {
- int idx1 = lastClassName.lastIndexOf('.');
- int idx2 = ss[i].lastIndexOf('.');
- if (idx1 == -1 || idx2 == -1 || idx1 != idx2) {
- dollared = false;
- } else {
- if (lastClassName.subSequence(0, idx1).equals(ss[i].subSequence(0, idx2))) {
- buf.append("$");
- buf.append(ss[i].substring(idx2));
- } else {
- dollared = false;
+ boolean visitNativeJavadoc(Javadoc javadoc, Block node, boolean superVisit) {
+ if (javadoc != null) {
+ List tags = javadoc.tags();
+ if (tags.size() != 0) {
+ for (Iterator iter = tags.iterator(); iter.hasNext();) {
+ TagElement tagEl = (TagElement) iter.next();
+ if ("@j2sIgnore".equals(tagEl.getTagName())) {
+ if (superVisit) super.visit(node);
+ return false;
+ }
+ }
+ if (isDebugging) {
+ for (Iterator iter = tags.iterator(); iter.hasNext();) {
+ TagElement tagEl = (TagElement) iter.next();
+ if ("@j2sDebug".equals(tagEl.getTagName())) {
+ if (superVisit) super.visit(node);
+ return false;
+ }
+ }
+ }
+// if (!toCompileVariableName) {
+// for (Iterator iter = tags.iterator(); iter.hasNext();) {
+// TagElement tagEl = (TagElement) iter.next();
+// if ("@j2sNativeSrc".equals(tagEl.getTagName())) {
+// if (superVisit) super.visit(node);
+// return false;
+// }
+// }
+// }
+ for (Iterator iter = tags.iterator(); iter.hasNext();) {
+ TagElement tagEl = (TagElement) iter.next();
+ if ("@j2sNative".equals(tagEl.getTagName())) {
+ if (superVisit) super.visit(node);
+ return false;
}
}
}
- if (!dollared) {
- String key = "org.eclipse.swt.";
- if (ss[i].startsWith(key)) {
- buf.append("$wt.");
- buf.append(ss[i].substring(key.length()));;
- } else {
- buf.append(ss[i]);
+ }
+ return true;
+ }
+
+ private void checkJavadocs(ASTNode root) {
+ if (root != javadocRoot) {
+ nativeJavadoc = null;
+ javadocRoot = root;
+ }
+ if (nativeJavadoc == null) {
+ nativeJavadoc = new Javadoc[0];
+ if (root instanceof CompilationUnit) {
+ CompilationUnit unit = (CompilationUnit) root;
+ List commentList = unit.getCommentList();
+ ArrayList list = new ArrayList();
+ for (Iterator iter = commentList.iterator(); iter.hasNext();) {
+ Comment comment = (Comment) iter.next();
+ if (comment instanceof Javadoc) {
+ Javadoc javadoc = (Javadoc) comment;
+ List tags = javadoc.tags();
+ if (tags.size() != 0) {
+ for (Iterator itr = tags.iterator(); itr.hasNext();) {
+ TagElement tagEl = (TagElement) itr.next();
+ String tagName = tagEl.getTagName();
+ if ("@j2sIgnore".equals(tagName)
+ || "@j2sDebug".equals(tagName)
+ || "@j2sNative".equals(tagName)) {
+ list.add(comment);
+ }
+ }
+ }
+ }
}
+ nativeJavadoc = (Javadoc[]) list.toArray(nativeJavadoc);
}
- lastClassName = ss[i];
- buf.append("\"");
- if (i != ss.length - 1) {
- buf.append(seperator);
+ }
+ }
+
+ private int getPreviousStartPosition(Block node) {
+ int previousStart = 0;
+ ASTNode blockParent = node.getParent();
+ if (blockParent != null) {
+ if (blockParent instanceof Statement) {
+ Statement sttmt = (Statement) blockParent;
+ previousStart = sttmt.getStartPosition();
+ if (sttmt instanceof Block) {
+ Block parentBlock = (Block) sttmt;
+ for (Iterator iter = parentBlock.statements().iterator(); iter.hasNext();) {
+ Statement element = (Statement) iter.next();
+ if (element == node) {
+ break;
+ }
+ previousStart = element.getStartPosition() + element.getLength();
+ }
+ } else if (sttmt instanceof IfStatement) {
+ IfStatement ifSttmt = (IfStatement) sttmt;
+ if (ifSttmt.getElseStatement() == node) {
+ Statement thenSttmt = ifSttmt.getThenStatement();
+ previousStart = thenSttmt.getStartPosition() + thenSttmt.getLength();
+ }
+ }
+ } else if (blockParent instanceof MethodDeclaration) {
+ MethodDeclaration method = (MethodDeclaration) blockParent;
+ previousStart = method.getStartPosition();
+ } else if (blockParent instanceof Initializer) {
+ Initializer initializer = (Initializer) blockParent;
+ previousStart = initializer.getStartPosition();
+ } else if (blockParent instanceof CatchClause) {
+ CatchClause catchClause = (CatchClause) blockParent;
+ previousStart = catchClause.getStartPosition();
}
}
- return lastClassName;
+ return previousStart;
}
+ /**
+ * Method with "j2s*" tag.
+ *
+ * @param node
+ * @return
+ */
+ protected Object getJ2STag(BodyDeclaration node, String tagName) {
+ List modifiers = node.modifiers();
+ for (Iterator iter = modifiers.iterator(); iter.hasNext();) {
+ Object obj = (Object) iter.next();
+ if (obj instanceof Annotation) {
+ Annotation annotation = (Annotation) obj;
+ String qName = annotation.getTypeName().getFullyQualifiedName();
+ int idx = qName.indexOf("J2S");
+ if (idx != -1) {
+ String annName = qName.substring(idx);
+ annName = annName.replaceFirst("J2S", "@j2s");
+ if (annName.startsWith(tagName)) {
+ return annotation;
+ }
+ }
+ }
+ }
+ Javadoc javadoc = node.getJavadoc();
+ if (javadoc != null) {
+ List tags = javadoc.tags();
+ if (tags.size() != 0) {
+ for (Iterator iter = tags.iterator(); iter.hasNext();) {
+ TagElement tagEl = (TagElement) iter.next();
+ if (tagName.equals(tagEl.getTagName())) {
+ return tagEl;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
public static void main(String[] args) {
Set set = new HashSet();
set.add ("java.lang.UnsupportedOperationException");
@@ -361,41 +739,17 @@ public static void main(String[] args) {
for (int i = 0; i < s.length; i++) {
set.add(s[i]);
}
- s = new String[] {
- "java.io.ObjectOutputStream", "java.text.SimpleDateFormat", "java.util.TimeZone", "java.lang.ClassNotFoundException", "java.io.ObjectInputStream", "java.lang.CloneNotSupportedException", "java.lang.IllegalArgumentException", "java.util.Locale", "java.io.IOException", "java.text.DateFormat", "java.util.GregorianCalendar", "java.util.Calendar", "java.lang.ref.SoftReference"
- };
- for (int i = 0; i < s.length; i++) {
- set.add(s[i]);
- }
- String[] ss = (String[]) set.toArray(new String[0]);
- StringBuffer buf = new StringBuffer();
- Arrays.sort(ss);
- joinArrayClasses(buf, ss, null);
- System.out.println(buf.toString().replaceAll(", ", ",\r\n\t"));
- }
-
-
- public boolean visit(ImportDeclaration node) {
- return false;
- }
-
- public boolean visit(PackageDeclaration node) {
- ASTPackageVisitor packageVisitor = ((ASTPackageVisitor) getAdaptable(ASTPackageVisitor.class));
- packageVisitor.setPackageName("" + node.getName());
- return false;
- }
-
- //sgurin - fix for bug http://sourceforge.net/tracker/?func=detail&aid=3037341&group_id=155436&atid=795800 with static imports
- public void endVisit(ImportDeclaration node) {
- super.endVisit(node);
- if(node.isStatic()&&node.isOnDemand()) {
- String qnameStr = node.getName().getFullyQualifiedName();
- if(qnameStr!=null && !qnameStr.equals("") && isQualifiedNameOK(qnameStr, node)) {
- if(!musts.contains(qnameStr)) {
- musts.add(qnameStr);
- }
- }
+ s = new String[] {
+ "java.io.ObjectOutputStream", "java.text.SimpleDateFormat", "java.util.TimeZone", "java.lang.ClassNotFoundException", "java.io.ObjectInputStream", "java.lang.CloneNotSupportedException", "java.lang.IllegalArgumentException", "java.util.Locale", "java.io.IOException", "java.text.DateFormat", "java.util.GregorianCalendar", "java.util.Calendar", "java.lang.ref.SoftReference"
+ };
+ for (int i = 0; i < s.length; i++) {
+ set.add(s[i]);
}
+ String[] ss = (String[]) set.toArray(new String[0]);
+ StringBuffer buf = new StringBuffer();
+ Arrays.sort(ss);
+ joinArrayClasses(buf, ss, null);
+ System.out.println(buf.toString().replaceAll(", ", ",\r\n\t"));
}
protected void readClasses(Annotation annotation, Set set) {
@@ -460,68 +814,6 @@ protected void readClasses(TagElement tagEl, Set set) {
}
}
}
- /* (non-Javadoc)
- * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TypeLiteral)
- */
- public boolean visit(TypeLiteral node) {
- ITypeBinding resolveTypeBinding = node.getType().resolveBinding();
- ITypeBinding declaringClass = resolveTypeBinding.getDeclaringClass();
- QNTypeBinding qn = new QNTypeBinding();
- String qualifiedName = null;
- if (declaringClass != null) {
- ITypeBinding dclClass = null;
- while ((dclClass = declaringClass.getDeclaringClass()) != null) {
- declaringClass = dclClass;
- }
- qualifiedName = declaringClass.getQualifiedName();
- qn.binding = declaringClass;
- } else {
- qualifiedName = resolveTypeBinding.getQualifiedName();
- qn.binding = resolveTypeBinding;
- }
- qualifiedName = discardGenericType(qualifiedName);
- qn.qualifiedName = qualifiedName;
- if (isQualifiedNameOK(qualifiedName, node)
- && !musts.contains(qn)
- && !requires.contains(qn)) {
- optionals.add(qn);
- }
- return false;
- }
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TypeDeclaration)
- */
- public boolean visit(TypeDeclaration node) {
- ITypeBinding resolveBinding = node.resolveBinding();
- if (resolveBinding != null && resolveBinding.isTopLevel()) {
- String thisClassName = resolveBinding.getQualifiedName();
- classNameSet.add(thisClassName);
- classBindingSet.add(resolveBinding);
- }
- readTags(node);
-
- visitForMusts(node);
- visitForRequires(node);
- visitForOptionals(node);
- return super.visit(node);
- }
-
- public boolean visit(FieldDeclaration node) {
- if (getJ2STag(node, "@j2sIgnore") != null) {
- return false;
- }
- return super.visit(node);
- }
-
- public boolean visit(Initializer node) {
- if (getJ2STag(node, "@j2sIgnore") != null) {
- return false;
- }
- return super.visit(node);
- }
-
private void readTags(AbstractTypeDeclaration node) {
Javadoc javadoc = node.getJavadoc();
if (javadoc != null) {
@@ -531,11 +823,11 @@ private void readTags(AbstractTypeDeclaration node) {
TagElement tagEl = (TagElement) iter.next();
String tagName = tagEl.getTagName();
if ("@j2sRequireImport".equals(tagName)) {
- readClasses(tagEl, requires);
+ readClasses(tagEl, j2sRequireImport);
} else if ("@j2sOptionalImport".equals(tagName)) {
- readClasses(tagEl, optionals);
+ readClasses(tagEl, j2sOptionalImport);
} else if ("@j2sIgnoreImport".equals(tagName)) {
- readClasses(tagEl, ignores);
+ readClasses(tagEl, j2sIgnoreImport);
}
}
}
@@ -551,36 +843,16 @@ private void readTags(AbstractTypeDeclaration node) {
String annName = qName.substring(idx);
annName = annName.replaceFirst("J2S", "@j2s");
if (annName.startsWith("@j2sRequireImport")) {
- readClasses(annotation, requires);
+ readClasses(annotation, j2sRequireImport);
} else if (annName.startsWith("@j2sOptionalImport")) {
- readClasses(annotation, optionals);
+ readClasses(annotation, j2sOptionalImport);
} else if (annName.startsWith("@j2sIgnoreImport")) {
- readClasses(annotation, ignores);
+ readClasses(annotation, j2sIgnoreImport);
}
}
}
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TypeDeclaration)
- */
- public boolean visit(EnumDeclaration node) {
- ITypeBinding resolveBinding = node.resolveBinding();
- if (resolveBinding.isTopLevel()) {
- String thisClassName = resolveBinding.getQualifiedName();
- classNameSet.add(thisClassName);
- classBindingSet.add(resolveBinding);
- }
- readTags(node);
-
- musts.add("java.lang.Enum");
- visitForMusts(node);
- visitForRequires(node);
- visitForOptionals(node);
- return super.visit(node);
- }
public boolean isClassKnown(String qualifiedName) {
String[] knownClasses = new String[] {
@@ -667,7 +939,7 @@ protected void visitForMusts(AbstractTypeDeclaration node) {
qualifiedName = discardGenericType(qualifiedName);
qn.qualifiedName = qualifiedName;
if (isQualifiedNameOK(qualifiedName, node)) {
- musts.add(qn);
+ imports.add(qn);
}
//musts.add(superBinding.getQualifiedName());
}
@@ -701,12 +973,12 @@ protected void visitForMusts(AbstractTypeDeclaration node) {
qualifiedName = discardGenericType(qualifiedName);
qn.qualifiedName = qualifiedName;
if (isQualifiedNameOK(qualifiedName, node)) {
- musts.add(qn);
+ imports.add(qn);
}
} else {
qn.qualifiedName = element.toString();
qn.binding = binding;
- musts.add(qn);
+ imports.add(qn);
}
}
}
@@ -723,664 +995,332 @@ protected void visitForRequires(AbstractTypeDeclaration node) {
isInteface = false;
}
if (isInteface || (node.getModifiers() & Modifier.STATIC) != 0) {
- DependencyASTVisitor visitor = getSelfVisitor();
+ Java2ScriptDependencyVisitor visitor = getSelfVisitor();
element.accept(visitor);
- requires.addAll(visitor.musts);
- requires.addAll(visitor.requires);
- requires.addAll(visitor.optionals);
+ j2sRequireImport.addAll(visitor.imports);
+ j2sRequireImport.addAll(visitor.j2sRequireImport);
+ j2sRequireImport.addAll(visitor.j2sOptionalImport);
}
} else if (element instanceof Initializer) {
if (getJ2STag((Initializer) element, "@j2sIgnore") != null) {
continue;
}
- DependencyASTVisitor visitor = getSelfVisitor();
+ Java2ScriptDependencyVisitor visitor = getSelfVisitor();
element.accept(this);
- requires.addAll(visitor.musts);
- requires.addAll(visitor.requires);
- requires.addAll(visitor.optionals);
+ j2sRequireImport.addAll(visitor.imports);
+ j2sRequireImport.addAll(visitor.j2sRequireImport);
+ j2sRequireImport.addAll(visitor.j2sOptionalImport);
} else if (element instanceof FieldDeclaration) {
- FieldDeclaration field = (FieldDeclaration) element;
- if (getJ2STag(field, "@j2sIgnore") != null) {
- continue;
- }
- List fragments = field.fragments();
- for (int j = 0; j < fragments.size(); j++) {
- VariableDeclarationFragment vdf = (VariableDeclarationFragment) fragments
- .get(j);
- Expression initializer = vdf.getInitializer();
- DependencyASTVisitor visitor = getSelfVisitor();
- if (initializer != null) {
- initializer.accept(visitor);
- }
- requires.addAll(visitor.musts);
- requires.addAll(visitor.requires);
- requires.addAll(visitor.optionals);
- }
- }
- }
- }
-
- private DependencyASTVisitor getSelfVisitor() {
- try {
- Object obj = this.getClass().getConstructor(new Class[0]).newInstance(new Object[0]);
- return (DependencyASTVisitor) obj;
- } catch (IllegalArgumentException e) {
- e.printStackTrace();
- } catch (SecurityException e) {
- e.printStackTrace();
- } catch (InstantiationException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- protected void visitForOptionals(AbstractTypeDeclaration node) {
-
- }
-
- protected boolean isSimpleQualified(QualifiedName node) {
- Name qualifier = node.getQualifier();
- if (qualifier instanceof SimpleName) {
- return true;
- } else if (qualifier instanceof QualifiedName) {
- return isSimpleQualified((QualifiedName) qualifier);
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.QualifiedName)
- */
- public boolean visit(QualifiedName node) {
- Object constValue = node.resolveConstantExpressionValue();
- if (constValue != null && (constValue instanceof Number
- || constValue instanceof Character
- || constValue instanceof String
- || constValue instanceof Boolean)
- && isSimpleQualified(node)) {
- //buffer.append(constValue);
- return false;
- }
- return super.visit(node);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SimpleName)
- */
- public boolean visit(SimpleName node) {
- Object constValue = node.resolveConstantExpressionValue();
- if (constValue != null && (constValue instanceof Number
- || constValue instanceof Character
- || constValue instanceof Boolean)) {
- return false;
- }
- ITypeBinding typeBinding = node.resolveTypeBinding();
- IBinding binding = node.resolveBinding();
- boolean isCasting = false;
- boolean isQualified = false;
- ASTNode nodeParent = node.getParent();
- while (nodeParent != null && nodeParent instanceof QualifiedName) {
- isQualified = true;
- nodeParent = nodeParent.getParent();
- }
- if (nodeParent != null && nodeParent instanceof SimpleType) {
- isCasting = true;
- }
- if (typeBinding != null && !isCasting && isQualified
- && !(binding instanceof IVariableBinding)) {
- QNTypeBinding qn = new QNTypeBinding();
- String qualifiedName = null;
- if (!typeBinding.isPrimitive()) {
- if (typeBinding.isArray()) {
- ITypeBinding elementType = typeBinding.getElementType();
- while (elementType.isArray()) {
- elementType = elementType.getElementType();
- }
- if (!elementType.isPrimitive()) {
- ITypeBinding declaringClass = elementType.getDeclaringClass();
- if (declaringClass != null) {
- ITypeBinding dclClass = null;
- while ((dclClass = declaringClass.getDeclaringClass()) != null) {
- declaringClass = dclClass;
- }
- qualifiedName = declaringClass.getQualifiedName();
- qn.binding = declaringClass;
- } else {
- qualifiedName = elementType.getQualifiedName();
- qn.binding = elementType;
- }
- }
- } else {
- ITypeBinding declaringClass = typeBinding.getDeclaringClass();
- if (declaringClass != null) {
- ITypeBinding dclClass = null;
- while ((dclClass = declaringClass.getDeclaringClass()) != null) {
- declaringClass = dclClass;
- }
- qualifiedName = declaringClass.getQualifiedName();
- qn.binding = declaringClass;
- } else {
- qualifiedName = typeBinding.getQualifiedName();
- qn.binding = typeBinding;
- }
- }
- }
- if (isQualifiedNameOK(qualifiedName, node)
- && !musts.contains(qualifiedName)
- && !requires.contains(qualifiedName)) {
- qn.qualifiedName = qualifiedName;
- optionals.add(qn);
- }
- } else if (binding instanceof IVariableBinding) {
- IVariableBinding varBinding = (IVariableBinding) binding;
- if ((varBinding.getModifiers() & Modifier.STATIC) != 0) {
- QNTypeBinding qn = new QNTypeBinding();
- String qualifiedName = null;
-
- IVariableBinding variableDeclaration = varBinding.getVariableDeclaration();
- ITypeBinding declaringClass = variableDeclaration.getDeclaringClass();
-
- ITypeBinding dclClass = null;
- while ((dclClass = declaringClass.getDeclaringClass()) != null) {
- declaringClass = dclClass;
- }
- qualifiedName = declaringClass.getQualifiedName();
- if (isQualifiedNameOK(qualifiedName, node)
- && !musts.contains(qualifiedName)
- && !requires.contains(qualifiedName)) {
- qn.qualifiedName = qualifiedName;
- optionals.add(qn);
- }
-
- }
-
- }
- return super.visit(node);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ClassInstanceCreation)
- */
- public boolean visit(ClassInstanceCreation node) {
- ITypeBinding resolveTypeBinding = node.resolveTypeBinding();
- QNTypeBinding qn = new QNTypeBinding();
- String qualifiedName = null;
- if (resolveTypeBinding != null && resolveTypeBinding.isAnonymous()) {
- qualifiedName = node.getType().resolveBinding().getQualifiedName();
- qn.binding = node.getType().resolveBinding();
- } else if(resolveTypeBinding != null){
- ITypeBinding declaringClass = resolveTypeBinding.getDeclaringClass();
- if (declaringClass != null) {
- ITypeBinding dclClass = null;
- while ((dclClass = declaringClass.getDeclaringClass()) != null) {
- declaringClass = dclClass;
+ FieldDeclaration field = (FieldDeclaration) element;
+ if (getJ2STag(field, "@j2sIgnore") != null) {
+ continue;
}
- qualifiedName = declaringClass.getQualifiedName();
- qn.binding = declaringClass;
- } else {
- qualifiedName = resolveTypeBinding.getQualifiedName();
- qn.binding = resolveTypeBinding;
+ List fragments = field.fragments();
+ for (int j = 0; j < fragments.size(); j++) {
+ VariableDeclarationFragment vdf = (VariableDeclarationFragment) fragments
+ .get(j);
+ Expression initializer = vdf.getInitializer();
+ Java2ScriptDependencyVisitor visitor = getSelfVisitor();
+ if (initializer != null) {
+ initializer.accept(visitor);
+ }
+ j2sRequireImport.addAll(visitor.imports);
+ j2sRequireImport.addAll(visitor.j2sRequireImport);
+ j2sRequireImport.addAll(visitor.j2sOptionalImport);
+ }
}
- }else{
- return super.visit(node);
- }
- qualifiedName = discardGenericType(qualifiedName);
- qn.qualifiedName = qualifiedName;
- if (isQualifiedNameOK(qualifiedName, node)
- && !musts.contains(qn)
- && !requires.contains(qn)) {
- optionals.add(qn);
}
- return super.visit(node);
}
- public boolean visit(InstanceofExpression node) {
- Type type = node.getRightOperand();
- ITypeBinding resolveTypeBinding = type.resolveBinding();
- QNTypeBinding qn = new QNTypeBinding();
- String qualifiedName = resolveTypeBinding.getQualifiedName();
- qn.binding = resolveTypeBinding;
- qualifiedName = discardGenericType(qualifiedName);
- qn.qualifiedName = qualifiedName;
- if (isQualifiedNameOK(qualifiedName, node)
- && !musts.contains(qn)
- && !requires.contains(qn)) {
- optionals.add(qn);
+ private Java2ScriptDependencyVisitor getSelfVisitor() {
+ try {
+ Object obj = this.getClass().getConstructor(new Class[0]).newInstance(new Object[0]);
+ return (Java2ScriptDependencyVisitor) obj;
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
}
- return super.visit(node);
+ return null;
+ }
+
+ protected void visitForOptionals(AbstractTypeDeclaration node) {
+
+ }
+
+ protected boolean isSimpleQualified(QualifiedName node) {
+ Name qualifier = node.getQualifier();
+ if (qualifier instanceof SimpleName) {
+ return true;
+ } else if (qualifier instanceof QualifiedName) {
+ return isSimpleQualified((QualifiedName) qualifier);
+ }
+ return false;
}
-// /* (non-Javadoc)
-// * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ArrayCreation)
-// */
-// public boolean visit(ArrayCreation node) {
-// ArrayType type = node.getType();
-// Type elementType = type.getElementType();
-// if (!elementType.isPrimitiveType()) {
-// ITypeBinding resolveTypeBinding = elementType.resolveBinding();
-// if(resolveTypeBinding != null){
-// ITypeBinding declaringClass = resolveTypeBinding.getDeclaringClass();
-// QNTypeBinding qn = new QNTypeBinding();
-// String qualifiedName = null;
-// if (declaringClass != null) {
-// ITypeBinding dclClass = null;
-// while ((dclClass = declaringClass.getDeclaringClass()) != null) {
-// declaringClass = dclClass;
-// }
-// qualifiedName = declaringClass.getQualifiedName();
-// qn.binding = declaringClass;
-// } else {
-// qualifiedName = resolveTypeBinding.getQualifiedName();
-// qn.binding = resolveTypeBinding;
-// }
-// qualifiedName = discardGenericType(qualifiedName);
-// qn.qualifiedName = qualifiedName;
-// if (isQualifiedNameOK(qualifiedName, node)
-// && !musts.contains(qn)
-// && !requires.contains(qn)) {
-// optionals.add(qn);
-// }
-// }
-// }
-// return super.visit(node);
-// }
+///////// delivery section -- from ASTScriptVisitor ///////////////
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.
- * MethodInvocation)
+ public String discardGenericType(String name) {
+ return ((ASTTypeVisitor) getAdaptable(ASTTypeVisitor.class)).discardGenericType(name);
+ }
+
+ public String getPackageName() {
+ return ((ASTPackageVisitor) getAdaptable(ASTPackageVisitor.class)).getPackageName();
+ }
+ /**
+ * @return Returns the thisClassName.
*/
- public boolean visit(MethodInvocation node) {
- /*
- * sgurin: last fix: returning to original version of the method because
- * a bug was introduced in my last modifications.
- */
- IMethodBinding resolveMethodBinding = node.resolveMethodBinding();
- if (resolveMethodBinding != null
- && Modifier.isStatic(resolveMethodBinding.getModifiers())) {
- Expression expression = node.getExpression();
- if (expression instanceof Name) {
- Name name = (Name) expression;
- ITypeBinding resolveTypeBinding = name.resolveTypeBinding();
- ITypeBinding declaringClass = resolveTypeBinding
- .getDeclaringClass();
- QNTypeBinding qn = new QNTypeBinding();
- String qualifiedName = null;
- if (declaringClass != null) {
- ITypeBinding dclClass = null;
- while ((dclClass = declaringClass.getDeclaringClass()) != null) {
- declaringClass = dclClass;
+ public String[] getClassNames() {
+ return (String[]) classNameSet.toArray(new String[0]);
+ }
+
+ protected void checkSuperType(Set set) {
+ Set removed = new HashSet();
+ Set reseted = new HashSet();
+ for (Iterator iter = set.iterator(); iter.hasNext();) {
+ Object n = iter.next();
+ if (n instanceof QNTypeBinding) {
+ QNTypeBinding qn = (QNTypeBinding) n;
+ boolean isRemoved = false;
+ for (Iterator iterator = classBindingSet.iterator(); iterator
+ .hasNext();) {
+ ITypeBinding binding = (ITypeBinding) iterator.next();
+ if (qn.binding != null && Bindings.isSuperType(binding, qn.binding)) {
+ removed.add(qn);
+ isRemoved = true;
+ break;
}
- qualifiedName = declaringClass.getQualifiedName();
- qn.binding = declaringClass;
- } else {
- qualifiedName = resolveTypeBinding.getQualifiedName();
- qn.binding = resolveTypeBinding;
}
- qualifiedName = discardGenericType(qualifiedName);
- qn.qualifiedName = qualifiedName;
- if (isQualifiedNameOK(qualifiedName, node)
- && !musts.contains(qn) && !requires.contains(qn)) {
- optionals.add(qn);
+ if (!isRemoved) {
+ reseted.add(qn);
}
}
}
- return super.visit(node);
- }
-
- public boolean isDebugging() {
- return isDebugging;
- }
-
- public void setDebugging(boolean isDebugging) {
- this.isDebugging = isDebugging;
+ set.removeAll(removed);
+ set.removeAll(reseted);
+ for (Iterator i = reseted.iterator(); i.hasNext();) {
+ QNTypeBinding qn = (QNTypeBinding) i.next();
+ set.add(qn.qualifiedName);
+ }
}
+
-// public boolean isToCompileVariableName() {
-// return toCompileVariableName;
-// }
-//
-// public void setToCompileVariableName(boolean toCompileVariableName) {
-// this.toCompileVariableName = toCompileVariableName;
-// }
-//
- public boolean visit(MethodDeclaration node) {
- IMethodBinding mBinding = node.resolveBinding();
- if (Bindings.isMethodInvoking(mBinding, "net.sf.j2s.ajax.SimplePipeRunnable", "deal")) {
- ITypeBinding[] parameterTypes = mBinding.getParameterTypes();
- if (parameterTypes != null && parameterTypes.length == 1) {
- ITypeBinding paramType = parameterTypes[0];
- ITypeBinding declaringClass = paramType.getDeclaringClass();
- QNTypeBinding qn = new QNTypeBinding();
- String qualifiedName = null;
- if (declaringClass != null) {
- qn.binding = declaringClass;
- qualifiedName = declaringClass.getQualifiedName();
- } else {
- qn.binding = paramType;
- qualifiedName = paramType.getQualifiedName();
- }
- qn.qualifiedName = discardGenericType(qualifiedName);
- optionals.add(qn);
+ protected void remedyDependency(Set set) {
+ String[] classNames = getClassNames();
+ for (int i = 0; i < classNames.length; i++) {
+ if ("net.sf.j2s.ajax.ASWTClass".equals(classNames[i])) {
+ return;
}
}
- boolean toBeIgnored = false;
- if (Bindings.isMethodInvoking(mBinding, "net.sf.j2s.ajax.SimpleRPCRunnable", "ajaxRun")) {
- toBeIgnored = true;
- }
- if (!toBeIgnored) {
- String[] pipeMethods = new String[] {
- "pipeSetup",
- "pipeThrough",
- "through",
- "pipeMonitoring",
- "pipeMonitoringInterval",
- "pipeWaitClosingInterval",
- "setPipeHelper"
- };
- for (int i = 0; i < pipeMethods.length; i++) {
- if (Bindings.isMethodInvoking(mBinding, "net.sf.j2s.ajax.SimplePipeRunnable", pipeMethods[i])) {
- toBeIgnored = true;
- break;
- }
+ List toRemoveList = new ArrayList();
+ boolean needRemedy = false;;
+ for (Iterator iterator = set.iterator(); iterator.hasNext();) {
+ Object next = iterator.next();
+ String name = null;
+ if (next instanceof QNTypeBinding) {
+ QNTypeBinding qn = (QNTypeBinding) next;
+ name = qn.qualifiedName;
+ } else {
+ name = (String) next;
}
- }
- if (!toBeIgnored) {
- if (Bindings.isMethodInvoking(mBinding, "net.sf.j2s.ajax.CompoundPipeSession", "convert")) {
- toBeIgnored = true;
+ if ("net.sf.j2s.ajax.AClass".equals(name)
+ || "net.sf.j2s.ajax.ASWTClass".equals(name)) {
+ needRemedy = true;
+ //break;
+ }
+ for (Iterator itr = classNameSet.iterator(); itr.hasNext();) {
+ String className = (String) itr.next();
+ if (name.startsWith(className + ".")) { // inner class dependency
+ toRemoveList.add(next);
+ }
}
}
- if (toBeIgnored && getJ2STag(node, "@j2sKeep") == null) {
- return false;
- }
-
- if (getJ2STag(node, "@j2sNative") != null) {
- return false;
- }
- if (getJ2STag(node, "@j2sNativeSrc") != null) {
- return false;
- }
-
- if (getJ2STag(node, "@j2sIgnore") != null) {
- return false;
+ if (needRemedy) {
+ set.add("java.lang.reflect.Constructor");
}
-
- if (node.getBody() == null) {
- /*
- * Abstract or native method
- */
- return false;
+ for (Iterator iterator = toRemoveList.iterator(); iterator.hasNext();) {
+ set.remove(iterator.next());
}
- return super.visit(node);
}
- /* (non-Javadoc)
- * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.FieldAccess)
- */
- public boolean visit(FieldAccess node) {
- Object constValue = node.resolveConstantExpressionValue();
- IVariableBinding resolveFieldBinding = node.resolveFieldBinding();
- Expression exp = node.getExpression();
- if (resolveFieldBinding != null && constValue == null && Modifier.isStatic(resolveFieldBinding.getModifiers())) {
- Expression expression = exp;
- if (expression instanceof Name) {
- Name name = (Name) expression;
- ITypeBinding resolveTypeBinding = name.resolveTypeBinding();
- ITypeBinding declaringClass = resolveTypeBinding.getDeclaringClass();
- QNTypeBinding qn = new QNTypeBinding();
- String qualifiedName = null;
- if (declaringClass != null) {
- ITypeBinding dclClass = null;
- while ((dclClass = declaringClass.getDeclaringClass()) != null) {
- declaringClass = dclClass;
- }
- qualifiedName = declaringClass.getQualifiedName();
- qn.binding = declaringClass;
- } else {
- qualifiedName = resolveTypeBinding.getQualifiedName();
- qn.binding = resolveTypeBinding;
- }
- qualifiedName = discardGenericType(qualifiedName);
- qn.qualifiedName = qualifiedName;
- if (isQualifiedNameOK(qualifiedName, node)
- && !musts.contains(qn)
- && !requires.contains(qn)) {
- optionals.add(qn);
- }
- }
- } else if (constValue != null && (constValue instanceof Number
- || constValue instanceof Character
- || constValue instanceof Boolean)) {
- if ((exp instanceof QualifiedName)
- || (exp instanceof QualifiedName && isSimpleQualified((QualifiedName) exp))) {
- return false;
+
+ public String getDependencyScript(StringBuffer mainJS) {
+ checkSuperType(imports);
+ checkSuperType(j2sRequireImport);
+ checkSuperType(j2sOptionalImport);
+ remedyDependency(imports);
+ remedyDependency(j2sRequireImport);
+ remedyDependency(j2sOptionalImport);
+
+ imports.remove("");
+ j2sRequireImport.remove("");
+ j2sOptionalImport.remove("");
+
+ for (Iterator iter = j2sIgnoreImport.iterator(); iter.hasNext();) {
+ String s = (String) iter.next();
+ if (imports.contains(s)) {
+ imports.remove(s);
+ }
+ if (j2sRequireImport.contains(s)) {
+ j2sRequireImport.remove(s);
+ }
+ if (j2sOptionalImport.contains(s)) {
+ j2sOptionalImport.remove(s);
}
}
-
- return super.visit(node);
- }
-
- public boolean visit(Block node) {
- ASTNode parent = node.getParent();
- if (parent instanceof MethodDeclaration) {
- MethodDeclaration method = (MethodDeclaration) parent;
- Javadoc javadoc = method.getJavadoc();
- /*
- * if comment contains "@j2sNative", then output the given native
- * JavaScript codes directly.
- */
- if (visitNativeJavadoc(javadoc, node, true) == false) {
- return false;
+ for (Iterator iter = imports.iterator(); iter.hasNext();) {
+ String s = (String) iter.next();
+ if (j2sRequireImport.contains(s)) {
+ j2sRequireImport.remove(s);
}
- } else if (parent instanceof Initializer) {
- Initializer initializer = (Initializer) parent;
- Javadoc javadoc = initializer.getJavadoc();
- /*
- * if comment contains "@j2sNative", then output the given native
- * JavaScript codes directly.
- */
- if (visitNativeJavadoc(javadoc, node, true) == false) {
- return false;
+ if (j2sOptionalImport.contains(s)) {
+ j2sOptionalImport.remove(s);
}
}
- int blockStart = node.getStartPosition();
- int previousStart = getPreviousStartPosition(node);
- ASTNode root = node.getRoot();
- checkJavadocs(root);
- //for (int i = 0; i < nativeJavadoc.length; i++) {
- for (int i = nativeJavadoc.length - 1; i >= 0; i--) {
- Javadoc javadoc = nativeJavadoc[i];
- int commentStart = javadoc.getStartPosition();
- if (commentStart > previousStart && commentStart < blockStart) {
- /*
- * if the block's leading comment contains "@j2sNative",
- * then output the given native JavaScript codes directly.
- */
- if (visitNativeJavadoc(javadoc, node, true) == false) {
- return false;
- }
+ for (Iterator iter = j2sRequireImport.iterator(); iter.hasNext();) {
+ String s = (String) iter.next();
+ if (j2sOptionalImport.contains(s)) {
+ j2sOptionalImport.remove(s);
}
}
- return super.visit(node);
- }
+
+ removeExcluded(j2sIgnoreImport);
+ removeExcluded(j2sRequireImport);
+ removeExcluded(j2sOptionalImport);
+
+ String js = mainJS.toString();
+ if (imports.size() == 0 && j2sRequireImport.size() == 0 && j2sOptionalImport.size() == 0) {
+ return js;
+ }
+ StringBuffer buf = new StringBuffer();
+ if (js.startsWith("Clazz.declarePackage")) {
+ int index = js.indexOf("\r\n");
+ buf.append(js.substring(0, index + 2));
+ js = js.substring(index + 2);
+ }
+
+ if (j2sIgnoreImport.size() > 0) {
+ // BH 2023.11.10 interfaces as well and remove javax.sound.sampled.LineListener in the following case:
+ // Clazz.instantialize (this, arguments);
+ //}, org.jmol.util, "JmolAudio", null, [javax.sound.sampled.LineListener, org.jmol.api.JmolAudioPlayer]);
- boolean visitNativeJavadoc(Javadoc javadoc, Block node, boolean superVisit) {
- if (javadoc != null) {
- List tags = javadoc.tags();
- if (tags.size() != 0) {
- for (Iterator iter = tags.iterator(); iter.hasNext();) {
- TagElement tagEl = (TagElement) iter.next();
- if ("@j2sIgnore".equals(tagEl.getTagName())) {
- if (superVisit) super.visit(node);
- return false;
- }
- }
- if (isDebugging) {
- for (Iterator iter = tags.iterator(); iter.hasNext();) {
- TagElement tagEl = (TagElement) iter.next();
- if ("@j2sDebug".equals(tagEl.getTagName())) {
- if (superVisit) super.visit(node);
- return false;
- }
- }
- }
- if (!toCompileVariableName) {
- for (Iterator iter = tags.iterator(); iter.hasNext();) {
- TagElement tagEl = (TagElement) iter.next();
- if ("@j2sNativeSrc".equals(tagEl.getTagName())) {
- if (superVisit) super.visit(node);
- return false;
+
+ int pt = js.indexOf("Clazz.instantialize");
+ pt = (pt < 0 ? -1 : js.indexOf("},", pt));
+ int pt1 = (pt < 0 ? -1 : js.indexOf("\r\n", pt + 2));
+ if (pt1 > 0) {
+ String js1 = js.substring(0, pt1);
+ boolean fixed = false;
+ for (Iterator iter = j2sIgnoreImport.iterator(); iter.hasNext();) {
+ String s = (String) iter.next();
+ pt = js1.indexOf(s);
+ if (pt > 2) {
+ fixed = true;
+ int len = s.length();
+ if (js1.charAt(pt + len) == ',') {
+ len += 2;
+ } else if (js1.charAt(pt - 2) == ',') {
+ len += 2;
+ pt -= 2;
}
+ js1 = js1.substring(0, pt) + js1.substring(pt + len);
}
}
- for (Iterator iter = tags.iterator(); iter.hasNext();) {
- TagElement tagEl = (TagElement) iter.next();
- if ("@j2sNative".equals(tagEl.getTagName())) {
- if (superVisit) super.visit(node);
- return false;
- }
+ if (fixed) {
+ js = js1 + js.substring(pt1);
}
}
}
- return true;
- }
-
- private void checkJavadocs(ASTNode root) {
- if (root != javadocRoot) {
- nativeJavadoc = null;
- javadocRoot = root;
- }
- if (nativeJavadoc == null) {
- nativeJavadoc = new Javadoc[0];
- if (root instanceof CompilationUnit) {
- CompilationUnit unit = (CompilationUnit) root;
- List commentList = unit.getCommentList();
- ArrayList list = new ArrayList();
- for (Iterator iter = commentList.iterator(); iter.hasNext();) {
- Comment comment = (Comment) iter.next();
- if (comment instanceof Javadoc) {
- Javadoc javadoc = (Javadoc) comment;
- List tags = javadoc.tags();
- if (tags.size() != 0) {
- for (Iterator itr = tags.iterator(); itr.hasNext();) {
- TagElement tagEl = (TagElement) itr.next();
- String tagName = tagEl.getTagName();
- if ("@j2sIgnore".equals(tagName)
- || "@j2sDebug".equals(tagName)
- || "@j2sNative".equals(tagName)) {
- list.add(comment);
- }
- }
- }
- }
- }
- nativeJavadoc = (Javadoc[]) list.toArray(nativeJavadoc);
+ buf.append("Clazz.load (");
+ if (imports.size() != 0 || j2sRequireImport.size() != 0) {
+ buf.append("[");
+ String[] ss = (String[]) imports.toArray(new String[0]);
+ Arrays.sort(ss);
+ String lastClassName = joinArrayClasses(buf, ss, null);
+ if (imports.size() != 0 && j2sRequireImport.size() != 0) {
+ buf.append(", ");
}
+ ss = (String[]) j2sRequireImport.toArray(new String[0]);
+ Arrays.sort(ss);
+ joinArrayClasses(buf, ss, lastClassName);
+ buf.append("], ");
+ } else {
+ buf.append("null, ");
+ }
+ if (classNameSet.size() > 1) {
+ buf.append("[");
+ }
+ joinArrayClasses(buf, getClassNames(), null);
+ if (classNameSet.size() > 1) {
+ buf.append("]");
+ }
+ buf.append(", ");
+ if (j2sOptionalImport.size() != 0) {
+ buf.append("[");
+ String[] ss = (String[]) j2sOptionalImport.toArray(new String[0]);
+ Arrays.sort(ss);
+ joinArrayClasses(buf, ss, null);
+ buf.append("], ");
+ } else {
+ buf.append("null, ");
}
+ buf.append("function () {\r\n");
+ buf.append(js);
+ buf.append("});\r\n");
+ return buf.toString();
}
- private int getPreviousStartPosition(Block node) {
- int previousStart = 0;
- ASTNode blockParent = node.getParent();
- if (blockParent != null) {
- if (blockParent instanceof Statement) {
- Statement sttmt = (Statement) blockParent;
- previousStart = sttmt.getStartPosition();
- if (sttmt instanceof Block) {
- Block parentBlock = (Block) sttmt;
- for (Iterator iter = parentBlock.statements().iterator(); iter.hasNext();) {
- Statement element = (Statement) iter.next();
- if (element == node) {
- break;
- }
- previousStart = element.getStartPosition() + element.getLength();
- }
- } else if (sttmt instanceof IfStatement) {
- IfStatement ifSttmt = (IfStatement) sttmt;
- if (ifSttmt.getElseStatement() == node) {
- Statement thenSttmt = ifSttmt.getThenStatement();
- previousStart = thenSttmt.getStartPosition() + thenSttmt.getLength();
- }
- }
- } else if (blockParent instanceof MethodDeclaration) {
- MethodDeclaration method = (MethodDeclaration) blockParent;
- previousStart = method.getStartPosition();
- } else if (blockParent instanceof Initializer) {
- Initializer initializer = (Initializer) blockParent;
- previousStart = initializer.getStartPosition();
- } else if (blockParent instanceof CatchClause) {
- CatchClause catchClause = (CatchClause) blockParent;
- previousStart = catchClause.getStartPosition();
- }
- }
- return previousStart;
+ public static String joinArrayClasses(StringBuffer buf, String[] ss, String last) {
+ return joinArrayClasses(buf, ss, last, ", ");
}
- /**
- * Method with "j2s*" tag.
- *
- * @param node
- * @return
- */
- protected Object getJ2STag(BodyDeclaration node, String tagName) {
- List modifiers = node.modifiers();
- for (Iterator iter = modifiers.iterator(); iter.hasNext();) {
- Object obj = (Object) iter.next();
- if (obj instanceof Annotation) {
- Annotation annotation = (Annotation) obj;
- String qName = annotation.getTypeName().getFullyQualifiedName();
- int idx = qName.indexOf("J2S");
- if (idx != -1) {
- String annName = qName.substring(idx);
- annName = annName.replaceFirst("J2S", "@j2s");
- if (annName.startsWith(tagName)) {
- return annotation;
+ public static String joinArrayClasses(StringBuffer buf, String[] ss, String last, String seperator) {
+ String lastClassName = last;
+ for (int i = 0; i < ss.length; i++) {
+ buf.append("\"");
+ boolean dollared = true;
+ if (lastClassName == null) {
+ dollared = false;
+ } else {
+ int idx1 = lastClassName.lastIndexOf('.');
+ int idx2 = ss[i].lastIndexOf('.');
+ if (idx1 == -1 || idx2 == -1 || idx1 != idx2) {
+ dollared = false;
+ } else {
+ if (lastClassName.subSequence(0, idx1).equals(ss[i].subSequence(0, idx2))) {
+ buf.append("$");
+ buf.append(ss[i].substring(idx2));
+ } else {
+ dollared = false;
}
}
}
- }
- Javadoc javadoc = node.getJavadoc();
- if (javadoc != null) {
- List tags = javadoc.tags();
- if (tags.size() != 0) {
- for (Iterator iter = tags.iterator(); iter.hasNext();) {
- TagElement tagEl = (TagElement) iter.next();
- if (tagName.equals(tagEl.getTagName())) {
- return tagEl;
- }
+ if (!dollared) {
+ String key = "org.eclipse.swt.";
+ if (ss[i].startsWith(key)) {
+ buf.append("$wt.");
+ buf.append(ss[i].substring(key.length()));;
+ } else {
+ buf.append(ss[i]);
}
}
+ lastClassName = ss[i];
+ buf.append("\"");
+ if (i != ss.length - 1) {
+ buf.append(seperator);
+ }
}
- return null;
+ return lastClassName;
}
-
-}
-
-class QNTypeBinding {
- String qualifiedName;
- ITypeBinding binding;
- public boolean equals(Object obj) {
- if (obj == null/* || !(obj instanceof QNTypeBinding)*/) {
- return false;
- }
- if (obj instanceof String) {
- return qualifiedName.equals(obj);
- } else if (obj instanceof QNTypeBinding) {
- QNTypeBinding b = (QNTypeBinding) obj;
- return /*binding == b.binding &&*/ qualifiedName.equals(b.qualifiedName);
- } else {
- return false;
- }
- }
- public int hashCode() {
- return qualifiedName.hashCode();
- }
-
+
}
+
diff --git a/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTScriptVisitor.java b/sources/net.sf.j2s.core/src/j2s/jmol/common/Java2ScriptScriptVisitor.java
similarity index 91%
rename from sources/net.sf.j2s.core/src/j2s/jmol/common/ASTScriptVisitor.java
rename to sources/net.sf.j2s.core/src/j2s/jmol/common/Java2ScriptScriptVisitor.java
index c2de871f1..9fb26c405 100644
--- a/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTScriptVisitor.java
+++ b/sources/net.sf.j2s.core/src/j2s/jmol/common/Java2ScriptScriptVisitor.java
@@ -64,22 +64,33 @@
import org.eclipse.jdt.core.dom.PrimitiveType.Code;
/**
- * ASTScriptVisitor has to solve the following compiling problems:
+ * Formerly ASTScriptVisitor
+ *
+ * This classs has to solve the following compiling problems:
+ *
* 1. Field and method names:
+ *
* 1.1 Java and JavaScript keywords;
+ *
* 1.2 super;
+ *
* 1.3 private;
+ *
* 1.4 .j2smap;
+ *
* 1.5 ...
+ *
* 2. Final variables
+ *
* 3. @-j2s* tags
+ *
* 4.
*
* @author zhou renjian
*
* 2006-12-3
*/
-public class ASTScriptVisitor extends ASTJ2SDocVisitor {
+public class Java2ScriptScriptVisitor extends ASTJ2SDocVisitor {
// UNFIXED bugs: no boxing/unboxing in Legacy!
//
@@ -144,19 +155,22 @@ public String getTypeStringName(Type type) {
}
protected String getFieldName(ITypeBinding binding, String name) {
- return ((ASTJ2SMapVisitor) getAdaptable(ASTJ2SMapVisitor.class)).getFieldName(binding, name);
+ return NameInheritanceChecker.getFieldName(binding, name);
}
protected String getJ2SName(SimpleName node) {
- return ((ASTJ2SMapVisitor) getAdaptable(ASTJ2SMapVisitor.class)).getJ2SName(node);
+ IBinding binding = node.resolveBinding();
+ return (binding instanceof IVariableBinding || binding instanceof IMethodBinding ? binding.getName() : node.getIdentifier());
+// return NameInheritanceChecker.getJ2SName(node);
}
protected String getJ2SName(IVariableBinding binding) {
- return ((ASTJ2SMapVisitor) getAdaptable(ASTJ2SMapVisitor.class)).getJ2SName(binding);
+ return binding.getName();
+// return NameInheritanceChecker.getJ2SName(binding);
}
protected boolean isInheritedFieldName(ITypeBinding binding, String name) {
- return ((ASTJ2SMapVisitor) getAdaptable(ASTJ2SMapVisitor.class)).isInheritedFieldName(binding, name);
+ return NameInheritanceChecker.isInheritedFieldName(binding, name);
}
protected boolean checkKeyworkViolation(String name) {
@@ -164,7 +178,7 @@ protected boolean checkKeyworkViolation(String name) {
}
protected boolean checkSameName(ITypeBinding binding, String name) {
- return ((ASTJ2SMapVisitor) getAdaptable(ASTJ2SMapVisitor.class)).checkSameName(binding, name);
+ return NameInheritanceChecker.checkSameName(binding, name);
}
public boolean isIntegerType(String type) {
@@ -1172,11 +1186,11 @@ public boolean visit(EnumDeclaration node) {
}
if ((node != rootTypeNode) && node.getParent() != null && node.getParent() instanceof AbstractTypeDeclaration) {
/* inner static class */
- ASTScriptVisitor visitor = null;
+ Java2ScriptScriptVisitor visitor = null;
try {
- visitor = (ASTScriptVisitor) this.getClass().newInstance();
+ visitor = (Java2ScriptScriptVisitor) this.getClass().newInstance();
} catch (Exception e) {
- visitor = new ASTScriptVisitor(); // Default visitor
+ visitor = new Java2ScriptScriptVisitor(); // Default visitor
}
visitor.rootTypeNode = node;
// visitor.thisClassName = thisClassName + "." + node.getName();
@@ -2046,12 +2060,12 @@ private boolean checkJ2STags(MethodDeclaration node, boolean needScope) {
if (isDebugging()) {
read = readSources(node, "@j2sDebug", prefix, suffix, false);
}
- if (!read) {
- boolean toCompileVariableName = false;//((ASTVariableVisitor) getAdaptable(ASTVariableVisitor.class)).isToCompileVariableName();
- if (!toCompileVariableName) {
- read = readSources(node, "@j2sNativeSrc", prefix, suffix, false);
- }
- }
+// if (!read) {
+// boolean toCompileVariableName = false;//((ASTVariableVisitor) getAdaptable(ASTVariableVisitor.class)).isToCompileVariableName();
+// if (!toCompileVariableName) {
+// read = readSources(node, "@j2sNativeSrc", prefix, suffix, false);
+// }
+// }
if (!read) {
read = readSources(node, "@j2sNative", prefix, suffix, false);
}
@@ -3331,11 +3345,11 @@ public boolean visit(TypeDeclaration node) {
&& (node.getParent() instanceof AbstractTypeDeclaration
|| node.getParent() instanceof TypeDeclarationStatement)) {
/* inner static class */
- ASTScriptVisitor visitor = null;
+ Java2ScriptScriptVisitor visitor = null;
try {
- visitor = (ASTScriptVisitor) this.getClass().newInstance();
+ visitor = (Java2ScriptScriptVisitor) this.getClass().newInstance();
} catch (Exception e) {
- visitor = new ASTScriptVisitor(); // Default visitor
+ visitor = new Java2ScriptScriptVisitor(); // Default visitor
}
visitor.rootTypeNode = node;
String className = typeVisitor.getClassName();
@@ -3523,4 +3537,198 @@ public boolean visit(TypeLiteral node) {
return false;
}
+ /**
+ * Was ASTJ2sMapVisitor
+ *
+ * .j2smap is not implemented for Jmol.
+ *
+ * This class now is used to check for overloaded names in
+ * superclasses so that $ can be prepended if necesssary
+ *
+ *
+ * @author zhou renjian
+ *
+ * 2006-12-3
+ */
+ private static class NameInheritanceChecker {
+
+// private static Map maps;
+ //
+// /**
+// * Set .j2smap
+// * Please also read net.sf.j2s.java.org.eclipse.swt/.j2smap file.
+// *
+// * @param m
+// */
+// public static void setJ2SMap(Map m) {
+// maps = m;
+// }
+
+ static String getJ2SName(SimpleName node) {
+ IBinding binding = node.resolveBinding();
+ return (binding instanceof IVariableBinding || binding instanceof IMethodBinding ? binding.getName() : node.getIdentifier());
+// if (binding == null) return node.getIdentifier();
+// if (binding instanceof IVariableBinding) {
+// return getJ2SName((IVariableBinding) binding);
+// }
+// if (binding instanceof IMethodBinding) {
+// return getJ2SName((IMethodBinding) binding);
+// }
+// String nameID = node.getIdentifier();
+// return nameID;
+ }
+
+// static String getJ2SName(IVariableBinding binding) {
+// String nameID = binding.getName();
+// if (maps == null || maps.size() == 0) {
+// return nameID;
+// }
+// String className = null;
+// IVariableBinding varBinding = (IVariableBinding) binding;
+// ITypeBinding declaringClass = varBinding.getDeclaringClass();
+// if (declaringClass != null) {
+// className = declaringClass.getQualifiedName();
+// }
+//
+// String key = className + "." + nameID;
+// Object value = maps.get(key);
+// if (value != null && value instanceof NameConvertItem) {
+// NameConvertItem item = (NameConvertItem) value;
+// return item.toVarName;
+// }
+// return nameID;
+// }
+
+// private static String getJ2SName(IMethodBinding binding) {
+// String nameID = binding.getName();
+// if (maps == null || maps.size() == 0) {
+// return nameID;
+// }
+// String className = null;
+// IMethodBinding methodBinding = (IMethodBinding) binding;
+// ITypeBinding declaringClass = methodBinding.getDeclaringClass();
+// ITypeBinding superclass = declaringClass.getSuperclass();
+// while (superclass != null) {
+// IMethodBinding[] declaredMethods = superclass.getDeclaredMethods();
+// for (int i = 0; i < declaredMethods.length; i++) {
+// String methodName = declaredMethods[i].getName();
+// if (nameID.equals(methodName)) {
+// return getJ2SName(declaredMethods[i]);
+// }
+// }
+// superclass = superclass.getSuperclass();
+// }
+// if (declaringClass != null) {
+// className = declaringClass.getQualifiedName();
+// }
+// String key = className + "#" + nameID;
+// Object value = maps.get(key);
+// if (value != null && value instanceof NameConvertItem) {
+// NameConvertItem item = (NameConvertItem) value;
+// return item.toVarName;
+// }
+// return nameID;
+// }
+
+ public static boolean checkSameName(ITypeBinding binding, String name) {
+ if (binding != null) {
+ IMethodBinding[] declaredMethods = binding.getDeclaredMethods();
+ for (int i = 0; i < declaredMethods.length; i++) {
+// String methodName = getJ2SName(declaredMethods[i]);
+// if (name.equals(methodName)) {
+ if (name.equals(declaredMethods[i].getName())) {
+ return true;
+ }
+ }
+ ITypeBinding superclass = binding.getSuperclass();
+ if (checkSameName(superclass, name)) {
+ return true;
+ }
+ ITypeBinding[] interfaces = binding.getInterfaces();
+ if (interfaces != null) {
+ for (int i = 0; i < interfaces.length; i++) {
+ if (checkSameName(interfaces[i], name)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+
+ static String getFieldName(ITypeBinding binding, String name) {
+ if (binding != null) {
+ ITypeBinding superclass = binding.getSuperclass();
+ if (superclass != null) {
+ StringBuffer buffer = new StringBuffer();
+ IVariableBinding[] declaredFields = superclass.getDeclaredFields();
+ for (int i = 0; i < declaredFields.length; i++) {
+ //String fieldName = getJ2SName(declaredFields[i]);
+ if (name.equals(declaredFields[i].getName())) {
+ buffer.append("$");
+ }
+ }
+ buffer.append(getFieldName(superclass, name));
+ return buffer.toString();
+ }
+ }
+ return name;
+ }
+
+ /**
+ * Check whether the given field name is already defined in super types
+ * or not.
+ *
+ * The algorithm:
+ * 1. Check binding self class/interface fields
+ * 2. Check binding super class
+ * 3. Check binding interfaces
+ *
+ * @param binding
+ * @param name
+ * @return
+ */
+ static boolean isInheritedFieldName(ITypeBinding binding, String name) {
+ if ("serialVersionUID".equals(name)) {
+ /*
+ * Just ignore this field: serialVersionUID.
+ * Currently Java2Script does not support Java serialization but
+ * support Java2Script's own Simple RPC serialization, which does
+ * not care about serialVersionID.
+ */
+ return false;
+ }
+ if (binding == null) {
+ return false;
+ }
+ ITypeBinding superclass = binding.getSuperclass();
+ IVariableBinding[] declaredFields = null;
+ if (superclass != null) {
+ declaredFields = superclass.getDeclaredFields();
+ } else { // Interface
+ declaredFields = binding.getDeclaredFields();
+ }
+ for (int i = 0; i < declaredFields.length; i++) {
+ //String fieldName = getJ2SName(declaredFields[i]);
+ if (name.equals(declaredFields[i].getName())) {//fieldName) {) {
+ return true;
+ }
+ }
+ if (isInheritedFieldName(superclass, name)) {
+ return true;
+ }
+ ITypeBinding[] interfaces = binding.getInterfaces();
+ if (interfaces != null) {
+ for (int i = 0; i < interfaces.length; i++) {
+ if (isInheritedFieldName(interfaces[i], name)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ }
+
}
diff --git a/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTExtendedVisitor.java b/sources/net.sf.j2s.core/unused/ASTExtendedVisitor.java
similarity index 100%
rename from sources/net.sf.j2s.core/src/j2s/jmol/common/ASTExtendedVisitor.java
rename to sources/net.sf.j2s.core/unused/ASTExtendedVisitor.java
diff --git a/sources/net.sf.j2s.core/src/j2s/jmol/common/ASTJ2SMapVisitor.java b/sources/net.sf.j2s.core/unused/ASTJ2SMapVisitor.java
similarity index 100%
rename from sources/net.sf.j2s.core/src/j2s/jmol/common/ASTJ2SMapVisitor.java
rename to sources/net.sf.j2s.core/unused/ASTJ2SMapVisitor.java
diff --git a/sources/net.sf.j2s.core/src/j2s/jmol/common/NameConvertItem.java b/sources/net.sf.j2s.core/unused/NameConvertItem.java
similarity index 100%
rename from sources/net.sf.j2s.core/src/j2s/jmol/common/NameConvertItem.java
rename to sources/net.sf.j2s.core/unused/NameConvertItem.java
diff --git a/sources/net.sf.j2s.java.core/.classpath b/sources/net.sf.j2s.java.core/.classpath
index 4d92cbdb0..ac4bfb95a 100644
--- a/sources/net.sf.j2s.java.core/.classpath
+++ b/sources/net.sf.j2s.java.core/.classpath
@@ -1,7 +1,7 @@
-
-
+
+
diff --git a/sources/net.sf.j2s.java.core/build-jmol-j2s-site-zip.xml b/sources/net.sf.j2s.java.core/build-jmol-j2s-site-zip.xml
index 840aa1f2f..4fa9018b3 100644
--- a/sources/net.sf.j2s.java.core/build-jmol-j2s-site-zip.xml
+++ b/sources/net.sf.j2s.java.core/build-jmol-j2s-site-zip.xml
@@ -2,6 +2,7 @@
+
@@ -21,7 +22,7 @@
creating and compressing core files - warnings are OK; "does not exist" is trouble
creating dist/Jmol-j2s-site.zip
-
+
diff --git a/sources/net.sf.j2s.java.core/dist/Jmol-j2s-site.zip b/sources/net.sf.j2s.java.core/dist/Jmol-j2s-site.zip
deleted file mode 100644
index faff6c606..000000000
Binary files a/sources/net.sf.j2s.java.core/dist/Jmol-j2s-site.zip and /dev/null differ
diff --git a/sources/net.sf.j2s.java.core/dist/SwingJS-site.zip b/sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
index 1155a2eee..b80c5291c 100644
Binary files a/sources/net.sf.j2s.java.core/dist/SwingJS-site.zip and b/sources/net.sf.j2s.java.core/dist/SwingJS-site.zip differ
diff --git a/sources/net.sf.j2s.java.core/dist_to_jsmol/Jmol-j2s-site.zip b/sources/net.sf.j2s.java.core/dist_to_jsmol/Jmol-j2s-site.zip
new file mode 100644
index 000000000..d12b1273e
Binary files /dev/null and b/sources/net.sf.j2s.java.core/dist_to_jsmol/Jmol-j2s-site.zip differ
diff --git a/sources/net.sf.j2s.java.core/site-resources_4.2/jsmol/js/JSmolJavaExt.js b/sources/net.sf.j2s.java.core/site-resources_4.2/jsmol/js/JSmolJavaExt.js
new file mode 100644
index 000000000..636f83da6
--- /dev/null
+++ b/sources/net.sf.j2s.java.core/site-resources_4.2/jsmol/js/JSmolJavaExt.js
@@ -0,0 +1,2766 @@
+// JSmolJavaExt.js
+
+// contains class declarations for
+// Integer, Byte, Short, Float, Double, Character
+// EventObject, EventListenerProxy
+// Throwable, Error
+// and many others. If these classes have js files in java/, those files are unused
+
+
+// This library will be wrapped by an additional anonymous function using ANT in
+// build_03_tojs.xml. This task will also modify variable names. References
+// to Clazz._ will not be changed, but other Clazz.xxx will be changed to
+// (local scope) Clazz_xxx, allowing them to be further compressed using
+// Google Closure Compiler in that same ANT task.
+
+// BH 2023.07.08 NaN.0 fix
+// BH 10/16/2017 6:51:20 AM fixing range error for MSIE in prepareCallback setting arguments.length < 0
+// BH 10/13/2017 7:03:28 AM fix for String.initialize(bytes) applying bytes as arguments
+// BH 9/18/2017 10:15:18 PM adding Integer.compare()
+// BH 4/7/2017 10:48:50 AM adds Math.signum(f)
+// BH 10/15/2016 9:28:13 AM adds Float.floatToIntBits(f)
+// BH 3/9/2016 6:25:08 PM at least allow Error() by itself to work as before (inchi.js uses this)
+// BH 12/21/2015 1:31:41 PM fixing String.instantialize for generic typed array
+// BH 9/19/2015 11:05:45 PM Float.isInfinite(), Float.isNaN(), Double.isInfinite(), Double.isNaN() all not implemented
+// BH 5/31/2015 5:53:04 PM Number.compareTo added
+// BH 5/21/2015 5:46:30 PM Number("0xFFFFFFFF") is not -1
+// BH 4/23/2015 9:08:59 AM xx.getComponentType() is nonfunctional. Array.newInstance now defines a wrapper for .getClass().getComponentType() that works
+// BH 4/12/2015 1:37:44 PM adding Math.rint = Math.round
+// BH 1/16/2015 10:09:38 AM Chrome failure jqGrig due to new String("x").toString() not being a simple string
+// BH 8/14/2014 6:49:22 PM Character class efficiencies
+// BH 7/24/2014 9:02:18 AM most browsers do not support String.codePointAt()
+// BH 7/11/2014 4:17:22 PM fix for Boolean.valueOf("false") not being false
+// BH 5/27/2014 6:29:59 AM ensure floats and doubles have decimal point in toString
+// BH 4/1/2014 12:23:41 PM Encoding moved to Clazz._Encoding;
+// BH 4/1/2014 7:51:46 AM removing java.lang.B00lean
+// BH 3/7/2014 9:17:10 AM removing Array.toString; moving that code here from j2sJmol.js
+// BH 1/30/2014 9:04:25 AM adding Throwable.getStackTrace() as a STRING
+// BH 12/4/2013 9:20:44 PM fix for reassigning Date.prototype.toString()
+// BH 12/3/2013 11:43:10 AM bizarre Safari bug in reassigning Boolean (OK, I admit, we shouldn't have done that...)
+// BH 12/1/2013 6:50:16 AM evit Number.prototype.toString assignment removed!
+// BH 11/30/2013 1:46:31 PM fixing Byte, Short, Long, Integer, Float, Double to reflect proper bounds and error conditions
+// BH 11/29/2013 8:58:49 PM removing Boolean.toString(boolean)
+// BH 11/4/2013 7:34:26 AM changing "var nativeClazz" to "var nativeClass" to avoid ANT replacement of "nativeClazz." to "nativeClazz_"
+// BH 10/19/2013 1:29:27 PM fixed String.$replace()
+// BH 10/18/2013 6:09:23 PM fixed (Double|Float).valueOf(NaN).valueOf(), which should return NaN, not throw an error
+// BH 10/12/2013 11:18:44 AM fixed bug in Double(String) and Float(String) that was returning typeof "string"
+// BH 10/10/2013 2:40:20 PM added Math.log10
+// BH 7/23/2013 7:24:01 AM fixing Number.shortValue() and Number.byteValue() for negative values
+// BH 6/16/2013 1:31:30 PM adding /| in String.replace -- thank you David Koes
+// BH 3/13/2013 12:49:23 PM setting Boolean.valueOf() "@"
+// BH 3/2/2013 10:46:45 PM removed Double.valueOf(String)
+// BH 11/6/2012 8:26:33 PM added instanceof Int32Array in String.instantialize
+// BH 10/13/2012 11:38:07 PM corrected Integer.parseInt to allow only +-0123456789; created Integer.parseIntRadix
+// BH 11/1/2012 added Short
+// BH 9/10/2012 6:27:21 AM added java.net.URL... classes
+// BH 1/7/2013 7:40:06 AM added Clazz.dateToString
+
+;(function(Clazz) {
+
+// moved here from package.js
+// these classes will be created as objects prior to any others
+// and are then available immediately
+
+ Clazz._Loader.registerPackages("java", [ "io", "lang", "lang.reflect", "util" ]);
+
+ var sJU = "java.util";
+
+ //var sJU = "JU";
+ //Clazz._Loader.registerPackages (sJU, ["regex", "zip"]);
+ //var javautil = JU;
+
+ var javautil = java.util;
+
+ Clazz._Loader.ignore([
+ "net.sf.j2s.ajax.HttpRequest",
+ sJU + ".MapEntry.Type",
+ "java.net.UnknownServiceException", // unnecessary for Jmol
+ "java.lang.Runtime",
+ "java.security.AccessController",
+ "java.security.PrivilegedExceptionAction",
+ "java.io.File",
+ "java.io.FileInputStream",
+ "java.io.FileWriter",
+ "java.io.OutputStreamWriter",
+// sJU + ".Calendar", // bypassed in ModelCollection
+// "java.text.SimpleDateFormat", // not used
+// "java.text.DateFormat", // not used
+ sJU + ".concurrent.Executors"
+ ])
+
+Math.rint = Math.round;
+
+Math.log10||(Math.log10=function(a){return Math.log(a)/2.302585092994046});
+
+Math.signum||(Math.signum=function(d){return(d==0.0||isNaN(d))?d:d < 0 ? -1 : 1});
+
+if(Clazz._supportsNativeObject){
+ // Number and Array are special -- do not override prototype.toString -- "length - 2" here
+ for(var i=0;i 0 ? x - 0x10000 : x);
+});
+
+Clazz.defineMethod(Number,"byteValue",
+function(){
+var x = Math.round(this)&0xff;
+return (this < 0 && x > 0 ? x - 0x100 : x);
+});
+
+Clazz.defineMethod(Number,"intValue",
+function(){
+return Math.round(this)&0xffffffff;
+});
+
+Clazz.defineMethod(Number,"longValue",
+function(){
+return Math.round(this);
+});
+
+Clazz.defineMethod(Number,"floatValue",
+function(){
+return this.valueOf();
+});
+Clazz.defineMethod(Number,"doubleValue",
+function(){
+return parseFloat(this.valueOf());
+});
+
+Clazz.overrideMethod(Number,"hashCode",
+function(){
+return this.valueOf();
+});
+
+java.lang.Integer=Integer=function(){
+Clazz.instantialize(this,arguments);
+};
+Clazz.decorateAsType(Integer,"Integer",Number,Comparable,null,true);
+Integer.prototype.valueOf=function(){return 0;};
+Integer.toString=Integer.prototype.toString=function(){
+if(arguments.length!=0){
+return""+arguments[0];
+} else if(this===Integer){
+return"class java.lang.Integer";
+}
+return""+this.valueOf();
+};
+
+/*
+
+Clazz.makeConstructor(Integer,
+function(){
+this.valueOf=function(){
+return 0;
+};
+});
+*/
+
+
+Clazz.overrideConstructor(Integer, function(v){
+ v == null && (v = 0);
+ if (typeof v != "number")
+ v = Integer.parseIntRadix(v, 10);
+ this.valueOf=function(){return v;};
+}); //BH
+/*
+Clazz.makeConstructor(Integer,
+function(s){
+var value=Integer.parseInt(s,10);
+this.valueOf=function(){
+return value;
+};
+},"String");
+*/
+Integer.MIN_VALUE=Integer.prototype.MIN_VALUE=-0x80000000;
+Integer.MAX_VALUE=Integer.prototype.MAX_VALUE=0x7fffffff;
+Integer.TYPE=Integer.prototype.TYPE=Integer;
+
+
+Integer.compare = Clazz.defineMethod(Integer,"compare",
+function(i,j) {
+ return (i < j ? -1 : i > j ? 1 : 0);
+},"Number,Number");
+
+Clazz.defineMethod(Integer,"bitCount",
+function(i) {
+ i = i - ((i >>> 1) & 0x55555555);
+ i = (i & 0x33333333) + ((i >>> 2) & 0x33333333);
+ i = (i + (i >>> 4)) & 0x0f0f0f0f;
+ i = i + (i >>> 8);
+ i = i + (i >>> 16);
+ return i & 0x3f;
+},"Number");
+Integer.bitCount=Integer.prototype.bitCount;
+
+Clazz.defineMethod(Integer,"numberOfLeadingZeros",
+function(i) {
+ if (i == 0) return 32;
+ var n = 1;
+ if (i >>> 16 == 0) { n += 16; i <<= 16; }
+ if (i >>> 24 == 0) { n += 8; i <<= 8; }
+ if (i >>> 28 == 0) { n += 4; i <<= 4; }
+ if (i >>> 30 == 0) { n += 2; i <<= 2; }
+ n -= i >>> 31;
+ return n;
+},"Number");
+Integer.numberOfLeadingZeros=Integer.prototype.numberOfLeadingZeros;
+
+Clazz.defineMethod(Integer,"numberOfTrailingZeros",
+function(i) {
+ if (i == 0) return 32;
+ var n = 31;
+ var y = i <<16; if (y != 0) { n = n -16; i = y; }
+ y = i << 8; if (y != 0) { n = n - 8; i = y; }
+ y = i << 4; if (y != 0) { n = n - 4; i = y; }
+ y = i << 2; if (y != 0) { n = n - 2; i = y; }
+ return n - ((i << 1) >>> 31);
+},"Number");
+Integer.numberOfTrailingZeros=Integer.prototype.numberOfTrailingZeros;
+
+Clazz.defineMethod(Integer,"parseIntRadix",
+function(s,radix){
+if(s==null){
+throw new NumberFormatException("null");
+}if(radix<2){
+throw new NumberFormatException("radix "+radix+" less than Character.MIN_RADIX");
+}if(radix>36){
+throw new NumberFormatException("radix "+radix+" greater than Character.MAX_RADIX");
+}
+if (radix == 10) {
+ for (var i = s.length; --i >= 0;) {
+ var c = s.charCodeAt(i);
+ if (c >= 48 && c <= 57) continue;
+ if (i > 0 || c != 43 && c != 45)
+ throw new NumberFormatException("Not a Number : "+s);
+
+ }
+}
+var i=parseInt(s,radix);
+if(isNaN(i)){
+throw new NumberFormatException("Not a Number : "+s);
+}
+return i;
+},"String, Number");
+Integer.parseIntRadix=Integer.prototype.parseIntRadix;
+
+Clazz.defineMethod(Integer,"parseInt",
+function(s){
+return Integer.parseIntRadix(s,10);
+},"String");
+Integer.parseInt=Integer.prototype.parseInt;
+
+/*
+Clazz.defineMethod(Integer,"$valueOf",
+function(s){
+return new Integer(Integer.parseIntRadix(s,10));
+},"String");
+*/
+
+Clazz.overrideMethod(Integer,"$valueOf",
+function(s){
+return new Integer(s);
+});
+
+/*
+Clazz.defineMethod(Integer,"$valueOf",
+function(s,r){
+return new Integer(Integer.parseIntRadix(s,r));
+},"String, Number");
+*/
+
+Integer.$valueOf=Integer.prototype.$valueOf;
+
+
+Clazz.overrideMethod(Integer,"equals",
+function(s){
+if(s==null||!Clazz.instanceOf(s,Integer)){
+return false;
+}
+return s.valueOf()==this.valueOf();
+},"Object");
+Integer.toHexString=Integer.prototype.toHexString=function(d){
+if(d.valueOf)d=d.valueOf();
+if (d < 0) {
+var b = d & 0xFFFFFF;
+var c = ((d>>24)&0xFF);
+return c._numberToString(16) + (b = "000000" + b._numberToString(16)).substring(b.length - 6);
+}
+return d._numberToString(16);};
+Integer.toOctalString=Integer.prototype.toOctalString=function(d){if(d.valueOf)d=d.valueOf();return d._numberToString(8);};
+Integer.toBinaryString=Integer.prototype.toBinaryString=function(d){if(d.valueOf)d=d.valueOf();return d._numberToString(2);};
+
+Integer.decodeRaw=Clazz.defineMethod(Integer,"decodeRaw", function(n){
+if (n.indexOf(".") >= 0)n = "";
+var i = (n.startsWith("-") ? 1 : 0);
+n = n.replace(/\#/, "0x").toLowerCase();
+var radix=(n.startsWith("0x", i) ? 16 : n.startsWith("0", i) ? 8 : 10);
+// The general problem with parseInt is that is not strict -- ParseInt("10whatever") == 10.
+// Number is strict, but Number("055") does not work, though ParseInt("055", 8) does.
+// need to make sure negative numbers are negative
+n = Number(n) & 0xFFFFFFFF;
+return (radix == 8 ? parseInt(n, 8) : n);
+},"~S");
+
+Integer.decode=Clazz.defineMethod(Integer,"decode", function(n){
+ n = Integer.decodeRaw(n);
+ if (isNaN(n) || n < Integer.MIN_VALUE|| n > Integer.MAX_VALUE)
+ throw new NumberFormatException("Invalid Integer");
+ return new Integer(n);
+},"~S");
+
+Clazz.overrideMethod(Integer,"hashCode",
+function(){
+return this.valueOf();
+});
+
+// Note that Long is problematic in JavaScript
+
+java.lang.Long=Long=function(){
+Clazz.instantialize(this,arguments);
+};
+Clazz.decorateAsType(Long,"Long",Number,Comparable,null,true);
+Long.prototype.valueOf=function(){return 0;};
+Long.toString=Long.prototype.toString=function(){
+if(arguments.length!=0){
+return""+arguments[0];
+}else if(this===Long){
+return"class java.lang.Long";
+}
+return""+this.valueOf();
+};
+
+Clazz.overrideConstructor(Long, function(v){
+ v == null && (v = 0);
+ v = (typeof v == "number" ? Math.round(v) : Integer.parseIntRadix(v, 10));
+this.valueOf=function(){return v;};
+});
+
+//Long.MIN_VALUE=Long.prototype.MIN_VALUE=-0x8000000000000000;
+//Long.MAX_VALUE=Long.prototype.MAX_VALUE=0x7fffffffffffffff;
+Long.TYPE=Long.prototype.TYPE=Long;
+
+Clazz.defineMethod(Long,"parseLong",
+function(s,radix){
+ return Integer.parseInt(s, radix || 10);
+});
+
+Long.parseLong=Long.prototype.parseLong;
+
+Clazz.overrideMethod(Long,"$valueOf",
+function(s){
+return new Long(s);
+});
+/*
+Clazz.defineMethod(Long,"$valueOf",
+function(s){
+return new Long(s);
+},"Number");
+
+Clazz.defineMethod(Long,"$valueOf",
+function(s,r){
+return new Long(Long.parseLong(s,r));
+},"String, Number");
+*/
+Long.$valueOf=Long.prototype.$valueOf;
+Clazz.overrideMethod(Long,"equals",
+function(s){
+if(s==null||!Clazz.instanceOf(s,Long)){
+return false;
+}
+return s.valueOf()==this.valueOf();
+},"Object");
+Long.toHexString=Long.prototype.toHexString=function(i){
+return i.toString(16);
+};
+Long.toOctalString=Long.prototype.toOctalString=function(i){
+return i.toString(8);
+};
+Long.toBinaryString=Long.prototype.toBinaryString=function(i){
+return i.toString(2);
+};
+
+
+Long.decode=Clazz.defineMethod(Long,"decode",
+function(n){
+ n = Integer.decodeRaw(n);
+ if (isNaN(n))
+ throw new NumberFormatException("Invalid Long");
+ return new Long(n);
+},"~S");
+
+java.lang.Short = Short = function () {
+Clazz.instantialize (this, arguments);
+};
+Clazz.decorateAsType (Short, "Short", Number, Comparable, null, true);
+Short.prototype.valueOf = function () { return 0; };
+Short.toString = Short.prototype.toString = function () {
+ if (arguments.length != 0) {
+ return "" + arguments[0];
+ } else if (this === Short) {
+ return "class java.lang.Short"; // Short.class.toString
+ }
+ return "" + this.valueOf ();
+};
+
+Clazz.overrideConstructor(Short,
+function (v) {
+ v == null && (v = 0);
+ if (typeof v != "number")
+ v = Integer.parseIntRadix(v, 10);
+ v = v.shortValue();
+ this.valueOf = function () {return v;};
+});
+
+
+Short.MIN_VALUE = Short.prototype.MIN_VALUE = -32768;
+Short.MAX_VALUE = Short.prototype.MAX_VALUE = 32767;
+Short.TYPE = Short.prototype.TYPE = Short;
+
+Clazz.defineMethod(Short, "parseShortRadix",
+function (s, radix) {
+return Integer.parseIntRadix(s, radix).shortValue();
+}, "String, Number");
+Short.parseShortRadix = Short.prototype.parseShortRadix;
+
+Clazz.defineMethod(Short, "parseShort",
+function (s) {
+return Short.parseShortRadix (s, 10);
+}, "String");
+
+Short.parseShort = Short.prototype.parseShort;
+
+/*
+Clazz.defineMethod(Short, "$valueOf",
+function (s) {
+return new Short(Short.parseShort (s, 10));
+}, "String");
+ */
+
+Clazz.overrideMethod(Short, "$valueOf",
+function (s) {
+return new Short(s);
+});
+
+/*
+Clazz.defineMethod(Short, "$valueOf",
+function (s, r) {
+return new Short(Short.parseShort (s, r));
+}, "String, Number");
+ */
+
+Short.$valueOf = Short.prototype.$valueOf;
+Clazz.overrideMethod(Short, "equals",
+function (s) {
+if(s == null || !Clazz.instanceOf(s, Short) ){
+ return false;
+}
+return s.valueOf() == this.valueOf();
+}, "Object");
+Short.toHexString = Short.prototype.toHexString = function (i) {
+ return i.toString (16);
+};
+Short.toOctalString = Short.prototype.toOctalString = function (i) {
+ return i.toString (8);
+};
+Short.toBinaryString = Short.prototype.toBinaryString = function (i) {
+ return i.toString (2);
+};
+Short.decode = Clazz.defineMethod(Short, "decode",
+function(n){
+ n = Integer.decodeRaw(n);
+ if (isNaN(n) || n < -32768|| n > 32767)
+ throw new NumberFormatException("Invalid Short");
+ return new Short(n);
+}, "~S");
+
+java.lang.Byte=Byte=function(){
+Clazz.instantialize(this,arguments);
+};
+Clazz.decorateAsType(Byte,"Byte",Number,Comparable,null,true);
+Byte.prototype.valueOf=function(){return 0;};
+Byte.toString=Byte.prototype.toString=function(){
+if(arguments.length!=0){
+return""+arguments[0];
+}else if(this===Byte){
+return"class java.lang.Byte";
+}
+return""+this.valueOf();
+};
+Clazz.makeConstructor(Byte,
+function(v){
+ if (typeof v != "number")
+ v = Integer.parseIntRadix(v, 10);
+ v = v.byteValue();
+this.valueOf=function(){
+return v;
+};
+});
+
+Byte.serialVersionUID=Byte.prototype.serialVersionUID=-7183698231559129828;
+Byte.MIN_VALUE=Byte.prototype.MIN_VALUE=-128;
+Byte.MAX_VALUE=Byte.prototype.MAX_VALUE=127;
+Byte.SIZE=Byte.prototype.SIZE=8;
+Byte.TYPE=Byte.prototype.TYPE=Byte;
+
+Clazz.defineMethod(Byte,"parseByteRadix",
+function(s,radix){
+ return Integer.parseIntRadix(s, radix).byteValue();
+},"String, Number");
+Byte.parseByteRadix=Byte.prototype.parseByteRadix;
+
+Clazz.defineMethod(Byte,"parseByte",
+function(s){
+return Byte.parseByte(s,10);
+},"String");
+
+Byte.parseByte=Byte.prototype.parseByte;
+
+Clazz.overrideMethod(Byte, "$valueOf",
+function (s) {
+return new Byte(s);
+});
+
+Byte.$valueOf=Byte.prototype.$valueOf;
+Clazz.overrideMethod(Byte,"equals",
+function(s){
+if(s==null||!Clazz.instanceOf(s,Byte)){
+return false;
+}
+return s.valueOf()==this.valueOf();
+},"Object");
+Byte.toHexString=Byte.prototype.toHexString=function(i){
+return i.toString(16);
+};
+Byte.toOctalString=Byte.prototype.toOctalString=function(i){
+return i.toString(8);
+};
+Byte.toBinaryString=Byte.prototype.toBinaryString=function(i){
+return i.toString(2);
+};
+Byte.decode=Clazz.defineMethod(Byte,"decode",
+function(n){
+ n = Integer.decodeRaw(n);
+ if (isNaN(n) || n < -128|| n > 127)
+ throw new NumberFormatException("Invalid Byte");
+return new Byte(n);
+},"~S");
+
+Clazz._floatToString = function(f) {
+ var s = ""+f
+ if (s.indexOf(".") < 0 && s.indexOf("e") < 0 && s != "NaN")
+ s += ".0";
+ return s;
+}
+
+java.lang.Float=Float=function(){
+Clazz.instantialize(this,arguments);
+};
+Clazz.decorateAsType(Float,"Float",Number,Comparable,null,true);
+Float.prototype.valueOf=function(){return 0;};
+Float.toString=Float.prototype.toString=function(){
+if(arguments.length!=0){
+return Clazz._floatToString(arguments[0]);
+}else if(this===Float){
+return"class java.lang.Float";
+}
+return Clazz._floatToString(this.valueOf());
+};
+
+Clazz._a32 = null;
+
+Float.floatToIntBits = function(f) {
+var a = Clazz._a32 || (Clazz._a32 = new Float32Array(1));
+a[0] = f;
+return new Int32Array(a.buffer)[0];
+}
+
+Clazz.overrideConstructor(Float, function(v){
+ v == null && (v = 0);
+ if (typeof v != "number")
+ v = Number(v);
+ this.valueOf=function(){return v;}
+});
+
+Float.serialVersionUID=Float.prototype.serialVersionUID=-2671257302660747028;
+Float.MIN_VALUE=Float.prototype.MIN_VALUE=1.4e-45;
+Float.MAX_VALUE=Float.prototype.MAX_VALUE=3.4028235e+38;
+Float.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY;
+Float.POSITIVE_INFINITY=Number.POSITIVE_INFINITY;
+Float.NaN=Number.NaN;
+Float.TYPE=Float.prototype.TYPE=Float;
+
+Clazz.defineMethod(Float,"parseFloat",
+function(s){
+if(s==null){
+throw new NumberFormatException("null");
+}
+if (typeof s == "number")return s; // important -- typeof NaN is "number" and is OK here
+var floatVal=Number(s);
+if(isNaN(floatVal)){
+throw new NumberFormatException("Not a Number : "+s);
+}
+return floatVal;
+},"String");
+Float.parseFloat=Float.prototype.parseFloat;
+
+Clazz.overrideMethod(Float,"$valueOf",
+function(s){
+return new Float(s);
+});
+
+Float.$valueOf=Float.prototype.$valueOf;
+
+Clazz.defineMethod(Float,"isNaN",
+function(num){
+return isNaN(arguments.length == 1 ? num : this.valueOf());
+},"Number");
+Float.isNaN=Float.prototype.isNaN;
+Clazz.defineMethod(Float,"isInfinite",
+function(num){
+return!isFinite(arguments.length == 1 ? num : this.valueOf());
+},"Number");
+Float.isInfinite=Float.prototype.isInfinite;
+
+Clazz.overrideMethod(Float,"equals",
+function(s){
+if(s==null||!Clazz.instanceOf(s,Float)){
+return false;
+}
+return s.valueOf()==this.valueOf();
+},"Object");
+
+java.lang.Double=Double=function(){
+Clazz.instantialize(this,arguments);
+};
+Clazz.decorateAsType(Double,"Double",Number,Comparable,null,true);
+Double.prototype.valueOf=function(){return 0;};
+Double.toString=Double.prototype.toString=function(){
+if(arguments.length!=0){
+return Clazz._floatToString(arguments[0]);
+}else if(this===Double){
+return"class java.lang.Double";
+}
+return Clazz._floatToString(this.valueOf());
+};
+
+Clazz.overrideConstructor(Double, function(v){
+ v == null && (v = 0);
+ if (typeof v != "number")
+ v = Double.parseDouble(v);
+ this.valueOf=function(){return v;};
+}); // BH
+
+Double.serialVersionUID=Double.prototype.serialVersionUID=-9172774392245257468;
+Double.MIN_VALUE=Double.prototype.MIN_VALUE=4.9e-324;
+Double.MAX_VALUE=Double.prototype.MAX_VALUE=1.7976931348623157e+308;
+Double.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY;
+Double.POSITIVE_INFINITY=Number.POSITIVE_INFINITY;
+Double.NaN=Number.NaN;
+Double.TYPE=Double.prototype.TYPE=Double;
+
+Clazz.defineMethod(Double,"isNaN",
+function(num){
+return isNaN(arguments.length == 1 ? num : this.valueOf());
+},"Number");
+Double.isNaN=Double.prototype.isNaN;
+Clazz.defineMethod(Double,"isInfinite",
+function(num){
+return!isFinite(arguments.length == 1 ? num : this.valueOf());
+},"Number");
+Double.isInfinite=Double.prototype.isInfinite;
+
+Clazz.defineMethod(Double,"parseDouble",
+function(s){
+if(s==null){
+throw new NumberFormatException("null");
+}
+if (typeof s == "number")return s; // important -- typeof NaN is "number" and is OK here
+var doubleVal=Number(s);
+if(isNaN(doubleVal)){
+throw new NumberFormatException("Not a Number : "+s);
+}
+return doubleVal;
+},"String");
+Double.parseDouble=Double.prototype.parseDouble;
+
+/*
+Clazz.defineMethod(Double,"$valueOf",
+function(s){
+return new Double(this.parseDouble(s));
+},"String");
+*/
+
+Clazz.defineMethod(Double,"$valueOf",
+function(v){
+return new Double(v);
+},"Number");
+
+Double.$valueOf=Double.prototype.$valueOf;
+
+Clazz.overrideMethod(Double,"equals",
+function(s){
+if(s==null||!Clazz.instanceOf(s,Double)){
+return false;
+}
+return s.valueOf()==this.valueOf();
+},"Object");
+
+
+//java.lang.B00lean = Boolean; ?? BH why this?
+Boolean = java.lang.Boolean = Boolean || function () {Clazz.instantialize (this, arguments);};
+if (Clazz._supportsNativeObject) {
+ for (var i = 0; i < Clazz._extendedObjectMethods.length; i++) {
+ var p = Clazz._extendedObjectMethods[i];
+ Boolean.prototype[p] = Clazz._O.prototype[p];
+ }
+}
+Boolean.__CLASS_NAME__="Boolean";
+Clazz.implementOf(Boolean,[java.io.Serializable,java.lang.Comparable]);
+Boolean.equals=Clazz._innerFunctions.equals;
+Boolean.getName=Clazz._innerFunctions.getName;
+Boolean.serialVersionUID=Boolean.prototype.serialVersionUID=-3665804199014368530;
+
+//Clazz.makeConstructor(Boolean,
+//function(value){
+//this.valueOf=function(){
+//return value;
+//};
+//},"~B");
+
+Clazz.overrideConstructor(Boolean,
+function(s){
+ var b = ((typeof s == "string" ? Boolean.toBoolean(s) : s) ? true : false);
+ this.valueOf=function(){return b;};
+},"~O");
+
+Boolean.parseBoolean=Clazz.defineMethod(Boolean,"parseBoolean",
+function(s){
+return Boolean.toBoolean(s);
+},"~S");
+Clazz.defineMethod(Boolean,"booleanValue",
+function(){
+return this.valueOf();
+});
+Boolean.$valueOf=Clazz.overrideMethod(Boolean,"$valueOf",
+function(b){
+return((typeof b == "string"? "true".equalsIgnoreCase(b) : b)?Boolean.TRUE:Boolean.FALSE);
+});
+
+/*
+Boolean.toString=Clazz.defineMethod(Boolean,"toString",
+function(b){
+return b?"true":"false";
+},"~B");
+*/
+
+Clazz.overrideMethod(Boolean,"toString",
+function(){
+return this.valueOf()?"true":"false";
+});
+Clazz.overrideMethod(Boolean,"hashCode",
+function(){
+return this.valueOf()?1231:1237;
+});
+Clazz.overrideMethod(Boolean,"equals",
+function(obj){
+if(Clazz.instanceOf(obj,Boolean)){
+return this.booleanValue()==obj.booleanValue();
+}return false;
+},"~O");
+Boolean.getBoolean=Clazz.defineMethod(Boolean,"getBoolean",
+function(name){
+var result=false;
+try{
+result=Boolean.toBoolean(System.getProperty(name));
+}catch(e){
+if(Clazz.instanceOf(e,IllegalArgumentException)){
+}else if(Clazz.instanceOf(e,NullPointerException)){
+}else{
+throw e;
+}
+}
+return result;
+},"~S");
+Clazz.overrideMethod(Boolean,"compareTo",
+function(b){
+return(b.value==this.value?0:(this.value?1:-1));
+},"Boolean");
+Boolean.toBoolean=Clazz.defineMethod(Boolean,"toBoolean",
+($fz=function(name){
+return((name!=null)&&name.equalsIgnoreCase("true"));
+},$fz.isPrivate=true,$fz),"~S");
+Boolean.TRUE=Boolean.prototype.TRUE=new Boolean(true);
+Boolean.FALSE=Boolean.prototype.FALSE=new Boolean(false);
+Boolean.TYPE=Boolean.prototype.TYPE=Boolean;
+
+
+Clazz._Encoding=new Object();
+
+(function(Encoding) {
+
+Encoding.UTF8="utf-8";
+Encoding.UTF16="utf-16";
+Encoding.ASCII="ascii";
+
+
+Encoding.guessEncoding=function(str){
+if(str.charCodeAt(0)==0xEF&&str.charCodeAt(1)==0xBB&&str.charCodeAt(2)==0xBF){
+return Encoding.UTF8;
+}else if(str.charCodeAt(0)==0xFF&&str.charCodeAt(1)==0xFE){
+return Encoding.UTF16;
+}else{
+return Encoding.ASCII;
+}
+};
+
+Encoding.guessEncodingArray=function(a){
+if(a[0]==0xEF&&a[1]==0xBB&&a[2]==0xBF){
+return Encoding.UTF8;
+}else if(a[0]==0xFF&&a[1]==0xFE){
+return Encoding.UTF16;
+}else{
+return Encoding.ASCII;
+}
+};
+
+Encoding.readUTF8=function(str){
+if (typeof str != "string") return Encoding.readUTF8Array(str);
+var encoding=Encoding.guessEncoding(str);
+var startIdx=0;
+if(encoding==Encoding.UTF8){
+startIdx=3;
+}else if(encoding==Encoding.UTF16){
+startIdx=2;
+}
+var arrs=new Array();
+for(var i=startIdx;i0xc0&&charCode<0xe0){
+var c1=charCode&0x1f;
+i++;
+var c2=str.charCodeAt(i)&0x3f;
+var c=(c1<<6)+c2;
+arrs[arrs.length]=String.fromCharCode(c);
+}else if(charCode>=0xe0){
+var c1=charCode&0x0f;
+i++;
+var c2=str.charCodeAt(i)&0x3f;
+i++;
+var c3=str.charCodeAt(i)&0x3f;
+var c=(c1<<12)+(c2<<6)+c3;
+arrs[arrs.length]=String.fromCharCode(c);
+}
+}
+return arrs.join('');
+};
+
+Encoding.readUTF8Array=function(a){
+var encoding=Encoding.guessEncodingArray(a);
+var startIdx=0;
+if(encoding==Encoding.UTF8){
+startIdx=3;
+}else if(encoding==Encoding.UTF16){
+startIdx=2;
+}
+var arrs=new Array();
+for(var i=startIdx;i0xc0&&charCode<0xe0){
+var c1=charCode&0x1f;
+var c2=a[++i]&0x3f;
+var c=(c1<<6)+c2;
+arrs[arrs.length]=String.fromCharCode(c);
+}else if(charCode>=0xe0){
+var c1=charCode&0x0f;
+var c2=a[++i]&0x3f;
+var c3=a[++i]&0x3f;
+var c=(c1<<12)+(c2<<6)+c3;
+arrs[arrs.length]=String.fromCharCode(c);
+}
+}
+return arrs.join('');
+};
+
+Encoding.convert2UTF8=function(str){
+var encoding=this.guessEncoding(str);
+var startIdx=0;
+if(encoding==Encoding.UTF8){
+return str;
+}else if(encoding==Encoding.UTF16){
+startIdx=2;
+}
+
+var offset=0;
+var arrs=new Array(offset+str.length-startIdx);
+
+for(var i=startIdx;i>6);
+var c2=0x80+(charCode&0x003f);
+arrs[offset+i-startIdx]=String.fromCharCode(c1)+String.fromCharCode(c2);
+}else{
+var c1=0xe0+((charCode&0xf000)>>12);
+var c2=0x80+((charCode&0x0fc0)>>6);
+var c3=0x80+(charCode&0x003f);
+arrs[offset+i-startIdx]=String.fromCharCode(c1)+String.fromCharCode(c2)+String.fromCharCode(c3);
+}
+}
+return arrs.join('');
+};
+Encoding.base64Chars=new Array(
+'A','B','C','D','E','F','G','H',
+'I','J','K','L','M','N','O','P',
+'Q','R','S','T','U','V','W','X',
+'Y','Z','a','b','c','d','e','f',
+'g','h','i','j','k','l','m','n',
+'o','p','q','r','s','t','u','v',
+'w','x','y','z','0','1','2','3',
+'4','5','6','7','8','9','+','/'
+);
+Encoding.encodeBase64=function(str){
+if(str==null||str.length==0)return str;
+var b64=Encoding.base64Chars;
+var length=str.length;
+var index=0;
+var buf=[];
+var c0,c1,c2;
+while(index>2];
+if(index>4)];
+if(index>6)];
+buf[buf.length]=b64[c2&0x3F];
+}else{
+buf[buf.length]=b64[((c1<<2)&0x3c)];
+buf[buf.length]='=';
+}
+}else{
+buf[buf.length]=b64[(c0<<4)&0x30];
+buf[buf.length]='=';
+buf[buf.length]='=';
+}
+}
+return buf.join('');
+};
+Encoding.decodeBase64=function(str){
+if(str==null||str.length==0)return str;
+var b64=Encoding.base64Chars;
+var xb64=Encoding.xBase64Chars;
+if(Encoding.xBase64Chars==null){
+xb64=new Object();
+for(var i=0;i>4);
+if(c2!=null){
+buf[buf.length]=String.fromCharCode(((c1<<4)&0xff)|c2>>2);
+if(c3!=null){
+buf[buf.length]=String.fromCharCode(((c2<<6)&0xff)|c3);
+}
+}
+}
+return buf.join('');
+};
+
+if(String.prototype.$replace==null){
+java.lang.String=String;
+if(Clazz._supportsNativeObject){
+for(var i=0;i= 0) c1 = "\\" + c1;
+ } else {
+ c1=c1.replace(/([\\\$\.\*\+\|\?\^\{\}\(\)\[\]])/g,function($0,$1){return"\\"+$1;});
+ }
+ return this.replace(new RegExp(c1,"gm"),c2);
+};
+sp.$generateExpFunction=function(str){
+var arr=[];
+var orders=[];
+var idx=0;
+arr[0]="";
+var i=0;
+for(;ithis.length-len)||
+(ooffset>other.length-len)){
+return false;
+}
+var s1=this.substring(toffset,toffset+len);
+var s2=other.substring(ooffset,ooffset+len);
+if(ignoreCase){
+s1=s1.toLowerCase();
+s2=s2.toLowerCase();
+}
+return s1==s2;
+};
+
+
+
+sp.$plit=function(regex,limit){
+if (!limit && regex == " ")
+ return this.split(regex);
+
+if(limit!=null&&limit>0){
+if(limit==1){
+return this;
+}
+var regExp=new RegExp("("+regex+")","gm");
+var count=1;
+var s=this.replace(regExp,function($0,$1){
+count++;
+if(count==limit){
+return"@@_@@";
+}else if(count>limit){
+return $0;
+}else{
+return $0;
+}
+});
+regExp=new RegExp(regex,"gm");
+var arr=this.split(regExp);
+if(arr.length>limit){
+arr[limit-1]=s.substring(s.indexOf("@@_@@")+5);
+arr.length=limit;
+}
+return arr;
+}else{
+var regExp=new RegExp(regex,"gm");
+return this.split(regExp);
+}
+};
+/*
+sp.trim=function(){
+var len=this.length;
+var st=0;
+
+while((st0)||(lens.length-pc)){
+return false;
+}
+while(--pc>=0){
+if(s.charAt(to++)!=prefix.charAt(po++)){
+return false;
+}
+}
+return true;
+};
+
+sp.startsWith=function(prefix){
+if(arguments.length==1){
+return sn(this,arguments[0],0);
+}else if(arguments.length==2){
+return sn(this,arguments[0],arguments[1]);
+}else{
+return false;
+}
+};
+
+sp.endsWith=function(suffix){
+return sn(this, suffix,this.length-suffix.length);
+};
+
+}
+
+sp.equals=function(anObject){
+return this.valueOf()==anObject;
+};
+
+sp.equalsIgnoreCase=function(anotherString){
+return(anotherString==null)?false:(this==anotherString
+||this.toLowerCase()==anotherString.toLowerCase());
+};
+
+
+sp.hash=0;
+
+sp.hashCode=function(){
+var h=this.hash;
+if(h==0){
+var off=0;
+var len=this.length;
+for(var i=0;i255){
+arrs[ii]=0x1a;
+arrs[ii+1]=c&0xff;
+arrs[ii+2]=(c&0xff00)>>8;
+ii+=2;
+}else{
+arrs[ii]=c;
+}
+ii++;
+}
+return Clazz.newByteArray(arrs);
+};
+
+/*
+sp.compareTo=function(anotherString){
+if(anotherString==null){
+throw new java.lang.NullPointerException();
+}
+var len1=this.length;
+var len2=anotherString.length;
+var n=Math.min(len1,len2);
+var k=0;
+while(k= 0} // bh added
+sp.compareTo = function(a){return this > a ? 1 : this < a ? -1 : 0} // bh added
+
+
+
+sp.toCharArray=function(){
+var result=new Array(this.length);
+for(var i=0;is2){
+return 1;
+}else{
+return-1;
+}
+}
+};
+
+sp.contentEquals=function(sb){
+if(this.length!=sb.length()){
+return false;
+}
+var v=sb.getValue();
+var i=0;
+var j=0;
+var n=this.length;
+while(n--!=0){
+if(this.charCodeAt(i++)!=v[j++]){
+return false;
+}
+}
+return true;
+};
+
+sp.getChars=function(srcBegin,srcEnd,dst,dstBegin){
+if(srcBegin<0){
+throw new StringIndexOutOfBoundsException(srcBegin);
+}
+if(srcEnd>this.length){
+throw new StringIndexOutOfBoundsException(srcEnd);
+}
+if(srcBegin>srcEnd){
+throw new StringIndexOutOfBoundsException(srcEnd-srcBegin);
+}
+if(dst==null){
+throw new NullPointerException();
+}
+for(var i=0;ibytes.length){
+ throw new IndexOutOfBoundsException();
+ }
+ if(length>0){
+ var isChar=(bytes[offset].length!=null);
+ if(isChar){
+ for(var i=0;i0;){
+ value[i]=String.fromCharCode(bytes[i+offset]&0xff);
+ }
+ }else{
+ hibyte<<=8;
+ for(var i=count;i-->0;){
+ value[i]=String.fromCharCode(hibyte|(bytes[i+offset]&0xff));
+ }
+ }
+ return value.join('');
+default:
+ var s="";
+ for(var i=0;i= 0x1c && c <= 0x20 || c >= 0x9 && c <= 0xd || c == 0x1680
+ || c >= 0x2000 && c != 0x2007 && (c <= 0x200b || c == 0x2028 || c == 0x2029 || c == 0x3000));
+},"~N");
+c$.isLetter=Clazz.defineMethod(c$,"isLetter",
+function(c){
+c = c.charCodeAt(0);
+return (65 <= c && c <= 90 || 97 <= c && c <= 122);
+},"~N");
+c$.isLetterOrDigit=Clazz.defineMethod(c$,"isLetterOrDigit",
+function(c){
+c = c.charCodeAt(0);
+return (65 <= c && c <= 90 || 97 <= c && c <= 122 || 48 <= c && c <= 57);
+},"~N");
+c$.isSpaceChar=Clazz.defineMethod(c$,"isSpaceChar",
+function(c){
+ var i = c.charCodeAt(0);
+if(i==0x20||i==0xa0||i==0x1680)return true;
+if(i<0x2000)return false;
+return i<=0x200b||i==0x2028||i==0x2029||i==0x202f||i==0x3000;
+},"~N");
+c$.digit=Clazz.defineMethod(c$,"digit",
+function(c,radix){
+var i = c.charCodeAt(0);
+if(radix >= 2 && radix <= 36){
+ if(i < 128){
+ var result = -1;
+ if(48 <= i && i <= 57){
+ result = i - 48;
+ }else if(97 <= i && i <= 122){
+ result = i - 87;
+ }else if(65 <= i && i <= 90){
+ result=i-(55);
+ }
+ return (result < radix ? result : -1);
+ }
+}
+return -1;
+},"~N,~N");
+Clazz.overrideMethod(c$,"toString",
+function(){
+var buf=[this.value];
+return String.valueOf(buf);
+});
+c$.toString=Clazz.overrideMethod(c$,"toString",
+function(c){
+{
+if(this===Character){
+return"class java.lang.Character";
+}
+}return String.valueOf(c);
+},"~N");
+Clazz.defineStatics(c$,
+"MIN_VALUE",'\u0000',
+"MAX_VALUE",'\uffff',
+"MIN_RADIX",2,
+"MAX_RADIX",36,
+"TYPE",null);
+
+java.lang.Character.TYPE=java.lang.Character.prototype.TYPE=java.lang.Character;
+
+
+
+Clazz._ArrayWrapper = function(a, type) {
+ return {
+ a: a,
+ __CLASS_NAME__:"Array",
+ superClazz: Array,
+ getComponentType: function() {return type},
+ instanceOf: function(o) { return Clazz.instanceOf(type, o) },
+ getName: function() { return this.__CLASS_NAME__ }
+ };
+}
+c$=Clazz.declareType(java.lang.reflect,"Array");
+c$.newInstance=Clazz.defineMethod(c$,"newInstance",
+function(componentType,size){
+var a = Clazz.newArray(size);
+ a.getClass = function() { return new Clazz._ArrayWrapper(this, componentType);};
+return a;
+},"Class,~N");
+
+javautil.Date=Date;
+Date.TYPE="javautil.Date";
+Date.__CLASS_NAME__="Date";
+Clazz.implementOf(Date,[java.io.Serializable,java.lang.Comparable]);
+
+Clazz.defineMethod(javautil.Date,"clone",
+function(){
+return new Date(this.getTime());
+});
+
+Clazz.defineMethod(javautil.Date,"before",
+function(when){
+return this.getTime()when.getTime();
+},"javautil.Date");
+Clazz.defineMethod(javautil.Date,"equals",
+function(obj){
+return Clazz.instanceOf(obj,javautil.Date)&&this.getTime()==(obj).getTime();
+},"Object");
+Clazz.defineMethod(javautil.Date,"compareTo",
+function(anotherDate){
+var thisTime=this.getTime();
+var anotherTime=anotherDate.getTime();
+return(thisTime>32));
+});
+
+c$=Clazz.decorateAsClass(function(){
+this.source=null;
+Clazz.instantialize(this,arguments);
+},javautil,"EventObject",null,java.io.Serializable);
+Clazz.makeConstructor(c$,
+function(source){
+if(source!=null)this.source=source;
+else throw new IllegalArgumentException();
+},"~O");
+Clazz.defineMethod(c$,"getSource",
+function(){
+return this.source;
+});
+Clazz.overrideMethod(c$,"toString",
+function(){
+return this.getClass().getName()+"[source="+String.valueOf(this.source)+']';
+});
+Clazz.declareInterface(javautil,"EventListener");
+
+c$=Clazz.decorateAsClass(function(){
+this.listener=null;
+Clazz.instantialize(this,arguments);
+},javautil,"EventListenerProxy",null,javautil.EventListener);
+Clazz.makeConstructor(c$,
+function(listener){
+this.listener=listener;
+},"javautil.EventListener");
+Clazz.defineMethod(c$,"getListener",
+function(){
+return this.listener;
+});
+Clazz.declareInterface(javautil,"Iterator");
+
+Clazz.declareInterface(javautil,"ListIterator",javautil.Iterator);
+Clazz.declareInterface(javautil,"Enumeration");
+Clazz.declareInterface(javautil,"Collection",Iterable);
+
+Clazz.declareInterface(javautil,"Set",javautil.Collection);
+Clazz.declareInterface(javautil,"Map");
+Clazz.declareInterface(javautil.Map,"Entry");
+
+Clazz.declareInterface(javautil,"List",javautil.Collection);
+
+Clazz.declareInterface(javautil,"Queue",javautil.Collection);
+Clazz.declareInterface(javautil,"RandomAccess");
+c$=Clazz.decorateAsClass(function(){
+this.detailMessage=null;
+this.cause=null;
+this.stackTrace=null;
+Clazz.instantialize(this,arguments);
+},java.lang,"Throwable",null,java.io.Serializable);
+Clazz.prepareFields(c$,function(){
+this.cause=this;
+//alert("e0 "+ arguments.callee.caller.caller.caller.caller.caller)
+});
+Clazz.makeConstructor(c$,
+function(){
+this.fillInStackTrace();
+});
+Clazz.makeConstructor(c$,
+function(message){
+this.fillInStackTrace();
+this.detailMessage=message;
+},"~S");
+Clazz.makeConstructor(c$,
+function(message,cause){
+this.fillInStackTrace();
+this.detailMessage=message;
+this.cause=cause;
+},"~S,Throwable");
+Clazz.makeConstructor(c$,
+function(cause){
+this.fillInStackTrace();
+this.detailMessage=(cause==null?null:cause.toString());
+this.cause=cause;
+},"Throwable");
+Clazz.defineMethod(c$,"getMessage",
+function(){
+return (this.message || this.detailMessage || this.toString());
+});
+Clazz.defineMethod(c$,"getLocalizedMessage",
+function(){
+return this.getMessage();
+});
+Clazz.defineMethod(c$,"getCause",
+function(){
+return(this.cause===this?null:this.cause);
+});
+Clazz.defineMethod(c$,"initCause",
+function(cause){
+if(this.cause!==this)throw new IllegalStateException("Can't overwrite cause");
+if(cause===this)throw new IllegalArgumentException("Self-causation not permitted");
+this.cause=cause;
+return this;
+},"Throwable");
+Clazz.overrideMethod(c$,"toString",
+function(){
+var s=this.getClass().getName();
+var message=this.message || this.detailMessage;
+return(message ? s+": "+message : s);
+});
+Clazz.defineMethod(c$,"printStackTrace",
+function(){
+System.err.println(this.getStackTrace ? this.getStackTrace() : this.message + " " + Clazz.getStackTrace());
+});
+
+Clazz.defineMethod(c$,"getStackTrace",
+function(){
+var s = "" + this + "\n";
+for(var i=0;i-1||caller!=null){
+var clazzName=null;
+var nativeClass=null;
+if(!noLooping||caller==Clazz.tryToSearchAndExecute||caller==Clazz.superCall||caller==null){
+if(index<0){
+break;
+}
+noLooping=true;
+superCaller=Clazz._callingStackTraces[index].caller;
+nativeClass=Clazz._callingStackTraces[index].owner;
+index--;
+}else{
+superCaller=caller;
+if(superCaller.claxxOwner!=null){
+nativeClass=superCaller.claxxOwner;
+}else if(superCaller.exClazz!=null){
+nativeClass=superCaller.exClazz;
+}
+}
+var st=new StackTraceElement(
+((nativeClass!=null&&nativeClass.__CLASS_NAME__.length!=0)?
+nativeClass.__CLASS_NAME__:"anonymous"),
+((superCaller.exName==null)?"anonymous":superCaller.exName)
++" ("+Clazz.getParamsType(superCaller.arguments)+")",
+null,-1);
+st.nativeClazz=nativeClass;
+this.stackTrace[this.stackTrace.length]=st;
+for(var i=0;i":this.declaringClass;
+});
+Clazz.defineMethod(c$,"getFileName",
+function(){
+return this.fileName;
+});
+Clazz.defineMethod(c$,"getLineNumber",
+function(){
+return this.lineNumber;
+});
+Clazz.defineMethod(c$,"getMethodName",
+function(){
+return(this.methodName==null)?"":this.methodName;
+});
+Clazz.overrideMethod(c$,"hashCode",
+function(){
+if(this.methodName==null){
+return 0;
+}return this.methodName.hashCode()^this.declaringClass.hashCode();
+});
+Clazz.defineMethod(c$,"isNativeMethod",
+function(){
+return this.lineNumber==-2;
+});
+Clazz.overrideMethod(c$,"toString",
+function(){
+var buf=new StringBuilder(80);
+buf.append(this.getClassName());
+buf.append('.');
+buf.append(this.getMethodName());
+if(this.isNativeMethod()){
+buf.append("(Native Method)");
+}else{
+var fName=this.getFileName();
+if(fName==null){
+buf.append("(Unknown Source)");
+}else{
+var lineNum=this.getLineNumber();
+buf.append('(');
+buf.append(fName);
+if(lineNum>=0){
+buf.append(':');
+buf.append(lineNum);
+}buf.append(')');
+}}return buf.toString();
+});
+TypeError.prototype.getMessage || (TypeError.prototype.getMessage = function(){ return (this.message || this.toString()) + (this.getStackTrace ? this.getStackTrace() : Clazz.getStackTrace())});
+
+
+Clazz.Error = Error;
+
+Clazz.declareTypeError = function (prefix, name, clazzParent, interfacez,
+ parentClazzInstance, _declareType) {
+ var f = function () {
+ Clazz.instantialize (this, arguments);
+ return Clazz.Error();
+ };
+ return Clazz.decorateAsClass (f, prefix, name, clazzParent, interfacez,
+ parentClazzInstance);
+};
+
+// at least allow Error() by itself to work as before
+Clazz._Error || (Clazz._Error = Error);
+Clazz.decorateAsClass (function (){Clazz.instantialize(this, arguments);return Clazz._Error();}, java.lang, "Error", Throwable);
+
+//c$=Clazz.declareTypeError(java.lang,"Error",Throwable);
+
+
+c$=Clazz.declareType(java.lang,"LinkageError",Error);
+
+c$=Clazz.declareType(java.lang,"IncompatibleClassChangeError",LinkageError);
+
+c$=Clazz.declareType(java.lang,"AbstractMethodError",IncompatibleClassChangeError);
+
+c$=Clazz.declareType(java.lang,"AssertionError",Error);
+Clazz.makeConstructor(c$,
+function(detailMessage){
+Clazz.superConstructor(this,AssertionError,[String.valueOf(detailMessage),(Clazz.instanceOf(detailMessage,Throwable)?detailMessage:null)]);
+},"~O");
+Clazz.makeConstructor(c$,
+function(detailMessage){
+this.construct("" + detailMessage);
+},"~B");
+Clazz.makeConstructor(c$,
+function(detailMessage){
+this.construct("" + detailMessage);
+},"~N");
+
+c$=Clazz.declareType(java.lang,"ClassCircularityError",LinkageError);
+
+c$=Clazz.declareType(java.lang,"ClassFormatError",LinkageError);
+
+c$=Clazz.decorateAsClass(function(){
+this.exception=null;
+Clazz.instantialize(this,arguments);
+},java.lang,"ExceptionInInitializerError",LinkageError);
+Clazz.makeConstructor(c$,
+function(){
+Clazz.superConstructor(this,ExceptionInInitializerError);
+this.initCause(null);
+});
+Clazz.makeConstructor(c$,
+function(detailMessage){
+Clazz.superConstructor(this,ExceptionInInitializerError,[detailMessage]);
+this.initCause(null);
+},"~S");
+Clazz.makeConstructor(c$,
+function(exception){
+Clazz.superConstructor(this,ExceptionInInitializerError);
+this.exception=exception;
+this.initCause(exception);
+},"Throwable");
+Clazz.defineMethod(c$,"getException",
+function(){
+return this.exception;
+});
+Clazz.overrideMethod(c$,"getCause",
+function(){
+return this.exception;
+});
+
+c$=Clazz.declareType(java.lang,"IllegalAccessError",IncompatibleClassChangeError);
+
+c$=Clazz.declareType(java.lang,"InstantiationError",IncompatibleClassChangeError);
+
+c$=Clazz.declareType(java.lang,"VirtualMachineError",Error);
+
+c$=Clazz.declareType(java.lang,"InternalError",VirtualMachineError);
+
+c$=Clazz.declareType(java.lang,"NoClassDefFoundError",LinkageError);
+
+c$=Clazz.declareType(java.lang,"NoSuchFieldError",IncompatibleClassChangeError);
+
+c$=Clazz.declareType(java.lang,"NoSuchMethodError",IncompatibleClassChangeError);
+
+c$=Clazz.declareType(java.lang,"OutOfMemoryError",VirtualMachineError);
+
+c$=Clazz.declareType(java.lang,"StackOverflowError",VirtualMachineError);
+
+c$=Clazz.declareType(java.lang,"UnknownError",VirtualMachineError);
+
+c$=Clazz.declareType(java.lang,"UnsatisfiedLinkError",LinkageError);
+
+c$=Clazz.declareType(java.lang,"UnsupportedClassVersionError",ClassFormatError);
+
+c$=Clazz.declareType(java.lang,"VerifyError",LinkageError);
+
+c$=Clazz.declareType(java.lang,"ThreadDeath",Error);
+Clazz.makeConstructor(c$,
+function(){
+Clazz.superConstructor(this,ThreadDeath,[]);
+});
+
+c$=Clazz.declareType(java.lang,"Exception",Throwable);
+
+c$=Clazz.declareType(java.lang,"RuntimeException",Exception);
+
+c$=Clazz.declareType(java.lang,"ArithmeticException",RuntimeException);
+
+c$=Clazz.declareType(java.lang,"IndexOutOfBoundsException",RuntimeException);
+
+c$=Clazz.declareType(java.lang,"ArrayIndexOutOfBoundsException",IndexOutOfBoundsException);
+Clazz.makeConstructor(c$,
+function(index){
+Clazz.superConstructor(this,ArrayIndexOutOfBoundsException,["Array index out of range: "+index]);
+},"~N");
+
+c$=Clazz.declareType(java.lang,"ArrayStoreException",RuntimeException);
+
+c$=Clazz.declareType(java.lang,"ClassCastException",RuntimeException);
+
+c$=Clazz.decorateAsClass(function(){
+this.ex=null;
+Clazz.instantialize(this,arguments);
+},java.lang,"ClassNotFoundException",Exception);
+Clazz.makeConstructor(c$,
+function(){
+Clazz.superConstructor(this,ClassNotFoundException,[Clazz.castNullAs("Throwable")]);
+});
+Clazz.makeConstructor(c$,
+function(detailMessage){
+Clazz.superConstructor(this,ClassNotFoundException,[detailMessage,null]);
+},"~S");
+Clazz.makeConstructor(c$,
+function(detailMessage,exception){
+Clazz.superConstructor(this,ClassNotFoundException,[detailMessage]);
+this.ex=exception;
+},"~S,Throwable");
+Clazz.defineMethod(c$,"getException",
+function(){
+return this.ex;
+});
+Clazz.overrideMethod(c$,"getCause",
+function(){
+return this.ex;
+});
+
+c$=Clazz.declareType(java.lang,"CloneNotSupportedException",Exception);
+
+c$=Clazz.declareType(java.lang,"IllegalAccessException",Exception);
+
+c$=Clazz.declareType(java.lang,"IllegalArgumentException",RuntimeException);
+Clazz.makeConstructor(c$,
+function(cause){
+Clazz.superConstructor(this,IllegalArgumentException,[(cause==null?null:cause.toString()),cause]);
+},"Throwable");
+
+c$=Clazz.declareType(java.lang,"IllegalMonitorStateException",RuntimeException);
+
+c$=Clazz.declareType(java.lang,"IllegalStateException",RuntimeException);
+Clazz.makeConstructor(c$,
+function(cause){
+Clazz.superConstructor(this,IllegalStateException,[(cause==null?null:cause.toString()),cause]);
+},"Throwable");
+
+c$=Clazz.declareType(java.lang,"IllegalThreadStateException",IllegalArgumentException);
+
+c$=Clazz.declareType(java.lang,"InstantiationException",Exception);
+
+c$=Clazz.declareType(java.lang,"InterruptedException",Exception);
+
+c$=Clazz.declareType(java.lang,"NegativeArraySizeException",RuntimeException);
+
+c$=Clazz.declareType(java.lang,"NoSuchFieldException",Exception);
+
+c$=Clazz.declareType(java.lang,"NoSuchMethodException",Exception);
+
+c$=Clazz.declareType(java.lang,"NullPointerException",RuntimeException);
+
+c$=Clazz.declareType(java.lang,"NumberFormatException",IllegalArgumentException);
+
+c$=Clazz.declareType(java.lang,"SecurityException",RuntimeException);
+Clazz.makeConstructor(c$,
+function(cause){
+Clazz.superConstructor(this,SecurityException,[(cause==null?null:cause.toString()),cause]);
+},"Throwable");
+
+c$=Clazz.declareType(java.lang,"StringIndexOutOfBoundsException",IndexOutOfBoundsException);
+Clazz.makeConstructor(c$,
+function(index){
+Clazz.superConstructor(this,StringIndexOutOfBoundsException,["String index out of range: "+index]);
+},"~N");
+
+c$=Clazz.declareType(java.lang,"UnsupportedOperationException",RuntimeException);
+Clazz.makeConstructor(c$,
+function(){
+Clazz.superConstructor(this,UnsupportedOperationException,[]);
+});
+Clazz.makeConstructor(c$,
+function(cause){
+Clazz.superConstructor(this,UnsupportedOperationException,[(cause==null?null:cause.toString()),cause]);
+},"Throwable");
+
+c$=Clazz.decorateAsClass(function(){
+this.target=null;
+Clazz.instantialize(this,arguments);
+},java.lang.reflect,"InvocationTargetException",Exception);
+Clazz.makeConstructor(c$,
+function(){
+Clazz.superConstructor(this,java.lang.reflect.InvocationTargetException,[Clazz.castNullAs("Throwable")]);
+});
+Clazz.makeConstructor(c$,
+function(exception){
+Clazz.superConstructor(this,java.lang.reflect.InvocationTargetException,[null,exception]);
+this.target=exception;
+},"Throwable");
+Clazz.makeConstructor(c$,
+function(exception,detailMessage){
+Clazz.superConstructor(this,java.lang.reflect.InvocationTargetException,[detailMessage,exception]);
+this.target=exception;
+},"Throwable,~S");
+Clazz.defineMethod(c$,"getTargetException",
+function(){
+return this.target;
+});
+Clazz.overrideMethod(c$,"getCause",
+function(){
+return this.target;
+});
+
+c$=Clazz.decorateAsClass(function(){
+this.undeclaredThrowable=null;
+Clazz.instantialize(this,arguments);
+},java.lang.reflect,"UndeclaredThrowableException",RuntimeException);
+Clazz.makeConstructor(c$,
+function(exception){
+Clazz.superConstructor(this,java.lang.reflect.UndeclaredThrowableException);
+this.undeclaredThrowable=exception;
+this.initCause(exception);
+},"Throwable");
+Clazz.makeConstructor(c$,
+function(exception,detailMessage){
+Clazz.superConstructor(this,java.lang.reflect.UndeclaredThrowableException,[detailMessage]);
+this.undeclaredThrowable=exception;
+this.initCause(exception);
+},"Throwable,~S");
+Clazz.defineMethod(c$,"getUndeclaredThrowable",
+function(){
+return this.undeclaredThrowable;
+});
+Clazz.overrideMethod(c$,"getCause",
+function(){
+return this.undeclaredThrowable;
+});
+
+c$=Clazz.declareType(java.io,"IOException",Exception);
+
+
+c$=Clazz.declareType(java.io,"CharConversionException",java.io.IOException);
+
+c$=Clazz.declareType(java.io,"EOFException",java.io.IOException);
+
+c$=Clazz.declareType(java.io,"FileNotFoundException",java.io.IOException);
+
+c$=Clazz.decorateAsClass(function(){
+this.bytesTransferred=0;
+Clazz.instantialize(this,arguments);
+},java.io,"InterruptedIOException",java.io.IOException);
+
+c$=Clazz.declareType(java.io,"ObjectStreamException",java.io.IOException);
+
+c$=Clazz.decorateAsClass(function(){
+this.classname=null;
+Clazz.instantialize(this,arguments);
+},java.io,"InvalidClassException",java.io.ObjectStreamException);
+Clazz.makeConstructor(c$,
+function(className,detailMessage){
+Clazz.superConstructor(this,java.io.InvalidClassException,[detailMessage]);
+this.classname=className;
+},"~S,~S");
+Clazz.defineMethod(c$,"getMessage",
+function(){
+var msg=Clazz.superCall(this,java.io.InvalidClassException,"getMessage",[]);
+if(this.classname!=null){
+msg=this.classname+';' + ' '+msg;
+}return msg;
+});
+
+c$=Clazz.declareType(java.io,"InvalidObjectException",java.io.ObjectStreamException);
+
+c$=Clazz.declareType(java.io,"NotActiveException",java.io.ObjectStreamException);
+
+c$=Clazz.declareType(java.io,"NotSerializableException",java.io.ObjectStreamException);
+
+c$=Clazz.decorateAsClass(function(){
+this.eof=false;
+this.length=0;
+Clazz.instantialize(this,arguments);
+},java.io,"OptionalDataException",java.io.ObjectStreamException);
+
+c$=Clazz.declareType(java.io,"StreamCorruptedException",java.io.ObjectStreamException);
+
+c$=Clazz.declareType(java.io,"SyncFailedException",java.io.IOException);
+
+c$=Clazz.declareType(java.io,"UnsupportedEncodingException",java.io.IOException);
+
+c$=Clazz.declareType(java.io,"UTFDataFormatException",java.io.IOException);
+
+c$=Clazz.decorateAsClass(function(){
+this.detail=null;
+Clazz.instantialize(this,arguments);
+},java.io,"WriteAbortedException",java.io.ObjectStreamException);
+Clazz.makeConstructor(c$,
+function(detailMessage,rootCause){
+Clazz.superConstructor(this,java.io.WriteAbortedException,[detailMessage]);
+this.detail=rootCause;
+this.initCause(rootCause);
+},"~S,Exception");
+Clazz.defineMethod(c$,"getMessage",
+function(){
+var msg=Clazz.superCall(this,java.io.WriteAbortedException,"getMessage",[]);
+return (this.detail ? msg + "; "+this.detail.toString() : msg);
+});
+Clazz.overrideMethod(c$,"getCause",
+function(){
+return this.detail;
+});
+
+c$=Clazz.declareType(javautil,"ConcurrentModificationException",RuntimeException);
+Clazz.makeConstructor(c$,
+function(){
+Clazz.superConstructor(this,javautil.ConcurrentModificationException,[]);
+});
+
+c$=Clazz.declareType(javautil,"EmptyStackException",RuntimeException);
+
+c$=Clazz.decorateAsClass(function(){
+this.className=null;
+this.key=null;
+Clazz.instantialize(this,arguments);
+},javautil,"MissingResourceException",RuntimeException);
+Clazz.makeConstructor(c$,
+function(detailMessage,className,resourceName){
+Clazz.superConstructor(this,javautil.MissingResourceException,[detailMessage]);
+this.className=className;
+this.key=resourceName;
+},"~S,~S,~S");
+Clazz.defineMethod(c$,"getClassName",
+function(){
+return this.className;
+});
+Clazz.defineMethod(c$,"getKey",
+function(){
+return this.key;
+});
+
+c$=Clazz.declareType(javautil,"NoSuchElementException",RuntimeException);
+
+c$=Clazz.declareType(javautil,"TooManyListenersException",Exception);
+
+c$=Clazz.declareType(java.lang,"Void");
+Clazz.defineStatics(c$,
+"TYPE",null);
+{
+java.lang.Void.TYPE=java.lang.Void;
+}Clazz.declareInterface(java.lang.reflect,"GenericDeclaration");
+Clazz.declareInterface(java.lang.reflect,"AnnotatedElement");
+
+c$=Clazz.declareType(java.lang.reflect,"AccessibleObject",null,java.lang.reflect.AnnotatedElement);
+Clazz.makeConstructor(c$,
+function(){
+});
+Clazz.defineMethod(c$,"isAccessible",
+function(){
+return false;
+});
+c$.setAccessible=Clazz.defineMethod(c$,"setAccessible",
+function(objects,flag){
+return;
+},"~A,~B");
+Clazz.defineMethod(c$,"setAccessible",
+function(flag){
+return;
+},"~B");
+Clazz.overrideMethod(c$,"isAnnotationPresent",
+function(annotationType){
+return false;
+},"Class");
+Clazz.overrideMethod(c$,"getDeclaredAnnotations",
+function(){
+return new Array(0);
+});
+Clazz.overrideMethod(c$,"getAnnotations",
+function(){
+return new Array(0);
+});
+Clazz.overrideMethod(c$,"getAnnotation",
+function(annotationType){
+return null;
+},"Class");
+c$.marshallArguments=Clazz.defineMethod(c$,"marshallArguments",
+function(parameterTypes,args){
+return null;
+},"~A,~A");
+Clazz.defineMethod(c$,"invokeV",
+function(receiver,args){
+return;
+},"~O,~A");
+Clazz.defineMethod(c$,"invokeL",
+function(receiver,args){
+return null;
+},"~O,~A");
+Clazz.defineMethod(c$,"invokeI",
+function(receiver,args){
+return 0;
+},"~O,~A");
+Clazz.defineMethod(c$,"invokeJ",
+function(receiver,args){
+return 0;
+},"~O,~A");
+Clazz.defineMethod(c$,"invokeF",
+function(receiver,args){
+return 0.0;
+},"~O,~A");
+Clazz.defineMethod(c$,"invokeD",
+function(receiver,args){
+return 0.0;
+},"~O,~A");
+c$.emptyArgs=c$.prototype.emptyArgs=new Array(0);
+Clazz.declareInterface(java.lang.reflect,"InvocationHandler");
+c$=Clazz.declareInterface(java.lang.reflect,"Member");
+Clazz.defineStatics(c$,
+"PUBLIC",0,
+"DECLARED",1);
+
+c$=Clazz.declareType(java.lang.reflect,"Modifier");
+Clazz.makeConstructor(c$,
+function(){
+});
+c$.isAbstract=Clazz.defineMethod(c$,"isAbstract",
+function(modifiers){
+return((modifiers&1024)!=0);
+},"~N");
+c$.isFinal=Clazz.defineMethod(c$,"isFinal",
+function(modifiers){
+return((modifiers&16)!=0);
+},"~N");
+c$.isInterface=Clazz.defineMethod(c$,"isInterface",
+function(modifiers){
+return((modifiers&512)!=0);
+},"~N");
+c$.isNative=Clazz.defineMethod(c$,"isNative",
+function(modifiers){
+return((modifiers&256)!=0);
+},"~N");
+c$.isPrivate=Clazz.defineMethod(c$,"isPrivate",
+function(modifiers){
+return((modifiers&2)!=0);
+},"~N");
+c$.isProtected=Clazz.defineMethod(c$,"isProtected",
+function(modifiers){
+return((modifiers&4)!=0);
+},"~N");
+c$.isPublic=Clazz.defineMethod(c$,"isPublic",
+function(modifiers){
+return((modifiers&1)!=0);
+},"~N");
+c$.isStatic=Clazz.defineMethod(c$,"isStatic",
+function(modifiers){
+return((modifiers&8)!=0);
+},"~N");
+c$.isStrict=Clazz.defineMethod(c$,"isStrict",
+function(modifiers){
+return((modifiers&2048)!=0);
+},"~N");
+c$.isSynchronized=Clazz.defineMethod(c$,"isSynchronized",
+function(modifiers){
+return((modifiers&32)!=0);
+},"~N");
+c$.isTransient=Clazz.defineMethod(c$,"isTransient",
+function(modifiers){
+return((modifiers&128)!=0);
+},"~N");
+c$.isVolatile=Clazz.defineMethod(c$,"isVolatile",
+function(modifiers){
+return((modifiers&64)!=0);
+},"~N");
+c$.toString=Clazz.defineMethod(c$,"toString",
+function(modifiers){
+var sb=new Array(0);
+if(java.lang.reflect.Modifier.isPublic(modifiers))sb[sb.length]="public";
+if(java.lang.reflect.Modifier.isProtected(modifiers))sb[sb.length]="protected";
+if(java.lang.reflect.Modifier.isPrivate(modifiers))sb[sb.length]="private";
+if(java.lang.reflect.Modifier.isAbstract(modifiers))sb[sb.length]="abstract";
+if(java.lang.reflect.Modifier.isStatic(modifiers))sb[sb.length]="static";
+if(java.lang.reflect.Modifier.isFinal(modifiers))sb[sb.length]="final";
+if(java.lang.reflect.Modifier.isTransient(modifiers))sb[sb.length]="transient";
+if(java.lang.reflect.Modifier.isVolatile(modifiers))sb[sb.length]="volatile";
+if(java.lang.reflect.Modifier.isSynchronized(modifiers))sb[sb.length]="synchronized";
+if(java.lang.reflect.Modifier.isNative(modifiers))sb[sb.length]="native";
+if(java.lang.reflect.Modifier.isStrict(modifiers))sb[sb.length]="strictfp";
+if(java.lang.reflect.Modifier.isInterface(modifiers))sb[sb.length]="interface";
+if(sb.length>0){
+return sb.join(" ");
+}return"";
+},"~N");
+Clazz.defineStatics(c$,
+"PUBLIC",0x1,
+"PRIVATE",0x2,
+"PROTECTED",0x4,
+"STATIC",0x8,
+"FINAL",0x10,
+"SYNCHRONIZED",0x20,
+"VOLATILE",0x40,
+"TRANSIENT",0x80,
+"NATIVE",0x100,
+"INTERFACE",0x200,
+"ABSTRACT",0x400,
+"STRICT",0x800,
+"BRIDGE",0x40,
+"VARARGS",0x80,
+"SYNTHETIC",0x1000,
+"ANNOTATION",0x2000,
+"ENUM",0x4000);
+
+c$=Clazz.decorateAsClass(function(){
+this.clazz=null;
+this.parameterTypes=null;
+this.exceptionTypes=null;
+this.modifiers=0;
+Clazz.instantialize(this,arguments);
+},java.lang.reflect,"Constructor",java.lang.reflect.AccessibleObject,[java.lang.reflect.GenericDeclaration,java.lang.reflect.Member]);
+Clazz.makeConstructor(c$,
+function(declaringClass,parameterTypes,checkedExceptions,modifiers){
+Clazz.superConstructor(this,java.lang.reflect.Constructor,[]);
+this.clazz=declaringClass;
+this.parameterTypes=parameterTypes;
+this.exceptionTypes=checkedExceptions;
+this.modifiers=modifiers;
+},"Class,~A,~A,~N");
+Clazz.overrideMethod(c$,"getTypeParameters",
+function(){
+return null;
+});
+Clazz.defineMethod(c$,"toGenericString",
+function(){
+return null;
+});
+Clazz.defineMethod(c$,"getGenericParameterTypes",
+function(){
+return null;
+});
+Clazz.defineMethod(c$,"getGenericExceptionTypes",
+function(){
+return null;
+});
+Clazz.defineMethod(c$,"getParameterAnnotations",
+function(){
+return null;
+});
+Clazz.defineMethod(c$,"isVarArgs",
+function(){
+return false;
+});
+Clazz.overrideMethod(c$,"isSynthetic",
+function(){
+return false;
+});
+Clazz.overrideMethod(c$,"equals",
+function(object){
+if(object!=null&&Clazz.instanceOf(object,java.lang.reflect.Constructor)){
+var other=object;
+if(this.getDeclaringClass()===other.getDeclaringClass()){
+var params1=this.parameterTypes;
+var params2=other.parameterTypes;
+if(params1.length==params2.length){
+for(var i=0;i
* A modifiable {@link CharSequence sequence of characters} for use in creating
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/text/MessageFormat.java b/sources/net.sf.j2s.java.core/src_4.2/java/text/MessageFormat.java
index 8a92ac69e..946dd3931 100644
--- a/sources/net.sf.j2s.java.core/src_4.2/java/text/MessageFormat.java
+++ b/sources/net.sf.j2s.java.core/src_4.2/java/text/MessageFormat.java
@@ -31,18 +31,12 @@ public MessageFormat(String pattern, Locale locale) {
}
/**
- * @j2sNativeSrc
+ * @j2sNative
* return pattern.replace (/\{(\d+)\}/g, function ($0, $1) {
* var i = parseInt ($1);
* if (args == null) return null;
* return args[i];
* });
- * @j2sNative
- * return a.replace (/\{(\d+)\}/g, function ($0, $1) {
- * var i = parseInt ($1);
- * if (b == null) return null;
- * return b[i];
- * });
*/
public static String format(String pattern, Object[] args) {
return pattern;
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/ResourceBundle.java b/sources/net.sf.j2s.java.core/src_4.2/java/util/ResourceBundle.java
index a66c70b97..63cc10678 100644
--- a/sources/net.sf.j2s.java.core/src_4.2/java/util/ResourceBundle.java
+++ b/sources/net.sf.j2s.java.core/src_4.2/java/util/ResourceBundle.java
@@ -617,16 +617,11 @@ private void initBundle() {
String[] m = this.map;
String[] k = this.keys;
/**
- * @j2sNativeSrc
+ * @j2sNative
* if (m[key] == null) {
* k[k.length] = key;
* }
* m[key] = value;
- * @j2sNative
- * if (i[g] == null) {
- * j[j.length] = g;
- * }
- * i[g] = h;
*/
{
//keys[keys.length] = key;
@@ -662,11 +657,10 @@ protected Object handleGetObject(String key) {
}
String[] m = this.map;
/**
- * @j2sNativeSrc
- return m[key];
* @j2sNative
- return b[a];
- */ {}
+ return m[key];
+ */
+ {}
//return map.get(key);
return m; // Should never reach here in JS
}
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/AbstractMethodError.java b/sources/net.sf.j2s.java.core/unused/lang/AbstractMethodError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/AbstractMethodError.java
rename to sources/net.sf.j2s.java.core/unused/lang/AbstractMethodError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/ArithmeticException.java b/sources/net.sf.j2s.java.core/unused/lang/ArithmeticException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/ArithmeticException.java
rename to sources/net.sf.j2s.java.core/unused/lang/ArithmeticException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/ArrayIndexOutOfBoundsException.java b/sources/net.sf.j2s.java.core/unused/lang/ArrayIndexOutOfBoundsException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/ArrayIndexOutOfBoundsException.java
rename to sources/net.sf.j2s.java.core/unused/lang/ArrayIndexOutOfBoundsException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/ArrayStoreException.java b/sources/net.sf.j2s.java.core/unused/lang/ArrayStoreException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/ArrayStoreException.java
rename to sources/net.sf.j2s.java.core/unused/lang/ArrayStoreException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/AssertionError.java b/sources/net.sf.j2s.java.core/unused/lang/AssertionError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/AssertionError.java
rename to sources/net.sf.j2s.java.core/unused/lang/AssertionError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/ClassCastException.java b/sources/net.sf.j2s.java.core/unused/lang/ClassCastException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/ClassCastException.java
rename to sources/net.sf.j2s.java.core/unused/lang/ClassCastException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/ClassCircularityError.java b/sources/net.sf.j2s.java.core/unused/lang/ClassCircularityError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/ClassCircularityError.java
rename to sources/net.sf.j2s.java.core/unused/lang/ClassCircularityError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/ClassFormatError.java b/sources/net.sf.j2s.java.core/unused/lang/ClassFormatError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/ClassFormatError.java
rename to sources/net.sf.j2s.java.core/unused/lang/ClassFormatError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/ClassNotFoundException.java b/sources/net.sf.j2s.java.core/unused/lang/ClassNotFoundException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/ClassNotFoundException.java
rename to sources/net.sf.j2s.java.core/unused/lang/ClassNotFoundException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/CloneNotSupportedException.java b/sources/net.sf.j2s.java.core/unused/lang/CloneNotSupportedException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/CloneNotSupportedException.java
rename to sources/net.sf.j2s.java.core/unused/lang/CloneNotSupportedException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/Error.java b/sources/net.sf.j2s.java.core/unused/lang/Error.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/Error.java
rename to sources/net.sf.j2s.java.core/unused/lang/Error.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/Exception.java b/sources/net.sf.j2s.java.core/unused/lang/Exception.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/Exception.java
rename to sources/net.sf.j2s.java.core/unused/lang/Exception.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/ExceptionInInitializerError.java b/sources/net.sf.j2s.java.core/unused/lang/ExceptionInInitializerError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/ExceptionInInitializerError.java
rename to sources/net.sf.j2s.java.core/unused/lang/ExceptionInInitializerError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/IllegalAccessError.java b/sources/net.sf.j2s.java.core/unused/lang/IllegalAccessError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/IllegalAccessError.java
rename to sources/net.sf.j2s.java.core/unused/lang/IllegalAccessError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/IllegalAccessException.java b/sources/net.sf.j2s.java.core/unused/lang/IllegalAccessException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/IllegalAccessException.java
rename to sources/net.sf.j2s.java.core/unused/lang/IllegalAccessException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/IllegalArgumentException.java b/sources/net.sf.j2s.java.core/unused/lang/IllegalArgumentException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/IllegalArgumentException.java
rename to sources/net.sf.j2s.java.core/unused/lang/IllegalArgumentException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/IllegalMonitorStateException.java b/sources/net.sf.j2s.java.core/unused/lang/IllegalMonitorStateException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/IllegalMonitorStateException.java
rename to sources/net.sf.j2s.java.core/unused/lang/IllegalMonitorStateException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/IllegalStateException.java b/sources/net.sf.j2s.java.core/unused/lang/IllegalStateException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/IllegalStateException.java
rename to sources/net.sf.j2s.java.core/unused/lang/IllegalStateException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/IllegalThreadStateException.java b/sources/net.sf.j2s.java.core/unused/lang/IllegalThreadStateException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/IllegalThreadStateException.java
rename to sources/net.sf.j2s.java.core/unused/lang/IllegalThreadStateException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/IncompatibleClassChangeError.java b/sources/net.sf.j2s.java.core/unused/lang/IncompatibleClassChangeError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/IncompatibleClassChangeError.java
rename to sources/net.sf.j2s.java.core/unused/lang/IncompatibleClassChangeError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/IndexOutOfBoundsException.java b/sources/net.sf.j2s.java.core/unused/lang/IndexOutOfBoundsException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/IndexOutOfBoundsException.java
rename to sources/net.sf.j2s.java.core/unused/lang/IndexOutOfBoundsException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/InstantiationError.java b/sources/net.sf.j2s.java.core/unused/lang/InstantiationError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/InstantiationError.java
rename to sources/net.sf.j2s.java.core/unused/lang/InstantiationError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/InstantiationException.java b/sources/net.sf.j2s.java.core/unused/lang/InstantiationException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/InstantiationException.java
rename to sources/net.sf.j2s.java.core/unused/lang/InstantiationException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/InternalError.java b/sources/net.sf.j2s.java.core/unused/lang/InternalError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/InternalError.java
rename to sources/net.sf.j2s.java.core/unused/lang/InternalError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/InterruptedException.java b/sources/net.sf.j2s.java.core/unused/lang/InterruptedException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/InterruptedException.java
rename to sources/net.sf.j2s.java.core/unused/lang/InterruptedException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/Iterable.java b/sources/net.sf.j2s.java.core/unused/lang/Iterable.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/Iterable.java
rename to sources/net.sf.j2s.java.core/unused/lang/Iterable.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/LinkageError.java b/sources/net.sf.j2s.java.core/unused/lang/LinkageError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/LinkageError.java
rename to sources/net.sf.j2s.java.core/unused/lang/LinkageError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/NegativeArraySizeException.java b/sources/net.sf.j2s.java.core/unused/lang/NegativeArraySizeException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/NegativeArraySizeException.java
rename to sources/net.sf.j2s.java.core/unused/lang/NegativeArraySizeException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/NoClassDefFoundError.java b/sources/net.sf.j2s.java.core/unused/lang/NoClassDefFoundError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/NoClassDefFoundError.java
rename to sources/net.sf.j2s.java.core/unused/lang/NoClassDefFoundError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/NoSuchFieldError.java b/sources/net.sf.j2s.java.core/unused/lang/NoSuchFieldError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/NoSuchFieldError.java
rename to sources/net.sf.j2s.java.core/unused/lang/NoSuchFieldError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/NoSuchFieldException.java b/sources/net.sf.j2s.java.core/unused/lang/NoSuchFieldException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/NoSuchFieldException.java
rename to sources/net.sf.j2s.java.core/unused/lang/NoSuchFieldException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/NoSuchMethodError.java b/sources/net.sf.j2s.java.core/unused/lang/NoSuchMethodError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/NoSuchMethodError.java
rename to sources/net.sf.j2s.java.core/unused/lang/NoSuchMethodError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/NoSuchMethodException.java b/sources/net.sf.j2s.java.core/unused/lang/NoSuchMethodException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/NoSuchMethodException.java
rename to sources/net.sf.j2s.java.core/unused/lang/NoSuchMethodException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/NullPointerException.java b/sources/net.sf.j2s.java.core/unused/lang/NullPointerException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/NullPointerException.java
rename to sources/net.sf.j2s.java.core/unused/lang/NullPointerException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/NumberFormatException.java b/sources/net.sf.j2s.java.core/unused/lang/NumberFormatException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/NumberFormatException.java
rename to sources/net.sf.j2s.java.core/unused/lang/NumberFormatException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/OutOfMemoryError.java b/sources/net.sf.j2s.java.core/unused/lang/OutOfMemoryError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/OutOfMemoryError.java
rename to sources/net.sf.j2s.java.core/unused/lang/OutOfMemoryError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/RuntimeException.java b/sources/net.sf.j2s.java.core/unused/lang/RuntimeException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/RuntimeException.java
rename to sources/net.sf.j2s.java.core/unused/lang/RuntimeException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/SecurityException.java b/sources/net.sf.j2s.java.core/unused/lang/SecurityException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/SecurityException.java
rename to sources/net.sf.j2s.java.core/unused/lang/SecurityException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/StackOverflowError.java b/sources/net.sf.j2s.java.core/unused/lang/StackOverflowError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/StackOverflowError.java
rename to sources/net.sf.j2s.java.core/unused/lang/StackOverflowError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/StackTraceElement.java b/sources/net.sf.j2s.java.core/unused/lang/StackTraceElement.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/StackTraceElement.java
rename to sources/net.sf.j2s.java.core/unused/lang/StackTraceElement.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/StrictMath.java b/sources/net.sf.j2s.java.core/unused/lang/StrictMath.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/StrictMath.java
rename to sources/net.sf.j2s.java.core/unused/lang/StrictMath.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/StringIndexOutOfBoundsException.java b/sources/net.sf.j2s.java.core/unused/lang/StringIndexOutOfBoundsException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/StringIndexOutOfBoundsException.java
rename to sources/net.sf.j2s.java.core/unused/lang/StringIndexOutOfBoundsException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/ThreadDeath.java b/sources/net.sf.j2s.java.core/unused/lang/ThreadDeath.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/ThreadDeath.java
rename to sources/net.sf.j2s.java.core/unused/lang/ThreadDeath.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/Throwable.java b/sources/net.sf.j2s.java.core/unused/lang/Throwable.java
similarity index 95%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/Throwable.java
rename to sources/net.sf.j2s.java.core/unused/lang/Throwable.java
index c88f4807a..ccbd2f520 100644
--- a/sources/net.sf.j2s.java.core/src_4.2/java/lang/Throwable.java
+++ b/sources/net.sf.j2s.java.core/unused/lang/Throwable.java
@@ -458,21 +458,13 @@ public void printStackTrace() {
System.err.println(this);
for (int i = 0; i < stackTrace.length; i++)
/**
- * @j2sNativeSrc
+ * @j2sNative
var t = this.stackTrace[i];
var x = t.methodName.indexOf ("(");
var n = t.methodName.substring (0, x).replace (/\s+/g, "");
if (n != "construct" || t.nativeClazz == null
|| Clazz.getInheritedLevel (t.nativeClazz, Throwable) < 0) {
System.err.println (t);
-}
- * @j2sNative
-var t = this.c[i];
-var x = t.e.indexOf ("(");
-var n = t.e.substring (0, x).replace (/\s+/g, "");
-if (n != "construct" || t.z == null
- || Clazz.getInheritedLevel (t.z, Throwable) < 0) {
- System.err.println (t);
}
*/
{
@@ -587,7 +579,7 @@ private void printStackTraceAsCause(PrintWriter s,
*
* @return a reference to this Throwable
instance.
* @see java.lang.Throwable#printStackTrace()
- * @j2sNativeSrc
+ * @j2sNative
this.stackTrace = new Array ();
var caller = arguments.callee.caller;
var superCaller = null;
@@ -639,60 +631,6 @@ private void printStackTraceAsCause(PrintWriter s,
caller = superCaller.arguments.callee.caller;
}
Clazz.initializingException = false;
-return this;
- * @j2sNative
-this.c = new Array ();
-var r = arguments.callee.caller;
-var s = null;
-var l = new Array ();
-var q = Clazz.callingStackTraces;
-var x = q.length - 1;
-var p = true;
-while (x > -1 || r != null) {
- var clazzName = null;
- var z = null;
- if (!p || r == Clazz.tryToSearchAndExecute || r == Clazz.superCall || r == null) {
- if (x < 0) {
- break;
- }
- p = true;
- s = q[x].caller;
- z = q[x].owner;
- x--;
- } else {
- s = r;
- if (s.claxxOwner != null) {
- z = s.claxxOwner;
- } else if (s.exClazz != null) {
- z = s.exClazz;
- }
- }
-
- var st = new StackTraceElement (
- ((z != null && z.__CLASS_NAME__.length != 0) ?
- z.__CLASS_NAME__ : "anonymous"),
- ((s.exName == null) ? "anonymous" : s.exName)
- + " (" + Clazz.getParamsType (s.arguments) + ")",
- null, -1);
- st.z = z;
- this.c[this.c.length] = st;
- for (var i = 0; i < l.length; i++) {
- if (l[i] == s) {
- // ... stack information lost as recursive invocation existed ...
- var st = new StackTraceElement ("lost", "missing", null, -3);
- st.z = null;
- this.c[this.c.length] = st;
-
- p = false;
- //break;
- }
- }
- if (s != null) {
- l[l.length] = s;
- }
- r = s.arguments.callee.caller;
-}
-Clazz.initializingException = false;
return this;
*/
public synchronized native Throwable fillInStackTrace();
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/TypeNotPresentException.java b/sources/net.sf.j2s.java.core/unused/lang/TypeNotPresentException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/TypeNotPresentException.java
rename to sources/net.sf.j2s.java.core/unused/lang/TypeNotPresentException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/UnknownError.java b/sources/net.sf.j2s.java.core/unused/lang/UnknownError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/UnknownError.java
rename to sources/net.sf.j2s.java.core/unused/lang/UnknownError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/UnsatisfiedLinkError.java b/sources/net.sf.j2s.java.core/unused/lang/UnsatisfiedLinkError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/UnsatisfiedLinkError.java
rename to sources/net.sf.j2s.java.core/unused/lang/UnsatisfiedLinkError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/UnsupportedClassVersionError.java b/sources/net.sf.j2s.java.core/unused/lang/UnsupportedClassVersionError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/UnsupportedClassVersionError.java
rename to sources/net.sf.j2s.java.core/unused/lang/UnsupportedClassVersionError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/UnsupportedOperationException.java b/sources/net.sf.j2s.java.core/unused/lang/UnsupportedOperationException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/UnsupportedOperationException.java
rename to sources/net.sf.j2s.java.core/unused/lang/UnsupportedOperationException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/VerifyError.java b/sources/net.sf.j2s.java.core/unused/lang/VerifyError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/VerifyError.java
rename to sources/net.sf.j2s.java.core/unused/lang/VerifyError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/VirtualMachineError.java b/sources/net.sf.j2s.java.core/unused/lang/VirtualMachineError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/VirtualMachineError.java
rename to sources/net.sf.j2s.java.core/unused/lang/VirtualMachineError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/Void.java b/sources/net.sf.j2s.java.core/unused/lang/Void.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/Void.java
rename to sources/net.sf.j2s.java.core/unused/lang/Void.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/Annotation.java b/sources/net.sf.j2s.java.core/unused/lang/annotation/Annotation.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/Annotation.java
rename to sources/net.sf.j2s.java.core/unused/lang/annotation/Annotation.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/AnnotationFormatError.java b/sources/net.sf.j2s.java.core/unused/lang/annotation/AnnotationFormatError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/AnnotationFormatError.java
rename to sources/net.sf.j2s.java.core/unused/lang/annotation/AnnotationFormatError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/AnnotationTypeMismatchException.java b/sources/net.sf.j2s.java.core/unused/lang/annotation/AnnotationTypeMismatchException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/AnnotationTypeMismatchException.java
rename to sources/net.sf.j2s.java.core/unused/lang/annotation/AnnotationTypeMismatchException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/Documented.java b/sources/net.sf.j2s.java.core/unused/lang/annotation/Documented.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/Documented.java
rename to sources/net.sf.j2s.java.core/unused/lang/annotation/Documented.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/ElementType.java b/sources/net.sf.j2s.java.core/unused/lang/annotation/ElementType.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/ElementType.java
rename to sources/net.sf.j2s.java.core/unused/lang/annotation/ElementType.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/IncompleteAnnotationException.java b/sources/net.sf.j2s.java.core/unused/lang/annotation/IncompleteAnnotationException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/IncompleteAnnotationException.java
rename to sources/net.sf.j2s.java.core/unused/lang/annotation/IncompleteAnnotationException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/Inherited.java b/sources/net.sf.j2s.java.core/unused/lang/annotation/Inherited.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/Inherited.java
rename to sources/net.sf.j2s.java.core/unused/lang/annotation/Inherited.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/Retention.java b/sources/net.sf.j2s.java.core/unused/lang/annotation/Retention.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/Retention.java
rename to sources/net.sf.j2s.java.core/unused/lang/annotation/Retention.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/RetentionPolicy.java b/sources/net.sf.j2s.java.core/unused/lang/annotation/RetentionPolicy.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/RetentionPolicy.java
rename to sources/net.sf.j2s.java.core/unused/lang/annotation/RetentionPolicy.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/Target.java b/sources/net.sf.j2s.java.core/unused/lang/annotation/Target.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/annotation/Target.java
rename to sources/net.sf.j2s.java.core/unused/lang/annotation/Target.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/AccessibleObject.java b/sources/net.sf.j2s.java.core/unused/reflect/AccessibleObject.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/AccessibleObject.java
rename to sources/net.sf.j2s.java.core/unused/reflect/AccessibleObject.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/AnnotatedElement.java b/sources/net.sf.j2s.java.core/unused/reflect/AnnotatedElement.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/AnnotatedElement.java
rename to sources/net.sf.j2s.java.core/unused/reflect/AnnotatedElement.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Array.java b/sources/net.sf.j2s.java.core/unused/reflect/Array.java
similarity index 99%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Array.java
rename to sources/net.sf.j2s.java.core/unused/reflect/Array.java
index 9837c877a..0ce186005 100644
--- a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Array.java
+++ b/sources/net.sf.j2s.java.core/unused/reflect/Array.java
@@ -280,10 +280,8 @@ public static Object newInstance(Class> componentType, int[] dimensions)
* @exception java.lang.NegativeArraySizeException
* if the size if negative
*
- * @j2sNativeSrc
- * return Clazz.newArray (length);
* @j2sNative
- * return Clazz.newArray (b);
+ * return Clazz.newArray (length);
*/
public static Object newInstance(Class> componentType, int size)
throws NegativeArraySizeException {
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Constructor.java b/sources/net.sf.j2s.java.core/unused/reflect/Constructor.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Constructor.java
rename to sources/net.sf.j2s.java.core/unused/reflect/Constructor.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Field.java b/sources/net.sf.j2s.java.core/unused/reflect/Field.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Field.java
rename to sources/net.sf.j2s.java.core/unused/reflect/Field.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/GenericDeclaration.java b/sources/net.sf.j2s.java.core/unused/reflect/GenericDeclaration.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/GenericDeclaration.java
rename to sources/net.sf.j2s.java.core/unused/reflect/GenericDeclaration.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/GenericSignatureFormatError.java b/sources/net.sf.j2s.java.core/unused/reflect/GenericSignatureFormatError.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/GenericSignatureFormatError.java
rename to sources/net.sf.j2s.java.core/unused/reflect/GenericSignatureFormatError.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/InvocationHandler.java b/sources/net.sf.j2s.java.core/unused/reflect/InvocationHandler.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/InvocationHandler.java
rename to sources/net.sf.j2s.java.core/unused/reflect/InvocationHandler.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/InvocationTargetException.java b/sources/net.sf.j2s.java.core/unused/reflect/InvocationTargetException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/InvocationTargetException.java
rename to sources/net.sf.j2s.java.core/unused/reflect/InvocationTargetException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/MalformedParameterizedTypeException.java b/sources/net.sf.j2s.java.core/unused/reflect/MalformedParameterizedTypeException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/MalformedParameterizedTypeException.java
rename to sources/net.sf.j2s.java.core/unused/reflect/MalformedParameterizedTypeException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Member.java b/sources/net.sf.j2s.java.core/unused/reflect/Member.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Member.java
rename to sources/net.sf.j2s.java.core/unused/reflect/Member.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Method.java b/sources/net.sf.j2s.java.core/unused/reflect/Method.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Method.java
rename to sources/net.sf.j2s.java.core/unused/reflect/Method.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Modifier.java b/sources/net.sf.j2s.java.core/unused/reflect/Modifier.java
similarity index 99%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Modifier.java
rename to sources/net.sf.j2s.java.core/unused/reflect/Modifier.java
index 4c98e108c..00f598028 100644
--- a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Modifier.java
+++ b/sources/net.sf.j2s.java.core/unused/reflect/Modifier.java
@@ -273,10 +273,8 @@ public static java.lang.String toString(int modifiers) {
if (sb.length > 0) /* join the array */
/**
- * @j2sNativeSrc
- * return sb.join (" ");
* @j2sNative
- * return a.join (" ");
+ * return sb.join(" ");
*/
{
return sb.toString();
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Proxy.java b/sources/net.sf.j2s.java.core/unused/reflect/Proxy.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/Proxy.java
rename to sources/net.sf.j2s.java.core/unused/reflect/Proxy.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/ReflectPermission.java b/sources/net.sf.j2s.java.core/unused/reflect/ReflectPermission.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/ReflectPermission.java
rename to sources/net.sf.j2s.java.core/unused/reflect/ReflectPermission.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/TypeVariable.java b/sources/net.sf.j2s.java.core/unused/reflect/TypeVariable.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/TypeVariable.java
rename to sources/net.sf.j2s.java.core/unused/reflect/TypeVariable.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/UndeclaredThrowableException.java b/sources/net.sf.j2s.java.core/unused/reflect/UndeclaredThrowableException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/lang/reflect/UndeclaredThrowableException.java
rename to sources/net.sf.j2s.java.core/unused/reflect/UndeclaredThrowableException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/text/Annotation.java b/sources/net.sf.j2s.java.core/unused/text/Annotation.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/text/Annotation.java
rename to sources/net.sf.j2s.java.core/unused/text/Annotation.java
diff --git a/sources/net.sf.j2s.java.core/unused/text/MessageFormat.java b/sources/net.sf.j2s.java.core/unused/text/MessageFormat.java
new file mode 100644
index 000000000..946dd3931
--- /dev/null
+++ b/sources/net.sf.j2s.java.core/unused/text/MessageFormat.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007 java2script.org and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Zhou Renjian - initial API and implementation
+ *******************************************************************************/
+
+package java.text;
+
+import java.util.Locale;
+
+
+/**
+ * @author zhou renjian
+ *
+ * 2006-10-10
+ */
+public class MessageFormat {
+ private String pattern;
+
+ public MessageFormat(String pattern) {
+ this.pattern = pattern;
+ }
+
+ public MessageFormat(String pattern, Locale locale) {
+ this.pattern = pattern;
+ }
+
+ /**
+ * @j2sNative
+ * return pattern.replace (/\{(\d+)\}/g, function ($0, $1) {
+ * var i = parseInt ($1);
+ * if (args == null) return null;
+ * return args[i];
+ * });
+ */
+ public static String format(String pattern, Object[] args) {
+ return pattern;
+ }
+
+ public final String format (Object obj) {
+ return format(pattern, new Object[] { obj });
+ }
+}
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/ConcurrentModificationException.java b/sources/net.sf.j2s.java.core/unused/util/ConcurrentModificationException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/ConcurrentModificationException.java
rename to sources/net.sf.j2s.java.core/unused/util/ConcurrentModificationException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/DuplicateFormatFlagsException.java b/sources/net.sf.j2s.java.core/unused/util/DuplicateFormatFlagsException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/DuplicateFormatFlagsException.java
rename to sources/net.sf.j2s.java.core/unused/util/DuplicateFormatFlagsException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/EmptyStackException.java b/sources/net.sf.j2s.java.core/unused/util/EmptyStackException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/EmptyStackException.java
rename to sources/net.sf.j2s.java.core/unused/util/EmptyStackException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/FormatFlagsConversionMismatchException.java b/sources/net.sf.j2s.java.core/unused/util/FormatFlagsConversionMismatchException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/FormatFlagsConversionMismatchException.java
rename to sources/net.sf.j2s.java.core/unused/util/FormatFlagsConversionMismatchException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/FormatterClosedException.java b/sources/net.sf.j2s.java.core/unused/util/FormatterClosedException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/FormatterClosedException.java
rename to sources/net.sf.j2s.java.core/unused/util/FormatterClosedException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/IllegalFormatCodePointException.java b/sources/net.sf.j2s.java.core/unused/util/IllegalFormatCodePointException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/IllegalFormatCodePointException.java
rename to sources/net.sf.j2s.java.core/unused/util/IllegalFormatCodePointException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/IllegalFormatConversionException.java b/sources/net.sf.j2s.java.core/unused/util/IllegalFormatConversionException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/IllegalFormatConversionException.java
rename to sources/net.sf.j2s.java.core/unused/util/IllegalFormatConversionException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/IllegalFormatException.java b/sources/net.sf.j2s.java.core/unused/util/IllegalFormatException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/IllegalFormatException.java
rename to sources/net.sf.j2s.java.core/unused/util/IllegalFormatException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/IllegalFormatFlagsException.java b/sources/net.sf.j2s.java.core/unused/util/IllegalFormatFlagsException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/IllegalFormatFlagsException.java
rename to sources/net.sf.j2s.java.core/unused/util/IllegalFormatFlagsException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/IllegalFormatPrecisionException.java b/sources/net.sf.j2s.java.core/unused/util/IllegalFormatPrecisionException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/IllegalFormatPrecisionException.java
rename to sources/net.sf.j2s.java.core/unused/util/IllegalFormatPrecisionException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/IllegalFormatWidthException.java b/sources/net.sf.j2s.java.core/unused/util/IllegalFormatWidthException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/IllegalFormatWidthException.java
rename to sources/net.sf.j2s.java.core/unused/util/IllegalFormatWidthException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/InputMismatchException.java b/sources/net.sf.j2s.java.core/unused/util/InputMismatchException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/InputMismatchException.java
rename to sources/net.sf.j2s.java.core/unused/util/InputMismatchException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/InvalidPropertiesFormatException.java b/sources/net.sf.j2s.java.core/unused/util/InvalidPropertiesFormatException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/InvalidPropertiesFormatException.java
rename to sources/net.sf.j2s.java.core/unused/util/InvalidPropertiesFormatException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/MissingFormatArgumentException.java b/sources/net.sf.j2s.java.core/unused/util/MissingFormatArgumentException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/MissingFormatArgumentException.java
rename to sources/net.sf.j2s.java.core/unused/util/MissingFormatArgumentException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/MissingFormatWidthException.java b/sources/net.sf.j2s.java.core/unused/util/MissingFormatWidthException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/MissingFormatWidthException.java
rename to sources/net.sf.j2s.java.core/unused/util/MissingFormatWidthException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/MissingResourceException.java b/sources/net.sf.j2s.java.core/unused/util/MissingResourceException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/MissingResourceException.java
rename to sources/net.sf.j2s.java.core/unused/util/MissingResourceException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/NoSuchElementException.java b/sources/net.sf.j2s.java.core/unused/util/NoSuchElementException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/NoSuchElementException.java
rename to sources/net.sf.j2s.java.core/unused/util/NoSuchElementException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/TooManyListenersException.java b/sources/net.sf.j2s.java.core/unused/util/TooManyListenersException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/TooManyListenersException.java
rename to sources/net.sf.j2s.java.core/unused/util/TooManyListenersException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/UnknownFormatConversionException.java b/sources/net.sf.j2s.java.core/unused/util/UnknownFormatConversionException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/UnknownFormatConversionException.java
rename to sources/net.sf.j2s.java.core/unused/util/UnknownFormatConversionException.java
diff --git a/sources/net.sf.j2s.java.core/src_4.2/java/util/UnknownFormatFlagsException.java b/sources/net.sf.j2s.java.core/unused/util/UnknownFormatFlagsException.java
similarity index 100%
rename from sources/net.sf.j2s.java.core/src_4.2/java/util/UnknownFormatFlagsException.java
rename to sources/net.sf.j2s.java.core/unused/util/UnknownFormatFlagsException.java