Ver código fonte

234943: implementation

tags/V1_6_1rc1
aclement 16 anos atrás
pai
commit
97c8fff779

+ 1
- 0
tests/src/org/aspectj/systemtest/ajc161/AllTestsAspectJ161.java Ver arquivo

@@ -19,6 +19,7 @@ public class AllTestsAspectJ161 {
TestSuite suite = new TestSuite("AspectJ 1.6.1 tests");
//$JUnit-BEGIN$
suite.addTest(Ajc161Tests.suite());
suite.addTest(OptimizedAnnotationFieldBinding.suite());
//$JUnit-END$
return suite;
}

+ 69
- 0
tests/src/org/aspectj/systemtest/ajc161/OptimizedAnnotationFieldBinding.java Ver arquivo

@@ -0,0 +1,69 @@
/* *******************************************************************
* Copyright (c) 2008 Contributors
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors
* Andy Clement
* ******************************************************************/
package org.aspectj.systemtest.ajc161;
import java.io.File;

import junit.framework.Test;

import org.aspectj.testing.XMLBasedAjcTestCase;

/**
* Optimising Annotation Field Binding - better code gen for the cases where the user just wants a field from the
* annotation on a method but not the whole annotation.
*
*/
public class OptimizedAnnotationFieldBinding extends XMLBasedAjcTestCase {
public void testCaseOne_Syntax() {
runTest("case one - syntax");
}
public void testCaseTwo_NoSuchField() {
runTest("case two - no such field");
}
public void testCaseThree_Ambiguous() {
runTest("case three - ambiguous");
}
public void testCaseFour_DefaultValue() {
runTest("case four - default value");
}
public void testCaseFive_NotAnEnum_CompilerLimitation() {
runTest("case five - not an enum - compiler limitation");
}
public void testCaseSeven_AnnosInPackagesOne() {
runTest("case seven - annos in packages one");
}
public void testCaseEight_AnnosInPackagesTwo() {
runTest("case eight - annos in packages two");
}
public void testCaseNine_AllInDifferentPackages() {
runTest("case nine - everything in different packages");
}
public void testCaseTen_BindingMultipleThings() {
runTest("case ten - binding multiple things");
}
public void testCaseEleven_BindingMultipleAnnotationFields() {
runTest("case eleven - binding multiple annotation fields");
}
public void testCaseTwelve_BindingAnnoAndAnnoValue() {
runTest("case twelve - binding anno and anno value");
}
/////////////////////////////////////////
public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(OptimizedAnnotationFieldBinding.class);
}

protected File getSpecFile() {
return new File("../tests/src/org/aspectj/systemtest/ajc161/annotationFieldBinding.xml");
}
}

+ 118
- 0
tests/src/org/aspectj/systemtest/ajc161/annotationFieldBinding.xml Ver arquivo

@@ -0,0 +1,118 @@
<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>

<!-- AspectJ v1.6.1 Optimized Annotation Field Binding Tests -->
<suite>

<ajc-test dir="features161/optimizedAnnotationBinding" title="case one - syntax">
<compile options="-1.5" files="CaseOne.java"/>
<run class="CaseOne">
<stdout>
<line text="ONE"/>
<line text="TWO"/>
<line text="THREE"/>
</stdout>
</run>
</ajc-test>
<ajc-test dir="features161/optimizedAnnotationBinding" title="case two - no such field">
<compile options="-1.5" files="CaseTwo.java">
<message kind="error" line="30" text="No field of type 'Level' exists on annotation type 'Anno'"/>
</compile>
</ajc-test>
<ajc-test dir="features161/optimizedAnnotationBinding" title="case three - ambiguous">
<compile options="-1.5" files="CaseThree.java">
<message kind="error" line="31" text="The field type 'Level' is ambiguous for annotation type 'Anno'"/>
</compile>
</ajc-test>
<ajc-test dir="features161/optimizedAnnotationBinding" title="case four - default value">
<compile options="-1.5" files="CaseFour.java"/>
<run class="CaseFour">
<stdout>
<line text="ONE"/>
<line text="TWO"/>
<line text="ONE"/>
</stdout>
</run>
</ajc-test>
<ajc-test dir="features161/optimizedAnnotationBinding" title="case five - not an enum - compiler limitation">
<compile options="-1.5" files="CaseFive.java">
<message kind="error" line="20" text="The field within the annotation must be an Enum. 'java.lang.String' is not an Enum"/>
</compile>
</ajc-test>
<ajc-test dir="features161/optimizedAnnotationBinding" title="case six - not an execution join point - compiler limitation">
<compile options="-1.5" files="CaseSix.java">
<message kind="error" line="20" text="Annotation field binding is only supported at method-execution join points"/>
</compile>
</ajc-test>
<ajc-test dir="features161/optimizedAnnotationBinding" title="case seven - annos in packages one">
<compile options="-1.5" files="CaseSeven.java"/>
<run class="p.q.r.CaseSeven">
<stdout>
<line text="ONE"/>
<line text="TWO"/>
<line text="THREE"/>
</stdout>
</run>
</ajc-test>
<ajc-test dir="features161/optimizedAnnotationBinding" title="case eight - annos in packages two">
<compile options="-1.5" files="CaseEight.java"/>
<run class="p.q.r.CaseEight">
<stdout>
<line text="ONE"/>
<line text="TWO"/>
<line text="THREE"/>
</stdout>
</run>
</ajc-test>
<ajc-test dir="features161/optimizedAnnotationBinding" title="case nine - everything in different packages">
<compile options="-1.5" files="CaseNine.java Level.java Anno.java"/>
<run class="p.q.r.CaseNine">
<stdout>
<line text="ONE"/>
<line text="TWO"/>
<line text="THREE"/>
</stdout>
</run>
</ajc-test>
<ajc-test dir="features161/optimizedAnnotationBinding" title="case ten - binding multiple things">
<compile options="-1.5" files="CaseTen.java"/>
<run class="CaseTen">
<stdout>
<line text="ONE:3"/>
<line text="TWO:4"/>
<line text="THREE:5"/>
</stdout>
</run>
</ajc-test>
<ajc-test dir="features161/optimizedAnnotationBinding" title="case eleven - binding multiple annotation fields">
<compile options="-1.5" files="CaseEleven.java"/>
<run class="CaseEleven">
<stdout>
<line text="ONE:GREEN"/>
<line text="TWO:GREEN"/>
<line text="THREE:BLUE"/>
</stdout>
</run>
</ajc-test>
<ajc-test dir="features161/optimizedAnnotationBinding" title="case twelve - binding anno and anno value">
<compile options="-1.5" files="CaseTwelve.java"/>
<run class="CaseTwelve">
<stdout>
<line text="ONE:GREEN"/>
<line text="TWO:GREEN"/>
<line text="THREE:BLUE"/>
</stdout>
</run>
</ajc-test>
</suite>

Carregando…
Cancelar
Salvar