protected final AbstractIcon METHOD = createIcon(STRUCTURE_PATH + "method.gif");
protected final AbstractIcon FIELD = createIcon(STRUCTURE_PATH + "field.gif");
+ protected final AbstractIcon ENUM_VALUE = createIcon(STRUCTURE_PATH + "field.gif");//???Change to an enum value icon...
protected final AbstractIcon CLASS = createIcon(STRUCTURE_PATH + "class.gif");
protected final AbstractIcon INTERFACE = createIcon(STRUCTURE_PATH + "interface.gif");
return METHOD;
} else if (kind == IProgramElement.Kind.FIELD) {
return FIELD;
+ } else if (kind == IProgramElement.Kind.ENUM_VALUE) {
+ return ENUM_VALUE;
} else if (kind == IProgramElement.Kind.POINTCUT) {
return POINTCUT;
} else if (kind == IProgramElement.Kind.ADVICE) {
public static final Kind INTERFACE = new Kind("interface");
public static final Kind ASPECT = new Kind("aspect");
public static final Kind ENUM = new Kind("enum");
+ public static final Kind ENUM_VALUE = new Kind("enumvalue");
public static final Kind ANNOTATION = new Kind("annotation");
public static final Kind INITIALIZER = new Kind("initializer");
public static final Kind INTER_TYPE_FIELD = new Kind("inter-type field");
INTERFACE,
ASPECT,
ENUM,
+ ENUM_VALUE,
ANNOTATION,
INITIALIZER,
INTER_TYPE_FIELD,
public static List getNonAJMemberKinds() {
List list = new ArrayList();
list.add(METHOD);
+ list.add(ENUM_VALUE);
list.add(FIELD);
list.add(CONSTRUCTOR);
return list;
|| this == METHOD
|| this == CONSTRUCTOR
|| this == POINTCUT
- || this == ADVICE;
+ || this == ADVICE
+ || this == ENUM_VALUE;
}
public boolean isInterTypeMember() {
public boolean isType() {
return this == CLASS
|| this == INTERFACE
- || this == ASPECT;
+ || this == ASPECT
+ || this == ANNOTATION
+ || this == ENUM;
}
public boolean isSourceFile() {
}
}
- public boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope) {
- IProgramElement peNode = new ProgramElement(
- new String(fieldDeclaration.name),
- IProgramElement.Kind.FIELD,
- makeLocation(fieldDeclaration),
- fieldDeclaration.modifiers,
- "",
- new ArrayList());
- peNode.setCorrespondingType(fieldDeclaration.type.toString());
+ public boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope) {
+ IProgramElement peNode = null;
+ if (fieldDeclaration.type == null) { // The field represents an enum value
+ peNode = new ProgramElement(
+ new String(fieldDeclaration.name),IProgramElement.Kind.ENUM_VALUE,
+ makeLocation(fieldDeclaration), fieldDeclaration.modifiers,
+ "", new ArrayList());
+ peNode.setCorrespondingType(fieldDeclaration.binding.type.debugName());
+ } else {
+ peNode = new ProgramElement(
+ new String(fieldDeclaration.name),IProgramElement.Kind.FIELD,
+ makeLocation(fieldDeclaration), fieldDeclaration.modifiers,
+ "", new ArrayList());
+ peNode.setCorrespondingType(fieldDeclaration.type.toString());
+ }
peNode.setSourceSignature(genSourceSignature(fieldDeclaration));
peNode.setFormalComment(generateJavadocComment(fieldDeclaration));
protected String genSourceSignature(FieldDeclaration fieldDeclaration) {
StringBuffer output = new StringBuffer();
FieldDeclaration.printModifiers(fieldDeclaration.modifiers, output);
- fieldDeclaration.type.print(0, output).append(' ').append(fieldDeclaration.name);
+ if (fieldDeclaration.type == null) { // This is an enum value
+ output.append(fieldDeclaration.binding.type.debugName()).append(" ").append(fieldDeclaration.name);
+ } else {
+ fieldDeclaration.type.print(0, output).append(' ').append(fieldDeclaration.name);
+ }
if (fieldDeclaration.initialization != null
&& !(fieldDeclaration.initialization instanceof QualifiedAllocationExpression)) {
--- /dev/null
+public enum Rainbow {
+ Red,Orange,Yellow,Green,Blue,Indigo,Violet;
+}
--- /dev/null
+/*
+ * Created on 19-01-2005
+ */
+package org.aspectj.systemtest;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.aspectj.systemtest.ajc150.AllTestsAspectJ150_NeedJava15;
+
+public class AllTests15 {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("AspectJ System Test Suite - JDK 1.5");
+ //$JUnit-BEGIN$
+ suite.addTest(AllTests14.suite());
+ suite.addTestSuite(AllTestsAspectJ150_NeedJava15.class);
+ //$JUnit-END$
+ return suite;
+ }
+}
import org.aspectj.testing.XMLBasedAjcTestCase;
+/**
+ * These are tests that will run on Java 1.4 and use the old harness format for test specification.
+ */
public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
public static Test suite() {
/**
+ * These are tests that run on Java 1.4 and use the new ajctestcase format.
+ * If you have a test that *needs* to run on Java 1.5 then look in Ajc150TestsRequireJava15.java
*/
public class Ajc150TestsNoHarness extends TestUtils {
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2005 IBM
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc150;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import org.aspectj.asm.AsmManager;
+import org.aspectj.tools.ajc.CompilationResult;
+
+
+/**
+ * These tests only execute in a 1.5 environment.
+ */
+public class Ajc150TestsRequireJava15 extends TestUtils {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ baseDir = new File("../tests/bugs150");
+ }
+
+ public void testBadASMforEnums() throws IOException {
+ CompilationResult cR = ajc(baseDir,new String[]{"Rainbow.java","-emacssym","-1.5"});
+ System.err.println(cR);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ PrintWriter pw = new PrintWriter(baos);
+ AsmManager.dumptree(pw,AsmManager.getDefault().getHierarchy().getRoot(),0);
+ pw.flush();
+ String tree = baos.toString();
+ assertTrue("Expected 'Red [enumvalue]' somewhere in here:"+tree,tree.indexOf("Red [enumvalue]")!=-1);
+ }
+
+}
\ No newline at end of file
import junit.framework.Test;
import junit.framework.TestSuite;
+/**
+ * This pulls together tests we have written for AspectJ 1.5.0 that don't need Java 1.5 to run
+ */
public class AllTestsAspectJ150 {
public static Test suite() {
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2005 IBM
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc150;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * This is a superset of AllTestsAspectJ150 that includes tests that must be run on Java 1.5
+ */
+public class AllTestsAspectJ150_NeedJava15 {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Java5");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(Ajc150TestsRequireJava15.class);
+ suite.addTestSuite(Autoboxing.class);
+
+ //$JUnit-END$
+ return suite;
+ }
+}