diff options
author | Andy Clement <aclement@pivotal.io> | 2019-01-30 16:55:38 -0800 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2019-01-30 16:55:38 -0800 |
commit | 2b24e7377da7c849fe7f9f4fa06a701664f9d27d (patch) | |
tree | 64c36c8fcf29633af7a5e2f7405b94cbec629ca8 /tests/src/test/java/org/aspectj/systemtest/ajc150 | |
parent | d60de8d0b3e62eb36b612a824bb9345d865c0155 (diff) | |
download | aspectj-2b24e7377da7c849fe7f9f4fa06a701664f9d27d.tar.gz aspectj-2b24e7377da7c849fe7f9f4fa06a701664f9d27d.zip |
mavenizing tests - wip
Diffstat (limited to 'tests/src/test/java/org/aspectj/systemtest/ajc150')
38 files changed, 13510 insertions, 0 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/AccBridgeMethods.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/AccBridgeMethods.java new file mode 100644 index 000000000..e9348f49c --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/AccBridgeMethods.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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 - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + + +/** + * <b>These tests check binary weaving of code compiled with the 1.5 compiler. If you need to rebuild + * the class files then you will have to run tests/java5/bridgeMethods/build.xml.</b> + * + * <p>Bridge methods are generated when a type extends or implements a parameterized class or interface and + * type erasure changes the signature of any inherited method. + * + * <p>They impact AspectJ in two ways: + * <ol> + * <li>They exist as a method execution join point, and their 'body' exists as a set of new join points + * (although their body is normally coded simply to delegate to the method they are bridging too). + * <li> They create a potential call join point where a call can be made to the bridge method. + * </ol> + * + * <p>The principal things we have to do are avoid weaving their body and ignore their existence + * as a method execution join point. Their existence as a potential target for a call join point are + * more complicated. Although they exist in the code, a 1.5 compiler will prevent a call to them with + * an error like this: + * + * M.java:3: compareTo(Number) in Number cannot be applied to (java.lang.String) + * new Number(5).compareTo("abc"); + * + * Our problem is that a Java 1.4 or earlier compiler will allow you to write calls to this bridge method + * and it will let them through. + */ +public class AccBridgeMethods extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AccBridgeMethods.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + + /** + * AspectX attempts to weave call and execution of the method for which a 'bridge method' is also created. + * If the test works then only two weaving messages come out. If it fails then usually 4 messages come out + * and we have incorrectly woven the bridge method (the 3rd message is execution of the bridge method and + * the 4th message is the call within the bridge method to the real method). + */ + public void test001_bridgeMethodIgnored() { + runTest("Ignore bridge methods"); + } + + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/Ajc150Tests.java new file mode 100644 index 000000000..c9998d6c9 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/Ajc150Tests.java @@ -0,0 +1,1035 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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 - 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 junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.apache.bcel.classfile.Signature; +import org.aspectj.asm.AsmManager; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.util.LangUtil; + +public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc150Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + public void testMixingCodeStyles_pr121385() { + runTest("mixing aspect styles"); + } + + public void testTypeVars_pr121575() { + runTest("different numbers of type vars"); + } + + public void testTypeVars_pr121575_2() { + runTest("different numbers of type vars - 2"); + } + + public void testTypeVars_pr121575_3() { + runTest("different numbers of type vars - 3"); + } + + public void testTypeVars_pr121575_4() { + runTest("different numbers of type vars - 4"); + } + + public void testDecps1() { + runTest("decps - 1"); + } + + public void testDecps1b() { + runTest("decps - 1b"); + } + + public void testDecps2() { + runTest("decps - 2"); + } + + public void testDecps2b() { + runTest("decps - 2b"); + } + + public void testDecps3() { + runTest("decps - 3"); + } + + public void testDecps3b() { + runTest("decps - 3b"); + } + + public void testDecps3c() { + runTest("decps - 3c"); + } + + public void testVarargsNPE_pr120826() { + runTest("varargs NPE"); + } + + public void testNamedPointcutPertarget_pr120521() { + runTest("named pointcut not resolved in pertarget pointcut"); + } + + public void testDollarClasses_pr120474() { + runTest("Dollar classes"); + } + + public void testGenericPTW_pr119539_1() { + runTest("generic pertypewithin aspect - 1"); + } + + public void testGenericPTW_pr119539_2() { + runTest("generic pertypewithin aspect - 2"); + } + + public void testGenericPTW_pr119539_3() { + runTest("generic pertypewithin aspect - 3"); + } + + /* + * public void testBrokenDispatchByITD_pr72834() { runTest("broken dispatch");} public void testMissingAccessor_pr73856() { + * runTest("missing accessor");} public void testCunningDeclareParents_pr92311() { runTest("cunning declare parents");} public + * void testGenericITDsAndAbstractMethodError_pr102357() { runTest("generic itds and abstract method error");} + */ + public void testIncorrectSignatureMatchingWithExceptions_pr119749() { + runTest("incorrect exception signature matching"); + } + + public void testGeneratingCodeForAnOldRuntime_pr116679_1() { + runTest("generating code for a 1.2.1 runtime - 1"); + } + + public void testGeneratingCodeForAnOldRuntime_pr116679_2() { + runTest("generating code for a 1.2.1 runtime - 2"); + } + + public void testAmbiguousMethod_pr118599_1() { + runTest("ambiguous method when binary weaving - 1"); + } + + public void testAmbiguousMethod_pr118599_2() { + runTest("ambiguous method when binary weaving - 2"); + } + + public void testAroundAdviceArrayAdviceSigs_pr118781() { + runTest("verify error with around advice array sigs"); + } + + public void testAtDeclareParents_pr117681() { + runTest("at declare parents"); + } + + public void testPrivilegeProblem_pr87525() { + runTest("privilege problem with switch"); + } + + public void testRangeProblem_pr109614() { + runTest("Range problem"); + } + + public void testGenericAspects_pr115237() { + runTest("aspectOf and generic aspects"); + } + + public void testClassFormatError_pr114436() { + runTest("ClassFormatError binary weaving perthis"); + } + + public void testParserException_pr115788() { + runTest("parser exception"); + } + + public void testPossibleStaticImports_pr113066_1() { + runTest("possible static imports bug - 1"); + } + + public void testPossibleStaticImports_pr113066_2() { + runTest("possible static imports bug - 2"); + } + + public void testPossibleStaticImports_pr113066_3() { + runTest("possible static imports bug - 3"); + } + + public void testITDCtor_pr112783() { + runTest("Problem with constructor ITDs"); + } + + public void testAnnotatedITDFs_pr114005_1() { + runTest("Annotated ITDFs - 1"); + } + + public void testAnnotatedITDFs_pr114005_2() { + runTest("Annotated ITDFs - 2"); + } + + public void testCantCallSuperMethods_pr90143() { + runTest("cant call super methods"); + } + + public void testBrokenDecp_pr112476() { + runTest("binary weaving decp broken"); + } + + public void testUnboundFormal_pr112027() { + runTest("unexpected error unboundFormalInPC"); + } + + public void testNPEScopeSetup_pr115038() { + runTest("NPE in ensureScopeSetup"); + } + + public void testCCEGenerics_pr113445() { + runTest("Generics ClassCastException"); + } + + public void testMatthewsAspect_pr113947_1() { + runTest("maws generic aspect - 1"); + } + + public void testMatthewsAspect_pr113947_2() { + runTest("maws generic aspect - 2"); + } + + public void testFieldGet_pr114343() { + runTest("field-get, generics and around advice"); + } + + public void testFieldGet_pr114343_2() { + runTest("field-get, generics and around advice - 2"); + } + + public void testFieldGet_pr114343_3() { + runTest("field-get, generics and around advice - 3"); + } + + public void testCaptureBinding_pr114744() { + runTest("capturebinding wildcard problem"); + } + + public void testAutoboxingAroundAdvice_pr119210_1() { + runTest("autoboxing around advice - 1"); + } + + public void testAutoboxingAroundAdvice_pr119210_2() { + runTest("autoboxing around advice - 2"); + } + + public void testAutoboxingAroundAdvice_pr119210_3() { + runTest("autoboxing around advice - 3"); + } + + public void testBadDecp_pr110788_1() { + runTest("bad generic decp - 1"); + } + + public void testBadDecp_pr110788_2() { + runTest("bad generic decp - 2"); + } + + public void testBadDecp_pr110788_3() { + runTest("bad generic decp - 3"); + } + + public void testBadDecp_pr110788_4() { + runTest("bad generic decp - 4"); + } + + // public void testSimplifiedGenericAspectITDTest() { runTest("spurious override method warning - 3");} + // public void testSpuriousOverrideMethodWarning_pr119570_1() { runTest("spurious override method warning");} + // public void testSpuriousOverrideMethodWarning_pr119570_2() { runTest("spurious override method warning - 2");} + + public void testBrokenSwitch_pr117854() { + runTest("broken switch transform"); + } + + public void testVarargsITD_pr110906() { + runTest("ITD varargs problem"); + } + + public void testBadRenderer_pr86903() { + runTest("bcelrenderer bad"); + } + + // public void testIllegalInitialization_pr118326_1() { runTest("illegal initialization - 1");} + // public void testIllegalInitialization_pr118326_2() { runTest("illegal initialization - 2");} + public void testLintForAdviceSorting_pr111667() { + runTest("lint for advice sorting"); + } + + public void testIncompatibleClassChangeError_pr113630_1() { + runTest("IncompatibleClassChangeError - errorscenario"); + } + + public void testIncompatibleClassChangeError_pr113630_2() { + runTest("IncompatibleClassChangeError - workingscenario"); + } + + public void testFieldGetProblemWithGenericField_pr113861() { + runTest("field-get problems with generic field"); + } + + public void testAccesstoPrivateITDInNested_pr118698() { + runTest("access to private ITD from nested type"); + } + + public void testDeclareAnnotationOnNonExistentType_pr99191_1() { + runTest("declare annotation on non existent type - 1"); + } + + public void testDeclareAnnotationOnNonExistentType_pr99191_2() { + runTest("declare annotation on non existent type - 2"); + } + + public void testDeclareAnnotationOnNonExistentType_pr99191_3() { + runTest("declare annotation on non existent type - 3"); + } + + public void testDeclareAnnotationOnNonExistentType_pr99191_4() { + runTest("declare annotation on non existent type - 4"); + } + + public void testDeclareAnnotationOnNonExistentType_pr99191_5() { + runTest("declare annotation on non existent type - 5"); + } + + public void testBadGenericSigAttribute_pr110927() { + runTest("cant create signature attribute"); + Signature sig = GenericsTests.getClassSignature(ajc, "I"); + if (sig == null) + fail("Couldn't find signature attribute for type I"); + String sigString = sig.getSignature(); + if (!(sigString.equals("Ljava/lang/Object;LIE2;LIE1<Ljava/lang/String;>;") || sigString + .equals("Ljava/lang/Object;LIE1<Ljava/lang/String;>;LIE2;"))) { + fail("Signature was " + sigString + + " when should have been something like Ljava/lang/Object;LIE1<Ljava/lang/String;>;LIE2;"); + } + } + + public void test_typeProcessingOrderWhenDeclareParents() { + runTest("Order of types passed to compiler determines weaving behavior"); + } + + public void test_aroundMethod() { + runTest("method called around in class"); + } + + public void test_aroundMethodAspect() { + runTest("method called around in aspect"); + } + + public void test_ambiguousBindingsDetection() { + runTest("Various kinds of ambiguous bindings"); + } + + public void test_ambiguousArgsDetection() { + runTest("ambiguous args"); + } + + public void testIncorrectExceptionTableWhenBreakInMethod_pr78021() { + runTest("Injecting exception into while loop with break statement causes catch block to be ignored"); + } + + public void testIncorrectExceptionTableWhenReturnInMethod_pr79554() { + runTest("Return in try-block disables catch-block if final-block is present"); + } + + public void testMissingDebugInfoForGeneratedMethods_pr82570() throws ClassNotFoundException { + runTest("Weaved code does not include debug lines"); + boolean f = false; + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "PR82570_1"); + Method[] meths = jc.getMethods(); + for (int i = 0; i < meths.length; i++) { + Method method = meths[i]; + if (f) + System.err.println("Line number table for " + method.getName() + method.getSignature() + " = " + + method.getLineNumberTable()); + assertTrue("Didn't find a line number table for method " + method.getName() + method.getSignature(), + method.getLineNumberTable() != null); + } + + // This test would determine the info isn't there if you pass -g:none ... + // cR = ajc(baseDir,new String[]{"PR82570_1.java","-g:none"}); + // assertTrue("Expected no compile problem:"+cR,!cR.hasErrorMessages()); + // System.err.println(cR.getStandardError()); + // jc = getClassFrom(ajc.getSandboxDirectory(),"PR82570_1"); + // meths = jc.getMethods(); + // for (int i = 0; i < meths.length; i++) { + // Method method = meths[i]; + // assertTrue("Found a line number table for method "+method.getName(), + // method.getLineNumberTable()==null); + // } + } + + public void testCanOverrideProtectedMethodsViaITDandDecp_pr83303() { + runTest("compiler error when mixing inheritance, overriding and polymorphism"); + } + + public void testPerTypeWithin_pr106554() { + runTest("Problem in staticinitialization with pertypewithin aspect"); + } + + public void testPerTypeWithinMissesNamedInnerTypes() { + runTest("pertypewithin() handing of inner classes (1)"); + } + + public void testPerTypeWithinMissesAnonymousInnerTypes() { + runTest("pertypewithin() handing of inner classes (2)"); + } + + public void testPerTypeWithinIncorrectlyMatchingInterfaces() { + runTest("pertypewithin({interface}) illegal field modifier"); + } + + public void test051_arrayCloningInJava5() { + runTest("AJC possible bug with static nested classes"); + } + + public void testBadASMforEnums() throws IOException { + runTest("bad asm for enums"); + + if (LangUtil.is15VMOrGreater()) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + PrintWriter pw = new PrintWriter(baos); + AsmManager.dumptree(pw, AsmManager.lastActiveStructureModel.getHierarchy().getRoot(), 0); + pw.flush(); + String tree = baos.toString(); + assertTrue("Expected 'Red [enumvalue]' somewhere in here:" + tree, tree.indexOf("Red [enumvalue]") != -1); + } + } + + public void npeOnTypeNotFound() { + runTest("structure model npe on type not found"); + } + + public void testNoRuntimeExceptionSoftening() { + runTest("declare soft of runtime exception"); + } + + public void testRuntimeNoSoftenWithHandler() { + runTest("declare soft w. catch block"); + } + + public void testSyntaxError() { + runTest("invalid cons syntax"); + } + + public void testVarargsInConsBug() { + runTest("varargs in constructor sig"); + } + + public void testAspectpathdirs() { + runTest("dirs on aspectpath"); + } + + public void testIntroSample() { + runTest("introduction sample"); + } + + public void testPTWInterface() { + runTest("pertypewithin({interface}) illegal field modifier"); + } + + public void testEnumCalledEnumEtc() { + runTest("enum called Enum, annotation called Annotation, etc"); + } + + public void testInternalCompilerError_pr86832() { + runTest("Internal compiler error"); + } + + public void testCloneMethod_pr83311() { + runTest("overriding/polymorphism error on interface method introduction"); + } + + // IfPointcut.findResidueInternal() was modified to make this test complete in a short amount + // of time - if you see it hanging, someone has messed with the optimization. + public void testIfEvaluationExplosion_pr94086() { + runTest("Exploding compile time with if() statements in pointcut"); + } + + public void testReflectNPE_pr94167() { + runTest("NPE in reflect implementation"); + } + + public void testStaticImports_pr84260() { + runTest("static import failures"); + } + + public void testGenerics_pr99089() { + runTest("ArrayIndexOutOfBoundsException - Generics in privileged aspects"); + } + + public void testGenerics_pr95993() { + runTest("NPE at ClassScope.java:660 when compiling generic class"); + } + + public void testItdGenerics_pr99228() { + runTest("ITD of a field into a generic class"); + } + + public void testItdGenerics_pr98320() { + runTest("intertype with nested generic type"); + } + + public void testItdGenerics_pr100227() { + runTest("inner class with generic enclosing class"); + } + + public void testItdGenerics_pr100260() { + runTest("methods inherited from a generic parent"); + } + + public void testSyntaxErrorNPE_pr103266() { + runTest("NPE on syntax error"); + } + + public void testFinalAbstractClass_pr109486() { + runTest("Internal compiler error (ClassParser.java:242)"); + } + + public void testComplexBinding_pr102210() { + runTest("NullPointerException trying to compile"); + } + + public void testIllegalStateExceptionOnNestedParameterizedType_pr106634() { + runTest("IllegalStateException unpacking signature of nested parameterized type"); + } + + public void testParseErrorOnAnnotationStarPlusPattern() { + runTest("(@Foo *)+ type pattern parse error"); + } + + public void test_pr106130_tooManyLocals() { + runTest("test weaving with > 256 locals"); + } + + public void testMissingNamePattern_pr106461() { + runTest("missing name pattern"); + } + + public void testMissingNamePattern_pr107059() { + runTest("parser crashes on call(void (@a *)(..)"); + } + + public void testIntermediateAnnotationMatching() { + runTest("intermediate annotation matching"); + } + + public void testBadRuntimeTestGeneration() { + runTest("target(@Foo *)"); + } + + // ONE_EIGHT remove for now, needs some grammar changes to ensure empty type annotations are put in place for later consumption +// public void testErrorMessageOnITDWithTypePatterns() { +// runTest("clear error message on itd with type pattern"); +// } + + public void testAjKeywordsAsIdentifiers() { + runTest("before and after are valid identifiers in classes"); + } + + public void testAjKeywordsAsIdentifiers2() { + runTest("before and after are valid identifiers in classes, part 2"); + } + + public void testNoBeforeReturningAdvice() { + runTest("before returning advice not allowed!"); + } + + public void testDetectVoidFieldType() { + runTest("void field type in pointcut expression"); + } + + public void testPointcutOverriding() { + runTest("overriding final pointcut from super-aspect"); + } + + public void testAtSuppressWarnings() { + runTest("@SuppressWarnings should suppress"); + } + + public void testDEOWWithBindingPointcut() { + runTest("declare warning : foo(str) : ...;"); + } + + public void testAroundAdviceAndInterfaceInitializer() { + runTest("around advice on interface initializer"); + } + + public void testGoodErrorMessageOnUnmatchedMemberSyntax() { + runTest("good error message for unmatched member syntax"); + } + + public void testITDWithNoExceptionAndIntermediary() { + runTest("itd override with no exception clause"); + } + + public void testAnonymousInnerClasses() { + runTest("anonymous inner classes"); + } + + public void testMultipleAnonymousInnerClasses() { + runTest("multiple anonymous inner classes"); + } + + public void testPrivilegedMethodAccessorsGetRightExceptions_pr82989() { + runTest("Compiler error due to a wrong exception check in try blocks"); + } + + public void testAnonymousInnerClassWithMethodReturningTypeParameter_pr107898() { + runTest("anonymous inner class with method returning type parameter"); + } + + public void testMatchingOfObjectArray() { + runTest("matching against Object[]"); + } + + public void testMultipleAnonymousInnerClasses_pr108104() { + runTest("multiple anonymous inner classes 2"); + } + + public void testSignatureMatchingInMultipleOverrideScenario() { + runTest("signature matching in override scenario"); + } + + public void testWildcardAnnotationMatching_pr108245() { + runTest("wildcard annotation matching - pr108245"); + } + + public void testInnerTypesAndTypeVariables() { + runTest("inner types and type variables"); + } + + public void testAtAfterThrowingWithNoFormal() { + runTest("@AfterThrowing with no formal specified"); + } + + public void testParameterizedVarArgsMatch() { + runTest("varargs with type variable"); + } + + public void testFieldAccessInsideITDM() { + runTest("itd field access inside itd method"); + } + + public void testTypeVarWithTypeVarBound() { + runTest("type variable with type variable bound"); + } + + public void testEnumSwitchInITD() { + runTest("switch on enum inside ITD method"); + } + + public void testInnerTypeOfGeneric() { + runTest("inner type of generic interface reference from parameterized type"); + } + + public void testDeclareParentsIntroducingCovariantReturnType() { + runTest("declare parents introducing override with covariance"); + } + + public void testInnerClassPassedToVarargs() { + runTest("inner class passed as argument to varargs method"); + } + + public void testInlinedFieldAccessInProceedCall() { + runTest("inlined field access in proceed call"); + } + + public void testVisibiltyInSignatureMatchingWithOverridesPart1() { + runTest("visibility in signature matching with overrides - 1"); + } + + public void testVisibiltyInSignatureMatchingWithOverridesPart2() { + runTest("visibility in signature matching with overrides - 2"); + } + + public void testVisibiltyInSignatureMatchingWithOverridesPart3() { + runTest("visibility in signature matching with overrides - 3"); + } + + public void testArgsGeneratedCorrectlyForAdviceExecution() { + runTest("args generated correctly for advice execution join point"); + } + + public void testNoUnusedWarningsOnAspectTypes() { + runTest("no unused warnings on aspect types"); + } + + public void testSyntheticArgumentsOnITDConstructorsNotUsedInMatching() { + runTest("synthetic arguments on itd cons are not used in matching"); + } + + public void testParsingOfGenericTypeSignature() { + runTest("parse generic type signature with parameterized type in interface"); + } + + public void testOverrideAndCovarianceWithDecPRuntime() { + runTest("override and covariance with decp - runtime"); + } + + public void testOverrideAndCovarianceWithDecPRuntimeMultiFiles() { + runTest("override and covariance with decp - runtime separate files"); + } + + public void testOverrideAndCovarianceWithDecPRuntimeMultiFilesBinaryWeaving() { + runTest("override and covariance with decp - binary weaving"); + } + + public void testAbstractSynchronizedITDMethods() { + runTest("abstract synchronized itdms not detected"); + } + + public void testSynchronizedITDInterfaceMethods() { + runTest("synchronized itd interface methods"); + } + + public void testNoWarningOnUnusedPointcut() { + runTest("unused private pointcuts"); + } + + public void testITDOnInterfaceWithExistingMember() { + runTest("itd interface method already existing on interface"); + } + + public void testFinalITDMOnInterface() { + runTest("final itd methods on interfaces"); + } + + public void testPrivatePointcutOverriding() { + runTest("can't override private pointcut in abstract aspect"); + } + + public void testAdviceOnCflow() { + runTest("advising cflow advice execution"); + } + + public void testNoTypeMismatchOnSameGenericTypes() { + runTest("no type mismatch on generic types in itds"); + } + + public void testSuperCallInITD() { + runTest("super call in ITD"); + } + + public void testSuperCallInITDPart2() { + runTest("super call in ITD - part 2"); + } + + public void testAtAnnotationBadTest_pr103740() { + runTest("Compiler failure on at_annotation"); + } + + public void testNoUnusedParameterWarningsForSyntheticAdviceArgs() { + runTest("no unused parameter warnings for synthetic advice args"); + } + + public void testNoVerifyErrorWithSetOnInnerType() { + runTest("no verify error with set on inner type"); + } + + public void testCantFindTypeErrorWithGenericReturnTypeOrParameter() { + runTest("cant find type error with generic return type or parameter"); + } + + public void testNoVerifyErrorOnGenericCollectionMemberAccess() { + runTest("no verify error on generic collection member access"); + } + + public void testRawAndGenericTypeConversionITDCons() { + runTest("raw and generic type conversion with itd cons"); + } + + public void testAtAnnotationBindingWithAround() { + runTest("@annotation binding with around advice"); + } + + public void testUnableToBuildShadows_pr109728() { + runTest("Unable to build shadows"); + } + + public void testMessageOnMissingTypeInDecP() { + runTest("declare parents on a missing type"); + } + + public void testParameterizedGenericMethods() { + runTest("parameterized generic methods"); + } + + public void testIllegalChangeToPointcutDeclaration_pr111915() { + runTest("test illegal change to pointcut declaration"); + } + + public void testCantProvideDefaultImplViaITD_pr110307_1() { + runTest("Cant provide default implementation via ITD - 1"); + } + + public void testCantProvideDefaultImplViaITD_pr110307_2() { + runTest("Cant provide default implementation via ITD - 2"); + } + + public void testCantProvideDefaultImplViaITD_pr110307_3() { + runTest("Cant provide default implementation via ITD - 3"); + } + + public void testCantProvideDefaultImplViaITD_pr110307_4() { + runTest("Cant provide default implementation via ITD - 4"); + } + + public void testCantProvideDefaultImplViaITD_pr110307_5() { + runTest("Cant provide default implementation via ITD - 5"); + } + + // Needs a change in the compiler so that getType() can be overridden in the intertype scope - thats + // where we can police whether a type variable has been used without being specified appropriately. + // public void testCantProvideDefaultImplViaITD_pr110307_6() {runTest("Cant provide default implementation via ITD - 6");} + + public void testCantProvideDefaultImplViaITD_pr110307_7() { + runTest("Cant provide default implementation via ITD - 7"); + } + + public void testCallJoinPointsInAnonymousInnerClasses() { + runTest("call join points in anonymous inner classes"); + } + + public void testNoRequirementForUnwovenTypesToBeExposedToWeaver() { + runTest("default impl of Runnable"); + } + + public void testArrayCloneCallJoinPoints() { + runTest("array clone call join points in 1.4 vs 1.3"); + } + + public void testDebugInfoForAroundAdvice() { + runTest("debug info in around advice inlining"); + } + + public void testCCEWithGenericWildcard_pr112602() { + runTest("ClassCastException with generic wildcard"); + } + + public void testVarArgsIITDInConstructor() { + runTest("ITD varargs in constructor"); + } + + public void testWeaveInfoMessageForDeclareAtMethodOnITDdMethod() { + runTest("weaveinfo message for declare at method on an ITDd method"); + } + + public void testITDCWithNoExplicitConsCall() { + runTest("ITDC with no explicit cons call"); + } + + public void testJava5SpecificFeaturesUsedAtJava14OrLower() { + if (LangUtil.is17VMOrGreater()) { + runTest("java 5 pointcuts and declares at pre-java 5 compliance levels - 1.7"); + } else { + runTest("java 5 pointcuts and declares at pre-java 5 compliance levels"); + } + } + + public void testAnonymousTypes() { + runTest("Anonymous types and nome matching"); + } + + public void testAdviceExecutionJPToStringForms() { + runTest("adviceexecution join point toString forms"); + } + + public void testAssertWithinPointcutExpression() { + runTest("pointcut expression containing 'assert'"); + } + + public void testNoVerifyErrorWithTwoThisPCDs_pr113447() { + runTest("no verify error with two this pcds"); + } + + public void testNoVerifyErrorWithTwoAtThisPCDs_pr113447() { + runTest("no verify error with two at this pcds"); + } + + public void testNoVerifyErrorWithAtWithinPCDs_pr113447() { + runTest("no verify error with at within pcds"); + } + + public void testNoVerifyErrorWithAtWithincodePCDs_pr113447() { + runTest("no verify error with at withincode pcds"); + } + + public void testNoVerifyErrorWithAtAnnotationPCDs_pr113447() { + runTest("no verify error with at annotation pcds"); + } + + public void testNoVerifyErrorWithTwoArgsPCDs_pr113447() { + runTest("no verify error with two args pcds"); + } + + public void testNoStackOverflowWithCircularPCDInGenericAspect() { + runTest("no StackOverflowError with circular pcd in generic aspect"); + } + + public void testNoStackOverflowWithCircularPCDInGenericAspect2() { + runTest("no StackOverflowError with circular pcd in generic aspect - 2"); + } + + public void testNPEInThisJoinPointStaticPart() { + runTest("thisJoinPointStaticPart in if test"); + } + + public void testPointcutParsingOfCompiledPointcuts() { + runTest("pointcut parsing with ajc compiled pointcut references"); + } + + public void testReflectionOfAbstractITDs() { + runTest("reflection on abstract ITDs (Billing example)"); + } + + public void testDeclareSoftWithAdviceExecution() { + runTest("declare soft and adviceexecution"); + } + + public void testDeclareSoftWithExclusions() { + runTest("declare soft and exclusions"); + } + + public void testReturningObjectBinding() { + runTest("returning(Object) binding"); + } + + public void testPerTargetAndNegation() { + runTest("pertarget and negated pointcut"); + } + + public void testParameterizedPointcutAndAdvice() { + runTest("parameterized pointcut and advice"); + } + + public void testDoublyParameterizedAbstractType() { + runTest("double parameter generic abstract type"); + } + + public void testArgNamesInAdviceAnnotations() { + runTest("arg names in advice annotations"); + } + + /* + * Load-time weaving bugs + */ + public void testNPEinWeavingAdaptor_pr116626() { + runTest("NPE in WeavingAdaptor"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_Exact() { + runTest("xlint message for improper exact annotation type"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_OR() { + runTest("xlint message for improper annotation type inside OR"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_AND() { + runTest("xlint message for improper annotation type inside AND"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_Return() { + runTest("xlint message for improper annotated return type"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_Declaring() { + runTest("xlint message for improper annotated declaring type"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_Parameter() { + runTest("xlint message for improper annotated parameter type"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_Throws() { + runTest("xlint message for improper annotated throws pattern"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_MoreThanOne() { + runTest("xlint message for more than one improper annotated parameter type"); + } + + public void testNoNPEWhenInaccessibleMethodIsCalledWithinITD_pr119019() { + runTest("no NPE when inaccessible method is called within itd"); + } + + public void testNoNPEWithOrPointcutAndMoreThanOneArgs_pr118149() { + runTest("no NPE with or pointcut and more than one args"); + } + + public void testNoSOBWithGenericInnerAspects_pr119543() { + runTest("no StringOutOfBoundsException with generic inner aspects"); + } + + public void testIllegalAccessErrorWithAroundAdvice_pr119657() { + runTest("IllegalAccessError with around advice on interface method call"); + } + + public void testIllegalAccessErrorWithAroundAdviceNotSelf_pr119657() { + runTest("IllegalAccessError with around advice on interface method call not self"); + } + + public void testIllegalAccessErrorWithAroundAdviceTerminateAfterCompilationLTW_pr119657() { + runTest("IllegalAccessError with around advice on interface method call using -XterminateAfterCompilation and LTW"); + } + + public void testIllegalAccessErrorWithAroundAdviceLTW_pr119657() { + runTest("IllegalAccessError with around advice on interface method call using LTW"); + } + + public void testIllegalAccessErrorWithAroundAdviceNotSelfLTW_pr119657() { + runTest("IllegalAccessError with around advice on interface method call not self using LTW"); + } + + public void testIllegalAccessErrorWithAroundAdviceSelfAndNotSelfLTW_pr119657() { + runTest("IllegalAccessError with around advice on interface method call self and not self using LTW"); + } + + public void testIllegalAccessErrorWithAroundAdviceLTWNoInline_pr119657() { + runTest("IllegalAccessError with around advice on interface method call using LTW and -XnoInline"); + } + + public void testReflectOnCodeStyleITDs() { + runTest("reflection on itds"); + } + + public void testReflectOnAtAspectJDecP() { + runTest("reflection on @DeclareParents"); + } + + public void testModifierOverrides() { + runTest("modifier overrides"); + } + + public void testAbstractPerThisInAtAspectJ() { + runTest("abstract perthis in @AspectJ"); + } + + public void testNPEInBcelAdviceWithConcreteAspect_pr121385() { + runTest("override protected pointcut in aop.xml concrete aspect"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java new file mode 100644 index 000000000..1d750bb94 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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 - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.aspectj.systemtest.ajc150.ataspectj.AtAjLTWTests; +import org.aspectj.systemtest.ajc150.ataspectj.AtAjMisuseTests; +import org.aspectj.systemtest.ajc150.ataspectj.AtAjSyntaxTests; +import org.aspectj.systemtest.ajc150.ltw.LTWServerTests; +import org.aspectj.systemtest.ajc150.ltw.LTWTests; + +/** + * 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() { + TestSuite suite = new TestSuite("AspectJ1.5.0 tests"); + // $JUnit-BEGIN$ + suite.addTestSuite(MigrationTests.class); + suite.addTest(Ajc150Tests.suite()); + suite.addTestSuite(SCCSFixTests.class); + + suite.addTest(AccBridgeMethods.suite()); + suite.addTestSuite(CovarianceTests.class); + suite.addTestSuite(Enums.class); + suite.addTest(AnnotationsBinaryWeaving.suite()); + suite.addTest(AnnotationPointcutsTests.suite()); + suite.addTestSuite(VarargsTests.class); + suite.addTestSuite(StaticImports.class); + suite.addTest(AnnotationRuntimeTests.suite()); + suite.addTestSuite(PerTypeWithinTests.class); + + suite.addTest(Autoboxing.suite()); + suite.addTest(Annotations.suite()); + suite.addTest(AnnotationBinding.suite()); + suite.addTest(RuntimeAnnotations.suite()); + + suite.addTest(SuppressedWarnings.suite()); + suite.addTest(DeclareAnnotationTests.suite()); + suite.addTest(GenericsTests.suite()); + suite.addTest(GenericITDsDesign.suite()); + suite.addTest(AtAjSyntaxTests.suite()); + suite.addTest(AtAjMisuseTests.suite()); + suite.addTest(AtAjLTWTests.suite()); + suite.addTest(HasMember.suite()); + + suite.addTestSuite(LTWTests.class); + suite.addTestSuite(LTWServerTests.class); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationBinding.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationBinding.java new file mode 100644 index 000000000..466567641 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationBinding.java @@ -0,0 +1,402 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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 - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; +import java.util.List; + +import junit.framework.Test; + +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IHierarchy; +import org.aspectj.asm.IProgramElement; +import org.aspectj.asm.IRelationship; +import org.aspectj.asm.internal.Relationship; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class AnnotationBinding extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AnnotationBinding.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + // /////////////////////////////////// @ANNOTATION and CALL + + // Very simple annotation binding for 'call() && @annotation()' + public void testCallAnnotationBinding1() { + runTest("call annotation binding 1"); + } + + // 'call() && @annotation()' when the called method has multiple arguments + public void testCallAnnotationBinding2() { + runTest("call annotation binding 2"); + } + + // 'call() && @annotation()' when the called method takes primitive arguments (YUCK!) + public void testCallAnnotationBinding3() { + runTest("call annotation binding 3"); + } + + // 'call() && @annotation()' when runtime type will exhibit different annotation (due to interface implementing) + public void testCallAnnotationBinding4() { + runTest("call annotation binding 4"); + } + + // 'call() && @annotation()' when target doesnt have an annotation ! + public void testCallAnnotationBinding5() { + runTest("call annotation binding 5"); + } + + // 'call() && @annotation()' when runtime type will exhibit different annotation (due to subclassing) + public void testCallAnnotationBinding6() { + runTest("call annotation binding 6"); + } + + // 'call() && @annotation()' using named pointcut + public void testCallAnnotationBinding7() { + runTest("call annotation binding 7"); + } + + // /////////////////////////////////// @TARGET + + // 'call() && @target()' + public void testAtTargetAnnotationBinding1() { + runTest("@target annotation binding 1"); + } + + // 'call() && @target() && @target' + public void testAtTargetAnnotationBinding2() { + runTest("@target annotation binding 2"); + } + + // 'call() && @target()' - using a type hierarchy where some levels are missing annotations + public void testAtTargetAnnotationBinding3() { + runTest("@target annotation binding 3"); + } + + // 'call() && @target()' - using a type hierarchy where some levels are missing annotations + // but the annotation is inherited + public void testAtTargetAnnotationBinding4() { + runTest("@target annotation binding 4"); + } + + // @target() with an annotation in a package + public void testAtTargetAnnotationBinding5() { + runTest("@target annotation binding 5"); + } + + // /////////////////////////////////// @THIS + + // 'call() && @this()' + public void testAtThisAnnotationBinding1() { + runTest("@this annotation binding 1"); + } + + // 'call() && @this() && @this' + public void testAtThisAnnotationBinding2() { + runTest("@this annotation binding 2"); + } + + // 'call() && @this()' - using a type hierarchy where some levels are missing annotations + public void testAtThisAnnotationBinding3() { + runTest("@this annotation binding 3"); + } + + // 'call() && @this()' - using a type hierarchy where some levels are missing annotations + // but the annotation is inherited + public void testAtThisAnnotationBinding4() { + runTest("@this annotation binding 4"); + } + + // '@this() and @target()' used together + public void testAtThisAtTargetAnnotationBinding() { + runTest("@this annotation binding 5"); + } + + // /////////////////////////////////// @ARGS + + // complex case when there are 3 parameters + public void testAtArgs1() { + runTest("@args annotation binding 1"); + } + + // simple case when there is only one parameter + public void testAtArgs2() { + runTest("@args annotation binding 2"); + } + + // simple case when there is only one parameter and no binding + public void testAtArgs3() { + runTest("@args annotation binding 3"); + } + + // complex case binding different annotation kinds + public void testAtArgs4() { + runTest("@args annotation binding 4"); + } + + // check @args and execution() + public void testAtArgs5() { + runTest("@args annotation binding 5"); + } + + // /////////////////////////////////// @ANNOTATION and EXECUTION + + // 'execution() && @annotation()' + public void testExecutionAnnotationBinding1() { + runTest("execution and @annotation"); + } + + // /////////////////////////////////// @ANNOTATION and SET + + // 'set() && @annotation()' + public void testFieldAnnotationBinding1() { + runTest("set and @annotation"); + } + + // 'get() && @annotation()' + public void testFieldAnnotationBinding2() { + runTest("get and @annotation"); + } + + // 'get() && @annotation()' when using array fields + public void testFieldAnnotationBinding3() { + runTest("get and @annotation with arrays"); + } + + // /////////////////////////////////// @ANNOTATION and CTOR-CALL + + // 'ctor-call(new) && @annotation()' + public void testCtorCallAnnotationBinding1() { + runTest("cons call and @annotation"); + } + + // /////////////////////////////////// @ANNOTATION and CTOR-CALL + + // 'ctor-execution() && @annotation()' + public void testCtorExecAnnotationBinding1() { + runTest("cons exe and @annotation"); + } + + // /////////////////////////////////// @ANNOTATION and STATICINITIALIZATION + + // 'staticinitialization() && @annotation()' + public void testStaticInitAnnotationBinding1() { + runTest("staticinit and @annotation"); + } + + // /////////////////////////////////// @ANNOTATION and PREINITIALIZATION + + // 'preinitialization() && @annotation()' + public void testPreInitAnnotationBinding1() { + runTest("preinit and @annotation"); + } + + // /////////////////////////////////// @ANNOTATION and INITIALIZATION + + // 'initialization() && @annotation()' + public void testInitAnnotationBinding1() { + runTest("init and @annotation"); + } + + // /////////////////////////////////// @ANNOTATION and ADVICEEXECUTION + + // 'adviceexecution() && @annotation()' + public void testAdviceExecAnnotationBinding1() { + runTest("adviceexecution and @annotation"); + } + + // /////////////////////////////////// @ANNOTATION and HANDLER + + // 'handler() && @annotation()' + public void testHandlerAnnotationBinding1() { + runTest("handler and @annotation"); + } + + // /////////////////////////////////// @WITHIN + + // '@within()' + public void testWithinBinding1() { + runTest("@within"); + } + + // '@within()' but multiple types around (some annotated) + public void testWithinBinding2() { + runTest("@within - multiple types"); + } + + // /////////////////////////////////// @WITHINCODE + + // '@withincode() && call(* println(..))' + public void testWithinCodeBinding1() { + runTest("@withincode() and call(* println(..))"); + } + + // /////////////////////////////////// @ANNOTATION complex tests + + // Using package names for the types (including the annotation) - NO BINDING + public void testPackageNamedTypesNoBinding() { + runTest("packages and no binding"); + } + + // Using package names for the types (including the annotation) - INCLUDES BINDING + public void testPackageNamedTypesWithBinding() { + runTest("packages and binding"); + } + + // declare parents: @Color * implements Serializable + public void testDeclareParentsWithAnnotatedAnyPattern() { + runTest("annotated any pattern"); + } + + // Should error (in a nice way!) on usage of an annotation that isnt imported + public void testAnnotationUsedButNotImported() { + runTest("annotation not imported"); + } + + // Binding with calls/executions of static methods + public void testCallsAndExecutionsOfStaticMethods() { + runTest("binding with static methods"); + } + + // /////////////////////////////////////////////////////////////////////////////// + // annotation binding with ITDs + + public void testAnnotationBindingAndITDs1() { + runTest("simple binding annotation values where itd method is annotated"); + } + + public void testAnnotationBindingAndITDs2() { + runTest("simple binding annotation values where itd field is annotated"); + } + + public void testAnnotationBindingAndITDs3() { + runTest("simple binding annotation values where itd ctor is annotated"); + } + + public void testAnnotationBindingAndITDs4() { + runTest("simple binding annotation values where itd method is annotated via declare"); + } + + public void testAnnotationBindingAndITDs5() { + runTest("simple binding annotation values where itd field is annotated via declare"); + } + + public void testAnnotationBindingAndITDs6() { + runTest("simple binding annotation values where itd field is annotated multiple times via declare"); + } + + public void testAnnotationBindingAndITDs7() { + runTest("simple binding annotation values where itd ctor is annotated via declare"); + } + + public void testAnnotationBindingAndITDs4_asmtest() { + // AsmManager.setReporting("c:/debug.txt",true,true,true,true); + runTest("simple binding annotation values where itd method is annotated via declare"); + + if (getCurrentTest().canRunOnThisVM()) { + AsmManager asm = AsmManager.lastActiveStructureModel; + IHierarchy top = asm.getHierarchy(); + + IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_METHOD, + "declare @method: int A.m() : @Fruit(\"orange\")"); + assertTrue("Couldn't find 'declare @method' element in the tree", ipe != null); + + List<IRelationship> l = asm.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_METHOD, + "declare @method: int A.n() : @Fruit(\"banana\")"); + assertTrue("Couldn't find 'declare @method element in the tree", ipe != null); + + l = asm.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + Relationship rel = (Relationship) l.get(0); + assertTrue("Should have 1 target but has " + rel.getTargets().size(), rel.getTargets().size() == 1); + String tgt = (String) rel.getTargets().get(0); + int lineNumber = asm.getHandleProvider().getLineNumberForHandle(tgt); + assertTrue("Should point to line 10 but doesnt: " + lineNumber, lineNumber == 10); + } + } + + public void testAnnotationBindingAndITDs5_asmtest() { + // AsmManager.setReporting("c:/debug.txt",true,true,true,true); + runTest("simple binding annotation values where itd field is annotated via declare"); + + if (getCurrentTest().canRunOnThisVM()) { + AsmManager asm = AsmManager.lastActiveStructureModel; + IHierarchy top = asm.getHierarchy(); + + IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_FIELD, + "declare @field: int A.i : @Fruit(\"orange\")"); + assertTrue("Couldn't find 'declare @type' element in the tree", ipe != null); + + List<IRelationship> l = asm.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_FIELD, + "declare @field: java.lang.String A.j : @Fruit(\"banana\")"); + assertTrue("Couldn't find 'declare @field element in the tree", ipe != null); + + l = asm.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + Relationship rel = (Relationship) l.get(0); + assertTrue("Should have 1 target but has " + rel.getTargets().size(), rel.getTargets().size() == 1); + String tgt = (String) rel.getTargets().get(0); + int lineNumber = asm.getHandleProvider().getLineNumberForHandle(tgt); + assertTrue("Should point to line 10 but doesnt: " + lineNumber, lineNumber == 10); + + } + } + + public void testAnnotationBindingAndITDs7_asmtest() { + // AsmManager.setReporting("c:/debug.txt",true,true,true,true); + runTest("simple binding annotation values where itd ctor is annotated via declare"); + + if (getCurrentTest().canRunOnThisVM()) { + + AsmManager asm = AsmManager.lastActiveStructureModel; + IHierarchy top = asm.getHierarchy(); + + IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_CONSTRUCTOR, + "declare @constructor: A.new(java.lang.String) : @Fruit(\"pear\")"); + assertTrue("Couldn't find 'declare @constructor' element in the tree", ipe != null); + + List<IRelationship> l = asm.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_CONSTRUCTOR, + "declare @constructor: A.new(int) : @Fruit(\"orange\")"); + assertTrue("Couldn't find 'declare @constructor element in the tree", ipe != null); + + l = asm.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + Relationship rel = (Relationship) l.get(0); + assertTrue("Should have 1 target but has " + rel.getTargets().size(), rel.getTargets().size() == 1); + String tgt = (String) rel.getTargets().get(0); + int lineNumber = asm.getHandleProvider().getLineNumberForHandle(tgt); + assertTrue("Should point to line 10 but doesnt: " + lineNumber, lineNumber == 10); + + } + } + + public void testAnnotationBindingArgsVerifyError_pr92053() { + runTest("AtArgs causes a VerifyError: Unable to pop operand off an empty stack"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationPointcutsTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationPointcutsTests.java new file mode 100644 index 000000000..4301a44c0 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationPointcutsTests.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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 - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + + +/** + * Tests the use of Annotations in pointcuts + */ +public class AnnotationPointcutsTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AnnotationPointcutsTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + // before(): call(@SimpleAnnotation * *(..)) { } + public void test001_usingAnnotationsInPointcuts() { + runTest("annotation matching on call"); + } + + public void test002_AtAnnotationMatching() { + runTest("at annotation matching"); + } + + public void test003_Within_Code() { + runTest("annotations and within(code)"); + } + + public void test004_Within() { + runTest("annotations and within"); + } + + // TODO extra tests + // 3) @annotation on the different join point kinds, matches with inherited annotation + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationRuntimeTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationRuntimeTests.java new file mode 100644 index 000000000..e1d83a6cc --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationRuntimeTests.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** +* Tests for @this, @target, @args +*/ +public class AnnotationRuntimeTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AnnotationRuntimeTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + +// No longer a limitation ASC 31Jan05 +// public void test001_BindingWithAtTargetAllowed() { +// CompilationResult cR = binaryWeave("TestingAnnotations.jar","BindingWithAtTarget.aj",0,0); +// List errors = cR.getErrorMessages(); +// RunResult rR = run("TestingAnnotations"); +// System.err.println(rR.getStdErr()); +// } + + public void test002_MustHaveRuntimeRetention() { + runTest("must have runtime retention"); + } + + public void test003_InheritableOrNot() { + runTest("inheritable or not"); + } + + public void test004_CantUseinDecEoW() { + runTest("use of @this/target in deow"); + } + + public void test005_ArgsSuite() { + runTest("@args tests"); + } + + public void test006_CantUseinDecEoW() { + runTest("use of @args in deow"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/Annotations.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/Annotations.java new file mode 100644 index 000000000..f6cea64cb --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/Annotations.java @@ -0,0 +1,171 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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 - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class Annotations extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Annotations.class); + } + + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml"); + } + + public void testCompilingAnnotation() { + runTest("compiling an annotation"); + } + + public void testCompilingAnnotatedFile() { + runTest("compiling annotated file"); + } + + public void testCompilingUsingWithinAndAnnotationTypePattern() { + runTest("annotations and within (src)"); + } + + /** + * We had a bug where annotations were not present in the output class file for methods + * that got woven. This was due to unpacking bugs in LazyMethodGen. This test compiles + * a simple program then checks the annotations were copied across. + */ + public void testBugWithAnnotationsLostOnWovenMethods() throws ClassNotFoundException { + runTest("losing annotations..."); + if (getCurrentTest().canRunOnThisVM()) { + + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Program"); + Method[] meths = jc.getMethods(); + for (int i = 0; i < meths.length; i++) { + Method method = meths[i]; + if (method.getName().equals("m1")) { + assertTrue("Didn't have annotations - were they lost? method="+method.getName(),method.getAnnotations().length==1); + } + } + } + } + + public void testAnnotatedAnnotations() { + runTest("annotated annotations (@Target)"); + } + + public void testSimpleAnnotatedAspectMembers() { + runTest("simple annotated aspect members"); + } + + public void testAnnotatedAspectMembersWithWrongAnnotationType() { + runTest("simple annotated aspect members with bad target"); + } + + // more implementation work needed before this test passes + public void testAnnotatedITDs() { + runTest("annotated itds"); + } + + public void testAnnotatedITDs2() { + runTest("annotated public itds"); + } + + public void testAnnotatedITDs3() { + runTest("annotated public itds - values"); + } + + public void testAnnotatedITDs4() { + runTest("annotated public itds - multiple complex annotations"); + } + + public void testAnnotatedITDsWithWrongAnnotationType() { + runTest("annotated itds with bad target"); + } + + public void testAnnotatedAdvice() { + runTest("annotated advice"); + } + + public void testAnnotatedAdviceWithWrongAnnotationType() { + runTest("annotated advice with bad target"); + } + + public void testAnnotatedPointcut() { + runTest("annotated pointcut"); + } + + // FIXME asc uncomment this test when parser is opened up +// public void testAnnotatedDeclareStatements() { +// runTest("annotated declare statements"); +// } + + public void testBasicDeclareAnnotation() { + runTest("basic declare annotation parse test"); + } + + public void testAJDKAnnotatingAspects() { + runTest("ajdk: annotating aspects chapter"); + } + + public void testAJDKAnnotatingAspects2() { + runTest("ajdk: annotating aspects chapter, ex 2"); + } + + public void testAnnotationPatterns() { + runTest("ajdk: annotation pattern matching"); + } + + public void testAnnotationTypePatterns() { + runTest("ajdk: annotation type pattern matching"); + } + + public void testAnnotationSigPatterns() { + runTest("ajdk: annotations in sig patterns"); + } + + public void testAnnotationRuntimeMatching() { + runTest("ajdk: runtime annotations"); + } + + public void testAnnotationRetentionChecking() { + runTest("ajdk: @retention checking"); + } + + public void testAnnotationInheritance() { + runTest("ajdk: @inherited"); + } + + public void testAnnotationDEOW() { + runTest("ajdk: deow-ann"); + } + + public void testAnnotationDecp() { + runTest("ajdk: decp-ann"); + } + + public void testAnnotationDecPrecedence() { + runTest("ajdk: dec precedence"); + } + + public void testAnnotationDecAnnotation() { + runTest("ajdk: dec annotation"); + } + + public void testAnnotationsAndITDs() { + runTest("nasty annotation and itds test"); + } + + // helper methods..... + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationsBinaryWeaving.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationsBinaryWeaving.java new file mode 100644 index 000000000..cec4665a7 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationsBinaryWeaving.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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 - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + + +/** + * Annotations, the rules/tests: + * + * 1. cannot make ITD (C,M or F) on an annotation + * 2. cannot use declare parents to change the super type of an annotation + * 3. cannot use decp to make an annotation type implement an interface + * 4. cannot use decp to dec java.lang.annotation.Annotation as the parent of any type + * 5. cannot extend set of values in an annotation via an ITD like construct + * 6. Compilation error if you explicitly identify an Annotation type. + * 7. Lint warning if a non-explicit type pattern would match an annotation type. + */ +public class AnnotationsBinaryWeaving extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AnnotationsBinaryWeaving.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + // Cannot make ITD (c/m/f) on an annotation + public void test001_itdsOnAnnotationsNotAllowed() { + runTest("no itds on annotation types"); + } + + // Deals with the cases where an explicit type is specified and it is an annotation type + public void test002_decpOnAnnotationNotAllowed_errors() { + runTest("no declare parents on annotation types"); + } + + //Deals with the cases where an wild type pattern is specified and it hits an annotation type + public void test004_decpOnAnnotationNotAllowed_xlints() { + runTest("declare parents wildcards matching annotation types"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/Autoboxing.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/Autoboxing.java new file mode 100644 index 000000000..46a261e24 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/Autoboxing.java @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * 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 - initial implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** +This test must be run under a Java5 VM - so it is *not* currently +in the test suite !!! +*/ +public class Autoboxing extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Autoboxing.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + public void testSimpleBoxing() { + runTest("simple boxing test"); + } + + public void testIntegerBoxing() { + runTest("integer boxing"); + } + + public void testCharacterBoxing() { + runTest("char boxing"); + } + + public void testDoubleBoxing() { + runTest("double boxing"); + } + + public void testFloatBoxing() { + runTest("float boxing"); + } + + public void testShortBoxing() { + runTest("short boxing"); + } + + public void testLongBoxing() { + runTest("long boxing"); + } + + public void testBooleanBoxing() { + runTest("boolean boxing"); + } + + public void testByteBoxing() { + runTest("byte boxing"); + } + + public void testBoxingAfterReturning() { + runTest("boxing in after returning"); + } +// CompilationResult cR = binaryWeave("testcode.jar","AspectAfterReturning.aj",0,0,"-1.5"); +// //System.err.println(cR.getStandardError()); +// assertTrue("Expected six weaving messages but got: "+getWeavingMessages(cR.getInfoMessages()).size(), +// getWeavingMessages(cR.getInfoMessages()).size()==6); +// RunResult rR = run("AspectAfterReturning"); +// int lines = countLines(rR.getStdErr()); +// assertTrue("Expected 6 lines of output but got: #"+lines+":\n"+rR.getStdErr(),lines==6); +// } +// +// public int countLines(String s) { +// int count = 0; +// while (s.indexOf("\n")!=-1) { +// count++; +// s = s.substring(s.indexOf("\n")+1); +// } +// return count; +// } +// +// protected void verify(String output,String lookingFor) { +// assertTrue("Didn't find expected string '"+lookingFor+"' in:\n"+output,output.indexOf(lookingFor)!=-1); +// } +// +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/CovarianceTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/CovarianceTests.java new file mode 100644 index 000000000..662394969 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/CovarianceTests.java @@ -0,0 +1,166 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * 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 - initial implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/* + +class Car {} + +class FastCar extends Car {} + +class Super { + Car getCar() { + return new Car(); + } +} + +class Sub extends Super { + FastCar getCar() { + return new FastCar(); + } +} + +public class CovBaseProgram01 { + public static void main(String[] argv) { + new CovBaseProgram01().run(); + } + + public void run() { + Super instance_super = new Super(); + Sub instance_sub = new Sub(); + + Car c1 = instance_super.getCar(); // Line 26 + Car c2 = instance_sub.getCar(); // Line 27 + } +} + +// Line26: callJPs: call(Car Super.getCar()) +// Line27: callJPs: call(FastCar Sub.getCar()) call(Car Super.getCar()) + + */ + +/** + * Covariance is simply where a type overrides some inherited implementation and narrows the return type. + */ +public class CovarianceTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(CovarianceTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + private boolean verbose = false; + + + /** + * call(* getCar()) should match both + */ + public void testCOV001() { + runTest("covariance 1"); + } + + + /** + * call(* Super.getCar()) should match both + * + * This test required a change to the compiler. When we are looking at signatures and comparing them we walk up + * the hierarchy looking for supertypes that declare the same method. The problem is that in the comparison for + * whether to methods are compatible we were including the return type - this meant 'Car getCar()' on Super was + * different to 'FastCar getCar()' on Sub - it thought they were entirely different methods. In fact the return + * type is irrelevant here, we just want to make sure the names and the parameter types are the same - so I + * added a parameterSignature to the Member class that looks like '()' where the full signature looks like + * '()LFastCar;' (which includes the return type). If the full signature comparison fails then it looks at the + * parameter signature - I did it that way to try and preserve some performance. I haven't changed the + * definition of 'signature' for a member as trimming the return type off it seems rather serious ! + * + * What might break: + * - 'matches' can now return true for things that have different return types - I guess whether this is a problem + * depends on what the caller of matches is expecting, their code will have been written before covariance was + * a possibility. All the tests pass so I'll leave it like this for now. + */ + public void testCOV002() { + runTest("covariance 2"); + } + + /** + * call(Car getCar()) should match both + * + * Had to implement proper covariance support here... + */ + public void testCOV003() { + runTest("covariance 3"); + } + + /** + * *** Different base program, where Sub does not extend Super. + * call(Car Super.getCar()) should only match first call to getCar() + */ + public void testCOV004() { + runTest("covariance 4"); + } + + /** + * *** Original base program + * call(Car Super.getCar()) should match both + */ + public void testCOV005() { + runTest("covariance 5"); + } + + /** + * call(Car Sub.getCar()) should not match anything + */ + public void testCOV006() { + runTest("covariance 6"); + } + + /** + * call(Car+ Sub.getCar()) should match 2nd call with xlint for the 1st call + */ + public void testCOV007() { + runTest("covariance 7"); + } + + /** + * *** aspect now contains two pointcuts and two pieces of advice + * call(FastCar getCar()) matches on 2nd call + * call(FastCar Sub.getCar()) matches on 2nd call + */ + public void testCOV008() { + runTest("covariance 8"); + } + + /** + * call(FastCar Super.getCar()) matches nothing + */ + public void testCOV009() { + runTest("covariance 9"); + } + + /** + * call(Car+ getCar()) matches both + */ + public void testCOV010() { + runTest("covariance 10"); + } + + public void testAJDKExamples() { + runTest("ajdk: covariance"); + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/DeclareAnnotationTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/DeclareAnnotationTests.java new file mode 100644 index 000000000..28d48c6ca --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/DeclareAnnotationTests.java @@ -0,0 +1,331 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM + * 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 initial implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; +import java.util.List; + +import junit.framework.Test; + +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IHierarchy; +import org.aspectj.asm.IProgramElement; +import org.aspectj.asm.IRelationship; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class DeclareAnnotationTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(DeclareAnnotationTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + // parsing the various forms of declare @ + public void testDeclareAnnotationParsing() { + runTest("basic declare annotation parse test"); + } + + // declare @type + + // declare @type for one simple annotation on one specific type + public void testAtType_OneAnnotationHittingOneType_Src() { + runTest("declare @type 1"); + } + + // declare @type for one simple annotation to multiple types + public void testAtType_OneAnnotationHittingMultipleTypes_Src() { + runTest("declare @type 2"); + } + + // declare @type for one simple annotation and a pointcut that matches on it + public void testAtType_PointcutMatchingOnDeclaredAnnotation() { + runTest("declare @type - with matching pointcut"); + } + + // binary weaving declare @type, one annotation on one type + public void testAtType_OneAnnotationHittingOneType_Bin() { + runTest("declare @type - binary weaving"); + } + + // an annotation with multiple values (all the primitives and string) + // is declared upon a single type + public void testAtType_ComplexAnnotation_BinWeaving() { + runTest("declare @type - complex annotation - binary weaving"); + } + + public void testAtType_ComplexAnnotation_SrcWeaving() { + runTest("declare @type - complex annotation - source weaving"); + } + + // two annotations are declared on a type + public void testAtType_TwoAnnotationsOnOneType_BinWeaving() { + runTest("declare @type - two annotations hit one type - binary weaving"); + } + + public void testAtType_TwoAnnotationsOnOneType_SrcWeaving() { + runTest("declare @type - two annotations hit one type - source weaving"); + } + + // decp and deca can interact, let's try some variants that should + // result in the same thing + public void testAtType_InteractingWithDeclareParents1_BinWeaving() { + runTest("declare @type - declare parents interactions (order 1) - binary weaving"); + } + + public void testAtType_InteractingWithDeclareParents1_SrcWeaving() { + runTest("declare @type - declare parents interactions (order 1) - source weaving"); + } + + public void testAtType_InteractingWithDeclareParents2_BinWeaving() { + runTest("declare @type - declare parents interactions (order 2) - binary weaving"); + } + + public void testAtType_InteractingWithDeclareParents2_SrcWeaving() { + runTest("declare @type - declare parents interactions (order 2) - source weaving"); + } + + public void testAtType_InteractingWithDeclareParents3_BinWeaving() { + runTest("declare @type - declare parents interactions (order 3) - binary weaving"); + } + + public void testAtType_InteractingWithDeclareParents3_SrcWeaving() { + runTest("declare @type - declare parents interactions (order 3) - source weaving"); + } + + public void testAtType_InteractingWithDeclareParents4_BinWeaving() { + runTest("declare @type - declare parents interactions (order 4) - binary weaving"); + } + + public void testAtType_InteractingWithDeclareParents4_SrcWeaving() { + runTest("declare @type - declare parents interactions (order 4) - source weaving"); + } + + public void testAtType_AnnotatingAlreadyAnnotatedType_BinWeaving() { + runTest("declare @type - annotating an already annotated type - binary weaving"); + } + + public void testAtType_AnnotatingAlreadyAnnotatedType_SrcWeaving() { + runTest("declare @type - annotating an already annotated type - source weaving"); + } + + // testing for error messages when exact type patterns used + // public void testAtType_UsingWrongAnnotationOnAType_BinWeaving() + // runTest("declare @type - annotations with different targets - binary weaving"); + // } + public void testAtType_UsingWrongAnnotationOnAType_SrcWeaving() { + runTest("declare @type - annotations with different targets - source weaving"); + } + + // testing for the lint message when non exact patterns used + // public void testAtType_UsingWrongAnnotationOnAType_TypeSpecifiedByPattern_BinWeaving() { + // runTest("declare @type - annotations with different targets (using type patterns) - binary weaving"); + // } + public void testAtType_UsingWrongAnnotationOnAType_TypeSpecifiedByPattern_SrcWeaving() { + runTest("declare @type - annotations with different targets (using type patterns) - source weaving"); + } + + // testing how multiple decAtType/decps interact when they rely on each other + public void testAtType_ComplexDecpDecAtTypeInteractions_BinWeaving() { + runTest("declare @type - complex decp decAtType interactions - binary weaving"); + } + + public void testAtType_ComplexDecpDecAtTypeInteractions_SrcWeaving() { + runTest("declare @type - complex decp decAtType interactions - source weaving"); + } + + public void testAtType_PuttingIncorrectAnnosOnTypes_SrcWeaving() { + runTest("declare @type - trying to put annotation targetting annos on normal types - source weaving"); + } + + public void testAtType_PuttingIncorrectAnnosOnTypes_BinWeaving() { + runTest("declare @type - trying to put annotation targetting annos on normal types - binary weaving"); + } + + public void testAtType_PuttingIncorrectAnnosOnTypesWithPatterns_SrcWeaving() { + runTest("declare @type - trying to put annotation targetting annos on normal types (uses pattern) - source weaving"); + } + + public void testAtType_PuttingIncorrectAnnosOnTypesWithPatterns_BinWeaving() { + runTest("declare @type - trying to put annotation targetting annos on normal types (uses pattern) - binary weaving"); + } + + // I think this fails because of a freaky JDT compiler bug ... + // public void testAtType_UsingClassOrEnumElementValuesInAnnotations_SrcWeaving() { + // runTest("declare @type - covering enum and class element values - source weaving"); + // } + + public void testAtType_UsingClassOrEnumElementValuesInAnnotations_BinWeaving() { + runTest("declare @type - covering enum and class element values - binary weaving"); + } + + // /////////////////////////////////////////////////////////////////////////////// + // declare @field + + public void testAtField_SimpleSource() { + runTest("declare @field - simple source weaving"); + } + + public void testAtField_SimpleBinary() { + runTest("declare @field - simple binary weaving"); + } + + // lint warning + public void testAtField_TwoTheSameOnOneSource() { + runTest("declare @field - two the same on one - source weaving"); + } + + // lint warning + public void testAtField_TwoTheSameOnOneBinary() { + runTest("declare @field - two the same on one - binary weaving"); + } + + public void testAtField_TwoDifferentOnOneSource() { + runTest("declare @field - two different on one - source weaving"); + } + + public void testAtField_TwoDifferentOnOneBinary() { + runTest("declare @field - two different on one - binary weaving"); + } + + public void testAtField_WrongTargetSource() { + runTest("declare @field - wrong target - source weaving"); + } + + // Can't do a test like this - as verification of the declare @ is + // done when the aspect is first compiled. + // public void testAtField_WrongTargetBinary() { + // runTest("declare @field - wrong target - binary weaving"); + // } + + public void testAtField_RightTargetSource() { + runTest("declare @field - right target - source weaving"); + } + + public void testAtField_RightTargetBinary() { + runTest("declare @field - right target - binary weaving"); + } + + public void testAtField_RecursiveSource() { + runTest("declare @field - recursive application - source weaving"); + } + + public void testAtField_RecursiveBinary() { + runTest("declare @field - recursive application - binary weaving"); + } + + public void testAtField_RecursiveOtherOrderSource() { + runTest("declare @field - recursive application (other order) - source weaving"); + } + + public void testAtField_RecursiveOtherOrderBinary() { + runTest("declare @field - recursive application (other order) - binary weaving"); + } + + // /////////////////////////////////////////////////////////////////////////////// + // declare @method + + public void testAtMethod_SimpleSource() { + runTest("declare @method - simple source weaving"); + } + + public void testAtMethod_SimpleBinary() { + runTest("declare @method - simple binary weaving"); + } + + // /////////////////////////////////////////////////////////////////////////////// + // declare @constructor + + public void testAtCtor_SimpleSource() { + runTest("declare @constructor - simple source weaving"); + } + + public void testAtCtor_SimpleBinary() { + runTest("declare @constructor - simple binary weaving"); + } + + // /////////////////////////////////////////////////////////////////////////////// + // declare @method @constructor + + public void testAtMethodCtor_WrongTargetSource() { + runTest("declare @method @ctor - wrong target - source weaving"); + } + + public void testAtMethodCtor_RightTargetSource() { + runTest("declare @method @ctor - right target - source weaving"); + } + + public void testAtMethodCtor_RightTargetBinary() { + runTest("declare @method @ctor - right target - binary weaving"); + } + + // lint warning + public void testAtMethodCtor_TwoTheSameOnOneSource() { + runTest("declare @method @ctor - two the same on one - source weaving"); + } + + // lint warning + public void testAtMethodCtor_TwoTheSameOnOneBinary() { + runTest("declare @method @ctor - two the same on one - binary weaving"); + } + + public void testAtMethodCtor_TwoDifferentOnOneSource() { + runTest("declare @method @ctor - two different on one - source weaving"); + } + + public void testAtMethodCtor_TwoDifferentOnOneBinary() { + runTest("declare @method @ctor - two different on one - binary weaving"); + } + + // to debug this test, uncomment the first line which will give you a nice + // dump of the structure model in c:/debug.txt + public void testStructureModel() { + // AsmManager.setReporting("c:/debug.txt",true,true,true,true); + runTest("declare all annotations on one class - source weaving"); + + if (getCurrentTest().canRunOnThisVM()) { + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + + IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_TYPE, + "declare @type: p.q.DeathByAnnotations : @Colored(\"red\")"); + assertTrue("Couldn't find 'declare @type' element in the tree", ipe != null); + + List<IRelationship> l = AsmManager.lastActiveStructureModel.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l != null && l.size() > 0); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_METHOD, + "declare @method: * m*(..) : @Fruit(\"tomato\")"); + assertTrue("Couldn't find 'declare @method element in the tree", ipe != null); + + l = AsmManager.lastActiveStructureModel.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_CONSTRUCTOR, + "declare @constructor: p.q.DeathByAnnotations.new(..) : @Fruit(\"tomato\")"); + assertTrue("Couldn't find 'declare @constructor element in the tree", ipe != null); + l = AsmManager.lastActiveStructureModel.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_FIELD, + "declare @field: * p.q.DeathByAnnotations.* : @Material(\"wood\")"); + assertTrue("Couldn't find 'declare @field element in the tree", ipe != null); + l = AsmManager.lastActiveStructureModel.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + } + } + + public void testDeclareTypeMisspelled() { + runTest("declare @Type (should be @type)"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/Enums.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/Enums.java new file mode 100644 index 000000000..7f7f8bac4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/Enums.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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 - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + + +/** + * Enums, the rules/tests: + * + * 1. cannot make ITDC on an enum + * 2. cannot make ITDM or ITDF on an enum + * 3. cannot use declare parents to change the super type of an enum + * 4. cannot use decp to make an enum type implement an interface + * 5. cannot use decp to dec java.lang.Enum as the parent of any type + * 6. cannot extend set of values in an enum via an ITD like construct + * 7. Compilation error if you explicitly identify an Enum type. + * 8. Lint warning if a non-explicit type pattern would match an enum type. + * + */ +public class Enums extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Enums.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + // Cannot make ITDC on an enum + public void test001_itdcsOnEnumNotAllowed() { + runTest("cant itd constructor on enum"); + } + + // Cannot make ITDM or ITDF on an enum + public void test002_itdFieldOrMethodOnEnumNotAllowed() { + runTest("cant itd field or method on enum"); + } + + // Deals with the cases where an explicit type is specified and it is an enum type + public void test003_decpOnEnumNotAllowed_errors() { + runTest("declare parents and enums"); + } + + //Deals with the cases where an wild type pattern is specified and it hits an enum type + public void test004_decpOnEnumNotAllowed_xlints() { + runTest("wildcard enum match in itd"); + } +// CompilationResult cR = binaryWeave("testcode.jar","EnumAspect04.aj",0,2,false); +// IMessage msg = (IMessage)cR.getWarningMessages().get(0); +// assertTrue("Expected a message about an enum type matching a declare parents but being ignored: "+msg, +// msg.toString().indexOf("matches a declare parents type pattern")!=-1); +// msg = (IMessage)cR.getWarningMessages().get(1); +// assertTrue("Expected a message about an enum type matching a declare parents but being ignored: "+msg, +// msg.toString().indexOf("matches a declare parents type pattern")!=-1); +// verifyWeavingMessagesOutput(cR,new String[]{}); +// } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericITDsDesign.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericITDsDesign.java new file mode 100644 index 000000000..6209298c1 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericITDsDesign.java @@ -0,0 +1,254 @@ +package org.aspectj.systemtest.ajc150; + +import java.io.File; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.Attribute; +import org.aspectj.apache.bcel.classfile.Field; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Signature; +import org.aspectj.apache.bcel.util.ClassPath; +import org.aspectj.apache.bcel.util.SyntheticRepository; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.tools.ajc.Ajc; +import org.aspectj.weaver.ConcreteTypeMunger; +import org.aspectj.weaver.CrosscuttingMembers; +import org.aspectj.weaver.ReferenceType; +import org.aspectj.weaver.ResolvedMember; +import org.aspectj.weaver.ResolvedType; +import org.aspectj.weaver.ResolvedTypeMunger; +import org.aspectj.weaver.TypeVariable; +import org.aspectj.weaver.TypeVariableReference; +import org.aspectj.weaver.World; +import org.aspectj.weaver.bcel.BcelTypeMunger; +import org.aspectj.weaver.bcel.BcelWorld; + +public class GenericITDsDesign extends XMLBasedAjcTestCase { + + private World recentWorld; + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(GenericITDsDesign.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + private void verifyDebugString(ResolvedMember theMember, String string) { + assertTrue("Expected '" + string + "' but found " + theMember.toDebugString(), theMember.toDebugString().equals(string)); + } + + public static JavaClass getClassFromDisk(Ajc ajc, String classname) { + try { + ClassPath cp = new ClassPath(ajc.getSandboxDirectory() + File.pathSeparator + System.getProperty("java.class.path")); + SyntheticRepository sRepos = SyntheticRepository.getInstance(cp); + return sRepos.loadClass(classname); + } catch (ClassNotFoundException e) { + fail("Couldn't find class " + classname + " in the sandbox directory."); + } + return null; + } + + public static Signature getClassSignature(Ajc ajc, String classname) { + JavaClass clazz = getClassFromDisk(ajc, classname); + Signature sigAttr = null; + Attribute[] attrs = clazz.getAttributes(); + for (int i = 0; i < attrs.length; i++) { + Attribute attribute = attrs[i]; + if (attribute.getName().equals("Signature")) { + sigAttr = (Signature) attribute; + } + } + return sigAttr; + } + + // Check the signature attribute on a class is correct + public static void verifyClassSignature(Ajc ajc, String classname, String sig) { + Signature sigAttr = getClassSignature(ajc, classname); + assertTrue("Failed to find signature attribute for class " + classname, sigAttr != null); + assertTrue("Expected signature to be '" + sig + "' but was '" + sigAttr.getSignature() + "'", sigAttr.getSignature() + .equals(sig)); + } + + public List<ConcreteTypeMunger> getTypeMunger(String classname) { + ClassPath cp = new ClassPath(ajc.getSandboxDirectory() + File.pathSeparator + System.getProperty("java.class.path")); + recentWorld = new BcelWorld(cp.toString()); + ReferenceType resolvedType = (ReferenceType) recentWorld.resolve(classname); + CrosscuttingMembers cmembers = resolvedType.collectCrosscuttingMembers(true); + List<ConcreteTypeMunger> tmungers = cmembers.getTypeMungers(); + return tmungers; + } + + private BcelTypeMunger getMungerFromLine(String classname, int linenumber) { + List allMungers = getTypeMunger(classname); + for (Iterator iter = allMungers.iterator(); iter.hasNext();) { + BcelTypeMunger element = (BcelTypeMunger) iter.next(); + if (element.getMunger().getSourceLocation().getLine() == linenumber) { + return element; + } + } + for (Iterator iter = allMungers.iterator(); iter.hasNext();) { + BcelTypeMunger element = (BcelTypeMunger) iter.next(); + System.err.println("Line: " + element.getMunger().getSourceLocation().getLine() + " > " + element); + } + fail("Couldn't find a type munger from line " + linenumber + " in class " + classname); + return null; + } + + public Hashtable<String,Field> getMeTheFields(String classname) { + JavaClass theClass = getClassFromDisk(ajc, classname); + Hashtable<String,Field> retval = new Hashtable<>(); + org.aspectj.apache.bcel.classfile.Field[] fs = theClass.getFields(); + for (int i = 0; i < fs.length; i++) { + Field field = fs[i]; + retval.put(field.getName(), field); + } + return retval; + } + + /* + * test plan: 1. Serializing and recovering 'default bounds' type variable info: a. methods b. fields c. ctors 2. Serializing + * and recovering 'extends' with a class bounded type variable info: a. methods b. fields c. ctors 3. Serializing and recovering + * 'extends' with an interface bounded type variable info: a. methods b. fields c. ctors 4. Multiple interface bounds a. methods + * b. fields c. ctors 5. wildcard bounds '? extends/? super' a. methods b. fields c. ctors 6. using type variables in an ITD + * from the containing aspect, no bounds a. methods b. fields c. ctors + */ + + // Verify: a) After storing it in a class file and recovering it (through deserialization), we can see the type + // variable and that the parameter refers to the type variable. + public void testDesignA() { + runTest("generic itds - design A"); + BcelTypeMunger theBcelMunger = getMungerFromLine("X", 5); + ResolvedType typeC = recentWorld.resolve("C"); + ResolvedTypeMunger rtMunger = theBcelMunger.getMunger(); + ResolvedMember theMember = rtMunger.getSignature(); + // Let's check all parts of the member + assertTrue("Declaring type should be C: " + theMember, theMember.getDeclaringType().equals(typeC)); + + TypeVariable tVar = theMember.getTypeVariables()[0]; + TypeVariableReference tvrt = (TypeVariableReference) theMember.getParameterTypes()[0]; + + theMember.resolve(recentWorld); // resolution will join the type variables together (i.e. make them refer to the same + // instance) + + tVar = theMember.getTypeVariables()[0]; + tvrt = (TypeVariableReference) theMember.getParameterTypes()[0]; + + assertTrue( + "Post resolution, the type variable in the parameter should be identical to the type variable declared on the member", + tVar == tvrt.getTypeVariable()); + } + + // Verify: bounds are preserved and accessible after serialization + public void testDesignB() { + runTest("generic itds - design B"); + BcelTypeMunger theBcelMunger = getMungerFromLine("X", 7); + ResolvedTypeMunger rtMunger = theBcelMunger.getMunger(); + ResolvedMember theMember = rtMunger.getSignature(); + verifyDebugString(theMember, "<T extends java.lang.Number> void C.m0(T)"); + + theBcelMunger = getMungerFromLine("X", 9); + rtMunger = theBcelMunger.getMunger(); + theMember = rtMunger.getSignature(); + verifyDebugString(theMember, "<Q extends I> void C.m1(Q)"); + + theBcelMunger = getMungerFromLine("X", 11); + rtMunger = theBcelMunger.getMunger(); + theMember = rtMunger.getSignature(); + verifyDebugString(theMember, "<R extends java.lang.Number,I> void C.m2(R)"); + } + + // Verify: a) multiple type variables work. + // b) type variables below the 'top level' (e.g. List<A>) are preserved. + public void testDesignC() { + runTest("generic itds - design C"); + BcelTypeMunger theBcelMunger = getMungerFromLine("X", 9); + // System.err.println(theBcelMunger.getMunger().getSignature().toDebugString()); + verifyDebugString(theBcelMunger.getMunger().getSignature(), "<T extends java.lang.Number,Q extends I> void C.m0(T, Q)"); + + theBcelMunger = getMungerFromLine("X", 11); + // System.err.println(theBcelMunger.getMunger().getSignature().toDebugString()); + verifyDebugString(theBcelMunger.getMunger().getSignature(), "<A,B,C> java.util.List<A> C.m1(B, java.util.Collection<C>)"); + } + + // Verify: a) sharing type vars with some target type results in the correct variable names in the serialized form + public void testDesignD() { + runTest("generic itds - design D"); + BcelTypeMunger theBcelMunger = getMungerFromLine("X", 9); + // System.err.println(theBcelMunger.getMunger().getSignature().toDebugString()); + verifyDebugString(theBcelMunger.getMunger().getSignature(), "void C.m0(R)"); + + theBcelMunger = getMungerFromLine("X", 11); + // System.err.println(theBcelMunger.getMunger().getSignature().toDebugString()); + verifyDebugString(theBcelMunger.getMunger().getSignature(), + "java.util.List<Q> C.m0(Q, int, java.util.List<java.util.List<Q>>)"); + } + + // Verify: a) for fields, sharing type vars with some target type results in the correct entries in the class file + public void testDesignE() { + runTest("generic itds - design E"); + BcelTypeMunger theBcelMunger = getMungerFromLine("X", 9); + verifyDebugString(theBcelMunger.getMunger().getSignature(), "java.util.List<Z> C.ln"); + assertTrue("Expected to find \"Z\": " + theBcelMunger.getTypeVariableAliases(), theBcelMunger.getTypeVariableAliases() + .contains("Z")); + + theBcelMunger = getMungerFromLine("X", 11); + verifyDebugString(theBcelMunger.getMunger().getSignature(), "Q C.n"); + assertTrue("Expected to find \"Q\": " + theBcelMunger.getTypeVariableAliases(), theBcelMunger.getTypeVariableAliases() + .contains("Q")); + } + + // Verifying what gets into a class targetted with a field ITD + public void testDesignF() { + runTest("generic itds - design F"); + Hashtable<String,Field> fields = getMeTheFields("C"); + + // Declared in src as: List C.list1; and List<Z> C<Z>.list2; + Field list1 = (Field) fields.get("list1");// ajc$interField$$list1"); + assertTrue("Field list1 should be of type 'Ljava/util/List;' but is " + list1.getSignature(), list1.getSignature().equals( + "Ljava/util/List;")); + Field list2 = (Field) fields.get("list2");// ajc$interField$$list1"); + assertTrue("Field list2 should be of type 'Ljava/util/List;' but is " + list2.getSignature(), list2.getSignature().equals( + "Ljava/util/List;")); + + // Declared in src as: String C.field1; and Q C<Q>.field2; + // bound for second field collapses to Object + Field field1 = (Field) fields.get("field1");// ajc$interField$$field1"); + assertTrue("Field list1 should be of type 'Ljava/lang/String;' but is " + field1.getSignature(), field1.getSignature() + .equals("Ljava/lang/String;")); + Field field2 = (Field) fields.get("field2");// ajc$interField$$field2"); + assertTrue("Field list2 should be of type 'Ljava/lang/Object;' but is " + field2.getSignature(), field2.getSignature() + .equals("Ljava/lang/Object;")); + } + + // Verifying what gets into a class when an interface it implements was targetted with a field ITD + public void testDesignG() { + runTest("generic itds - design G"); + Hashtable<String,Field> fields = getMeTheFields("C"); + + // The ITDs are targetting an interface. That interface is generic and is parameterized with + // 'String' when implemented in the class C. This means the fields that make it into C should + // be parameterized with String also. + + // List<Z> I<Z>.ln; and Q I<Q>.n; + // Field field1 = (Field)fields.get("ajc$interField$X$I$ln"); + // assertTrue("Field list1 should be of type 'Ljava/util/List;' but is "+field1.getSignature(), + // field1.getSignature().equals("Ljava/util/List;")); + // Field field2 = (Field)fields.get("ajc$interField$X$I$n"); + // assertTrue("Field list2 should be of type 'Ljava/lang/String;' but is "+field2.getSignature(), + // field2.getSignature().equals("Ljava/lang/String;")); + } + + // // Verify: a) sharing type vars with some target type results in the correct variable names in the serialized form + // public void testDesignE() { + // runTest("generic itds - design E"); + // + // } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java new file mode 100644 index 000000000..907e3d7a5 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java @@ -0,0 +1,996 @@ +package org.aspectj.systemtest.ajc150; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.HashSet; +import java.util.Set; + +import org.aspectj.apache.bcel.classfile.Attribute; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Signature; +import org.aspectj.apache.bcel.util.ClassPath; +import org.aspectj.apache.bcel.util.SyntheticRepository; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.tools.ajc.Ajc; +import org.aspectj.util.LangUtil; + +import junit.framework.Test; + +public class GenericsTests extends XMLBasedAjcTestCase { + + /*========================================== + * Generics test plan for pointcuts. + * + * handler PASS + * - does not permit type var spec + * - does not permit generic type (fail with type not found) + * - does not permit parameterized types + * if PASS + * - does not permit type vars + * cflow PASS + * - does not permit type vars + * cflowbelow PASS + * - does not permit type vars + * @this PASS + * - does not permit type vars PASS + * - does not permit parameterized type PASS + * @target PASS + * - does not permit type vars PASS + * - does not permit parameterized type PASS + * @args PASS + * - does not permit type vars PASS + * - does not permit parameterized type PASS + * @annotation PASS + * - does not permit type vars PASS + * - does not permit parameterized type PASS + * @within, @within code - as above PASS + * annotation type pattern with generic and parameterized types PASS + * - just make sure that annotation interfaces can never be generic first! VERIFIED + * - @Foo<T> should fail PASS + * - @Foo<String> should fail PASS + * - @(Foo || Bar<T>) should fail DEFERRED (not critical) + * staticinitialization PASS + * - error on parameterized type PASS N/A + * - permit parameterized type + PASS N/A + * - matching with parameterized type + N/A + * - wrong number of parameters in parameterized type PASS N/A + * - generic type with one type parameter N/A + * - generic type with n type parameters N/A + * - generic type with bounds [extends, extends + i/f's] N/A + * - generic type with wrong number of type params N/A + * - wildcards in bounds N/A + * within PASS + * - as above, but allows parameterized type (disallowed in simplified plan) + * - wildcards in type parameters N/A + * this PASS + * - no type vars + * - parameterized types - disallowed in simplification plan + * - implements + * - instanceof + * target PASS + * - as this + * args + * - args(List) matches List, List<T>, List<String> PASS + * - args(List<T>) -> invalid absolute type T + * - args(List<String>) matches List<String> but not List<Number> PASS + * - args(List<String>) matches List with unchecked warning PASS + * - args(List<String>) matches List<?> with unchecked warning PASS + * - args(List<Double>) matches List, List<?>, List<? extends Number> with unchecked warning PASS + * matches List<Double> PASS, List<? extends Double> PASS(with warning) + * - args(List<?>) matches List, List<String>, List<?>, ... PASS + * - args(List<? extends Number) matches List<Number>, List<Double>, not List<String> PASS + * matches List, List<?> with unchecked warning PASS + * - args(List<? super Number>) matches List<Object>, List<Number> + * does not match List<Double> + * matches List, List<?> with unchecked warning + * matches List<? super Number> + * matches List<? extends Object> with unchecked warning + * matches List<? extends Number> with unchecked warning + * get & set PASS + * - parameterized declaring type PASS + * - generic declaring type PASS + * - field type is type variable PASS + * - field type is parameterized PASS + * initialization, preinitialization PASS + * - generic declaring type PASS + * - type variables as params PASS + * - parameterized types as params PASS + * - no join points for init, preinit of parameterized types (as per staticinit) PASS + * withincode PASS + * - no generic or parameterized declaring type patterns PASS + * - no parameterized throws patterns PASS + * - return type as type variable PASS + * - return type as parameterized type PASS + * - parameter as type variable PASS + * - parameter as parameterized type PASS + * - no join points within bridge methods PASS + * execution PASS + * - no generic or parameterized declaring type patterns PASS + * - no parameterized throws patterns PASS + * - return type as type variable PASS + * - return type as parameterized type PASS + * - parameter as type variable PASS + * - parameter as parameterized type PASS + * - no join points for bridge methods PASS + * call PASS + * - no generic or parameterized declaring type patterns PASS + * - no parameterized throws patterns PASS + * - return type as type variable PASS + * - return type as parameterized type PASS + * - parameter as type variable PASS + * - parameter as parameterized type PASS + * - calls to a bridge methods PASS + * after throwing - can't use parameterized type pattern + * after returning - same as for args + */ + + /* ========================================== + * Generics test plan for ITDs. + * + * think about: + * - 'visibility' default/private/public + * - static/nonstatic + * - parameterized ITDs (methods/ctors/fields) + * - ITD target: interface/class/aspect + * - multiple type variables + * - constructor ITDs, method ITDs + * - ITDs sharing type variables with generic types + * - relating to above point, this makes generic ITD fields possible + * - signature attributes for generic ITDs (required? required only for public ITDs?) + * - binary weaving when target type changes over time (might start out 'simple' then sometime later be 'generic') + * - bridge methods - when to create them + * - multiple 'separate' ITDs in a file that share a type variable by 'name' + * - wildcards '?' 'extends' 'super' '&' + * - do type variables assigned to members need to persist across serialization + * - recursive type variable definitions eg. <R extends Comparable<? super R>> + * - super/extends with parameterized types <? extends List<String>> + * - multiple ITDs defined in one type that reuse type variable letters, specifying different bounds + * - generic aspects + * + * PASS parsing generic ITDs + * PASS generic methods + * PASS generic constructors + * PASS ITD visibility + * PASS static/nonstatic + * PASS parameterizedITDs + * PASS differing targets (interface/class/aspect) + * PASS multiple type variables in an ITD + * PASS parsing ITDs that share type variables with target type + * PASS using type variables from the target type in your field ITD + * PASS using type variables from the target type in your method ITD (but no type vars of your own) + * PASS using type variables from the target type in your ctor ITD (but no type vars of your own) + * PASS using type variables from the target type and having your own too (methods) + * PASS using type variables from the target type and having your own too (ctors) + * PASS reusing type variable letter but differing spec across multiple ITDs in one aspect + * PASS wildcards + * PASS recursive type variable definitions + * PASS generic aspects + * PASS parameterizing ITDs with type variables + * PASS using type variables from the target type in your *STATIC* ITD (field/method/ctor) (error scenario) + * PASS basic binary weaving of generic itds + * + * TODO generic aspect binary weaving (or at least multi source file weaving) + * TODO binary weaving with changing types (moving between generic and simple) + * TODO bridge method creation (also relates to covariance overrides..) + * TODO exotic class/interface bounds ('? extends List<String>','? super anything') + * TODO signature attributes for generic ITDs (public only?) + * + */ + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(GenericsTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + public void testITDReturningParameterizedType() { + runTest("ITD with parameterized type"); + } + + public void testPR91267_1() { + runTest("NPE using generic methods in aspects 1"); + } + + public void testParameterizedTypeAndAroundAdvice_PR115250() { + runTest("parameterized type and around advice"); + } + + public void testParameterizedTypeAndAroundAdvice_PR115250_2() { + runTest("parameterized type and around advice - 2"); + } + + public void testPR91267_2() { + runTest("NPE using generic methods in aspects 2"); + } + + public void testPR91053() { + runTest("Generics problem with Set"); + } + + public void testPR87282() { + runTest("Compilation error on generic member introduction"); + } + + public void testGenericsOverrides_1() { runTest("generics and ITD overrides - 1"); } + public void testGenericsOverrides_2() { runTest("generics and ITD overrides - 2"); } + public void testGenericsOverrides_3() { runTest("generics and ITD overrides - 3"); } + public void testGenericsOverrides_4() { runTest("generics and ITD overrides - 4"); } + + + public void testSelfBoundGenerics_pr117296() { + runTest("self bounding generic types"); + } + + public void testPR88606() { + runTest("Parameterized types on introduced fields not correctly recognized"); + } + + public void testPR97763() { + runTest("ITD method with generic arg"); + } + + public void testGenericsBang_pr95993() { + runTest("NPE at ClassScope.java:660 when compiling generic class"); + } + + + // generic aspects + public void testPR96220_GenericAspects1() {runTest("generic aspects - 1");} + public void testPR96220_GenericAspects2() {runTest("generic aspects - 2");} + public void testPR96220_GenericAspects3() {runTest("generic aspects - 3");} + public void testGenericAspects4() {runTest("generic aspects - 4");} + public void testGenericAspects5() {runTest("generic aspects - 5 (ajdk)");} // in separate files + public void testGenericAspects6() {runTest("generic aspects - 6 (ajdk)");} // all in one file + public void testTypeVariablesInDeclareWarning() { runTest("generic aspect with declare warning using type vars");} + public void testTypeVariablesInExecutionAdvice() { runTest("generic aspect with execution advice using type vars");} + public void testTypeVariablesInAnonymousPointcut() { runTest("generic aspect with anonymous pointcut");} + public void testDeclareParentWithParameterizedInterface() { + runTest("generic aspect declare parents"); + } + public void testDeclareSoftInGenericAspect() { + runTest("generic aspect declare soft"); + } + + ////////////////////////////////////////////////////////////////////////////// + // Generic/Parameterized ITDs - includes scenarios from developers notebook // + ////////////////////////////////////////////////////////////////////////////// + + + // parsing of generic ITD members + public void testParseItdNonStaticMethod() {runTest("Parsing generic ITDs - 1");} + public void testParseItdStaticMethod() {runTest("Parsing generic ITDs - 2");} + public void testParseItdCtor() {runTest("Parsing generic ITDs - 3");} + public void testParseItdComplexMethod() {runTest("Parsing generic ITDs - 4");} + public void testParseItdSharingVars1() {runTest("Parsing generic ITDs - 5");} + public void testParseItdSharingVars2() {runTest("Parsing generic ITDs - 6");} + + + // non static + public void testGenericMethodITD1() {runTest("generic method itd - 1");} // <E> ... (List<? extends E>) + public void testGenericMethodITD2() {runTest("generic method itd - 2");} // <E extends Number> ... (List<? extends E>) called incorrectly + public void testGenericMethodITD3() {runTest("generic method itd - 3");} // <E> ... (List<E>,List<E>) + public void testGenericMethodITD4() {runTest("generic method itd - 4");} // <A,B> ... (List<A>,List<B>) + public void testGenericMethodITD5() {runTest("generic method itd - 5");} // <E> ... (List<E>,List<E>) called incorrectly + public void testGenericMethodITD6() {runTest("generic method itd - 6");} // <E extends Number> ... (List<? extends E>) + public void testGenericMethodITD7() {runTest("generic method itd - 7"); } // <E> ... (List<E>,List<? extends E>) + public void testGenericMethodITD8() {runTest("generic method itd - 8"); } // <E> ... (List<E>,List<? extends E>) called incorrectly + public void testGenericMethodITD9() {runTest("generic method itd - 9"); } // <R extends Comparable<? super R>> ... (List<R>) + public void testGenericMethodITD10() {runTest("generic method itd - 10");} // <R extends Comparable<? super R>> ... (List<R>) called incorrectly + public void testGenericMethodITD11() {runTest("generic method itd - 11");} // <R extends Comparable<? extends R>> ... (List<R>) + public void testGenericMethodITD12() {runTest("generic method itd - 12");} // <R extends Comparable<? extends R>> ... (List<R>) called incorrectly + public void testGenericMethodITD13() {runTest("generic method itd - 13");} // <R extends Comparable<? extends R>> ... (List<R>) called correctly in a clever way ;) + public void testGenericMethodITD14() {runTest("generic method itd - 14");} // <R extends Comparable<? super R>> ... (List<R>) called incorrectly in a clever way + public void testGenericMethodITD15() {runTest("generic method itd - 15");} // <R extends Comparable<? super R>> ... (List<R>) called correctly in a clever way + + + + // generic ctors + public void testGenericCtorITD1() {runTest("generic ctor itd - 1");} // <T> new(List<T>) + public void testGenericCtorITD2() {runTest("generic ctor itd - 2");} // <T> new(List<T>,List<? extends T>) + public void testGenericCtorITD3() {runTest("generic ctor itd - 3");} // <T> new(List<T>,Comparator<? super T>) + + + // parameterized ITDs + public void testParameterizedMethodITD1() {runTest("parameterized method itd - 1");} // (List<? extends Super>) + public void testParameterizedMethodITD2() {runTest("parameterized method itd - 2");} // (List<? extends Number>) called incorrectly + public void testParameterizedMethodITD3() {runTest("parameterized method itd - 3");} // (List<? super A>) called incorrectly + public void testParameterizedMethodITD4() {runTest("parameterized method itd - 4");} // (List<? super B>) + + + // differing visibilities + public void testPublicITDs() {runTest("public itds");} + public void testPublicITDsErrors() {runTest("public itds with errors");} + public void testPrivateITDs() {runTest("private itds");} + public void testPackageITDs() {runTest("package itds");} + + + // targetting different types (interface/class/aspect) + public void testTargettingInterface() {runTest("targetting interface");} + public void testTargettingAspect() {runTest("targetting aspect");} + public void testTargettingClass() {runTest("targetting class");} + + + + // using a type variable from the target generic type in your ITD + public void testFieldITDsUsingTargetTypeVars1() {runTest("field itd using type variable from target type - 1");} + public void testFieldITDsUsingTargetTypeVars2() {runTest("field itd using type variable from target type - 2");} + public void testFieldITDsUsingTargetTypeVars3() {runTest("field itd using type variable from target type - 3");} + public void testFieldITDsUsingTargetTypeVars4() {runTest("field itd using type variable from target type - 4");} + public void testFieldITDsUsingTargetTypeVars5() {runTest("field itd using type variable from target type - 5");} + public void testFieldITDsUsingTargetTypeVars6() {runTest("field itd using type variable from target type - 6");} + public void testFieldITDsUsingTargetTypeVars7() {runTest("field itd using type variable from target type - 7");} + public void testFieldITDsUsingTargetTypeVars8() {runTest("field itd using type variable from target type - 8");} + public void testFieldITDsUsingTargetTypeVars9() {runTest("field itd using type variable from target type - 9");} + public void testFieldITDsUsingTargetTypeVars10(){runTest("field itd using type variable from target type -10");} + public void testFieldITDsUsingTargetTypeVars11(){runTest("field itd using type variable from target type -11");} + public void testFieldITDsUsingTargetTypeVars12(){runTest("field itd using type variable from target type -12");} + public void testFieldITDsUsingTargetTypeVars13(){runTest("field itd using type variable from target type -13");} + public void testFieldITDsUsingTargetTypeVars14(){runTest("field itd using type variable from target type -14");} + public void testFieldITDsUsingTargetTypeVars15(){runTest("field itd using type variable from target type -15");} + public void testFieldITDsUsingTargetTypeVars16(){runTest("field itd using type variable from target type -16");} + public void testFieldITDsUsingTargetTypeVars17(){runTest("field itd using type variable from target type -17");} + + + public void testMethodITDsUsingTargetTypeVarsA1() {runTest("method itd using type variable from target type - A1");} + public void testMethodITDsUsingTargetTypeVarsA2() {runTest("method itd using type variable from target type - A2");} + public void testMethodITDsUsingTargetTypeVarsA3() {runTest("method itd using type variable from target type - A3");} + public void testMethodITDsUsingTargetTypeVarsA4() {runTest("method itd using type variable from target type - A4");} + public void testMethodITDsUsingTargetTypeVarsB1() {runTest("method itd using type variable from target type - B1");} + public void testMethodITDsUsingTargetTypeVarsC1() {runTest("method itd using type variable from target type - C1");} + public void testMethodITDsUsingTargetTypeVarsD1() {runTest("method itd using type variable from target type - D1");} + public void testMethodITDsUsingTargetTypeVarsE1() {runTest("method itd using type variable from target type - E1");} + public void testMethodITDsUsingTargetTypeVarsF1() {runTest("method itd using type variable from target type - F1");} + public void testMethodITDsUsingTargetTypeVarsG1() {runTest("method itd using type variable from target type - G1");} + public void testMethodITDsUsingTargetTypeVarsH1() {runTest("method itd using type variable from target type - H1");} + public void testMethodITDsUsingTargetTypeVarsI1() {runTest("method itd using type variable from target type - I1");} + public void testMethodITDsUsingTargetTypeVarsI2() {runTest("method itd using type variable from target type - I2");} + public void testMethodITDsUsingTargetTypeVarsJ1() {runTest("method itd using type variable from target type - J1");} + public void testMethodITDsUsingTargetTypeVarsK1() {runTest("method itd using type variable from target type - K1");} + public void testMethodITDsUsingTargetTypeVarsL1() {runTest("method itd using type variable from target type - L1");} + public void testMethodITDsUsingTargetTypeVarsM1() {runTest("method itd using type variable from target type - M1");} + public void testMethodITDsUsingTargetTypeVarsM2() {runTest("method itd using type variable from target type - M2");} + public void testMethodITDsUsingTargetTypeVarsN1() {runTest("method itd using type variable from target type - N1");} + public void testMethodITDsUsingTargetTypeVarsO1() {runTest("method itd using type variable from target type - O1");} + public void testMethodITDsUsingTargetTypeVarsO2() {runTest("method itd using type variable from target type - O2");} + public void testMethodITDsUsingTargetTypeVarsP1() {runTest("method itd using type variable from target type - P1");} + public void testMethodITDsUsingTargetTypeVarsQ1() {runTest("method itd using type variable from target type - Q1");} + + public void testCtorITDsUsingTargetTypeVarsA1() {runTest("ctor itd using type variable from target type - A1");} + public void testCtorITDsUsingTargetTypeVarsB1() {runTest("ctor itd using type variable from target type - B1");} + public void testCtorITDsUsingTargetTypeVarsC1() {runTest("ctor itd using type variable from target type - C1");} + public void testCtorITDsUsingTargetTypeVarsD1() {runTest("ctor itd using type variable from target type - D1");} + public void testCtorITDsUsingTargetTypeVarsE1() {runTest("ctor itd using type variable from target type - E1");} + public void testCtorITDsUsingTargetTypeVarsF1() {runTest("ctor itd using type variable from target type - F1");} + public void testCtorITDsUsingTargetTypeVarsG1() {runTest("ctor itd using type variable from target type - G1");} + public void testCtorITDsUsingTargetTypeVarsH1() {runTest("ctor itd using type variable from target type - H1");} + public void testCtorITDsUsingTargetTypeVarsI1() {runTest("ctor itd using type variable from target type - I1");} + + public void testSophisticatedAspectsA() {runTest("uberaspects - A");} + public void testSophisticatedAspectsB() {runTest("uberaspects - B");} + public void testSophisticatedAspectsC() {runTest("uberaspects - C");} + public void testSophisticatedAspectsD() {runTest("uberaspects - D");} + public void testSophisticatedAspectsE() {runTest("uberaspects - E");} + public void testSophisticatedAspectsF() {runTest("uberaspects - F");} + public void testSophisticatedAspectsG() {runTest("uberaspects - G");} + public void testSophisticatedAspectsH() {runTest("uberaspects - H");} + public void testSophisticatedAspectsI() {runTest("uberaspects - I");} + public void testSophisticatedAspectsJ() {runTest("uberaspects - J");} + //public void testSophisticatedAspectsK() {runTest("uberaspects - K");} // FIXME asc bounds testing is tough! + public void testSophisticatedAspectsK2(){runTest("uberaspects - K2");} + public void testSophisticatedAspectsL() {runTest("uberaspects - L");} + public void testSophisticatedAspectsM() {runTest("uberaspects - M");} + public void testSophisticatedAspectsN() {runTest("uberaspects - N");} + public void testSophisticatedAspectsO() {runTest("uberaspects - O");} + public void testSophisticatedAspectsP() {runTest("uberaspects - P");} + public void testSophisticatedAspectsQ() {runTest("uberaspects - Q");} + public void testSophisticatedAspectsR() {runTest("uberaspects - R");} + public void testSophisticatedAspectsS() {runTest("uberaspects - S");} + public void testSophisticatedAspectsT() {runTest("uberaspects - T");} + public void testSophisticatedAspectsU() {runTest("uberaspects - U");} // includes nasty casts + public void testSophisticatedAspectsV() {runTest("uberaspects - V");} // casts are gone + public void testSophisticatedAspectsW() {runTest("uberaspects - W");} + public void testSophisticatedAspectsX() {runTest("uberaspects - X");} // from the AJDK + public void testSophisticatedAspectsY() {runTest("uberaspects - Y");} // pointcut matching + public void testSophisticatedAspectsZ() {runTest("uberaspects - Z");} + + // FIXME asc these two tests have peculiar error messages - generic aspect related +// public void testItdUsingTypeParameter() {runTest("itd using type parameter");} +// public void testItdIncorrectlyUsingTypeParameter() {runTest("itd incorrectly using type parameter");} + + + public void testUsingSameTypeVariable() {runTest("using same type variable in ITD");} + + public void testBinaryWeavingITDsA() {runTest("binary weaving ITDs - A");} + public void testBinaryWeavingITDsB() {runTest("binary weaving ITDs - B");} + public void testBinaryWeavingITDs1() {runTest("binary weaving ITDs - 1");} + public void testBinaryWeavingITDs2() {runTest("binary weaving ITDs - 2");} + public void testBinaryWeavingITDs3() {runTest("binary weaving ITDs - 3");} + public void testGenericITFSharingTypeVariable() {runTest("generic intertype field declaration, sharing type variable");} + + + // general tests ... usually just more complex scenarios + public void testReusingTypeVariableLetters() {runTest("reusing type variable letters");} + public void testMultipleGenericITDsInOneFile() {runTest("multiple generic itds in one file");} + public void testItdNonStaticMember() {runTest("itd of non static member");} + public void testItdStaticMember() {runTest("itd of static member");} + public void testStaticGenericMethodITD() {runTest("static generic method itd");} + + + public void testAtOverride0() {runTest("atOverride used with ITDs");} + public void testAtOverride1() {runTest("atOverride used with ITDs - 1");} + public void testAtOverride2() {runTest("atOverride used with ITDs - 2");} + public void testAtOverride3() {runTest("atOverride used with ITDs - 3");} + public void testAtOverride4() {runTest("atOverride used with ITDs - 4");} + public void testAtOverride5() {runTest("atOverride used with ITDs - 5");} + public void testAtOverride6() {runTest("atOverride used with ITDs - 6");} + public void testAtOverride7() {runTest("atOverride used with ITDs - 7");} + + + // bridge methods + public void testITDBridgeMethodsCovariance1() {runTest("bridging with covariance 1 - normal");} + public void testITDBridgeMethodsCovariance2() {runTest("bridging with covariance 1 - itd");} + public void testITDBridgeMethods1Normal() {runTest("basic bridging with type vars - 1 - normal");} + public void testITDBridgeMethods1Itd() {runTest("basic bridging with type vars - 1 - itd");} + public void testITDBridgeMethods2Normal() {runTest("basic bridging with type vars - 2 - normal");} + public void testITDBridgeMethods2Itd() {runTest("basic bridging with type vars - 2 - itd");} + public void testITDBridgeMethodsPr91381() {runTest("Abstract intertype method and covariant returns");} + + + // Just normal source compile of two types with a method override between them + public void testGenericITDsBridgeMethods1() { + runTest("bridge methods - 1"); + checkMethodsExist("Sub1",new String[]{ + "java.lang.Integer Sub1.m()", + "java.lang.Object Sub1.m() [BridgeMethod]"}); + } + // Now the same thing but the aspect (which doesn't do much!) is binary woven in. + public void testGenericITDsBridgeMethods1binary() { + runTest("bridge methods - 1 - binary"); + checkMethodsExist("Sub1",new String[]{ + "java.lang.Integer Sub1.m()", + "java.lang.Object Sub1.m() [BridgeMethod]"}); + } + // Now the method is put into the superclass via ITD - there should be a bridge method in the subclass + public void testGenericITDsBridgeMethods2() { + runTest("bridge methods - 2"); + checkMethodsExist("Sub2",new String[]{ + "java.lang.Integer Sub2.m()", + "java.lang.Object Sub2.m() [BridgeMethod]"}); + } + // Now the superclass ITD is done with binary weaving so the weaver (rather than compiler) has to create the bridge method + public void testGenericITDsBridgeMethods2binary() { + runTest("bridge methods - 2 - binary"); + checkMethodsExist("Sub2",new String[]{ + "java.lang.Integer Sub2.m()", + "java.lang.Object Sub2.m() [BridgeMethod]"}); + } + // Now the method is put into the subclass via ITD - there should be a bridge method alongside it in the subclass + public void testGenericITDsBridgeMethods3() { + runTest("bridge methods - 3"); + checkMethodsExist("Sub3",new String[]{ + "java.lang.Integer Sub3.m()", + "java.lang.Object Sub3.m() [BridgeMethod]"}); + } + // Now the subclass ITD is done with binary weaving - the weaver should create the necessary bridge method + public void testGenericITDsBridgeMethods3binary() { + runTest("bridge methods - 3 - binary"); + checkMethodsExist("Sub3",new String[]{ + "java.lang.Integer Sub3.m()", + "java.lang.Object Sub3.m() [BridgeMethod]"}); + } + // Now the two types are disconnected until the aspect supplies a declare parents relationship - + // the bridge method should still be created in the subtype + public void testGenericITDSBridgeMethods4() { + runTest("bridge methods - 4"); + checkMethodsExist("Sub4",new String[]{ + "java.lang.Integer Sub4.m()", + "java.lang.Object Sub4.m() [BridgeMethod]"}); + } + // now the aspect doing the decp between the types is applied via binary weaving - weaver should create the bridge method + public void testGenericITDSBridgeMethods4binary() { + runTest("bridge methods - 4 - binary"); + checkMethodsExist("Sub4",new String[]{ + "java.lang.Integer Sub4.m()", + "java.lang.Object Sub4.m() [BridgeMethod]"}); + } + + public void testBinaryBridgeMethodsOne() { + runTest("binary bridge methods - one"); + checkMethodsExist("OneB",new String[]{ + "java.lang.Number OneB.firstMethod() [BridgeMethod]", + "java.lang.Integer OneB.firstMethod()", + "void OneB.secondMethod(java.lang.Number) [BridgeMethod]", + "void OneB.secondMethod(java.lang.Integer)", + "void OneB.thirdMethod(java.lang.Number,java.lang.Number) [BridgeMethod]", + "void OneB.thirdMethod(java.lang.Integer,java.lang.Integer)", + "void OneB.fourthMethod(java.util.List)", + "java.lang.Number OneB.fifthMethod(java.lang.Number,java.util.List) [BridgeMethod]", + "java.lang.Integer OneB.fifthMethod(java.lang.Integer,java.util.List)" + }); + } + public void testBinaryBridgeMethodsTwo() { + runTest("binary bridge methods - two"); + checkMethodsExist("TwoB",new String[]{ + "java.lang.Number TwoB.firstMethod(java.io.Serializable) [BridgeMethod]", + "java.lang.Integer TwoB.firstMethod(java.lang.String)" + }); + } + public void testBinaryBridgeMethodsThree() { + runTest("binary bridge methods - three"); + checkMethodsExist("ThreeB",new String[]{ + "java.lang.Number ThreeB.m() [BridgeMethod]", + "java.lang.Double ThreeB.m()" + }); + } + + + public void testGenericITDsBridgeMethodsPR91381() {runTest("abstract intertype methods and covariant returns");} + public void testGenericITDsBridgeMethodsPR91381_2() {runTest("abstract intertype methods and covariant returns - error");} + + // ---------------------------------------------------------------------------------------- + // generic declare parents tests + // ---------------------------------------------------------------------------------------- + + public void testPR96220_GenericDecp() { + runTest("generic decp - simple"); + checkOneSignatureAttribute(ajc,"Basic"); + verifyClassSignature(ajc,"Basic","Ljava/lang/Object;LJ<Ljava/lang/Double;>;LI<Ljava/lang/Double;>;"); + } + + // Both the existing type decl and the one adding via decp are parameterized + public void testGenericDecpMultipleVariantsOfAParameterizedType1() { + runTest("generic decp - implementing two variants #1"); + } + + // Existing type decl is raw and the one added via decp is parameterized + public void testGenericDecpMultipleVariantsOfAParameterizedType2() { + runTest("generic decp - implementing two variants #2"); + } + + // Existing type decl is parameterized and the one added via decp is raw + public void testGenericDecpMultipleVariantsOfAParameterizedType3() { + runTest("generic decp - implementing two variants #3"); + } + + // decp is parameterized but it does match the one already on the type + public void testGenericDecpMultipleVariantsOfAParameterizedType4() { + runTest("generic decp - implementing two variants #4"); + } + + // same as above four tests for binary weaving + public void testGenericDecpMultipleVariantsOfAParameterizedType1_binaryWeaving() { + runTest("generic decp binary - implementing two variants #1"); + } + + public void testGenericDecpMultipleVariantsOfAParameterizedType2_binaryWeaving() { + runTest("generic decp binary - implementing two variants #2"); + } + + // Existing type decl is parameterized and the one added via decp is raw + public void testGenericDecpMultipleVariantsOfAParameterizedType3_binaryWeaving() { + runTest("generic decp binary - implementing two variants #3"); + } + + // decp is parameterized but it does match the one already on the type + public void testGenericDecpMultipleVariantsOfAParameterizedType4_binaryWeaving() { + runTest("generic decp binary - implementing two variants #4"); + } + + public void testGenericDecpParameterized() { + runTest("generic decp - with parameterized on the target"); + checkOneSignatureAttribute(ajc,"Basic6"); + verifyClassSignature(ajc,"Basic6","<J:Ljava/lang/Object;>Ljava/lang/Object;LI<TJ;>;LK<Ljava/lang/Integer;>;"); + } + + public void testGenericDecpIncorrectNumberOfTypeParams() { + runTest("generic decp - incorrect number of type parameters"); + } + + public void testGenericDecpSpecifyingBounds() { + runTest("generic decp - specifying bounds"); + } + + public void testGenericDecpViolatingBounds() { + runTest("generic decp - specifying bounds but breaking them"); + } + + // need separate compilation test to verify signatures are ok +// +// public void testIllegalGenericDecp() { +// runTest("illegal generic decp"); +// } +// +// public void testPR95992_TypeResolvingProblemWithGenerics() { +// runTest("Problems resolving type name inside generic class"); +// } + + + // -- Pointcut tests... + + public void testHandlerWithGenerics() { + runTest("handler pcd and generics / type vars"); + } + + public void testPointcutsThatDontAllowTypeVars() { + runTest("pointcuts that dont allow type vars"); + } + + public void testParameterizedTypesInAtPCDs() { + runTest("annotation pcds with parameterized types"); + } + + public void testAnnotationPatternsWithParameterizedTypes() { + runTest("annotation patterns with parameterized types"); + } + + public void testStaticInitializationWithParameterizedTypes() { + runTest("staticinitialization and parameterized types"); + } + + // no longer a valid test with generics simplication +// public void testStaticInitializationMatchingWithParameterizedTypes() { +// runTest("staticinitialization and parameterized type matching"); +// } + +// no longer a valid test in simplified design +// public void testStaticInitializationWithGenericTypes() { +// runTest("staticinitialization with generic types"); +// } + +// no longer a valid test in simplified design +// public void testStaticInitializationWithGenericTypesAdvanced() { +// runTest("staticinitialization with generic types - advanced"); +// } + + public void testWithinPointcutErrors() { + runTest("within pcd with various parameterizations and generic types - errors"); + } + + public void testWithinPointcutWarnings() { + runTest("within pcd with various parameterizations and generic types - warnings"); + } + + public void testThisTargetPointcutErrors() { + runTest("this and target with various parameterizations and generic types - errors"); + } + + public void testThisTargetPointcutRuntime() { + runTest("this and target with various parameterizations and generic types - runtime"); + } + + public void testInitAndPreInitPointcutErrors() { + runTest("init and preinit with parameterized declaring types"); + } + + public void testInitAndPreInitPointcutMatchingWithGenericDeclaringTypes() { + runTest("init and preinit with raw declaring type pattern"); + } + + public void testInitAndPreInitPointcutMatchingWithParameterizedParameterTypes() { + runTest("init and preinit with parameterized parameter types"); + } + + public void testWithinCodePointcutErrors() { + runTest("withincode with various parameterizations and generic types - errors"); + } + + public void testWithinCodeMatching() { + runTest("withincode with various parameterizations and generic types - matching"); + } + + public void testWithinCodeOverrideMatchingWithGenericMembers() { + runTest("withincode with overriding of inherited generic members"); + } + + public void testExecutionWithRawType() { + runTest("execution pcd with raw type matching"); + } + + public void testExecutionWithRawSignature() { + runTest("execution pcd with raw signature matching"); + } + + public void testExecutionPointcutErrors() { + runTest("execution with various parameterizations and generic types - errors"); + } + + public void testExecutionMatching() { + runTest("execution with various parameterizations and generic types - matching"); + } + + public void testExecutionOverrideMatchingWithGenericMembers() { + runTest("execution with overriding of inherited generic members"); + } + + public void testCallPointcutErrors() { + runTest("call with various parameterizations and generic types - errors"); + } + + public void testCallMatching() { + runTest("call with various parameterizations and generic types - matching"); + } + + public void testCallOverrideMatchingWithGenericMembers() { + runTest("call with overriding of inherited generic members"); + } + + public void testCallWithBridgeMethods() { + runTest("call with bridge methods"); + } + + public void testGetAndSetPointcutErrors() { + runTest("get and set with various parameterizations and generic types - errors"); + } + + public void testGetAndSetPointcutMatchingWithGenericAndParameterizedTypes() { + runTest("get and set with various parameterizations and generic declaring types"); + } + + public void testGetAndSetPointcutMatchingWithGenericAndParameterizedFieldTypes() { + runTest("get and set with various parameterizations and generic field types"); + } + + public void testArgsWithRawType() { + runTest("args with raw type and generic / parameterized sigs"); + } + + public void testArgsParameterizedType() { + runTest("args with parameterized type and generic / parameterized sigs"); + } + + public void testArgsParameterizedAndWildcards() { + runTest("args with parameterized type and wildcards"); + } + + public void testArgsWithWildcardVar() { + runTest("args with generic wildcard"); + } + + public void testArgsWithWildcardExtendsVar() { + runTest("args with generic wildcard extends"); + } + + public void testArgsWithWildcardSuperVar() { + runTest("args with generic wildcard super"); + } + + public void testGenericMethodMatching() { + runTest("generic method matching"); + } + + public void testGenericWildcardsInSignatureMatching() { + runTest("generic wildcards in signature matching"); + } + + public void testAfterThrowing() { + runTest("after throwing with parameterized throw type"); + } + + public void testAfterReturningWithRawType() { + runTest("after returning with raw type and generic / parameterized sigs"); + } + + public void testAfterReturningParameterizedType() { + runTest("after returning with parameterized type and generic / parameterized sigs"); + } + + public void testAfterReturningParameterizedAndWildcards() { + runTest("after returning with parameterized type and wildcards"); + } + + public void testAfterReturningWithWildcardVar() { + if (LangUtil.is19VMOrGreater()) { + // See ReferenceType.isCoerceableFrom comments + return; + } + // Something to investigate here. The implementation of isCoerceable + runTest("after returning with generic wildcard"); + } + + public void testAfterReturningWithWildcardExtendsVar() { + runTest("after returning with generic wildcard extends"); + } + + public void testAfterReturningWithWildcardSuperVar() { + runTest("after returning with generic wildcard super"); + } + + public void testAJDKErasureMatchingExamples() { + runTest("ajdk notebook: erasure matching examples"); + } + + public void testAJDKParameterizedMatchingSimpleExamples() { + runTest("ajdk notebook: simple parameterized type matching examples"); + } + + public void testAJDKMixedTypeVarsAndParametersExample() { + runTest("ajdk notebook: mixed parameterized types and generic methods"); + } + + public void testAJDKSignatureAndWildcardExamples() { + runTest("ajdk notebook: signature matching with generic wildcards"); + } + + // had to remove at e37 level - although pointcuts are likely to work, we can't compile the code + // that invokes the bridge methods - seems the compiler is too smart and won't let them through. +// public void testAJDKBridgeMethodExamples() { +// runTest("ajdk notebook: bridge method examples"); +// } + + public void testAJDKArgsExamples() { + runTest("ajdk notebook: args examples"); + } + + public void testAJDKArgsAndWildcardsExamples() { + runTest("ajdk notebook: args and wildcards examples"); + } + + public void testAJDKAfterReturningExamples() { + runTest("ajdk notebook: after returning examples"); + } + + public void testAJDKPointcutInGenericClassExample() { + runTest("ajdk notebook: pointcut in generic class example"); + } + + // TESTS for generic abstract aspects that get extended and parameterized... + + public void testStaticPointcutParameterization() { + runTest("static pointcut parameterization suite"); + } + + public void testDynamicPointcutParameterization() { + runTest("dynamic pointcut parameterization suite"); + } + + public void testReferenceToPointcutInGenericClass() { + runTest("reference to pointcut in generic class"); + } + + public void testReferenceToPointcutInGenericClass2() { + runTest("reference to non-parameterized pointcut in generic class"); + } + + public void testDeclareParentsParameterized() { + runTest("declare parents parameterized"); + } + + public void testDeclarePrecedenceParameterized() { + runTest("declare precedence parameterized"); + } + + public void testDeclareAnnotationParameterized() { + runTest("declare annotation parameterized"); + } + + public void testMultiLevelGenericAspects() { + runTest("multi-level generic abstract aspects"); + } + + // --- helpers + + /** + * When a class has been written to the sandbox directory, you can ask this method to + * verify it contains a particular set of methods. Typically this is used to verify that + * bridge methods have been created. + */ + public void checkMethodsExist(String classname,String[] methods) { + Set<String> methodsFound = new HashSet<>(); + StringBuffer debugString = new StringBuffer(); + try { + ClassLoader cl = new URLClassLoader(new URL[]{ajc.getSandboxDirectory().toURL()}); + Class<?> clz = Class.forName(classname,false,cl); + java.lang.reflect.Method[] ms = clz.getDeclaredMethods(); + if (ms!=null) { + for (int i =0;i<ms.length;i++) { + String methodString = ms[i].getReturnType().getName()+" "+ms[i].getDeclaringClass().getName()+"."+ + ms[i].getName()+"("+stringify(ms[i].getParameterTypes())+")"+ + (isBridge(ms[i])?" [BridgeMethod]":""); + methodsFound.add(methodString); + debugString.append("\n[").append(methodString).append("]"); + } + } + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + + // check the methods specified do exist + for (int i = 0; i < methods.length; i++) { + String string = methods[i]; + if (!methodsFound.remove(string)) { + fail("Couldn't find ["+string+"] in the set of methods in "+classname+" => "+debugString); + } + } + StringBuffer unexpectedMethods = new StringBuffer(); + if (!methodsFound.isEmpty()) { + for (String element: methodsFound) { + unexpectedMethods.append("[").append(element).append("]"); + } + fail("These methods weren't expected: "+unexpectedMethods); + } + + } + + /** + * Use 1.5 API isBridge if available. + * See JLS3 15.12.4.5 Create Frame, Synchronize, Transfer Control + */ + public static boolean isBridge(java.lang.reflect.Method m) { + // why not importing java.lang.reflect.Method? No BCEL clash? + if (!LangUtil.is15VMOrGreater()) { + return false; + } + try { + final Class<?>[] noparms = new Class[0]; + java.lang.reflect.Method isBridge + = java.lang.reflect.Method.class.getMethod("isBridge", noparms); + Boolean result = (Boolean) isBridge.invoke(m, new Object[0]); + return result.booleanValue(); + } catch (Throwable t) { + return false; + } + } + public static JavaClass getClass(Ajc ajc, String classname) { + try { + ClassPath cp = + new ClassPath(ajc.getSandboxDirectory() + File.pathSeparator + System.getProperty("java.class.path")); + SyntheticRepository sRepos = SyntheticRepository.getInstance(cp); + JavaClass clazz = sRepos.loadClass(classname); + return clazz; + } catch (ClassNotFoundException e) { + fail("Couldn't find class "+classname+" in the sandbox directory."); + } + return null; + } + + public static Signature getClassSignature(Ajc ajc,String classname) { + JavaClass clazz = getClass(ajc,classname); + Signature sigAttr = null; + Attribute[] attrs = clazz.getAttributes(); + for (int i = 0; i < attrs.length; i++) { + Attribute attribute = attrs[i]; + if (attribute.getName().equals("Signature")) sigAttr = (Signature)attribute; + } + return sigAttr; + } + + public static void checkOneSignatureAttribute(Ajc ajc,String classname) { + JavaClass clazz = getClass(ajc,classname); + Attribute[] attrs = clazz.getAttributes(); + int signatureCount = 0; + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < attrs.length; i++) { + Attribute attribute = attrs[i]; + if (attribute.getName().equals("Signature")) { + signatureCount++; + sb.append("\n"+((Signature)attribute).getSignature()); + } + } + if (signatureCount>1) fail("Should be only one signature attribute but found "+signatureCount+sb.toString()); + } + + // Check the signature attribute on a class is correct + public static void verifyClassSignature(Ajc ajc,String classname,String sig) { + Signature sigAttr = getClassSignature(ajc,classname); + assertTrue("Failed to find signature attribute for class "+classname,sigAttr!=null); + assertTrue("Expected signature to be '"+sig+"' but was '"+sigAttr.getSignature()+"'", + sigAttr.getSignature().equals(sig)); + } + + private static String stringify(Class<?>[] clazzes) { + if (clazzes==null) return ""; + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < clazzes.length; i++) { + if (i>0) sb.append(","); + sb.append(clazzes[i].getName()); + } + return sb.toString(); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/HasMember.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/HasMember.java new file mode 100644 index 000000000..57e053b9b --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/HasMember.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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: + * Adrian Colyer - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class HasMember extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(HasMember.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + public void testSimpleDecPHasMethod() { + runTest("declare parents : hasmethod(..) - 1"); + } + + public void testSimpleDecPHasMethodInherited() { + runTest("declare parents : hasmethod(..) - 2"); + } + + public void testSimpleDecPHasMethodInheritedPrivate() { + runTest("declare parents : hasmethod(..) - 3"); + } + + // this test not passing yet, ITD integration not implemented +// public void testDecPHasMethodViaITD() { +// runTest("declare parents : hasmethod(..) - 4"); +// } + + public void testSimpleDecPHasField() { + runTest("declare parents : hasfield(..) - 1"); + } + + public void testSimpleDecPHasFieldInherited() { + runTest("declare parents : hasfield(..) - 2"); + } + + public void testSimpleDecPHasFieldInheritedPrivate() { + runTest("declare parents : hasfield(..) - 3"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/MigrationTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/MigrationTests.java new file mode 100644 index 000000000..a9322b086 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/MigrationTests.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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 - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + + +/** + * Checks if we are obeying migration rules. + */ +public class MigrationTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(MigrationTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + /** + * Compile a simple java class with an aspect library built with aspectj 1.2.1 - this + * checks that we can load in attributes (especially pointcuts) that were written out + * in the 'old way' + * + */ + public void testMigrationFrom121_pointcutsAndAdvice() { + runTest("load aspectj 1.2.1 aspects in aspectj 5"); +// CompilationResult cR = ajc(baseDir,new String[]{"-aspectpath","aspects121.jar","Program.java"}); +// System.err.println(cR.getStandardError()); +// assertTrue("Should not coredump: "+cR.getStandardError(),cR.getStandardError().indexOf("Dumping to ajcore")==-1); +// assertTrue("Should be no error messages: \n"+cR.getErrorMessages(),cR.getErrorMessages().size()==0); +// File f = new File(ajc.getSandboxDirectory()+File.separator+"Program.class"); +// assertTrue("Missing class file",f.exists()); +// run("Program"); + } + +// /** +// * We cannot support all aspects built prior to AspectJ 1.2.1 - so we don't support any. +// * There are probably many reasons but the first one I've hit is: +// * - Changes for cflow optimizations (counters instead of stacks where we can) mean that an aspect +// * compiled at AspectJ1.2.0 will contain stack cases but AspectJ1.5.0 will look for counter +// * fields in some cases. +// * +// * This means we should get a reasonable failure message in this case. +// */ +// public void testMigrationFrom120_pointcutsAndAdvice() { +// CompilationResult cR = ajc(baseDir,new String[]{"-aspectpath","aspects120.jar","Program.java"}); +// assertTrue("Should have failed",cR.getFailMessages().size()>0); +// assertTrue("Should have produced nice message",cR.getFailMessages().get(0).toString().indexOf("Unable to continue")!=-1); +// } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/PerTypeWithinTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/PerTypeWithinTests.java new file mode 100644 index 000000000..84b014392 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/PerTypeWithinTests.java @@ -0,0 +1,104 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM + * 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 - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.tools.ajc.CompilationResult; + + + +public class PerTypeWithinTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(PerTypeWithinTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + /** + * First few tests: + * + * Five types p.A, p.B, p.C, q.D, q.E and an aspect a.X. + * + * The aspect is pertypewithin(p..*) - this should match A,B,C but not D,E. + * + * Aspect instances should be accessible for A,B,C but not D,E. + * The aspect instances for A,B,C should be different. + * + * hasAspect(), aspectOf() should work. + * + * We test these assumptions in A,B,C,D,E. + */ + public void testDoesItWorkAtAll() { + runTest("basic ptw test"); + } + + public void testCheckHasAspectWorks() { + runTest("ptw hasAspect"); + } + + public void testCheckAspectOfWorks() { + runTest("ptw aspectOf"); + } + /** + * Aspects Q and R match P with a pertypewithin() - they shouldn't clash in any way + * + */ + public void testTwoAspectsHittingOneType() { + runTest("ptw multi-aspects"); + } + + /** + * Checks the use of pertypewithin() doesn't result in extra join points (i.e. the + * infrastructure is properly hidden in ajc$ or synthetic members) + */ + public void testPervasivenessOfWeaving() { + CompilationResult cR = ajc(new File("../tests/java5/pertypewithin"),new String[]{"U.java","-showWeaveInfo"}); + int weavingMessagesFromNormalDeploymentModel = cR.getWeaveMessages().size(); + + cR = ajc(new File("../tests/java5/pertypewithin"),new String[]{"V.java","-showWeaveInfo"}); + int weavingMessagesFromPerTypeWithin = cR.getWeaveMessages().size(); + + assertEquals("Expected same number of messages regardless of perclause", + weavingMessagesFromNormalDeploymentModel,weavingMessagesFromPerTypeWithin); + } + + + public void testBinaryWeaving_ClassesAreBinary() { + runTest("ptw binary"); + } + + public void testBinaryWeaving_AspectsAreBinary() { + runTest("ptw binary aspect"); + } + + public void testAJDKExamples() { + runTest("ajdk: ptw"); + } +// // Compile the aspect H.java into classes3 +// CompilationResult cR = ajc(new File("../tests/java5/pertypewithin"),new String[]{"H.java","-outjar","aspects.jar"}); +// setShouldEmptySandbox(false); +// // Compile the class with H.class as aspectpath, should be binary woven correctly +// cR = ajc(new File("../tests/java5/pertypewithin"),new String[]{"G.java","-aspectpath","aspects.jar"}); +// RunResult rR = run("G"); +// assertTrue("Expected aspect related message 'advice running' in output from G", +// rR.getStdErr().indexOf("advice running")!=-1); +// setShouldEmptySandbox(true); +// } +// +// // binary weaving case ... +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/RuntimeAnnotations.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/RuntimeAnnotations.java new file mode 100644 index 000000000..676c2b014 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/RuntimeAnnotations.java @@ -0,0 +1,138 @@ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * Checking that runtime visible annotations are visible at runtime (they get into the class file) + */ +public class RuntimeAnnotations extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(RuntimeAnnotations.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + public void test01() { + runTest("public method with declare @method"); + } + + public void test02() { + runTest("public method on the aspect that declares @method on it"); + } + + public void test03() { + runTest("public annotated method"); + } + + public void test04() { + runTest("public ITD method with declare @method"); + } + + public void test05() { + runTest("public annotated ITD method"); + } + + public void test06() { + runTest("public ITD-on-itself method with declare @method"); + } + + public void test07() { + runTest("public annotated ITD-on-itself method"); + } + + public void test08() { + runTest("public method on an Interface with declare @method"); + } + + public void test09() { + runTest("public annotated method on an Interface"); + } + + public void test10() { + runTest("public ITD method onto an Interface with declare @method"); + } + + public void test11() { + runTest("public annotated ITD method onto an Interface"); + } + + public void test12() { + runTest("public abstract method with declare @method"); + } + + public void test13() { + runTest("public abstract method on the aspect that declares @method on it"); + } + + public void test14() { + runTest("public abstract annotated method"); + } + + public void test15() { + runTest("public abstract ITD method with declare @method"); + } + + public void test16() { + runTest("public abstract annotated ITD method"); + } + + public void test17() { + runTest("public abstract ITD-on-itself method with declare @method"); + } + + public void test18() { + runTest("public abstract annotated ITD-on-itself method"); + } + + public void test19() { + runTest("public abstract method on an Interface with declare @method"); + } + + public void test20() { + runTest("public abstract annotated method on an Interface"); + } + + public void test21() { + runTest("public abstract ITD method onto an Interface with declare @method"); + } + + public void test22() { + runTest("public abstract annotated ITD method onto an Interface"); + } + + public void test23() { + runTest("public field with declare @field"); + } + + public void test24() { + runTest("public field on the aspect that declares @field on it"); + } + + public void test25() { + runTest("public annotated field"); + } + + public void test26() { + runTest("public ITD field with declare @field"); + } + + public void test27() { + runTest("public annotated ITD field"); + } + + public void test28() { + runTest("public ITD-on-itself field with declare @field"); + } + + public void test29() { + runTest("public annotated ITD-on-itself field"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/SCCSFixTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/SCCSFixTests.java new file mode 100644 index 000000000..30dba129f --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/SCCSFixTests.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM Corporation and others. + * 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: + * Wes Isberg - initial implementation + *******************************************************************************/ + +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import org.aspectj.tools.ajc.AjcTestCase; +import org.aspectj.tools.ajc.CompilationResult; +import org.aspectj.util.FileUtil; + +/** + * SCCS/CVS directory fix. + * Would add to Ajc150TestsNoHarness, but can't share basedir/setup, etc. + */ +public class SCCSFixTests extends AjcTestCase { + File baseDir; + File sourceroot; + + public void setUp() throws Exception { + super.setUp(); + baseDir = FileUtil.getTempDir("BugFixTests"); + sourceroot = new File(baseDir, "sourceroot"); + sourceroot.mkdirs(); + } + public void tearDown() { + FileUtil.deleteContents(baseDir); + } + /** + * @see org/aspectj/util/FileUtil.java 1.17 + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=48650 + */ + public void testSkipCVS() { + doTestSkip("CVS"); + } + + /** + * @see org/aspectj/util/FileUtil.java 1.17 + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=48650 + */ + public void testSkipSCCS() { + doTestSkip("SCCS"); + } + + /** + * Can't check in "CVS" or "SCCS" directories, + * so construct for each test. + */ + private void doTestSkip(String name) { + File dir = new File(sourceroot, name); + sourceroot.mkdirs(); + File file = new File(dir, "Error.java"); + FileUtil.writeAsString(file, "public class Error { here }"); + file = new File(sourceroot, "Main.java"); + FileUtil.writeAsString(file, MAIN); + String[] args = { "-sourceroots", sourceroot.getPath() }; + CompilationResult result = ajc(baseDir, args); + assertNoMessages(result); + RunResult r = run("Main"); + String m = r.getStdOut().trim(); + assertEquals("I ran", m); + } + private static final String MAIN = + "public class Main { public static void main(String[] a) {System.out.println(\"I ran\");}}"; +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/StaticImports.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/StaticImports.java new file mode 100644 index 000000000..71b82f4e4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/StaticImports.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2005 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: + * Andrew Huff - initial implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class StaticImports extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(StaticImports.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + public void testImportStaticSystemDotOut() { + runTest("import static java.lang.System.out"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/SuppressedWarnings.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/SuppressedWarnings.java new file mode 100644 index 000000000..0a830018e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/SuppressedWarnings.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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 - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class SuppressedWarnings extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SuppressedWarnings.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + // Check basic suppression + public void testSuppression1() { + runTest("suppressing non-matching advice warnings"); + } + + // Checks source contexts aren't put out incorrectly + // NOTE: Source contexts only come out if the primary source location in a message + // matches the file currently being dealt with. Because advice not matching + // messages come out at the last stage of compilation, you currently only + // get sourcecontext for advice not matching messages that point to places in + // the last file being processed. You do get source locations in all cases - + // you just don't always get context, we could revisit this sometime... + // (see bug 62073 reference in WeaverMessageHandler.handleMessage()) + public void testSuppression2() { + runTest("suppressing non-matching advice warnings when multiple source files involved"); + } + + public void testSuppressionWithCflow_pr93345() { + runTest("XLint warning for advice not applied with cflow(execution)"); + } + + public void testSuppressionOfMessagesIssuedDuringMatching() { + runTest("SuppressAjWarnings raised during matching"); + } +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/VarargsTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/VarargsTests.java new file mode 100644 index 000000000..7592f7c6d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/VarargsTests.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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 - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + + +/** + * Varargs, the rules/tests: + * + * 1. cannot match on a varargs method by using 'Object[]' in your signature, + * this affects call/execution/initialization/withincode + */ +public class VarargsTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(VarargsTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + // check when signature is from a call PCD + // should get message: + // "an array type as the last parameter in a signature does not match on the varargs declared method: <blah>" + public void test001_cantMatchVarargsWithObjectArray_callPCD() { + runTest("varargs not matched by Object[] (call)"); + } + + // check when signature is from an execution PCD + public void test002_cantMatchVarargsWithObjectArray_execPCD() { + runTest("varargs not matched by Object[] (exe)"); + } + + // check when signature is from an initialization PCD + public void test003_cantMatchVarargsWithObjectArray_initPCD() { + runTest("varargs not matched by Object[] (init)"); + } + + // check when signature is from an withincode PCD + public void test003_cantMatchVarargsWithObjectArray_withincodePCD() { + runTest("varargs not matched by Object[] (withincode)"); + } + + // before(): call(* *(Integer...)) { } + public void test_usingVarargsInPointcuts1() { + runTest("call with varargs signature"); + } + + // before(): call(* *(int,Integer...)) { } - slightly more complex pcut + public void test_usingVarargsInPointcuts2() { + runTest("call with varargs multi-signature"); + } + + public void testAJDKExamples() { + runTest("ajdk: varargs"); + } + + public void testStarVarargs() { + runTest("star varargs pattern"); + } + + public void testVarargsWithDotDotInPointcut() { + runTest("Varargs with .. in pointcut"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ajc150.xml new file mode 100644 index 000000000..9eda00b0c --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ajc150.xml @@ -0,0 +1,6308 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.0 Tests --> +<suite> + + <ajc-test dir="bugs150" title="abstract perthis in @AspectJ"> + <compile files="pr121197.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="different numbers of type vars"> + <compile files="pr121575.aj" options="-1.5"/> + <run class="pr121575"/> + </ajc-test> + + + <ajc-test dir="bugs150/pr121385" title="mixing aspect styles"> + <compile files="A.java" options="-1.5"/> + <run class="A"/> + </ajc-test> + + <ajc-test dir="java5/generics/tvars" title="different numbers of type vars - 2"> + <compile files="Case1.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void MyClass.read(java.lang.String))' in Type 'MyClass' (Case1.aj:13) advised by before advice from 'MyAspect' (Case1.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/tvars" title="different numbers of type vars - 3"> + <compile files="Case2.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void MyClass.read(java.lang.Number))' in Type 'MyClass' (Case2.aj:13) advised by before advice from 'MyAspect' (Case2.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/tvars" title="different numbers of type vars - 4"> + <compile files="Case3.aj" options="-1.5 -showWeaveInfo"> + <message kind="error" line="9" text="The type MyClass<T,E> must implement the inherited abstract method MyInterface<T>.read(T)"/> + </compile> + </ajc-test> + + + <ajc-test dir="bugs150" title="access to private ITD from nested type"> + <compile files="pr118698.aj"/> + <run class="pr118698"/> + </ajc-test> + + <ajc-test dir="bugs150" title="modifier overrides"> + <compile files="pr119749.aj" options="-1.5"> + <message kind="warning" line="26" text="C E.*()"/> + <message kind="warning" line="25" text="D E.*()"/> + <message kind="warning" line="17" text="aa @Me void m()"/> + <message kind="warning" line="17" text="aa void m() throws Exception"/> + <message kind="warning" line="17" text="aa * *(..) throws Exception"/> + <message kind="warning" line="37" text="aa call void m() throws Exception"/> + <message kind="warning" line="38" text="aa call void m() throws Exception"/> + </compile> + <run class="pr119749"> + <stdout> + <line text="execution(void pr119749.C.m()): execMe[Me]"/> + <line text="execution(void pr119749.C.m()): execEx"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr120826" pr="120826" title="varargs NPE"> + <compile files="TestVarargs.java" options="-1.5"/> + </ajc-test> + + + <ajc-test dir="bugs150/pr112476/case1" title="binary weaving decp broken"> + <compile files="lib/A.java,lib/B.java,lib/C.java" outjar="library.jar" options="-1.5"/> + <!-- library.jar on the aspectpath here just for resolution when compiling SuperC --> + <compile aspectpath="library.jar" files="weaved/SuperC.java" outjar="newsuper.jar" options="-1.5"/> + <compile inpath="library.jar;newsuper.jar" files="weaved/DeclareAspect.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Setting superclass of type 'lib.C' (C.java) to 'weaved.SuperC' (DeclareAspect.aj)"/> + </compile> + <run class="weaved.SuperC"> + <stdout> + <line text="Is [class lib.C] subcass of [class weaved.SuperC]? true"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr114005" title="Annotated ITDFs - 1"> + <compile files="Declaration1.java" options="-1.5"/> + <run class="Declaration1"> + <stdout> + <line text="public java.lang.String Test.firstProperty has annotation:true"/> + <line text="public java.lang.String Test.secondProperty has annotation:true"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="114495" title="parameterized pointcut and advice"> + <compile files="Pr114495.aj" options="-1.5"> + <message kind="warning" line="3" text="going()"/> + </compile> + <run class="Pr114495"> + <stdout> + <line text="A.going()"/> + <line text="AA.going()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="112880" title="double parameter generic abstract type"> + <compile files="Pr112880.aj" options="-1.5"> + </compile> + <run class="Pr112880"> + <stdout> + <line text="method returning C1 or C2"/> + <line text="method returning C1 or C2"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr114005" title="Annotated ITDFs - 2"> + <compile files="Declaration2.java" options="-1.5"/> + <run class="Declaration2"> + <stdout> + <line text="public java.lang.String Test.firstProperty has annotation:true"/> + <line text="public java.lang.String Test.secondProperty has annotation:true"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="114054" title="pertarget and negated pointcut"> + <compile files="Pr114054.aj" options=""/> + <run class="Pr114054"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="121385" title="mixing styles"> + <compile files="pr121385.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 1"> + <compile files="Basic1.java" options="-1.5"/> + <run class="Basic1"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 1b"> + <compile files="Basic1b.java" options="-1.5"/> + <run class="Basic1b"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 2"> + <compile files="Basic2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void X$I.m2())' in Type 'X' (Basic2.java:15) advised by before advice from 'X' (Basic2.java:23)"/> + <message kind="weave" text="Type 'X$I' (Basic2.java) has intertyped method from 'X' (Basic2.java:'void X$I.m2()')"/> + <message kind="weave" text="Extending interface set for type 'Basic2' (Basic2.java) to include 'X$I' (Basic2.java)"/> + <message kind="weave" text="Type 'Basic2' (Basic2.java) has intertyped method from 'X' (Basic2.java:'void X$I.m2()')"/> + <message kind="weave" text="Join point 'method-execution(void Basic2.main(java.lang.String[]))' in Type 'Basic2' (Basic2.java:2) advised by before advice from 'X' (Basic2.java:23)"/> + </compile> + <run class="Basic2"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 2b"> + <compile files="Basic2b.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void X$IIimpl.m2())' in Type 'X$IIimpl' (Basic2b.java:18) advised by before advice from 'X' (Basic2b.java:27)"/> + <message kind="weave" text="Extending interface set for type 'Basic2b' (Basic2b.java) to include 'X$I' (Basic2b.java)"/> + <message kind="weave" text="Join point 'method-execution(void Basic2b.main(java.lang.String[]))' in Type 'Basic2b' (Basic2b.java:4) advised by before advice from 'X' (Basic2b.java:27)"/> + </compile> + <run class="Basic2b"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 3"> + <compile files="Basic3.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Basic3' (Basic3.java) to include 'X$I' (Basic3.java)"/> + <message kind="weave" text="Type 'Basic3' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m2()')"/> + <message kind="weave" text="Type 'Basic3' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m3()')"/> + <message kind="weave" text="Type 'Basic3' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m4()')"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3' (Basic3.java:7) advised by before advice from 'X' (Basic3.java:29)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m3())' in Type 'Basic3' (Basic3.java:8) advised by before advice from 'X' (Basic3.java:29)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3' (Basic3.java:9) advised by before advice from 'X' (Basic3.java:29)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m4())' in Type 'Basic3' (Basic3.java:10) advised by before advice from 'X' (Basic3.java:29)"/> + <message kind="weave" text="Type 'X$I' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m2()')"/> + <message kind="weave" text="Type 'X$I' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m3()')"/> + <message kind="weave" text="Type 'X$I' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m4()')"/> + </compile> + <run class="Basic3"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 3b"> + <compile files="Basic3b.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Basic3b' (Basic3b.java) to include 'X$I' (Basic3b.java)"/> + <message kind="weave" text="Type 'Basic3b' (Basic3b.java) has intertyped method from 'X' (Basic3b.java:'void X$I.m2()')"/> + <message kind="weave" text="Type 'Basic3b' (Basic3b.java) has intertyped method from 'X' (Basic3b.java:'void X$I.m3()')"/> + <message kind="weave" text="Type 'Basic3b' (Basic3b.java) has intertyped method from 'X' (Basic3b.java:'void X$I.m4()')"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3b' (Basic3b.java:7) advised by before advice from 'X' (Basic3b.java:35)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m3())' in Type 'Basic3b' (Basic3b.java:8) advised by before advice from 'X' (Basic3b.java:35)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3b' (Basic3b.java:9) advised by before advice from 'X' (Basic3b.java:35)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m4())' in Type 'Basic3b' (Basic3b.java:10) advised by before advice from 'X' (Basic3b.java:35)"/> + </compile> + <run class="Basic3b"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 3c"> + <compile files="Basic3c.java" options="-1.5"> + <message kind="error" text="@DeclareParents: defaultImpl="X$IImpl" has a no argument constructor, but it is of incorrect visibility"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr119570" pr="119570" title="spurious override method warning"> + <compile files="NodeImpl.java,INode.java,ParameterizedDP.java" options="-1.5"/> + <run class="bugs.ParameterizedDP"/> + </ajc-test> + + <ajc-test dir="bugs150/pr119570" pr="119570" title="spurious override method warning - 2"> + <compile files="ParameterizedDP.java,NodeImpl.java,INode.java" options="-1.5"/> + <run class="bugs.ParameterizedDP"/> + </ajc-test> + + <ajc-test dir="bugs150/pr119570" pr="119570" title="spurious override method warning - 3"> + <compile files="SimpleTest.java" options="-1.5"/> + <run class="SimpleTest"/> + </ajc-test> + + <ajc-test dir="bugs150/pr120521" pr="120521" title="named pointcut not resolved in pertarget pointcut"> + <compile files="PerTargetSubaspectError.java" options="-1.4"/> + </ajc-test> + + <ajc-test dir="bugs150/pr119210" pr="119210" title="autoboxing around advice - 1"> + <compile files="TestLib.java,ThreadAspectLib.java" options="-1.5"/> + <run class="TestLib"> + <stderr> + <line text="obtaining five, got 3"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119210" pr="119210" title="autoboxing around advice - 2"> + <compile files="TestLib2.java,ThreadAspectLib2.java" options="-1.5"/> + <run class="TestLib2"> + <stderr> + <line text="obtaining five, got 3"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119210" pr="119210" title="autoboxing around advice - 3"> + <compile files="TestLib2.java,ThreadAspectLib2.java" options="-1.4"> + <message kind="error" line="16" text="incompatible return type applying to method-call(java.lang.Integer TestLib2.getFive())"/> + <message kind="error" line="4" text="incompatible return type applying to method-call(java.lang.Integer TestLib2.getFive())"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr119539" pr="119539" title="generic pertypewithin aspect - 1"> + <compile files="GenericPerTypeWithin.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-execution(void bugs.C.<init>())' in Type 'bugs.C' (GenericPerTypeWithin.java:10) advised by before advice from 'bugs.A' (GenericPerTypeWithin.java:21)"/> + <message kind="weave" text="Join point 'constructor-execution(void bugs.C.<init>())' in Type 'bugs.C' (GenericPerTypeWithin.java:10) advised by before advice from 'bugs.A' (GenericPerTypeWithin.java:20)"/> + </compile> + <run class="bugs.GenericPerTypeWithin"/> + </ajc-test> + + <ajc-test dir="bugs150/pr119539" pr="119539" title="generic pertypewithin aspect - 2"> + <compile files="GenericPerTypeWithin2.java" options="-1.5 -showWeaveInfo"> + <message kind="error" line="24" text="a generic super-aspect must be fully parameterized in an extends clause"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr119539" pr="119539" title="generic pertypewithin aspect - 3"> + <compile files="GenericPerTypeWithin3.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-execution(void bugs.GenericPerTypeWithin3$C.<init>())' in Type 'bugs.GenericPerTypeWithin3$C' (GenericPerTypeWithin3.java:15) advised by before advice from 'bugs.GenericPerTypeWithin3$A' (GenericPerTypeWithin3.java:10)"/> + <message kind="warning" line="15" text="Singleton.creation()"/> + </compile> + <run class="bugs.GenericPerTypeWithin3"/> + </ajc-test> + + <ajc-test dir="bugs150/pr117854" pr="117854" title="broken switch transform"> + <compile files="BrokenSwitch.java" options=""/> + <run class="BrokenSwitch"/> + </ajc-test> + + <ajc-test dir="bugs150/pr119749" pr="119749" title="incorrect exception signature matching"> + <compile files="InheritedThrows.java" options="-showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void InheritedThrows$NestedClassBoth.m())' in Type 'InheritedThrows$NestedClassBoth' (InheritedThrows.java:24) advised by afterThrowing advice from 'InheritedThrows$A' (InheritedThrows.java:4)"/> + <message kind="weave" text="Join point 'method-execution(void InheritedThrows$NestedClass1.m())' in Type 'InheritedThrows$NestedClass1' (InheritedThrows.java:16) advised by afterThrowing advice from 'InheritedThrows$A' (InheritedThrows.java:4)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr118599" pr="118599" title="ambiguous method when binary weaving - 1"> + <!-- separate compilation was failing --> + <compile files="Attributable.java" outjar="foo.jar" options="-1.5"/> + <compile files="AnAttributedClass.java" aspectpath="foo.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr118599" pr="118599" title="ambiguous method when binary weaving - 2"> + <!-- complete compilation works --> + <compile files="Attributable.java,AnAttributedClass.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="104220" title="adviceexecution join point toString forms"> + <compile files="Pr104220.aj"/> + <run class="Pr104220"> + <stdout> + <line text="adviceexecution"/> + <line text="adviceexecution(void SomeAspect.before())"/> + <line text="adviceexecution(SomeAspect.before())"/> + <line text="adviceexecution(void SomeAspect.before())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="112756" title="pointcut expression containing 'assert'"> + <compile files="Pr112756.aj" options="-warn:assertIdentifier -Xdev:Pinpoint"/> + </ajc-test> + + <ajc-test dir="bugs150/pr118781" pr="118781" title="verify error with around advice array sigs"> + <compile files="MyMain.java,MyAspect.java,MyClass.java" options="-XnoInline"/> + <run class="blah.MyMain"/> + </ajc-test> + + <ajc-test dir="bugs150/pr117681" pr="117681" title="at declare parents"> + <compile files="Test.java,TestAspect.java,Audit.java,AuditImpl.java" options="-1.5"/> + <run class="Test"/> + </ajc-test> + + <ajc-test dir="bugs150/pr120474" pr="120474" title="Dollar classes"> + <compile files="$ProxyPr120474.java"/> + <compile files="X.aj" options="-outxml -1.4"/> + <run class="$ProxyPr120474" ltw="aop.xml"> + <stdout> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr111667" pr="111667" title="lint for advice sorting"> + <compile files="A.java,X.java,Y.java" options="-1.5 -Xlint:warning"> + <message kind="warning" line="9" text="at this shadow method-execution(void A.m1()) no precedence is specified between advice applying from aspect X and aspect Y [Xlint:unorderedAdviceAtShadow]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr118326" pr="118326" title="illegal initialization - 1"> + <compile files="Foo.java,Bar.java"> + <message kind="error" line="2" text="Type mismatch: cannot convert from null to int"/> + <message kind="error" line="6" text="Type mismatch: cannot convert from Integer to int"/> + <message kind="error" line="8" text="Type mismatch: cannot convert from String to int"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr118326" pr="118326" title="illegal initialization - 2"> + <compile files="Foo.java,Bar.java" options="-1.5"> + <message kind="error" line="2" text="Type mismatch: cannot convert from null to int"/> + <message kind="error" line="8" text="Type mismatch: cannot convert from String to int"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr117296" pr="117296" title="self bounding generic types"> + <compile files="PropertySupport.java" options="-1.5"/> + <run class="PropertySupport"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="113368" title="thisJoinPointStaticPart in if test"> + <compile files="Pr113368.aj"/> + <run class="Pr113368"> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr87525" pr="87525" title="privilege problem with switch"> + <compile files="A.java,B.java"> + <message kind="error" line="5" text="Fields accessible due to an aspect being privileged can not be used in switch statements"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/reflection" title="pointcut parsing with ajc compiled pointcut references"> + <compile files="PointcutLibrary.aj,ReflectOnAjcCompiledPointcuts.java" options="-1.5"></compile> + <run class="ReflectOnAjcCompiledPointcuts" classpath="../lib/bcel/bcel.jar"/> + </ajc-test> + + <ajc-test dir="java5/reflection" title="reflection on itds"> + <compile files="InterTypeDeclarations.aj,ReflectOnCodeStyleITDs.java" options="-1.5 -Xlint:ignore -makeAjReflectable"></compile> + <run class="ReflectOnCodeStyleITDs" classpath="../lib/bcel/bcel.jar"> + <stdout> + <line text="public C.new(int, int, int)"/> + <line text="C.new(int, int)"/> + <line text="private C.new(int)"/> + <line text="private C.new(int)"/> + <line text="public C.new(int, int, int)"/> + <line text="public C.new(int, int, int)"/> + <line text="int C.getY()"/> + <line text="int I.getY()"/> + <line text="public int C.getZ()"/> + <line text="public int I.getZ()"/> + <line text="private int C.getX()"/> + <line text="private int I.getX()"/> + <line text="private int C.getX()"/> + <line text="public int C.getZ()"/> + <line text="public int I.getZ()"/> + <line text="public int C.getZ()"/> + <line text="int C.y"/> + <line text="int I.y"/> + <line text="public int C.z"/> + <line text="public int I.z"/> + <line text="private int C.x"/> + <line text="private int I.x"/> + <line text="private int C.x"/> + <line text="public int C.z"/> + <line text="public int I.z"/> + <line text="public int C.z"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/reflection" title="reflection on @DeclareParents"> + <compile files="AtAspectJDeclareParents.aj,ReflectOnAtAspectJDeclareParents.java" options="-1.5 -Xlint:ignore"></compile> + <run class="ReflectOnAtAspectJDeclareParents" classpath="../lib/bcel/bcel.jar"> + <stdout> + <line text="declare parents : C implements I"/> + <line text="public int I.getX()"/> + <line text="public void I.setX(int)"/> + <line text="public int I.getX()"/> + <line text="public int I.getX()"/> + <line text="public void I.setX(int)"/> + <line text="public int I.getX()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="compatibility/case1" title="generating code for a 1.2.1 runtime - 1"> + <compile files="Simple.java" options="-Xajruntimetarget:1.2"/> + <run class="Simple" classpath="../lib/aspectj/lib/aspectjrt121.jar"/> + </ajc-test> + + <ajc-test dir="compatibility/case2" title="generating code for a 1.2.1 runtime - 2"> + <compile files="TrackingErrors.aj,A.java" options="-Xajruntimetarget:1.2 -Xlint:ignore"/> + <run class="A" classpath="../lib/aspectj/lib/aspectjrt121.jar"/> + </ajc-test> + + <ajc-test dir="java5/reflection" title="arg names in advice annotations"> + <compile files="AdviceWithArgs.aj" options="-1.5"></compile> + <run class="AdviceWithArgs"/> + </ajc-test> + + + <ajc-test dir="java5/reflection" pr="114322" title="reflection on abstract ITDs (Billing example)"> + <compile files="ReflectBilling.java,Billing.aj" options="-1.5 -makeAjReflectable"/> + <run class="ReflectBilling"> + <stdout> + <line text="public void Customer.addCharge(long)"/> + <line text="public long Local.callRate()"/> + <line text="public long LongDistance.callRate()"/> + <line text="public abstract long Connection.callRate()"/> + <line text="public Customer Connection.payer"/> + <line text="public long Customer.totalCharge"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="103157" title="returning(Object) binding"> + <compile files="Pr103157.aj" options="-1.4"/> + <run class="Pr103157"> + <stdout> + <line text="returning from staticinit"/> + <line text="returning from preinit"/> + <line text="returning from set"/> + <line text="returning from cons exe"/> + <line text="returning from init"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="declare soft and adviceexecution" pr="103051"> + <compile files="Pr103051.aj" options="-Xdev:Pinpoint"/> + </ajc-test> + + <ajc-test dir="bugs150" title="declare soft and exclusions" pr="103097"> + <compile files="Pr103097.aj" options="-Xlint:ignore"/> + <run class="Pr103097"/> + </ajc-test> + + + <ajc-test dir="bugs150" title="Range problem"> + <compile files="pr109614.java"/> + <run class="pr109614"/> + </ajc-test> + + <ajc-test dir="bugs150/pr114436" title="ClassFormatError binary weaving perthis"> + <compile files="SimpleTrace.aj,ConcreteSimpleTracing.aj" outjar="aspects.jar" options="-1.4"/> + <compile files="TestClass.java" aspectpath="aspects.jar" options="-1.4"/> + <run class="TestClass"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113066" title="possible static imports bug - 1"> + <compile files="Consts.java,TestNPE.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="parameterized type and around advice"> + <compile files="pr115250.aj" options="-1.5 -Xlint:ignore"> + <!-- this first error happens twice, once for each piece of around advice --> + <message kind="error" line="10" text="incompatible return type applying to constructor-execution(void pr115250$C.<init>())"/> + <message kind="error" line="17" text="incompatible return type applying to constructor-execution(void pr115250$C.<init>())"/> + <message kind="error" line="27" text="incompatible return type applying to constructor-execution(void pr115250$C.<init>())"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="parameterized type and around advice - 2"> + <compile files="pr115250_2.aj" options="-1.5 -Xlint:ignore -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(pr115250_2$C pr115250_2$C.foo())' in Type 'pr115250_2$C' (pr115250_2.aj:7) advised by around advice from 'pr115250_2$A' (pr115250_2.aj:22)"/> + <message kind="weave" text="Join point 'method-execution(pr115250_2$C pr115250_2$C.foo())' in Type 'pr115250_2$C' (pr115250_2.aj:7) advised by around advice from 'pr115250_2$Normal' (pr115250_2.aj:12)"/> + </compile> + <run class="pr115250_2"> + <stderr> + <line text="funky advice running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr115788" title="parser exception"> + <compile files="AAA.java"> + <message kind="warning" line="3" text="no match for this type name: Screen"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr113066" title="possible static imports bug - 2"> + <compile files="Consts2.java,TestNPE2.java" options="-1.5"> + <message kind="error" line="2" text="The field Consts2.a.Consts2.A_CONST is not visible"/> + <!-- message has changed with 3.3 compiler upgrade, it used to be this: --> + <!-- message kind="error" line="2" text="The import a.Consts2.A_CONST cannot be resolved"/--> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr113066" title="possible static imports bug - 3"> + <compile files="Consts3.java,TestNPE3.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/staticImports" title="import static java.lang.System.out"> + <compile files="StaticImport.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="Problem with constructor ITDs"> + <compile files="pr112783.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="NPE in ensureScopeSetup"> + <compile files="pr115038.aj" options="-1.5"> + <message kind="error" line="2" text="Cannot make inter-type declarations on type variables"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="ITDC with no explicit cons call"> + <compile files="Pr62606.aj" options="-1.5"> + <message kind="warning" line="6" text="[Xlint:noExplicitConstructorCall]"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/bugs" title="using same type variable in ITD"> + <compile files="SameTypeVariable.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="capturebinding wildcard problem"> + <compile files="pr114744.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="Anonymous types and nome matching"> + <compile files="Pr73050.aj" outjar="jar1.jar"> + <message kind="warning" line="16" text="anonymous types should be matched by a * wild card"/> + </compile> + <compile inpath="jar1.jar"> + <message kind="warning" line="0" text="anonymous types should be matched by a * wild card"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr86903" title="bcelrenderer bad"> + <compile files="GenericService.java,Service.java,Main.java,BadWormhole.java"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="bugs150/pr114343" title="field-get, generics and around advice"> + <compile files="Test.java,Test1.java,Test2.java,TestAspect.aj" options="-1.5"> + <message kind="warning" line="7" text="unchecked conversion when advice applied at shadow field-get(java.util.Set Test1.intsSet), expected java.util.Set<java.lang.Integer> but advice uses java.util.Set"/> + <message kind="warning" line="8" text="unchecked conversion when advice applied at shadow field-get(java.util.Set Test2.doubSet), expected java.util.Set<java.lang.Double> but advice uses java.util.Set"/> + </compile> + <run class="TestAspect"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113947/case1" title="maws generic aspect - 1"> + <compile files="AbstractListSupport.java,AnotherItem.java,Item.java,LinkedList.java,LinkedListItem.java,ListItem.java,StringList.java" options="-1.5"> + <message kind="error" line="6" text="Cannot make inter-type declarations on type variables"/> + <message kind="error" line="8" text="Cannot make inter-type declarations on type variables"/> + <message kind="error" line="12" text="Cannot make inter-type declarations on type variables"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="aspectOf and generic aspects"> + <compile files="pr115237.aj" options="-1.5"/> + <run class="pr115237"/> + </ajc-test> + + <ajc-test dir="bugs150/pr114343/case2" title="field-get, generics and around advice - 2"> + <compile files="Test.java,TTT.java,TestAspect.java" options="-1.5"/> + <run class="TestAspect"> + <stderr> + <line text="TestAspect.main: Calling foo"/> + <line text="Creating Test<Integer> instance"/> + <line text="Calling toArray"/> + <line text="In around advice"/> + <line text="In toArray()"/> + <line text="done"/> + <line text="TestAspect.main: done"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr114343/case3" title="field-get, generics and around advice - 3"> + <compile files="Test.java,TTT.java,TestAspect.java" options="-1.5"/> + <run class="TestAspect"> + <stderr> + <line text="TestAspect.main: Calling foo"/> + <line text="Creating Test<Integer> instance"/> + <line text="Calling toArray"/> + <line text="In around advice"/> + <line text="In toArray()"/> + <line text="done"/> + <line text="Creating Test<Integer> instance"/> + <line text="Calling getFirst"/> + <line text="around on getFirstExec(): running"/> + <line text="done"/> + <line text="TestAspect.main: done"/> + </stderr> + </run> + </ajc-test> + + + <ajc-test dir="bugs150/pr113947/case2" title="maws generic aspect - 2"> + <compile files="AbstractListSupport.java,AnotherItem.java,Item.java,LinkedList.java,LinkedListItem.java,ListItem.java,StringList.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113861" title="field-get problems with generic field"> + <compile files="Test.java,TestAspect.java" options="-1.5"/> + <run class="com.Test"/> + </ajc-test> + + + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 1"> + <compile files="pr99191_1.java" options="-1.5"> + <message kind="error" line="4" text="The field 'int C.noSuchField' does not exist"/> + <message kind="error" line="5" text="The field 'int B.noSuchField' does not exist"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/lists/case1" title="generics and ITD overrides - 1"> + <compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.5"> + </compile> + <run class="IdentifiableAspect"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/lists/case2" title="generics and ITD overrides - 2"> + <compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.5"> + </compile> + <run class="IdentifiableAspect"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/lists/case3" title="generics and ITD overrides - 3"> + <compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.5"> + </compile> + <run class="IdentifiableAspect"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/lists/case4" title="generics and ITD overrides - 4"> + <compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.5"> + </compile> + <run class="IdentifiableAspect"/> + </ajc-test> + + <!-- Currently a warning doesn't occur if the annotation is already on the field + (see bug 113029). If this is fixed, need to add check for this warning to this + test as in test "declare annotation on non existent type - 4" --> + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 2"> + <compile files="pr99191_2.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 3"> + <compile files="pr99191_3.java" options="-1.5"> + <message kind="error" line="4" text="The method 'public * C.noSuchMethod(..)' does not exist"/> + <message kind="error" line="5" text="The method '* B.noSuchMethod(..)' does not exist"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 4"> + <compile files="pr99191_4.java" options="-1.5"> + <message kind="warning" text="void C.amethod() - already has an annotation of type Annotation, cannot add a second instance [Xlint:elementAlreadyAnnotated]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 5"> + <compile files="pr99191_5.java" options="-1.5"> + <message kind="error" line="4" text="The method 'C.new(java.lang.String)' does not exist"/> + <message kind="error" line="5" text="The method 'B.new(int)' does not exist"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 6"> + <compile files="pr99191_6.java" options="-1.5"> + <message kind="warning" text="void C.<init>(int) - already has an annotation of type Annotation, cannot add a second instance [Xlint:elementAlreadyAnnotated]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr113630/case1" title="IncompatibleClassChangeError - errorscenario"> + <compile files="Bean.java,BeanTestCase.java,javaBean.java,propertyChanger.java,PropertySupportAspect5.aj" options="-1.5"> + <message kind="warning" line="9" text="Failing match because annotation 'javaBean' on type 'Bean' has SOURCE retention. Matching allowed when RetentionPolicy is CLASS or RUNTIME"/> + <message kind="error" line="18" text="The method addPropertyChangeListener(String, BeanTestCase) is undefined for the type Bean"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr113630/case2" title="IncompatibleClassChangeError - workingscenario"> + <compile files="Bean.java,BeanTestCase.java,javaBean.java,propertyChanger.java,PropertySupportAspect5.aj" options="-1.5"/> + <run class="BeanTestCase"/> + </ajc-test> + + <ajc-test dir="bugs150" title="Generics ClassCastException"> + <compile files="pr113445.aj" options="-1.5,-emacssym"/> + </ajc-test> + + <ajc-test dir="bugs150" title="test illegal change to pointcut declaration"> + <compile files="pr111915.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void SomeClass.doSomething())' in Type 'SomeClass' (pr111915.java:4) advised by around advice from 'DoesntCompile' (pr111915.java:15)"/> + <message kind="weave" text="Extending interface set for type 'SomeClass' (pr111915.java) to include 'java.io.Serializable' (pr111915.java)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/bridgeMethods" pr="72766" title="Ignore bridge methods"> + <compile files="AspectX.aj" inpath="testcode.jar" options="-showWeaveInfo"> + <!-- <message kind="warning" line="7" text="pointcut did not match on the method call to a bridge method."/> + <message kind="warning" line="7" text="does not match because declaring type is Number"/>--> + <message kind="weave" text="(AspectX.aj:18) advised by before advice from 'AspectX'"/> + <message kind="weave" text="(AspectX.aj:19) advised by before advice from 'AspectX'"/> + <message kind="weave" text="(Number.java:5) advised by before advice from 'AspectX'"/> + </compile> + </ajc-test> + + <ajc-test title="intermediate annotation matching" dir="bugs150"> + <compile files="AnnotationPlusPatternMatchingError.aj" options="-1.5"> + <message kind="warning" line="28" text="matched"/> + </compile> + <run class="AnnotationPlusPatternMatchingError"> + <stdout> + <line text="In advice"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="migration" title="load aspectj 1.2.1 aspects in aspectj 5"> + <compile files="Program.java" aspectpath="aspects121.jar"> + </compile> + <run class="Program"/> + </ajc-test> + + <ajc-test dir="bugs/java5/arrayCloning" pr="72150" vm="1.5" + title="AJC possible bug with static nested classes"> + <compile files="A.java,C.java" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'C' (C.java:14) advised by around advice from 'A' (A.java:2)"/> + </compile> + <run class="C"/> + </ajc-test> + + <ajc-test dir="java5/pseudoKeywords" + title="method called around in class"> + <compile files="MethodCalledAround.java"> + </compile> + </ajc-test> + + <ajc-test dir="java5/pseudoKeywords" + title="method called around in aspect"> + <compile files="MethodCalledAroundAspect.java"> + <message kind="error" line="2"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="64568" title="clear error message on itd with type pattern"> + <compile files="pr64568.aj"> + <message line="4" kind="error" text="Syntax error on token "*", delete this token"/> + <message line="4" kind="error" text="foo cannot be resolved to a type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="74562" title="before and after are valid identifiers in classes"> + <compile files="pr74562.aj"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="107486" title="anonymous inner classes"> + <compile files="pr107486.aj"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="102210" title="NullPointerException trying to compile"> + <compile files="PR102210.java"/> + <run class="PR102210"> + <stderr> + <line text="List size is 1"/> + <line text="m1 running"/> + <line text="List size is 2"/> + <line text="m2 running"/> + <line text="List size is 3"/> + <line text="m3 running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="107486" title="multiple anonymous inner classes"> + <compile files="pr107486part2.aj"> + </compile> + <run class="pr107486part2"> + <stdout> + <line text="[advised] f"/> + <line text="[advised] g"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/compliance" title="java 5 pointcuts and declares at pre-java 5 compliance levels"> + <compile files="AJ5FeaturesAtJ14.aj" options="-1.4"> + <message kind="error" line="3" text="the @annotation pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="11" text="the @within pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="13" text="the @withincode pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="5" text="the @this pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="7" text="the @target pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="9" text="the @args pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="15" text="declare @type is only supported at Java 5 compliance level or above"/> + <message kind="error" line="15" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="15" text="cannot convert from Foo to Annotation"/> + <message kind="error" line="17" text="declare @method is only supported at Java 5 compliance level or above"/> + <message kind="error" line="17" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="17" text="cannot convert from Foo to Annotation"/> + <message kind="error" line="19" text="declare @field is only supported at Java 5 compliance level or above"/> + <message kind="error" line="19" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="19" text="cannot convert from Foo to Annotation"/> + <message kind="error" line="21" text="declare @constructor is only supported at Java 5 compliance level or above"/> + <message kind="error" line="21" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="21" text="cannot convert from Foo to Annotation"/> + <message kind="error" line="25" text="annotation type patterns are only supported at Java 5 compliance level or above"/> + <message kind="error" line="27" text="annotation type patterns are only supported at Java 5 compliance level or above"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/compliance" title="java 5 pointcuts and declares at pre-java 5 compliance levels - 1.7"> + <compile files="AJ5FeaturesAtJ14.aj" options="-1.4"> + <message kind="error" line="3" text="the @annotation pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="11" text="the @within pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="13" text="the @withincode pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="5" text="the @this pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="7" text="the @target pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="9" text="the @args pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="15" text="declare @type is only supported at Java 5 compliance level or above"/> + <message kind="error" line="15" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="15" text="Foo is not an annotation type"/> + <message kind="error" line="17" text="declare @method is only supported at Java 5 compliance level or above"/> + <message kind="error" line="17" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="17" text="Foo is not an annotation type"/> + <message kind="error" line="19" text="declare @field is only supported at Java 5 compliance level or above"/> + <message kind="error" line="19" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="19" text="Foo is not an annotation type"/> + <message kind="error" line="21" text="declare @constructor is only supported at Java 5 compliance level or above"/> + <message kind="error" line="21" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="21" text="Foo is not an annotation type"/> + <message kind="error" line="25" text="annotation type patterns are only supported at Java 5 compliance level or above"/> + <message kind="error" line="27" text="annotation type patterns are only supported at Java 5 compliance level or above"/> + </compile> + </ajc-test> + + + <ajc-test dir="bugs150" pr="91114" title="before and after are valid identifiers in classes, part 2"> + <compile files="pr91114.aj"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="78621" title="void field type in pointcut expression"> + <compile files="pr78261.aj"> + <message line="3" kind="error" text="fields cannot have a void type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="86057" title="overriding final pointcut from super-aspect"> + <compile files="pr86057.aj"> + <message line="9" kind="error" text="can't override final pointcut Base.foo()"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="78707" title="before returning advice not allowed!"> + <compile files="pr78707.aj"> + <message line="3" kind="error" text="Syntax error on token "returning", delete this token"/> + <message line="3" kind="error" text="Syntax error on token "throwing", delete this token"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="104529" title="@SuppressWarnings should suppress"> + <compile files="pr104529.aj" options = "-1.5 -warn:+unchecked"> + <message line="11" kind="warning" text="needs unchecked conversion"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="79523" title="declare warning : foo(str) : ...;"> + <compile files="pr79523.aj"> + <message line="4" kind="warning" text="no match for this type name: str"/> + <message line="4" kind="error" text="bad parameter"/> + <message line="4" kind="error" text="args() pointcut designator cannot be used in declare statement"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="107059" title="parser crashes on call(void (@a *)(..)"> + <compile files="pr107059.aj"> + <message line="3" kind="error" text="Syntax error on token "(", "name pattern" expected"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="107059" title="target(@Foo *)"> + <compile files="pr107059_2.aj" options="-1.5"> + <message kind="error" line="4" text="wildcard type pattern not allowed"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="varargs with type variable"> + <compile files="ParameterizedVarArgMatch.aj" options="-1.5"> + </compile> + </ajc-test> + + + <ajc-test dir="bugs150" pr="108104" title="multiple anonymous inner classes 2"> + <compile files="pr108104.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108050" title="signature matching in override scenario"> + <compile files="pr108050.aj" options="-1.5"> + <message kind="warning" line = "2" text="servlet request"></message> + <message kind="warning" line = "7" text="servlet request"></message> + <message kind="warning" line = "21" text="servlet request"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr108425" pr="108245" title="wildcard annotation matching - pr108245"> + <compile files="package1/Bean.java,package2/Bean.java,package2/propertyChanger.java,package3/pr108425.aj" options="-1.5 -Xlint:ignore"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/" pr="108104" title="inner types and type variables"> + <compile files="ShapeCommandMap.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/" pr="107953" title="@AfterThrowing with no formal specified"> + <compile files="pr107953.java" options="-1.5"> + <message kind="error" line="8" text="throwing formal 'RuntimeException' must be declared as a parameter in the advice signature"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr106130" pr="106130" title="test weaving with > 256 locals"> + <compile files="AroundLotsOfVars.java LotsOfVars.java" options="-preserveAllLocals"/> + <run class="LotsOfVars"> + <stdout> + <line text="hello"/> + <line text="2"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr87376" title="structure model npe on type not found"> + <compile files="I.java,NPE.aj" options="-emacssym"> + <message kind="error" line="8" text="I cannot be resolved to a type"/> + <message kind="error" line="10" text="I cannot be resolved to a type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="83311" title="overriding/polymorphism error on interface method introduction"> + <compile files="pr83311.aj"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="103266" title="NPE on syntax error"> + <compile files="pr103266.aj"> + <message kind="error" line="41" text="ConnectionRequestContext cannot be resolved to a type"/> + <!-- this next message is new in e37 --> + <message kind="error" line="41" text="Type mismatch: cannot convert from new ConnectionRequestContext(){} to WorkerExample.RequestContext"/> + </compile> + </ajc-test> + + <ajc-test title="itd override with no exception clause" dir="bugs150"> + <compile files="pr83377.aj"></compile> + </ajc-test> + + <ajc-test dir="bugs150/pr84260" vm="1.5" title="static import failures"> + <compile files="A.java,I1.java,I2.java" options="-1.5"/> + <run class="I1"> + <stderr> + <line text="static method running"/> + </stderr> + </run> + <run class="I2"> + <stderr> + <line text="static method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test title="anonymous inner class with method returning type parameter" pr="107898" dir="bugs150"> + <compile files="pr107898.aj" options="-1.5"></compile> + </ajc-test> + + <ajc-test title="matching against Object[]" pr="72668" dir="bugs150"> + <compile files="pr72668.aj" options="-1.5"> + <message kind="error" line="3" text="incompatible return type applying to method-execution(java.lang.Number[] pr72668.getThoseInts())"></message> + <message kind="error" line="10" text="incompatible return type applying to method-execution(java.lang.Number[] pr72668.getThoseInts())"></message> + </compile> + </ajc-test> + + <ajc-test dir="decp" pr="80249" title="Order of types passed to compiler determines weaving behavior"> + <compile files="A.java,B.java,AspectX.java"/> + <run class="B"/> + <compile files="B.java,A.java,AspectX.java"/> + <run class="B"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="99228" vm="1.5" title="ITD of a field into a generic class"> + <compile files="PR99228.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="98320" vm="1.5" title="intertype with nested generic type"> + <compile files="PR98320.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="decs" pr="42743" title="declare soft of runtime exception"> + <compile files="DeclareSoftRuntimeException.aj"> + <message kind="warning" line="3" text="MyRuntimeException will not be softened as it is already a RuntimeException"/> + </compile> + <run class="DeclareSoftRuntimeException"> + <stdout> + <line text="MyRuntimeException"/> + <line text="org.aspectj.lang.SoftException"/> + <line text="MyRuntimeException"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="decs" pr="42743" title="declare soft w. catch block"> + <compile files="VerifyError.aj" options="-Xlint:ignore"> + </compile> + <run class="VerifyError"/> + </ajc-test> + + <ajc-test dir="bugs" pr="61568" title="Various kinds of ambiguous bindings"> + <compile files="AmbiguousBindings.aj" options="-1.4"> + <message line="17" text="ambiguous binding of parameter(s) foo across '||' in pointcut"></message> + <message line="19" text="ambiguous binding of parameter(s) foo across '||' in pointcut"></message> + <message line="21" text="ambiguous binding of parameter(s) foo across '||' in pointcut"></message> + <message line="23" text="ambiguous binding of parameter(s) x across '||' in pointcut"></message> + <message line="25" text="ambiguous binding of parameter(s) foo across '||' in pointcut"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="61658" title="ambiguous args"> + <compile files="PR61658.java"> + <message line="17" text="ambiguous binding of parameter(s) a, b across '||' in pointcut"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="78021" title="Injecting exception into while loop with break statement causes catch block to be ignored"> + <compile files="PR78021.java"/> + <run class="PR78021"/> + </ajc-test> + + <ajc-test dir="bugs150/pr99089" vm="1.5" pr="99089" title="ArrayIndexOutOfBoundsException - Generics in privileged aspects"> + <compile files="DataClass.java,TracingAspect.java" options="-1.5"/> + <run class="DataClass"> + <stderr> + <line text="before:Length of v=1"/> + <line text="after:Length of v=2"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="79554" title="Return in try-block disables catch-block if final-block is present"> + <compile files="PR79554.java"/> + <run class="PR79554"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="82570" title="Weaved code does not include debug lines"> + <compile files="PR82570_1.java"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="83303" title="compiler error when mixing inheritance, overriding and polymorphism"> + <compile files="PR83303.java"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="83563" title="pertypewithin() handing of inner classes (1)"> + <compile files="PR83563_1.java"/> + <run class="PR83563_1"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="83563" title="pertypewithin() handing of inner classes (2)"> + <compile files="PR83563_2.java"/> + <run class="PR83563_2"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="83645" title="pertypewithin({interface}) illegal field modifier"> + <compile files="PR83645.java" options="-Xlint:ignore"/> + <run class="PR83645"/> + </ajc-test> + + <ajc-test dir="bugs150" title="bad asm for enums" vm="1.5"> + <compile files="Rainbow.java" options="-emacssym,-1.5,-Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="10461" title="missing name pattern"> + <compile files="PR106461.aj"> + <message kind="error" line="3" text="Syntax error on token "(", "name pattern" expected"/> + <message kind="error" line="5" text="Syntax error on token ")", "name pattern" expected"/> + <message kind="error" line="7" text="Syntax error on token ".", "name pattern" expected"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="106634" title="IllegalStateException unpacking signature of nested parameterized type"> + <compile files="pr106634.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="(@Foo *)+ type pattern parse error"> + <compile files="AnnotationPlusPatternParseError.aj" options="-1.5"/> + <!-- next line needs the change for inherited anno matching... --> + <!--compile files="AnnotationPlusPatternParseError.aj" options="-1.5"> + <message kind="warning" line="19"/> + </compile--> + </ajc-test> + + <ajc-test dir="bugs150" pr="80571" title="around advice on interface initializer"> + <compile files="pr80571.aj"> + <message kind="warning" text="The joinpoint 'constructor-call(void pr80571.<init>())' cannot be advised"/> + </compile> + <run class="pr80571"> + <stdout> + <line text="before"/> + <line text="after"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="78314" title="good error message for unmatched member syntax"> + <compile files="pr78314.aj" options="-1.5"> + <message kind="error" line="5" text="Syntax error on token "foo", no accurate correction available"/> + </compile> + <compile files="pr78314.aj"> + <message kind="error" line="5" text="Syntax error on token "foo", no accurate correction available"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108377" title="itd field access inside itd method"> + <compile files="pr108377.aj"/> + <run class="pr108377"/> + </ajc-test> + + <ajc-test dir="bugs150/pr108054" pr="108054" title="type variable with type variable bound"> + <compile files="pr108054.aj" options="-1.5"/> + <compile files="ISequence.java,ICounter.java,ASequence.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr108370" pr="108370" title="switch on enum inside ITD method"> + <compile files="et/Q.java" options="-1.5"/> + <compile files="EnumTest.aj" options="-1.5 -inpath et"/> + <run class="EnumTest"> + <stdout> + <line text="B!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="95992" title="inner type of generic interface reference from parameterized type"> + <compile files="pr95992.aj" options="-1.5"/> + </ajc-test> + + + <ajc-test dir="bugs150" pr="104024" title="inner class passed as argument to varargs method"> + <compile files="pr104024.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="107858" title="inlined field access in proceed call"> + <compile files="pr107858.aj" options="-1.5"> + <message kind="error" line="9" text="too many arguments to proceed, expected 0"></message> + <message kind="error" line="10" text="too many arguments to proceed, expected 0"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr71159" pr="71159" title="visibility in signature matching with overrides - 1"> + <compile files="pr71159.aj"> + <message kind="warning" line="26" text="should match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr71159" pr="71159" title="visibility in signature matching with overrides - 2"> + <compile files="PrivateITD.aj"> + <message kind="warning" line="28" text="should match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr71159" pr="71159" title="visibility in signature matching with overrides - 3"> + <compile files="pkg1/A.java,pkg1/B.java,pkg1/C.java,pkg2/ITDInDiffPackage.aj"> + <message kind="warning" line="10" text="should match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="59196" title="args generated correctly for advice execution join point"> + <compile files="pr59196.aj" options="-XnoInline -1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="74048" title="no unused warnings on aspect types"> + <compile files="pr74048.aj" options="-warn:unusedPrivate"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="59397" title="synthetic arguments on itd cons are not used in matching"> + <compile files="pr59397.aj"> + <message line="6" kind="warning" text="should match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108602" title="parse generic type signature with parameterized type in interface"> + <compile files="pr108602.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="105479" title="declare parents introducing override with covariance"> + <compile files="pr105479.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="105479" title="override and covariance with decp - runtime"> + <compile files="pr105479part2.aj" options="-1.5"/> + <run class="pr105479part2"> + <stdout> + <line text="in Test.hashCode()"/> + <line text="in Test.hashCode()"/> + <line text="id"/> + <line text="in Test.hashCode()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr105479/case1" pr="105479" title="override and covariance with decp - runtime separate files"> + <compile files="ReturnTypeTest.aj,ReturnTypeTester.java,Driver.java" options="-1.5"/> + <run class="Driver"> + <stdout> + <line text="in Test.hashCode()"/> + <line text="in Test.hashCode()"/> + <line text="id"/> + <line text="in Test.hashCode()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr105479/case2" pr="105479" title="override and covariance with decp - binary weaving"> + <compile files="ReturnTypeTest.java" outjar="jar1.jar" options="-1.5 -Xlint:ignore"/> + <compile files="ReturnTypeTester.java" outjar="jar2.jar" options="-1.5"/> + <compile inpath="jar1.jar;jar2.jar" options="-1.5"/> + <run class="ReturnTypeTester"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="102212" title="abstract synchronized itdms not detected"> + <compile files="pr102212.aj"> + <message line="7" kind="error" text="The abstract method _abstract in type Parent can only set a visibility modifier, one of public or protected"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="102212" title="synchronized itd interface methods"> + <compile files="SynchronizedInterfaceMethods.aj" options="-1.5"> + </compile> + <run class="SynchronizedInterfaceMethods"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="101606" title="unused private pointcuts"> + <compile files="pr101606.aj" options="-warn:unusedPrivate"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr99125" pr="99125" title="itd interface method already existing on interface"> + <compile files="p/pr99125.aj,p/I.java,p/J.java" options="-1.5"> + </compile> + <compile files="Aspects.aj" options="-inpath p"/> + <run class="p.pr99125"/> + <compile files="p2/pr99125.aj,p/I.java,p/J.java"/> <!-- actually in package p, introduces incompatible change --> + <compile files="Aspects.aj" options="-inpath p"> + <message kind="error" line="7" text="inter-type declaration from X conflicts with existing member"/> + <!-- 275032 - new error at affected member location too --> + <message kind="error" line="10" text="inter-type declaration from X conflicts with existing member"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr87530" pr="87530" title="final itd methods on interfaces"> + <compile files="FinalITDMOnInterface.aj"> + <message kind="error" line="12" text="Cannot override the final method from A.TestInterface"></message> + </compile> + <compile files="FinalITDMOnInterface2.aj"> + <!--message kind="error" line="8" text="Cannot override the final method from A.TestInterface"></message--> + <message kind="error" line="8" text="can't override final void A$TestInterface.m()"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108818" title="can't override private pointcut in abstract aspect"> + <compile files="PrivatePointcutOverriding.aj"> + <message kind="warning" line="19" text="matched join point from super advice"/> + <message kind="warning" line="21" text="matched join point from sub advice"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108816" title="advising cflow advice execution"> + <compile files="pr108816.aj" > + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr108902" pr="108902" title="no type mismatch on generic types in itds"> + <compile files="Subject.java,Observer.java,ObserverProtocol.aj" > + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108903" title="super call in ITD"> + <compile files="pr108903.aj" > + <message kind="error" line="14" text="The method print() is undefined for the type Object"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="109042" title="no unused parameter warnings for synthetic advice args"> + <compile files="pr109042.aj" options="-warn:+unusedArgument -warn:+unusedPrivate -warn:+unusedImport -1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="109486" title="Internal compiler error (ClassParser.java:242)"> + <compile files="PR109486.java" > + <message kind="error" line="1" text="The class PR109486 can be either abstract or final, not both"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="109124" title="no verify error with set on inner type"> + <compile files="VerifyErrorOnSet.aj" options="-1.5" > + </compile> + <run class="test.VerifyErrorOnSet"/> + <compile files="pr106874.aj" options="-1.5" > + </compile> + <run class="pr106874"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="108826" title="cant find type error with generic return type or parameter"> + <compile files="pr108826.aj" options="-1.5 -emacssym" > + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="105181" title="no verify error on generic collection member access"> + <compile files="pr105181.aj" options="-1.5"> + </compile> + <run class="pr105181"/> + </ajc-test> + + <ajc-test dir="bugs150/pr108903" pr="108903" title="super call in ITD - part 2"> + <compile files="com/designpattern/decorator/HeaderDecorator.aj,com/designpattern/decorator/Main.java,com/designpattern/decorator/Order.java,com/designpattern/decorator/OrderDecorator.aj,com/designpattern/decorator/SalesOrder.java" options="-1.5" > + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr103740" pr="103740" title="Compiler failure on at_annotation"> + <compile files="AroundAdvice.aj" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void C.m1())' in Type 'C' (AroundAdvice.aj:12) advised by before advice from 'ErrorHandling' (AroundAdvice.aj:8)"/> + <message kind="weave" text="Join point 'method-execution(void C.m3())' in Type 'C' (AroundAdvice.aj:14) advised by before advice from 'ErrorHandling' (AroundAdvice.aj:8)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr106554" pr="106554" title="Problem in staticinitialization with pertypewithin aspect"> + <compile files="A.aj" options="-showWeaveInfo -1.4"> + <message kind="weave" text="Join point 'staticinitialization(void A.<clinit>())' in Type 'A' (A.aj:1) advised by before advice from 'StopsInit' (A.aj:21)"/> + </compile> + <run class="A"> + <stdout> + <line text="test = 1"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/SimpleInsuranceFailure" title="raw and generic type conversion with itd cons"> + <compile files="" options=" -emacssym, -sourceroots ." > + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="@annotation binding with around advice"> + <compile files="AnnotationBinding.aj" options="-1.5"/> + <run class="AnnotationBinding"/> + </ajc-test> + + <ajc-test dir="bugs150" title="declare parents on a missing type"> + <compile files="Pr76374.aj" options="-1.5"> + <message kind="warning" line="3" text="no match for this type name"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="parameterized generic methods"> + <compile files="Pr109283.aj" options="-1.5 -warn:indirectStatic"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="call join points in anonymous inner classes"> + <compile files="pr104229.aj" options="-1.5"> + <message kind="warning" line="54" text="bingo"/> + <message kind="warning" line="115" text="bingo"/> + <message kind="warning" line="130" text="bingo"/> + </compile> + <run class="pr104229"> + <stdout> + <line text="call match class pr104229"/> + <line text="OK it worked!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="default impl of Runnable"> + <compile files="pr88900.aj" options="-Xdev:Pinpoint"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="array clone call join points in 1.4 vs 1.3"> + <compile files="pr102933.aj" options="-1.3"> + <message kind="warning" line="7" text="a call within pr102933"/> + </compile> + <compile files="pr102933.aj" options="-1.4"> + <message kind="warning" line="7" text="a call within pr102933"/> + </compile> + <compile files="pr102933.aj" options="-1.5"> + <message kind="warning" line="7" text="a call within pr102933"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="100195" title="debug info in around advice inlining"> + <compile files="pr100195.aj"> + </compile> + <run class="pr100195"/> + </ajc-test> + + <ajc-test dir="bugs150" title="weaveinfo message for declare at method on an ITDd method"> + <compile files="pr113073.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Type 'C' (pr113073.java) has intertyped method from 'D' (pr113073.java:'void C.anotherMethod()')"/> + <message kind="weave" text="'public void C.anotherMethod()' (pr113073.java) is annotated with @Annotation method annotation from 'B' (pr113073.java:3)"/> + <message kind="weave" text="Type 'C' (pr113073.java) has intertyped method from 'D' (pr113073.java:'void C.anotherMethod(java.lang.String)')"/> + <message kind="weave" text="'public void C.anotherMethod(String)' (pr113073.java) is annotated with @Annotation method annotation from 'B' (pr113073.java:3)"/> + <message kind="weave" text="Type 'C' (pr113073.java) has intertyped constructor from 'D' (pr113073.java:'void C."/> + <message kind="weave" text="'public void C.new(String)' (pr113073.java) is annotated with @Annotation constructor annotation from 'B' (pr113073.java:4)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with two this pcds"> + <compile files="PR113447.java"> + </compile> + <run class="PR113447"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with two at this pcds"> + <compile files="PR113447a.java" options="-1.5"> + </compile> + <run class="PR113447a"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with at within pcds"> + <compile files="PR113447b.java" options="-1.5"> + </compile> + <run class="PR113447b"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with at withincode pcds"> + <compile files="PR113447c.java" options="-1.5"> + </compile> + <run class="PR113447c"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with at annotation pcds"> + <compile files="PR113447d.java" options="-1.5"> + </compile> + <run class="PR113447d"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with two args pcds"> + <compile files="PR113447e.java" options="-1.5"> + </compile> + <run class="PR113447e"/> + </ajc-test> + + <ajc-test dir="bugs150" title="no StackOverflowError with circular pcd in generic aspect"> + <compile files="pr115235.aj" options="-1.5"> + <message kind="warning" line="3" text="advice defined in GenericAbstractAspect has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="error" text="circular pointcut declaration involving: pc()"/> + <message kind="error" line="20" text="circular pointcut declaration involving: pc2()"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="no StackOverflowError with circular pcd in generic aspect - 2"> + <compile files="pr115235b.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper exact annotation type"> + <compile files="ExactAnnotationTypePattern.java" options="-1.5"> + <message kind="warning" line="20" text="field blah"/> + <message kind="warning" line="28" text="does not match because annotation @TypeAnnotation has @Target{ElementType.TYPE} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="37" text="does not match because annotation @FieldAnnotation has @Target{ElementType.FIELD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="46" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotation type inside OR"> + <compile files="OrTypePattern.java" options="-1.5"> + <message kind="warning" line="26" text="does not match because annotation @FieldAnnotation has @Target{ElementType.FIELD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="31" text="does not match because annotation @TypeAnnotation has @Target{ElementType.TYPE} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="31" text="does not match because annotation @FieldAnnotation has @Target{ElementType.FIELD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotation type inside AND"> + <compile files="AndTypePattern.java" options="-1.5"> + <message kind="warning" line="23" text="does not match because annotation @FieldAnnotation has @Target{ElementType.FIELD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotated return type"> + <compile files="AnnotationReturnType.java" options="-1.5"> + <!-- warnings coming from matching pointcuts and corresponding declare warnings --> + <message kind="warning" line="12" text="(@TypeAnnotation *) *(..)"/> + <message kind="warning" line="12" text="(@(TypeAnnotation || MethodAnnotation) *) *(..)"/> + <!-- xlint warnings that were put in as part of fix for pr115252 --> + <message kind="warning" line="32" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="37" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotated declaring type"> + <compile files="AnnotationDeclaringType.java" options="-1.5"> + <!-- warning coming from matching pointcuts and corresponding declare warnings --> + <message kind="warning" line="13" text="* (@TypeAnnotation *).*(..)"/> + <!-- xlint warning that was put in as part of fix for pr115252 --> + <message kind="warning" line="27" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotated parameter type"> + <compile files="AnnotationParameterType.java" options="-1.5"> + <!-- warning coming from matching pointcuts and corresponding declare warnings --> + <message kind="warning" line="12" text="* *(@TypeAnnotation *)"/> + <!-- xlint warning that was put in as part of fix for pr115252 --> + <message kind="warning" line="31" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotated throws pattern"> + <compile files="AnnotationThrowsPattern.java" options="-1.5"> + <!-- warnings coming from matching pointcuts and corresponding declare warnings --> + <message kind="warning" line="12" text="(* *.*(..) throws (@TypeAnnotation *))"/> + <message kind="warning" line="12" text="* *.*(..) throws !(@MethodAnnotation *)"/> + <message kind="warning" line="14" text="(* *.*(..) throws !(@TypeAnnotation *))"/> + <message kind="warning" line="14" text="* *.*(..) throws !(@MethodAnnotation *)"/> + <!-- xlint warnings that were put in as part of fix for pr115252 --> + <message kind="warning" line="40" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="46" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for more than one improper annotated parameter type"> + <compile files="MoreThanOneTargetAnnotation.java" options="-1.5"> + <!-- xlint warning that was put in as part of fix for pr115252 --> + <message kind="warning" line="28" text="does not match because annotation @MethodAndFieldAnnotation has @Target{ElementType.FIELD,ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="38" text="does not match because annotation @TypeAndMethodAnnotation has @Target{ElementType.METHOD,ElementType.TYPE} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr119019" title="no NPE when inaccessible method is called within itd"> + <compile files="bar/TargetITDClass.java,foo/ITDWithACall.aj"/> + <run class="foo.ITDWithACall"/> + </ajc-test> + + <ajc-test dir="bugs150" title="no NPE with or pointcut and more than one args"> + <compile files="PR118149.aj"/> + </ajc-test> + + <ajc-test dir="bugs150" title="no StringOutOfBoundsException with generic inner aspects"> + <compile files="PR119543.java" options="-1.5"> + <message kind="warning" line="8" text="advice defined in PR119543$A has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + </ajc-test> + + <!-- ============================================================================ --> + <!-- ============================================================================ --> + + <!-- atOverride tests with ITDs --> + + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs"> + <compile files="AtOverride.aj" options="-1.5"/> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 1"> + <compile files="AtOverride1.aj" options="-1.5"> + <message kind="error" line="9" text="The method method() of type Child must override a superclass method"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 2"> + <compile files="AtOverride2.aj" options="-1.5"/> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 3"> + <compile files="AtOverride3.aj" options="-1.5"/> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 4"> + <compile files="AtOverride4.aj" options="-1.5"/> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 5"> + <compile files="AtOverride5.aj" options="-1.5"> + <message kind="error" line="11" text="The method method() of type Child must override a superclass method"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 6"> + <compile files="AtOverride6.aj" options="-1.5"/> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 7"> + <compile files="AtOverride7.aj" options="-1.5"/> + </ajc-test> + + <!-- end of atOverride tests with ITDs --> + + <ajc-test dir="../docs/dist/doc/examples/introduction" title="introduction sample" vm="1.5"> + <compile files="CloneablePoint.java,ComparablePoint.java,HashablePoint.java,Point.java" options="-1.5 -Xlint:ignore"/> + </ajc-test> + + <ajc-test dir="java5/varargs" title="varargs in constructor sig" vm="1.5"> + <compile files="Pr88652.aj" options="-1.5"> + <message kind="warning" line="8" text="should match"/> + <message kind="warning" line="9" text="should match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" title="Varargs with .. in pointcut" vm="1.5"> + <compile files="pr93356.aj" options="-1.5"> + <message kind="warning" line="5" text="a"/> + <message kind="warning" line="5" text="b"/> + <message kind="warning" line="5" text="c"/> + <message kind="warning" line="5" text="d"/> + <message kind="warning" line="5" text="e"/> + <message kind="warning" line="5" text="k"/> + <message kind="warning" line="5" text="l"/> + + <message kind="warning" line="4" text="f"/> + <message kind="warning" line="4" text="g"/> + <message kind="warning" line="4" text="h"/> + <message kind="warning" line="4" text="i"/> + <message kind="warning" line="4" text="j"/> + + <message kind="warning" line="7" text="f"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" title="star varargs pattern" vm="1.5"> + <compile files="StarVarargsPattern.aj" options="-1.5"> + <message kind="warning" line="5" text="you used a varargs signature"/> + <message kind="warning" line="7" text="you used a varargs signature"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" title="invalid cons syntax" vm="1.5"> + <compile files="SyntaxError.aj" options="-1.5"> + <message kind="error" line="3" text="Syntax error on token "new", "method name (not constructor)" expected"/> + </compile> + </ajc-test> + + <!-- hasmethod / hasfield tests --> + + <ajc-test title="declare parents : hasmethod(..) - 1" dir="hasmember"> + <compile files="HasMethod.aj"> + <message kind="error" line="5" text="the type pattern hasmethod(* print(..)) can only be used when the -XhasMember option is set"/> + </compile> + </ajc-test> + + <ajc-test title="declare parents : hasmethod(..) - 1" dir="hasmember"> + <compile files="HasMethod.aj" options="-XhasMember"> + </compile> + <run class="HasMethod"></run> + </ajc-test> + + <ajc-test title="declare parents : hasmethod(..) - 2" dir="hasmember"> + <compile files="HasMethodInherited.aj" options="-XhasMember"> + </compile> + <run class="HasMethodInherited"></run> + </ajc-test> + + <ajc-test title="declare parents : hasmethod(..) - 3" dir="hasmember"> + <compile files="HasPrivateMethodInherited.aj" options="-XhasMember"> + </compile> + <run class="HasPrivateMethodInherited"></run> + </ajc-test> + + <ajc-test title="declare parents : hasmethod(..) - 4" dir="hasmember"> + <compile files="HasMethodViaITD.aj" options="-XhasMember"> + <message kind="warning" line="15" text="hasmethod matched on ITD ok"/> + </compile> + </ajc-test> + + <ajc-test title="declare parents : hasfield(..) - 1" dir="hasmember"> + <compile files="HasField.aj" options="-XhasMember"> + </compile> + <run class="HasField"></run> + </ajc-test> + + <ajc-test title="declare parents : hasfield(..) - 2" dir="hasmember"> + <compile files="HasFieldInherited.aj" options="-XhasMember"> + </compile> + <run class="HasFieldInherited"></run> + </ajc-test> + + <ajc-test title="declare parents : hasfield(..) - 3" dir="hasmember"> + <compile files="HasPrivateFieldInherited.aj" options="-XhasMember"> + </compile> + <run class="HasPrivateFieldInherited"></run> + </ajc-test> + + <!-- Annotation binding tests --> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 1"> + <compile files="CallAnnBinding.aj" options="-1.5"/> + <run class="CallAnnBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 2"> + <compile files="CallAnnBinding2.aj" options="-1.5"/> + <run class="CallAnnBinding2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 3"> + <compile files="CallAnnBinding3.aj" options="-1.5"/> + <run class="CallAnnBinding3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 4"> + <compile files="CallAnnBinding4.aj" options="-1.5"/> + <run class="CallAnnBinding4"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 5"> + <compile files="CallAnnBinding5.aj" options="-1.5"/> + <run class="CallAnnBinding5"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 6"> + <compile files="CallAnnBinding6.aj" options="-1.5"/> + <run class="CallAnnBinding6"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 7"> + <compile files="CallAnnBinding7.aj" options="-1.5"/> + <run class="CallAnnBinding7"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@target annotation binding 1"> + <compile files="AtTarget1.aj" options="-1.5"/> + <run class="AtTarget1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@target annotation binding 2"> + <compile files="AtTarget2.aj" options="-1.5"/> + <run class="AtTarget2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@target annotation binding 3"> + <compile files="AtTarget3.aj" options="-1.5"/> + <run class="AtTarget3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@target annotation binding 4"> + <compile files="AtTarget4.aj" options="-1.5"/> + <run class="AtTarget4"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/usingPackageNames" vm="1.5" title="@target annotation binding 5"> + <compile files="MyAspect.aj,MyAnnotation.java,MyClass.java" options="-1.5"/> + <run class="test.MyClass"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@this annotation binding 1"> + <compile files="AtThis1.aj" options="-1.5"/> + <run class="AtThis1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@this annotation binding 2"> + <compile files="AtThis2.aj" options="-1.5"/> + <run class="AtThis2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@this annotation binding 3"> + <compile files="AtThis3.aj" options="-1.5"/> + <run class="AtThis3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@this annotation binding 4"> + <compile files="AtThis4.aj" options="-1.5"/> + <run class="AtThis4"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@this annotation binding 5"> + <compile files="AtThis5.aj" options="-1.5"/> + <run class="AtThis5"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@args annotation binding 1"> + <compile files="AtArgs1.aj" options="-1.5"/> + <run class="AtArgs1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@args annotation binding 2"> + <compile files="AtArgs2.aj" options="-1.5"/> + <run class="AtArgs2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@args annotation binding 3"> + <compile files="AtArgs3.aj" options="-1.5"/> + <run class="AtArgs3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@args annotation binding 4"> + <compile files="AtArgs4.aj" options="-1.5"/> + <run class="AtArgs4"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@args annotation binding 5"> + <compile files="AtArgs5.aj" options="-1.5"/> + <run class="AtArgs5"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="execution and @annotation"> + <compile files="ExecutionAnnBinding1.aj" options="-1.5"/> + <run class="ExecutionAnnBinding1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="set and @annotation"> + <compile files="FieldAnnBinding1.aj" options="-1.5"/> + <run class="FieldAnnBinding1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="get and @annotation"> + <compile files="FieldAnnBinding2.aj" options="-1.5"/> + <run class="FieldAnnBinding2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="get and @annotation with arrays"> + <compile files="FieldAnnBinding3.aj" options="-1.5"/> + <run class="FieldAnnBinding3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="cons call and @annotation"> + <compile files="CtorAnnBinding1.aj" options="-1.5"/> + <run class="CtorAnnBinding1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="cons exe and @annotation"> + <compile files="CtorAnnBinding2.aj" options="-1.5"/> + <run class="CtorAnnBinding2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="staticinit and @annotation"> + <compile files="StaticInitBinding.aj" options="-1.5"/> + <run class="StaticInitBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="preinit and @annotation"> + <compile files="PreInitBinding.aj" options="-1.5"/> + <run class="PreInitBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="init and @annotation"> + <compile files="InitBinding.aj" options="-1.5"/> + <run class="InitBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="adviceexecution and @annotation"> + <compile files="AdviceExecBinding.aj" options="-1.5"/> + <run class="AdviceExecBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="handler and @annotation"> + <compile files="HandlerBinding.aj" options="-1.5"/> + <run class="HandlerBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@withincode() and call(* println(..))"> + <compile files="WithinCodeBinding1.aj" options="-1.5"/> + <run class="WithinCodeBinding1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@within"> + <compile files="WithinBinding1.aj" options="-1.5"/> + <run class="WithinBinding1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@within - multiple types"> + <compile files="WithinBinding2.aj" options="-1.5"/> + <run class="WithinBinding2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/complexExample" vm="1.5" title="packages and no binding"> + <compile files="A.java,B.java,Color.java,X.java" options="-1.5"/> + <run class="a.b.c.A"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/complexExample" vm="1.5" title="packages and binding"> + <compile files="A.java,B.java,Color.java,X2.java" options="-1.5"/> + <run class="a.b.c.A"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="binding with static methods"> + <compile files="StaticMethods.java" options="-1.5"/> + <run class="StaticMethods"/> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="annotation matching on call"> + <weave classesFiles="AnnotatedType.java,SimpleAnnotation.java,SimpleAnnotation2.java" + aspectsFiles="AnnotationAspect02.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AnnotatedType' (AnnotatedType.java:3) advised by before advice from 'AnnotationAspect02' (aspects.jar!AnnotationAspect02.class:4(from AnnotationAspect02.aj))"/> + <message kind="weave" text="Type 'AnnotatedType' (AnnotatedType.java:3) advised by before advice from 'AnnotationAspect02' (aspects.jar!AnnotationAspect02.class:2(from AnnotationAspect02.aj))"/> + <message kind="weave" text="Type 'AnnotatedType' (AnnotatedType.java:4) advised by before advice from 'AnnotationAspect02' (aspects.jar!AnnotationAspect02.class:4(from AnnotationAspect02.aj))"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="at annotation matching"> + <weave classesFiles="AnnotatedType.java,SimpleAnnotation.java,SimpleAnnotation2.java" + aspectsFiles="AnnotationAspect03.aj" + options="-1.5,-showWeaveInfo"> + <message kind="warning" line="8" text="@annotation matched here"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/within_code" vm="1.5" title="annotations and within(code)"> + <weave classesFiles="TestingAnnotations.java" + aspectsFiles="WithinAndWithinCodeTests.java" + options="-1.5,-showWeaveInfo"> + <message kind="warning" line="31" text="@within match on non-inherited annotation"/> + <message kind="warning" line="39" text="@within match on non-inherited annotation"/> + <message kind="warning" line="39" text="@within match on inheritable annotation"/> + <message kind="warning" line="43" text="@within match on inheritable annotation"/> + <message kind="warning" line="32" text="@withincode match"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/within" vm="1.5" title="annotations and within"> + <weave classesFiles="PlainWithin.java" + aspectsFiles="PlainWithinTests.java" + options="-1.5,-showWeaveInfo"> + <message kind="warning" line="21" text="positive within match on annotation"/> + <message kind="warning" line="25" text="negative within match on annotation"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/thisOrtarget" vm="1.5" title="must have runtime retention"> + <compile options="-1.5" files="NotRuntimeRetention.aj"> + <message kind="error" line="20" text="Annotation type MySourceAnnotation does not have runtime retention"/> + <message kind="error" line="21" text="Annotation type MyClassAnnotation does not have runtime retention"/> + <message kind="error" line="22" text="Annotation type MyAnnotation does not have runtime retention"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/thisOrtarget" vm="1.5" title="inheritable or not"> + <compile options="-1.5" files="TestingAnnotations.java,ThisOrTargetTests.aj"> + </compile> + <run class="TestingAnnotations"/> + </ajc-test> + + <ajc-test dir="java5/annotations/thisOrtarget" vm="1.5" title="use of @this/target in deow"> + <compile options="-1.5" files="TestingAnnotations.java,DeclareEoW.java"> + <message kind="error" line="3" text="this() pointcut designator cannot be used in declare statement"/> + <message kind="error" line="5" text="target() pointcut designator cannot be used in declare statement"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/args" vm="1.5" title="@args tests"> + <compile options="-1.5" files="TestingArgsAnnotations.java,AtArgsAspect.java"> + </compile> + <run class="TestingArgsAnnotations"/> + </ajc-test> + + <ajc-test dir="java5/annotations/args" vm="1.5" title="use of @args in deow"> + <compile options="-1.5" files="TestingArgsAnnotations.java,DeclareEoW.java"> + <message kind="error" line="3" text="args() pointcut designator cannot be used in declare statement"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="compiling an annotation"> + <compile options="-1.5" files="SimpleAnnotation.java"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="compiling annotated file"> + <compile options="-1.5" files="SimpleAnnotation.java,AnnotatedType.java"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/within" vm="1.5" title="annotations and within (src)"> + <compile files="PlainWithin.java,PlainWithinTests.java" + aspectsFiles="PlainWithinTests.java" + options="-1.5"> + <message kind="warning" line="21" text="positive within match on annotation"/> + <message kind="warning" line="25" text="negative within match on annotation"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/attarget" vm="1.5" title="losing annotations..."> + <compile options="-1.5" files="Program.java,AtTargetAspect.java"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="no itds on annotation types"> + <compile files="AnnotatedType.java,SimpleAnnotation.java,SimpleAnnotation2.java,AnnotationAspect01.aj" + options="-1.5"> + <message kind="error" line="4" text="can't make inter-type constructor declarations"/> + <message kind="error" line="8" text="can't make inter-type method declarations"/> + <message kind="error" line="13" text="can't make inter-type field declarations"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="no declare parents on annotation types"> + <compile files="AnnotatedType.java,SimpleAnnotation.java,SimpleAnnotation2.java,AnnotationAspect04.aj" + options="-1.5"> + <message kind="error" line="7" text="can't use declare parents to alter supertype of annotation type SimpleAnnotation"/> + <message kind="error" line="10" text="can't use declare parents to make 'java.lang.annotation.Annotation' the parent of type"/> + <message kind="error" line="4" text="can't use declare parents to make annotation type SimpleAnnotation implement an interface"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="declare parents wildcards matching annotation types"> + <compile files="AnnotatedType.java,SimpleAnnotation.java,SimpleAnnotation2.java,AnnotationAspect05.aj" + options="-1.5"> + <message kind="warning" line="4" text="annotation type SimpleAnnotation2 matches a declare parents type pattern but is being ignored"/> + <message kind="warning" line="4" text="annotation type SimpleAnnotation matches a declare parents type pattern but is being ignored"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/complexExample" vm="1.5" title="annotated any pattern"> + <compile files="A.java,B.java,C.java,Color.java,X3.java" + options="-1.5"> + </compile> + <run class="g.h.i.C"/> + <run class="a.b.c.A"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/complexExample" vm="1.5" title="annotation not imported"> + <compile files="A.java,B.java,C.java,Color.java,X4.java" + options="-1.5"> + <message kind="warning" line="6" text="no match for this type name: Color"/> + </compile> + <run class="a.b.c.A"/> + </ajc-test> + + <ajc-test dir="java5/annotations/itds" vm="1.5" title="annotated public itds"> + <compile files="AtItd2.aj" options="-1.5"/> + <run class="AtItd2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/itds" vm="1.5" title="annotated public itds - values"> + <compile files="AtItd3.aj" options="-1.5"/> + <run class="AtItd3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/itds" vm="1.5" title="annotated public itds - multiple complex annotations"> + <compile files="AtItd4.aj" options="-1.5"/> + <run class="AtItd4"/> + </ajc-test> + + + <ajc-test dir="java5/annotations/itds" vm="1.5" title="nasty annotation and itds test"> + <compile files="AnnotationsAndITDs.aj" options="-1.5"> + <!-- first two are ITCs, second two are ITCs annotated via declare @ctor, third is default ctor --> + <message kind="warning" line="17" text="execution(@SomeAnnotation ...new(..)"/> + <message kind="warning" line="20" text="execution(@SomeAnnotation ...new(..)"/> + <message kind="warning" line="45" text="execution(@SomeAnnotation ...new(..)"/> + <message kind="warning" line="46" text="execution(@SomeAnnotation ...new(..)"/> + <message kind="warning" line="180" text="execution(@SomeAnnotation ...new(..)"/> + + <!-- first four are fields annotated via declare, last two are directly annotated ITDs --> + <message kind="warning" line="59" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="60" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="70" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="71" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="76" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="77" text="set(@SomeAnnotation...)"/> + + <!-- annotations added via declare --> + <message kind="warning" line="175" text="si(@SomeAnnotation...)"/> + <message kind="warning" line="180" text="si(@SomeAnnotation...)"/> + + <message kind="warning" line="25" text="execution(@SomeAnnotation ...)"/> + <message kind="warning" line="28" text="execution(@SomeAnnotation ...)"/> + <message kind="warning" line="52" text="execution(@SomeAnnotation ...)"/> + <message kind="warning" line="53" text="execution(@SomeAnnotation ...)"/> + <!--message kind="warning" line="70" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="71" text="set(@SomeAnnotation...)"/--> + </compile> + <run class="AnnotationsAndITDs"> + <stderr> + <line text="@type java.lang.System (AnnotationsAndITDs.aj:0)"/> + <line text="hello AnnotationsAndITDs (AnnotationsAndITDs.aj:17)"/> + <line text="goodbye java.lang.String (AnnotationsAndITDs.aj:20)"/> + <line text="goodbye java.lang.String (AnnotationsAndITDs.aj:20)"/> + <line text="y java.lang.Integer (AnnotationsAndITDs.aj:28)"/> + <line text="d java.lang.Double (AnnotationsAndITDs.aj:70)"/> + <line text="f java.lang.Double (AnnotationsAndITDs.aj:71)"/> + <line text="@type java.lang.System (AnnotationsAndITDs.aj:0)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:59)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:60)"/> + <line text="@cons java.lang.String (AnnotationsAndITDs.aj:45)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:59)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:60)"/> + <line text="@cons java.lang.String (AnnotationsAndITDs.aj:46)"/> + <line text="@cons java.lang.String (AnnotationsAndITDs.aj:46)"/> + <line text="@method ITDMe2 (AnnotationsAndITDs.aj:53)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:76)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:77)"/> + + <!-- + <line text="method bar has 1 params, first param annotation is @ParamAnnotation"/> + --> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" pr="91858" title="declare @Type (should be @type)"> + <compile files="DeathByPoorSpelling.aj" options="-1.5"> + <message kind="error" line="6" text="Syntax error on token ":", "one of type, method, field, constructor" expected"/> + </compile> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- Autoboxing tests --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="simple boxing test"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,SimpleAutoboxingAspect.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'SimpleAutoboxing' (SimpleAutoboxing.java:7) advised by before advice from 'SimpleAutoboxingAspect' (SimpleAutoboxingAspect.aj:8)"/> + <message kind="weave" text="Type 'SimpleAutoboxing' (SimpleAutoboxing.java:7) advised by before advice from 'SimpleAutoboxingAspect' (SimpleAutoboxingAspect.aj:4)"/> + </compile> + <run class="SimpleAutoboxing"> + <stderr> + <line text="Matching by Integer:20000"/> + <line text="Matching by int:20000"/> + <line text="method_takes_Integer=20000"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="integer boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectInteger.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:11) advised by before advice from 'AspectInteger' (AspectInteger.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:11) advised by before advice from 'AspectInteger' (AspectInteger.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:12) advised by before advice from 'AspectInteger' (AspectInteger.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:12) advised by before advice from 'AspectInteger' (AspectInteger.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:13) advised by before advice from 'AspectInteger' (AspectInteger.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:13) advised by before advice from 'AspectInteger' (AspectInteger.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:14) advised by before advice from 'AspectInteger' (AspectInteger.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:14) advised by before advice from 'AspectInteger' (AspectInteger.aj:4)"/> + </compile> + <run class="AutoboxingI"> + <stderr> + <line text="Matching by Integer:10000"/> + <line text="Matching by int:10000"/> + <line text="method_takes_Integer=10000"/> + <line text="Matching by Integer:20000"/> + <line text="Matching by int:20000"/> + <line text="method_takes_Integer=20000"/> + <line text="Matching by Integer:30000"/> + <line text="Matching by int:30000"/> + <line text="method_takes_int=30000"/> + <line text="Matching by Integer:40000"/> + <line text="Matching by int:40000"/> + <line text="method_takes_int=40000"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="char boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectChar.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:11) advised by before advice from 'AspectChar' (AspectChar.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:11) advised by before advice from 'AspectChar' (AspectChar.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:12) advised by before advice from 'AspectChar' (AspectChar.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:12) advised by before advice from 'AspectChar' (AspectChar.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:13) advised by before advice from 'AspectChar' (AspectChar.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:13) advised by before advice from 'AspectChar' (AspectChar.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:14) advised by before advice from 'AspectChar' (AspectChar.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:14) advised by before advice from 'AspectChar' (AspectChar.aj:4)"/> + </compile> + <run class="AutoboxingC"> + <stderr> + <line text="Character:1"/> + <line text="char:1"/> + <line text="method_takes_Character=1"/> + <line text="Character:2"/> + <line text="char:2"/> + <line text="method_takes_Character=2"/> + <line text="Character:3"/> + <line text="char:3"/> + <line text="method_takes_char=3"/> + <line text="Character:4"/> + <line text="char:4"/> + <line text="method_takes_char=4"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="double boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectDouble.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:11) advised by before advice from 'AspectDouble' (AspectDouble.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:11) advised by before advice from 'AspectDouble' (AspectDouble.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:12) advised by before advice from 'AspectDouble' (AspectDouble.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:12) advised by before advice from 'AspectDouble' (AspectDouble.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:13) advised by before advice from 'AspectDouble' (AspectDouble.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:13) advised by before advice from 'AspectDouble' (AspectDouble.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:14) advised by before advice from 'AspectDouble' (AspectDouble.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:14) advised by before advice from 'AspectDouble' (AspectDouble.aj:4)"/> + </compile> + <run class="AutoboxingD"> + <stderr> + <line text="Double:100.0"/> + <line text="double:100.0"/> + <line text="method_takes_Double=100.0"/> + <line text="Double:200.0"/> + <line text="double:200.0"/> + <line text="method_takes_Double=200.0"/> + <line text="Double:300.0"/> + <line text="double:300.0"/> + <line text="method_takes_double=300.0"/> + <line text="Double:400.0"/> + <line text="double:400.0"/> + <line text="method_takes_double=400.0"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="float boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectFloat.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:11) advised by before advice from 'AspectFloat' (AspectFloat.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:11) advised by before advice from 'AspectFloat' (AspectFloat.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:12) advised by before advice from 'AspectFloat' (AspectFloat.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:12) advised by before advice from 'AspectFloat' (AspectFloat.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:13) advised by before advice from 'AspectFloat' (AspectFloat.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:13) advised by before advice from 'AspectFloat' (AspectFloat.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:14) advised by before advice from 'AspectFloat' (AspectFloat.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:14) advised by before advice from 'AspectFloat' (AspectFloat.aj:4)"/> + </compile> + <run class="AutoboxingF"> + <stderr> + <line text="Float:100.0"/> + <line text="float:100.0"/> + <line text="method_takes_Float=100.0"/> + <line text="Float:200.0"/> + <line text="float:200.0"/> + <line text="method_takes_Float=200.0"/> + <line text="Float:300.0"/> + <line text="float:300.0"/> + <line text="method_takes_float=300.0"/> + <line text="Float:400.0"/> + <line text="float:400.0"/> + <line text="method_takes_float=400.0"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="short boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectShort.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:11) advised by before advice from 'AspectShort' (AspectShort.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:11) advised by before advice from 'AspectShort' (AspectShort.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:12) advised by before advice from 'AspectShort' (AspectShort.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:12) advised by before advice from 'AspectShort' (AspectShort.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:13) advised by before advice from 'AspectShort' (AspectShort.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:13) advised by before advice from 'AspectShort' (AspectShort.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:14) advised by before advice from 'AspectShort' (AspectShort.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:14) advised by before advice from 'AspectShort' (AspectShort.aj:4)"/> + </compile> + <run class="AutoboxingS"> + <stderr> + <line text="Short:100"/> + <line text="short:100"/> + <line text="method_takes_Short=100"/> + <line text="Short:200"/> + <line text="short:200"/> + <line text="method_takes_Short=200"/> + <line text="Short:300"/> + <line text="short:300"/> + <line text="method_takes_short=300"/> + <line text="Short:400"/> + <line text="short:400"/> + <line text="method_takes_short=400"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="long boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectLong.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:11) advised by before advice from 'AspectLong' (AspectLong.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:11) advised by before advice from 'AspectLong' (AspectLong.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:12) advised by before advice from 'AspectLong' (AspectLong.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:12) advised by before advice from 'AspectLong' (AspectLong.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:13) advised by before advice from 'AspectLong' (AspectLong.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:13) advised by before advice from 'AspectLong' (AspectLong.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:14) advised by before advice from 'AspectLong' (AspectLong.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:14) advised by before advice from 'AspectLong' (AspectLong.aj:4)"/> + </compile> + <run class="AutoboxingJ"> + <stderr> + <line text="Long:1000000"/> + <line text="long:1000000"/> + <line text="method_takes_Long=1000000"/> + <line text="Long:2000000"/> + <line text="long:2000000"/> + <line text="method_takes_Long=2000000"/> + <line text="Long:3000000"/> + <line text="long:3000000"/> + <line text="method_takes_long=3000000"/> + <line text="Long:4000000"/> + <line text="long:4000000"/> + <line text="method_takes_long=4000000"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="boolean boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectBoolean.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:9) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:9) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:10) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:10) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:11) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:11) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:12) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:12) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:4)"/> + </compile> + <run class="AutoboxingZ"> + <stderr> + <line text="Boolean:false"/> + <line text="boolean:false"/> + <line text="method_takes_Boolean=false"/> + <line text="Boolean:false"/> + <line text="boolean:false"/> + <line text="method_takes_Boolean=false"/> + <line text="Boolean:false"/> + <line text="boolean:false"/> + <line text="method_takes_boolean=false"/> + <line text="Boolean:false"/> + <line text="boolean:false"/> + <line text="method_takes_boolean=false"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="byte boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectByte.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:11) advised by before advice from 'AspectByte' (AspectByte.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:11) advised by before advice from 'AspectByte' (AspectByte.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:12) advised by before advice from 'AspectByte' (AspectByte.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:12) advised by before advice from 'AspectByte' (AspectByte.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:13) advised by before advice from 'AspectByte' (AspectByte.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:13) advised by before advice from 'AspectByte' (AspectByte.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:14) advised by before advice from 'AspectByte' (AspectByte.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:14) advised by before advice from 'AspectByte' (AspectByte.aj:4)"/> + </compile> + <run class="AutoboxingB"> + <stderr> + <line text="Byte:1"/> + <line text="byte:1"/> + <line text="method_takes_Byte=1"/> + <line text="Byte:50"/> + <line text="byte:50"/> + <line text="method_takes_Byte=50"/> + <line text="Byte:3"/> + <line text="byte:3"/> + <line text="method_takes_byte=3"/> + <line text="Byte:52"/> + <line text="byte:52"/> + <line text="method_takes_byte=52"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="boxing in after returning"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectAfterReturning.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:18) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:4)"/> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:18) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:8)"/> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:18) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:12)"/> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:19) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:4)"/> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:19) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:8)"/> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:19) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:12)"/> + </compile> + <run class="AspectAfterReturning"> + <stderr> + <line text="Returning I=5"/> + <line text="Returning Integer=5"/> + <line text="Returning Object=5"/> + <line text="Returning I=10"/> + <line text="Returning Integer=10"/> + <line text="Returning Object=10"/> + </stderr> + </run> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- Covariance tests --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 1"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect01.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:26) advised by before advice from 'CovAspect01' (CovAspect01.aj:5)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect01' (CovAspect01.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 2"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect02.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:26) advised by before advice from 'CovAspect02' (CovAspect02.aj:5)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect02' (CovAspect02.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 3"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect03.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:26) advised by before advice from 'CovAspect03' (CovAspect03.aj:5)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect03' (CovAspect03.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 4"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram02.java,CovAspect04.aj"> + <message kind="weave" text="Type 'CovBaseProgram02' (CovBaseProgram02.java:30) advised by before advice from 'CovAspect04' (CovAspect04.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 5"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect05.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:26) advised by before advice from 'CovAspect05' (CovAspect05.aj:5)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect05' (CovAspect05.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 6"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect06.aj"> + <message kind="warning" line="3" text="does not match because declaring type is Super"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 7"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect07.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect07' (CovAspect07.aj:5)"/> + <message kind="warning" line="3" text="does not match because declaring type is Super"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 8"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect08.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect08' (CovAspect08.aj:11)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect08' (CovAspect08.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 9"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect09.aj"> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 10"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect10.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:26) advised by before advice from 'CovAspect10' (CovAspect10.aj:5)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect10' (CovAspect10.aj:5)"/> + </compile> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- Enum tests --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/enums" vm="1.5" title="cant itd constructor on enum"> + <compile files="SimpleEnum.java,SimpleEnum2.java,EnumAspect01.aj" options="-1.5"> + <message kind="error" line="2" text="can't make inter-type constructor declarations on enum types"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/enums" vm="1.5" title="cant itd field or method on enum"> + <compile files="SimpleEnum.java,SimpleEnum2.java,EnumAspect02.aj" options="-1.5"> + <message kind="error" line="2" text="can't make inter-type method declarations on enum types"/> + <message kind="error" line="6" text="can't make inter-type field declarations on enum types"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/enums" vm="1.5" title="declare parents and enums"> + <compile files="SimpleEnum.java,SimpleEnum2.java,EnumAspect03.aj" options="-1.5"> + <message kind="error" line="5" text="can't use declare parents to make enum type SimpleEnum implement an interface"/> + <message kind="error" line="8" text="can't use declare parents to alter supertype of enum type SimpleEnum"/> + <message kind="error" line="11" text="can't use declare parents to make 'java.lang.Enum' the parent of type EnumAspect03$D"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/enums" vm="1.5" title="wildcard enum match in itd"> + <compile files="SimpleEnum.java,SimpleEnum2.java,EnumAspect04.aj" options="-1.5"> + <message kind="warning" line="5" text="enum type SimpleEnum2 matches a declare parents type pattern but is being ignored"/> + <message kind="warning" line="5" text="enum type SimpleEnum matches a declare parents type pattern but is being ignored"/> + </compile> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- pertypewithin tests --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/pertypewithin" title="basic ptw test"> + <compile files="A.java,B.java,C.java,D.java,Main.java,X.java" options="-Xlint:ignore"/> + <run class="p.A"> + <stderr> + <line text="hi from A"/> + <line text="after() returning from a method call to sayhi()"/> + <line text="hi from A"/> + <line text="after() returning from a method call to sayhi()"/> + <line text="Tests in A have passed"/> + <line text="callcount = 2"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/pertypewithin" title="ptw hasAspect"> + <compile files="A.java,B.java,C.java,D.java,Main.java,X.java" options="-Xlint:ignore"/> + <run class="p.B"> + <stderr> + <line text="hi from B"/> + <line text="after() returning from a method call to sayhi()"/> + <line text="hi from B"/> + <line text="after() returning from a method call to sayhi()"/> + <line text="hi from B"/> + <line text="after() returning from a method call to sayhi()"/> + <line text="callcount = 3"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/pertypewithin" title="ptw aspectOf"> + <compile files="A.java,B.java,C.java,D.java,Main.java,X.java" options="-Xlint:ignore"/> + <run class="p.C"/> + </ajc-test> + + <ajc-test dir="java5/pertypewithin" title="ptw multi-aspects"> + <compile files="P.java,Q.java,R.java"/> + <run class="P"> + <stderr> + <line text="Q reporting 2"/> + <line text="R reporting 3"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/pertypewithin" title="ptw binary"> + <weave classesFiles="G.java" aspectsFiles="H.java" options="-1.4"/> + <run class="G"> + <stderr> + <line text="advice running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/pertypewithin" title="ptw binary aspect"> + <compile files="H.java" outjar="aspects.jar" options="-1.4"> + <message kind="warning" line="1" text="no match for this type name: G"/> + </compile> + <compile files="G.java" aspectpath="aspects.jar"/> + <run class="G"> + <stderr> + <line text="advice running"/> + </stderr> + </run> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- varargs tests --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/varargs" vm="1.5" title="varargs not matched by Object[] (call)"> + <compile files="SimpleVarargs.java,VarargsAspect01.aj" options="-1.5,-showWeaveInfo"> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" vm="1.5" title="varargs not matched by Object[] (exe)"> + <compile files="SimpleVarargs.java,VarargsAspect02.aj" options="-1.5,-showWeaveInfo"> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" vm="1.5" title="varargs not matched by Object[] (init)"> + <compile files="SimpleVarargs.java,VarargsAspect03.aj" options="-1.5,-showWeaveInfo"> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" vm="1.5" title="varargs not matched by Object[] (withincode)"> + <compile files="SimpleVarargs.java,VarargsAspect04.aj" options="-1.5,-showWeaveInfo"> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" vm="1.5" title="call with varargs signature"> + <compile files="SimpleVarargs.java,VarargsAspect05.aj" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:20) advised by before advice from 'VarargsAspect05' (VarargsAspect05.aj:3)"/> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:21) advised by before advice from 'VarargsAspect05' (VarargsAspect05.aj:3)"/> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:22) advised by before advice from 'VarargsAspect05' (VarargsAspect05.aj:3)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" vm="1.5" title="call with varargs multi-signature"> + <compile files="SimpleVarargs.java,VarargsAspect06.aj" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:25) advised by before advice from 'VarargsAspect06' (VarargsAspect06.aj:3)"/> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:26) advised by before advice from 'VarargsAspect06' (VarargsAspect06.aj:3)"/> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:27) advised by before advice from 'VarargsAspect06' (VarargsAspect06.aj:3)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/suppressedWarnings" vm="1.5" title="suppressing non-matching advice warnings"> + <compile files="Suppression1.aj" options="-1.5,-showWeaveInfo"> + <message kind="warning" line="13"/> + <message kind="warning" line="21"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/suppressedWarnings" vm="1.5" title="suppressing non-matching advice warnings when multiple source files involved"> + <compile files="A.java,A1.aj,A2.aj,A3.aj" options="-1.5,-showWeaveInfo"> + <message kind="warning" line="4" file="A1.aj"/> + <message kind="warning" line="4" file="A2.aj"/> + <message kind="warning" line="11" file="A2.aj"/> + <message kind="warning" line="4" file="A3.aj"/> + <message kind="warning" line="11" file="A3.aj"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="XLint warning for advice not applied with cflow(execution)" pr="93345"> + <compile options="-Xlint,-1.5" files="PR93345.aj" > + <message kind="warning" line="9" text="advice defined in AnAspect has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="NPE in reflect implementation" pr="94167"> + <compile files="PR94167.java"/> + <run class="reflect.PR94167"/> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- annotated aspect members --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated annotations (@Target)"> + <compile files="a/Annotations.java,a/Foo.java" options="-1.5"> + <message kind="error" line="16" text="The annotation @MethodAnnotation is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="simple annotated aspect members"> + <compile files="a/Annotations.java,a/AnnotatedAspect.aj" options="-1.5"> + <message kind="warning" line="4" text="annotated type"/> + <message kind="warning" line="6" text="annotated field"/> + <message kind="warning" line="8" text="annotated method"/> + <message kind="warning" line="11" text="annotated constructor"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="simple annotated aspect members with bad target"> + <compile files="a/Annotations.java,a/AnnotatedAspect02.aj" options="-1.5"> + <message kind="error" line="3" text="The annotation @MethodAnnotation is disallowed for this location"/> + <message kind="error" line="6" text="The annotation @TypeAnnotation is disallowed for this location"/> + <message kind="error" line="8" text="The annotation @FieldAnnotation is disallowed for this location"/> + <message kind="error" line="10" text="The annotation @AnnotationAnnotation is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated itds"> + <compile files="a/Annotations.java,a/AnnotatedAspect03.aj" options="-1.5"> + <message kind="warning" line="4" text="annotated type"/> + <message kind="warning" line="6" text="annotated field"/> + <message kind="warning" line="8" text="annotated field"/> + <message kind="warning" line="10" text="annotated method"/> + <message kind="warning" line="12" text="annotated constructor"/> + <message kind="warning" line="12" text="annotated field"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated itds with bad target"> + <compile files="a/Annotations.java,a/AnnotatedAspect04.aj" options="-1.5"> + <message kind="error" line="6" text="The annotation @ConstructorAnnotation is disallowed for this location"/> + <message kind="error" line="8" text="The annotation @FieldAnnotation is disallowed for this location"/> + <message kind="error" line="10" text="The annotation @TypeAnnotation is disallowed for this location"/> + <!-- known limitation... + <message kind="error" line="12" text="The annotation @MethodAnnotation is disallowed for this location"/> + --> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated advice"> + <compile files="a/Annotations.java,a/AnnotatedAspect05.aj" options="-1.5"> + <message kind="warning" line="17"/> + </compile> + <run class="a.AnnotatedAspect05"/> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated advice with bad target"> + <compile files="a/Annotations.java,a/AnnotatedAspect06.aj" options="-1.5"> + <message kind="error" line="6" text="The annotation @ConstructorAnnotation is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated pointcut"> + <compile files="a/Annotations.java,a/AnnotatedAspect07.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated declare statements"> + <compile files="a/Annotations.java,a/AnnotatedAspect08.aj" options="-1.5"> + </compile> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- ajdk examples --> + <!-- ======================================================================================= --> + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotating aspects chapter"> + <compile files="AnnotatingAspects.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotating aspects chapter, ex 2"> + <compile files="SuppressAj.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotation pattern matching"> + <compile files="AnnotationPatternMatching.aj,org/xyz/OrgXYZAnnotation.java" options="-1.5"> + <message kind="warning" line="25" text="@Immutable"/> + <message kind="warning" line="25" text="!@Persistent"/> + <message kind="warning" line="29" text="!@Persistent"/> + <message kind="warning" line="31" text="!@Persistent"/> + <message kind="warning" line="33" text="!@Persistent"/> + <message kind="warning" line="29" text="@Foo @Goo"/> + <message kind="warning" line="29" text="@(Foo || Goo)"/> + <message kind="warning" line="31" text="@(Foo || Goo)"/> + <message kind="warning" line="33" text="@(org.xyz..*)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotation type pattern matching"> + <compile files="AnnotationsInTypePatterns.aj,org/xyz/OrgXYZAnnotation.java,org/xyz/Types.java,org/abc/Types.java,anns/Immutable.java,anns/NonPersistent.java" options="-1.5"> + <message kind="warning" line="23" text="(@Immutable *)"/> + <message kind="warning" line="32" text="(@Immutable *)"/> + <message kind="warning" line="3" text="(@Immutable *)"/> + <message kind="warning" line="5" text="(@Immutable *)"/> + <message kind="warning" line="8" text="(@Immutable *)"/> + <message kind="warning" line="25" text="(!@Immutable *)"/> + <message kind="warning" line="27" text="(!@Immutable *)"/> + <message kind="warning" line="29" text="(!@Immutable *)"/> + <message kind="warning" line="5" text="(!@Immutable *)"/> + <message kind="warning" line="6" text="(!@Immutable *)"/> + <message kind="warning" line="2" text="(!@Immutable *)"/> + <message kind="warning" line="2" text="(!@Immutable *)"/> + <message kind="warning" line="5" text="(!@Immutable *)"/> + <message kind="warning" line="3" text="@Immutable (org.xyz.* || org.abc.*)"/> + <message kind="warning" line="5" text="@Immutable (org.xyz.* || org.abc.*)"/> + <message kind="warning" line="8" text="@Immutable (org.xyz.* || org.abc.*)"/> + <message kind="warning" line="32" text="((@Immutable Foo+) || Goo)"/> + <message kind="warning" line="27" text="((@Immutable Foo+) || Goo)"/> + <message kind="warning" line="3" text="@(Immutable || NonPersistent) org.xyz..*"/> + <message kind="warning" line="6" text="@(Immutable || NonPersistent) org.xyz..*"/> + <message kind="warning" line="8" text="@(Immutable || NonPersistent) org.xyz..*"/> + <message kind="warning" line="8" text="@Immutable @NonPersistent org.xyz..*"/> + <message kind="warning" line="6" text="@(@Inherited *) org.xyz..*"/> + <message kind="warning" line="8" text="@(@Inherited *) org.xyz..*"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotations in sig patterns"> + <compile files="AnnotationsInSignaturePatterns.aj,anns/Cachable.java,anns/SensitiveData.java,anns/Persisted.java,Classified.java,anns/Immutable.java,Secure.java,Catastrophic.java,Oneway.java,anns/Transaction.java,org/xyz/SignatureTypes.java" options="-1.5"> + <message kind="warning" line="32" text="@SensitiveData * *"/> + <message kind="warning" line="7" text="@SensitiveData * *"/> + <message kind="warning" line="13" text="@SensitiveData * *"/> + <message kind="warning" line="7" text="@SensitiveData List org.xyz..*.*"/> + <message kind="warning" line="11" text="(@SensitiveData *) org.xyz..*.*"/> + <message kind="warning" line="13" text="(@SensitiveData *) org.xyz..*.*"/> + <message kind="warning" line="50" text="@Foo (@Goo *) (@Hoo *).*"/> + <message kind="warning" line="38" text="@Persisted @Classified * *"/> + + <message kind="warning" line="44" text="@Oneway * *(..)"/> + <message kind="warning" line="18" text="@Transaction * (@Persisted org.xyz..*).*(..)"/> + <message kind="warning" line="52" text="* *.*(@Immutable *,..)"/> + <message kind="warning" line="53" text="* *.*(@Immutable *,..)"/> + <message kind="warning" line="54" text="* *.*(@Immutable *,..)"/> + + <message kind="warning" line="62" text="within(@Secure *)"/> + <message kind="warning" line="63" text="within(@Secure *)"/> + <message kind="warning" line="66" text="staticinitialization(@Persisted *)"/> + <message kind="warning" line="17" text="staticinitialization(@Persisted *)"/> + <message kind="warning" line="56" text="call(@Oneway * *(..))"/> + <message kind="warning" line="28" text="execution(public (@Immutable *) org.xyz..*.*(..))"/> + <message kind="warning" line="26" text="set(@Cachable * *)"/> + <message kind="warning" line="80" text="handler(!@Catastrophic *)"/> + + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: runtime annotations"> + <compile files="RuntimeTypeMatching.aj" options="-1.5"> + <message kind="warning" line="121" text="@within(Foo)"/> + <message kind="warning" line="122" text="@within(Foo)"/> + </compile> + <run class="RuntimeTypeMatching"> + <stdout> + <line text="This information is TOP-SECRET"/> + <line text="@target(Classified) at call(void A.a())"/> + <line text="@this(Foo) at execution(void B.b())"/> + <line text="Classified data being passed at call(void B.callA(A))"/> + <line text="Classified data being passed at execution(void B.callA(A))"/> + <line text="This information is TOP-SECRET"/> + <line text="@target(Classified) at call(Class java.lang.Object.getClass())"/> + <line text="1 @Foo()"/> + <line text="1 @Foo()"/> + <line text="1 @Classified(classification=TOP-SECRET)" vm="1.5,1.6,1.7,1.8"/> + <line text="1 @Classified(classification="TOP-SECRET")" vm="9+"/> + <line text="This information is TOP-SECRET"/> + <line text="Entering critical join point with priority 3"/> + <line text="Entering critical join point with reflectively obtained priority 3"/> + <line text="@target(Classified) at call(void A.a())"/> + <line text="@this(Foo) at execution(void B.callA(A))"/> + <line text="(Class) Transaction required at execution(void ByeByeEJB.method1())"/> + <line text="(Method) Transaction required at execution(void ByeByeEJB.method1())"/> + <line text="(Class) Transaction required at execution(void ByeByeEJB.method2())"/> + <line text="(Method) Transaction required at execution(void ByeByeEJB.method2())"/> + <line text="(Class) Transaction required at execution(void ByeByeEJB.method3())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: @retention checking"> + <compile files="RetentionTime.aj" options="-1.5"> + <message kind="error" line="8" text="Annotation type Goo does not have runtime retention"/> + <message kind="error" line="13" text="Annotation type Goo does not have runtime retention"/> + <message kind="error" line="18" text="Annotation type Goo does not have runtime retention"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: @inherited"> + <compile files="AnnotationInheritance.aj" options="-1.5"> + <message kind="warning" line="16" text="annotatedMethodCall()"/> + <!-- <message kind="warning" line="17" text="annotatedMethodCall()"/> --> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: deow-ann"> + <compile files="DeclaresWithAnnotations.aj,org/xyz/model/Model.java" options="-1.5"> + <message kind="warning" line="27" text="Expensive operation called from within performance critical section"/> + <message kind="error" line="26" text="Untrusted code should not call the model classes directly"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: decp-ann"> + <compile files="DecpAnnotations.aj" options="-1.5"> + </compile> + <run class="DecpAnnotations"> + <stdout> + <line text="Test Foo is not secured: PASS"/> + <line text="Test Goo is secured: PASS"/> + <line text="goo credentials: none"/> + <line text="Test BankAccount is not secured: PASS"/> + <line text="Test PrivateBankAccount is not secured: PASS"/> + <line text="Test BusinessBankAccount is secured: PASS"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: dec precedence"> + <compile files="PrecedenceAnnotations.aj" options="-1.5"> + </compile> + <run class="PrecedenceAnnotations"> + <stdout> + <line text="@Security S2"/> + <line text="S1"/> + <line text="@Performance P2"/> + <line text="P1"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: dec annotation"> + <compile files="DeclareAnnotation.aj,org/xyz/model/Model.java" options="-1.5"> + <message kind="warning" line="3" text="@BusinessDomain"/> + <message kind="warning" line="43" text="@Secured"/> + <message kind="warning" line="44" text="@Secured"/> + <message kind="warning" line="55" text="@Secured"/> + <message kind="warning" line="62" text="@Persisted"/> + <message kind="warning" line="68" text="@Persisted"/> + <message kind="warning" line="41" text="@Secured"/> + <message kind="warning" line="51" text="@Secured"/> + </compile> + <run class="DeclareAnnotation"/> + </ajc-test> + + <ajc-test dir="java5/covariance/ajdk" title="ajdk: covariance"> + <compile files="AJDKExamples.aj" options="-1.5"> + <message kind="warning" line="43" text="call(* whoAreYou())"/> + <message kind="warning" line="44" text="call(* whoAreYou())"/> + <message kind="warning" line="43" text="call(* A.whoAreYou())"/> + <message kind="warning" line="44" text="call(* A.whoAreYou())"/> + <message kind="warning" line="43" text="call(A whoAreYou())"/> + <message kind="warning" line="44" text="call(A whoAreYou())"/> + <message kind="warning" line="44" text="call(A+ B.whoAreYou())"/> + <message kind="warning" line="44" text="call(B whoAreYou())"/> + <message kind="warning" line="44" text="call(B B.whoAreYou())"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs/ajdk" title="ajdk: varargs"> + <compile files="AJDKExamples.aj,org/xyz/Foo.java,org/xyz/Goo.java,org/xyz/Hoo.java" options="-1.5"> + <message kind="warning" line="8" text="call vararg match"/> + <message kind="warning" line="14" text="execution vararg match"/> + <message kind="warning" line="5" text="init vararg match"/> + <message kind="warning" line="6" text="init vararg match"/> + <message kind="warning" line="27" text="single vararg"/> + <message kind="warning" line="28" text="single String[]"/> + <message kind="warning" line="18" text="single String[]"/> + </compile> + <run class="AJDKExamples"> + <stdout> + <line text="Matched at call(void X.foo(int, String[]))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/pertypewithin/ajdk" title="ajdk: ptw"> + <compile files="AJDKExamples.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-execution(void org.xyz.foo.B.<init>())' in Type 'org.xyz.foo.B' (AJDKExamples.aj:38) advised by afterReturning advice from 'org.xyz.foo.AJDKExamples' (AJDKExamples.aj:11)"/> + <message kind="weave" text="Join point 'constructor-execution(void org.xyz.foo.A.<init>())' in Type 'org.xyz.foo.A' (AJDKExamples.aj:36) advised by afterReturning advice from 'org.xyz.foo.AJDKExamples' (AJDKExamples.aj:11)"/> + </compile> + <run class="org.xyz.foo.AJDKExamples"> + <stdout> + <line text="Aspect instance constructed"/> + <line text="Aspect instance constructed"/> + <line text="true"/> + <line text="true"/> + <line text="There are 2 As"/> + <line text="There are 3 Bs"/> + </stdout> + </run> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- declare annotation --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/declare" title="basic declare annotation parse test"> + <compile files="BasicParseTest.aj" options="-1.5"> + </compile> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- declare annotation (@type) --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/declare" title="declare @type 1"> + <compile files="DecaType1.java" options="-1.5"/> + <run class="DecaType1"> + <stderr> + <line text="annotation is @MyAnnotation()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type 2"> + <compile files="DecaType2.java" options="-1.5,-Xlint:ignore" > + </compile> + <run class="DecaType2"> + <stderr> + <line text="annotation on DecaType2 is @MyAnnotation()"/> + <line text="annotation on X is @MyAnnotation()"/> + <line text="annotation on MyAnnotation is @MyAnnotation()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - with matching pointcut"> + <compile files="DecaType3.java" options="-1.5"/> + <run class="DecaType3"> + <stderr> + <line text="hello world"/> + <line text="advice running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - binary weaving"> + <weave classesFiles="BaseTypes.java" + aspectsFiles="DecaTypeBin1.aj,Colored.java" + options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + </weave> + <run class="BaseTypes"> + <stderr> + <line text="Color identified on class X"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - complex annotation - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="ComplexAnnotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - complex annotation - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin2.aj" options="-1.5"/> + <run class="BaseTypes"> + <stderr> + <line text="ComplexAnnotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - two annotations hit one type - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin3.aj" options="-1.5"/> + <run class="BaseTypes"> + <stderr> + <line text="Color identified on execution(void A.m())"/> + <line text="Fruit identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - two annotations hit one type - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin3.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Color identified on execution(void A.m())"/> + <line text="Fruit identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 1) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaDecpInteractions1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 1) - source weaving"> + <compile files="BaseTypes.java,DecaDecpInteractions1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 2) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaDecpInteractions2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 2) - source weaving"> + <compile files="BaseTypes.java,DecaDecpInteractions2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 3) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaDecpInteractions3.aj" options="-1.5,-Xlint:ignore"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 3) - source weaving"> + <compile files="BaseTypes.java,DecaDecpInteractions3.aj" options="-1.5,-Xlint:ignore"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 4) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaDecpInteractions4.aj" options="-1.5,-Xlint:ignore"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 4) - source weaving"> + <compile files="BaseTypes.java,DecaDecpInteractions4.aj" options="-1.5,-Xlint:ignore"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - annotating an already annotated type - binary weaving"> + <weave classesFiles="AnnotatedType.java" aspectsFiles="DecaTypeBin4.aj" options="-1.5,-Xlint:ignore"/> + <run class="AnnotatedType"> + <stderr> + <line text="Color identified on execution(void AnnotatedType.m())"/> + <line text="Fruit identified on execution(void AnnotatedType.m())"/> + <line text="m() running"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/declare" title="declare @type - annotating an already annotated type - source weaving"> + <compile files="AnnotatedType.java,DecaTypeBin4.aj" options="-1.5,-Xlint:ignore"/> + <run class="AnnotatedType"> + <stderr> + <line text="Color identified on execution(void AnnotatedType.m())"/> + <line text="Fruit identified on execution(void AnnotatedType.m())"/> + <line text="m() running"/> + </stderr> + </run> + </ajc-test> + + + <!--ajc-test dir="java5/annotations/declare" title="declare @type - annotations with different targets - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin5.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="15" text="The annotation @ColorM is disallowed for this location"/> + <message kind="error" line="16" text="The annotation @ColorC is disallowed for this location"/> + <message kind="error" line="18" text="The annotation @ColorF is disallowed for this location"/> + <message kind="error" line="19" text="The annotation @ColorP is disallowed for this location"/> + <message kind="error" line="20" text="The annotation @ColorL is disallowed for this location"/> + <message kind="error" line="21" text="The annotation @ColorPkg is disallowed for this location"/> + </weave> + <run class="BaseTypes"> + <stderr> + <line text="ColorT identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test--> + + <ajc-test dir="java5/annotations/declare" title="declare @type - annotations with different targets - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin5.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="15" text="The annotation @ColorM is disallowed for this location"/> + <message kind="error" line="16" text="The annotation @ColorC is disallowed for this location"/> + <message king="error" line="17" text="A is not a valid target for annotation ColorA"/> + <message kind="error" line="18" text="The annotation @ColorF is disallowed for this location"/> + <message kind="error" line="19" text="The annotation @ColorP is disallowed for this location"/> + <message kind="error" line="20" text="The annotation @ColorL is disallowed for this location"/> + <message kind="error" line="21" text="The annotation @ColorPkg is disallowed for this location"/> + </compile> + </ajc-test> + + <!--ajc-test dir="java5/annotations/declare" title="declare @type - annotations with different targets (using type patterns) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin6.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" line="15" text="A is not a valid target for annotation ColorM"/> + <message kind="warning" line="16" text="A is not a valid target for annotation ColorC"/> + <message kind="warning" line="17" text="A is not a valid target for annotation ColorL"/> + <message kind="warning" line="17" text="B is not a valid target for annotation ColorL"/> + <message kind="warning" line="17" text="C is not a valid target for annotation ColorL"/> + </weave> + <run class="BaseTypes"> + <stderr> + <line text="ColorT identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="ColorT identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="ColorT identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test--> + + <ajc-test dir="java5/annotations/declare" title="declare @type - annotations with different targets (using type patterns) - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin6.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="15" text="The annotation @ColorM is disallowed for this location"/> + <message kind="error" line="16" text="The annotation @ColorC is disallowed for this location"/> + <message kind="error" line="17" text="The annotation @ColorL is disallowed for this location"/> + <message kind="error" line="18" text="The annotation @ColorF is disallowed for this location"/> + </compile> + </ajc-test> + + + <ajc-test dir="java5/annotations/declare" title="declare @type - complex decp decAtType interactions - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin7.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + </weave> + <run class="BaseTypes"> + <stderr> + <line text="Color identified on execution(void A.m())"/> + <line text="Fruit identified on execution(void A.m())"/> + <line text="Chocolate identified on execution(void A.m())"/> + <line text="M1 at execution(void A.m())"/> + <line text="M2 at execution(void A.m())"/> + <line text="M3 at execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Fruit identified on execution(void B.m())"/> + <line text="Chocolate identified on execution(void B.m())"/> + <line text="M1 at execution(void B.m())"/> + <line text="M2 at execution(void B.m())"/> + <line text="M3 at execution(void B.m())"/> + <line text="B.m() running"/> + <line text="Fruit identified on execution(void C.m())"/> + <line text="Chocolate identified on execution(void C.m())"/> + <line text="M1 at execution(void C.m())"/> + <line text="M2 at execution(void C.m())"/> + <line text="M3 at execution(void C.m())"/> + <line text="C.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - complex decp decAtType interactions - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin7.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Color identified on execution(void A.m())"/> + <line text="Fruit identified on execution(void A.m())"/> + <line text="Chocolate identified on execution(void A.m())"/> + <line text="M1 at execution(void A.m())"/> + <line text="M2 at execution(void A.m())"/> + <line text="M3 at execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Fruit identified on execution(void B.m())"/> + <line text="Chocolate identified on execution(void B.m())"/> + <line text="M1 at execution(void B.m())"/> + <line text="M2 at execution(void B.m())"/> + <line text="M3 at execution(void B.m())"/> + <line text="B.m() running"/> + <line text="Fruit identified on execution(void C.m())"/> + <line text="Chocolate identified on execution(void C.m())"/> + <line text="M1 at execution(void C.m())"/> + <line text="M2 at execution(void C.m())"/> + <line text="M3 at execution(void C.m())"/> + <line text="C.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - trying to put annotation targetting annos on normal types - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin8.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="8" text="A is not a valid target for annotation ColorA"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - trying to put annotation targetting annos on normal types - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin8.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="8" text="A is not a valid target for annotation ColorA"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - trying to put annotation targetting annos on normal types (uses pattern) - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin9.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" line="8" text="A is not a valid target for annotation ColorA"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - trying to put annotation targetting annos on normal types (uses pattern) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin9.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" line="8" text="A is not a valid target for annotation ColorA"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - covering enum and class element values - source weaving"> + <compile files="EnumAndClassValues.aj,FunkyAnnotations.java" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="FunkyAnnotations"> + <stderr> + <line text="hello world"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - covering enum and class element values - binary weaving"> + <weave aspectsFiles="EnumAndClassValues.aj" classesFiles="FunkyAnnotations.java" options="-1.5 -Xdev:Pinpoint" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="FunkyAnnotations"> + <stderr> + <line text="advice running: Red"/> + <line text="advice running: class java.lang.Integer"/> + <line text="method running"/> + </stderr> + </run> + </ajc-test> + + + <!-- ======================================================================================= --> + <!-- declare annotation (@field) --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - simple source weaving"> + <compile files="Base.java,Colored.java,AtField1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - simple binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="AtField1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - two the same on one - source weaving"> + <compile files="Base.java,Colored.java,TwoOnOneField.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" text="int Base.publicIntField - already has an annotation of type Colored"/> + </compile> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - two the same on one - binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="TwoOnOneField.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" text="int Base.publicIntField - already has an annotation of type Colored"/> + </weave> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - two different on one - source weaving"> + <compile files="Base.java,Colored.java,Fruit.java,TwoOnOneField2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + </compile> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - two different on one - binary weaving"> + <weave classesFiles="Base.java,Colored.java,Fruit.java" aspectsFiles="TwoOnOneField2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + </weave> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - wrong target - source weaving"> + <compile files="Base.java,Colored.java,WrongTarget.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="8" text="The annotation @MethodColoring is disallowed for this location"/> + <message kind="error" line="9" text="The annotation @TypeColoring is disallowed for this location"/> + <!-- xlint warnings that were put in as part of fix for pr115252 --> + <message kind="warning" line="13" text="does not match because annotation @MethodColoring has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="16" text="does not match because annotation @TypeColoring has @Target{ElementType.TYPE} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - right target - source weaving"> + <compile files="Base.java,Colored.java,RightTarget.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - right target - binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="RightTarget.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - recursive application - source weaving"> + <compile files="Base.java,Colored.java,Fruit.java,RecursiveFields.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - recursive application - binary weaving"> + <weave classesFiles="Base.java,Colored.java,Fruit.java" aspectsFiles="RecursiveFields.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - recursive application (other order) - source weaving"> + <compile files="Base.java,Colored.java,Fruit.java,RecursiveFields2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - recursive application (other order) - binary weaving"> + <weave classesFiles="Base.java,Colored.java,Fruit.java" aspectsFiles="RecursiveFields2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + <!-- incorrect target type for annotation on field --> + + <!-- incorrect target type for annotation on method --> + <!-- two annotations on one method --> + <!-- two of the same annotation on one method - error --> + <!-- two of the same on one using pattern spec - lint --> + +<!-- need some incorrect signatures in the declare @statements - e.g. declare @constructor: public Base(int): XXX; will blow things up as it uses Base rather than new --> + <!-- incorrect target type for annotation on ctor --> + <!-- two annotations on one ctor --> + <!-- two of the same annotation on one ctor - error --> + <!-- two of the same on one using pattern spec - lint --> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method - simple source weaving"> + <compile files="Base.java,Colored.java,AtMethod1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored method invocation at call(void Base.m1())"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method - simple binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="AtMethod1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored method invocation at call(void Base.m1())"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @constructor - simple source weaving"> + <compile files="Base.java,Colored.java,AtCtor1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored constructor invocation at call(Base(int))"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @constructor - simple binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="AtCtor1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored constructor invocation at call(Base(int))"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + + <!-- These tests verify both @method and @ctor behavior - they are so similar it is OK to have them together... --> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - wrong target - source weaving"> + <compile files="Base.java,Colored.java,WrongTarget.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="8" text="The annotation @MethodColoring is disallowed for this location"/> + <message kind="error" line="9" text="The annotation @TypeColoring is disallowed for this location"/> + <message kind="error" line="10" text="The annotation @MethodColoring is disallowed for this location"/> + <message kind="error" line="11" text="The annotation @TypeColoring is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - right target - source weaving"> + <compile files="Base.java,Colored.java,RightTarget.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored ctor call at call(Base(int))"/> + <line text="Colored method call at call(void Base.m1())"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - right target - binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="RightTarget.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored ctor call at call(Base(int))"/> + <line text="Colored method call at call(void Base.m1())"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + +<!-- check @method/@ctor/@field recursively applying, can only happen if a pattern for one of them includes an annotation --> + + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - two the same on one - source weaving"> + <compile files="Base.java,Colored.java,TwoOnOneMember.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" text="void Base.m1() - already has an annotation of type Colored"/> + <message kind="warning" text="void Base.<init>(int) - already has an annotation of type Colored"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - two the same on one - binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="TwoOnOneMember.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" text="void Base.m1() - already has an annotation of type Colored"/> + <message kind="warning" text="void Base.<init>(int) - already has an annotation of type Colored"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - two different on one - source weaving"> + <compile files="Base.java,Colored.java,Fruit.java,TwoOnOneMember2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + </compile> + <run class="Base"> + <stderr> + <line text="Colored ctor call at Base.java:11"/> + <line text="Fruit ctor call at Base.java:11"/> + <line text="Colored method call at Base.java:15"/> + <line text="Fruit method call at Base.java:15"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - two different on one - binary weaving"> + <weave classesFiles="Base.java,Colored.java,Fruit.java" aspectsFiles="TwoOnOneMember2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + </weave> + <run class="Base"> + <stderr> + <line text="Colored ctor call at Base.java:11"/> + <line text="Fruit ctor call at Base.java:11"/> + <line text="Colored method call at Base.java:15"/> + <line text="Fruit method call at Base.java:15"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare all annotations on one class - source weaving"> + <compile files="DeathByAnnotations.aj" options="-1.5,-emacssym" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="p.q.DeathByAnnotations"/> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- annotation binding with ITDs --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd method is annotated"> + <compile files="BindingWithAnnotatedItds1.aj" options="-1.5"/> + <run class="BindingWithAnnotatedItds1"> + <stderr> + <line text="Found apple at jp execution(int A.m()) (BindingWithAnnotatedItds1.aj:8)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd field is annotated"> + <compile files="BindingWithAnnotatedItds2.aj" options="-1.5"/> + <run class="BindingWithAnnotatedItds2"> + <stderr> + <line text="Found banana at jp set(int A.i) (BindingWithAnnotatedItds2.aj:16)"/> + <line text="Found apple at jp set(String A.j) (BindingWithAnnotatedItds2.aj:17)"/> + <line text="Found orange at jp set(int[] A.k) (BindingWithAnnotatedItds2.aj:18)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd ctor is annotated"> + <compile files="BindingWithAnnotatedItds3.aj" options="-1.5"/> + <run class="BindingWithAnnotatedItds3"> + <stderr> + <line text="Found pear at jp execution(A(String)) (BindingWithAnnotatedItds3.aj:8)"/> + <line text="Found orange at jp execution(A(int)) (BindingWithAnnotatedItds3.aj:10)"/> + <line text="Found tomato at jp execution(A(boolean)) (BindingWithAnnotatedItds3.aj:12)"/> + </stderr> + </run> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- declare annotation targetting ITDs --> + <!-- ======================================================================================= --> + + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd method is annotated via declare"> + <compile files="BindingWithDeclaredAnnotationItds1.aj" options="-1.5,-emacssym"/> + <run class="BindingWithDeclaredAnnotationItds1"> + <stderr> + <line text="Found orange at jp call(int A.m()) (BindingWithDeclaredAnnotationItds1.aj:16)"/> + <line text="Found orange at jp execution(int A.m()) (BindingWithDeclaredAnnotationItds1.aj:8)"/> + <line text="Found banana at jp call(int A.n()) (BindingWithDeclaredAnnotationItds1.aj:17)"/> + <line text="Found banana at jp execution(int A.n()) (BindingWithDeclaredAnnotationItds1.aj:10)"/> + <line text="Found tomato at jp call(int A.o()) (BindingWithDeclaredAnnotationItds1.aj:18)"/> + <line text="Found tomato at jp execution(int A.o()) (BindingWithDeclaredAnnotationItds1.aj:12)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd field is annotated via declare"> + <compile files="BindingWithDeclaredAnnotationItds2.aj" options="-1.5,-emacssym"/> + <run class="BindingWithDeclaredAnnotationItds2"> + <stderr> + <line text="Found orange at jp set(int A.i) (BindingWithDeclaredAnnotationItds2.aj:16)"/> + <line text="Found banana at jp set(String A.j) (BindingWithDeclaredAnnotationItds2.aj:17)"/> + <line text="Found apple at jp set(boolean[] A.k) (BindingWithDeclaredAnnotationItds2.aj:18)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd field is annotated multiple times via declare"> + <compile files="BindingWithDeclaredAnnotationItds3.aj" options="-1.5,-emacssym"/> + <run class="BindingWithDeclaredAnnotationItds3"> + <stderr> + <line text="Found fruit orange at jp set(int A.i) (BindingWithDeclaredAnnotationItds3.aj:13)"/> + <line text="Found drink margarita at jp set(int A.i) (BindingWithDeclaredAnnotationItds3.aj:13)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd ctor is annotated via declare"> + <compile files="BindingWithDeclaredAnnotationItds4.aj" options="-1.5,-emacssym"/> + <run class="BindingWithDeclaredAnnotationItds4"> + <stderr> + <line text="Found pear at jp execution(A(String)) (BindingWithDeclaredAnnotationItds4.aj:8)"/> + <line text="Found orange at jp execution(A(int)) (BindingWithDeclaredAnnotationItds4.aj:10)"/> + <line text="Found tomato at jp execution(A(boolean)) (BindingWithDeclaredAnnotationItds4.aj:12)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/suppressedWarnings" title="SuppressAjWarnings raised during matching"> + <compile files="SuppressionDuringMatching.aj" options="-1.5"> + </compile> + </ajc-test> + + <!-- ============================================================== --> + + <ajc-test dir="options/aspectpath" title="dirs on aspectpath"> + <compile files="MyAspect.aj" options="-d out"/> + <compile files="MyClass.java" options="-aspectpath out"> + <message kind="warning" line="3" text="a method"/> + </compile> + </ajc-test> + + <!-- ============================================================== --> + <!-- Start of generics tests --> + <!-- ============================================================== --> + + <ajc-test dir="java5/generics" title="ITD with parameterized type" vm="1.5"> + <compile files="ITDReturningParameterizedType.aj" options="-1.5"/> + <run class="ITDReturningParameterizedType"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/bugs" title="AtArgs causes a VerifyError: Unable to pop operand off an empty stack" vm="1.5"> + <compile files="Test3.java" options="-1.5"/> + <run class="Test3"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/pr91267" title="NPE using generic methods in aspects 1" vm="1.5"> + <compile files="TestBug1.aj" options="-1.5"/> + <run class="TestBug1"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/pr91267" title="NPE using generic methods in aspects 2" vm="1.5"> + <compile files="TestBug2.aj" options="-1.5"/> + <run class="TestBug2"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs" title="Generics problem with Set" vm="1.5"> + <compile files="PR91053.aj" options="-1.5"/> + <run class="PR91053"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs" title="Compilation error on generic member introduction" vm="1.5"> + <compile files="PR87282.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs" title="Parameterized types on introduced fields not correctly recognized" vm="1.5"> + <compile files="PR88606.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="enum called Enum, annotation called Annotation, etc"> + <compile files="PR90827.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="Internal compiler error"> + <compile files="PR86832.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="Exploding compile time with if() statements in pointcut"> + <compile files="PR94086.aj" options="-1.5"/> + </ajc-test> + + <!-- generic abstract aspects... --> + + <ajc-test dir="java5/generics/genericaspects" title="static pointcut parameterization suite"> + <compile files="GenericAspectPointcuts.aj" options="-1.5"> + <message kind="warning" line="62" text="kinded-returning-ok"/> + <message kind="warning" line="52" text="kinded-declaring-ok"/> + <message kind="warning" line="67" text="kinded-declaring-ok"/> + <message kind="warning" line="50" text="kinded-params-ok"/> + <message kind="warning" line="56" text="kinded-throws-ok"/> + <message kind="warning" line="64" text="and-ok"/> + <message kind="warning" line="60" text="or-ok"/> + <message kind="warning" line="64" text="or-ok"/> + <message kind="warning" line="67" text="or-ok"/> + <message kind="warning" line="1" text="not-ok"/> + <message kind="warning" line="42" text="not-ok"/> + <message kind="warning" line="72" text="not-ok"/> + <message kind="warning" line="59" text="within-ok"/> + <message kind="warning" line="64" text="withincode-ok"/> + <message kind="warning" line="53" text="handler-ok"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="dynamic pointcut parameterization suite"> + <compile files="GenericAspectRuntimePointcuts.aj" options="-1.5"> + </compile> + <run class="GenericAspectRuntimePointcuts"> + <stdout> + <line text="target-ok an X execution(void X.foo())"/> + <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/> + <line text="@this-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9+"/> + <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/> + <line text="@target-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9+"/> + <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/> + <line text="@within-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9+"/> + <line text="cflow-ok an X a Y set(Y X.y)"/> + <line text="@annotation-ok-sub @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@annotation-ok-sub @MyAnnotation(value="bar") execution(void X.bar())" vm="9+"/> + <line text="@annotation-ok @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@annotation-ok @MyAnnotation(value="bar") execution(void X.bar())" vm="9+"/> + <line text="target-ok an X execution(void X.bar())"/> + <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@this-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9+"/> + <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@target-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9+"/> + <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@within-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9+"/> + <line text="@args-ok @MyAnnotation(value=my-value) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> + <line text="@args-ok @MyAnnotation(value="my-value") execution(void Y.foo(X))" vm="9+"/> + <line text="args-ok an X execution(void Y.foo(X))"/> + <line text="this-ok a Y execution(void Y.foo(X))"/> + <line text="@this-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> + <line text="@this-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9+"/> + <line text="@target-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> + <line text="@target-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9+"/> + <line text="@within-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> + <line text="@within-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9+"/> + <line text="@annotation-ok-sub @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@annotation-ok-sub @MyAnnotation(value="my-value") execution(X Y.bar())" vm="9+"/> + <line text="@annotation-ok @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@annotation-ok @MyAnnotation(value="my-value") execution(X Y.bar())" vm="9+"/> + <line text="this-ok a Y execution(X Y.bar())"/> + <line text="@this-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@this-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9+"/> + <line text="@target-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@target-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9+"/> + <line text="@within-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@within-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9+"/> + <line text="@withincode-ok @MyAnnotation(value=my-value) get(X Y.x)" vm="1.5,1.6,1.7,1.8"/> + <line text="@withincode-ok @MyAnnotation(value="my-value") get(X Y.x)" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="reference to pointcut in generic class"> + <compile files="PointcutsInGenericClasses.aj" options="-1.5"> + <message kind="warning" line="16" text="a match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="reference to non-parameterized pointcut in generic class"> + <compile files="PointcutsInGenericClasses2.aj" options="-1.5"> + <message kind="error" line="10" text="cannot use a raw type reference to refer to a pointcut in a generic type (use a parameterized reference instead)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="declare parents parameterized"> + <compile files="DecPGenericTest.aj" options="-1.5"> + <message kind="warning" line="16" text="success"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="declare precedence parameterized"> + <compile files="DecPrecedenceGenericTest.aj" options="-1.5 -Xdev:Pinpoint"> + </compile> + <run class="DecPrecedenceGenericTest"> + <stdout> + <line text="A1"/> + <line text="A2"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="declare annotation parameterized"> + <compile files="DecAnnGenericTest.aj" options="-1.5"> + <message kind="warning" line="18" text="@type ok"/> + <message kind="warning" line="20" text="@field ok"/> + <message kind="warning" line="22" text="@constructor ok"/> + <message kind="warning" line="24" text="@method ok"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="multi-level generic abstract aspects"> + <compile files="MultiLevelGenericTest.aj" options="-1.5"> + <message kind="warning" line="23" text="base match"/> + <message kind="warning" line="23" text="middle match"/> + <message kind="warning" line="23" text="top match"/> + </compile> + </ajc-test> + <!-- generic bugs --> + + <ajc-test dir="java5/generics/bugs" title="ITD method with generic arg"> + <compile files="PR97763.aj" options="-1.5"/> + <run class="PR97763"> + <stderr> + <line text="Number of entries=2"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="NPE at ClassScope.java:660 when compiling generic class"> + <compile files="PR95993.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs" title="Problems resolving type name inside generic class"> + <compile files="PR95992.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="100227" title="inner class with generic enclosing class"> + <compile files="pr100227.aj" options="-1.5"/> + <run class="pr100227"> + <stderr> + <line text="Outer.Inner.inner=2"/> + <line text="Outer.Inner.p() executing"/> + <line text="Generic_Outer.Inner.inner=4"/> + <line text="Generic_Outer.Inner.p() executing"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="100260" title="methods inherited from a generic parent"> + <compile files="pr100260.aj" options="-1.5"/> + <run class="pr100260"/> + </ajc-test> + + <!-- end of generic bugs --> + + <!-- generic aspects --> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 1"> + <compile files="GenericAspect1.aj" options="-1.5"> + <message kind="error" line="2" text="only abstract aspects can have type parameters"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 2"> + <compile files="GenericAspect2.aj" options="-1.5"> + <message kind="error" line="9" text="a generic super-aspect must be fully parameterized in an extends clause"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 3"> + <compile files="GenericAspect3.aj" options="-1.5"/> + <run class="GenericAspect3"> + <stderr> + <line text="A"/> + <line text="B"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 4"> + <compile files="ParentChildRelationship.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspect with declare warning using type vars"> + <compile files="DeclareWarningInGenericAspect.aj" options="-1.5"> + <message kind="warning" line="16" text="this method takes a T!"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspect with execution advice using type vars"> + <compile files="ExecutionAdviceInGenericAspect.aj" options="-1.5"> + </compile> + <run class="ExecutionAdviceInGenericAspect"> + <stdout> + <line text="I matched at execution(void C.foo(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspect with anonymous pointcut"> + <compile files="AnonymousPointcutInGenericAspect.aj" options="-1.5"> + </compile> + <run class="AnonymousPointcutInGenericAspect"> + <stdout> + <line text="I matched at execution(void C.foo(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspect declare parents"> + <compile files="DeclareParentsWithTypeVars.aj" options="-1.5"> + </compile> + <run class="DeclareParentsWithTypeVars"> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspect declare soft"> + <compile files="DeclareSoftWithTypeVars.aj" options="-1.5"> + </compile> + <run class="DeclareSoftWithTypeVars"> + <stderr> + <line text="handled exception: io, io, it's off to work we go..."/> + <line text="Successfully converted to domain exception"/> + </stderr> + </run> + </ajc-test> + + <!-- ajdk example --> + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 5 (ajdk)"> + <compile files="Blob.java,BlobContainment.aj,ParentChildRelationship.aj" options="-1.5"/> + <run class="BlobContainment"/> + </ajc-test> + + <!-- same as above but all types in one file --> + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 6 (ajdk)"> + <compile files="TheBigOne.java" options="-1.5"/> + <run class="TheBigOne"/> + </ajc-test> + + <!-- end of generic aspects --> + + <!-- generic ITDs --> + + <ajc-test dir="java5/generics/itds" title="ITDs on generic type"> + <compile files="Parse5.java" options="-1.5"> + <message kind="error" line="9"/> + <message kind="error" line="11"/> + <message kind="error" line="13"/> + <message kind="error" line="15"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="itd of non static member"> + <compile files="A.java" options="-1.5"/> + <run class="A"> + <stderr> + <line text="min(2,4)=>2"/> + <line text="max(2,4)=>4"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="itd of static member"> + <compile files="B.java" options="-1.5"/> + <run class="B"> + <stderr> + <line text="min(2,4)=>2"/> + <line text="max(2,4)=>4"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="itd using type parameter"> + <compile files="C.java" options="-1.5"/> + <run class="C"> + <stderr> + <line text="fillthisin..."/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="itd incorrectly using type parameter"> + <compile files="D.java" options="-1.5"/> + <run class="D"> + <stderr> + <line text="fillthisin..."/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="static generic method itd"> + <compile files="StaticGenericMethodITD.aj" options="-1.5"/> + <run class="StaticGenericMethodITD"> + <stderr> + <line text="First=10"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic ctor itd - 1"> + <compile files="GenericCtorITD1.aj" options="-1.5"/> + <run class="GenericCtorITD1"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic ctor itd - 2"> + <compile files="GenericCtorITD2.aj" options="-1.5"/> + <run class="GenericCtorITD2"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic ctor itd - 3"> + <compile files="GenericCtorITD3.aj" options="-1.5"/> + <run class="GenericCtorITD3"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="parameterized method itd - 1"> + <compile files="ParameterizedMethodITD1.aj" options="-1.5"/> + <run class="ParameterizedMethodITD1"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="parameterized method itd - 2"> + <compile files="ParameterizedMethodITD2.aj" options="-1.5"> + <message kind="error" line="9" text="The method simple(List<? extends Number>) in the type Base is not applicable for the arguments (List<A>)"/> + </compile> + </ajc-test> + + + <ajc-test dir="java5/generics/itds" title="parameterized method itd - 3"> + <compile files="ParameterizedMethodITD3.aj" options="-1.5"> + <message kind="error" line="9" text="The method simple(List<? super A>) in the type Base is not applicable for the arguments (List<B>)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="parameterized method itd - 4"> + <compile files="ParameterizedMethodITD4.aj" options="-1.5"/> + <run class="ParameterizedMethodITD4"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 1"> + <compile files="GenericMethodITD1.aj" options="-1.5"/> + <run class="GenericMethodITD1"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 2"> + <compile files="GenericMethodITD2.aj" options="-1.5"> + <message kind="error" line="9" text="Bound mismatch: The generic method simple(List<? extends E>) of type Base is not applicable for the arguments (List<A>). The inferred type A is not a valid substitute for the bounded parameter <E extends Number>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 3"> + <compile files="GenericMethodITD3.aj" options="-1.5"/> + <run class="GenericMethodITD3"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 4"> + <compile files="GenericMethodITD4.aj" options="-1.5"/> + <run class="GenericMethodITD4"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 5"> + <compile files="GenericMethodITD5.aj" options="-1.5"> + <message kind="error" line="10" text="The method simple(List<E>, List<E>) in the type Base is not applicable for the arguments (List<A>, List<B>)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 6"> + <compile files="GenericMethodITD6.aj" options="-1.5"/> + <run class="GenericMethodITD6"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 7"> + <compile files="GenericMethodITD7.aj" options="-1.5"/> + <run class="GenericMethodITD7"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 8"> + <compile files="GenericMethodITD8.aj" options="-1.5"> + <message kind="error" line="10" text="The method simple(List<E>, List<? extends E>) in the type Base is not applicable for the arguments (List<Number>, List<String>)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 9"> + <compile files="GenericMethodITD9.aj" options="-1.5"/> + <run class="GenericMethodITD9"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 10"> + <compile files="GenericMethodITD10.aj" options="-1.5"> + <message kind="error" line="10" text="Bound mismatch: The generic method crazy(List<R>) of type Base is not applicable for the arguments (List<A>). The inferred type A is not a valid substitute for the bounded parameter <R extends Comparable<? super R>>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 11"> + <compile files="GenericMethodITD11.aj" options="-1.5"/> + <run class="GenericMethodITD11"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 12"> + <compile files="GenericMethodITD12.aj" options="-1.5"> + <message kind="error" line="10" text="Bound mismatch: The generic method crazy(List<R>) of type Base is not applicable for the arguments (List<A>). The inferred type A is not a valid substitute for the bounded parameter <R extends Foo<? extends R>>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 13"> + <compile files="GenericMethodITD13.aj" options="-1.5"/> + <run class="GenericMethodITD13"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 14"> + <compile files="GenericMethodITD14.aj" options="-1.5"> + <message kind="error" line="10" text="Bound mismatch: The generic method crazy(List<R>) of type Base is not applicable for the arguments (List<A>). The inferred type A is not a valid substitute for the bounded parameter <R extends Foo<? super R>>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 15"> + <compile files="GenericMethodITD15.aj" options="-1.5"/> + <run class="GenericMethodITD15"/> + </ajc-test> + + <!-- visibility --> + + <ajc-test dir="java5/generics/itds/visibility" title="public itds"> + <compile files="PublicITDs.aj" options="-1.5"/> + <run class="PublicITDs"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/visibility" title="private itds"> + <compile files="PrivateITDs.aj" options="-1.5"/> + <run class="PrivateITDs"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/visibility" title="package itds"> + <compile files="PackageITDs.aj" options="-1.5"/> + <run class="PackageITDs"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/visibility" title="public itds with errors"> + <compile files="PublicITDsErrors.aj" options="-1.5"> + <message kind="error" line="13" text="The method publicMethod2(List<R>, List<R>) in the type Base is not applicable for the arguments (List<Double>, List<Float>)"/> + <message kind="error" line="15" text="The constructor Base(List<Double>, Map<Integer,String>) is undefined"/> + </compile> + </ajc-test> + + <!-- targetting different types --> + + <ajc-test dir="java5/generics/itds/differingTargets" title="targetting interface"> + <compile files="TargettingInterface.aj" options="-1.5"/> + <run class="TargettingInterface"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/differingTargets" title="targetting aspect"> + <compile files="TargettingAspect.aj" options="-1.5"/> + <run class="TargettingAspect"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/differingTargets" title="targetting class"> + <compile files="TargettingClass.aj" options="-1.5"/> + <run class="TargettingClass"/> + </ajc-test> + + <!-- sharing type variables between the ITD and the generic type --> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 1"> + <compile files="FieldA.aj" options="-1.5"/> + <run class="FieldA"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 2"> + <compile files="FieldB.aj" options="-1.5"> + <message kind="error" line="16" text="Incorrect number of type parameters supplied. The generic type Base<N,M> has 2 type parameters, not 1."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 3"> + <compile files="FieldC.aj" options="-1.5"/> + <run class="FieldC"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 4"> + <compile files="FieldD.aj" options="-1.5"/> + <run class="FieldD"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 5"> + <compile files="FieldE.aj" options="-1.5"/> + <run class="FieldE"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 6"> + <compile files="FieldF.aj" options="-1.5"/> + <run class="FieldF"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 7"> + <compile files="FieldG.aj" options="-1.5"/> + <run class="FieldG"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 8"> + <compile files="FieldH.aj" options="-1.5"/> + <run class="FieldH"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 9"> + <compile files="FieldI.aj" options="-1.5"> + <message kind="error" line="7" text="Type mismatch: cannot convert from List<String> to List<Integer>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -10"> + <compile files="FieldJ.aj" options="-1.5"/> + <run class="FieldJ"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -11"> + <compile files="FieldK.aj" options="-1.5"/> + <run class="FieldK"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -12"> + <compile files="FieldL.aj" options="-1.5"/> + <run class="FieldL"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -13"> + <compile files="FieldM.aj" options="-1.5"/> + <run class="FieldM"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -14"> + <compile files="FieldN.aj" options="-1.5"> + <message kind="error" line="11" text="Type parameters can not be specified in the ITD target type - the target type I is not generic."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -15"> + <compile files="FieldO.aj" options="-1.5"> + <message kind="error" line="11" text="Intertype declarations can only be made on the generic type, not on a parameterized type. The name 'String' cannot be used as a type parameter, since it refers to a real type."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -16"> + <compile files="FieldP.aj" options="-1.5"> + <message kind="error" line="10" text="static intertype field declarations cannot refer to type variables from the target generic type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -17"> + <compile files="FieldQ.aj" options="-1.5"/> + <run class="FieldQ"/> + </ajc-test> + + <!-- Now intertype declared methods on generic types that use the target types type vars --> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A1"> + <compile files="MethodA.aj" options="-1.5"/> + <run class="MethodA"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A2"> + <compile files="MethodA2.aj" options="-1.5"/> + <run class="MethodA2"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A3"> + <compile files="MethodA3.aj" options="-1.5"/> + <run class="MethodA3"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A4"> + <compile files="MethodA4.aj" options="-1.5"/> + <run class="MethodA4"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - B1"> + <compile files="MethodB.aj" options="-1.5"> + <message kind="error" line="16" text="Incorrect number of type parameters supplied. The generic type Base<N,M> has 2 type parameters, not 1."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - C1"> + <compile files="MethodC.aj" options="-1.5"/> + <run class="MethodC"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - D1"> + <compile files="MethodD.aj" options="-1.5"/> + <run class="MethodD"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - E1"> + <compile files="MethodE.aj" options="-1.5"/> + <run class="MethodE"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - F1"> + <compile files="MethodF.aj" options="-1.5"/> + <run class="MethodF"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - G1"> + <compile files="MethodG.aj" options="-1.5"/> + <run class="MethodG"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - H1"> + <compile files="MethodH.aj" options="-1.5"/> + <run class="MethodH"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - I1"> + <compile files="MethodI.aj" options="-1.5"> + <message kind="error" line="6" text="Type mismatch: cannot convert from List<Integer> to List<String>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - I2"> + <compile files="MethodI2.aj" options="-1.5"> + <message kind="error" line="7" text="The method m(List<Integer>) in the type Base<Integer> is not applicable for the arguments (List<String>)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - J1"> + <compile files="MethodJ.aj" options="-1.5"/> + <run class="MethodJ"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - K1"> + <compile files="MethodK.aj" options="-1.5"/> + <run class="MethodK"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - L1"> + <compile files="MethodL.aj" options="-1.5"/> + <run class="MethodL"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - M1"> + <compile files="MethodM.aj" options="-1.5"/> + <run class="MethodM"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - M2"> + <compile files="MethodM2.aj" options="-1.5"/> + <run class="MethodM2"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - N1"> + <compile files="MethodN.aj" options="-1.5"> + <message kind="error" line="11" text="Type parameters can not be specified in the ITD target type - the target type I is not generic."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - O1"> + <compile files="MethodO.aj" options="-1.5"> + <message kind="error" line="11" text="Intertype declarations can only be made on the generic type, not on a parameterized type. The name 'String' cannot be used as a type parameter, since it refers to a real type."/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - O2"> + <compile files="MethodO2.aj" options="-1.5"> + <message kind="error" line="11" text="Intertype declarations can only be made on the generic type, not on a parameterized type. The name 'String' cannot be used as a type parameter, since it refers to a real type."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - P1"> + <compile files="MethodP.aj" options="-1.5"/> + <run class="MethodP"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - Q1"> + <compile files="MethodQ.aj" options="-1.5"/> + <run class="MethodQ"/> + </ajc-test> + + <!-- Now intertype declared constructors on generic types that use the target types type vars --> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - A1"> + <compile files="CtorA.aj" options="-1.5"/> + <run class="CtorA"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - B1"> + <compile files="CtorB.aj" options="-1.5"> + <message kind="error" line="15" text="Incorrect number of type parameters supplied. The generic type Base<N,M> has 2 type parameters, not 1."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - C1"> + <compile files="CtorC.aj" options="-1.5"/> + <run class="CtorC"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - D1"> + <compile files="CtorD.aj" options="-1.5"/> + <run class="CtorD"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - E1"> + <compile files="CtorE.aj" options="-1.5"/> + <run class="CtorE"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - F1"> + <compile files="CtorF.aj" options="-1.5"/> + <run class="CtorF"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - G1"> + <compile files="CtorG.aj" options="-1.5"/> + <run class="CtorG"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - H1"> + <compile files="CtorH.aj" options="-1.5"/> + <run class="CtorH"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - I1"> + <compile files="CtorI.aj" options="-1.5"/> + <run class="CtorI"/> + </ajc-test> + + <!-- putting it all together, fields/methods/ctors and decps --> + + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - A"> + <compile files="GenericAspectA.aj" options="-1.5"/> + <run class="GenericAspectA"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - B"> + <compile files="GenericAspectB.aj" options="-1.5"/> + <run class="GenericAspectB"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - C"> + <compile files="GenericAspectC.aj" options="-1.5"/> + <run class="GenericAspectC"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - D"> + <compile files="GenericAspectD.aj" options="-1.5"/> + <run class="GenericAspectD"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - E"> + <compile files="GenericAspectE.aj" options="-1.5"/> + <run class="GenericAspectE"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - F"> + <compile files="GenericAspectF.aj" options="-1.5"/> + <run class="GenericAspectF"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - G"> + <compile files="GenericAspectG.aj" options="-1.5"/> + <run class="GenericAspectG"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - H"> + <compile files="GenericAspectH.aj" options="-1.5"> + <message kind="error" line="7" text="Type java.lang.String does not meet the specification for type parameter 1 (N extends java.lang.Number) in generic type GenericAspect$SimpleI"/> + <!-- see pr133307, shame about this --> + <!--message kind="error" line="16" text="The method m4(String) is undefined for the type Base"/--> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - I"> + <compile files="GenericAspectI.aj" options="-1.5"/> + <run class="GenericAspectI"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - J"> + <compile files="GenericAspectJ.aj" options="-1.5"/> + <run class="GenericAspectJ"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - K"> + <compile files="GenericAspectK.aj" options="-1.5"> + <message kind="error" line="7" text="B does not meet the specification for type parameter 1 (L extends java.lang.Number) in generic type GenericAspect$SimpleI"/> + <message kind="error" line="16" text="The method m4(String) is undefined for the type Base"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - K2"> + <compile files="GenericAspectK2.aj" options="-1.5"> + <message kind="error" line="13" text="The type String is not a valid substitute"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - L"> + <compile files="GenericAspectL.aj" options="-1.5"/> + <run class="GenericAspectL"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - M"> + <compile files="GenericAspectM.aj" options="-1.5"> + <message kind="error" line="23" text="The method m0(Integer) in the type GenericAspect.SimpleI<Integer> is not applicable for the arguments (String)"/> + <message kind="error" line="24" text="The method m1(List<Integer>) in the type GenericAspect.SimpleI<Integer> is not applicable for the arguments (List<String>)"/> + <message kind="error" line="25" text="Type mismatch: cannot convert from String to Integer"/> + <message kind="error" line="26" text="Type mismatch: cannot convert from List<String> to List<Integer>"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - N"> + <compile files="GenericAspectN.aj" options="-1.5"/> + <run class="GenericAspectN"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - O"> + <compile files="GenericAspectO.aj" options="-1.5"> + <message kind="error" line="24" text="Cannot make a static reference to the non-static field Bottom.parent"/> + <message kind="error" line="26" text="The method add(Bottom) in the type List<Bottom> is not applicable for the arguments (Top)"/> + <message kind="error" line="27" text="Cannot make a static reference to the non-static field Top.children"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - P"> + <compile files="GenericAspectP.aj" options="-1.5"/> + <run class="GenericAspectP"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - Q"> + <compile files="GenericAspectQ.aj" options="-1.5"/> + <run class="GenericAspectQ"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - R"> + <compile files="GenericAspectR.aj" options="-1.5"/> + <run class="GenericAspectR"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - S"> + <compile files="GenericAspectS.aj" options="-1.5"/> + <run class="GenericAspectS"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - T"> + <compile files="GenericAspectT.aj" options="-1.5"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - U"> + <compile files="GenericAspectU.aj" options="-1.5"/> + <run class="GenericAspectU"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - V"> + <compile files="GenericAspectV.aj" options="-1.5"/> + <run class="GenericAspectV"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - W"> + <compile files="GenericAspectW.aj" options="-1.5"/> + <run class="GenericAspectW"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - X"> + <compile files="GenericAspectX.aj" options="-1.5"/> + <run class="GenericAspectX"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - Y"> + <compile files="GenericAspectY.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void ParentChildRelationship$ParentHasChildren.addChild(C))' in Type 'ParentChildRelationship' (GenericAspectY.aj:53) advised by before advice from 'GenericAspectY' (GenericAspectY.aj:101) [with runtime test]"/> + <message kind="weave" text="Extending interface set for type 'Top' (GenericAspectY.aj) to include 'ParentChildRelationship$ParentHasChildren<Bottom>' (GenericAspectY.aj)"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.addChild(Bottom)')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(Bottom)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'P ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'P ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> + <message kind="weave" text="Extending interface set for type 'Bottom' (GenericAspectY.aj) to include 'ParentChildRelationship$ChildHasParent<Top>' (GenericAspectY.aj)"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'Top ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'Top ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ChildHasParent.setParent(Top)')"/> + </compile> + <run class="GenericAspectY"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - Z"> + <compile files="GenericAspectZ.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void ParentChildRelationship$ParentHasChildren.addChild(C))' in Type 'ParentChildRelationship' (GenericAspectZ.aj:53) advised by before advice from 'GenericAspectZ' (GenericAspectZ.aj:95) [with runtime test]"/> + <message kind="weave" text="Join point 'method-execution(void ParentChildRelationship$ParentHasChildren.removeChild(C))' in Type 'ParentChildRelationship' (GenericAspectZ.aj:65) advised by before advice from 'GenericAspectZ' (GenericAspectZ.aj:96) [with runtime test]"/> + + <message kind="weave" text="Extending interface set for type 'Top' (GenericAspectZ.aj) to include 'ParentChildRelationship$ParentHasChildren<Bottom>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(Bottom)')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(Bottom)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'P ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'P ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> + <message kind="weave" text="Extending interface set for type 'Bottom' (GenericAspectZ.aj) to include 'ParentChildRelationship$ChildHasParent<Top>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'Top ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'Top ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(Top)')"/> + + <!--message kind="weave" text="Extending interface set for type 'Top' (GenericAspectZ.aj) to include 'ParentChildRelationship$ParentHasChildren<Bottom>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> + <message kind="weave" text="Extending interface set for type 'Bottom' (GenericAspectZ.aj) to include 'ParentChildRelationship$ChildHasParent<Top>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/--> + </compile> + <run class="GenericAspectZ"/> + </ajc-test> + + <ajc-test dir="java5/generics/binaryBridging" title="binary bridge methods - two"> + <compile files="TwoA.java" outjar="twoa.jar" options="-1.5"/> + <compile files="TwoB.java" outjar="twob.jar" options="-1.5"/> + <compile files="TwoX.java" inpath="twoa.jar;twob.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd sharing type variable with generic type"> + <compile files="Simple.aj" options="-1.5"/> + <run class="Simple"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd sharing type variable with generic type"> + <compile files="Simple2.aj" options="-1.5"/> + <run class="Simple2"/> + </ajc-test> + + + <ajc-test dir="java5/generics/itds" title="non static generic method itd - 2"> + <compile files="NonstaticGenericCtorITD2.aj" options="-1.5"/> + <run class="NonstaticGenericCtorITD2"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="reusing type variable letters"> + <compile files="ReusingLetters.aj" options="-1.5"/> + <run class="ReusingLetters"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="multiple generic itds in one file"> + <compile files="BizarroSignatures.aj" options="-1.5"/> + <run class="BizarroSignatures"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic intertype field declaration, sharing type variable"> + <compile files="FieldITDOnGenericType.aj" options="-1.5"/> + <run class="FieldITDOnGenericType"> + <stderr> + <line text=">42"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 1"> + <compile files="Parse1.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 2"> + <compile files="Parse2.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 3"> + <compile files="Parse3.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 4"> + <compile files="Parse4.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 5"> + <compile files="Parse5.java" options="-1.5"> + <message kind="error" line="11" text="Incorrect number of type parameters supplied. The generic type Parse5<T,S> has 2 type parameters, not 3."/> + <message kind="error" line="13" text="Incorrect number of type parameters supplied. The generic type Parse5<T,S> has 2 type parameters, not 1."/> + <message kind="error" line="15" text="Intertype declarations can only be made on the generic type, not on a parameterized type. The name 'String' cannot be used as a type parameter, since it refers to a real type."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 6"> + <compile files="Parse6.java" options="-1.5"/> + </ajc-test> + + <!-- end of generic ITDs --> + + <!-- generic decps --> + + <ajc-test dir="java5/generics/decp" title="generic decp - simple"> + <compile files="Basic.aj" options="-1.5"/> + <run class="Basic"/> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - implementing two variants #1"> + <compile files="Basic2.aj" options="-1.5"> + <message kind="error" line="11" text="Cannot declare parent I<java.lang.Integer> onto type Basic2 since it already has I<java.lang.String> in its hierarchy"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - implementing two variants #2"> + <compile files="Basic2b.aj" options="-1.5"> + <message kind="error" line="10" text="Cannot declare parent I<java.lang.Integer> onto type Basic2b since it already has I in its hierarchy"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - implementing two variants #3"> + <compile files="Basic2c.aj" options="-1.5"> + <message kind="error" line="10" text="Cannot declare parent I onto type Basic2c since it already has I<java.lang.Double> in its hierarchy"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - implementing two variants #4"> + <compile files="Basic2d.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/decp/binary" title="generic decp binary - implementing two variants #1"> + <weave classesFiles="Base1.java" aspectsFiles="Asp1.aj" options="-1.5,-showWeaveInfo"> + <message kind="error" line="2" text="Cannot declare parent I<java.lang.Integer> onto type Base1 since it already has I<java.lang.String> in its hierarchy"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/generics/decp/binary" title="generic decp binary - implementing two variants #2"> + <weave classesFiles="Base2.java" aspectsFiles="Asp2.aj" options="-1.5,-showWeaveInfo"> + <message kind="error" line="2" text="Cannot declare parent I<java.lang.Integer> onto type Base2 since it already has I in its hierarchy"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/generics/decp/binary" title="generic decp binary - implementing two variants #3"> + <weave classesFiles="Base3.java" aspectsFiles="Asp3.aj" options="-1.5,-showWeaveInfo"> + <message kind="error" line="2" text="Cannot declare parent I onto type Base3 since it already has I<java.lang.Double> in its hierarchy"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/generics/decp/binary" title="generic decp binary - implementing two variants #4"> + <weave classesFiles="Base4.java" aspectsFiles="Asp4.aj" options="-1.5,-showWeaveInfo"/> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - incorrect number of type parameters"> + <compile files="Basic3.aj" options="-1.5"> + <message kind="error" line="10" text="Type pattern does not match because the wrong number of type parameters are specified: Type I requires 1 parameter(s)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - specifying bounds"> + <compile files="Basic4.aj" options="-1.5"/> + <run class="Basic4"/> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - specifying bounds but breaking them"> + <compile files="Basic5.aj" options="-1.5"> + <message kind="error" line="7" text="Type java.lang.String does not meet the specification for type parameter 1 (T extends java.lang.Number) in generic type I"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - with parameterized on the target"> + <compile files="Basic6.aj" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Basic6' (Basic6.aj) to include 'K<java.lang.Integer>' (Basic6.aj)"/> + </compile> + <run class="Basic6"/> + </ajc-test> + + <!-- end of generic decps --> + + <!-- generics/itds and binary weaving --> + + <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - A"> + <compile files="TestA_generictype.java" outjar="code.jar" options="-1.5"/> + <compile files="TestA_aspect.aj,TestA_class.java" inpath="code.jar" options="-1.5"/> + <run class="TestA_class"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - B"> + <compile files="TestB_generictype.java" outjar="code.jar" options="-1.5"/> + <compile files="TestB_aspect1.aj,TestB_aspect2.aj,TestB_class.java" inpath="code.jar" options="-1.5"/> + <run class="TestB_class"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - 1"> + <compile files="BaseClass.java" outjar="code.jar" options="-1.5"/> + <compile files="A1.aj" inpath="code.jar" options="-1.5"/> + <run class="BaseClass"> + <stderr> + <line text="Advice count=1"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - 2"> + <compile files="BaseClass.java,A1.aj" outjar="code.jar" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A1' (A1.aj:'java.util.List<java.lang.String> BaseClass.list1')"/> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java:12) advised by after advice from 'A1' (A1.aj:7)"/> + </compile> + <compile files="A2.aj" inpath="code.jar" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A1' (A1.aj:'java.util.List<java.lang.String> BaseClass.list1')"/> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java:12) advised by after advice from 'A1' (code.jar!A1.class:7(from A1.aj))"/> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A2' (A2.aj:'java.util.List<N> BaseClass.list2')"/> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java:13) advised by after advice from 'A2' (A2.aj:8)"/> + </compile> + <run class="BaseClass"> + <stderr> + <line text="Advice count=2"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - 3"> + <compile files="BaseClass.java,A1.aj,A2.aj" outjar="code.jar" options="-1.5"/> + <compile files="A3.aj" inpath="code.jar" options="-1.5"/> + <run class="BaseClass"> + <stderr> + <line text="Advice count=3"/> + </stderr> + </run> + </ajc-test> + + <!-- end of generics/itds and binary weaving --> + + <!-- generics/itds and bridge methods --> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 1"> + <compile files="Sub1.java,Super1.java,X1.aj" options="-1.5"/> + <run class="X1"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 1 - binary"> + <compile files="Sub1.java,Super1.java" outjar="code.jar" options="-1.5"/> + <compile files="X1.aj" inpath="code.jar" options ="-1.5"/> + <run class="X1"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 2"> + <compile files="Sub2.java,Super2.java,X2.aj" options="-1.5"/> + <run class="X2"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 2 - binary"> + <compile files="Sub2.java,Super2.java" outjar="code.jar" options="-1.5"/> + <compile files="X2.aj,Util.java" inpath="code.jar" options ="-1.5"/> + <run class="X2"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 3"> + <compile files="Sub3.java,Super3.java,X3.aj" options="-1.5"/> + <run class="X3"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 3 - binary"> + <compile files="Sub3.java,Super3.java" outjar="code.jar" options="-1.5"/> + <compile files="X3.aj" inpath="code.jar" options ="-1.5"/> + <run class="X3"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 4"> + <compile files="Sub4.java,Super4.java,X4.aj" options="-1.5"/> + <run class="X4"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 4 - binary"> + <compile files="Sub4.java,Super4.java" outjar="code.jar" options="-1.5"/> + <compile files="X4.aj" inpath="code.jar" options ="-1.5"/> + <run class="X4"/> + </ajc-test> + + <ajc-test dir="java5/generics/binaryBridging" title="binary bridge methods - one"> + <compile files="OneA.java" outjar="onea.jar" options="-1.5"/> + <compile files="OneB.java" outjar="oneb.jar" options="-1.5"/> + <compile files="OneX.java" inpath="onea.jar;oneb.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/binaryBridging" title="binary bridge methods - two"> + <compile files="TwoA.java" outjar="twoa.jar" options="-1.5"/> + <compile files="TwoB.java" outjar="twob.jar" options="-1.5"/> + <compile files="TwoX.java" inpath="twoa.jar;twob.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/binaryBridging" title="binary bridge methods - three"> + <compile files="ThreeA.java" outjar="threea.jar" options="-1.5"/> + <compile files="ThreeB.java" outjar="threeb.jar" options="-1.5"/> + <compile files="ThreeX.java" inpath="threea.jar;threeb.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="abstract intertype methods and covariant returns"> + <compile files="pr91381.aj" options="-1.5"/> + <run class="pr91381"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" title="abstract intertype methods and covariant returns - error"> + <compile files="pr91381_2.aj"> + <message kind="error" line="15" text="The return type is incompatible with A.foo()"/> + </compile> + </ajc-test> + + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridging with covariance 1 - normal"> + <compile files="Bridging1.aj,Util.java" options="-1.5"/> + <run class="Bridging1"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="C D.method1() [BridgeMethod]"/> + <line text="D D.method1()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridging with covariance 1 - itd"> + <compile files="BridgingITD1.aj,Util.java" options="-1.5"/> + <run class="BridgingITD1"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="C D.method1() [BridgeMethod]"/> + <line text="D D.method1()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="basic bridging with type vars - 1 - normal"> + <compile files="Bridging2.aj,Util.java" options="-1.5"/> + <run class="Bridging2"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="java.lang.Object D.next() [BridgeMethod]"/> + <line text="java.lang.String D.next()"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="basic bridging with type vars - 1 - itd"> + <compile files="BridgingITD2.aj,Util.java" options="-1.5"/> + <run class="BridgingITD2"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="java.lang.Object D.next() [BridgeMethod]"/> + <line text="java.lang.String D.next()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="basic bridging with type vars - 2 - normal"> + <compile files="Bridging3.aj,Util.java" options="-1.5"/> + <run class="Bridging3"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="java.lang.Object D.id(java.lang.Object) [BridgeMethod]"/> + <line text="java.lang.String D.id(java.lang.String)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="basic bridging with type vars - 2 - itd"> + <compile files="BridgingITD3.aj,Util.java" options="-1.5"/> + <run class="BridgingITD3"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="java.lang.Object D.id(java.lang.Object) [BridgeMethod]"/> + <line text="java.lang.String D.id(java.lang.String)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="Abstract intertype method and covariant returns" pr="91381"> + <compile files="pr91381.aj" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'A' (pr91381.aj) has intertyped method from 'pr91381' (pr91381.aj:'java.lang.Object A.foo()')"/> + </compile> + <run class="pr91381"/> + </ajc-test> + <!-- end of generics/itds and bridge methods --> + + + <!-- generics and pointcuts --> + + <ajc-test dir="java5/generics/pointcuts" title="handler pcd and generics / type vars"> + <compile files="GenericInterface.java,HandlerPointcutTests.aj" options="-1.5"> + <message kind="error" line="4" text="Syntax error on token"/> + <message kind="error" line="8" text="a parameterized type pattern may not be used in a handler pointcut expression"/> + <message kind="warning" line="8" text="no match for this type name: T"/> + <message kind="error" line="11" text="a parameterized type pattern may not be used in a handler pointcut expression"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="pointcuts that dont allow type vars"> + <compile files="PointcutsThatDontAllowTypeVars.aj" options="-1.5"> + <message kind="error" line="3" text="Syntax error on token"/> + <message kind="error" line="5" text="Syntax error on token"/> + <message kind="error" line="7" text="Syntax error on token"/> + <message kind="error" line="9" text="Syntax error on token"/> + <message kind="error" line="11" text="Syntax error on token"/> + <message kind="error" line="13" text="Syntax error on token"/> + <message kind="error" line="15" text="Syntax error on token"/> + <message kind="error" line="17" text="Syntax error on token"/> + <message kind="error" line="19" text="Syntax error on token"/> + <message kind="error" line="21" text="Syntax error on token"/> + <message kind="error" line="23" text="Syntax error on token"/> + <message kind="error" line="25" text="Syntax error on token"/> + <message kind="error" line="27" text="Syntax error on token"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="annotation pcds with parameterized types"> + <compile files="ParameterizedTypesInAtPCDs.aj" options="-1.5"> + <message kind="error" line="3" text="Syntax error on token"/> + <message kind="error" line="5" text="Syntax error on token"/> + <message kind="error" line="7" text="Syntax error on token"/> + <message kind="error" line="9" text="Syntax error on token"/> + <message kind="error" line="11" text="Syntax error on token"/> + <message kind="error" line="13" text="Syntax error on token"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="annotation patterns with parameterized types"> + <compile files="ParameterizedTypesInAnnotationPatterns.aj" options="-1.5"> + <message kind="error" line="5" text="is not an annotation type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="staticinitialization and parameterized types"> + <compile files="GenericInterface.java,GenericImplementingClass.java,StaticInitializationWithParameterizedTypes.aj" options="-1.5"> + <message kind="error" line="4" text="no static initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="6" text="no static initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="9" text="no static initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="11" text="no static initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="14" text="no static initialization join points for parameterized types, use raw type instead"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="staticinitialization and parameterized type matching"> + <compile files="GenericInterface.java,GenericImplementingClass.java,ConcreteImplementingClass.java,ConcreteExtendingClass.java,StaticInitializationWithParameterizedTypesMatching.aj" options="-1.5"> + <message kind="warning" line="1" text="clinit(GenericInterface<Double>+)"/> + <message kind="warning" line="3" text="clinit(GenericInterface<Double>+)"/> + <message kind="warning" line="3" text="clinit(GenericImplementingClass<Double>+)"/> + <message kind="warning" line="15" text="Type java.lang.String does not meet the specification for type parameter 1 (N extends java.lang.Number) in generic type GenericInterface"/> + <message kind="warning" line="19" text="Type pattern does not match because the wrong number of type parameters are specified: Type GenericInterface requires 1 parameter(s)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="staticinitialization with generic types"> + <compile files="GenericInterface.java,GenericImplementingClass.java,StaticInitializationWithGenericTypes.aj" options="-1.5"> + <message kind="warning" line="1" text="one generic param, correct bounds"/> + <message kind="warning" line="1" text="doesn't matter what type variable name you use"/> + <message kind="warning" line="1" text="works with classes too"/> + <message kind="warning" line="4" text="Type T does not meet the specification for type parameter 1 (N extends java.lang.Number) in generic type GenericInterface"/> + <message kind="warning" line="20" text="Type pattern does not match because the wrong number of type parameters are specified: Type GenericImplementingClass requires 1 parameter(s)"/> + <message kind="warning" line="24" text="Type N extends java.lang.Number & java.lang.Comparable does not meet the specification for type parameter 1 (N extends java.lang.Number) in generic type GenericImplementingClass"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="staticinitialization with generic types - advanced"> + <compile files="StaticInitializationWithGenericTypesAdvanced.aj" options="-1.5"> + <message kind="warning" line="76" text="simple match"/> + <message kind="warning" line="76" text="matches since R and R extends Object are equivalent"/> + <message kind="warning" line="63" text="raw type should match"/> + <message kind="warning" line="63" text="matches all bounds"/> + <message kind="warning" line="63" text="still matches with interfaces specified in a different order"/> + <message kind="warning" line="69" text="matches with type variable inter-dependencies"/> + <message kind="warning" line="76" text="matches any generic type with one unbound type var"/> + <message kind="warning" line="82" text="any generic type with one type var bound to Number or subtype"/> + <message kind="warning" line="63" text="matches a generic type with any upper bound and i/f bounds"/> + <message kind="warning" line="76" text="matches a generic type with any upper bound and i/f bounds"/> + <message kind="warning" line="82" text="matches a generic type with any upper bound and i/f bounds"/> + <message kind="warning" line="19" text="Type X does not meet the specification for type parameter 1 (T extends java.lang.Number & java.lang.Comparable & java.io.Serializable) in generic type ClassWithInterfaceBounds"/> + <message kind="warning" line="23" text="Type Y extends java.lang.Number does not meet the specification for type parameter 1 (T extends java.lang.Number & java.lang.Comparable & java.io.Serializable) in generic type ClassWithInterfaceBounds"/> + <message kind="warning" line="27" text="Type Z extends java.lang.Number & java.lang.Comparable does not meet the specification for type parameter 1 (T extends java.lang.Number & java.lang.Comparable & java.io.Serializable) in generic type ClassWithInterfaceBounds"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="within pcd with various parameterizations and generic types - errors"> + <compile files="WithinPointcutMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="error" line="4" text="parameterized type pattern not supported by 'within', use a raw type pattern instead"/> + <message kind="error" line="5" text="parameterized type pattern not supported by 'within', use a raw type pattern instead"/> + <message kind="error" line="6" text="parameterized type pattern not supported by 'within', use a raw type pattern instead"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="within pcd with various parameterizations and generic types - warnings"> + <compile files="WithinPointcutMatchingWarnings.aj" options="-1.5"> + <message kind="warning" line="16" text="matched set correctly"/> + <message kind="warning" line="18" text="matched execution correctly"/> + <message kind="warning" line="24" text="init matched correctly"/> + <message kind="warning" line="32" text="matched parameterization ok"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="this and target with various parameterizations and generic types - errors"> + <compile files="ThisAndTargetPointcutMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="warning" line="5" text="no match for this type name: T"/> + <message kind="error" line="4" text="parameterized types not supported for this and target pointcuts (erasure limitation)"/> + <message kind="error" line="5" text="parameterized types not supported for this and target pointcuts (erasure limitation)"/> + <message kind="error" line="6" text="parameterized types not supported for this and target pointcuts (erasure limitation)"/> + <message kind="error" line="7" text="parameterized types not supported for this and target pointcuts (erasure limitation)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="this and target with various parameterizations and generic types - runtime"> + <compile files="ThisAndTargetPointcutMatchingRuntime.aj" options="-1.5"> + </compile> + <run class="ThisAndTargetPointcutMatchingRuntime"> + <stdout> + <line text="set and this matched ok"/> + <line text="set and target matched ok"/> + <line text="call and target matched ok"/> + <line text="execution and this matched ok"/> + <line text="execution and target matched ok"/> + <line text="parameterized call and target matched ok"/> + <line text="parameterized call and this matched ok"/> + <line text="parameterized call and target matched ok"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="get and set with various parameterizations and generic types - errors"> + <compile files="GetAndSetPointcutMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="warning" line="5" text="no match for this type name: T"/> + <message kind="error" line="4" text="can't use parameterized type patterns for the declaring type of a get or set pointcut expression (use the raw type instead)"/> + <message kind="error" line="5" text="can't use parameterized type patterns for the declaring type of a get or set pointcut expression (use the raw type instead)"/> + <message kind="error" line="6" text="can't use parameterized type patterns for the declaring type of a get or set pointcut expression (use the raw type instead)"/> + <message kind="error" line="7" text="can't use parameterized type patterns for the declaring type of a get or set pointcut expression (use the raw type instead)"/> + <message kind="error" line="8" text="can't use parameterized type patterns for the declaring type of a get or set pointcut expression (use the raw type instead)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="get and set with various parameterizations and generic declaring types"> + <compile files="GetAndSetPointcutMatchingDeclaringType.aj" options="-1.5"> + <message kind="warning" line="15" text="generic/param get matching ok"/> + <message kind="warning" line="33" text="generic/param get matching ok"/> + <message kind="warning" line="12" text="generic/param set matching ok"/> + <message kind="warning" line="32" text="generic/param set matching ok"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="get and set with various parameterizations and generic field types"> + <compile files="GetAndSetPointcutMatchingFieldType.aj" options="-1.5"> + <message kind="warning" line="13" text="raw field type matching in get ok"/> + <message kind="warning" line="14" text="raw field type matching in set ok"/> + <message kind="warning" line="49" text="erasure matching in get ok"/> + <message kind="warning" line="45" text="erasure matching in set ok"/> + <message kind="warning" line="53" text="erasure matching in get with params ok"/> + <message kind="warning" line="46" text="erasure matching in set with params ok"/> + <message kind="warning" line="72" text="parameterized type matching in set ok"/> + <message kind="warning" line="73" text="parameterized type matching in get ok"/> + <message kind="warning" line="74" text="parameterized type matching in set ok x2"/> + <message kind="warning" line="75" text="parameterized type matching in get ok x2"/> + <message kind="warning" line="83" text="wildcard set matching ok"/> + <message kind="warning" line="84" text="wildcard get matching ok"/> + <message kind="warning" line="85" text="wildcard extends set matching ok"/> + <message kind="warning" line="86" text="wildcard extends get matching ok"/> + <message kind="warning" line="87" text="wildcard super set matching ok"/> + <message kind="warning" line="88" text="wildcard super get matching ok"/> + <message kind="warning" line="73" text="the really wild show"/> + <message kind="warning" line="84" text="the really wild show"/> + <message kind="warning" line="86" text="the really wild show"/> + <message kind="warning" line="88" text="the really wild show"/> + <message kind="warning" line="53" text="the really wild show"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="init and preinit with parameterized declaring types"> + <compile files="InitializationPointcutMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="warning" line="5" text="no match for this type name: T"/> + <message kind="error" line="4" text="no [pre]initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="5" text="no [pre]initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="6" text="no [pre]initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="7" text="no [pre]initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="8" text="no [pre]initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="9" text="invalid throws pattern: a generic class may not be a direct or indirect subclass of Throwable"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="init and preinit with raw declaring type pattern"> + <compile files="InitializationPointcutMatchingDeclaringType.aj" options="-1.5"> + <message kind="warning" line="10" text="generic/param init matching ok"/> + <message kind="warning" line="10" text="generic/param preinit matching ok"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="init and preinit with parameterized parameter types"> + <compile files="InitializationPointcutMatchingParamTypes.aj" options="-1.5"> + <message kind="warning" line="36" text="raw param type matching in init ok"/> + <message kind="warning" line="36" text="raw param type matching in preinit ok"/> + <message kind="warning" line="37" text="erasure matching in init ok"/> + <message kind="warning" line="37" text="erasure matching in preinit ok"/> + <message kind="warning" line="38" text="erasure matching in init with params ok"/> + <message kind="warning" line="38" text="erasure matching in preinit with params ok"/> + <message kind="warning" line="48" text="parameterized type matching in init ok"/> + <message kind="warning" line="48" text="parameterized type matching in preinit ok"/> + <message kind="warning" line="49" text="parameterized type matching in init ok x2"/> + <message kind="warning" line="49" text="parameterized type matching in preinit ok x2"/> + <message kind="warning" line="50" text="wildcard init matching ok"/> + <message kind="warning" line="50" text="wildcard preinit matching ok"/> + <message kind="warning" line="51" text="wildcard extends init matching ok"/> + <message kind="warning" line="51" text="wildcard extends preinit matching ok"/> + <message kind="warning" line="52" text="wildcard super init matching ok"/> + <message kind="warning" line="52" text="wildcard super preinit matching ok"/> + <message kind="warning" line="48" text="the really wild show"/> + <message kind="warning" line="50" text="the really wild show"/> + <message kind="warning" line="51" text="the really wild show"/> + <message kind="warning" line="52" text="the really wild show"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="withincode with various parameterizations and generic types - errors"> + <compile files="WithincodePointcutMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="error" line="4" text="can't use parameterized type patterns for the declaring type of a withincode pointcut expression (use the raw type instead)"/> + <message kind="error" line="5" text="can't use parameterized type patterns for the declaring type of a withincode pointcut expression (use the raw type instead)"/> + <message kind="error" line="6" text="invalid throws pattern: a generic class may not be a direct or indirect subclass of Throwable"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="withincode with various parameterizations and generic types - matching"> + <compile files="WithinCodePointcutMatchingParamAndReturnTypes.aj" options="-1.5"> + <message kind="warning" line="35" text="raw param type matching in withincode ok"/> + <message kind="warning" line="36" text="raw param type matching in withincode ok"/> + <message kind="warning" line="67" text="raw return type matching in withincode ok"/> + <message kind="warning" line="38" text="erasure type matching in withincode ok"/> + <message kind="warning" line="39" text="erasure type matching in withincode ok"/> + <message kind="warning" line="42" text="erasure type matching in withincode ok"/> + <message kind="warning" line="62" text="withincode and parameterized method ok"/> + <message kind="warning" line="62" text="withincode and generic interface ok"/> + <message kind="warning" line="65" text="withincode and interface control test"/> + <message kind="warning" line="35" text="match on parameterized args"/> + <message kind="warning" line="36" text="match on parameterized args"/> + <message kind="warning" line="67" text="match on parameterized return type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="withincode with overriding of inherited generic members"> + <compile files="WithinCodeOverriding.aj" options="-1.5"> + <message kind="warning" line="37" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="50" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="63" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="37" text="base declaring type match on erasure"/> + <message kind="warning" line="50" text="base declaring type match on erasure"/> + <message kind="warning" line="63" text="base declaring type match on erasure"/> + <message kind="warning" line="50" text="sub type match on erasure"/> + <message kind="warning" line="63" text="parameterized match on erasure"/> + <message kind="warning" line="80" text="erasure match on base interface"/> + <message kind="warning" line="80" text="wildcard match on erasure"/> + <message kind="warning" line="80" text="parameterized match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution pcd with raw type matching"> + <compile files="GenericInterface.java,ConcreteImplementingClass.java,GenericImplementingClass.java,RawTypeMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="execution(* GenericInterface.*(..))"/> + <message kind="warning" line="5" text="execution(* GenericInterface.*(..))"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution pcd with raw signature matching"> + <compile files="GenericInterface.java,ConcreteImplementingClass.java,GenericImplementingClass.java,RawSignatureMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="execution(* GenericInterface.asInt(Number))"/> + <message kind="warning" line="5" text="execution(* GenericInterface.asInt(Number))"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution with various parameterizations and generic types - errors"> + <compile files="ExecutionPointcutMatchingErrorCases.aj" options="-1.5"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="error" line="4" text="can't use parameterized type patterns for the declaring type of an execution pointcut expression (use the raw type instead)"/> + <message kind="error" line="5" text="can't use parameterized type patterns for the declaring type of an execution pointcut expression (use the raw type instead)"/> + <message kind="error" line="6" text="invalid throws pattern: a generic class may not be a direct or indirect subclass of Throwable"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution with various parameterizations and generic types - matching"> + <compile files="ExecutionPointcutMatchingParamAndReturnTypes.aj" options="-1.5"> + <message kind="warning" line="35" text="raw param type matching in execution ok"/> + <message kind="warning" line="67" text="raw return type matching in execution ok"/> + <message kind="warning" line="38" text="erasure type matching in execution ok"/> + <message kind="warning" line="42" text="erasure type matching in execution ok"/> + <message kind="warning" line="61" text="execution and parameterized method ok"/> + <message kind="warning" line="61" text="execution and generic interface ok"/> + <message kind="warning" line="65" text="execution and interface control test"/> + <message kind="warning" line="35" text="match on parameterized args"/> + <message kind="warning" line="67" text="match on parameterized return type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution with overriding of inherited generic members"> + <compile files="ExecutionOverriding.aj" options="-1.5"> + <message kind="warning" line="36" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="49" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="62" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="36" text="base declaring type match on erasure"/> + <message kind="warning" line="49" text="base declaring type match on erasure"/> + <message kind="warning" line="62" text="base declaring type match on erasure"/> + <message kind="warning" line="49" text="sub type match on erasure"/> + <message kind="warning" line="62" text="parameterized match on erasure"/> + <message kind="warning" line="79" text="erasure match on base interface"/> + <message kind="warning" line="79" text="wildcard match on erasure"/> + <message kind="warning" line="79" text="parameterized match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution pcd with generic declaring type and erased parameter types"> + <compile files="GenericInterface.java,ConcreteImplementingClass.java,GenericImplementingClass.java,GenericDeclaringTypeWithParameterErasure.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution pcd with generic signature matching"> + <compile files="GenericInterface.java,ConcreteImplementingClass.java,GenericImplementingClass.java,GenericSignatureMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="execution<T>(* GenericInterface<T extends Number>.asInt(T))"/> + <message kind="warning" line="5" text="execution<T>(* GenericInterface<T extends Number>.asInt(T))"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="call with various parameterizations and generic types - errors"> + <compile files="CallPointcutMatchingErrorCases.aj" options="-1.5"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="error" line="4" text="can't use parameterized type patterns for the declaring type of a call pointcut expression (use the raw type instead)"/> + <message kind="error" line="5" text="can't use parameterized type patterns for the declaring type of a call pointcut expression (use the raw type instead)"/> + <message kind="error" line="6" text="invalid throws pattern: a generic class may not be a direct or indirect subclass of Throwable"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="call with various parameterizations and generic types - matching"> + <compile files="CallPointcutMatchingParamAndReturnTypes.aj" options="-1.5"> + <message kind="warning" line="7" text="raw param type matching in call ok"/> + <message kind="warning" line="8" text="raw return type matching in call ok"/> + <message kind="warning" line="9" text="erasure type matching in call ok"/> + <message kind="warning" line="10" text="erasure type matching in call ok"/> + <message kind="warning" line="11" text="call and parameterized method ok"/> + <message kind="warning" line="11" text="call and generic interface ok"/> + <message kind="warning" line="12" text="call and interface control test"/> + <message kind="warning" line="7" text="match on parameterized args"/> + <message kind="warning" line="8" text="match on parameterized return type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="call with overriding of inherited generic members"> + <compile files="CallOverriding.aj" options="-1.5"> + <message kind="warning" line="8" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="9" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="10" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="8" text="base declaring type match on erasure"/> + <message kind="warning" line="9" text="base declaring type match on erasure"/> + <message kind="warning" line="10" text="base declaring type match on erasure"/> + <message kind="warning" line="9" text="sub type match on erasure"/> + <message kind="warning" line="10" text="parameterized match on erasure"/> + <message kind="warning" line="87" text="erasure match on base interface"/> + <message kind="warning" line="87" text="wildcard match on erasure"/> + <message kind="warning" line="87" text="parameterized match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="call with bridge methods"> + <compile files="CallWithBridgeMethods.aj" options="-1.5"> + <!-- see testcode + <message kind="warning" line="23" text="should match call to bridge method on L23, this is a real call!"/> + --> + </compile> + </ajc-test> + + + <ajc-test dir="java5/generics/pointcuts" title="args with raw type and generic / parameterized sigs"> + <compile files="RawArgs.aj" options="-1.5"> + </compile> + <run class="RawArgs"> + <stdout> + <line text="args(List) match at call(void Generic.foo(List))"/> + <line text="args(List) match at call(void Generic.bar(List))"/> + <line text="args(List) match at call(void Generic.tada(List))"/> + <line text="args(List) match at call(void Generic.tada(List))"/> + <line text="args(List) match at call(void Generic.tada(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="args with parameterized type and generic / parameterized sigs"> + <compile files="ArgsParameterized.aj" options="-1.5"> + <message kind="warning" line="28" text="unchecked match of List<String> with List"/> + </compile> + <run class="ArgsParameterized"> + <stdout> + <line text="args(List<String> matched at call(void Generic.foo(List))"/> + <line text="args(List<String> matched at call(void Generic.bar(List))"/> + <line text="args(List<String> matched at call(void Generic.tada(List))"/> + <line text="args(List<String> matched at call(void Generic.something(List))"/> + <line text="args(List<String> matched at call(void MustBeString.listit(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="args with parameterized type and wildcards"> + <compile files="ArgsParameterizedWithWildcards.aj" options="-1.5"> + <message kind="warning" line="10" text="unchecked match of List<Double> with List when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Double> when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Number> when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<?> when argument is an instance of List"/> + </compile> + <run class="ArgsParameterizedWithWildcards"> + <stdout> + <line text="List<Double> matched at execution(void C.rawList(List))"/> + <line text="List<Double> matched at execution(void C.listOfSomething(List))"/> + <line text="List<Double> matched at execution(void C.listOfSomeNumber(List))"/> + <line text="List<Double> matched at execution(void C.listOfDouble(List))"/> + <line text="List<Double> matched at execution(void C.listOfSomeDouble(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="args with generic wildcard"> + <compile files="ArgsListOfSomething.aj" options="-1.5 -Xlint:ignore"> + </compile> + <run class="ArgsListOfSomething"> + <stdout> + <line text="List<?> matches execution(void ArgsListOfSomething.rawList(List))"/> + <line text="List<?> matches execution(void ArgsListOfSomething.listOfString(List))"/> + <line text="List<?> matches execution(void ArgsListOfSomething.listOfSomething(List))"/> + <line text="List<?> matches execution(void ArgsListOfSomething.listOfSomethingExtends(List))"/> + <line text="List<?> matches execution(void ArgsListOfSomething.listOfSomethingSuper(List))"/> + <line text="wild map matches execution(void ArgsListOfSomething.mapit(Map))"/> + <line text="exact wild map matches execution(void ArgsListOfSomething.mapit(Map))"/> + <line text="super type exact matches execution(void ArgsListOfSomething.setOf(HashSet))"/> + <line text="super wild type matches execution(void ArgsListOfSomething.setOf(HashSet))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="args with generic wildcard extends"> + <compile files="ArgsListOfSomethingExtends.aj" options="-1.5"> + <message kind="warning" line="27" text="unchecked match of List<? extends Number> with List"/> + <message kind="warning" line="27" text="unchecked match of List<? extends Number> with List<?>"/> + </compile> + <run class="ArgsListOfSomethingExtends"> + <stdout> + <line text="List<? extends Number> matches execution(void ArgsListOfSomethingExtends.rawList(List))"/> + <line text="List<? extends Number> matches execution(void ArgsListOfSomethingExtends.listOfNumber(List))"/> + <line text="List<? extends Number> matches execution(void ArgsListOfSomethingExtends.listOfDouble(List))"/> + <line text="List<? extends Number> matches execution(void ArgsListOfSomethingExtends.listOfSomething(List))"/> + <line text="List<? extends Number> matches execution(void ArgsListOfSomethingExtends.listOfSomethingExtends(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="args with generic wildcard super"> + <compile files="ArgsListOfSomethingSuper.aj" options="-1.5"> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List"/> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List<?>"/> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List<? extends Number>"/> + </compile> + <run class="ArgsListOfSomethingSuper"> + <stdout> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.rawList(List))"/> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.listOfObject(List))"/> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.listOfNumber(List))"/> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.listOfSomething(List))"/> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.listOfSomethingSuper(List))"/> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.listOfSomethingExtendsNumber(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="generic method matching"> + <compile files="GenericMethods.aj" options="-1.5"> + <message kind="warning" line="19" text="static generic method match"/> + <message kind="warning" line="34" text="static generic method match"/> + <message kind="warning" line="24" text="instance generic method match"/> + <message kind="warning" line="39" text="instance generic method match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="generic wildcards in signature matching"> + <compile files="GenericWildcardsInSignatureMatching.aj" options="-1.5"> + <message kind="warning" line="5" text="set of a list"/> + <message kind="warning" line="7" text="exact nested wildcard match"/> + <message kind="warning" line="7" text="wildcard nested wildcard match"/> + <message kind="warning" line="11" text="super"/> + <message kind="warning" line="15" text="super wild match"/> + </compile> + </ajc-test> + + <!-- end of generics and pointcuts tests --> + + <ajc-test dir="java5/generics/afterAdvice" title="after throwing with parameterized throw type"> + <compile files="AfterThrowing.aj" options="-1.5"> + <message kind="error" line="6" text="cannot convert from List<String> to Throwable"/> + </compile> + </ajc-test> + + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with raw type and generic / parameterized sigs"> + <compile files="AfterReturningRawType.aj" options="-1.5"> + </compile> + <run class="AfterReturningRawType"> + <stdout> + <line text="returning(List) match at call(List Generic.foo(List))"/> + <line text="returning(List) match at call(List Generic.bar(List))"/> + <line text="returning(List) match at call(List Generic.tada(List))"/> + <line text="returning(List) match at call(List Generic.tada(List))"/> + <line text="returning(List) match at call(List Generic.tada(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with parameterized type and generic / parameterized sigs"> + <compile files="AfterReturningParameterized.aj" options="-1.5"> + <message kind="warning" line="28" text="unchecked match of List<String> with List"/> + </compile> + <run class="AfterReturningParameterized"> + <stdout> + <line text="returning(List<String> matched at call(List Generic.foo(List))"/> + <line text="returning(List<String> matched at call(List Generic.bar(List))"/> + <line text="returning(List<String> matched at call(List Generic.tada(List))"/> + <line text="returning(List<String> matched at call(List Generic.something(List))"/> + <line text="returning(List<String> matched at call(List MustBeString.listit(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with parameterized type and wildcards"> + <compile files="AfterReturningParameterizedWithWildcards.aj" options="-1.5"> + <message kind="warning" line="10" text="unchecked match of List<Double> with List when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Double> when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Number> when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<?> when argument is an instance of List"/> + </compile> + <run class="AfterReturningParameterizedWithWildcards"> + <stdout> + <line text="List<Double> matched at call(List C.rawList(List))"/> + <line text="List<Double> matched at call(List C.listOfSomething(List))"/> + <line text="List<Double> matched at call(List C.listOfSomeNumber(List))"/> + <line text="List<Double> matched at call(List C.listOfDouble(List))"/> + <line text="List<Double> matched at call(List C.listOfSomeDouble(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with generic wildcard"> + <compile files="AfterReturningListOfSomething.aj" options="-1.5"> + <!-- warning is unchecked match of List<?> from line 28 onto line 15. --> + <!-- some sets may be lists unless the set is final, so as a cast is allowed, the match is allowed --> + <message kind="warning" line="28"/> + <message kind="warning" line="44"/> + <message kind="warning" line="48"/> + </compile> + <run class="AfterReturningListOfSomething"> + <stdout> + <line text="List<?> matches execution(List AfterReturningListOfSomething.rawList(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfString(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfSomething(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfSomethingExtends(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfSomethingSuper(List))"/> + <line text="wild map matches execution(Map AfterReturningListOfSomething.mapit(Map))"/> + <line text="exact wild map matches execution(Map AfterReturningListOfSomething.mapit(Map))"/> + <line text="super type exact matches execution(HashSet AfterReturningListOfSomething.setOf(HashSet))"/> + <line text="super wild type matches execution(HashSet AfterReturningListOfSomething.setOf(HashSet))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with generic wildcard extends"> + <compile files="AfterReturningListOfSomethingExtends.aj" options="-1.5"> + <message kind="warning" line="27" text="unchecked match of List<? extends Number> with List"/> + <message kind="warning" line="27" text="unchecked match of List<? extends Number> with List<?>"/> + </compile> + <run class="AfterReturningListOfSomethingExtends"> + <stdout> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.rawList(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfNumber(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfDouble(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfSomething(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfSomethingExtends(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with generic wildcard super"> + <compile files="AfterReturningListOfSomethingSuper.aj" options="-1.5"> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List"/> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List<?>"/> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List<? extends Number>"/> + </compile> + <run class="AfterReturningListOfSomethingSuper"> + <stdout> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.rawList(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfObject(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfNumber(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfSomething(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfSomethingSuper(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfSomethingExtendsNumber(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test title="ajdk notebook: erasure matching examples" dir="java5/generics/ajdk"> + <compile files="ErasureMatching.aj" options="-1.5"> + <message kind="warning" line="18" text="static generic method match"/> + <message kind="warning" line="21" text="instance generic method match"/> + <message kind="warning" line="31" text="method in generic type match"/> + <message kind="warning" line="28" text="field in generic type match"/> + </compile> + </ajc-test> + + <ajc-test title="ajdk notebook: simple parameterized type matching examples" dir="java5/generics/ajdk"> + <compile files="SimpleParameterizedTypeExamples.aj" options="-1.5"> + <message kind="warning" line="34" text="get myStrings 1"/> + <message kind="warning" line="34" text="get myStrings 2"/> + <message kind="warning" line="38" text="get myStrings 1"/> + <message kind="warning" line="38" text="get myStrings 2"/> + <message kind="warning" line="35" text="get myFloats 1"/> + <message kind="warning" line="35" text="get myFloats 2"/> + <message kind="warning" line="35" text="get myFloats 3"/> + <message kind="warning" line="34" text="getter 1"/> + <message kind="warning" line="35" text="getter 1"/> + <message kind="warning" line="34" text="getter 2"/> + <message kind="warning" line="35" text="getter 2"/> + <message kind="warning" line="34" text="getter 3"/> + <message kind="warning" line="35" text="getter 4"/> + <message kind="warning" line="25" text="call 1"/> + <message kind="warning" line="25" text="call 2"/> + </compile> + </ajc-test> + + <ajc-test title="ajdk notebook: mixed parameterized types and generic methods" dir="java5/generics/ajdk"> + <compile files="MixedParameterizedAndTypeVariables.aj" options="-1.5"> + <message kind="warning" line="13" text="erasure match"/> + <message kind="warning" line="13" text="mixed match"/> + <message kind="warning" line="13" text="params only match"/> + </compile> + </ajc-test> + + <ajc-test title="ajdk notebook: signature matching with generic wildcards" dir="java5/generics/ajdk"> + <compile files="SignatureWildcards.aj" options="-1.5"> + <message kind="warning" line="13" text="any list"/> + <message kind="warning" line="15" text="any list"/> + <message kind="warning" line="17" text="any list"/> + <message kind="warning" line="13" text="only foo"/> + <message kind="warning" line="15" text="some list"/> + <message kind="warning" line="13" text="any list with upper bound"/> + <message kind="warning" line="15" text="any list with upper bound"/> + </compile> + </ajc-test> + + <ajc-test title="ajdk notebook: bridge method examples" dir="java5/generics/ajdk"> + <compile files="BridgeMethodExamples.aj" options="-1.5"> + <message kind="warning" line="17" text="double match"/> + <message kind="warning" line="25" text="double match"/> + <message kind="warning" line="9" text="match"/> + <message kind="warning" line="11" text="match"/> + </compile> + </ajc-test> + + <ajc-test title="ajdk notebook: args examples" dir="java5/generics/ajdk"> + <compile files="ArgsExamples.aj" options="-1.5"> + <message kind="warning" line="15" text="unchecked match of List<Double> with List<? extends Number> when argument is an instance of List at join point method-execution(void C.goo(List<? extends Number>)) [Xlint:uncheckedArgument]"/> + <message kind="warning" line="53" text="unchecked match"/> + </compile> + <run class="ArgsExamples"> + <stdout> + <line text="args(List)"/> + <line text="args List of String"/> + <line text="args(List)"/> + <line text="args List of Double"/> + <line text="args(List)"/> + <line text="args List of Double"/> + </stdout> + </run> + </ajc-test> + + <ajc-test title="ajdk notebook: after returning examples" dir="java5/generics/ajdk"> + <compile files="AfterReturningExamples.aj" options="-1.5"> + <message kind="warning" line="20" text="unchecked match of List<Double> with List<? extends Number>"/> + </compile> + <run class="AfterReturningExamples"> + <stdout> + <line text="execution(List C.foo(List))"/> + <line text="raw s1"/> + <line text="raw s2"/> + <line text="execution(List C.bar(List))"/> + <line text="raw 5.0"/> + <line text="raw 10.0"/> + <line text="a1 5.0"/> + <line text="a1 10.0"/> + <line text="a2 5.0"/> + <line text="a2 10.0"/> + <line text="a3 5.0"/> + <line text="a3 10.0"/> + <line text="execution(List C.goo(List))"/> + <line text="raw 5.0"/> + <line text="raw 10.0"/> + <line text="a1 5.0"/> + <line text="a1 10.0"/> + <line text="a3 5.0"/> + <line text="a3 10.0"/> + </stdout> + </run> + </ajc-test> + + <ajc-test title="ajdk notebook: args and wildcards examples" dir="java5/generics/ajdk"> + <compile files="WildcardArgsExamples.aj" options="-1.5"> + <message kind="warning" line="6" text="unchecked match of List<? extends Number> with List"/> + </compile> + <run class="WildcardArgsExamples"> + <stdout> + <line text="advice match at call(void C.foo(Object))"/> + <line text="advice match at call(void C.foo(Object))"/> + <line text="advice match 2 at call(void C.goo1(List))"/> + <line text="advice match 2 at call(void C.goo2(List))"/> + <line text="advice match 2 at call(void C.goo4(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test title="ajdk notebook: pointcut in generic class example" dir="java5/generics/ajdk"> + <compile files="PointcutInGenericClassExample.aj" options="-1.5"> + <message kind="warning" line="23" text="parameterized with C"/> + <message kind="warning" line="29" text="parameterized with D"/> + </compile> + </ajc-test> + + <!-- ============================================================== --> + <!-- End of generics tests --> + <!-- ============================================================== --> + + <ajc-test dir="bugs150/pr98901" title="public method with declare @method"> + <compile files="Case01.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B01"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="Compiler error due to a wrong exception check in try blocks"> + <compile files="pr82989.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public method on the aspect that declares @method on it"> + <compile files="Case02.aj" options="-1.5 -Xlint:error"/> + <run class="B02"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public annotated method"> + <compile files="Case03.aj" options="-1.5 -Xlint:error"/> + <run class="B03"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public ITD method with declare @method"> + <compile files="Case04.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B04"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public annotated ITD method"> + <compile files="Case05.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B05"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public ITD-on-itself method with declare @method"> + <compile files="Case06.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B06"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public annotated ITD-on-itself method"> + <compile files="Case07.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B07"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public method on an Interface with declare @method"> + <compile files="Case08.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B08"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public annotated method on an Interface"> + <compile files="Case09.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B09"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public ITD method onto an Interface with declare @method"> + <compile files="Case10.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B10"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public annotated ITD method onto an Interface"> + <compile files="Case11.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B11"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract method with declare @method"> + <compile files="Case12.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B12"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract method on the aspect that declares @method on it"> + <compile files="Case13.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B13"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract annotated method"> + <compile files="Case14.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B14"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract ITD method with declare @method"> + <compile files="Case15.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B15"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract annotated ITD method"> + <compile files="Case16.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B16"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract ITD-on-itself method with declare @method"> + <compile files="Case17.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B17"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract annotated ITD-on-itself method"> + <compile files="Case18.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B18"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract method on an Interface with declare @method"> + <compile files="Case19.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B19"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract annotated method on an Interface"> + <compile files="Case20.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B20"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract ITD method onto an Interface with declare @method"> + <compile files="Case21.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B21"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract annotated ITD method onto an Interface"> + <compile files="Case22.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B22"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public field with declare @field"> + <compile files="Case23.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B23"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + +<ajc-test dir="bugs150/pr98901" title="public field on the aspect that declares @field on it"> + <compile files="Case24.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B24"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public annotated field"> + <compile files="Case25.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B25"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public ITD field with declare @field"> + <compile files="Case26.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B26"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public annotated ITD field"> + <compile files="Case27.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B27"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public ITD-on-itself field with declare @field"> + <compile files="Case28.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B28"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public annotated ITD-on-itself field"> + <compile files="Case29.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B29"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="Unable to build shadows"> + <compile files="pr109728.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110788" title="bad generic decp - 1"> + <compile files="Case1.java" options="-1.5"> + <message kind="error" line="10" text="Cannot declare parent B<java.lang.Number> onto type C since it already has A<java.lang.String> in its hierarchy"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr110788" title="bad generic decp - 2"> + <compile files="Case2.java" options="-1.5"> + <message kind="error" line="8" text="Cannot declare parent A<java.lang.Number> onto type C since it already has A<java.lang.String> in its hierarchy"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr110788" title="bad generic decp - 3"> + <compile files="Case3.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110788" title="bad generic decp - 4"> + <compile files="Case4.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110927" title="cant create signature attribute"> + <compile files="Case1.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr72834" title="broken dispatch"> + <compile files="Trouble.java"> + <message kind="error" line="7" text="package visible abstract inter-type declarations are not allowed"/> + <message kind="error" line="9" text="The method getName() is undefined for the type A"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr73856" title="missing accessor"> + <compile files="MissingAccessor.java"/> + <run class="MissingAccessor"/> + </ajc-test> + + <ajc-test dir="bugs150/pr90143" title="cant call super methods"> + <compile files="A.aj"/> + </ajc-test> + + <ajc-test dir="bugs150" title="cunning declare parents"> + <compile files="pr92311.aj"/> + </ajc-test> + + <ajc-test dir="bugs150" title="ITD varargs problem"> + <compile files="pr110906.aj" options="-1.5"/> + <run class="pr110906"> + <stdout> + <line text="a"/> + <line text="a"/> + <line text="a"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="generic itds and abstract method error"> + <compile files="pr102357.aj"/> + <run class="pr102357"/> + </ajc-test> + + <ajc-test dir="bugs150" title="unexpected error unboundFormalInPC"> + <compile files="pr112027.aj"/> + </ajc-test> + + <ajc-test dir="bugs150" title="ITD varargs in constructor"> + <compile files="pr111481.aj" options="-1.5"/> + <run class="pr111481"> + <stdout> + <line text="a"/> + <line text="a"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr112602" title="ClassCastException with generic wildcard"> + <compile files="GenericInterface.java,Implementation.java" options="-1.5,-emacssym"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 1"> + <compile files="Case1.java" options="-1.5"> + <message kind="warning" line="27" text="no match for this type name: Branch [Xlint:invalidAbsoluteTypeName]"/> + <message kind="error" line="26" text="can't bind type name 'Branch'"/> + <message kind="error" line="27" text="can't bind type name 'Revision'"/> + <message kind="error" line="33" text="List cannot be resolved to a type"/> + <message kind="error" line="38" text="List cannot be resolved to a type"/> + <message kind="error" line="39" text="List cannot be resolved to a type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 2"> + <compile files="Case2.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 3"> + <compile files="Case3.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 4"> + <compile files="Case4.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 5"> + <compile files="Case5.java" options="-1.5"> + <!-- might possibly need more diagnostics in this case to explain what has happened --> + <message kind="error" line="10" text="can't override java.util.List<java.lang.String> I.foo() with java.util.List<java.lang.Integer> A.foo() return types don't match"/> + <message kind="error" line="15" text="can't override java.util.List<java.lang.String> I.foo() with java.util.List<java.lang.Integer> A.foo() return types don't match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 6"> + <compile files="Case6.java" options="-1.5"> + <message kind="error" line="8" text="N cannot be resolved to a type"/> + <!--message kind="error" line="7" text="T cannot be resolved to a type"/--> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 7"> + <compile files="Case7.java" options="-1.5"/> + <run class="Case7"> + <stderr> + <line text="in=hello out=hello"/> + <line text="in=35 out=35"/> + <line text="in=[] out=[]"/> + </stderr> + </run> + </ajc-test> + + <!-- generic ITDs --> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design A"> + <compile files="DesignA.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design B"> + <compile files="DesignB.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design C"> + <compile files="DesignC.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design D"> + <compile files="DesignD.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design E"> + <compile files="DesignE.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design F"> + <compile files="DesignF.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design G"> + <compile files="DesignG.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr116626" title="NPE in WeavingAdaptor"> + <compile files="com/foo/bar/Test.java, TestAspect.aj" options="-1.5"/> + <run class="com.foo.bar.Test" ltw="aop.xml" + > + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java, accounts/recovery/Recovery.aj"/> + <run class="services.account.StockQuoteServiceTest"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + <run class="services.account.StockQuoteServiceTest" ltw="aop.xml"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call not self"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java, accounts/recovery/RecoveryNotSelf.aj"/> + <run class="services.account.StockQuoteServiceTest"> + <stdout> + <line text="RecoveryNotSelf.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + <run class="services.account.StockQuoteServiceTest" ltw="aop-notself.xml"> + <stdout> + <line text="RecoveryNotSelf.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call using -XterminateAfterCompilation and LTW"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java"/> + <compile files="accounts/recovery/Recovery.aj" options="-XterminateAfterCompilation"/> + <run class="services.account.StockQuoteServiceTest" ltw="aop.xml"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call using LTW"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java"/> + <compile files="accounts/recovery/Recovery.aj"/> + <run class="services.account.StockQuoteServiceTest" ltw="aop.xml"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call not self using LTW"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java"/> + <compile files="accounts/recovery/RecoveryNotSelf.aj" options="-1.4"/> + <run class="services.account.StockQuoteServiceTest" ltw="aop-notself.xml"> + <stdout> + <line text="RecoveryNotSelf.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call self and not self using LTW"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java"/> + <compile files="accounts/recovery/Recovery.aj, accounts/recovery/RecoveryNotSelf.aj"/> + <run class="services.account.StockQuoteServiceTest" ltw="aop-selfandnotself.xml"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + <line text="RecoveryNotSelf.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call using LTW and -XnoInline"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java"/> + <compile files="accounts/recovery/Recovery.aj"/> + <run class="services.account.StockQuoteServiceTest" ltw="aop-noinline.xml"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr121385" title="override protected pointcut in aop.xml concrete aspect"> + <compile files="Hello.java"/> + <compile files="World.aj, ConcreteWorld.aj" options="-1.4"/> + <run class="Hello" ltw="aop.xml"> + <stdout> + <line text="around start!"/> + <line text="Hello"/> + <line text="around start!"/> + <line text="World"/> + <line text="around end!"/> + <line text="around end!"/> + </stdout> + </run> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjAnnotationGenTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjAnnotationGenTests.java new file mode 100644 index 000000000..bfbc289f6 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjAnnotationGenTests.java @@ -0,0 +1,160 @@ +/******************************************************************************* + * Copyright (c) 2005 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: + * initial development Jonas Bon�r, Alexandre Vasseur + *******************************************************************************/ +package org.aspectj.systemtest.ajc150.ataspectj; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * A suite for @AspectJ aspects located in java5/ataspectj + * + * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> + */ +public class AtAjAnnotationGenTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AtAjAnnotationGenTests.class); + } + + protected File getSpecFile() { + return getClassResource("annotationgen.xml"); + } + + public void testSimpleAspect() { + runTest("annotation gen for simple aspect"); + } + + public void testSimpleAspectIn14Mode() { + runTest("annotation gen for simple aspect pre 1.5"); + } + + public void testAspectAlreadyAnnotated() { + runTest("annotation gen for simple annotated aspect"); + } + + public void testPrivilegedAspect() { + runTest("annotation gen for privileged aspect"); + } + + public void testPerThisAspect() { + runTest("annotation gen for perthis aspect"); + } + + public void testPerTargetAspect() { + runTest("annotation gen for pertarget aspect"); + } + + public void testPerCflowAspect() { + runTest("annotation gen for percflow aspect"); + } + + public void testPerCflowbelowAspect() { + runTest("annotation gen for percflowbelow aspect"); + } + + public void testPertypewithinAspect() { + runTest("annotation gen for pertypewithin aspect"); + } + + public void testInnerAspectOfClass() { + runTest("annotation gen for inner aspect of aspect"); + } + + public void testInnerAspectOfAspect() { + runTest("annotation gen for inner aspect of class"); + } + + public void testAdvice() { + runTest("annotation gen for advice declarations"); + } + + public void testSimplePointcut() { + runTest("annotation gen for simple pointcut"); + } + + public void testPointcutModifiers() { + runTest("annotation gen for pointcut modifiers"); + } + + public void testPointcutParams() { + runTest("annotation gen for pointcut params"); + } + + public void testPointcutRefs() { + runTest("annotation gen for pointcut refs"); + } + + public void testBeforeWithBadReturn() { + runTest("before ann with non-void return"); + } + + public void testTwoAnnotationsOnSameElement() { + runTest("two anns on same element"); + } + + public void testBadPcutInAdvice() { + runTest("bad pcut in after advice"); + } + + public void testBadParameterBinding() { + runTest("bad parameter binding in advice"); + } + + public void testSimpleAtPointcut() { + runTest("simple pointcut no params"); + } + + public void testPointcutMedley() { + runTest("pointcut medley"); + } + + public void testAdviceDeclaredInClass() { + runTest("advice in a class"); + } + + public void testDeows() { + runTest("ann gen for deows"); + } + + // no reliable way to get around classpath issues for + // running this test as part of release script :( +// public void testRuntimePointcutsReferencingCompiledPointcuts() { +// runTest("runtime pointcut resolution referencing compiled pointcuts"); +// } + + public void testDecP() { + runTest("ann gen for decp"); + } + + public void testDecPAdvanced() { + runTest("ann gen for decp 2"); + } + + public void testDecS() { + runTest("ann gen for decs"); + } + + public void testDecPrecedence() { + runTest("ann gen for dec precedence"); + } + + public void testDecAnnotation() { + runTest("ann gen for dec annotation"); + } + + public void testITDs() { + runTest("ann gen for itds"); + } +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java new file mode 100644 index 000000000..966642da2 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java @@ -0,0 +1,237 @@ +/******************************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexandre Vasseur initial implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150.ataspectj; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.util.FileUtil; + +/** + * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> + */ +public class AtAjLTWTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(org.aspectj.systemtest.ajc150.ataspectj.AtAjLTWTests.class); + } + + protected File getSpecFile() { + return getClassResource("ltw.xml"); + } + + public void testRunThemAllWithJavacCompiledAndLTW() { + runTest("RunThemAllWithJavacCompiledAndLTW"); + } + + public void testAjcLTWPerClauseTest_XterminateAfterCompilation() { + runTest("AjcLTW PerClauseTest -XterminateAfterCompilation"); + } + + public void testAjcLTWPerClauseTest_Xreweavable() { + runTest("AjcLTW PerClauseTest -Xreweavable"); + } + + public void testJavaCAjcLTWPerClauseTest() { + runTest("JavaCAjcLTW PerClauseTest"); + } + + public void testAjcLTWAroundInlineMungerTest_XterminateAfterCompilation() { + runTest("AjcLTW AroundInlineMungerTest -XterminateAfterCompilation"); + } + + public void testAjcLTWAroundInlineMungerTest_Xreweavable() { + runTest("AjcLTW AroundInlineMungerTest"); + } + + public void testAjcLTWAroundInlineMungerTest() { + runTest("AjcLTW AroundInlineMungerTest"); + } + + public void testAjcLTWAroundInlineMungerTest_XnoInline_Xreweavable() { + runTest("AjcLTW AroundInlineMungerTest -XnoInline -Xreweavable"); + } + + public void testAjcLTWAroundInlineMungerTest2() { + runTest("AjcLTW AroundInlineMungerTest2"); + } + + public void testLTWDumpNone() { + runTest("LTW DumpTest none"); + + File f = new File("_ajdump/ataspectj/DumpTest.class"); + assertFalse(f.exists()); + f = new File("_ajdump/_before/ataspectj/DumpTestTheDump.class"); + assertFalse(f.exists()); + f = new File("_ajdump/ataspectj/DumpTestTheDump.class"); + assertFalse(f.exists()); + } + + public void testLTWDump() { + runTest("LTW DumpTest"); + + File f = new File("_ajdump/ataspectj/DumpTest.class"); + assertFalse(f.exists()); + f = new File("_ajdump/_before/ataspectj/DumpTestTheDump.class"); + assertFalse(f.exists()); + f = new File("_ajdump/ataspectj/DumpTestTheDump.class"); + assertTrue(f.exists()); + + // tidy up... + f = new File("_ajdump"); + FileUtil.deleteContents(f); + f.delete(); + } + + public void testLTWDumpBeforeAndAfter() { + runTest("LTW DumpTest before and after"); + + // before + File f = new File("_ajdump/_before/com/foo/bar"); + CountingFilenameFilter cff = new CountingFilenameFilter(".class"); + f.listFiles(cff); + assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount()); + + // after + f = new File("_ajdump/com/foo/bar"); + cff = new CountingFilenameFilter(".class"); + f.listFiles(cff); + assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount()); + + // tidy up... + f = new File("_ajdump"); + FileUtil.deleteContents(f); + f.delete(); + } + + public void testLTWDumpClosure() { + runTest("LTW DumpTest closure"); + + File f = new File("_ajdump/ataspectj/DumpTestTheDump$AjcClosure1.class"); + assertTrue("Missing dump file " + f.getAbsolutePath(), f.exists()); + + // tidy up... + f = new File("_ajdump"); + FileUtil.deleteContents(f); + f.delete(); + } + + public void testLTWDumpProxy() { + runTest("LTW DumpTest proxy"); + + // The working directory is different because this test must be forked + File dir = new File("../tests/java5/ataspectj"); + File f = new File(dir, "_ajdump/_before/com/sun/proxy"); + CountingFilenameFilter cff = new CountingFilenameFilter(".class"); + f.listFiles(cff); + assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount()); + f = new File(dir, "_ajdump/com/sun/proxy"); + cff = new CountingFilenameFilter(".class"); + f.listFiles(cff); + assertEquals(1, cff.getCount()); + + // tidy up... + f = new File(dir, "_ajdump"); + FileUtil.deleteContents(f); + f.delete(); + } + + public void testLTWDumpJSP() { + runTest("LTW DumpTest JSP"); + + // The working directory is different because this test must be forked + File f = new File("_ajdump/_before/com/ibm/_jsp"); + CountingFilenameFilter cff = new CountingFilenameFilter(".class"); + f.listFiles(cff); + assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount()); + f = new File("_ajdump/com/ibm/_jsp"); + cff = new CountingFilenameFilter(".class"); + f.listFiles(cff); + assertEquals(1, cff.getCount()); + + // tidy up... + f = new File("_ajdump"); + FileUtil.deleteContents(f); + f.delete(); + } + + public void testAjcAspect1LTWAspect2_Xreweavable() { + runTest("Ajc Aspect1 LTW Aspect2 -Xreweavable"); + } + + public void testLTWLogSilent() { + runTest("LTW Log silent"); + } + + public void testLTWLogVerbose() { + runTest("LTW Log verbose"); + } + + public void testLTWLogVerboseAndShow() { + runTest("LTW Log verbose and showWeaveInfo"); + } + + public void testLTWLogMessageHandlerClass() { + runTest("LTW Log messageHandlerClass"); + } + + public void testLTWUnweavable() { + // actually test that we do LTW proxy and jit classes + runTest("LTW Unweavable"); + } + + public void testLTWDecp() { + runTest("LTW Decp"); + } + + public void testLTWDecp2() { + runTest("LTW Decp2"); + } + + public void testCompileTimeAspectsDeclaredToLTWWeaver() { + runTest("Compile time aspects declared to ltw weaver"); + } + + public void testConcreteAtAspect() { + runTest("Concrete@Aspect"); + } + + public void testConcreteAspect() { + runTest("ConcreteAspect"); + } + + public void testConcretePrecedenceAspect() { + runTest("ConcretePrecedenceAspect"); + } + + // public void testAspectOfWhenAspectNotInInclude() { + // runTest("AspectOfWhenAspectNotInInclude"); + // } + // + // public void testAspectOfWhenAspectExcluded_pr152873() { + // runTest("AspectOfWhenAspectExcluded"); + // } + + public void testAspectOfWhenNonAspectExcluded_pr152873() { + runTest("AspectOfWhenNonAspectExcluded"); + } + + public void testAppContainer() { + runTest("AppContainer"); + } + + public void testCflowBelowStack() { + runTest("CflowBelowStack"); + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java new file mode 100644 index 000000000..0f13e8f8b --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2005 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: + * Alexandre Vasseur initial implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150.ataspectj; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> + */ +public class AtAjMisuseTests extends XMLBasedAjcTestCase { + + protected File getSpecFile() { + return getClassResource("misuse.xml"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AtAjMisuseTests.class); + } + + public void testQAspectClassExtendingQAspectClass() { + runTest("@Aspect class extending @Aspect class"); + } + + // TODO asc commented out for now until Alex manages to get ajdtcore up to date... +// public void testClassWithQBeforeExtendingQAspectClass() { +// runTest("class with @Before extending @Aspect class"); +// } + + public void testQPointcutNotReturningVoid() { + runTest("@Pointcut not returning void"); + } + + public void testQPointcutWithGarbageString() { + runTest("@Pointcut with garbage string"); + } + + public void testQPointcutWithThrowsClause() { + runTest("@Pointcut with throws clause"); + } + + public void testQAfterReturningWithWrongNumberOfArgs() { + runTest("@AfterReturning with wrong number of args"); + } + + public void testQBeforeOnNon_publicMethod() { + runTest("@Before on non-public method"); + } + + public void testQBeforeOnMethodNotReturningVoid() { + runTest("@Before on method not returning void"); + } + + public void testQBeforeWithPJP() { + runTest("@Before with PJP"); + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java new file mode 100644 index 000000000..794fce907 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java @@ -0,0 +1,145 @@ +/******************************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * initial implementation Alexandre Vasseur + *******************************************************************************/ +package org.aspectj.systemtest.ajc150.ataspectj; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * A suite for @AspectJ aspects located in java5/ataspectj + * + * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> + */ +public class AtAjSyntaxTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AtAjSyntaxTests.class); + } + + protected File getSpecFile() { + return getClassResource("syntax.xml"); + } + + public void testSimpleBefore() { + runTest("SimpleBefore"); + } + + public void testSimpleAfter() { + runTest("SimpleAfter"); + } + + public void testSingletonAspectBindings() { + // Note AV: uncomment setReporting to get it in modules/tests folder + // org.aspectj.asm.AsmManager.setReporting("debug.txt",true,true,true,true); + runTest("singletonAspectBindings"); + // same stuff with AJ + // org.aspectj.asm.AsmManager.setReporting("debug-aj.txt",true,true,true,true); + // runTest("singletonAspectBindings2"); + + } + + public void testCflowTest() { + runTest("CflowTest"); + } + + public void testPointcutReferenceTest() { + runTest("PointcutReferenceTest"); + } + + public void testXXJoinPointTest() { + runTest("XXJoinPointTest"); + } + + public void testPrecedenceTest() { + runTest("PrecedenceTest"); + } + + public void testAfterXTest() { + runTest("AfterXTest"); + } + + public void testBindingTest() { + runTest("BindingTest"); + } + + public void testBindingTestNoInline() { + runTest("BindingTest no inline"); + } + + public void testPerClause() { + runTest("PerClause"); + } + + public void testAroundInlineMunger_XnoInline() { + runTest("AroundInlineMunger -XnoInline"); + } + + public void testAroundInlineMunger() { + try { + runTest("AroundInlineMunger"); + } finally { + System.out.println(ajc.getLastCompilationResult().getStandardError()); + } + } + + public void testAroundInlineMunger2() { + runTest("AroundInlineMunger2"); + } + + public void testDeow() { + runTest("Deow"); + } + + public void testSingletonInheritance() { + runTest("singletonInheritance"); + } + + public void testPerClauseInheritance() { + runTest("perClauseInheritance"); + } + + public void testIfPointcut() { + runTest("IfPointcutTest"); + } + + public void testIfPointcut2() { + runTest("IfPointcut2Test"); + } + + public void testMultipleBinding() { + runTest("MultipleBinding"); + } + + public void testBug104212() { + runTest("Bug104212"); + } + + public void testDeclareParentsInterface() { + runTest("DeclareParentsInterface"); + } + + public void testDeclareParentsImplements() { + runTest("DeclareParentsImplements"); + } + + public void testAbstractAspectNPE() { + runTest("AbstractAspectNPE"); + } + + public void testAbstractInherited() { + runTest("AbstractInherited"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/annotationgen.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/annotationgen.xml new file mode 100644 index 000000000..3a8bda2ad --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/annotationgen.xml @@ -0,0 +1,187 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> +<!-- @AspectJ v1.5.0 Tests --> + + <!-- ================================================================= --> + <!-- Adrian's tests for generation of @AspectJ annotations from ajc --> + <!-- ================================================================= --> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for simple aspect"> + <compile files="SimpleAspect.aj" options="-1.5"/> + <run class="SimpleAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for simple annotated aspect"> + <compile files="SimpleAnnotatedAspect.aj" options="-1.5"/> + <run class="SimpleAnnotatedAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for simple aspect pre 1.5"> + <compile files="Simple14Aspect.aj" options="-1.4"/> + <compile files="Simple14AspectTest.java" options="-1.5"/> + <run class="Simple14AspectTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for privileged aspect"> + <compile files="PrivilegedAspect.aj" options="-1.5"/> + <run class="PrivilegedAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for perthis aspect"> + <compile files="PerThisAspect.aj" options="-1.5"/> + <run class="PerThisAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for pertarget aspect"> + <compile files="PerTargetAspect.aj" options="-1.5"/> + <run class="PerTargetAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for percflow aspect"> + <compile files="PerCflowAspect.aj" options="-1.5"/> + <run class="PerCflowAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for percflowbelow aspect"> + <compile files="PerCflowbelowAspect.aj" options="-1.5"/> + <run class="PerCflowbelowAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for pertypewithin aspect"> + <compile files="PerTypeWithinAspect.aj" options="-1.5"/> + <run class="PerTypeWithinAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for inner aspect of aspect"> + <compile files="InnerAspectAspect.aj" options="-1.5"/> + <run class="InnerAspectAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for inner aspect of class"> + <compile files="InnerAspectClass.aj" options="-1.5"/> + <run class="InnerAspectClass"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for advice declarations"> + <compile files="BasicAdvice.aj" options="-1.5"/> + <run class="BasicAdvice"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for simple pointcut"> + <compile files="SimplePointcut.aj" options="-1.5"/> + <run class="SimplePointcut"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for pointcut modifiers"> + <compile files="PointcutModifiers.aj" options="-1.5"/> + <run class="PointcutModifiers"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for pointcut params"> + <compile files="PointcutsWithParams.aj" options="-1.5"/> + <run class="PointcutsWithParams"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for pointcut refs"> + <compile files="ReferencePointcuts.aj" options="-1.5"/> + <run class="ReferencePointcuts"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="before ann with non-void return"> + <compile files="BeforeWithBadReturn.java" options="-1.5"> + <message kind="error" line="7" text="This advice must return void"/> + <message kind="error" line="7" text="This method must return a result of type String"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="two anns on same element"> + <compile files="TwoForThePriceOfOne.java" options="-1.5"> + <message kind="error" line="7" text="The annotation @Pointcut is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="bad pcut in after advice"> + <compile files="AfterReturningWithBadPCut.java" options="-1.5"> + <message kind="error" line="6" text="Syntax error on token "excution(* *.*(..))""/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="bad parameter binding in advice"> + <compile files="BadParameterBinding.java" options="-1.5"> + <message kind="warning" line="11" text="no match for this type name: bpb"/> + <message kind="warning" line="15" text="no match for this type name: TheUnknownType"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="simple pointcut no params"> + <compile files="APointcut.java" options="-1.5"/> + <run class="APointcut"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="pointcut medley"> + <compile files="PointcutAssortment.java" options="-1.5"> + <message kind="error" line="9" text="Methods annotated with @Pointcut must return void"/> + <message kind="error" line="9" text="This method must return a result of type String"/> + <message kind="error" line="15" text="Pointcuts without an if() expression should have an empty method body"/> + <message kind="error" line="28" text="Duplicate annotation @Pointcut"/> + <message kind="error" line="29" text="Duplicate annotation @Pointcut"/> + <message kind="error" line="11" text="can't find referenced pointcut foo"/> + <message kind="warning" line="32" text="no match for this type name: foo [Xlint:invalidAbsoluteTypeName]"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="advice in a class"> + <compile files="AdviceInAClass.java" options="-1.5"> + <message kind="error" line="6" text="Advice must be declared inside an aspect type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for deows"> + <compile files="Deow.aj" options="-1.5"> + </compile> + <run class="Deow"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="runtime pointcut resolution referencing compiled pointcuts"> + <compile files="PCLib.aj,RuntimePointcuts.java" options="-1.5"> + </compile> + <run class="RuntimePointcuts" classpath=".;../lib/bcel/bcel.jar" ltw=""/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for decp"> + <compile files="DeclareParentsTest.aj" options="-1.5, -outxml"> + </compile> + <run class="DeclareParentsTest" ltw=""/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for decp 2"> + <compile files="DeclareParentsTestAdvanced.aj" options="-1.5, -outxml"> + </compile> + <run class="a.b.c.DeclareParentsTestAdvanced" ltw=""/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for decs"> + <compile files="DeclareSoftTest.aj" options="-1.5"> + </compile> + <run class="DeclareSoftTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for dec precedence"> + <compile files="DeclarePrecedenceTest.aj" options="-1.5"> + </compile> + <run class="DeclarePrecedenceTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for dec annotation"> + <compile files="DeclareAnnotationTest.aj" options="-1.5"> + </compile> + <run class="DeclareAnnotationTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for itds"> + <compile files="ITDTest.aj" options="-1.5, -outxml -Xlint:ignore -makeAjReflectable"> + </compile> + <run class="a.b.c.ITDTest" ltw=""/> + </ajc-test> +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/coverage/CoverageTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/coverage/CoverageTests.java new file mode 100644 index 000000000..534c7e57d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/coverage/CoverageTests.java @@ -0,0 +1,43 @@ +package org.aspectj.systemtest.ajc150.ataspectj.coverage; + +import java.io.File; + +import junit.framework.Test; +import junit.framework.TestResult; + +public class CoverageTests extends + org.aspectj.testing.AutowiredXMLBasedAjcTestCase { + + // set to false to debug tests + static final boolean failing = true; + + /** + * disabled here so Ant JUnit rule wrt running *Tests works. + */ + public static Test suite() { + if (failing) { + return new Test() { + public int countTestCases() { + return 1; + } + + public void run(TestResult r) { + r.startTest(this); + r.endTest(this); + } + + public String toString() { + return CoverageTests.class.getName() + " fail"; + } + }; + } + return org.aspectj.testing.AutowiredXMLBasedAjcTestCase + .loadSuite(CoverageTests.class); + } + + protected File getSpecFile() { + return new File( + "../tests/src/org/aspectj/systemtest/ajc150/ataspectj/coverage/coverage.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/coverage/coverage.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/coverage/coverage.xml new file mode 100644 index 000000000..f0ad3f4d3 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/coverage/coverage.xml @@ -0,0 +1,320 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.0 Tests --> + +<suite> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Aspect extending Aspect"> + <compile files="Test001.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Aspect with codestyle pointcut"> + <compile files="Test002.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="Codestyle Aspect with @Pointcut"> + <compile files="Test003.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut declared on codestyle advice"> + <compile files="Test004.java" options="-1.5"> + <message kind="error" line="9" text="Only @AdviceName AspectJ annotation allowed on advice"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Aspect class extending @Aspect class"> + <compile files="Test005.java" options="-1.5"> + <message kind="error" line="9" text="cannot extend a concrete aspect"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="class with @Before extending @Aspect class"> + <compile files="Test006.java" options="-1.5"> + <message kind="error" line="10" text="a class cannot extend an aspect"/> + <message kind="error" line="12" text="Advice must be declared inside an aspect type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before declared on codestyle advice"> + <compile files="Test007.java" options="-1.5"> + <message kind="error" line="8" text="Duplicate annotation @Before"/> + <message kind="error" line="9" text="Only @AdviceName AspectJ annotation allowed on advice"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut not returning void"> + <compile files="Test008.java" options="-1.5"> + <message kind="error" line="10" text="Pointcuts should have an empty method body"/> + <message kind="error" line="10" text="Methods annotated with @Pointcut must return void"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut on @Aspect class constructor"> + <compile files="Test009.java" options="-1.5"> + <message kind="error" line="7" text="The annotation @Pointcut is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Aspect on interface"> + <compile files="Test010.java" options="-1.5"> + <message kind="error" line="6" text="only classes can have an @Aspect annotation"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut on non-aspect class method"> + <compile files="Test011.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before on non-aspect class method"> + <compile files="Test012.java" options="-1.5"> + <message kind="error" line="6" text="Syntax error on token """/> + <message kind="error" line="7" text="Advice must be declared inside an aspect type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut on Interface method"> + <compile files="Test013.java" options="-1.5"> + <message kind="error" line="8" text="pointcuts can only be declared in a class or an aspect"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut with garbage string"> + <compile files="Test014.java" options="-1.5"> + <message kind="error" line="7" text="String literal is not properly closed by a double-quote"/> + <message kind="error" line="8" text="Syntax error, insert "}" to complete BlockStatements"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut with non-empty method body"> + <compile files="Test015.java" options="-1.5"> + <message kind="error" line="8" text="Pointcuts should have an empty method body"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut with throws clause"> + <compile files="Test016.java" options="-1.5"> + <message kind="error" line="8" text="pointcuts cannot throw exceptions!"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Aspect used badly"> + <compile files="Test017.java" options="-1.5"> + <message kind="error" line="5" text="Syntax error, insert "interface JavaIdentifier" to complete InterfaceHeader"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before declared on @Aspect class constructor"> + <compile files="Test018.java" options="-1.5"> + <message kind="error" line="7" text="The annotation @Before is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@AfterReturning with wrong number of args"> + <compile files="Test019.java" options="-1.5"> + <message kind="error" line="7" text="formal unbound in pointcut"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before on non-public method"> + <compile files="Test020.java" options="-1.5"> + <message kind="error" line="7" text="advice must be public"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before on method not returning void"> + <compile files="Test021.java" options="-1.5"> + <message kind="error" line="7" text="This advice must return void"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut with wrong number of args"> + <compile files="Test022.java" options="-1.5"> + <message kind="error" line="8" text="formal unbound in pointcut"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareParents with interface extending interface"> + <compile files="Test023.java" options="-1.5"> + <message kind="error" line="11" text="@DeclareParents must be called before a class implementing a single interface"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareParents with interface extending interface"> + <compile files="Test024.java" options="-1.5"> + <message kind="error" line="13" text="@DeclareParents must be called before a class implementing a single interface"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareParents used outside of an Aspect"> + <compile files="Test025.java" options="-1.5"> + <message kind="error" line="9" text="@DeclareParents must be called inside an aspect"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareParents on an @Aspect"> + <compile files="Test026.java" options="-1.5"> + <message kind="error" line="11" text="@DeclareParents must be called before a class implementing a single interface"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareParents on an @Aspect with @DeclarePrecidence"> + <compile files="Test027.java" options="-1.5"> + <message kind="error" line="12" text="@DeclareParents must be called before a class implementing a single interface"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareWarning with a non-final String"> + <compile files="Test028.java" options="-1.5"> + <message kind="error" line="6" text="@DeclareWarning must be called before a static final String"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareWarning with a static final Object (that is a String)"> + <compile files="Test029.java" options="-1.5"> + <message kind="error" line="7" text="Is this an error?"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareWarning with a static final Integer"> + <compile files="Test030.java" options="-1.5"> + <message kind="error" line="6" text="@DeclareWarning must be called before a static final String"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Around given an extension of ProceedingJoinPoint"> + <compile files="Test031.java" options="-1.5"> + <message kind="error" line="11" text="formal unbound in pointcut"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="calling @Before advice explicitly as a method"> + <compile files="Test032.java" options="-1.5"> + <message kind="error" line="14" text="Advice should never be called explicitly"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before on Interface method"> + <compile files="Test033.java" options="-1.5"> + <message kind="error" line="7" text="advice must be public"/> + <message kind="error" line="7" text="Advice must be declared inside an aspect type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Aspect Aspect double declaration"> + <compile files="Test034.java" options="-1.5"> + <message kind="error" line="5" text="The annotation @Aspect is only allowed before a class definition"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before and @After on one method"> + <compile files="Test035.java" options="-1.5"> + <message kind="error" line="7" text="The annotation @After is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before twice on one method"> + <compile files="Test036.java" options="-1.5"> + <message kind="error" line="6" text="Duplicate annotation @Before"/> + <message kind="error" line="7" text="Duplicate annotation @Before"/> + <message kind="error" line="7" text="The annotation @Before is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before advice with empty string"> + <compile files="Test037.java" options="-1.5"> + <message kind="error" line="6" text="Syntax error on token """/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="isPrivileged=truu misspelling"> + <compile files="Test038.java" options="-1.5"> + <message kind="error" line="5" text="The attribute isPrivileged is undefined for the annotation type Aspect"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut with an empty string"> + <compile files="Test039.java" options="-1.5"> + <message kind="error" line="11" text="Syntax error on token """/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before with && in string"> + <compile files="Test040.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@AdviceName given an empty string"> + <compile files="Test041.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@AdviceName used on @Before advice"> + <compile files="Test042.java" options="-1.5"> + <message kind="error" line="6" text="AdviceName annotation cannot be used for advice defined using annotation style"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="The Moody example"> + <compile files="Test043.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareWarning"> + <compile files="Test044.java" options="-1.5"> + <message kind="warning" line="13" text="This call is warned"/> + </compile> + </ajc-test> + + + + + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml new file mode 100644 index 000000000..a72fa4ebf --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml @@ -0,0 +1,349 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> +<suite> + + <ajc-test dir="java5/ataspectj" title="RunThemAllWithJavacCompiledAndLTW"> + <ant file="ajc-ant.xml" target="RunThemAllWithJavacCompiledAndLTW" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AjcLTW PerClauseTest -XterminateAfterCompilation"> + <compile + files="ataspectj/PerClauseTest.java,ataspectj/PerClauseTestAspects.java,ataspectj/TestHelper.java" + options="-1.5 -XterminateAfterCompilation"/> + <ant file="ajc-ant.xml" target="ltw.PerClauseTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AjcLTW PerClauseTest -Xreweavable"> + <compile + files="ataspectj/PerClauseTest.java,ataspectj/PerClauseTestAspects.java,ataspectj/TestHelper.java" + options="-1.5"/> + <ant file="ajc-ant.xml" target="ltw.PerClauseTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="JavaCAjcLTW PerClauseTest"> + <compile + files="ataspectj/PerClauseTest.java,ataspectj/TestHelper.java,ataspectj/PerClauseTestAspects.java" + options="-1.5 -XterminateAfterCompilation"/> + <comment> + aspectOf methods will be pushed in, ignore warning for adviceDidNotMatch but still do the logic for them + since such just added methods are an interesting case (percflow ajc$perCflowStack advice) + </comment> + <compile + files="ataspectj/PerClauseTestAspects.java" + options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="warning"/> + </compile> + <ant file="ajc-ant.xml" target="ltw.PerClauseTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AjcLTW AroundInlineMungerTest -XterminateAfterCompilation"> + <compile + files="ataspectj/AroundInlineMungerTest.java,ataspectj/AroundInlineMungerTestAspects.java,ataspectj/TestHelper.java" + options="-1.5 -XterminateAfterCompilation"/> + <ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AjcLTW AroundInlineMungerTest -Xreweavable"> + <compile + files="ataspectj/AroundInlineMungerTest.java,ataspectj/AroundInlineMungerTestAspects.java,ataspectj/TestHelper.java" + options="-1.5"/> + <ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AjcLTW AroundInlineMungerTest"> + <compile + files="ataspectj/AroundInlineMungerTestAspects.java" + options="-1.5 -Xlint:ignore"/> + <compile + files="ataspectj/AroundInlineMungerTest.java,ataspectj/TestHelper.java" + options="-1.5"/> + <ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AjcLTW AroundInlineMungerTest -XnoInline -Xreweavable"> + <compile + files="ataspectj/AroundInlineMungerTestAspects.java" + options="-1.5 -Xlint:ignore -XnoInline"/> + <compile + files="ataspectj/AroundInlineMungerTest.java,ataspectj/TestHelper.java" + options="-1.5 -XnoInline"/> + <ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AjcLTW AroundInlineMungerTest2"> + <compile + files="ataspectj/AroundInlineMungerTestAspects2.aj" + options="-1.5 -Xlint:ignore"/> + <compile + files="ataspectj/AroundInlineMungerTest2.aj,ataspectj/TestHelper.java" + options="-1.5"/> + <ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest2" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW DumpTest none"> + <compile + files="ataspectj/DumpTest.java,ataspectj/DumpTestTheDump.java,ataspectj/TestHelper.java" + options="-1.5"/> + <run class="ataspectj.DumpTest" ltw="ataspectj/aop-dumpnone.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW DumpTest"> + <compile + files="ataspectj/EmptyAspect.aj" + options="-1.5 -Xlint:ignore"/> + <compile + files="ataspectj/DumpTest.java,ataspectj/DumpTestTheDump.java,ataspectj/TestHelper.java" + options="-1.5"/> + <run class="ataspectj.DumpTest" ltw="ataspectj/aop-dump.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW DumpTest before and after"> + <compile + files="ataspectj/EmptyAspect.aj" + options="-1.5 -Xlint:ignore"/> + <compile + files="com/foo/bar/Test.java, com/foo/bar/Test$$EnhancerByCGLIB$$12345.java" + options="-1.5"/> + <run class="com.foo.bar.Test$$EnhancerByCGLIB$$12345" ltw="ataspectj/aop-dumpbeforeandafter.xml"> + <stdout> + <line text="Test$$EnhancerByCGLIB$$12345.main()"/> + <line text="Test.main()"/> + </stdout> + <stderr> + <line text="info AspectJ Weaver Version"/> + <line text="info register classloader"/> + <line text="info using"/> + <line text="info register aspect ataspectj.EmptyAspect"/> + <line text="debug not weaving 'com.foo.bar.Test$$EnhancerByCGLIB$$12345'"/> + <line text="debug weaving 'com.foo.bar.Test'"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW DumpTest closure"> + <compile + files="ataspectj/DumpTest.java,ataspectj/DumpTestTheDump.java,ataspectj/TestAroundAspect.aj" + options="-1.5"/> + <run class="ataspectj.DumpTest" ltw="ataspectj/aop-dumpclosure.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW DumpTest proxy"> + <compile + files="ataspectj/EmptyAspect.aj" + options="-1.5 -Xlint:ignore"/> + <compile + files="ataspectj/TestProxyGenerator.java,ataspectj/TestInterface.java" + options="-1.5"/> + <ant file="ajc-ant.xml" target="ltw.DumpProxyTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW DumpTest JSP"> + <compile + files="ataspectj/EmptyAspect.aj" + options="-1.5 -Xlint:ignore"/> + <compile + files="com/ibm/_jsp/_abc123_xyz890.java" + options="-1.5"/> + <run class="com.ibm._jsp._abc123_xyz890" ltw="ataspectj/aop-dumpjsp.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="Ajc Aspect1 LTW Aspect2 -Xreweavable"> + <compile + files="ataspectj/ltwreweavable/Main.java,ataspectj/ltwreweavable/Aspect1.java,ataspectj/ltwreweavable/Advisable.java" + options="-1.5" + outjar="main1.jar"/> + <ant file="ajc-ant.xml" target="ltw.Aspect2MainTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW Log silent"> + <compile + files="ataspectj/ltwlog/Main.java" + options="-1.5" + /> + <compile + files="ataspectj/ltwlog/Aspect1.java" + options="-1.5 -XterminateAfterCompilation" + > + </compile> + <run class="ataspectj.ltwlog.Main" ltw="ataspectj/ltwlog/aop-silent.xml"> + <stdout> + <line text="execution(Main.target())"/> + </stdout> + <stderr> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW Log verbose"> + <compile + files="ataspectj/ltwlog/Main.java" + options="-1.5" + /> + <compile + files="ataspectj/ltwlog/Aspect1.java" + options="-1.5 -XterminateAfterCompilation" + > + </compile> + <run class="ataspectj.ltwlog.Main" ltw="ataspectj/ltwlog/aop-verbose.xml"> + <stdout> + <line text="execution(Main.target())"/> + </stdout> + <stderr> + <line text="info AspectJ Weaver Version"/> + <line text="info register classloader"/> + <line text="info using"/> + <line text="info register aspect ataspectj.ltwlog.Aspect1"/> + <line text="debug weaving 'ataspectj.ltwlog.Main'"/> + <line text="debug weaving 'ataspectj.ltwlog.Aspect1'"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW Log verbose and showWeaveInfo"> + <compile + files="ataspectj/ltwlog/Main.java" + options="-1.5" + /> + <compile + files="ataspectj/ltwlog/Aspect1.java" + options="-1.5 -XterminateAfterCompilation" + > + </compile> + <run class="ataspectj.ltwlog.Main" ltw="ataspectj/ltwlog/aop-verboseandshow.xml"> + <stdout> + <line text="execution(Main.target())"/> + </stdout> + <stderr> + <line text="info AspectJ Weaver Version"/> + <line text="info register classloader"/> + <line text="info using"/> + <line text="info register aspect ataspectj.ltwlog.Aspect1"/> + <line text="debug weaving 'ataspectj.ltwlog.Main'"/> + <line text="weaveinfo Join point 'method-execution(void ataspectj.ltwlog.Main.target())' in Type 'ataspectj.ltwlog.Main' (Main.java:22) advised by before advice from 'ataspectj.ltwlog.Aspect1' (Aspect1.java)"/> + <line text="debug weaving 'ataspectj.ltwlog.Aspect1'"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW Log messageHandlerClass"> + <compile + files="ataspectj/ltwlog/Main.java, ataspectj/ltwlog/MessageHolder.java" + options="-1.5" + /> + <compile + files="ataspectj/ltwlog/Aspect1.java" + options="-1.5 -XterminateAfterCompilation" + > + </compile> + <run class="ataspectj.ltwlog.Main" ltw="ataspectj/ltwlog/aop-messagehandler.xml"> + <stdout> + <line text="MessageHolder.MessageHolder()"/> + <line text="execution(Main.target())"/> + </stdout> + <stderr> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW Unweavable"> + <ant file="ajc-ant.xml" target="ltw.Unweavable" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW Decp"> + <!-- ajc compile them to test reweable as well --> + <compile + files="ataspectj/DeclareParentsInterfaceTest.java,ataspectj/DeclareParentsImplementsTest.java,ataspectj/TestHelper.java" + options="-1.5" + /> + <!--<run class="ataspectj.DeclareParentsInterfaceTest" ltw="ataspectj/aop-decptest.xml"/>--> + <ant file="ajc-ant.xml" target="ltw.Decp" verbose="true"> + <stderr> + <line text="weaveinfo Extending interface set for type 'ataspectj.DeclareParentsInterfaceTest$Target' (DeclareParentsInterfaceTest.java) to include 'ataspectj.DeclareParentsInterfaceTest$Marker' (DeclareParentsInterfaceTest.java)"/> + <line text="weaveinfo Join point 'method-execution(void ataspectj.DeclareParentsInterfaceTest$Target.target())' in Type 'ataspectj.DeclareParentsInterfaceTest$Target' (DeclareParentsInterfaceTest.java:27) advised by before advice from 'ataspectj.DeclareParentsInterfaceTest$TestAspect' (DeclareParentsInterfaceTest.java)"/> + <line text="weaveinfo Extending interface set for type 'ataspectj.DeclareParentsImplementsTest$Target' (DeclareParentsImplementsTest.java) to include 'ataspectj.DeclareParentsImplementsTest$Introduced' (DeclareParentsImplementsTest.java)"/> + <line text="weaveinfo Type 'ataspectj.DeclareParentsImplementsTest$Target' (DeclareParentsImplementsTest.java) has intertyped method from 'ataspectj.DeclareParentsImplementsTest$TestAspect' (DeclareParentsImplementsTest.java:'void ataspectj.DeclareParentsImplementsTest$Introduced.intro()')"/> + <line text="weaveinfo Join point 'method-execution(void ataspectj.DeclareParentsImplementsTest$Implementation.intro())' in Type 'ataspectj.DeclareParentsImplementsTest$Implementation' (DeclareParentsImplementsTest.java:47) advised by before advice from 'ataspectj.DeclareParentsImplementsTest$TestAspect' (DeclareParentsImplementsTest.java)"/> + </stderr> + </ant> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW Decp2"> + <!-- ajc compile them but with only one aspect --> + <compile + files="ataspectj/DeclareParentsImplementsReweavableTest.java,ataspectj/TestHelper.java" + options="-1.5" + /> + <!-- compile the other aspect alone (won't be applied) --> + <ant file="ajc-ant.xml" target="ltw.Decp2" verbose="true"/> + </ajc-test> + + + <ajc-test dir="java5/ataspectj" title="Compile time aspects declared to ltw weaver"> + <compile + files="ataspectj/ltwlog/MessageHolder.java,ataspectj/ltwreweavable/MainReweavableLogging.java,ataspectj/ltwreweavable/AspectReweavableLogging.java,ataspectj/ltwreweavable/Advisable.java,ataspectj/ltwreweavable/EmptyAtAspect.java" + options="-1.5" + outjar="main1.jar"/> + <ant file="ajc-ant.xml" target="Compile time aspects declared to ltw weaver" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="Concrete@Aspect"> + <compile + files="ataspectj/ConcreteAtAspectTest.java,ataspectj/TestHelper.java" + options="-1.5 -XterminateAfterCompilation" + /> + <run class="ataspectj.ConcreteAtAspectTest" ltw="ataspectj/aop-concreteataspect.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="ConcreteAspect"> + <compile + files="ataspectj/ConcreteAspectTest.aj,ataspectj/TestHelper.java" + options="-1.5 -Xdev:NoAtAspectJProcessing -XterminateAfterCompilation" + /> + <run class="ataspectj.ConcreteAspectTest" ltw="ataspectj/aop-concreteaspect.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="ConcretePrecedenceAspect"> + <compile + files="ataspectj/ConcretePrecedenceAspectTest.java,ataspectj/TestHelper.java" + options="-1.5 -Xdev:NoAtAspectJProcessing -XterminateAfterCompilation" + /> + <run class="ataspectj.ConcretePrecedenceAspectTest" ltw="ataspectj/aop-concreteprecedenceaspect.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AspectOfWhenAspectNotInInclude"> + <compile + files="ataspectj/bugs/AspectOfWhenAspectNotInIncludeTest.java,ataspectj/TestHelper.java" + options="-1.5 -XterminateAfterCompilation"/> + <run class="ataspectj.bugs.AspectOfWhenAspectNotInIncludeTest" ltw="ataspectj/bugs/aop-aspectofwhenaspectnotinincludetest.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AspectOfWhenAspectExcluded"> + <compile + files="ataspectj/bugs/AspectOfWhenAspectNotInIncludeTest.java,ataspectj/TestHelper.java" + options="-1.5 -XterminateAfterCompilation"/> + <run class="ataspectj.bugs.AspectOfWhenAspectNotInIncludeTest" ltw="ataspectj/bugs/aop-aspectofwhenaspectexcludedtest.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AspectOfWhenNonAspectExcluded"> + <compile + files="ataspectj/bugs/NotAspect.java" + options="-1.5 -XterminateAfterCompilation"/> + <run class="ataspectj.bugs.NotAspect" ltw="ataspectj/bugs/aop-aspectofwhennonaspectexcludedtest.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AppContainer"> + <compile + files="ataspectj/hierarchy/AppContainerTest.java,ataspectj/hierarchy/app/SubApp.java,ataspectj/TestHelper.java" + options="-1.5 -XterminateAfterCompilation" + /> + <ant file="ajc-ant.xml" target="ltw.AppContainer" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="CflowBelowStack"> + <compile + files="ataspectj/bugs/CflowBelowStackTest.java,ataspectj/TestHelper.java" + options="-1.5 -verbose "/> + <run class="ataspectj.bugs.CflowBelowStackTest" ltw="ataspectj/bugs/aop-cflowbelowstacktest.xml"/> + </ajc-test> + + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/misuse.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/misuse.xml new file mode 100644 index 000000000..9aec9d7a4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/misuse.xml @@ -0,0 +1,146 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.0 Tests --> + +<suite> + + <ajc-test dir="java5/ataspectj" + pr="" title="@Aspect class extending @Aspect class"> + <compile files="ataspectj/misuse/Test005.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj" + pr="" title="class with @Before extending @Aspect class"> + <compile files="ataspectj/misuse/Test006.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="error" line="11" text="class 'Test006B' can not extend aspect"/> + </compile> + </ajc-test> + + <comment>a warning. We ignore the pointcut (TBD) - line is enclosing class (TBD Andy do better ?)</comment> + <ajc-test dir="java5/ataspectj" + pr="" title="@Pointcut not returning void"> + <compile files="ataspectj/misuse/Test008.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="warning" line="9" text="Found @Pointcut on a method not returning 'void' or not 'public static boolean'"/> + </compile> + </ajc-test> + +<!-- <ajc-test dir="java5/ataspectj"--> +<!-- pr="" title="@Aspect on interface">--> +<!-- <compile files="ataspectj/misuse/Test010.java" options="-1.5 -Xdev:NoAtAspectJProcessing">--> +<!-- <message kind="warning" line="7" text="Found @Aspect on an interface type 'ataspectj.misuse.Test010'"/>--> +<!-- </compile>--> +<!-- </ajc-test>--> + + <comment>line is enclosing class - TBD</comment> + <ajc-test dir="java5/ataspectj" + pr="" title="@Pointcut with garbage string"> + <compile files="ataspectj/misuse/Test014.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"> + <message kind="error" line="7" text="Invalid pointcut 'call%dddd"/> + <message kind="error" text="can't find referenced pointcut"/> + <message kind="error" text="can't find pointcut"/> + <message kind="error" text="@AfterThrowing: either 'value' or 'poincut' must be provided, not both"/> + <message kind="error" text="@AfterReturning: either 'value' or 'poincut' must be provided, not both"/> + <message kind="error" text="@DeclareWarning used on a non String constant field"/> + <message kind="error" text="@DeclareError used on a non String constant field"/> + </compile> + </ajc-test> + + <comment>line is enclosing class - TBD</comment> + <ajc-test dir="java5/ataspectj" + pr="" title="@Pointcut with throws clause"> + <compile files="ataspectj/misuse/Test016.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="warning" line="7" text="Found @Pointcut on a method throwing exception"/> + </compile> + </ajc-test> + + <comment>very dirty hack - can't get this location to work properly so added match all error..</comment> + <comment>amc - with new checks for binding of returning this was giving a different message, so I + tweaked the test slightly by swapping the order of the args</comment> + <ajc-test dir="java5/ataspectj" + pr="" title="@AfterReturning with wrong number of args"> + <compile files="ataspectj/misuse/Test019.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"> + <message kind="error" line="1" text="the parameter x is not bound"/> + <message kind="error" line="1" text="formal unbound in pointcut"/> + </compile> + </ajc-test> + + <comment>line number is enclosing type</comment> + <ajc-test dir="java5/ataspectj" + pr="" title="@Before on non-public method"> + <compile files="ataspectj/misuse/Test020.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"> + <message kind="error" line="7" text="Found @AspectJ annotation on a non public advice 'someCall()V'"/> + </compile> + </ajc-test> + + <comment>line number is enclosing type</comment> + <ajc-test dir="java5/ataspectj" + pr="" title="@Before on method not returning void"> + <compile files="ataspectj/misuse/Test021.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"> + <message kind="error" line="7" text="Found @AspectJ annotation on a non around advice not returning void 'someCall()I'"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj" + pr="" title="@Before with PJP"> + <compile files="ataspectj/misuse/Test100.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"> + <message kind="error" text="use of ProceedingJoinPoint is allowed only on around advice"/> + </compile> + </ajc-test> + + <!-- +ALEX: todo + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut with wrong number of args"> + <compile files="ataspectj/misuse/Test022.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="error" line="8" text="int x is not declared in the pointcut parameters"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Around given an extension of ProceedingJoinPoint"> + <compile files="ataspectj/misuse/Test031.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="error" line="9" text="Is this an error?"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="calling @Before advice explicitly as a method"> + <compile files="ataspectj/misuse/Test032.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="error" line="14" text="Advice should never be called explicitly"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before on Interface method"> + <compile files="ataspectj/misuse/Test033.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="error" line="4" text="The annotation @Before is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before and @After on one method"> + <compile files="ataspectj/misuse/Test035.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="error" line="7" text="A method may only be declared as advice once"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before advice with empty string"> + <compile files="ataspectj/misuse/Test037.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut with an empty string"> + <compile files="ataspectj/misuse/Test039.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before with AND in string"> + <compile files="ataspectj/misuse/Test040.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + </compile> + </ajc-test> +--> +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/syntax.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/syntax.xml new file mode 100644 index 000000000..69055af39 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/syntax.xml @@ -0,0 +1,202 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> +<suite> + + <ajc-test dir="java5/ataspectj" title="SimpleBefore"> + <compile files="SimpleBefore.java" options="-1.5 -showWeaveInfo -XnoInline"> + <message kind="weave" text="(SimpleBefore.java:23) advised by before advice from 'SimpleBefore$X' (SimpleBefore.java:33)"/> + </compile> + <run class="SimpleBefore"/> + <compile files="SimpleBefore.java" options="-1.5 -showWeaveInfo -XnoInline -Xdev:NoAtAspectJProcessing"> + <message kind="weave" text="(SimpleBefore.java:23) advised by before advice from 'SimpleBefore$X' (SimpleBefore.java:33)"/> + </compile> + <run class="SimpleBefore"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="SimpleAfter"> + <compile files="SimpleAfter.java" options="-1.5 -showWeaveInfo -XnoInline"> + <message kind="weave" text="(SimpleAfter.java:13) advised by after advice from 'SimpleAfter$X'"/> + </compile> + <run class="SimpleAfter"/> + <compile files="SimpleAfter.java" options="-1.5 -showWeaveInfo -XnoInline -Xdev:NoAtAspectJProcessing"> + <message kind="weave" text="(SimpleAfter.java:13) advised by after advice from 'SimpleAfter$X'"/> + </compile> + <run class="SimpleAfter"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="singletonAspectBindings"> + <compile files="ataspectj/SingletonAspectBindingsTest.java,ataspectj/TestHelper.java" options="-1.5 -emacssym -XnoInline"/> + <run class="ataspectj.SingletonAspectBindingsTest"/> + <compile files="ataspectj/SingletonAspectBindingsTest.java,ataspectj/TestHelper.java" options="-1.5 -emacssym -XnoInline -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.SingletonAspectBindingsTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="singletonAspectBindings2"> + <compile files="ataspectj/SingletonAspectBindingsTest2.aj,ataspectj/TestHelper.java" options="-1.5 -emacssym -XnoInline"/> + <run class="ataspectj.SingletonAspectBindingsTest2"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="CflowTest"> + <compile files="ataspectj/CflowTest.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.CflowTest"/> + <compile files="ataspectj/CflowTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.CflowTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="PointcutReferenceTest"> + <compile files="ataspectj/PointcutReferenceTest.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.PointcutReferenceTest"/> + <compile files="ataspectj/PointcutReferenceTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.PointcutReferenceTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="XXJoinPointTest"> + <compile files="ataspectj/XXJoinPointTest.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.XXJoinPointTest"/> + <compile files="ataspectj/XXJoinPointTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.XXJoinPointTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="PrecedenceTest"> + <compile files="ataspectj/PrecedenceTest.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.PrecedenceTest"/> + <compile files="ataspectj/PrecedenceTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.PrecedenceTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AfterXTest"> + <compile files="ataspectj/AfterXTest.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.AfterXTest"/> + <compile files="ataspectj/AfterXTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.AfterXTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="IfPointcutTest"> + <compile files="ataspectj/IfPointcutTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.IfPointcutTest"/> + <compile files="ataspectj/IfPointcutTest.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.IfPointcutTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="IfPointcut2Test"> + <compile files="ataspectj/IfPointcut2Test.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.IfPointcut2Test"/> + <compile files="ataspectj/IfPointcut2Test.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.IfPointcut2Test"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="BindingTest"> + <compile files="ataspectj/BindingTest.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.BindingTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="BindingTest no inline"> + <compile files="ataspectj/BindingTest.java,ataspectj/TestHelper.java" options="-1.5 -XnoInline"/> + <run class="ataspectj.BindingTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="PerClause"> + <compile files="ataspectj/PerClauseTest.java,ataspectj/PerClauseTestAspects.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.PerClauseTest"/> + <compile files="ataspectj/PerClauseTest.java,ataspectj/PerClauseTestAspects.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.PerClauseTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AroundInlineMunger -XnoInline"> + <compile files="ataspectj/AroundInlineMungerTest.java,ataspectj/AroundInlineMungerTestAspects.java,ataspectj/TestHelper.java" options="-1.5 -XnoInline -Xdev:NoAtAspectJProcessing -Xlint:ignore"/> + <run class="ataspectj.AroundInlineMungerTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AroundInlineMunger"> + <compile files="ataspectj/AroundInlineMungerTest.java,ataspectj/AroundInlineMungerTestAspects.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"/> + <run class="ataspectj.AroundInlineMungerTest"> + <stdout> + <line text="AroundInlineMungerTestAspects.Open.aroundCount=3"/> + <line text="AroundInlineMungerTestAspects.Open.beforeCount=6"/> + </stdout> + </run> + <!-- + <compile files="ataspectj/AroundInlineMungerTest.java,ataspectj/AroundInlineMungerTestAspects.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"/> + <run class="ataspectj.AroundInlineMungerTest"/> + --> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AroundInlineMunger2"> + <compile files="ataspectj/AroundInlineMungerTest2.aj,ataspectj/AroundInlineMungerTestAspects2.aj" options="-1.5 -Xlint:ignore"/> + <run class="ataspectj.AroundInlineMungerTest2"> + <stdout> + <line text="AroundInlineMungerTestAspects2.Open.aroundCount=3"/> + <line text="AroundInlineMungerTestAspects2.Open.beforeCount=6"/> + </stdout> + </run> + <!-- + <compile files="ataspectj/AroundInlineMungerTest2.aj,ataspectj/AroundInlineMungerTestAspects2.aj,ataspectj/TestHelper.java" options="-1.5 -Xlint:ignore"/> + <run class="ataspectj.AroundInlineMungerTest2"/> + --> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="Deow"> + <compile files="ataspectj/DeowTest.java" options="-1.5"> + <message kind="warning" line="28" text="call hello"/> + <message kind="error" line="29" text="call hi"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="singletonInheritance"> + <compile files="ataspectj/SingletonInheritanceTest.java,ataspectj/TestHelper.java" options="-1.5 -XnoInline"/> + <run class="ataspectj.SingletonInheritanceTest"/> + <compile files="ataspectj/SingletonInheritanceTest.java,ataspectj/TestHelper.java" options="-1.5 -XnoInline -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.SingletonInheritanceTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="perClauseInheritance"> + <compile files="ataspectj/PerClauseInheritanceTest.java,ataspectj/TestHelper.java" options="-1.5 -XnoInline"/> + <run class="ataspectj.PerClauseInheritanceTest"/> + <compile files="ataspectj/PerClauseInheritanceTest.java,ataspectj/TestHelper.java" options="-1.5 -XnoInline -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.PerClauseInheritanceTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="MultipleBinding"> + <compile files="ataspectj/MultipleBindingTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing -XnoInline"/> + <run class="ataspectj.MultipleBindingTest"/> + <compile files="ataspectj/MultipleBindingTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.MultipleBindingTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="Bug104212"> + <compile files="ataspectj/Bug104212.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.Bug104212"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="DeclareParentsInterface"> + <compile files="ataspectj/DeclareParentsInterfaceTest.java,ataspectj/TestHelper.java" options="-showWeaveInfo -1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"> + <message kind="weave" text="Extending interface set for type 'ataspectj.DeclareParentsInterfaceTest$Target' (DeclareParentsInterfaceTest.java) to include 'ataspectj.DeclareParentsInterfaceTest$Marker' (DeclareParentsInterfaceTest.java)"/> + <message kind="weave" text="Join point "/> + </compile> + <run class="ataspectj.DeclareParentsInterfaceTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="DeclareParentsImplements"> + <compile files="ataspectj/DeclareParentsImplementsTest.java,ataspectj/TestHelper.java" options="-showWeaveInfo -1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"> + <message kind="weave" text="Join point "/> + <message kind="weave" text="Extending interface set for type 'ataspectj.DeclareParentsImplementsTest$Target' (DeclareParentsImplementsTest.java) to include 'ataspectj.DeclareParentsImplementsTest$Introduced' (DeclareParentsImplementsTest.java)"/> + <message kind="weave" text="Type 'ataspectj.DeclareParentsImplementsTest$Target' (DeclareParentsImplementsTest.java) has intertyped method from 'ataspectj.DeclareParentsImplementsTest$TestAspect' (DeclareParentsImplementsTest.java:'void ataspectj.DeclareParentsImplementsTest$Introduced.intro()')"/> + </compile> + <run class="ataspectj.DeclareParentsImplementsTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AbstractAspectNPE"> + <compile files="ataspectj/bugs/AbstractAspectNPEParent.java,ataspectj/bugs/AbstractAspectNPEChild.java" + options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void ataspectj.bugs.AbstractAspectNPEParent.main"/> + </compile> + </ajc-test> + + + <ajc-test dir="java5/ataspectj" title="AbstractInherited"> + <compile files="ataspectj/bugs/AbstractInherited.java" + options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point "/> + </compile> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/LTWServerTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/LTWServerTests.java new file mode 100644 index 000000000..d73e594b9 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/LTWServerTests.java @@ -0,0 +1,27 @@ +package org.aspectj.systemtest.ajc150.ltw; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class LTWServerTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return loadSuite(LTWServerTests.class); + } + + protected File getSpecFile() { + return getClassResource("ltw.xml"); + } + + public void testServerWithHelloWorld () { + runTest("TestServer with HelloWorld"); + } + + public void testServerWithParentAndChild () { + runTest("TestServer with Parent and Child"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/LTWTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/LTWTests.java new file mode 100644 index 000000000..ff9e59339 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/LTWTests.java @@ -0,0 +1,213 @@ +/******************************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Matthew Webster initial implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150.ltw; + +import java.io.File; +import java.util.Enumeration; +import java.util.Properties; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.weaver.tools.WeavingAdaptor; + +public class LTWTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(LTWTests.class); + } + + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml"); + } + + public void testInclusionAndPattern() { + runTest("Inclusion and patterns"); + } + + public void testExclusionAndPattern() { + runTest("Exclusion and patterns"); + } + + public void testAndPatternsAspects() { + runTest("And patterns aspects"); + } + + public void test001(){ + runTest("Ensure 1st aspect is rewoven when weaving 2nd aspect"); + } + + public void testOutxmlFile (){ + runTest("Ensure valid aop.xml file is generated"); + } + public void testOutxmlJar (){ + runTest("Ensure valid aop.xml is generated for -outjar"); + } + + public void testNoAopxml(){ + setSystemProperty(WeavingAdaptor.WEAVING_ADAPTOR_VERBOSE,"true"); + runTest("Ensure no weaving without visible aop.xml"); + } + + public void testDefineConcreteAspect(){ + runTest("Define concrete sub-aspect using aop.xml"); + } + + public void testDeclareAbstractAspect(){ +// setSystemProperty(WeavingAdaptor.WEAVING_ADAPTOR_VERBOSE,"true"); +// setSystemProperty(WeavingAdaptor.SHOW_WEAVE_INFO_PROPERTY,"true"); + runTest("Use abstract aspect for ITD using aop.xml"); + } + + public void testAspectsInclude () { + runTest("Ensure a subset of inherited aspects is used for weaving"); + } + + public void testAspectsIncludeWithLintWarning () { + runTest("Ensure weaver lint warning issued when an aspect is not used for weaving"); + } + + public void testXsetEnabled () { + runTest("Set Xset properties enabled"); + } + public void testXsetDisabled () { + runTest("Set Xset properties disabled"); + } + + public void testXlintfileEmpty () { + runTest("Empty Xlint.properties file"); + } + + public void testXlintfileMissing () { + runTest("Warning with missing Xlint.properties file"); + } + + public void testXlintWarningAdviceDidNotMatchSuppressed () { + runTest("Warning when advice doesn't match suppressed for LTW"); + } + + public void testXlintfile () { + runTest("Override suppressing of warning when advice doesn't match using -Xlintfile"); + } + + public void testXlintDefault () { + runTest("Warning when advice doesn't match using -Xlint:default"); + } + + public void testXlintWarning () { + runTest("Override suppressing of warning when advice doesn't match using -Xlint:warning"); + } + + public void testNonstandardJarFiles() { + runTest("Nonstandard jar file extensions"); + } + + public void testOddzipOnClasspath() { + runTest("Odd zip on classpath"); + } + + public void testJ14LTWWithXML() { + runTest("JDK14 LTW with XML"); + } + +// public void testJ14LTWWithASPECTPATH() { +// runTest("JDK14 LTW with ASPECTPATH"); +// } + + + //public void testDiscardingWovenTypes() { + // runTest("discarding woven types - 1"); + //} + + public void testWeavingTargetOfCallAggressivelyInLTW_DeclareParents_pr133770() { + runTest("aggressive ltw - decp"); + } + + public void testWeavingTargetOfCallAggressivelyInLTW_DeclareParents_pr133770_Deactivate() { + runTest("aggressive ltw - decp - deactivate"); + } + + public void testWeavingTargetOfCallAggressivelyInLTW_DeclareParents_Nested_pr133770() { + runTest("aggressive ltw - decp - 2"); + } + + public void testWeavingTargetOfCallAggressivelyInLTW_DeclareParents_Hierarchy_pr133770() { + runTest("aggressive ltw - hierarchy"); + } + + public void testSeparateCompilationDeclareParentsCall_pr133770() { + runTest("separate compilation with ltw: declare parents and call"); + } + + public void testConfigurationSystemProperty_pr149289() { + runTest("override default path using -Dorg.aspectj.weaver.loadtime.configuration"); + } + + public void testSimpleLTW_pr159854 () { + runTest("simple LTW"); + } + + public void testDumpOnError_pr155033 () { + runTest("dump on error"); + + File dir = getSandboxDirectory(); + CountingFilenameFilter cff = new CountingFilenameFilter(".txt"); + dir.listFiles(cff); + assertEquals("Missing ajcore file in " + dir.getAbsolutePath(),1,cff.getCount()); + } + + public void testMultipleDumpOnError_pr155033 () { + runTest("multiple dump on error"); + + File dir = getSandboxDirectory(); + CountingFilenameFilter cff = new CountingFilenameFilter(".txt"); + dir.listFiles(cff); + assertEquals("Missing ajcore file in " + dir.getAbsolutePath(),2,cff.getCount()); + } + + /* + * Allow system properties to be set and restored + * TODO maw move to XMLBasedAjcTestCase or RunSpec + */ + private final static String NULL = "null"; + + private Properties savedProperties; + + protected void setSystemProperty (String key, String value) { + Properties systemProperties = System.getProperties(); + copyProperty(key,systemProperties,savedProperties); + systemProperties.setProperty(key,value); + } + + private static void copyProperty (String key, Properties from, Properties to) { + String value = from.getProperty(key,NULL); + to.setProperty(key,value); + } + + protected void setUp() throws Exception { + super.setUp(); + savedProperties = new Properties(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + + /* Restore system properties */ + Properties systemProperties = System.getProperties(); + for (Enumeration enu = savedProperties.keys(); enu.hasMoreElements(); ) { + String key = (String)enu.nextElement(); + String value = savedProperties.getProperty(key); + if (value == NULL) systemProperties.remove(key); + else systemProperties.setProperty(key,value); + } + } +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml new file mode 100644 index 000000000..0dcdbf142 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml @@ -0,0 +1,670 @@ + +<!-- Load-time weaving tests --> +<ajc-test dir="ltw" + title="Ensure 1st aspect is rewoven when weaving 2nd aspect" + keywords="reweavable"> + <compile files="Main.java, Aspect1.aj" outjar="main1.jar" + options="-showWeaveInfo -verbose -1.4"> + <message kind="weave" + text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)" /> + </compile> + <compile classpath="main1.jar" files="Aspect2.aj" + outjar="aspect2.jar" options="-showWeaveInfo -verbose -1.4"> + </compile> + <run class="Main" ltw="aop-ltwreweavable.xml"> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line + text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)" /> + <line + text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)" /> + <line text="Aspect1.before_test1" /> + <line text="Aspect2.before_test2" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Ensure valid aop.xml file is generated" keywords="-outxml"> + <compile files="Main.java" outjar="main.jar"> + </compile> + <compile classpath="main.jar" + files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj" + outxmlfile="META-INF/aop.xml" options="-1.4"> + </compile> + <run class="Main" ltw=""> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line text="Aspect1.before_test1" /> + <line text="Aspect2.before_test2" /> + <line text="pakkage.Aspect3.before_test2" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Ensure valid aop.xml is generated for -outjar" + keywords="-outxml"> + <compile files="Main.java" outjar="main.jar"> + </compile> + <compile classpath="main.jar" + files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj" + outjar="aspects.jar" options="-1.4 -outxml"> + </compile> + <run class="Main" ltw=""> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line text="Aspect1.before_test1" /> + <line text="Aspect2.before_test2" /> + <line text="pakkage.Aspect3.before_test2" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Ensure no weaving without visible aop.xml" keywords="reweavable"> + <compile files="TestMain.java, Main.java"> + </compile> + <run class="TestMain" ltw=""> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line text="info AspectJ Weaver Version" /> + <line + text="info register classloader org.aspectj.weaver.loadtime.WeavingURLClassLoader" /> + <line + text="info no configuration found. Disabling weaver for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader" /> + </stderr> + </run> +</ajc-test> + +<!-- type discarding tests, investigating call munging --> + +<ajc-test dir="ltw/callMunging" + title="discarding woven types - 1"> + <compile files="A.java,B.java,T.java,Main.java" + outjar="classes.jar" /> + <compile files="X.java" outjar="aspects.jar" + classpath="classes.jar" options="-Xlint:ignore" /> + <run class="Main" ltw="aop.xml"> + <stdout> + <line text="into:main" /> + <line text="A.method() running" /> + <line text="advice running" /> + <line text="T.m1() running" /> + <line text="B.method() running" /> + <line text="advice running" /> + <line text="T.m2() running" /> + <line text="leave:main" /> + </stdout> + </run> +</ajc-test> + +<ajc-test dir="ltw/callMunging/case1" + title="aggressive ltw - decp"> + <compile files="A.java,T.java,Main.java" outjar="classes.jar" /> + <compile files="X.java" outjar="aspects.jar" + classpath="classes.jar" options="-Xlint:ignore" /> + <run class="Main" ltw="aop.xml"> + <stdout> + <line text="into:main" /> + <line text="A.method() running" /> + <line text="advice running" /> + <line text="T.m1() running" /> + <line text="leave:main" /> + </stdout> + </run> +</ajc-test> + +<ajc-test dir="ltw/callMunging/case1" + title="aggressive ltw - decp - deactivate"> + <compile files="A.java,T.java,Main.java" outjar="classes.jar" /> + <compile files="X.java" outjar="aspects.jar" + classpath="classes.jar" options="-Xlint:ignore" /> + <run class="Main" ltw="aop2.xml"> + <stdout> + <line text="into:main" /> + <line text="A.method() running" /> + <line text="T.m1() running" /> + <line text="leave:main" /> + </stdout> + </run> +</ajc-test> + +<ajc-test dir="ltw/callMunging/case1" + title="aggressive ltw - hierarchy"> + <compile files="T.java,HierMain.java" outjar="classes.jar" /> + <compile files="A.java" outjar="sub.hiddenjar" + classpath="classes.jar" /> + <compile files="X.java" outjar="aspects.jar" + classpath="classes.jar" options="-Xlint:ignore" /> + <run class="HierMain" ltw="aop.xml"> + <stdout> + <line text="into:main" /> + <line text="A.method() running" /> + <line text="advice running" /> + <line text="T.m1() running" /> + <line text="leave:main" /> + </stdout> + </run> +</ajc-test> + +<ajc-test dir="ltw/callMunging/case3" + title="aggressive ltw - decp - 2"> + <compile files="A.java,T.java,S.java,Main.java" + outjar="classes.jar" /> + <compile files="X.java" outjar="aspects.jar" + classpath="classes.jar" options="-Xlint:ignore" /> + <run class="Main" ltw="aop.xml"> + <stdout> + <line text="into:main" /> + <line text="A.method() running" /> + <line text="advice running" /> + <line text="T.m1() running" /> + <line text="leave:main" /> + </stdout> + </run> +</ajc-test> + +<ajc-test dir="ltw/callMunging/case2" + title="aggressive ltw - deca"> + <compile files="A.java,T.java,Main.java,MarkerAnnotation.java" + outjar="classes.jar" options="-1.5" /> + <compile files="X.java" outjar="aspects.jar" + classpath="classes.jar" options="-1.5 -Xlint:ignore" /> + <run class="Main" ltw="aop.xml"> + <stdout> + <line text="into:main" /> + <line text="A.method() running" /> + <line text="advice running" /> + <line text="T.m1() running" /> + <line text="leave:main" /> + </stdout> + </run> +</ajc-test> + + + +<!-- end of discarding type tests --> + +<ajc-test dir="ltw" + title="Define concrete sub-aspect using aop.xml" keywords="aop.xml"> + <compile files="Main.java" outjar="main.jar"> + </compile> + <!-- was in next section classpath="main1.jar" --> + <compile files="AbstractSuperAspect.aj" outjar="aspect.jar" + options="-1.4"> + </compile> + <run class="Main" ltw="aop-defineaspect.xml"> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line text="info AspectJ Weaver Version" /> + <line text="info register classloader" /> + <line text="info using" /> + <line text="info define aspect ConcreteAspect" /> + <line text="debug weaving 'ConcreteAspect'" /> + <line text="debug generating class 'ConcreteAspect'" /> + <line text="debug weaving 'Main'" /> + <line text="AbstractSuperAspect.before_test1" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Use abstract aspect for ITD using aop.xml" + keywords="abstract aspect, ITD"> + <compile files="TestITDMethod.java"> + </compile> + <compile files="AbstractAspect.aj" options="-1.4"> + <message kind="warning" + text="this affected type is not exposed to the weaver: TestITDMethod" /> + </compile> + <run class="TestITDMethod" options="test" + ltw="aop-abstractaspect.xml"> + <stdout> + <line text="TestITDMethod.main" /> + </stdout> + <stderr> + <line + text="weaveinfo Type 'TestITDMethod' (TestITDMethod.java) has intertyped method from 'AbstractAspect' (AbstractAspect.aj:'void TestITDMethod.test()')" /> + <line text="AbstractAspect_TestITDMethod.test" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Ensure a subset of inherited aspects is used for weaving" + keywords="aspects, include"> + <compile files="Main.java" outjar="main.jar"> + </compile> + <compile classpath="main.jar" + files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj" + outjar="aspects.jar" options="-outxml -1.4"> + </compile> + <run class="Main" ltw="aop-aspectsinclude.xml"> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line text="pakkage.Aspect3.before_test2" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Ensure weaver lint warning issued when an aspect is not used for weaving" + keywords="aspects, include, lint"> + <compile files="Main.java" outjar="main.jar"> + </compile> + <compile classpath="main.jar" + files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj" + outjar="aspects.jar" options="-outxml -1.4"> + </compile> + <run class="Main" ltw="aop-aspectsincludewithlintwarning.xml"> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr ordered="no"> + <line + text="warning aspect Aspect1 exluded for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader [Xlint:aspectExcludedByConfiguration]" /> + <line + text="warning aspect Aspect2 exluded for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader [Xlint:aspectExcludedByConfiguration]" /> + <line text="pakkage.Aspect3.before_test2" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" title="Empty Xlint.properties file" + keywords="xlint, ltw"> + <compile files="Main.java"> + </compile> + <run class="Main" ltw="aop-xlintfile.xml" + xlintfile="Xlint-empty.properties"> + <stderr> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" title="Set Xset properties enabled" + keywords="xSet, ltw"> + <compile files="Main.java,Aspect1.aj"> + </compile> + <run class="Main" ltw="aop-xset-verbose.xml" + xlintfile="Xlint-empty.properties"> + </run> +</ajc-test> + +<ajc-test dir="ltw" title="Set Xset properties disabled" + keywords="xSet, ltw"> + <compile files="Main.java,Aspect1.aj"> + </compile> + <run class="Main" ltw="aop-xset-verbose.xml" + xlintfile="Xlint-empty.properties"> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Warning with missing Xlint.properties file" + keywords="xlint, ltw"> + <compile files="Main.java"> + </compile> + <run class="Main" ltw="aop-xlintfile.xml"> + <stderr> + <line + text="warning Cannot access resource for -Xlintfile:Xlint-empty.properties" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw/hier" + title="separate compilation with ltw: declare parents and call" + keywords="ltw"> + <compile files="util/A.aj,util/T.aj" /> + <compile + files="child/Executor.aj,child/Advisor.aj,top/SimpleMain.aj" + options="-1.4"> + <message kind="warning" + text="this affected type is not exposed to the weaver: util.A" /> + </compile> + <run class="top.SimpleMain" ltw="aop-single.xml"> + <stdout> + <line text="T call" /> + </stdout> + <stderr> + <line + text="weaveinfo Join point 'method-call(void util.A.foo())' in Type 'child.Executor' (Executor.aj:18) advised by before advice from 'child.Advisor' (Advisor.aj:20)" /> + <line + text="weaveinfo Extending interface set for type 'util.A' (A.aj) to include 'util.T' (Advisor.aj)" /> + <line + text="weaveinfo Extending interface set for type 'child.Advisor' (Advisor.aj) to include 'util.T' (Advisor.aj)" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Warning when advice doesn't match suppressed for LTW" + keywords="xlint, ltw"> + <compile files="Main.java"> + </compile> + <compile files="Aspect3.aj" options="-1.4"> + </compile> + <run class="Main" ltw="aop-nomatch.xml"> + <stderr> + <line text="info AspectJ Weaver Version" /> + <line text="info register classloader" /> + <line text="info using" /> + <line text="info register aspect Aspect3" /> + <line text="debug weaving 'Main'" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Override suppressing of warning when advice doesn't match using -Xlintfile" + keywords="xlint, ltw"> + <compile files="Main.java"> + </compile> + <compile files="Aspect3.aj" options="-1.4"> + </compile> + <run class="Main" ltw="aop-nomatchxlintfile.xml" + xlintfile="Xlint-nomatch.properties"> + <stderr> + <line text="info AspectJ Weaver Version" /> + <line text="info register classloader" /> + <line text="info using" /> + <line text="info register aspect Aspect3" /> + <line text="can not build thisJoinPoint lazily for this advice" /> + <line text="debug weaving 'Main'" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Warning when advice doesn't match using -Xlint:default" + keywords="xlint, ltw"> + <compile files="Main.java"> + </compile> + <compile files="Aspect3.aj" options="-1.4"> + </compile> + <run class="Main" ltw="aop-nomatchxlint.xml"> + <stderr> + <line text="info AspectJ Weaver Version" /> + <line text="info register classloader" /> + <line text="info using" /> + <line text="info register aspect Aspect3" /> + <line text="can not build thisJoinPoint lazily for this advice" /> + <line text="debug weaving 'Main'" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Override suppressing of warning when advice doesn't match using -Xlint:warning" + keywords="xlint, ltw"> + <compile files="Main.java"> + </compile> + <compile files="Aspect3.aj" options="-1.4"> + </compile> + <run class="Main" ltw="aop-nomatchxlint.xml"> + <stderr> + <line text="info AspectJ Weaver Version" /> + <line text="info register classloader" /> + <line text="info using" /> + <line text="info register aspect Aspect3" /> + <line text="can not build thisJoinPoint lazily for this advice" /> + <line text="debug weaving 'Main'" /> + </stderr> + </run> +</ajc-test> + +<!-- based on "Ensure 1st aspect is rewoven when weaving 2nd aspect" --> +<ajc-test dir="ltw" title="Nonstandard jar file extensions" + pr="137235"> + <compile files="folder.jar/Main.java, folder.jar/Aspect1.aj" + outjar="folder.jar/main1.zip" options="-showWeaveInfo -1.4"> + <message kind="weave" + text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)" /> + </compile> + <compile classpath="$sandbox/folder.jar/main1.zip" + files="Aspect2.aj" outjar="aspect2Jar" options="-showWeaveInfo -1.4"> + </compile> + <run class="Main" ltw="aop-ltwreweavable.xml" + classpath="$sandbox/folder.jar/main1.zip,$sandbox/aspect2Jar"> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line + text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)" /> + <line + text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)" /> + <line text="Aspect1.before_test1" /> + <line text="Aspect2.before_test2" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" title="Odd zip on classpath" pr="137235"> + <compile files="folder.jar/Main.java, folder.jar/Aspect1.aj" + outjar="folder.jar/main1.archive" options="-showWeaveInfo"> + <message kind="weave" + text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)" /> + </compile> + <compile classpath="$sandbox/folder.jar/main1.archive" + files="Aspect2.aj" outjar="aspect2Jar" options="-showWeaveInfo -1.4"> + </compile> + <run class="Main" ltw="aop-ltwreweavable.xml" + classpath="$sandbox/folder.jar/main1.archive,$sandbox/aspect2Jar"> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line + text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)" /> + <line + text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)" /> + <line text="Aspect1.before_test1" /> + <line text="Aspect2.before_test2" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" title="JDK14 LTW with XML" keywords="ltw"> + <compile files="HelloWorldWithException.java" + options="-outjar hello.jar" /> + <compile files="ExceptionHandler.aj" + options="-outxml -outjar handler.jar -1.4" /> + <ant file="ant.xml" target="JDK14 LTW with XML" verbose="true"> + <stdout> + <line text="Hello World!" /> + </stdout> + <stderr> + <line text="TraceFactory.instance=" /> + </stderr> + </ant> +</ajc-test> + +<ajc-test dir="ltw" title="JDK14 LTW with ASPECTPATH" + keywords="ltw"> + <compile files="HelloWorldWithException.java" + options="-outjar hello.jar" /> + <compile files="ExceptionHandler.aj" + options="-outjar handler.jar" /> + <ant file="ant.xml" target="JDK14 LTW with ASPECTPATH" + verbose="true"> + <stdout> + <line text="Hello World!" /> + </stdout> + <stderr> + <line text="TraceFactory.instance=" /> + </stderr> + </ant> +</ajc-test> + +<ajc-test dir="ltw" title="TestServer with HelloWorld" + keywords="ltw,server"> + <compile files="HelloWorldWithException.java" + options="-outjar hello.jar" /> + <compile files="ExceptionHandler.aj" + options="-outxml -outjar handler.jar -1.4" /> + <ant file="ant-server.xml" target="TestServer with HelloWorld" + verbose="true"> + <stdout> + <line text="Starting ..." /> + <line text="Running HelloWorld" /> + <line text="Hello World!" /> + <line text="Stopping ..." /> + </stdout> + </ant> +</ajc-test> +<!-- <ajc-test dir="ltw" title="TestServer with Parent and Child" keywords="ltw,server"> + <compile files="Parent.java" options="-outjar parent.jar"/> <compile files="Child.java" + options="-classpath parent.jar -outjar child.jar"/> <ant file="ant-server.xml" + target="TestServer with Parent and Child" verbose="true"> <stdout> <line + text="Starting ..."/> <line text="Running Child"/> <line text="Parent"/> + <line text="Child"/> <line text="Stopping ..."/> </stdout> </ant> </ajc-test> --> +<ajc-test dir="ltw" title="TestServer with Parent and Child" + keywords="ltw,server"> + <compile files="HelloWorldWithException.java" + options="-outjar child.jar" /> + <compile files="ExceptionHandler.aj" + options="-outxml -outjar parent.jar -1.4" /> + <ant file="ant-server.xml" + target="TestServer with Parent and Child" verbose="true"> + <stdout> + <line text="Starting ..." /> + <line text="Running HelloWorld" /> + <line text="Hello World!" /> + <line text="Stopping ..." /> + </stdout> + </ant> +</ajc-test> + +<ajc-test dir="ltw" + title="override default path using -Dorg.aspectj.weaver.loadtime.configuration" + keywords="ltw"> + <compile files="HelloWorldWithException.java" + options="-outjar hello.jar" /> + <compile files="ExceptionHandler.aj" + options="-outxml -outjar handler.jar -1.4" /> + <compile files="Tracing.aj" + options="-outxml -outjar tracing.jar -1.4" /> + <ant file="ant.xml" + target="override default path using -Dorg.aspectj.weaver.loadtime.configuration" + verbose="true"> + <stdout> + <line text="Hello World!" /> + </stdout> + </ant> +</ajc-test> + +<ajc-test dir="ltw/inclExcl" title="Inclusion and patterns" + keywords="ltw"> + <compile files="pkg/sub/Foo.aj, pkg/Main.aj" + options="-outjar base.jar" /> + <compile files="tracing/Tracer.aj" options="-1.4" /> + <run class="pkg.Main" ltw="aop-include.xml"> + <stderr> + <line text="execution(void pkg.Main.foo())" /> + <line text="Main.class" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw/inclExcl" title="Exclusion and patterns" + keywords="ltw"> + <compile files="pkg/sub/Foo.aj, pkg/Main.aj" + options="-outjar base.jar" /> + <compile files="tracing/Tracer.aj" options="-1.4" /> + <run class="pkg.Main" ltw="aop-exclude.xml"> + <stderr> + <line text="execution(void pkg.sub.Foo.foo())" /> + </stderr> + </run> +</ajc-test> +<ajc-test dir="ltw/inclExcl" title="And patterns aspects" + keywords="ltw"> + <compile files="pkg/sub/Foo.aj, pkg/Main.aj" + options="-outjar base.jar" /> + <compile + files="tracing/Tracer.aj, tracing/staticinit/Tracer.aj, tracing/staticinit/sub/Tracer.aj" + options="-1.4" /> + <run class="pkg.Main" ltw="aop-aspectinclexcl.xml"> + <stderr> + <line text="staticinitialization(pkg.Main.<clinit>)" /> + <line text="staticinitialization(pkg.sub.Foo.<clinit>)" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" title="simple LTW" keywords="ltw"> + <compile files="HelloWorldWithException.java" /> + <compile files="ExceptionHandler.aj" options="-outxml -1.4" /> + <ant file="ant.xml" target="simple LTW" verbose="true"> + <stdout> + <line text="Hello World!" /> + </stdout> + </ant> +</ajc-test> + +<ajc-test dir="ltw" title="dump on error" keywords="ltw"> + <compile files="HelloWorldWithException.java" /> + <compile files="ExceptionHandler.aj" options="-outxml -1.4" /> + <ant file="ant.xml" target="dump on error" verbose="true"> + <stdout> + <line text="Hello World!" /> + </stdout> + </ant> +</ajc-test> + +<ajc-test dir="bugs153/pr155033" title="multiple dump on error" + keywords="ltw"> + <compile files="Annotation.java" options="-1.5" /> + <compile + files="MultipleDumpTest.java, Class1.java, Class2.java, Class3.java" + options="-1.5" /> + <compile files="Aspect.aj" options="-1.5 -outxml -Xlint:ignore" /> + <!-- <run class="MultipleDumpTest" ltw="aop-multipledumponerror.xml"> <stdout> + <line text="? AbortingMessageHandler.AbortingMessageHandler()"/> </stdout> + </run> --> + <ant file="ant.xml" target="multiple dump on error" verbose="true"> + <stdout> + <line text="? MultipleDumpTest.main()" /> + <line text="? Class1.main()" /> + <line text="? Aspect.before()" /> + <line text="? Class2.main()" /> + <line text="? Aspect.before()" /> + <line text="? Class3.main()" /> + <line text="? Aspect.before()" /> + </stdout> + </ant> +</ajc-test> + +
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/ltw.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/ltw.xml new file mode 100644 index 000000000..311872c09 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/ltw.xml @@ -0,0 +1,11 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml"> +]> + +<!-- Load-time weaving tests --> + +<suite> + +&tests; + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/tests/.cvsignore b/tests/src/test/java/org/aspectj/systemtest/ajc150/tests/.cvsignore new file mode 100644 index 000000000..9d3c17f8d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/tests/.cvsignore @@ -0,0 +1 @@ +ajcTestSuite.dtd |