Comments (8)
@lance Hi Lance. Any comment on this? I'm not too bothered how it's done, but getting nodyn to work on Nashorn is still important for Vert.x
from nodyn.
At this point, most (but not all) of the DynJS dependencies have been removed. We have not tested using Nashorn yet, but based on recent attempts to build https://github.com/vert-x/mod-lang-nashorn indicate there are issues in the current version of nashorn which render it incapable of using the vert.x Java API. Specifically, nashorn at this point appears unable to decide between overloaded method handles which take a String or CharSequence.
For example, let's say you have a Java class that looks like this:
package com.me;
public class Thingy {
public void doSomething(String s) {
// code here
}
public void doSomething(CharSequence cs) {
// more code
}
}
And you try to use it in nashorn like this:
var x = new com.me.Thingy();
x.doSomething('foobar');
Nashorn will fail as it is unable to determine which method it should call. In this case, DynJS chooses the method taking a String. There are a number of Java classes in Vert.x which suffer from this problem - e.g. MultiMap
.
So, while I am still making efforts to remove DynJS dependencies, there are issues with nashorn I have not yet resolved.
from nodyn.
Maybe ask on the nashorn-dev list?
from nodyn.
Who is maintaining mod-lang-nashorn these days?
from nodyn.
I am
from nodyn.
Lance,
I had a twitter conversation with some of the Nashorn team today, and it was mentioned that you can force the specific Java method to call from Nashorn JS if you like:
https://twitter.com/sundararajan_a/status/484627566985101313
I think this might be useful in resolving the issue with Nashorn defaulting to an undesired overloaded Java method.
from nodyn.
Just to note that I've been trying out the nashorn
branch of this project, and it works pretty well. I have Nodyn running a Gulp build to compile a large amount of LessCSS and run it through the Autoprefixer postprocessor. The same build with DynJS was still chugging away at regexes after half an hour.
So my vote is for bringing in that branch (while leaving DynJS as the default runtime), so that people can choose.
from nodyn.
Is there merit in making nashorn the default runtime if you are running JDK8? Its basically the fastest java runtime for JDK, and it is something that will receive much more support (compared to Rhino or DynJS)?
I would have little qualms in packaging nodyn for JDK 1.7 and lower, and another for JDK 8, with JDK 8 just supporting Nashorn.
from nodyn.
Related Issues (20)
- Support process.hrtime()
- Does not work on windows HOT 3
- vertx example does not work... not found in any repositories HOT 1
- Java code should not ex.printStackTrace()
- Broken Links on JBoss.org HOT 8
- Nodyn should maintain process.cwd separate from System.getProperty(user.dir) HOT 1
- Programmatic instructions for gae HOT 9
- Cannot subclass Array HOT 2
- mvn install hangs on test failure HOT 2
- ES6 Features (generators) HOT 2
- Build fails on Open JDK 1.8
- Error with programmatic code
- Static files with express doesn't work
- Invoke Java APIs from Nodyn HOT 3
- fs.readFileSync won't read files >512kb HOT 2
- Nodyn unable to initialize when using https module
- fs.writeFile hangs on Windows
- Scripts loaded from .jar file
- Node version support HOT 1
- java.nio.BufferOverflowException during fs.readFileSync() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodyn.