Closed
Bug 547071
Opened 15 years ago
Closed 6 years ago
Java hosted module script provider for CommonJS
Categories
(Rhino Graveyard :: Core, enhancement)
Tracking
(Not tracked)
RESOLVED
INACTIVE
People
(Reporter: jpalka, Unassigned)
Details
Attachments
(1 file, 1 obsolete file)
11.54 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.2) Gecko/20100115 Firefox/3.6
Build Identifier:
This is initial implementation of Java hosted module script provider for CommonJS together with test cases.
It uses annotations and package-info.java (more in test code).
At the moment it works, but I don't like the exceptions are handled.
Reproducible: Always
Reporter | ||
Comment 1•15 years ago
|
||
First version of Java hosted module script provider for CommonJS.
Comment 2•15 years ago
|
||
Looks interesting! I'm not sure it's a good idea to limit the exported objects to classes/constructors. A module may want to export other things such as functions, strings, number constants. I think we need to give modules more control on how to set up the exports object (in addition to your list of classes/constructors).
On a coding style level, I think it would be preferable to throw/propagate exceptions instead of just printing stack traces.
Comment 3•15 years ago
|
||
I agree it'd be preferred to propagate the exceptions.
I just updated the declaration of the ModuleScriptProvider.getModuleScript() method - it can now throw any Exception, not just IOException, so you should be able to just propagate those with no friction.
Reporter | ||
Comment 4•15 years ago
|
||
This is second attempt to Java hosted modules.
First I changed exception handling and now I throw exceptions (thanks Attila for changes in ModuleScriptProvider interface). However I do hide ClassNotFoundException as it is handled by Require.getModule and I don't think it is good idea to handle module not found in other places.
I have also added support for exporting other things than classes. In @Exports annotation you can now declare classes that implement Script interface. During export these classes will be instantiated and method exec will be invoked. This way we can export anything we want. I thought about separate interface but I believe Script really fits in here.
Let me know what you think about it.
Attachment #427652 -
Attachment is obsolete: true
Reporter | ||
Comment 5•15 years ago
|
||
Any comments, I still wonder if I should replace Script interface with more specific one.
Comment 6•6 years ago
|
||
Closing. Bug management is now done here:
https://github.com/mozilla/rhino
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
You need to log in
before you can comment on or make changes to this bug.
Description
•