| Summary: | NPE in CompilationUnitBinding#sourceMethod() | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [WebTools] JSDT | Reporter: | Christopher Ebert <chris.ebert> | ||||||||||
| Component: | General | Assignee: | Project Inbox <jsdt.javascript-inbox> | ||||||||||
| Status: | RESOLVED WORKSFORME | QA Contact: | Chris Jaun <cmjaun> | ||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | admin, cmjaun, earlyster, Michael_Rennie, mpcarl, petru.babuscov, smcclenahan, t.pfaffenzeller, thatnitind, vrubezhny | ||||||||||
| Version: | 3.2.3 | Keywords: | needinfo | ||||||||||
| Target Milestone: | 3.5.1 | ||||||||||||
| Hardware: | PC | ||||||||||||
| OS: | Linux | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Christopher Ebert
Is there *any* more information you can give? There's just not enough here to work off of. I have the same problem. It used to work (on 3.7.0), but I had to reinstall Eclipse (3.7.1) and now I get this: Errors running builder 'JavaScript Validator' on project XXX eclipse.buildId=M20120208-0800 java.version=1.6.0_27 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US Framework arguments: -product org.eclipse.epp.package.reporting.product Command-line arguments: -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.reporting.product java.lang.NullPointerException at org.eclipse.wst.jsdt.internal.compiler.lookup.CompilationUnitBinding.sourceMethod(CompilationUnitBinding.java:83) at org.eclipse.wst.jsdt.internal.compiler.lookup.MethodBinding.sourceMethod(MethodBinding.java:553) at org.eclipse.wst.jsdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesFor(SourceTypeBinding.java:1068) at org.eclipse.wst.jsdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesFor(SourceTypeBinding.java:1054) at org.eclipse.wst.jsdt.internal.compiler.lookup.SourceTypeBinding.methods(SourceTypeBinding.java:779) at org.eclipse.wst.jsdt.internal.compiler.lookup.MethodBinding.ensureBindingsAreComplete(MethodBinding.java:623) at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.findMethod(Scope.java:638) at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getImplicitMethod(Scope.java:1635) at org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:325) at org.eclipse.wst.jsdt.internal.compiler.ast.LocalDeclaration.resolve0(LocalDeclaration.java:224) at org.eclipse.wst.jsdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:140) at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:350) at org.eclipse.wst.jsdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:137) at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:304) at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:375) at org.eclipse.wst.jsdt.internal.compiler.ast.FunctionExpression.resolveType(FunctionExpression.java:58) at org.eclipse.wst.jsdt.internal.compiler.ast.ObjectLiteralField.resolveType(ObjectLiteralField.java:70) at org.eclipse.wst.jsdt.internal.compiler.ast.ObjectLiteral.resolveType(ObjectLiteral.java:80) at org.eclipse.wst.jsdt.internal.compiler.ast.Assignment.resolveType(Assignment.java:160) at org.eclipse.wst.jsdt.internal.compiler.ast.Expression.resolve(Expression.java:477) at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:394) at org.eclipse.wst.jsdt.internal.compiler.Compiler.process(Compiler.java:604) at org.eclipse.wst.jsdt.internal.compiler.Compiler.compile(Compiler.java:356) at org.eclipse.wst.jsdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:288) at org.eclipse.wst.jsdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:86) at org.eclipse.wst.jsdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:227) at org.eclipse.wst.jsdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:58) at org.eclipse.wst.jsdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:291) at org.eclipse.wst.jsdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:199) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374) 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) Dear developers, a have not found any workaround yet. I am shortly before recrating a fress workspace IMHO to remove this problem. And it will be spent a lot of time (21 projects of a big finance server project). I need a fix of this probem in next time. I will wait for some days. my eclipse version: Version: Indigo Service Release 2 Build id: 20120216-1857 Thanx a lot, Thomas P. *** Bug 377486 has been marked as a duplicate of this bug. *** I found a workaround. under the projects properties -> Builders, uncheck the JavaScript Validator. Under Builders, not under Validation. Cleared it up for me. Created attachment 215700 [details]
Part of BIRT libraries to reproduce the issue
The attached archive is the part of BIRT JavaScripts library that needs to be added to a JavaScript project due to reproduce the issue.
(In reply to comment #1) > Is there *any* more information you can give? There's just not enough here to > work off of. Nitin, I've attached the zip containing part of BIRT JavaScripts (Folders structure with two scripts) that allows me to reproduce the issue. Just create a JavaScript project, extract the archive into the project structure and then refresh the project. Cleaning and rebuilding the project constantly results in "Problem Occurred" Dialog as well as this NPE appearance in Error Log. Created attachment 215713 [details]
The patch fixes the issue
The problem is that the each compilation unit declaration is cleaned up right after it is processed by the compiler, but it is possible to be referenced later when processing some other compilation unit declaration (for example, through parent declaration of MethodBinding when resolving types of a method).
The patch makes processed units to be saved for the post compilation clean up and cleans them up after the whole compilation is finished instead of cleaning up the units one-by-one right after each unit is processed.
(In reply to comment #5) > I found a workaround. under the projects properties -> Builders, uncheck the > JavaScript Validator. Under Builders, not under Validation. > > Cleared it up for me. Confirmed! It´s a good workaround for us. Thanx, Thomas. Created attachment 222160 [details]
Modified patch to avoid array out of bounds exception
hi Victor,
I tried your patch, but encountered array out of bounds exceptions, this is due to the fact that "totalUnits" can be incremented (see addCompilationUnit function) after postCompileCleanUpUnits array has been initialized.
I modified your patch to use a List instead of array, but it is essentially the same.
Created attachment 222285 [details]
sample files to replicate the exception
Attaching sample files in order to help replicate the said null pointer exception.
1. Open the sample project.
2. Open the file "testmain.js", the two other files must be in the project also (prototype.js and valdiation.js). validation.js is from "Really-Easy-Field-Validation", another open source library.
3. Make some changes like adding extra spaces and then save the "testmain.js" file. The exception will be triggered on every other save.
Hope this helps.
Per this thread [1] vjet team was asked to look at this bug to see if it also applies to vjet. This bug doesn't apply to VJET the Compiler class from JSDT is not used. Only the AST parser is used from JSDT. There is no NPE in VJET when using the sample files. [1] http://dev.eclipse.org/mhonarc/lists/vjet-dev/msg00022.html This is no longer throwing the error in WTP 3.5.1. |