Bug 153303

Summary: IBinding.getAnnotations() returns array with null element
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: 3.3 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2006-08-09 10:33:10 EDT
I20060807-2000

IBinding.getAnnotations() returns array with a null element when the annotation type could not be resolved. Expected: empty array.

Steps:
- In a 1.5 project without JUnit4 on the classpath, create CU (with compile errors):

package tst;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class Tester23 {
    @Test
    public void testComparison2( ) {
        assertEquals( "Gah", "Gooh" );
    }
}

- Set caret into "Gah" and press Ctrl+1.

java.lang.NullPointerException
	at org.eclipse.jdt.internal.junit.ui.JUnitQuickFixProcessor.isInsideJUnit4Test(JUnitQuickFixProcessor.java:164)
	at org.eclipse.jdt.internal.junit.ui.JUnitQuickFixProcessor.getAddAssertImportProposals(JUnitQuickFixProcessor.java:106)
	at org.eclipse.jdt.internal.junit.ui.JUnitQuickFixProcessor.getCorrections(JUnitQuickFixProcessor.java:93)
...
Comment 1 Olivier Thomann CLA 2006-08-14 17:42:17 EDT
Fixed and released in HEAD.
Added regression tests org.eclipse.jdt.core.tests.dom.ASTConverter15Test#test0223/0224/0225/0226
Comment 2 Olivier Thomann CLA 2006-08-15 13:56:18 EDT
Released for 3.3 M2.
Comment 3 Maxime Daniel CLA 2006-09-18 10:18:51 EDT
Verified for 3.3 M2 using build I20060918-0010.