Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 399998

Summary: NullPointerException occurs during Build
Product: [Eclipse Project] JDT Reporter: Michael Meß <michael.mess>
Component: CoreAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: andrew.eisenberg, jarthana, jtk499, manoj.palat, stephan.herrmann
Version: 3.8   
Target Milestone: 4.3 M7   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Michael Meß CLA 2013-02-05 10:53:32 EST
What steps will reproduce the problem?
1. Eclipse builds the project.
2. A Popup appears telling a NullPointerException occurred.


-- Error Details --
Date: Tue Feb 05 16:21:22 CET 2013
Message: Errors running builder 'Java Builder' on project 'all-macd'.
Severity: Error
Product: Eclipse SDK 3.8.0.v201206081200 (org.eclipse.sdk.ide)
Plugin: org.eclipse.jdt.core
Session Data:
eclipse.buildId=I20120608-1200
java.version=1.6.0_35
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Framework arguments:  -eclipse.password /home/mm/.eclipse/password -keyring /home/mm/.eclipse-keyring/.keyring
Command-line arguments:  -os linux -ws gtk -arch x86 -eclipse.password /home/mm/.eclipse/password -keyring /home/mm/.eclipse-keyring/.keyring

Exception Stack Trace:
java.lang.NullPointerException
	at org.eclipse.jdt.internal.core.builder.ClasspathDirectory.directoryList(ClasspathDirectory.java:46)
	at org.eclipse.jdt.internal.core.builder.ClasspathDirectory.doesFileExist(ClasspathDirectory.java:75)
	at org.eclipse.jdt.internal.core.builder.ClasspathDirectory.findClass(ClasspathDirectory.java:96)
	at org.eclipse.jdt.internal.core.builder.NameEnvironment.findClass(NameEnvironment.java:304)
	at org.eclipse.jdt.internal.core.builder.NameEnvironment.findType(NameEnvironment.java:322)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:122)
	at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:54)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:136)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveTypesFor(BinaryTypeBinding.java:1160)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.methods(BinaryTypeBinding.java:1132)
	at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.initializeMembers(JDTClassNode.java:256)
	at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.initialize(JDTClassNode.java:233)
	at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.lazyClassInit(JDTClassNode.java:157)
	at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:1078)
	at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:1070)
	at org.codehaus.groovy.ast.ClassNode.getSuperClass(ClassNode.java:1064)
	at org.codehaus.groovy.ast.ClassNode.isDerivedFrom(ClassNode.java:1004)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.isAssignableTo(StaticTypeCheckingSupport.java:318)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.allParametersAndArgumentsMatchWithDefaultParams(StaticTypeCheckingSupport.java:213)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.chooseBestMethod(StaticTypeCheckingSupport.java:913)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.findMethod(StaticTypeCheckingVisitor.java:2181)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:1576)
	at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:67)
	at org.codehaus.groovy.ast.CodeVisitorSupport.visitReturnStatement(CodeVisitorSupport.java:73)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitReturnStatement(ClassCodeVisitorSupport.java:224)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitReturnStatement(StaticTypeCheckingVisitor.java:1060)
	at org.codehaus.groovy.ast.stmt.ReturnStatement.visit(ReturnStatement.java:47)
	at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:35)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:179)
	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
	at org.codehaus.groovy.ast.CodeVisitorSupport.visitTryCatchFinally(CodeVisitorSupport.java:82)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitTryCatchFinally(ClassCodeVisitorSupport.java:244)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitTryCatchFinally(StaticTypeCheckingVisitor.java:1834)
	at org.codehaus.groovy.ast.stmt.TryCatchStatement.visit(TryCatchStatement.java:42)
	at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:35)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:179)
	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:102)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:113)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitConstructorOrMethod(StaticTypeCheckingVisitor.java:1051)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:124)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.startMethodInference(StaticTypeCheckingVisitor.java:1252)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethod(StaticTypeCheckingVisitor.java:1226)
	at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1163)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:51)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClass(StaticTypeCheckingVisitor.java:216)
	at org.codehaus.groovy.transform.StaticTypesTransformation.visit(StaticTypesTransformation.java:70)
	at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:147)
	at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:220)
	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1188)
	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:621)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:599)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:576)
	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.processToPhase(GroovyCompilationUnitDeclaration.java:171)
	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.generateCode(GroovyCompilationUnitDeclaration.java:1534)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:838)
	at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:137)
	at java.lang.Thread.run(Thread.java:662)
Comment 1 Jay Arthanareeswaran CLA 2013-02-07 00:39:51 EST
Just looking at the code, looks like a cleanup is called but a look-up is requested without reset. Not sure if there are thread related issues here.

Can you reproduce this problem? This being such a common use case, I would like to believe that there is something about your set-up that is influencing this behavior.
Comment 2 Michael Meß CLA 2013-02-22 02:52:01 EST
The issue occurs occassionally only and cannot be reproduced sure enough.

Now I have switched to 

Eclipse Version: 3.8.1, Build id: M20120914-1540

I will see, if the bug hits me again...
Comment 3 Andrew Eisenberg CLA 2013-03-07 23:39:39 EST
What version of Groovy-Eclipse are you using and are you seeing this in groovy code only?
Comment 4 Michael Meß CLA 2013-03-08 08:54:46 EST
I am using the same eclipse environment, it is a shared installation, as Jörg Thönnes, for more details see bug 401271.

I have encountered the bug with Version 3.8, but it seems to be still present with 3.8.1.
Comment 5 Andrew Eisenberg CLA 2013-03-08 11:34:55 EST
It is likely, that you are hitting this bug: 

http://jira.codehaus.org/browse/GRECLIPSE-1521

It is fixed in groovy-eclipse 2.7.2 and later. Can you upgrade and see if this fixes the problem?  Best to grab a dev build from here:
http://groovy.codehaus.org/Eclipse+Plugin#EclipsePlugin-DevelopmentBuilds

This is assuming you are hitting the same bug as in Bug 402510.
Comment 6 Jörg Thönnes CLA 2013-03-15 11:29:56 EDT
OK, we have upgraded to lasted GRECLIPSE snapshot build

Version: 2.8.0.xx-20130314-1300-e42

as mentioned in bug 401271.

Will watch whether this issue reappears.
Comment 7 Stephan Herrmann CLA 2013-03-21 12:09:34 EDT
(In reply to comment #5)
> It is likely, that you are hitting this bug: 
> 
> http://jira.codehaus.org/browse/GRECLIPSE-1521
> 
> It is fixed in groovy-eclipse 2.7.2 and later. Can you upgrade and see if
> this fixes the problem?  Best to grab a dev build from here:
> http://groovy.codehaus.org/Eclipse+Plugin#EclipsePlugin-DevelopmentBuilds
> 
> This is assuming you are hitting the same bug as in Bug 402510.

Marking transitive duplication to GRECLIPSE-1521 via bug 402510.

*** This bug has been marked as a duplicate of bug 402510 ***
Comment 8 Manoj N Palat CLA 2013-04-30 03:13:56 EDT
Verified for 4.3 M7 Build id: I20130428-2000