andoaki / jslint4java

Automatically exported from code.google.com/p/jslint4java
Other
0 stars 0 forks source link

Ant task always ends with EvaluatorException #98

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. ant jslint

What is the expected output? What do you see instead?
Any jslint reporting output

What version of the product are you using? On what operating system?
jslint4java-2.0.5.jar

Please provide any additional information below.

------ Stacktrace -------
org.mozilla.javascript.EvaluatorException: invalid property id 
(com/googlecode/jslint4java/jslint.js#294)
        at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
        at org.mozilla.javascript.DefaultErrorReporter.error(DefaultErrorReporter.java:96)
        at org.mozilla.javascript.Parser.addError(Parser.java:146)
        at org.mozilla.javascript.Parser.reportError(Parser.java:160)
        at org.mozilla.javascript.Parser.primaryExpr(Parser.java:2365)
        at org.mozilla.javascript.Parser.memberExpr(Parser.java:1950)
        at org.mozilla.javascript.Parser.unaryExpr(Parser.java:1808)
        at org.mozilla.javascript.Parser.mulExpr(Parser.java:1737)
        at org.mozilla.javascript.Parser.addExpr(Parser.java:1718)
        at org.mozilla.javascript.Parser.shiftExpr(Parser.java:1698)
        at org.mozilla.javascript.Parser.relExpr(Parser.java:1672)
        at org.mozilla.javascript.Parser.eqExpr(Parser.java:1628)
        at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:1617)
        at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:1606)
        at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:1595)
        at org.mozilla.javascript.Parser.andExpr(Parser.java:1583)
        at org.mozilla.javascript.Parser.orExpr(Parser.java:1571)
        at org.mozilla.javascript.Parser.condExpr(Parser.java:1554)
        at org.mozilla.javascript.Parser.assignExpr(Parser.java:1539)
        at org.mozilla.javascript.Parser.variables(Parser.java:1396)
        at org.mozilla.javascript.Parser.statementHelper(Parser.java:1109)
        at org.mozilla.javascript.Parser.statement(Parser.java:708)
        at org.mozilla.javascript.Parser.parseFunctionBody(Parser.java:463)
        at org.mozilla.javascript.Parser.function(Parser.java:592)
        at org.mozilla.javascript.Parser.primaryExpr(Parser.java:2231)
        at org.mozilla.javascript.Parser.memberExpr(Parser.java:1950)
        at org.mozilla.javascript.Parser.unaryExpr(Parser.java:1808)
        at org.mozilla.javascript.Parser.mulExpr(Parser.java:1737)
        at org.mozilla.javascript.Parser.addExpr(Parser.java:1718)
        at org.mozilla.javascript.Parser.shiftExpr(Parser.java:1698)
        at org.mozilla.javascript.Parser.relExpr(Parser.java:1672)
        at org.mozilla.javascript.Parser.eqExpr(Parser.java:1628)
        at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:1617)
        at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:1606)
        at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:1595)
        at org.mozilla.javascript.Parser.andExpr(Parser.java:1583)
        at org.mozilla.javascript.Parser.orExpr(Parser.java:1571)
        at org.mozilla.javascript.Parser.condExpr(Parser.java:1554)
        at org.mozilla.javascript.Parser.assignExpr(Parser.java:1539)
        at org.mozilla.javascript.Parser.expr(Parser.java:1518)
        at org.mozilla.javascript.Parser.primaryExpr(Parser.java:2388)
        at org.mozilla.javascript.Parser.memberExpr(Parser.java:1950)
        at org.mozilla.javascript.Parser.unaryExpr(Parser.java:1808)
        at org.mozilla.javascript.Parser.mulExpr(Parser.java:1737)
        at org.mozilla.javascript.Parser.addExpr(Parser.java:1718)
        at org.mozilla.javascript.Parser.shiftExpr(Parser.java:1698)
        at org.mozilla.javascript.Parser.relExpr(Parser.java:1672)
        at org.mozilla.javascript.Parser.eqExpr(Parser.java:1628)
        at org.mozilla.javascript.Parser.bitAndExpr(Parser.java:1617)
        at org.mozilla.javascript.Parser.bitXorExpr(Parser.java:1606)
        at org.mozilla.javascript.Parser.bitOrExpr(Parser.java:1595)
        at org.mozilla.javascript.Parser.andExpr(Parser.java:1583)
        at org.mozilla.javascript.Parser.orExpr(Parser.java:1571)
        at org.mozilla.javascript.Parser.condExpr(Parser.java:1554)
        at org.mozilla.javascript.Parser.assignExpr(Parser.java:1539)
        at org.mozilla.javascript.Parser.variables(Parser.java:1396)
        at org.mozilla.javascript.Parser.statementHelper(Parser.java:1109)
        at org.mozilla.javascript.Parser.statement(Parser.java:708)
        at org.mozilla.javascript.Parser.parse(Parser.java:401)
        at org.mozilla.javascript.Parser.parse(Parser.java:359)
        at org.mozilla.javascript.Context.compileImpl(Context.java:2254)
        at org.mozilla.javascript.Context.compileReader(Context.java:1202)
        at org.mozilla.javascript.Context.compileReader(Context.java:1174)
        at org.mozilla.javascript.Context.evaluateReader(Context.java:1116)
        at com.googlecode.jslint4java.JSLintBuilder.fromReader(JSLintBuilder.java:123)
        at com.googlecode.jslint4java.JSLintBuilder.fromClasspathResource(JSLintBuilder.java:57)
        at com.googlecode.jslint4java.JSLintBuilder.fromClasspathResource(JSLintBuilder.java:40)
        at com.googlecode.jslint4java.JSLintBuilder.fromDefault(JSLintBuilder.java:69)
        at com.googlecode.jslint4java.ant.JSLintTask.makeLint(JSLintTask.java:244)
        at com.googlecode.jslint4java.ant.JSLintTask.execute(JSLintTask.java:156)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:392)
        at org.apache.tools.ant.Target.performTasks(Target.java:413)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.Main.runBuild(Main.java:811)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Original issue reported on code.google.com by ales.najmann on 21 May 2013 at 8:40

