Bug 99375 - Compiler error using Annotations
Summary: Compiler error using Annotations
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-10 10:53 EDT by Peter Shipton CLA
Modified: 2005-06-16 14:05 EDT (History)
1 user (show)

See Also:


Attachments
Annotation test suite which demonstrates a compiler problem in Eclipse (10.16 KB, application/octet-stream)
2005-06-10 10:54 EDT, Peter Shipton CLA
no flags Details
Picture showing the problem (30.65 KB, image/gif)
2005-06-10 10:58 EDT, Peter Shipton CLA
no flags Details
Apply on HEAD (2.38 KB, patch)
2005-06-10 16:50 EDT, Olivier Thomann CLA
no flags Details | Diff
Regression test (9.99 KB, patch)
2005-06-10 16:50 EDT, Olivier Thomann CLA
no flags Details | Diff
New patch (2.34 KB, patch)
2005-06-12 12:41 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Shipton CLA 2005-06-10 10:53:46 EDT
This problem still occurs in Eclipse 3.1 RC1.

Create a 1.5 project and import the code, it should all compile. Open the
AnnotationTest class, make a minor change like adding a space, and save it. You
should get a compiler error for AnnotationTestClass (cannot be resolved to a
type). If you clean the project and rebuilt it, the error should go away.
Comment 1 Peter Shipton CLA 2005-06-10 10:54:41 EDT
Created attachment 22803 [details]
Annotation test suite which demonstrates a compiler problem in Eclipse
Comment 2 Peter Shipton CLA 2005-06-10 10:58:09 EDT
Created attachment 22805 [details]
Picture showing the problem
Comment 3 Kent Johnson CLA 2005-06-10 13:21:17 EDT
reproduced.
Comment 4 Kent Johnson CLA 2005-06-10 13:27:45 EDT
Testcase can be reduced to changing the following source file (after a full 
build):

package com.ibm.oti.annotation;

public class AnnotationTest2 {
	private Class<?> testClass = AnnotationTestClass.class;
}
Comment 5 Kent Johnson CLA 2005-06-10 13:46:28 EDT
We are getting a ClassFormatException trying to open AnnotationTestClass.class

Any one of the 4 ValueAnnotations is causing the problem, here is the one for 
class:

@ValueAnnotation
(value="ValueAnnotation",booleanValue=true,charValue='m',byteValue=-
123,shortValue=-12345,
  intValue=-1234567890,floatValue=-12345.6789f,doubleValue=-
12345.6789,longValue=-1234567890123456789l,
  
stringValue="valueString",enumValue=EnumClass.Value3,classValue=AnnotationTestC
lass.class,
  annotationValue=@ClassAnnotation(value="ClassAnnotation"),booleanArrayValue=
{false,true},charArrayValue={'m','q'},
  byteArrayValue={-123,123},shortArrayValue={-12345,12345},intArrayValue={-
1234567890,1234567890},
  floatArrayValue={-12345.6789f,12345.6789f},doubleArrayValue={-
12345.6789,12345.6789},
  longArrayValue={-1234567890123456789l,1234567890123456789l},stringArrayValue=
{"valueString", "stringValue"},
  enumArrayValue={EnumClass.Value2,EnumClass.Value1},classArrayValue=
{EnumClass.class, AnnotationTestClass.class},
  annotationArrayValue={@ClassAnnotation(value="ClassAnnotation1"), 
@ClassAnnotation(value="ClassAnnotation2")})
Comment 6 Olivier Thomann CLA 2005-06-10 13:49:19 EDT
I'll investigate it.
Comment 7 Olivier Thomann CLA 2005-06-10 16:50:11 EDT
Created attachment 22840 [details]
Apply on HEAD
Comment 8 Olivier Thomann CLA 2005-06-10 16:50:41 EDT
Created attachment 22841 [details]
Regression test

Apply on HEAD of compiler tests.
Comment 9 Philipe Mulet CLA 2005-06-11 15:51:32 EDT
+1 for RC3
Comment 10 Olivier Thomann CLA 2005-06-12 12:41:29 EDT
Created attachment 22869 [details]
New patch

The code is clearer for the parameter annotation initialization.
Comment 11 Philipe Mulet CLA 2005-06-13 06:44:48 EDT
Dani - pls cast a vote for this one. Another exception during compile.
Comment 12 Dani Megert CLA 2005-06-13 08:49:50 EDT
+1 for 3.1 RC3.
Comment 13 Olivier Thomann CLA 2005-06-13 09:18:44 EDT
Fixed and released in HEAD.
Regression test added in
org.eclipse.jdt.core.tests.compiler.regression.AnnotationTest.test166.
Comment 14 David Audel CLA 2005-06-16 14:05:02 EDT
Verified using build N20050616-0010 + JDT Core HEAD.