1
/*******************************************************************************
2
* Copyright (c) 2004 IBM
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* Andy Clement - initial API and implementation
10
*******************************************************************************/
11
package org.aspectj.systemtest.ajc150;
15
import junit.framework.Test;
17
import org.aspectj.testing.XMLBasedAjcTestCase;
21
* Enums, the rules/tests:
23
* 1. cannot make ITDC on an enum
24
* 2. cannot make ITDM or ITDF on an enum
25
* 3. cannot use declare parents to change the super type of an enum
26
* 4. cannot use decp to make an enum type implement an interface
27
* 5. cannot use decp to dec java.lang.Enum as the parent of any type
28
* 6. cannot extend set of values in an enum via an ITD like construct
29
* 7. Compilation error if you explicitly identify an Enum type.
30
* 8. Lint warning if a non-explicit type pattern would match an enum type.
33
public class Enums extends XMLBasedAjcTestCase {
35
public static Test suite() {
36
return XMLBasedAjcTestCase.loadSuite(Enums.class);
39
protected File getSpecFile() {
40
return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
43
// Cannot make ITDC on an enum
44
public void test001_itdcsOnEnumNotAllowed() {
45
runTest("cant itd constructor on enum");
48
// Cannot make ITDM or ITDF on an enum
49
public void test002_itdFieldOrMethodOnEnumNotAllowed() {
50
runTest("cant itd field or method on enum");
53
// Deals with the cases where an explicit type is specified and it is an enum type
54
public void test003_decpOnEnumNotAllowed_errors() {
55
runTest("declare parents and enums");
58
//Deals with the cases where an wild type pattern is specified and it hits an enum type
59
public void test004_decpOnEnumNotAllowed_xlints() {
60
runTest("wildcard enum match in itd");
62
// CompilationResult cR = binaryWeave("testcode.jar","EnumAspect04.aj",0,2,false);
63
// IMessage msg = (IMessage)cR.getWarningMessages().get(0);
64
// assertTrue("Expected a message about an enum type matching a declare parents but being ignored: "+msg,
65
// msg.toString().indexOf("matches a declare parents type pattern")!=-1);
66
// msg = (IMessage)cR.getWarningMessages().get(1);
67
// assertTrue("Expected a message about an enum type matching a declare parents but being ignored: "+msg,
68
// msg.toString().indexOf("matches a declare parents type pattern")!=-1);
69
// verifyWeavingMessagesOutput(cR,new String[]{});
b'\\ No newline at end of file'