Bug 258685

Summary: [editor] Editor shows an error on 'case' label with enum constant
Product: [Tools] AJDT Reporter: David Pytel <pytel.dawid>
Component: UIAssignee: AJDT-inbox <AJDT-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: andrew.eisenberg
Version: 1.6.2   
Target Milestone: 1.6.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Project in which the bug appears none

Description David Pytel CLA 2008-12-12 13:44:24 EST
Created attachment 120359 [details]
Project in which the bug appears

Build ID: M20080911-1700

Steps To Reproduce:
1. Create aspect with some method
2. Add switch statement.
3. Add case label with enum constant


More information:
AJDT version: 1.6.2.20081211185107 from JDT Weaving

Example code where the error appears:

package none;

/**
 * @author Dawid Pytel
 * 
 */
public aspect AspectWithSwitch {
	public enum SomeEnum {
		VAL1
	}

	public void foo() {
		SomeEnum e = SomeEnum.VAL1;
		switch (e) {
		case VAL1: // here the error appears
			System.out.println("Val1");
			break;
		}
	}
}

If I move this piece of code to a Java class everything is perfectly fine. 
Error appears only when aspect is in .aj file.
Comment 1 Andrew Eisenberg CLA 2008-12-12 14:09:05 EST
Thanks for the test case.  Will look into it now.
Comment 2 Andrew Eisenberg CLA 2008-12-12 15:22:22 EST
Seems that our aspects transformer doesn't handle case statements properly (regardless of the enum.  It is confusing case statements with pointcut declarations!

Made the change, and tested it.  The project you submitted is now part of the test case.

Committed.