Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Switched to non-internal javascript Context class in eval1 fn #1

Closed
wants to merge 1 commit into from

1 participant

@kwbeam

I'm running on Ubuntu 11.04, java -version:

java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.2) (6b22-1.10.2-0ubuntu1~11.04.1)
OpenJDK Server VM (build 20.0-b11, mixed mode)

When I run script/repljs, I get:

Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: sun.org.mozilla.javascript.internal.Context, compiling:(cljs/compiler.clj:919)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6357)
...

This appears to be due to the use of the 'internal' javascript Context class, which is not included in OpenJDK. This appears to be a Sun JVM implementation class. This commit switches to the non-internal Context class.

Note: the repl now starts up after this change, and I'm able to use the repl, but only after this error:

"Error evaluating:" (defn test-stuff
...(omitting lots of text)...
sun.org.mozilla.javascript.EvaluatorException: Encountered code generation error while compiling function "test_stuff": generated bytecode for method exceeds 64K limit. (cljs/core.cljs#2701)

My guess is this is a different issue, so I decided to just make this one commit and issue the pull request. Advance apologies if that's not the right thing to do.

@kwbeam

Sorry, that was premature--I misunderstood what I was seeing in Rhino...I mistakenly thought there was a sun.org.mozilla.javascript.Context class in OpenJDK and Sun's JDK. But I see now that is not the case. Sun only has the classes in the internal package. Not sure why that is yet, but in any case, this pull request isn't correct for both JDKs. Sorry about that.

@kwbeam kwbeam closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/clj/cljs/compiler.clj
View
4 src/clj/cljs/compiler.clj
@@ -916,11 +916,11 @@ goog.require = function(rule){Packages.clojure.lang.RT[\"var\"](\"cljs.compiler\
(print js))
(let [filename (.get jse javax.script.ScriptEngine/FILENAME)
linenum (or (:line (meta form)) Integer/MIN_VALUE)
- ctx (sun.org.mozilla.javascript.internal.Context/enter)]
+ ctx (sun.org.mozilla.javascript.Context/enter)]
(try
(.evaluateString ctx (:global repl-env) js filename linenum nil)
(finally
- (sun.org.mozilla.javascript.internal.Context/exit))))
+ (sun.org.mozilla.javascript.Context/exit))))
(catch Throwable ex
;;we eat ns errors because we know goog.provide() will throw when reloaded
;;TODO - file bug with google, this is bs error
Something went wrong with that request. Please try again.