Bug 134129

Summary: [1.5][compiler] Duplicate error messages when an annotation value expects a boolean but gets an array
Product: [Eclipse Project] JDT Reporter: Steven Bandow <sbandow>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: jgarms
Version: 3.2   
Target Milestone: 3.2 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Steven Bandow CLA 2006-03-30 13:44:24 EST
Usage of an array instead of an expected boolean for an annotation value results in duplicate error message:

"Type mismatch: cannot convert from Object[] to boolean"


Repro:  Open the following two files in a java project, then observe the Problems view.  It is not necessary to have an annotation processor.


package pkg;
public @interface Anno {
	boolean b() default false;
}


package pkg;
@Anno(b = {})
public class Test {
}


Notes:  This bug was first found after integrating an APT test from 3.1.1.  The test org.eclipse.jdt.apt.tests.ExceptionHandlingTests.testArrayForBooleanValue() fails in 3.2 but now has a workaround.  I haven't seen this bug with any other flavor of type mismatch.
Comment 1 Philipe Mulet CLA 2006-03-31 04:34:33 EST
Reproduced. Added AnnotationTest#test198
Comment 2 Philipe Mulet CLA 2006-03-31 06:16:01 EST
Tuned error reporting to not issue 2 complaints in presence of faulty array initializer. Change located on MemberPairValue.

Fixed
Comment 3 Frederic Fusier CLA 2006-04-13 14:27:03 EDT
Verified for 3.2 RC1 using build I20060413-0010.