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

Bug 499601

Summary: NonNullByDefault applied to local variable does not cancel enclosing NonNullByDefault
Product: [Eclipse Project] JDT Reporter: Clovis Seragiotto <clovis.seragiotto>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: register.eclipse
Version: 4.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Clovis Seragiotto CLA 2016-08-12 07:55:58 EDT
In the class below, NonNullByDefault({}) cancels the enclosing NonNullByDefault when applied to the method but not when applied to the local variable.

@org.eclipse.jdt.annotation.NonNullByDefault
public class Main {
	@org.eclipse.jdt.annotation.NonNullByDefault({})
	static void a() {
		java.util.List<Object> list = new javax.management.AttributeList();
		System.out.println(list);
	}

	static void b() {
		@org.eclipse.jdt.annotation.NonNullByDefault({})
		java.util.List<Object> list = new javax.management.AttributeList(); // <-- unexpected warning at this line
		System.out.println(list);
	}
}
Comment 1 Till Brychcy CLA 2016-08-12 10:09:41 EDT
Thanks for reporting and providing a standalone test case.

You are right, this is simply not implemented yet.

*** This bug has been marked as a duplicate of bug 484926 ***