Skip to content
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

BIRT/JavaScript: Rhino engine, activate the "Version ES6" as new default for the BIRT-Rhino-engine #1574

Closed
speckyspooky opened this issue Feb 26, 2024 · 11 comments
Assignees
Labels
Enhancement Small change to improve the current supported functionality
Milestone

Comments

@speckyspooky
Copy link
Contributor

speckyspooky commented Feb 26, 2024

The BIRT-engine use for the JavaScript execution the Rhino-engine.
The default versionof Rhino is since 1.7.9 version "180" (BIRT use currently version 1.7.10 based on BIRT 4.14).

The plan would be to change the default of the BIRT-Rhino engine to the version ES6/version 200.
This version is available since Rhino version 1.7.7 based on new configuration: Context.VERSION_ES6
(June 17, 2015, source : https://github.com/mozilla/rhino/blob/6ec10856891879e3583e6d47b05e82d9ae8a19c6/RELEASE-NOTES.md?plain=1#L715).

I analysed the BIRT-process to create the according JavaScript-engine.
The creation of the engine is encapsulated from the report mechanism.

Therefore I would change 2 classes and set the new version ES6 as the new default JavaScript-processing version fro BIRT.
But there would be currently no way to change the version back to another version due to the special encapsulated of the engine (implementation of User-Properties would be very hard with lot of changes).

The 2 class changes are necessary for the JavaScript-engine and for the JavaScript-validator:

Change 01: Class: JavascriptEngine -> Constructor: JavascriptEngine:

this.context.setLanguageVersion(Context.VERSION_ES6);

Change 02: Class: ScriptValidator -> Method: validateScript

compilerEnv.setLanguageVersion(Context.VERSION_ES6);

@wimjongman, @hvbargen, @merks
Please vote from your side should we go this step - from my side I would prefer to go this way.
The version ES6 is a stable Rhino-mechanism and I see many advantages if we use this as new default.
(I don't know any negative facts if we would use it as the new default.)

But please your point of view to this option and change.

(By the way, I have tested the ES6 with my reports and currently I found only positive new options and all my scripts were running.)

@speckyspooky speckyspooky added the Enhancement Small change to improve the current supported functionality label Feb 26, 2024
@speckyspooky speckyspooky added this to the 4.15 milestone Feb 26, 2024
@wimjongman
Copy link
Contributor

wimjongman commented Feb 26, 2024

Sure, but let's do it early in 4.16.

@hvbtup
Copy link
Contributor

hvbtup commented Feb 27, 2024

But there would be currently no way to change the version back to another version...

Thomas, do you mean that the ES version must be set when BIRT as a whole initializes and thus cannot be changed per report?

I'd prefer (if it is possible) to be able to set this on a per-report basis.

Anyway, if it is only configurable for BIRT as a whole, we should allow a system property (say, birt.ecmascript.version to manually select a different version, to allow backward compatibility where necessary.

I'm +1 for deferring it to 4.16.

I think this is logically a change to the ROM (just like the improvement to support diagonal borders, btw), so we should increase the version number in the rptdesign files.

The reason is:
The BIRT releases used for designing the report and for running the report may differ (eg we still usually use BIRT 4.2.1 for developing reports).
If a report is developed in a BIRT 4.16 environment with ES6 support, it will usually not run in an BIRT 4.15 or older environment.

Increasing the version number means (at least I understand it that way):
This report design might not work with a BIRT release which only knows lower version numbers.
To make an rptdesign file work with older BIRT releases then means to manually edit the file and decrease the version number and hope for the best.

@speckyspooky
Copy link
Contributor Author

Yes, I will switch the change to 4.16.

@hvbtup: Henning, what would be a good place for the configuration because it must be work multiple with eclipse, runtime (standard & OSGI).
And yes, the classes are very strong splitted. So there is no easy way to exchange user properties (I found currently no way for it.)

@hvbtup
Copy link
Contributor

hvbtup commented Feb 27, 2024

As I said, I think it suffices if the default ES version can be overridden with a system property.

@speckyspooky speckyspooky self-assigned this Feb 28, 2024
@speckyspooky speckyspooky modified the milestones: 4.15, 4.16 Feb 28, 2024
@speckyspooky
Copy link
Contributor Author

Of course, I switched the change to BIRT 4.16. I will also add a system-property to switch from default to other older Rhino-JS-version.

@hvbtup
Copy link
Contributor

hvbtup commented Feb 28, 2024

Please specify the switch in such a way that the version can be specified as a string or something, not a boolean. This way it will be future-proof.

@speckyspooky
Copy link
Contributor Author

Henning, I would never use a boolean for that. In every case I will implements a string for the key-value.
The key option will be oriented in full at the version-configuration of the Rhino-Engine:

JavaScript - Verions (Rhino-Engine) Master

  • The Version number will be the key of the property, not the internal version number.
  • Version: 1.1 (internal Rhino-Engine version no.: 100)
  • Version: 1.1 (internal Rhino-Engine version no.: 110)
  • Version: 1.2 (internal Rhino-Engine version no.: 120)
  • Version: 1.3 (internal Rhino-Engine version no.: 130)
  • Version: 1.4 (internal Rhino-Engine version no.: 140)
  • Version: 1.5 (internal Rhino-Engine version no.: 150)
  • Version: 1.6 (internal Rhino-Engine version no.: 160)
  • Version: 1.7 (internal Rhino-Engine version no.: 170)
  • Version: 1.8 (internal Rhino-Engine version no.: 180, Rhnio-Engine default)
  • Version: ES6 (internal Rhino-Engine version no.: 200, BIRT-default 4.16)

@SteveSchafer-Innovent
Copy link
Contributor

+1 for ES6. Been wanting this for a long time.

@wimjongman
Copy link
Contributor

Hey Steve!

@speckyspooky
Copy link
Contributor Author

I will create a PR with it after publishing of 4.15.

speckyspooky added a commit to speckyspooky/birt that referenced this issue May 12, 2024
speckyspooky added a commit that referenced this issue May 13, 2024
* Enhancement to add ECMAScript 6 support (#1574)
@speckyspooky
Copy link
Contributor Author

The change is merged to the master branche with PR #1682

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Small change to improve the current supported functionality
Projects
None yet
Development

No branches or pull requests

4 participants