eclipsesource / jshint-eclipse

JSHint integration for the Eclipse IDE
http://github.eclipsesource.com/jshint-eclipse/
145 stars 31 forks source link

java.lang.LinkageError: com/eclipsesource/json/JsonObject - Errors running builder 'JSHint Problem Checker' on project 'NodeExpress017'. #99

Closed paulvi closed 10 years ago

paulvi commented 10 years ago

Please give an advice why good old 0.9.9 could start producing error when creating new Node Express project in Nodeclipse, mp

java.lang.LinkageError: com/eclipsesource/json/JsonObject
    at com.eclipsesource.jshint.JSHint.configure(JSHint.java:104)
    at com.eclipsesource.jshint.ui.internal.builder.JSHintBuilderVisitor.createJSHint(JSHintBuilderVisitor.java:93)
    at com.eclipsesource.jshint.ui.internal.builder.JSHintBuilderVisitor.<init>(JSHintBuilderVisitor.java:55)
    at com.eclipsesource.jshint.ui.internal.builder.JSHintBuilder.incrementalBuild(JSHintBuilder.java:60)
    at com.eclipsesource.jshint.ui.internal.builder.JSHintBuilder.build(JSHintBuilder.java:40)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:299)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:302)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:358)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:381)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

eclipse.buildId=4.4.0.I20140606-1215 java.version=1.8.0_05 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=zh_CN Framework arguments: -product org.eclipse.epp.package.java.product -showLocation Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product -showLocation

piotrtomiak commented 10 years ago

One of MyEclipse users has experienced very similar error with JSHint and Tern combination:

com.eclipsesource.json.ParseException: Unexpected end of input at 1:-1
 at com.eclipsesource.json.JsonParser.error(JsonParser.java:371)
 at com.eclipsesource.json.JsonParser.expected(JsonParser.java:362)
 at com.eclipsesource.json.JsonParser.readValue(JsonParser.java:97)
 at com.eclipsesource.json.JsonParser.parse(JsonParser.java:62)
 at com.eclipsesource.json.JsonValue.readFrom(JsonValue.java:105)
 at com.eclipsesource.json.JsonObject.readFrom(JsonObject.java:138)
 at com.eclipsesource.jshint.ui.internal.builder.ConfigLoader.getWorkspaceConfig(ConfigLoader.java:43)
 at com.eclipsesource.jshint.ui.internal.builder.ConfigLoader.getConfiguration(ConfigLoader.java:38)
 at com.eclipsesource.jshint.ui.internal.builder.JSHintBuilderVisitor.createJSHint(JSHintBuilderVisitor.java:93)
 at com.eclipsesource.jshint.ui.internal.builder.JSHintBuilderVisitor.<init>(JSHintBuilderVisitor.java:55)
 at com.eclipsesource.jshint.ui.internal.builder.JSHintBuilder.fullBuild(JSHintBuilder.java:53)
 at com.eclipsesource.jshint.ui.internal.builder.JSHintBuilder.build(JSHintBuilder.java:34)
 at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
 at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
 at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
 at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
 at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:299)
 at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
 at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:302)
 at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:358)
 at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:381)
 at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
 at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
 at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

I have tracked down the issue to an OSGi package conflict:

  1. JSHint is using com.eclipsesource.json (minimal-json) 0.9.0 code
  2. There is a custom class add to it and the rest is slightly modifed (JSON linkage issue)
  3. Modified minimal-json package is exported as com.eclipsesource.json;version="0.9.0"
  4. Tern makes a usage of version "0.9.1" of minimal-json and such bundle is present in MyEclipse with export com.eclipsesource.json;version="0.9.1"
  5. JSHint UI plugin imports com.eclipsesource.json;version="0.9.0" and expects it to contain modifications, but "0.9.1" is provided as it is newer and better from OSGi point of view.

If JSHint is installed first, then Tern is linked to 0.9.0 version and you may not see the issue.

I will provide a fix for this issue.

ralfstx commented 10 years ago

Should be fixed by #100