Bug 201182

Summary: [compiler][null] Null pointer access compiler warning fails when "throw null"
Product: [Eclipse Project] JDT Reporter: Roberto Javier Godoy <rjgodoy>
Component: CoreAssignee: Maxime Daniel <maxime_daniel>
Status: VERIFIED FIXED QA Contact:
Severity: trivial    
Priority: P3 CC: jerome_lanneluc, Olivier_Thomann
Version: 3.3Flags: kent_johnson: review+
Target Milestone: 3.4 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Suggested fix + test cases none

Description Roberto Javier Godoy CLA 2007-08-26 13:27:36 EDT
Build ID: I20070625-1500

Steps To Reproduce:
1. Set Java Compiler | Errors/Warnings | Null pointer access = ERROR (either workspace or project-specific settings)

2. Write the following class

public class Test {
 public static void main(String[] args) throws Throwable{
 	Throwable t = null;
	throw t;
 }
}


ACTUAL BEHAVIOUR: The source code pass compilation without errors. 
If run, it throws a NullPointerException.

EXPECTED BEHAVIOUR: The compiler should have signaled an error "Null pointer access: The variable t can only be null at this location" at the line where t is thrown.
Comment 1 Maxime Daniel CLA 2007-09-10 07:45:17 EDT
Created attachment 77975 [details]
Suggested fix + test cases

ThrowStatement imitates what MessageSend does. Currently under test.
Comment 2 Maxime Daniel CLA 2007-09-10 09:55:23 EDT
All JDT Core tests pass. Kent, would you please review the patch?
Comment 3 Maxime Daniel CLA 2007-09-12 03:15:33 EDT
Released for 3.4 M2.
Comment 4 Jerome Lanneluc CLA 2007-09-18 07:32:54 EDT
Verified for 3.4M2 using I20070917-1800