GoogleCodeExporter commented 8 years ago
Can you supply a small piece of Javascript, and a fragment of your ant build 
file that replicates this?

Thanks!

Original comment by d...@happygiraffe.net on 21 May 2013 at 10:24

GoogleCodeExporter commented 8 years ago
Sure. However the issue happens everytime no matter what's the file content, 
see the top of the Exception stacktrace. What's interesting, if I run it from 
the command line, program works fine. It seems to be connected only to ant task 
use.

fragments from the config:

<taskdef name="jslint" classname="com.googlecode.jslint4java.ant.JSLintTask" 
classpath="${libdir.shared}/jslint/jslint4java-2.0.5.jar"/>

<target name="jslinter">
<jslint>
  <formatter type="plain" destfile="plain-report.txt"/>
  <fileset dir="${app.src}" includes="**/*.js"/>
</jslint>
</target>

test.js:

function max(x, y) {
    return x > y ? x : y;
}

Original comment by ales.najmann on 21 May 2013 at 12:17

GoogleCodeExporter commented 8 years ago
Using that build and that src file, I get one error:

% cat build.xml
<project>
  <taskdef name="jslint"
    classname="com.googlecode.jslint4java.ant.JSLintTask"
    classpath="/opt/misc/jslint4java/jslint4java-2.0.5.jar" />

  <target name="jslinter">
    <jslint>
      <formatter type="plain" destfile="plain-report.txt"/>
      <fileset dir="." includes="**/*.js"/>
    </jslint>
  </target>

</project>
% cat max.js 
function max(x, y) {
    return x > y ? x : y;
}
% ant jslinter 
Buildfile: /tmp/jslint4java-issue-98/build.xml

jslinter:

BUILD FAILED
/tmp/jslint4java-issue-98/build.xml:6: JSLint: 1 error in 1 file

Total time: 0 seconds
% cat plain-report.txt 
/tmp/jslint4java-issue-98/max.js:2:5: Missing 'use strict' statement.
    return x > y ? x : y;
    ^

Can I ask what version of Java (and what OS) you're using?  I haven't seen 
this, despite having a test suite that should pick up such things.

Original comment by d...@happygiraffe.net on 21 May 2013 at 4:18

GoogleCodeExporter commented 8 years ago
OS platform: 
Windows XP SP3

Java version:
java version "1.7.0_15"
Java(TM) SE Runtime Environment (build 1.7.0_15-b03)
Java HotSpot(TM) Client VM (build 23.7-b01, mixed mode, sharing)

Ant version:
Apache Ant(TM) version 1.8.4 compiled on May 22 2012

~
I also don't believe much in the bug in the distributed package. I just don't 
know what to do with all this. In the stacktrace you can see the the rhino 
being unable to process jslint.js file distributed with the jar. Is the 
classpath wrong or something? I really have no idea.

Original comment by ales.najmann on 22 May 2013 at 3:23

GoogleCodeExporter commented 8 years ago
I had the exact same problem when running in Eclipse. The error was that 
yuicompressor-2.4.8 was in my classpath and it contains a non compatible 
version of Rhino.
So the above problem is most probably also a classpath problem not related to 
jslint4java.

Original comment by mathias....@netset.se on 3 Sep 2013 at 9:47

GoogleCodeExporter commented 8 years ago
I had the same problem and could fix it by including rhino 1.7R4 instead of 
rhino 1.7R2

Original comment by mathias....@gmail.com on 30 Oct 2013 at 1:51