Closed
Bug 630111
Opened 14 years ago
Closed 14 years ago
Codegen optimizer fails with Unsupported major.minor version 0.0 on JDK7
Categories
(Rhino Graveyard :: Compiler, defect)
Rhino Graveyard
Compiler
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: brunofr, Unassigned)
Details
Attachments
(1 file)
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-us) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4
Build Identifier: CVS HEAD
When setting ctx.setOptimizationLevel(9) to force compilation, generated class files under JDK7 b127 have major.minor version 0.0 and fail to load.
Reproducible: Always
Steps to Reproduce:
Execute test code:
ContextFactory contextFactory = ContextFactory.getGlobal();
contextFactory.call(new ContextAction() {
@Override
public Object run(Context ctx) {
ScriptableObject scope = ctx.initStandardObjects(null, true);
ctx.setOptimizationLevel(9);
return ctx.evaluateString(scope, "var h = 'test'", "test", 0, null);
}
});
Actual Results:
java.lang.UnsupportedClassVersionError: org/mozilla/javascript/gen/test_1 : Unsupported major.minor version 0.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:795)
at org.mozilla.javascript.DefiningClassLoader.defineClass(DefiningClassLoader.java:62)
at org.mozilla.javascript.optimizer.Codegen.defineClass(Codegen.java:160)
at org.mozilla.javascript.optimizer.Codegen.createScriptObject(Codegen.java:115)
at org.mozilla.javascript.Context.compileImpl(Context.java:2442)
at org.mozilla.javascript.Context.compileString(Context.java:1367)
at org.mozilla.javascript.Context.compileString(Context.java:1356)
at org.mozilla.javascript.Context.evaluateString(Context.java:1108)
at nodus.js.JdkBug$1.run(JdkBug.java:37)
Expected Results:
finish without an error
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b127)
Java HotSpot(TM) Client VM (build 20.0-b06, mixed mode, sharing)
openjdk version "1.7.0-internal"
OpenJDK Runtime Environment (build 1.7.0-internal-b00)
OpenJDK 64-Bit Server VM (build 20.0-b06, mixed mode)
Reporter | ||
Comment 1•14 years ago
|
||
Instead of using ClassFileWriter.class to determine the major.minor version, we can use java/lang/Object.class since the runtime that loaded it should be able to load a generated class.
Comment 2•14 years ago
|
||
Turns out the problem was due to InputStream.read() on the class resource only reading two bytes the first time around. Fixed in CVS.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•