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

JSHint 2.9.0: TypeError with Nashorn #2730

Open
veita opened this Issue Oct 23, 2015 · 5 comments

Comments

Projects
None yet
3 participants
@veita

veita commented Oct 23, 2015

JSHint does not work with the Nashorn engine. When invoked from the command line the following error occurs.

> jjs jshint.js
jshint.js:2198 TypeError: Cannot read property "prototype" from undefined

It seems that context is not the expected object, so context.Array is undefined.

Versions:
JSHint 2.9.0
Java (JDK) version "1.8.0_66"

@jugglinmike

This comment has been minimized.

Show comment
Hide comment
@jugglinmike

jugglinmike Nov 5, 2015

Member

JSHint has never officially supported the Nashorn JavaScript interpreter. I don't see why it shouldn't, though! To do this, we would need to extend the testing infrastructure to run the tests on that platform--otherwise we won't be able to detect regressions there. Would you have any interest in helping with this?

(Also note: version 2.9.0 of JSHint has been revoked https://twitter.com/JSHint/status/639564453852356608)

Member

jugglinmike commented Nov 5, 2015

JSHint has never officially supported the Nashorn JavaScript interpreter. I don't see why it shouldn't, though! To do this, we would need to extend the testing infrastructure to run the tests on that platform--otherwise we won't be able to detect regressions there. Would you have any interest in helping with this?

(Also note: version 2.9.0 of JSHint has been revoked https://twitter.com/JSHint/status/639564453852356608)

@veita

This comment has been minimized.

Show comment
Hide comment
@veita

veita Nov 18, 2015

I'm interested in helping with the Nashorn issue. Here's a fork: https://github.com/veita/jshint

I've added a unit test (org.jshint.nashorn.NashornTestCase) in the standard Maven directory structure that shows the issue. See https://travis-ci.org/veita/jshint, or run mvn test on a machine with a properly installed JDK1.8 and Maven.

Note that Java 1.8.0_31 that runs on travis-ci.org does, other than current versions of Java 8, not report the line number 2198 nicely.

veita commented Nov 18, 2015

I'm interested in helping with the Nashorn issue. Here's a fork: https://github.com/veita/jshint

I've added a unit test (org.jshint.nashorn.NashornTestCase) in the standard Maven directory structure that shows the issue. See https://travis-ci.org/veita/jshint, or run mvn test on a machine with a properly installed JDK1.8 and Maven.

Note that Java 1.8.0_31 that runs on travis-ci.org does, other than current versions of Java 8, not report the line number 2198 nicely.

@fabioz

This comment has been minimized.

Show comment
Hide comment
@fabioz

fabioz Apr 10, 2016

As a note, I'm properly running jshint on nashorn with the following patch:

fabioz@edb0ecf

The issue seems to be redefining builtins, although the related code seems a bit contrived (that code seems to be in some dependency, not really on jshint per se -- which is why the fix is only on dist/jshint.js).

fabioz commented Apr 10, 2016

As a note, I'm properly running jshint on nashorn with the following patch:

fabioz@edb0ecf

The issue seems to be redefining builtins, although the related code seems a bit contrived (that code seems to be in some dependency, not really on jshint per se -- which is why the fix is only on dist/jshint.js).

@fabioz

This comment has been minimized.

Show comment
Hide comment
@fabioz

fabioz Apr 10, 2016

As a note, it'd be really nice if nashorn could be officially supported (the latest rhino release is from 2012-06-18, whereas nashorn is being actively maintained and is much faster than rhino -- after warming up, it's close to being a contender for V8 -- it's still slower, but at least it's in the same range, whereas rhino has abysmal performance, so, using JShint on a big file with rhino is not really practical).

fabioz commented Apr 10, 2016

As a note, it'd be really nice if nashorn could be officially supported (the latest rhino release is from 2012-06-18, whereas nashorn is being actively maintained and is much faster than rhino -- after warming up, it's close to being a contender for V8 -- it's still slower, but at least it's in the same range, whereas rhino has abysmal performance, so, using JShint on a big file with rhino is not really practical).

@fabioz

This comment has been minimized.

Show comment
Hide comment
@fabioz

fabioz Apr 10, 2016

Actually, I seem to be wrong on the rhino development... it seems rhino now has development going on again (but the speed comments remain... rhino is still pretty slow whereas nashorn has decent performance).

fabioz commented Apr 10, 2016

Actually, I seem to be wrong on the rhino development... it seems rhino now has development going on again (but the speed comments remain... rhino is still pretty slow whereas nashorn has decent performance).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment