Bug 201182 - [compiler][null] Null pointer access compiler warning fails when "throw null"
Summary: [compiler][null] Null pointer access compiler warning fails when "throw null"
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 trivial (vote)
Target Milestone: 3.4 M2   Edit
Assignee: Maxime Daniel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-26 13:27 EDT by Roberto Javier Godoy CLA
Modified: 2007-09-18 07:32 EDT (History)
2 users (show)

See Also:
kent_johnson: review+


Attachments
Suggested fix + test cases (4.33 KB, patch)
2007-09-10 07:45 EDT, Maxime Daniel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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