-
Notifications
You must be signed in to change notification settings - Fork 30
major refactoring of legacy only #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AbstractStringBuilder Also removing java.util.regex as unnecessary for Jmol
switch(String) try(resource)
- ensures exception matching and instanceOf do not load classes (because if the class does not already exist, there is necessarily no match. - class name refactoring to clarify what is an ASTVisitor and what is just a Java2Script helper.
clarification of "Helpers" vs "Visitors" better subclassing consolidation of code for accessing Helpers removes @j2sSuffix and @j2sPrefix removed (never used in Jmol) swaths of comments removed.
description only
Change con.err() to con.error()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The old 2012 version 4.2 transpiler was brought up to speed and integrated into the SwingJS java2script transpiler as an optional second transpiler (using .j2sjmol instead of .j2s as a config file). All of the recognized bugs in the 4.2 transpiler were fixed as part of the process, including issues with global c$ and f$ (Clazz.pu$h and Claz.p0p removed; anonymous function wrappers added), unnecessary final static literals (removed), unnecessary Clazz.prepareStatics (removed), missing boxing and unboxing in field and variable initializers, unnecessary requirements for loading classes in instanceof and in exception checking (because a class that has not been loaded cannot be a match for those), failure to convert char to int in switch cases, lack of Java 8 string-based switch, limitation of Java 4 syntax in general, and probably a few other issues.
The code was streamlined and reorganized to have only two high-level ASTVisitor classes (J2SLegacyVisitor and J2SDependencyVisitor), with additional static methods in J2SUtil. The legacy transpiler was switched from being a compiler option (in .project) to being a second CompilationParticipant option (same participant as the SwingJS transpiler), with added options allowing direct JavaScript insertion into site/jsmol/j2s.
The workflow was immensely simplified. No longer any need for Eclipse Luna (using Eclipse Photon 4.8.0 now) or any limitation to Java 6 (using Java 8 now). A single ANT task creates dist_to_jsmol/Jmol-j2s-site.zip, and a single ANT task in the Jmol project unzips that into its site/ directory. Nothing more than that. The JSmol project is not specifically just for the HTML and non-Jmol-related project files that are pulled into site/ (such as all the HTML test files, jQuery, the Jmol object, etc.)
This Jmol-specific transpiler should still not be used for any other project, as it is a highly streamlined Java package (no StringBuilder or StringBuffer classes, for example) limited to only about 120 Java classes. No java.awt, no javax.swing, no sun.* -- just the classes in java.io, java.lang, java.net, and java.util that Jmol needs.
Older files are still available in the unused/ folder.
Bob Hanson 2023.11.28