Bug 40288 - NPE while building
Summary: NPE while building
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.0 M2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-17 05:29 EDT by Martin Aeschlimann CLA
Modified: 2003-07-18 04:39 EDT (History)
0 users

See Also:


Attachments
project build throws NPE (2.10 KB, application/octet-stream)
2003-07-17 05:50 EDT, Martin Aeschlimann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2003-07-17 05:29:20 EDT
20030716 + core update

In a testing workspace (JUnit source code + changes) I have this exception
reproducable (on every full build).

I have it in the debugger, will add more information as soon as I know more.

java.lang.NullPointerException
	at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.recordTypeReferences(CompilationUnitScope.java:529)
	at org.eclipse.jdt.internal.compiler.lookup.Scope.findExactMethod(Scope.java:169)
	at
org.eclipse.jdt.internal.compiler.lookup.BlockScope.getMethod(BlockScope.java:1044)
	at
org.eclipse.jdt.internal.compiler.ast.CastExpression.checkAlternateBinding(CastExpression.java:321)
	at
org.eclipse.jdt.internal.compiler.ast.CastExpression.checkNeedForArgumentCasts(CastExpression.java:254)
	at
org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:273)
	at org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:433)
	at org.eclipse.jdt.internal.compiler.ast.Block.resolve(Block.java:108)
	at
org.eclipse.jdt.internal.compiler.ast.ForStatement.resolve(ForStatement.java:321)
	at org.eclipse.jdt.internal.compiler.ast.Block.resolve(Block.java:108)
	at org.eclipse.jdt.internal.compiler.ast.IfStatement.resolve(IfStatement.java:261)
	at
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:361)
	at
org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:140)
	at
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:351)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:846)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:887)
	at
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:270)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:533)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:328)
	at
org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:198)
	at
org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:148)
	at
org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:51)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:192)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:115)
	at org.eclipse.core.internal.events.BuildManager$2.run(Unknown Source)
	at org.eclipse.core.internal.runtime.InternalPlatform.run(Unknown Source)
	at org.eclipse.core.runtime.Platform.run(Unknown Source)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(Unknown Source)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(Unknown Source)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(Unknown Source)
	at org.eclipse.core.internal.events.BuildManager$1.run(Unknown Source)
	at org.eclipse.core.internal.runtime.InternalPlatform.run(Unknown Source)
	at org.eclipse.core.runtime.Platform.run(Unknown Source)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(Unknown Source)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(Unknown Source)
	at org.eclipse.core.internal.events.BuildManager.build(Unknown Source)
	at org.eclipse.core.internal.resources.Workspace.build(Unknown Source)
	at
org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock$3.run(OptionsConfigurationBlock.java:354)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(Unknown Source)
Comment 1 Martin Aeschlimann CLA 2003-07-17 05:50:43 EDT
Created attachment 5489 [details]
project build throws NPE

'www' is the project name
Comment 2 Philipe Mulet CLA 2003-07-17 06:43:08 EDT
Reproduced.
Comment 3 Philipe Mulet CLA 2003-07-17 07:12:38 EDT
Simpler test case:

public class X {
	void bar() {
		foo((X) zork());
	}
	void foo(X x) {
	}
}

Problem is a lack of fault-tolerance if cast expression resolvedType slot is 
not positionned (due to some intermediate unbound signature).
Comment 4 Philipe Mulet CLA 2003-07-17 07:18:51 EDT
Fixed. Regression test added. Should release for M2.
Comment 5 Philipe Mulet CLA 2003-07-17 07:27:28 EDT
Fixed
Comment 6 Philipe Mulet CLA 2003-07-17 08:05:56 EDT
Made v_364a
Comment 7 Philipe Mulet CLA 2003-07-17 08:13:05 EDT
Patch posted on JDT/Core 3.0 update page.
Comment 8 David Audel CLA 2003-07-18 04:39:09 EDT
Verified.