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 new File("../tests/src/org/aspectj/systemtest/ajc150/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.getDefault().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 *)");
- }
-
- 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() {
- 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");
- }
-
-
- // helper methods.....
-
- public SyntheticRepository createRepos(File cpentry) {
- ClassPath cp = new ClassPath(cpentry+File.pathSeparator+System.getProperty("java.class.path"));
- return SyntheticRepository.getInstance(cp);
- }
-
- protected JavaClass getClassFrom(File where,String clazzname) throws ClassNotFoundException {
- SyntheticRepository repos = createRepos(where);
- return repos.loadClass(clazzname);
- }
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(Ajc150Tests.class);
+ }
+
+ protected File getSpecFile() {
+ return new File("../tests/src/org/aspectj/systemtest/ajc150/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 *)");
+ }
+
+ 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() {
+ 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");
+ }
+
+ // helper methods.....
+
+ public SyntheticRepository createRepos(File cpentry) {
+ ClassPath cp = new ClassPath(cpentry + File.pathSeparator + System.getProperty("java.class.path"));
+ return SyntheticRepository.getInstance(cp);
+ }
+
+ protected JavaClass getClassFrom(File where, String clazzname) throws ClassNotFoundException {
+ SyntheticRepository repos = createRepos(where);
+ return repos.loadClass(clazzname);
+ }
}
\ No newline at end of file
public class AnnotationBinding extends XMLBasedAjcTestCase {
- public static Test suite() {
- return XMLBasedAjcTestCase.loadSuite(AnnotationBinding.class);
- }
-
- protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/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()) {
- IHierarchy top = AsmManager.getDefault().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 l = AsmManager.getDefault().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 = AsmManager.getDefault().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 = AsmManager.getDefault().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()) {
- IHierarchy top = AsmManager.getDefault().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 l = AsmManager.getDefault().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 = AsmManager.getDefault().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 = AsmManager.getDefault().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()) {
- IHierarchy top = AsmManager.getDefault().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 l = AsmManager.getDefault().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 = AsmManager.getDefault().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 = AsmManager.getDefault().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");
- }
-
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(AnnotationBinding.class);
+ }
+
+ protected File getSpecFile() {
+ return new File("../tests/src/org/aspectj/systemtest/ajc150/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 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 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 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
public class DeclareAnnotationTests extends XMLBasedAjcTestCase {
- public static Test suite() {
- return XMLBasedAjcTestCase.loadSuite(DeclareAnnotationTests.class);
- }
-
- protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc150/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.getDefault().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 l = AsmManager.getDefault().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.getDefault().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.getDefault().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.getDefault().getRelationshipMap().get(ipe);
- assertTrue("Should have a relationship but does not ",l.size()>0);
- }
- }
-
- public void testDeclareTypeMisspelled() {
- runTest("declare @Type (should be @type)");
- }
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(DeclareAnnotationTests.class);
+ }
+
+ protected File getSpecFile() {
+ return new File("../tests/src/org/aspectj/systemtest/ajc150/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 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
public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
- // Some @DeclareParents testing
- public void testAtDecp_1() { runTest("atDecp - simple");}
- public void testAtDecp_2() { runTest("atDecp - annotation");}
- public void testAtDecp_3() { runTest("atDecp - binary interface");}
- public void testAtDecp_4() { runTest("atDecp - binary interface - 2");}
-
- public void testAnnotationsAndItds_pr98901() { runTest("annotations and itds");}
- public void testAnnotationsAndItds_pr98901_2() { runTest("annotations and itds - 2");}
- public void testCircularGenerics_pr133307() { runTest("circular generics");}
- public void testDeca() { runTest("doubly annotating a method with declare");}
- public void testDeca2() { runTest("doubly annotating a method with declare - 2");}
- public void testCrashingWithASM_pr132926_1() { runTest("crashing on annotation type resolving with asm - 1");}
- public void testCrashingWithASM_pr132926_2() { runTest("crashing on annotation type resolving with asm - 2");}
- public void testCrashingWithASM_pr132926_3() { runTest("crashing on annotation type resolving with asm - 3");}
- public void testGenericAdviceParameters_pr123553() { runTest("generic advice parameters");}
- public void testMemberTypesInGenericTypes_pr122458() { runTest("member types in generic types");}
- public void testMemberTypesInGenericTypes_pr122458_2() { runTest("member types in generic types - 2");}
- public void testNPEOnDeclareAnnotation_pr123695() { runTest("Internal nullptr exception with complex declare annotation");}
- public void testHasMemberPackageProblem_pr124105() { runTest("hasMember problems with packages");}
- public void testDifferentNumbersofTVars_pr124803() { runTest("generics and different numbers of type variables");}
- public void testDifferentNumbersofTVars_pr124803_2() { runTest("generics and different numbers of type variables - classes");}
- public void testParameterizedCollectionFieldMatching_pr124808() { runTest("parameterized collection fields matched via pointcut");}
- public void testGenericAspectsAndAnnotations_pr124654() { runTest("generic aspects and annotations");}
- public void testCallInheritedGenericMethod_pr124999() { runTest("calling inherited generic method from around advice");}
- public void testIncorrectlyReferencingPointcuts_pr122452() { runTest("incorrectly referencing pointcuts");}
- public void testIncorrectlyReferencingPointcuts_pr122452_2() { runTest("incorrectly referencing pointcuts - 2");}
- public void testInlinevisitorNPE_pr123901() { runTest("inlinevisitor NPE");}
- //public void testExposingWithintype_enh123423() { runTest("exposing withintype");}
- //public void testMissingImport_pr127299() { runTest("missing import gives funny message");}
- public void testUnusedInterfaceMessage_pr120527() { runTest("incorrect unused interface message");}
- public void testAtAspectInheritsAdviceWithTJPAndThis_pr125699 () { runTest("inherit advice with this() and thisJoinPoint"); }
- public void testAtAspectInheritsAdviceWithTJPAndThis_pr125699_2 () {runTest("inherit advice with this() and thisJoinPoint - 2"); }
- public void testBrokenLTW_pr128744() { runTest("broken ltw"); }
-
- public void testAtAspectNoInvalidAbsoluteTypeName_pr126560() {
- runTest("@AJ deow doesn't throw an invalidAbsoluteTypeName when specify type in the same package");
- }
-
- public void testAtAspectNoInvalidAbsoluteTypeName_pr126560_2() {
- runTest("@AJ deow doesn't throw an invalidAbsoluteTypeName when specify type in the same file");
- }
-
- public void testArrayindexoutofbounds_pr129566() {
- runTest("arrayindexoutofbounds");
- // public class SkipList<T extends Comparable> extends Object implements Set<T>, Iterable<T>
- GenericsTests.verifyClassSignature(ajc,"common.SkipList","<T::Ljava/lang/Comparable;>Ljava/lang/Object;Ljava/util/Set<TT;>;Ljava/lang/Iterable<TT;>;");
- // protected class SkipListElement<E> extends Object
- GenericsTests.verifyClassSignature(ajc,"common.SkipList$SkipListElement","<E:Ljava/lang/Object;>Ljava/lang/Object;");
- // protected class SkipListIterator<E> implements Iterator<T>
- GenericsTests.verifyClassSignature(ajc,"common.SkipList$SkipListIterator","<E:Ljava/lang/Object;>Ljava/lang/Object;Ljava/util/Iterator<TT;>;");
- }
-
- public void testMixingNumbersOfTypeParameters_pr125080() {
- runTest("mixing numbers of type parameters");
- GenericsTests.verifyClassSignature(ajc,"AspectInterface","<T:Ljava/lang/Object;S:Ljava/lang/Object;>Ljava/lang/Object;");
- GenericsTests.verifyClassSignature(ajc,"AbstractAspect","<T:Ljava/lang/Object;>Ljava/lang/Object;LAspectInterface<TT;Ljava/lang/Integer;>;");
- GenericsTests.verifyClassSignature(ajc,"ConcreteAspect","LAbstractAspect<Ljava/lang/String;>;");
- }
-
- public void testMixingNumbersOfTypeParameters_pr125080_2() {
- runTest("mixing numbers of type parameters - 2");
- GenericsTests.verifyClassSignature(ajc,"AspectInterface","<T:Ljava/lang/Object;S:Ljava/lang/Number;>Ljava/lang/Object;");
- GenericsTests.verifyClassSignature(ajc,"AbstractAspect","<T:Ljava/lang/Object;>Ljava/lang/Object;LAspectInterface<TT;Ljava/lang/Integer;>;");
- GenericsTests.verifyClassSignature(ajc,"ConcreteAspect","LAbstractAspect<LStudent;>;");
- }
-
- public void testIProgramElementMethods_pr125295() {
- runTest("new IProgramElement methods");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
-
- IProgramElement pe = top.findElementForType("pkg","foo");
- assertNotNull("Couldn't find 'foo' element in the tree",pe);
- // check that the defaults return the fully qualified arg
- assertEquals("foo(int,java.lang.Object)",pe.toLabelString());
- assertEquals("C.foo(int,java.lang.Object)",pe.toLinkLabelString());
- assertEquals("foo(int,java.lang.Object)",pe.toSignatureString());
- // check that can get hold of the non qualified args
- assertEquals("foo(int,Object)",pe.toLabelString(false));
- assertEquals("C.foo(int,Object)",pe.toLinkLabelString(false));
- assertEquals("foo(int,Object)",pe.toSignatureString(false));
-
- IProgramElement pe2 = top.findElementForType("pkg","printParameters");
- assertNotNull("Couldn't find 'printParameters' element in the tree",pe2);
- // the argument is org.aspectj.lang.JoinPoint, check that this is added
- assertFalse("printParameters method should have arguments",pe2.getParameterSignatures().isEmpty());
- }
-
- public void testParameterizedEnum_pr126316() {
- runTest("E extends Enum(E) again");
- }
-
- public void testSwallowedException() {
- runTest("swallowed exceptions");
- }
-
- public void testAtAspectVerifyErrorWithAfterThrowingAndthisJoinPoint_pr122742() {
- runTest("@AJ VerifyError with @AfterThrowing and thisJoinPoint argument");
- }
-
- public void testAtAspectVerifyErrorWithAfterReturningAndthisJoinPoint_pr122742() {
- runTest("@AJ VerifyError with @AfterReturning and thisJoinPoint argument");
- }
-
- public void testSwallowedExceptionIgnored() {
- runTest("swallowed exceptions with xlint");
- }
-
- public void testGenericAspectWithUnknownType_pr131933() {
- runTest("no ClassCastException with generic aspect and unknown type");
- }
-
- /*
- * @AspectJ bugs and enhancements
- */
-// public void testAtAspectInheritsAdviceWithTJPAndThis_pr125699 () {
-// runTest("inherit adivce with this() and thisJoinPoint");
-// }
-
- public void testAtAspectInheritsAbstractPointcut_pr125810 () {
- runTest("warning when inherited pointcut not made concrete");
- }
-
- public void testAtAspectWithoutJoinPointImport_pr121616() {
- runTest("@AJ without JoinPoint import");
- }
-
- public void testAtAspectDeclareParentsRetainsFieldState_pr122370() {
- runTest("@AJ declare parents retains field state");
- }
-
- public void testAtAspectNoNPEWithPcdContainingOrThisAndWildcard_pr128237() {
- runTest("@AJ no npe with pointcut containing or, this and a wildcard");
- }
-
- /*
- * Load-time weaving bugs and enhancements
- */
- public void testEmptyPointcutInAtAspectJ_pr125475 () {
- runTest("define empty pointcut using an annotation");
- }
-
- public void testEmptyPointcutInAtAspectJ_pr125475_2() {
- runTest("define empty pointcut using an annotation - 2");
- }
-
- public void testEmptyPointcutInAtAspectJWithLTW_pr125475 () {
- runTest("define empty pointcut using aop.xml");
- }
-
- public void testGenericAspectsWithAnnotationTypeParameters() {
- runTest("Generic aspects with annotation type parameters");
- }
-
- public void testPointcutInterfaces_pr130869() {
- runTest("Pointcut interfaces");
- }
-
- /////////////////////////////////////////
- public static Test suite() {
- return XMLBasedAjcTestCase.loadSuite(Ajc151Tests.class);
- }
-
- protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc151/ajc151.xml");
- }
-
-
+ // Some @DeclareParents testing
+ public void testAtDecp_1() {
+ runTest("atDecp - simple");
+ }
+
+ public void testAtDecp_2() {
+ runTest("atDecp - annotation");
+ }
+
+ public void testAtDecp_3() {
+ runTest("atDecp - binary interface");
+ }
+
+ public void testAtDecp_4() {
+ runTest("atDecp - binary interface - 2");
+ }
+
+ public void testAnnotationsAndItds_pr98901() {
+ runTest("annotations and itds");
+ }
+
+ public void testAnnotationsAndItds_pr98901_2() {
+ runTest("annotations and itds - 2");
+ }
+
+ public void testCircularGenerics_pr133307() {
+ runTest("circular generics");
+ }
+
+ public void testDeca() {
+ runTest("doubly annotating a method with declare");
+ }
+
+ public void testDeca2() {
+ runTest("doubly annotating a method with declare - 2");
+ }
+
+ public void testCrashingWithASM_pr132926_1() {
+ runTest("crashing on annotation type resolving with asm - 1");
+ }
+
+ public void testCrashingWithASM_pr132926_2() {
+ runTest("crashing on annotation type resolving with asm - 2");
+ }
+
+ public void testCrashingWithASM_pr132926_3() {
+ runTest("crashing on annotation type resolving with asm - 3");
+ }
+
+ public void testGenericAdviceParameters_pr123553() {
+ runTest("generic advice parameters");
+ }
+
+ public void testMemberTypesInGenericTypes_pr122458() {
+ runTest("member types in generic types");
+ }
+
+ public void testMemberTypesInGenericTypes_pr122458_2() {
+ runTest("member types in generic types - 2");
+ }
+
+ public void testNPEOnDeclareAnnotation_pr123695() {
+ runTest("Internal nullptr exception with complex declare annotation");
+ }
+
+ public void testHasMemberPackageProblem_pr124105() {
+ runTest("hasMember problems with packages");
+ }
+
+ public void testDifferentNumbersofTVars_pr124803() {
+ runTest("generics and different numbers of type variables");
+ }
+
+ public void testDifferentNumbersofTVars_pr124803_2() {
+ runTest("generics and different numbers of type variables - classes");
+ }
+
+ public void testParameterizedCollectionFieldMatching_pr124808() {
+ runTest("parameterized collection fields matched via pointcut");
+ }
+
+ public void testGenericAspectsAndAnnotations_pr124654() {
+ runTest("generic aspects and annotations");
+ }
+
+ public void testCallInheritedGenericMethod_pr124999() {
+ runTest("calling inherited generic method from around advice");
+ }
+
+ public void testIncorrectlyReferencingPointcuts_pr122452() {
+ runTest("incorrectly referencing pointcuts");
+ }
+
+ public void testIncorrectlyReferencingPointcuts_pr122452_2() {
+ runTest("incorrectly referencing pointcuts - 2");
+ }
+
+ public void testInlinevisitorNPE_pr123901() {
+ runTest("inlinevisitor NPE");
+ }
+
+ // public void testExposingWithintype_enh123423() { runTest("exposing withintype");}
+ // public void testMissingImport_pr127299() { runTest("missing import gives funny message");}
+ public void testUnusedInterfaceMessage_pr120527() {
+ runTest("incorrect unused interface message");
+ }
+
+ public void testAtAspectInheritsAdviceWithTJPAndThis_pr125699() {
+ runTest("inherit advice with this() and thisJoinPoint");
+ }
+
+ public void testAtAspectInheritsAdviceWithTJPAndThis_pr125699_2() {
+ runTest("inherit advice with this() and thisJoinPoint - 2");
+ }
+
+ public void testBrokenLTW_pr128744() {
+ runTest("broken ltw");
+ }
+
+ public void testAtAspectNoInvalidAbsoluteTypeName_pr126560() {
+ runTest("@AJ deow doesn't throw an invalidAbsoluteTypeName when specify type in the same package");
+ }
+
+ public void testAtAspectNoInvalidAbsoluteTypeName_pr126560_2() {
+ runTest("@AJ deow doesn't throw an invalidAbsoluteTypeName when specify type in the same file");
+ }
+
+ public void testArrayindexoutofbounds_pr129566() {
+ runTest("arrayindexoutofbounds");
+ // public class SkipList<T extends Comparable> extends Object implements Set<T>, Iterable<T>
+ GenericsTests.verifyClassSignature(ajc, "common.SkipList",
+ "<T::Ljava/lang/Comparable;>Ljava/lang/Object;Ljava/util/Set<TT;>;Ljava/lang/Iterable<TT;>;");
+ // protected class SkipListElement<E> extends Object
+ GenericsTests.verifyClassSignature(ajc, "common.SkipList$SkipListElement", "<E:Ljava/lang/Object;>Ljava/lang/Object;");
+ // protected class SkipListIterator<E> implements Iterator<T>
+ GenericsTests.verifyClassSignature(ajc, "common.SkipList$SkipListIterator",
+ "<E:Ljava/lang/Object;>Ljava/lang/Object;Ljava/util/Iterator<TT;>;");
+ }
+
+ public void testMixingNumbersOfTypeParameters_pr125080() {
+ runTest("mixing numbers of type parameters");
+ GenericsTests.verifyClassSignature(ajc, "AspectInterface", "<T:Ljava/lang/Object;S:Ljava/lang/Object;>Ljava/lang/Object;");
+ GenericsTests.verifyClassSignature(ajc, "AbstractAspect",
+ "<T:Ljava/lang/Object;>Ljava/lang/Object;LAspectInterface<TT;Ljava/lang/Integer;>;");
+ GenericsTests.verifyClassSignature(ajc, "ConcreteAspect", "LAbstractAspect<Ljava/lang/String;>;");
+ }
+
+ public void testMixingNumbersOfTypeParameters_pr125080_2() {
+ runTest("mixing numbers of type parameters - 2");
+ GenericsTests.verifyClassSignature(ajc, "AspectInterface", "<T:Ljava/lang/Object;S:Ljava/lang/Number;>Ljava/lang/Object;");
+ GenericsTests.verifyClassSignature(ajc, "AbstractAspect",
+ "<T:Ljava/lang/Object;>Ljava/lang/Object;LAspectInterface<TT;Ljava/lang/Integer;>;");
+ GenericsTests.verifyClassSignature(ajc, "ConcreteAspect", "LAbstractAspect<LStudent;>;");
+ }
+
+ public void testIProgramElementMethods_pr125295() {
+ runTest("new IProgramElement methods");
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
+
+ IProgramElement pe = top.findElementForType("pkg", "foo");
+ assertNotNull("Couldn't find 'foo' element in the tree", pe);
+ // check that the defaults return the fully qualified arg
+ assertEquals("foo(int,java.lang.Object)", pe.toLabelString());
+ assertEquals("C.foo(int,java.lang.Object)", pe.toLinkLabelString());
+ assertEquals("foo(int,java.lang.Object)", pe.toSignatureString());
+ // check that can get hold of the non qualified args
+ assertEquals("foo(int,Object)", pe.toLabelString(false));
+ assertEquals("C.foo(int,Object)", pe.toLinkLabelString(false));
+ assertEquals("foo(int,Object)", pe.toSignatureString(false));
+
+ IProgramElement pe2 = top.findElementForType("pkg", "printParameters");
+ assertNotNull("Couldn't find 'printParameters' element in the tree", pe2);
+ // the argument is org.aspectj.lang.JoinPoint, check that this is added
+ assertFalse("printParameters method should have arguments", pe2.getParameterSignatures().isEmpty());
+ }
+
+ public void testParameterizedEnum_pr126316() {
+ runTest("E extends Enum(E) again");
+ }
+
+ public void testSwallowedException() {
+ runTest("swallowed exceptions");
+ }
+
+ public void testAtAspectVerifyErrorWithAfterThrowingAndthisJoinPoint_pr122742() {
+ runTest("@AJ VerifyError with @AfterThrowing and thisJoinPoint argument");
+ }
+
+ public void testAtAspectVerifyErrorWithAfterReturningAndthisJoinPoint_pr122742() {
+ runTest("@AJ VerifyError with @AfterReturning and thisJoinPoint argument");
+ }
+
+ public void testSwallowedExceptionIgnored() {
+ runTest("swallowed exceptions with xlint");
+ }
+
+ public void testGenericAspectWithUnknownType_pr131933() {
+ runTest("no ClassCastException with generic aspect and unknown type");
+ }
+
+ /*
+ * @AspectJ bugs and enhancements
+ */
+ // public void testAtAspectInheritsAdviceWithTJPAndThis_pr125699 () {
+ // runTest("inherit adivce with this() and thisJoinPoint");
+ // }
+ public void testAtAspectInheritsAbstractPointcut_pr125810() {
+ runTest("warning when inherited pointcut not made concrete");
+ }
+
+ public void testAtAspectWithoutJoinPointImport_pr121616() {
+ runTest("@AJ without JoinPoint import");
+ }
+
+ public void testAtAspectDeclareParentsRetainsFieldState_pr122370() {
+ runTest("@AJ declare parents retains field state");
+ }
+
+ public void testAtAspectNoNPEWithPcdContainingOrThisAndWildcard_pr128237() {
+ runTest("@AJ no npe with pointcut containing or, this and a wildcard");
+ }
+
+ /*
+ * Load-time weaving bugs and enhancements
+ */
+ public void testEmptyPointcutInAtAspectJ_pr125475() {
+ runTest("define empty pointcut using an annotation");
+ }
+
+ public void testEmptyPointcutInAtAspectJ_pr125475_2() {
+ runTest("define empty pointcut using an annotation - 2");
+ }
+
+ public void testEmptyPointcutInAtAspectJWithLTW_pr125475() {
+ runTest("define empty pointcut using aop.xml");
+ }
+
+ public void testGenericAspectsWithAnnotationTypeParameters() {
+ runTest("Generic aspects with annotation type parameters");
+ }
+
+ public void testPointcutInterfaces_pr130869() {
+ runTest("Pointcut interfaces");
+ }
+
+ // ///////////////////////////////////////
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(Ajc151Tests.class);
+ }
+
+ protected File getSpecFile() {
+ return new File("../tests/src/org/aspectj/systemtest/ajc151/ajc151.xml");
+ }
+
}
\ No newline at end of file
* What still needs testing:
* - structure model
*
- */
-
+ */
public class NewarrayJoinpointTests extends XMLBasedAjcTestCase {
- // when its the creation of a new 'object' (not a primitive) single dimension array
- public void testTheBasics_1() { runTest("basics"); }
- public void testTheBasics_2() { runTest("basics - 2"); }
- public void testWhatShouldntMatch() { runTest("shouldnt match"); }
- public void testThisJoinPoint() { runTest("thisjoinpoint"); }
- public void testDifferentAdviceKinds() { runTest("different advice kinds");}
- public void testArgs() { runTest("args");}
-
- // when it is the creation of a new array of primitives
- public void testBasicWithAPrimitiveArray() { runTest("basic primitive array creation");}
-
-
- // when it is the creation of a new multi-dimensional array
- public void testBasicWithAMultiDimensionalArray() { runTest("multi dimensional array creation"); }
- public void testArgsWithAMultiDimensionalArray() { runTest("multi dimensional array args");}
-
- // various
- public void testOptionoff() { runTest("option deactivated - no match expected");}
- public void testUsingTargetAndAfterReturningAdvice() { runTest("using target and after returning");}
- public void testUsingItForReal() { runTest("using it for real");}
- public void testDifferentiatingArrayTypes() { runTest("differentiating array types");}
-
- public void testStructureModel() {
- //AsmManager.setReporting("c:/foo.txt",true,true,true,true);
- runTest("structure model");
- IProgramElement ipe = AsmManager.getDefault().getHierarchy().findElementForType("","Five");
- assertTrue("Couldnt find 'Five' type in the model",ipe!=null);
- List kids = ipe.getChildren();
- assertTrue("Couldn't find 'main' method in the 'Five' type",kids!=null && kids.size()==1);
- List codenodes = ((IProgramElement)kids.get(0)).getChildren();
- assertTrue("Couldn't find nodes below 'main' method",codenodes!=null && codenodes.size()==1);
- IProgramElement arrayCtorCallNode = (IProgramElement)codenodes.get(0);
- String exp = "constructor-call(void java.lang.Integer[].<init>(int))";
- assertTrue("Expected '"+exp+"' but found "+arrayCtorCallNode.toString(),arrayCtorCallNode.toString().equals(exp));
- List rels = AsmManager.getDefault().getRelationshipMap().get(arrayCtorCallNode);
- assertTrue("Should have a relationship from the ctorcall node, but didn't find one?",rels!=null && rels.size()==1);
- }
-
-
-
- //
- public static Test suite() {
- return XMLBasedAjcTestCase.loadSuite(NewarrayJoinpointTests.class);
- }
-
- protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc151/newarray_joinpoint.xml");
- }
-
+ // when its the creation of a new 'object' (not a primitive) single dimension array
+ public void testTheBasics_1() {
+ runTest("basics");
+ }
+
+ public void testTheBasics_2() {
+ runTest("basics - 2");
+ }
+
+ public void testWhatShouldntMatch() {
+ runTest("shouldnt match");
+ }
+
+ public void testThisJoinPoint() {
+ runTest("thisjoinpoint");
+ }
+
+ public void testDifferentAdviceKinds() {
+ runTest("different advice kinds");
+ }
+
+ public void testArgs() {
+ runTest("args");
+ }
+
+ // when it is the creation of a new array of primitives
+ public void testBasicWithAPrimitiveArray() {
+ runTest("basic primitive array creation");
+ }
+
+ // when it is the creation of a new multi-dimensional array
+ public void testBasicWithAMultiDimensionalArray() {
+ runTest("multi dimensional array creation");
+ }
+
+ public void testArgsWithAMultiDimensionalArray() {
+ runTest("multi dimensional array args");
+ }
+
+ // various
+ public void testOptionoff() {
+ runTest("option deactivated - no match expected");
+ }
+
+ public void testUsingTargetAndAfterReturningAdvice() {
+ runTest("using target and after returning");
+ }
+
+ public void testUsingItForReal() {
+ runTest("using it for real");
+ }
+
+ public void testDifferentiatingArrayTypes() {
+ runTest("differentiating array types");
+ }
+
+ public void testStructureModel() {
+ // AsmManager.setReporting("c:/foo.txt",true,true,true,true);
+ runTest("structure model");
+ IProgramElement ipe = AsmManager.lastActiveStructureModel.getHierarchy().findElementForType("", "Five");
+ assertTrue("Couldnt find 'Five' type in the model", ipe != null);
+ List kids = ipe.getChildren();
+ assertTrue("Couldn't find 'main' method in the 'Five' type", kids != null && kids.size() == 1);
+ List codenodes = ((IProgramElement) kids.get(0)).getChildren();
+ assertTrue("Couldn't find nodes below 'main' method", codenodes != null && codenodes.size() == 1);
+ IProgramElement arrayCtorCallNode = (IProgramElement) codenodes.get(0);
+ String exp = "constructor-call(void java.lang.Integer[].<init>(int))";
+ assertTrue("Expected '" + exp + "' but found " + arrayCtorCallNode.toString(), arrayCtorCallNode.toString().equals(exp));
+ List rels = AsmManager.lastActiveStructureModel.getRelationshipMap().get(arrayCtorCallNode);
+ assertTrue("Should have a relationship from the ctorcall node, but didn't find one?", rels != null && rels.size() == 1);
+ }
+
+ //
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(NewarrayJoinpointTests.class);
+ }
+
+ protected File getSpecFile() {
+ return new File("../tests/src/org/aspectj/systemtest/ajc151/newarray_joinpoint.xml");
+ }
+
}
public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
-// public void testCovarianceAndDecp_pr128443_1() { runTest("covariance and decp - 1"); }
-// public void testSuperITDExplosion_pr134425() { runTest("super ITDs");}
-// public void testMisbehavingDeclareAnnotation_pr135865() { runTest("misbehaving declare annotation");}
-// public void testMisbehavingDeclareAnnotation_pr135865_2() { runTest("misbehaving declare annotation - 2");}
-// public void testClassCastForInvalidAnnotationValue_pr148537() { runTest("classcast annotation value");}
-
-
- // tests added post 152rc1 and before final
- public void testSeparateCallAspectOf_pr148727() { runTest("separate compilation calling aspectOf and hasAspect"); }
- public void testIntegratedCallAspectOf_pr148727() { runTest("integrated compilation calling aspectOf and hasAspect"); }
- public void testFreakyNewArrayJoinpoint_pr148786() { runTest("freaky new array joinpoint"); }
-
- // tests adding during 152 development
- public void testPrivilegeGeneric_pr148545() { runTest("nosuchmethoderror for privileged aspect");}
- public void testPrivilegeGeneric_pr148545_2() { runTest("nosuchmethoderror for privileged aspect - 2");}
- public void testUnknownAnnotationNPE() { runTest("NPE for unknown annotation");}
- public void testDuplicateBridgeMethods_pr147801_1() { runTest("duplicate bridge methods");}
- public void testPackageIgnoredForException_pr147701_1() { runTest("package for exception ignored");}
- public void testPackageIgnoredForException_pr147701_2() { runTest("package for exception ignored - 2");}
- public void testPackageIgnoredForException_pr147701_3() { runTest("package for exception ignored - 3");}
- public void testBrokenAddSerialVersionUID_pr145950() {runTest("fails to discover Serializable");}
- public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_1() {runTest("no unnecessary declaration of thrown exception warning - 1");}
- public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_2() {runTest("no unnecessary declaration of thrown exception warning - 2");}
- public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_3() {runTest("no unnecessary declaration of thrown exception warning - 3");}
- public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_4() {runTest("no unnecessary declaration of thrown exception warning - 4");}
- public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_5() {runTest("no unnecessary declaration of thrown exception warning - 5");}
- public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_6() {runTest("no unnecessary declaration of thrown exception warning - 6");}
- public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_7() {runTest("no unnecessary declaration of thrown exception warning - 7");}
- public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_8() {runTest("no unnecessary declaration of thrown exception warning - 8");}
- public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_9() {runTest("no unnecessary declaration of thrown exception warning - 9");}
- public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_10() {runTest("no unnecessary declaration of thrown exception warning - 10");}
- public void testAtAJVerificationError_pr144602() { runTest("atAJ perthis aspect verification error");}
- public void testLTWAndGeneratingSUID_pr144465() { runTest("ltw with serialversionUID creation"); }
- public void testAspects14PerSingleton_pr122253() { runTest("aspects14 - persingleton");}
- public void testAspects14PerCflow_pr122253() { runTest("aspects14 - percflow");}
- public void testAspects14PerThis_pr122253() { runTest("aspects14 - perthis");}
- public void testAspects14PerTypeWithin_pr122253() { runTest("aspects14 - pertypewithin");}
- public void testFunkyGenericErrorWithITDs_pr126355() { runTest("bizarre generic error with itds");}
- public void testConcretizingAbstractMethods_pr142466() { runTest("aop.xml aspect inheriting but not concretizing abstract method");}
- public void testConcretizingAbstractMethods_pr142466_2() { runTest("aop.xml aspect inheriting but not concretizing abstract method - 2");}
- public void testComplexGenericDecl_pr137568() { runTest("complicated generics declaration");}
- public void testItdOnInnerTypeOfGenericType_pr132349() { runTest("ITD on inner type of generic type");}
- public void testItdOnInnerTypeOfGenericType_pr132349_2() { runTest("ITD on inner type of generic type - 2");}
- public void testItdOnInnerTypeOfGenericType_pr132349_3() { runTest("ITD on inner type of generic type - 3");}
- public void testLTWGeneratedAspectAbstractMethod_pr125480() { runTest("aop.xml aspect inheriting abstract method ");}
- public void testLTWGeneratedAspectAbstractMethod_pr125480_2() { runTest("aop.xml aspect inheriting abstract method - code style");}
- public void testCompletelyBrokenAopConcretization_pr142165_1() { runTest("broken concretization");}
- public void testCompletelyBrokenAopConcretization_pr142165_2() { runTest("broken concretization - 2");}
- public void testCompletelyBrokenAopConcretization_pr142165_3() { runTest("broken concretization - 3");}
-// public void testVerifyErrorLTW_pr135068() { runTest("ltw verifyerror");}
-// public void testVerifyErrorLTW_pr135068_2() { runTest("ltw verifyerror - 2");}
-// public void testVerifyErrorLTW_pr135068_3() { runTest("ltw verifyerror - 3");}
- public void testVerifyErrorLTW_pr135068_4() { runTest("ltw verifyerror - 4");}
- public void testVerifyErrorForComplexCflow_pr136026() { runTest("verifyerror");}
- public void testVerifyErrorForComplexCflow_pr136026_2() { runTest("verifyerror - 2");}
- public void testAnnotationsAndGenericsBCException_pr129704() { runTest("annotations and generics leading to BCException");}
- public void testMethodTooBigAfterWeaving_pr138384() { runTest("method too big"); }
- public void testNotAtWithincode_pr138158_1() { runTest("not at withincode - 1");}
- public void testNotAtWithincode_pr138158_2() { runTest("not at withincode - 2");}
- public void testNotAtWithincode_pr138158_3() { runTest("not at within - 3");}
- public void testNpeOnDup_pr138143() { runTest("npe on duplicate method with ataj");}
- public void testPointcutsAndGenerics_pr137496_1() { runTest("pointcuts and generics - B");}
- public void testPointcutsAndGenerics_pr137496_2() { runTest("pointcuts and generics - D");}
- public void testPointcutsAndGenerics_pr137496_3() { runTest("pointcuts and generics - E");}
- public void testPointcutsAndGenerics_pr137496_4() { runTest("pointcuts and generics - F");}
- public void testPointcutsAndGenerics_pr137496_5() { runTest("pointcuts and generics - G");}
- public void testPointcutsAndGenerics_pr137496_6() { runTest("pointcuts and generics - H");}
- public void testAspectLibrariesAndASM_pr135001() { runTest("aspect libraries and asm");}
- public void testStackOverflow_pr136258() { runTest("stack overflow");}
- public void testIncorrectOverridesEvaluation13() { runTest("incorrect overrides evaluation - 1.3"); }
- public void testIncorrectOverridesEvaluation15() { runTest("incorrect overrides evaluation - 1.5"); }
- public void testAtWithinCodeBug_pr138798() { runTest("atWithinCodeBug"); }
- public void testReferencePCutInDeclareWarning_pr138215() { runTest("Reference pointcut fails inside @DeclareWarning");}
- public void testReferencePCutInPerClause_pr138219() { runTest("Can't use a FQ Reference pointcut in any pointcut expression referenced by a per-clause");}
- public void testReferencePCutInPerClause_pr130722() { runTest("FQ Reference pointcut from perclause ref pc"); }
- public void testDoubleAnnotationMatching_pr138223() { runTest("Double at annotation matching (no binding)");}
- public void testSuperCallsInAtAspectJAdvice_pr139749() { runTest("Super calls in @AspectJ advice");}
- public void testNoClassCastExceptionWithPerThis_pr138286() { runTest("No ClassCastException with perThis");}
- public void testGenericAspectHierarchyWithBounds_pr147845() { runTest("Generic abstract aspect hierarchy with bounds"); }
- public void testJRockitBooleanReturn_pr148007() { runTest("jrockit boolean fun");}
- public void testJRockitBooleanReturn2_pr148007() { runTest("jrockit boolean fun (no aspects)");}
- public void testSyntheticAjcMembers_pr147711() { runTest("synthetic ajc$ members"); }
-
-// this next one reported as a bug by Rob Harrop, but I can't reproduce the failure yet...
-//public void testAtAspectWithReferencePCPerClause_pr138220() { runTest("@Aspect with reference pointcut in perclause");}
-
- public void testJarChecking_pr137235_1() { runTest("directory with .jar extension: source and outjar"); }
- public void testJarChecking_pr137235_2() { runTest("directory with .jar extension"); }
- public void testMakePreMethodNPE_pr136393() { runTest("NPE in makePreMethod");}
-
- public void testGetParameterSignatures_pr141730() {
- runTest("new iprogramelement method getParameterSignatures");
-
- checkGetParamSigOfMethod("stringMethod(java.lang.String)","Ljava/lang/String;");
- checkGetParamSigOfMethod("main(java.lang.String[])","[Ljava/lang/String;");
- checkGetParamSigOfMethod("multiMethod(java.lang.String[][])","[[Ljava/lang/String;");
- }
-
- public void testGetParameterSignaturesWithGenerics_pr141730() {
- runTest("new iprogramelement method getParameterSignatures with generics");
-
- checkGetParamSigOfMethod("genericMethod(java.util.List<java.lang.String>)","Pjava/util/List<Ljava/lang/String;>;");
- checkGetParamSigOfMethod("genericMethod2(MyGenericClass<java.lang.String,MyClass>)","PMyGenericClass<Ljava/lang/String;LMyClass;>;");
- }
-
-// public void testFunkyGenericErrorWithITDs_pr126355_2() {
-// runTest("bizarre generic error with itds - 2");
-// // public class Pair<F,S> affected by pertarget aspect
-// GenericsTests.verifyClassSignature(ajc,"Pair","<F:Ljava/lang/Object;S:Ljava/lang/Object;>Ljava/lang/Object;LIdempotentCache$ajcMightHaveAspect;;");
-// }
-
- public void testNoAspects(){
-// setSystemProperty(WeavingAdaptor.WEAVING_ADAPTOR_VERBOSE,"true");
+ // public void testCovarianceAndDecp_pr128443_1() { runTest("covariance and decp - 1"); }
+ // public void testSuperITDExplosion_pr134425() { runTest("super ITDs");}
+ // public void testMisbehavingDeclareAnnotation_pr135865() { runTest("misbehaving declare annotation");}
+ // public void testMisbehavingDeclareAnnotation_pr135865_2() { runTest("misbehaving declare annotation - 2");}
+ // public void testClassCastForInvalidAnnotationValue_pr148537() { runTest("classcast annotation value");}
+
+ // tests added post 152rc1 and before final
+ public void testSeparateCallAspectOf_pr148727() {
+ runTest("separate compilation calling aspectOf and hasAspect");
+ }
+
+ public void testIntegratedCallAspectOf_pr148727() {
+ runTest("integrated compilation calling aspectOf and hasAspect");
+ }
+
+ public void testFreakyNewArrayJoinpoint_pr148786() {
+ runTest("freaky new array joinpoint");
+ }
+
+ // tests adding during 152 development
+ public void testPrivilegeGeneric_pr148545() {
+ runTest("nosuchmethoderror for privileged aspect");
+ }
+
+ public void testPrivilegeGeneric_pr148545_2() {
+ runTest("nosuchmethoderror for privileged aspect - 2");
+ }
+
+ public void testUnknownAnnotationNPE() {
+ runTest("NPE for unknown annotation");
+ }
+
+ public void testDuplicateBridgeMethods_pr147801_1() {
+ runTest("duplicate bridge methods");
+ }
+
+ public void testPackageIgnoredForException_pr147701_1() {
+ runTest("package for exception ignored");
+ }
+
+ public void testPackageIgnoredForException_pr147701_2() {
+ runTest("package for exception ignored - 2");
+ }
+
+ public void testPackageIgnoredForException_pr147701_3() {
+ runTest("package for exception ignored - 3");
+ }
+
+ public void testBrokenAddSerialVersionUID_pr145950() {
+ runTest("fails to discover Serializable");
+ }
+
+ public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_1() {
+ runTest("no unnecessary declaration of thrown exception warning - 1");
+ }
+
+ public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_2() {
+ runTest("no unnecessary declaration of thrown exception warning - 2");
+ }
+
+ public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_3() {
+ runTest("no unnecessary declaration of thrown exception warning - 3");
+ }
+
+ public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_4() {
+ runTest("no unnecessary declaration of thrown exception warning - 4");
+ }
+
+ public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_5() {
+ runTest("no unnecessary declaration of thrown exception warning - 5");
+ }
+
+ public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_6() {
+ runTest("no unnecessary declaration of thrown exception warning - 6");
+ }
+
+ public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_7() {
+ runTest("no unnecessary declaration of thrown exception warning - 7");
+ }
+
+ public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_8() {
+ runTest("no unnecessary declaration of thrown exception warning - 8");
+ }
+
+ public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_9() {
+ runTest("no unnecessary declaration of thrown exception warning - 9");
+ }
+
+ public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_10() {
+ runTest("no unnecessary declaration of thrown exception warning - 10");
+ }
+
+ public void testAtAJVerificationError_pr144602() {
+ runTest("atAJ perthis aspect verification error");
+ }
+
+ public void testLTWAndGeneratingSUID_pr144465() {
+ runTest("ltw with serialversionUID creation");
+ }
+
+ public void testAspects14PerSingleton_pr122253() {
+ runTest("aspects14 - persingleton");
+ }
+
+ public void testAspects14PerCflow_pr122253() {
+ runTest("aspects14 - percflow");
+ }
+
+ public void testAspects14PerThis_pr122253() {
+ runTest("aspects14 - perthis");
+ }
+
+ public void testAspects14PerTypeWithin_pr122253() {
+ runTest("aspects14 - pertypewithin");
+ }
+
+ public void testFunkyGenericErrorWithITDs_pr126355() {
+ runTest("bizarre generic error with itds");
+ }
+
+ public void testConcretizingAbstractMethods_pr142466() {
+ runTest("aop.xml aspect inheriting but not concretizing abstract method");
+ }
+
+ public void testConcretizingAbstractMethods_pr142466_2() {
+ runTest("aop.xml aspect inheriting but not concretizing abstract method - 2");
+ }
+
+ public void testComplexGenericDecl_pr137568() {
+ runTest("complicated generics declaration");
+ }
+
+ public void testItdOnInnerTypeOfGenericType_pr132349() {
+ runTest("ITD on inner type of generic type");
+ }
+
+ public void testItdOnInnerTypeOfGenericType_pr132349_2() {
+ runTest("ITD on inner type of generic type - 2");
+ }
+
+ public void testItdOnInnerTypeOfGenericType_pr132349_3() {
+ runTest("ITD on inner type of generic type - 3");
+ }
+
+ public void testLTWGeneratedAspectAbstractMethod_pr125480() {
+ runTest("aop.xml aspect inheriting abstract method ");
+ }
+
+ public void testLTWGeneratedAspectAbstractMethod_pr125480_2() {
+ runTest("aop.xml aspect inheriting abstract method - code style");
+ }
+
+ public void testCompletelyBrokenAopConcretization_pr142165_1() {
+ runTest("broken concretization");
+ }
+
+ public void testCompletelyBrokenAopConcretization_pr142165_2() {
+ runTest("broken concretization - 2");
+ }
+
+ public void testCompletelyBrokenAopConcretization_pr142165_3() {
+ runTest("broken concretization - 3");
+ }
+
+ // public void testVerifyErrorLTW_pr135068() { runTest("ltw verifyerror");}
+ // public void testVerifyErrorLTW_pr135068_2() { runTest("ltw verifyerror - 2");}
+ // public void testVerifyErrorLTW_pr135068_3() { runTest("ltw verifyerror - 3");}
+ public void testVerifyErrorLTW_pr135068_4() {
+ runTest("ltw verifyerror - 4");
+ }
+
+ public void testVerifyErrorForComplexCflow_pr136026() {
+ runTest("verifyerror");
+ }
+
+ public void testVerifyErrorForComplexCflow_pr136026_2() {
+ runTest("verifyerror - 2");
+ }
+
+ public void testAnnotationsAndGenericsBCException_pr129704() {
+ runTest("annotations and generics leading to BCException");
+ }
+
+ public void testMethodTooBigAfterWeaving_pr138384() {
+ runTest("method too big");
+ }
+
+ public void testNotAtWithincode_pr138158_1() {
+ runTest("not at withincode - 1");
+ }
+
+ public void testNotAtWithincode_pr138158_2() {
+ runTest("not at withincode - 2");
+ }
+
+ public void testNotAtWithincode_pr138158_3() {
+ runTest("not at within - 3");
+ }
+
+ public void testNpeOnDup_pr138143() {
+ runTest("npe on duplicate method with ataj");
+ }
+
+ public void testPointcutsAndGenerics_pr137496_1() {
+ runTest("pointcuts and generics - B");
+ }
+
+ public void testPointcutsAndGenerics_pr137496_2() {
+ runTest("pointcuts and generics - D");
+ }
+
+ public void testPointcutsAndGenerics_pr137496_3() {
+ runTest("pointcuts and generics - E");
+ }
+
+ public void testPointcutsAndGenerics_pr137496_4() {
+ runTest("pointcuts and generics - F");
+ }
+
+ public void testPointcutsAndGenerics_pr137496_5() {
+ runTest("pointcuts and generics - G");
+ }
+
+ public void testPointcutsAndGenerics_pr137496_6() {
+ runTest("pointcuts and generics - H");
+ }
+
+ public void testAspectLibrariesAndASM_pr135001() {
+ runTest("aspect libraries and asm");
+ }
+
+ public void testStackOverflow_pr136258() {
+ runTest("stack overflow");
+ }
+
+ public void testIncorrectOverridesEvaluation13() {
+ runTest("incorrect overrides evaluation - 1.3");
+ }
+
+ public void testIncorrectOverridesEvaluation15() {
+ runTest("incorrect overrides evaluation - 1.5");
+ }
+
+ public void testAtWithinCodeBug_pr138798() {
+ runTest("atWithinCodeBug");
+ }
+
+ public void testReferencePCutInDeclareWarning_pr138215() {
+ runTest("Reference pointcut fails inside @DeclareWarning");
+ }
+
+ public void testReferencePCutInPerClause_pr138219() {
+ runTest("Can't use a FQ Reference pointcut in any pointcut expression referenced by a per-clause");
+ }
+
+ public void testReferencePCutInPerClause_pr130722() {
+ runTest("FQ Reference pointcut from perclause ref pc");
+ }
+
+ public void testDoubleAnnotationMatching_pr138223() {
+ runTest("Double at annotation matching (no binding)");
+ }
+
+ public void testSuperCallsInAtAspectJAdvice_pr139749() {
+ runTest("Super calls in @AspectJ advice");
+ }
+
+ public void testNoClassCastExceptionWithPerThis_pr138286() {
+ runTest("No ClassCastException with perThis");
+ }
+
+ public void testGenericAspectHierarchyWithBounds_pr147845() {
+ runTest("Generic abstract aspect hierarchy with bounds");
+ }
+
+ public void testJRockitBooleanReturn_pr148007() {
+ runTest("jrockit boolean fun");
+ }
+
+ public void testJRockitBooleanReturn2_pr148007() {
+ runTest("jrockit boolean fun (no aspects)");
+ }
+
+ public void testSyntheticAjcMembers_pr147711() {
+ runTest("synthetic ajc$ members");
+ }
+
+ // this next one reported as a bug by Rob Harrop, but I can't reproduce the failure yet...
+ // public void testAtAspectWithReferencePCPerClause_pr138220() { runTest("@Aspect with reference pointcut in perclause");}
+
+ public void testJarChecking_pr137235_1() {
+ runTest("directory with .jar extension: source and outjar");
+ }
+
+ public void testJarChecking_pr137235_2() {
+ runTest("directory with .jar extension");
+ }
+
+ public void testMakePreMethodNPE_pr136393() {
+ runTest("NPE in makePreMethod");
+ }
+
+ public void testGetParameterSignatures_pr141730() {
+ runTest("new iprogramelement method getParameterSignatures");
+
+ checkGetParamSigOfMethod("stringMethod(java.lang.String)", "Ljava/lang/String;");
+ checkGetParamSigOfMethod("main(java.lang.String[])", "[Ljava/lang/String;");
+ checkGetParamSigOfMethod("multiMethod(java.lang.String[][])", "[[Ljava/lang/String;");
+ }
+
+ public void testGetParameterSignaturesWithGenerics_pr141730() {
+ runTest("new iprogramelement method getParameterSignatures with generics");
+
+ checkGetParamSigOfMethod("genericMethod(java.util.List<java.lang.String>)", "Pjava/util/List<Ljava/lang/String;>;");
+ checkGetParamSigOfMethod("genericMethod2(MyGenericClass<java.lang.String,MyClass>)",
+ "PMyGenericClass<Ljava/lang/String;LMyClass;>;");
+ }
+
+ // public void testFunkyGenericErrorWithITDs_pr126355_2() {
+ // runTest("bizarre generic error with itds - 2");
+ // // public class Pair<F,S> affected by pertarget aspect
+ // GenericsTests.verifyClassSignature(ajc,"Pair","<F:Ljava/lang/Object;S:Ljava/lang/Object;>Ljava/lang/Object;LIdempotentCache$ajcMightHaveAspect;;");
+ // }
+
+ public void testNoAspects() {
+ // setSystemProperty(WeavingAdaptor.WEAVING_ADAPTOR_VERBOSE,"true");
runTest("Ensure no weaving without included aspects");
}
- public void testWeaveinfoMessages (){
+ public void testWeaveinfoMessages() {
runTest("weaveinfo messages with include and exclude");
}
- // tests that can't be included for some reason
+ // tests that can't be included for some reason
- // Not valid whilst the ajc compiler forces debug on (ignores -g:none) - it will be green but is invalid, trust me
- // public void testLongWindedMessages_pr129408() { runTest("long winded ataj messages");}
+ // Not valid whilst the ajc compiler forces debug on (ignores -g:none) - it will be green but is invalid, trust me
+ // public void testLongWindedMessages_pr129408() { runTest("long winded ataj messages");}
+
+ // ---------------- helper methods ---------------
- // ---------------- helper methods ---------------
-
private void checkGetParamSigOfMethod(String ipeLabel, String expectedParm) {
- IHierarchy top = AsmManager.getDefault().getHierarchy();
- IProgramElement ipe = top.findElementForLabel(top.getRoot(),IProgramElement.Kind.METHOD,ipeLabel);
- assertNotNull("Couldn't find '" + ipeLabel + "' element in the tree",ipe);
- List l = ipe.getParameterSignatures();
- boolean eq = CharOperation.equals(((char[])l.get(0)),expectedParm.toCharArray());
- assertTrue("expected parameter to be '" + expectedParm + "' but found '" +
- new String(((char[])l.get(0))) + "'",eq);
- }
-
- /////////////////////////////////////////
- public static Test suite() {
- return XMLBasedAjcTestCase.loadSuite(Ajc152Tests.class);
- }
-
- protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc152/ajc152.xml");
- }
-
-
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
+ IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, ipeLabel);
+ assertNotNull("Couldn't find '" + ipeLabel + "' element in the tree", ipe);
+ List l = ipe.getParameterSignatures();
+ boolean eq = CharOperation.equals(((char[]) l.get(0)), expectedParm.toCharArray());
+ assertTrue("expected parameter to be '" + expectedParm + "' but found '" + new String(((char[]) l.get(0))) + "'", eq);
+ }
+
+ // ///////////////////////////////////////
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(Ajc152Tests.class);
+ }
+
+ protected File getSpecFile() {
+ return new File("../tests/src/org/aspectj/systemtest/ajc152/ajc152.xml");
+ }
+
}
\ No newline at end of file
package org.aspectj.systemtest.ajc152;
import java.io.File;
-import java.util.List;
import junit.framework.Test;
-import org.aspectj.asm.AsmManager;
-import org.aspectj.asm.IProgramElement;
-import org.aspectj.asm.IRelationship;
import org.aspectj.testing.XMLBasedAjcTestCase;
/**
- * Work items, phase #1: lock()/unlock()
- * x expose new joinpoints
- * x parse new pcds
- * x fix tjp string
- * x preventing double unlock() messages/markers in structure model
- * x error messages appropriate for attempting to use around advice on synchronization join points
- * x making the use of lock/unlock conditional on an -Xjoinpoints:synchronization
- * x activating the -Xjoinpoints options from LTW configurations rather than through batch/AJDT
- * x ensure the lock/unlock joinpoints only appear when -Xjoinpoints:synchronization specified
- * TAG: Completion of PHASE1
+ * Work items, phase #1: lock()/unlock() x expose new joinpoints x parse new pcds x fix tjp string x preventing double unlock()
+ * messages/markers in structure model x error messages appropriate for attempting to use around advice on synchronization join
+ * points x making the use of lock/unlock conditional on an -Xjoinpoints:synchronization x activating the -Xjoinpoints options from
+ * LTW configurations rather than through batch/AJDT x ensure the lock/unlock joinpoints only appear when
+ * -Xjoinpoints:synchronization specified TAG: Completion of PHASE1
*
*
* Work items, phase #2: transformation
*
- * Design: transform all synchronized methods:
- * public synchronized void m() {
- * ...
- * }
- * =>
- * public void m() {
- * synchronized (this) {
- * ...
- * }
- * }
- *
- * x transforming synchronized methods
- * x matching execution(synchronized * *(..)) for transformed code
- * x warning message for execution() hitting a synchronized method
- * x ensure verifier runs over generated code (done by just executing the code as part of the test spec)
- * - Ant task support for -Xjoinpoints
- * TAG: Completion of PHASE2
- *
- *
+ * Design: transform all synchronized methods: public synchronized void m() { ... } => public void m() { synchronized (this) { ... }
+ * }
+ *
+ * x transforming synchronized methods x matching execution(synchronized * *(..)) for transformed code x warning message for
+ * execution() hitting a synchronized method x ensure verifier runs over generated code (done by just executing the code as part of
+ * the test spec) - Ant task support for -Xjoinpoints TAG: Completion of PHASE2
+ *
+ *
* TAG: Finished
- *
- * Future work items:
- * - optimize matching for transformed methods since we *know* the type we are locking on
- * - supporting type pattern in lock() unlock() - this is not entirely trivial as kinded pointcuts do not usually have any residue
- * - weaving messages include 'unusual' strings for the join points, not the
- * same as revealed by thisJoinPoint.getSignature() in code - handler is probably similar
- * - documentation
- * - lazy translation of synchronized methods, rather than eager
- * - applying execution(* *(..)) correctly to transformed methods (i.e. inside lock/unlock)
- * - use knowledge of type containing synchronized methods to optimize matching of (un)lock() - not always needing residue
- * - line number table is incorrect for transformed code (lock joinpoint has no line number)
- *
- * Notes:
- * IllegalMonitorStateException
- * Thrown to indicate that a thread has attempted to wait on an object's monitor or to
- * notify other threads waiting on an object's monitor without owning the specified monitor.
- *
- * around advice won't work on SUN VMs (may be a bug that it does work on other VMs) since the monitor
- * instructions are extracted to a separate method for proceed() calls and yet the VM seems to want
- * them paired inside a single method.
- *
- * Really we only need to restrict the use of around advice on synchronization join points
- * if the advice uses proceed() - but policing that is a little tough because (DOH) the
- * AdviceAttribute field 'proceedCallSignatures' is never filled in (which records how many
- * proceeds occur in the advice) - see where it isnt filled in at
- * AdviceDeclaration.resolveStatements() in the loop that goes over the proceedCalls list.
- *
- *
- * Problems:
- * - Can't run it on a 1.2.1 runtime - just not practical
+ *
+ * Future work items: - optimize matching for transformed methods since we *know* the type we are locking on - supporting type
+ * pattern in lock() unlock() - this is not entirely trivial as kinded pointcuts do not usually have any residue - weaving messages
+ * include 'unusual' strings for the join points, not the same as revealed by thisJoinPoint.getSignature() in code - handler is
+ * probably similar - documentation - lazy translation of synchronized methods, rather than eager - applying execution(* *(..))
+ * correctly to transformed methods (i.e. inside lock/unlock) - use knowledge of type containing synchronized methods to optimize
+ * matching of (un)lock() - not always needing residue - line number table is incorrect for transformed code (lock joinpoint has no
+ * line number)
+ *
+ * Notes: IllegalMonitorStateException Thrown to indicate that a thread has attempted to wait on an object's monitor or to notify
+ * other threads waiting on an object's monitor without owning the specified monitor.
+ *
+ * around advice won't work on SUN VMs (may be a bug that it does work on other VMs) since the monitor instructions are extracted to
+ * a separate method for proceed() calls and yet the VM seems to want them paired inside a single method.
+ *
+ * Really we only need to restrict the use of around advice on synchronization join points if the advice uses proceed() - but
+ * policing that is a little tough because (DOH) the AdviceAttribute field 'proceedCallSignatures' is never filled in (which records
+ * how many proceeds occur in the advice) - see where it isnt filled in at AdviceDeclaration.resolveStatements() in the loop that
+ * goes over the proceedCalls list.
+ *
+ *
+ * Problems: - Can't run it on a 1.2.1 runtime - just not practical
*
*
* Method transformation, example:
-
- public synchronized void m();
- Code:
- Stack=2, Locals=1, Args_size=1
- 0: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream;
- 3: ldc #3; //String hello
- 5: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
- 8: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream;
- 11: ldc #5; //String world
- 13: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
- 16: return
- LineNumberTable:
- line 4: 0
- line 5: 8
- line 6: 16
-
- public void m2();
- Code:
- Stack=2, Locals=3, Args_size=1
- 0: aload_0
- 1: dup
- 2: astore_1
- 3: monitorenter
- 4: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream;
- 7: ldc #3; //String hello
- 9: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
- 12: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream;
- 15: ldc #5; //String world
- 17: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
- 20: aload_1
- 21: monitorexit
- 22: goto 30
- 25: astore_2
- 26: aload_1
- 27: monitorexit
- 28: aload_2
- 29: athrow
- 30: return
- Exception table:
- from to target type
- 4 22 25 any
- 25 28 25 any
- *
- * Factors affecting transformation:
- * - LDC in Java5 supports referring to a class literal, e.g. Foo.class whereas before Java5, it did not.
- * This means if generating the synchronized() block for a static method from a preJava5 class then
- * we have to generate a lot of crap to build the class object for locking and unlocking. The object
- * is also stored in a local field of the type (if we follow the pattern of JDT/JAVAC)
+ *
+ * public synchronized void m(); Code: Stack=2, Locals=1, Args_size=1 0: getstatic #2; //Field
+ * java/lang/System.err:Ljava/io/PrintStream; 3: ldc #3; //String hello 5: invokevirtual #4; //Method
+ * java/io/PrintStream.println:(Ljava/lang/String;)V 8: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream; 11: ldc #5;
+ * //String world 13: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 16: return LineNumberTable: line
+ * 4: 0 line 5: 8 line 6: 16
+ *
+ * public void m2(); Code: Stack=2, Locals=3, Args_size=1 0: aload_0 1: dup 2: astore_1 3: monitorenter 4: getstatic #2; //Field
+ * java/lang/System.err:Ljava/io/PrintStream; 7: ldc #3; //String hello 9: invokevirtual #4; //Method
+ * java/io/PrintStream.println:(Ljava/lang/String;)V 12: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream; 15: ldc
+ * #5; //String world 17: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 20: aload_1 21: monitorexit
+ * 22: goto 30 25: astore_2 26: aload_1 27: monitorexit 28: aload_2 29: athrow 30: return Exception table: from to target type 4 22
+ * 25 any 25 28 25 any
+ *
+ * Factors affecting transformation: - LDC in Java5 supports referring to a class literal, e.g. Foo.class whereas before Java5, it
+ * did not. This means if generating the synchronized() block for a static method from a preJava5 class then we have to generate a
+ * lot of crap to build the class object for locking and unlocking. The object is also stored in a local field of the type (if we
+ * follow the pattern of JDT/JAVAC)
*/
public class SynchronizationTests extends XMLBasedAjcTestCase {
- // testing the new join points for monitorenter/monitorexit
- public void testTheBasics_1() { runTest("basic"); }
- public void testTheBasics_2() { runTest("basic - within"); }
- public void testTheBasics_3() { runTest("basic - within plus args"); }
- public void testTheBasics_4() { runTest("basic - within plus this"); } // this null in static context
- public void testTheBasics_5() { runTest("basic - within plus target"); } // target null in static context?
-
-
- // testing parsing of the new PCDs lock/unlock
- public void testParsing_1() { runTest("parsing - lock"); }
- public void testParsing_2() { runTest("parsing - unlock"); }
- public void testParsing_errors_1() { runTest("parsing - error - lock"); }
- public void testParsing_errors_2() { runTest("parsing - error - unlock"); }
-
- // testing parsing and matching with the new PCDs
- public void testParsingAndMatching_1() { runTest("parsing and matching - lock and static context"); }
- public void testParsingAndMatching_2() { runTest("parsing and matching - unlock and static context"); }
- public void testParsingAndMatching_3() { runTest("parsing and matching - lock and non-static context"); }
- public void testParsingAndMatching_4() { runTest("parsing and matching - unlock and non-static context"); }
- public void testParsingAndMatching_5() { runTest("parsing and matching - lock and non-static context"); }
- public void testParsingAndMatching_6() { runTest("parsing and matching - unlock and non-static context"); }
-
- // using the new PCDs in a LTW environment
- public void testUsingWithLTW_MissingFlag_1() { runTest("using lock with LTW - missing flag");}
- public void testUsingWithLTW_MissingFlag_2() { runTest("using unlock with LTW - missing flag");}
- public void testUsingWithLTW_1() { runTest("using lock with LTW");}
- public void testUsingWithLTW_2() { runTest("using unlock with LTW");}
-
- // multiple PCDs
- public void testCombiningPCDs_1() { runTest("combining pcds - lock and this");}
- public void testCombiningPCDs_2() { runTest("combining pcds - unlock and this");}
-
- // useful examples
- public void testUseful_1() { runTest("a useful program"); } // just uses within/args - matching the (un)lock jps
- public void testUseful_2() { runTest("a useful program - with lock"); } // uses lock/args
-
- // all the methods of thisJoinPoint
- public void testThisJoinPoint_1() { runTest("thisjoinpoint - monitor entry");}
- public void testThisJoinPoint_2() { runTest("thisjoinpoint - monitor exit"); }
-
- public void testDoubleMessagesOnUnlock() {
- //AsmManager.setReporting("c:/foo.txt",true,true,true,true);
- runTest("prevent double unlock weaving messages and model contents");
- //checkModel1();
- }
-
- // targetting 1.2 runtime - signature creation code in LazyClassGen.initializeTjp may not work
-
- // different advice kinds
- public void testBeforeAdvice_1() { runTest("before advice - lock");}
- public void testBeforeAdvice_2() { runTest("before advice - unlock");}
- public void testAfterAdvice_1() { runTest("after advice - lock"); }
- public void testAfterAdvice_2() { runTest("after advice - unlock"); }
- public void testAroundAdvice_1() { runTest("around advice - lock");}
- public void testAroundAdvice_2() { runTest("around advice - unlock");}
-
-
- public void testLockingTJP() { runTest("obtaining locked object through getArgs");}
-
- // binary weaving?
-
- // nested locking/unlocking
-
- // --- helpers
-
- // Half finished - could check there is only one relationship for unlock() rather than two - but
- // that seems to be the case anyway (peculiar...)
- private void checkModel1() {
- // Verifies only one unlock relationship, not two
- IProgramElement unlockNode = AsmManager.getDefault().getHierarchy().findElementForLabel(AsmManager.getDefault().getHierarchy().getRoot(),
- IProgramElement.Kind.CODE,"unlock(void java.lang.Object.<unlock>(java.lang.Object))");
- assertTrue("Couldn't find the unlock node",unlockNode!=null);
- List l = AsmManager.getDefault().getRelationshipMap().get(unlockNode);
- assertTrue("should be one entry :"+l,l!=null && l.size()==1);
- IRelationship ir = (IRelationship)l.get(0);
- System.err.println(ir);
- List targs = ir.getTargets();
- System.err.println(targs.size());
- System.err.println(targs.get(0));
- }
-
- // ---
- public static Test suite() {
- return XMLBasedAjcTestCase.loadSuite(SynchronizationTests.class);
- }
-
- protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc152/synchronization.xml");
- }
-
+ // testing the new join points for monitorenter/monitorexit
+ public void testTheBasics_1() {
+ runTest("basic");
+ }
+
+ public void testTheBasics_2() {
+ runTest("basic - within");
+ }
+
+ public void testTheBasics_3() {
+ runTest("basic - within plus args");
+ }
+
+ public void testTheBasics_4() {
+ runTest("basic - within plus this");
+ } // this null in static context
+
+ public void testTheBasics_5() {
+ runTest("basic - within plus target");
+ } // target null in static context?
+
+ // testing parsing of the new PCDs lock/unlock
+ public void testParsing_1() {
+ runTest("parsing - lock");
+ }
+
+ public void testParsing_2() {
+ runTest("parsing - unlock");
+ }
+
+ public void testParsing_errors_1() {
+ runTest("parsing - error - lock");
+ }
+
+ public void testParsing_errors_2() {
+ runTest("parsing - error - unlock");
+ }
+
+ // testing parsing and matching with the new PCDs
+ public void testParsingAndMatching_1() {
+ runTest("parsing and matching - lock and static context");
+ }
+
+ public void testParsingAndMatching_2() {
+ runTest("parsing and matching - unlock and static context");
+ }
+
+ public void testParsingAndMatching_3() {
+ runTest("parsing and matching - lock and non-static context");
+ }
+
+ public void testParsingAndMatching_4() {
+ runTest("parsing and matching - unlock and non-static context");
+ }
+
+ public void testParsingAndMatching_5() {
+ runTest("parsing and matching - lock and non-static context");
+ }
+
+ public void testParsingAndMatching_6() {
+ runTest("parsing and matching - unlock and non-static context");
+ }
+
+ // using the new PCDs in a LTW environment
+ public void testUsingWithLTW_MissingFlag_1() {
+ runTest("using lock with LTW - missing flag");
+ }
+
+ public void testUsingWithLTW_MissingFlag_2() {
+ runTest("using unlock with LTW - missing flag");
+ }
+
+ public void testUsingWithLTW_1() {
+ runTest("using lock with LTW");
+ }
+
+ public void testUsingWithLTW_2() {
+ runTest("using unlock with LTW");
+ }
+
+ // multiple PCDs
+ public void testCombiningPCDs_1() {
+ runTest("combining pcds - lock and this");
+ }
+
+ public void testCombiningPCDs_2() {
+ runTest("combining pcds - unlock and this");
+ }
+
+ // useful examples
+ public void testUseful_1() {
+ runTest("a useful program");
+ } // just uses within/args - matching the (un)lock jps
+
+ public void testUseful_2() {
+ runTest("a useful program - with lock");
+ } // uses lock/args
+
+ // all the methods of thisJoinPoint
+ public void testThisJoinPoint_1() {
+ runTest("thisjoinpoint - monitor entry");
+ }
+
+ public void testThisJoinPoint_2() {
+ runTest("thisjoinpoint - monitor exit");
+ }
+
+ public void testDoubleMessagesOnUnlock() {
+ // AsmManager.setReporting("c:/foo.txt",true,true,true,true);
+ runTest("prevent double unlock weaving messages and model contents");
+ // checkModel1();
+ }
+
+ // targetting 1.2 runtime - signature creation code in LazyClassGen.initializeTjp may not work
+
+ // different advice kinds
+ public void testBeforeAdvice_1() {
+ runTest("before advice - lock");
+ }
+
+ public void testBeforeAdvice_2() {
+ runTest("before advice - unlock");
+ }
+
+ public void testAfterAdvice_1() {
+ runTest("after advice - lock");
+ }
+
+ public void testAfterAdvice_2() {
+ runTest("after advice - unlock");
+ }
+
+ public void testAroundAdvice_1() {
+ runTest("around advice - lock");
+ }
+
+ public void testAroundAdvice_2() {
+ runTest("around advice - unlock");
+ }
+
+ public void testLockingTJP() {
+ runTest("obtaining locked object through getArgs");
+ }
+
+ // binary weaving?
+
+ // nested locking/unlocking
+
+ // --- helpers
+
+ // Half finished - could check there is only one relationship for unlock() rather than two - but
+ // that seems to be the case anyway (peculiar...)
+ // private void checkModel1() {
+ // // Verifies only one unlock relationship, not two
+ // IProgramElement unlockNode =
+ // AsmManager.getDefault().getHierarchy().findElementForLabel(AsmManager.getDefault().getHierarchy().getRoot(),
+ // IProgramElement.Kind.CODE,"unlock(void java.lang.Object.<unlock>(java.lang.Object))");
+ // assertTrue("Couldn't find the unlock node",unlockNode!=null);
+ // List l = AsmManager.getDefault().getRelationshipMap().get(unlockNode);
+ // assertTrue("should be one entry :"+l,l!=null && l.size()==1);
+ // IRelationship ir = (IRelationship)l.get(0);
+ // System.err.println(ir);
+ // List targs = ir.getTargets();
+ // System.err.println(targs.size());
+ // System.err.println(targs.get(0));
+ // }
+
+ // ---
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(SynchronizationTests.class);
+ }
+
+ protected File getSpecFile() {
+ return new File("../tests/src/org/aspectj/systemtest/ajc152/synchronization.xml");
+ }
+
}
import org.aspectj.apache.bcel.classfile.JavaClass;
import org.aspectj.apache.bcel.classfile.Method;
-import org.aspectj.asm.AsmManager;
-import org.aspectj.asm.IProgramElement;
-import org.aspectj.asm.IRelationship;
import org.aspectj.testing.XMLBasedAjcTestCase;
import org.aspectj.testing.util.TestUtil;
import org.aspectj.testing.util.TestUtil.LineStream;
import org.aspectj.weaver.bcel.LazyClassGen;
import org.aspectj.weaver.bcel.LazyMethodGen;
-
/**
* Method transformation, example:
-
- public synchronized void m();
- Code:
- Stack=2, Locals=1, Args_size=1
- 0: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream;
- 3: ldc #3; //String hello
- 5: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
- 8: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream;
- 11: ldc #5; //String world
- 13: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
- 16: return
- LineNumberTable:
- line 4: 0
- line 5: 8
- line 6: 16
-
- public void m2();
- Code:
- Stack=2, Locals=3, Args_size=1
- 0: aload_0
- 1: dup
- 2: astore_1
- 3: monitorenter
- 4: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream;
- 7: ldc #3; //String hello
- 9: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
- 12: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream;
- 15: ldc #5; //String world
- 17: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
- 20: aload_1
- 21: monitorexit
- 22: goto 30
- 25: astore_2
- 26: aload_1
- 27: monitorexit
- 28: aload_2
- 29: athrow
- 30: return
- Exception table:
- from to target type
- 4 22 25 any
- 25 28 25 any
+ *
+ * public synchronized void m(); Code: Stack=2, Locals=1, Args_size=1 0: getstatic #2; //Field
+ * java/lang/System.err:Ljava/io/PrintStream; 3: ldc #3; //String hello 5: invokevirtual #4; //Method
+ * java/io/PrintStream.println:(Ljava/lang/String;)V 8: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream; 11: ldc #5;
+ * //String world 13: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 16: return LineNumberTable: line
+ * 4: 0 line 5: 8 line 6: 16
+ *
+ * public void m2(); Code: Stack=2, Locals=3, Args_size=1 0: aload_0 1: dup 2: astore_1 3: monitorenter 4: getstatic #2; //Field
+ * java/lang/System.err:Ljava/io/PrintStream; 7: ldc #3; //String hello 9: invokevirtual #4; //Method
+ * java/io/PrintStream.println:(Ljava/lang/String;)V 12: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream; 15: ldc
+ * #5; //String world 17: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 20: aload_1 21: monitorexit
+ * 22: goto 30 25: astore_2 26: aload_1 27: monitorexit 28: aload_2 29: athrow 30: return Exception table: from to target type 4 22
+ * 25 any 25 28 25 any
*/
public class SynchronizationTransformTests extends XMLBasedAjcTestCase {
private static boolean regenerate;
-
- static { regenerate = false; }
+
+ static {
+ regenerate = false;
+ }
private World world;
-
- public void testInvestigatingTransforming() {
- runTest("investigation");
- checkMethod("Investigation","b"); // similar output to One.b
- checkMethod("Investigation","c");
- checkMethod("Investigation","d");
- checkMethod("Investigation","e");
- }
-
- public void testTransform1() {
- runTest("One");
- checkMethod("One","b");
- checkMethod("One","c");
- checkMethod("One","e");
- }
-
- // before() on execution jp
- public void testTransform2() {
- runTest("Two");
- checkMethod("C","ma");
- }
-
- public void testTransform2XlintOff() {
- runTest("Two - xlintoff");
- checkMethod("C","ma");
- }
-
- // after() returning/after() throwing on execution jp
- // after() returning -> make all returns go through the same exit point and make
- // it call the advice
- // after() throwing -> add a catch block that calls the advice
- public void testTransform3() {
- runTest("Three");
- checkMethod("C","m3");
- checkMethod("C","m32");
- checkMethod("C","m33"); // like m() but synchronized block
- checkMethod("C","m34"); // like m2() but synchronized block
- }
-
- // like testTransform3() but pointcuts explicitly specify synchronized
- public void testTransform4() {
- runTest("Four");
- checkMethod("C","m");
- checkMethod("C","m2");
- }
-
-
-
- // Java5 variant
- public void testStaticSynchronizedMethodTransformJava5() {
- runTest("Five - Java5");
- checkMethod("C","b");
- }
-
- // < Java5 variant
- public void testStaticSynchronizedMethodTransformPreJava5() {
- runTest("Six - preJava5");
- checkMethod("C","bbb");
- }
-
- public void testLockPcdOnTransformedNonStaticMethod() {
- runTest("lock pcd on transformed non-static method");
- }
-
- public void testUnlockPcdOnTransformedNonStaticMethod() {
- runTest("unlock pcd on transformed non-static method");
- }
-
- public void testLockPcdOnTransformedStaticMethod() {
- runTest("lock pcd on transformed static method - J5");
- }
-
- public void testUnlockPcdOnTransformedStaticMethod() {
- runTest("unlock pcd on transformed static method - J5");
- }
-
- public void testLockPcdOnTransformedStaticMethodPreJ5() {
- runTest("lock pcd on transformed static method - preJ5");
- }
-
- public void testUnlockPcdOnTransformedStaticMethodPreJ5() {
- runTest("unlock pcd on transformed static method - preJ5");
- }
-
- public void testJoinpointsEnabledButNoLock() {
- runTest("joinpoints enabled but no lock");
- }
-
- public void testTransformWithLTW() {
- runTest("transform with LTW");
- }
-
-
- public void testTransformStaticMethodPreJava5() {
- runTest("transform static method - preJ5");
- }
-
- public void testTransformStaticMethodPreJava5_2() {
- runTest("transform static method - packages - preJ5");
- }
-
- // more complex code sequences...
- public void testOtherTargeters() {
- runTest("other targeters");
- }
-
- // --- infrastructure below
-
- private void checkMethod(String typename,String methodname) {
- LazyMethodGen m = getMethod(typename,methodname);
- File expectedF = new File(".."+File.separator+"tests"+File.separator+"features152"+File.separator+"synchronization"+File.separator+
- "transformed"+File.separator+"expected"+File.separator+
- typename+"."+methodname+".txt");
- if (regenerate) {
- saveMethod(expectedF, m);
- } else {
- compareMethod(expectedF, m);
- }
- }
-
-
-
- private LazyMethodGen getMethod(String typename,String methodname) {
- BcelObjectType type = getBcelObjectFor(typename);
- LazyClassGen lcg = type.getLazyClassGen();
- List /*LazyMethodGen*/ methods = lcg.getMethodGens();
- for (Iterator iter = methods.iterator(); iter.hasNext();) {
+
+ public void testInvestigatingTransforming() {
+ runTest("investigation");
+ checkMethod("Investigation", "b"); // similar output to One.b
+ checkMethod("Investigation", "c");
+ checkMethod("Investigation", "d");
+ checkMethod("Investigation", "e");
+ }
+
+ public void testTransform1() {
+ runTest("One");
+ checkMethod("One", "b");
+ checkMethod("One", "c");
+ checkMethod("One", "e");
+ }
+
+ // before() on execution jp
+ public void testTransform2() {
+ runTest("Two");
+ checkMethod("C", "ma");
+ }
+
+ public void testTransform2XlintOff() {
+ runTest("Two - xlintoff");
+ checkMethod("C", "ma");
+ }
+
+ // after() returning/after() throwing on execution jp
+ // after() returning -> make all returns go through the same exit point and make
+ // it call the advice
+ // after() throwing -> add a catch block that calls the advice
+ public void testTransform3() {
+ runTest("Three");
+ checkMethod("C", "m3");
+ checkMethod("C", "m32");
+ checkMethod("C", "m33"); // like m() but synchronized block
+ checkMethod("C", "m34"); // like m2() but synchronized block
+ }
+
+ // like testTransform3() but pointcuts explicitly specify synchronized
+ public void testTransform4() {
+ runTest("Four");
+ checkMethod("C", "m");
+ checkMethod("C", "m2");
+ }
+
+ // Java5 variant
+ public void testStaticSynchronizedMethodTransformJava5() {
+ runTest("Five - Java5");
+ checkMethod("C", "b");
+ }
+
+ // < Java5 variant
+ public void testStaticSynchronizedMethodTransformPreJava5() {
+ runTest("Six - preJava5");
+ checkMethod("C", "bbb");
+ }
+
+ public void testLockPcdOnTransformedNonStaticMethod() {
+ runTest("lock pcd on transformed non-static method");
+ }
+
+ public void testUnlockPcdOnTransformedNonStaticMethod() {
+ runTest("unlock pcd on transformed non-static method");
+ }
+
+ public void testLockPcdOnTransformedStaticMethod() {
+ runTest("lock pcd on transformed static method - J5");
+ }
+
+ public void testUnlockPcdOnTransformedStaticMethod() {
+ runTest("unlock pcd on transformed static method - J5");
+ }
+
+ public void testLockPcdOnTransformedStaticMethodPreJ5() {
+ runTest("lock pcd on transformed static method - preJ5");
+ }
+
+ public void testUnlockPcdOnTransformedStaticMethodPreJ5() {
+ runTest("unlock pcd on transformed static method - preJ5");
+ }
+
+ public void testJoinpointsEnabledButNoLock() {
+ runTest("joinpoints enabled but no lock");
+ }
+
+ public void testTransformWithLTW() {
+ runTest("transform with LTW");
+ }
+
+ public void testTransformStaticMethodPreJava5() {
+ runTest("transform static method - preJ5");
+ }
+
+ public void testTransformStaticMethodPreJava5_2() {
+ runTest("transform static method - packages - preJ5");
+ }
+
+ // more complex code sequences...
+ public void testOtherTargeters() {
+ runTest("other targeters");
+ }
+
+ // --- infrastructure below
+
+ private void checkMethod(String typename, String methodname) {
+ LazyMethodGen m = getMethod(typename, methodname);
+ File expectedF = new File(".." + File.separator + "tests" + File.separator + "features152" + File.separator
+ + "synchronization" + File.separator + "transformed" + File.separator + "expected" + File.separator + typename
+ + "." + methodname + ".txt");
+ if (regenerate) {
+ saveMethod(expectedF, m);
+ } else {
+ compareMethod(expectedF, m);
+ }
+ }
+
+ private LazyMethodGen getMethod(String typename, String methodname) {
+ BcelObjectType type = getBcelObjectFor(typename);
+ LazyClassGen lcg = type.getLazyClassGen();
+ List /* LazyMethodGen */methods = lcg.getMethodGens();
+ for (Iterator iter = methods.iterator(); iter.hasNext();) {
LazyMethodGen element = (LazyMethodGen) iter.next();
if (element.getName().equals(methodname)) {
return element;
}
- }
- return null;
- }
-
- private BcelObjectType getBcelObjectFor(String clazzname) {
+ }
+ return null;
+ }
+
+ private BcelObjectType getBcelObjectFor(String clazzname) {
ensureWorldSetup();
- ResolvedType rt = world.resolve(clazzname);
- if (rt==null) fail("Couldn't find class "+clazzname);
- ReferenceType rtt = (ReferenceType)rt;
- BcelObjectType bot = (BcelObjectType)rtt.getDelegate();
- return bot;
- }
-
- private void ensureWorldSetup() {
- if (world == null) {
- world = new BcelWorld(
- getSandboxDirectory()+File.pathSeparator+
- System.getProperty("java.class.path"));
- }
- }
-
- protected Method getMethod(JavaClass cl,String methodname) {
+ ResolvedType rt = world.resolve(clazzname);
+ if (rt == null)
+ fail("Couldn't find class " + clazzname);
+ ReferenceType rtt = (ReferenceType) rt;
+ BcelObjectType bot = (BcelObjectType) rtt.getDelegate();
+ return bot;
+ }
+
+ private void ensureWorldSetup() {
+ if (world == null) {
+ world = new BcelWorld(getSandboxDirectory() + File.pathSeparator + System.getProperty("java.class.path"));
+ }
+ }
+
+ protected Method getMethod(JavaClass cl, String methodname) {
Method[] methods = cl.getMethods();
for (int i = 0; i < methods.length; i++) {
Method m = methods[i];
}
return null;
}
-
- public void dump(String title,String[] strs) {
+
+ public void dump(String title, String[] strs) {
System.err.println(title);
for (int i = 0; i < strs.length; i++) {
- System.err.println(i+") "+strs[i]);
+ System.err.println(i + ") " + strs[i]);
}
}
-
- private void compareMethod(File f,LazyMethodGen m) {
+
+ private void compareMethod(File f, LazyMethodGen m) {
BufferedReader fr;
if (!f.exists()) {
- fail("Can't find expected output file "+f);
+ fail("Can't find expected output file " + f);
}
try {
// Load the file in
fr = new BufferedReader(new FileReader(f));
String line = null;
List originalFileContents = new ArrayList();
- while ((line=fr.readLine())!=null) originalFileContents.add(line);
- String[] fileContents = (String[])originalFileContents.toArray(new String[]{});
-
+ while ((line = fr.readLine()) != null)
+ originalFileContents.add(line);
+ String[] fileContents = (String[]) originalFileContents.toArray(new String[] {});
+
LineStream ls = new TestUtil.LineStream();
- m.print(ls,null);
+ m.print(ls, null);
String[] lines = ls.getLines();
for (int i = 0; i < lines.length; i++) {
String existingLine = lines[i];
- if (fileContents[i].indexOf("MethodDeclarationLineNumber")==-1 &&
- !fileContents[i].equals(existingLine)) {
- dump("File contents:",fileContents);
- dump("Actual:",lines);
- fail("\nDifference in method "+m.getName()+" on line "+i+" between the expected:\n"+fileContents[i]+
- "\nand the found:\n"+existingLine);
+ if (fileContents[i].indexOf("MethodDeclarationLineNumber") == -1 && !fileContents[i].equals(existingLine)) {
+ dump("File contents:", fileContents);
+ dump("Actual:", lines);
+ fail("\nDifference in method " + m.getName() + " on line " + i + " between the expected:\n" + fileContents[i]
+ + "\nand the found:\n" + existingLine);
}
}
} catch (Exception e) {
- fail("Unexpected exception saving weaving messages:"+e);
+ fail("Unexpected exception saving weaving messages:" + e);
}
}
-
+
private String stringify(List l) {
StringBuffer result = new StringBuffer();
for (Iterator iter = l.iterator(); iter.hasNext();) {
String str = (String) iter.next();
- result.append(str);result.append("\n");
+ result.append(str);
+ result.append("\n");
}
return result.toString();
}
-
-
- private void saveMethod(File f,LazyMethodGen m) {
- System.out.println("Saving method into "+f.getName());
+
+ private void saveMethod(File f, LazyMethodGen m) {
+ System.out.println("Saving method into " + f.getName());
try {
- m.print(new PrintStream(new FileOutputStream(f)),null);
+ m.print(new PrintStream(new FileOutputStream(f)), null);
} catch (FileNotFoundException e) {
e.printStackTrace();
- fail("Couldn't store the method in file "+f);
+ fail("Couldn't store the method in file " + f);
}
}
-
-
-
-
-
-
-
- // --- helpers
-
- // Half finished - could check there is only one relationship for unlock() rather than two - but
- // that seems to be the case anyway (peculiar...)
- private void checkModel1() {
- // Verifies only one unlock relationship, not two
- IProgramElement unlockNode = AsmManager.getDefault().getHierarchy().findElementForLabel(AsmManager.getDefault().getHierarchy().getRoot(),
- IProgramElement.Kind.CODE,"unlock(void java.lang.Object.<unlock>(java.lang.Object))");
- assertTrue("Couldn't find the unlock node",unlockNode!=null);
- List l = AsmManager.getDefault().getRelationshipMap().get(unlockNode);
- assertTrue("should be one entry :"+l,l!=null && l.size()==1);
- IRelationship ir = (IRelationship)l.get(0);
- System.err.println(ir);
- List targs = ir.getTargets();
- System.err.println(targs.size());
- System.err.println(targs.get(0));
- }
-
- // ---
- public static Test suite() {
- return XMLBasedAjcTestCase.loadSuite(SynchronizationTransformTests.class);
- }
-
- protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc152/synchronization.xml");
- }
-
- public void tearDown() { world = null; }
-
+
+ // --- helpers
+
+ // Half finished - could check there is only one relationship for unlock() rather than two - but
+ // that seems to be the case anyway (peculiar...)
+ // private void checkModel1() {
+ // // Verifies only one unlock relationship, not two
+ // IProgramElement unlockNode =
+ // AsmManager.getDefault().getHierarchy().findElementForLabel(AsmManager.getDefault().getHierarchy().getRoot(),
+ // IProgramElement.Kind.CODE,"unlock(void java.lang.Object.<unlock>(java.lang.Object))");
+ // assertTrue("Couldn't find the unlock node",unlockNode!=null);
+ // List l = AsmManager.getDefault().getRelationshipMap().get(unlockNode);
+ // assertTrue("should be one entry :"+l,l!=null && l.size()==1);
+ // IRelationship ir = (IRelationship)l.get(0);
+ // System.err.println(ir);
+ // List targs = ir.getTargets();
+ // System.err.println(targs.size());
+ // System.err.println(targs.get(0));
+ // }
+
+ // ---
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(SynchronizationTransformTests.class);
+ }
+
+ protected File getSpecFile() {
+ return new File("../tests/src/org/aspectj/systemtest/ajc152/synchronization.xml");
+ }
+
+ public void tearDown() {
+ world = null;
+ }
+
}
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IHierarchy;
import org.aspectj.asm.IProgramElement;
-import org.aspectj.testing.Utils;
import org.aspectj.testing.XMLBasedAjcTestCase;
import org.aspectj.weaver.bcel.Utility;
public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+ public void testFormalCommentsAreSetForConstructorIPEs_pr164340() {
+ runTest("formal comments are set for constructor ipes");
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
+ IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.CONSTRUCTOR, "C()");
+ assertNotNull("expected formal comment to be non null but" + " found that it was null", ipe.getFormalComment());
+ }
- public void testFormalCommentsAreSetForConstructorIPEs_pr164340() {
- runTest("formal comments are set for constructor ipes");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
- IProgramElement ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.CONSTRUCTOR,"C()");
- assertNotNull("expected formal comment to be non null but" +
- " found that it was null",ipe.getFormalComment());
- }
- //public void testGenericsProblem_pr151978() { runTest("generics problem");}
- // public void testArgnamesAndJavac_pr148381() { runTest("argNames and javac");}
- // public void testCFlowXMLAspectLTW_pr149096() { runTest("cflow xml concrete aspect"); }
- // public void testAmbiguousBinding_pr121805() { runTest("ambiguous binding");}
-// public void testNegatedAnnotationMatchingProblem_pr153464() { runTest("negated annotation matching problem");}
-// public void testAnnotationStyleBcException_pr162135() { runTest("bcexception in annotation style around advice");}
-// public void testAnnotationStyleBcException_pr162135_2() { runTest("bcexception in annotation style around advice - 2");}
-// public void testAnnotationStyleBcException_pr162135_3() { runTest("bcexception in annotation style around advice - 3");}
-// public void testAnnotationStyleBcException_pr162135_4() { runTest("bcexception in annotation style around advice - 4");}
-// public void testAnnotationStyleBcException_pr162135_5() { runTest("bcexception in annotation style around advice - 5");}
- public void testIncompatibleClassChangeWithITD_pr164633() { runTest("incompatibleclasschange");}
- public void testComplexPointcut_pr162657() { runTest("complex pointcut");}
- public void testGenericsInPointcuts_pr161502() { runTest("generics in pointcuts");}
- public void testGenericsInPointcuts_pr161502_2() { runTest("generics in pointcuts - 2");}
- public void testNoNPEDueToMissingType_pr149908() { runTest("ensure no npe due to missing type");}
- public void testNoNPEDueToMember_pr149908() { runTest("ensure no npe due to missing member");}
- public void testPTWgetWithinTypeName_pr123423_1() { runTest("basic usage of getWithinTypeName");}
- public void testPTWgetWithinTypeName_pr123423_2() { runTest("basic usage of getWithinTypeName - multiple types");}
- public void testPTWgetWithinTypeName_pr123423_3() { runTest("basic usage of getWithinTypeName - non matching types");}
- public void testPTWgetWithinTypeName_pr123423_4() { runTest("basic usage of getWithinTypeName - types in packages");}
- public void testPTWgetWithinTypeName_pr123423_5() { runTest("basic usage of getWithinTypeName - annotation style");}
- public void testTurningOffBcelCaching_pr160674() { runTest("turning off bcel caching");}
- public void testNoIllegalStateExceptionWithGenericInnerAspect_pr156058() { runTest("no IllegalStateException with generic inner aspect"); }
- public void testNoIllegalStateExceptionWithGenericInnerAspect_pr156058_2() { runTest("no IllegalStateException with generic inner aspect - 2"); }
- public void testDeclareMethodAnnotations_pr159143() { runTest("declare method annotations");}
- public void testVisibilityProblem_pr149071() { runTest("visibility problem");}
- public void testMissingLineNumbersInStacktraceAfter_pr145442() { runTest("missing line numbers in stacktrace after");}
- public void testMissingLineNumbersInStacktraceAround_pr145442() { runTest("missing line numbers in stacktrace around");}
- public void testGenericArrays_pr158624() { runTest("generics and arrays"); }
- public void testMissingLineNumbersInStacktraceBefore_pr145442() { runTest("missing line numbers in stacktrace before");}
- public void testMissingLineNumbersInStacktraceBefore_pr145442_Binary() { runTest("missing line numbers in stacktrace before - binary");}
- public void testAnnotationStylePointcutNPE_pr158412() { runTest("annotation style pointcut npe"); }
- public void testAnnotationStylePointcutNPE_pr158412_2() { runTest("annotation style pointcut npe - 2"); }
- public void testAnnotationsCallConstructors_pr158126() { runTest("annotations, call and constructors problem");}
- public void testIllegalStateExceptionGenerics_pr153845() { runTest("IllegalStateException at GenericSignatureParser.java"); }
- public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_1() { runTest("no illegal state exception from AsmDelegate - 1");}
- public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_2() { runTest("no illegal state exception from AsmDelegate - 2");}
- public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_3() { runTest("no illegal state exception from AsmDelegate - 3");}
- public void testAnnotMethod_pr156962() { runTest("Test Annot Method");}
- public void testAnnotMethodHasMember_pr156962() { runTest("Test Annot Method Has Member"); }
- public void testMixingGenerics_pr152848() { runTest("mixing generics"); }
- public void testIncorrectStaticinitializationWeaving_pr149560_1() { runTest("incorrect staticinitialization weaving - codestyle");}
- public void testIncorrectStaticinitializationWeaving_pr149560_2() { runTest("incorrect staticinitialization weaving - annstyle");}
- public void testIncorrectDeprecatedAnnotationProcessing_pr154332() { runTest("incorrect deprecated annotation processing");}
- public void testPipeliningProblemWithAnnotationsDecp_pr153380_1() { runTest("pipelining decps");}
- public void testUnwantedPointcutWarning_pr148219() { runTest("unwanted warning for pointcut");}
- public void testDecpAndCflowadderMungerClash_pr152631() { runTest("decp and cflowadder munger clash");}
- public void testGenericInheritanceDecp_pr150095() { runTest("generics, inheritance and decp");}
- public void testIllegalStateException_pr148737() { runTest("illegalstateexception for non generic type");}
- public void testAtajInheritance_pr149305_1() { runTest("ataj inheritance - 1");}
- public void testAtajInheritance_pr149305_2() { runTest("ataj inheritance - 2");}
- public void testAtajInheritance_pr149305_3() { runTest("ataj inheritance - 3");}
-// public void testVerificationFailureForAspectOf_pr148693() {
-// runTest("verification problem"); // build the code
-// Utils.verifyClass(ajc,"mypackage.MyAspect"); // verify it <<< BRAND NEW VERIFY UTILITY FOR EVERYONE TO TRY ;)
-// }
- public void testIncorrectAnnotationValue_pr148537() { runTest("incorrect annotation value");}
- public void testVerifyErrNoTypeCflowField_pr145693_1() { runTest("verifyErrNoTypeCflowField"); }
- public void testVerifyErrInpathNoTypeCflowField_pr145693_2() { runTest("verifyErrInpathNoTypeCflowField"); }
- public void testCpathNoTypeCflowField_pr145693_3() { runTest("cpathNoTypeCflowField"); }
- // public void testAdviceNotWovenAspectPath_pr147841() { runTest("advice not woven on aspectpath");}
- public void testGenericSignatures_pr148409() { runTest("generic signature problem"); }
- public void testCantFindType_pr149322_01() {runTest("can't find type on interface call 1");}
- public void testCantFindType_pr149322_02() {runTest("can't find type on interface call 2");}
- public void testCantFindType_pr149322_03() {runTest("can't find type on interface call 3");}
- public void testParsingBytecodeLess_pr152871() {
- Utility.testingParseCounter=0;
- runTest("parsing bytecode less");
- assertTrue("Should have called parse 2 times, not " + Utility.testingParseCounter + " times", Utility.testingParseCounter == 2);
- // 5 means: // 3 of these are gone with change to UnwovenClassFileWTPMB to take a classname in ctor
- // (1)=registerAspect
- // (2,3)=checkingIfShouldWeave,AcceptingResult for class
- // (4,5)=checkingIfShouldWeave,AcceptingResult for aspect
- }
- public void testMatchVolatileField_pr150671() {runTest("match volatile field");}
- public void testDuplicateJVMTIAgents_pr151938() {runTest("Duplicate JVMTI agents");}
- public void testLTWWorldWithAnnotationMatching_pr153572() { runTest("LTWWorld with annotation matching");}
-
- public void testReweavableAspectNotRegistered_pr129525 () {
- runTest("reweavableAspectNotRegistered error");
- }
-
- public void testNPEinConstructorSignatureImpl_pr155972 () {
- runTest("NPE in ConstructorSignatureImpl");
- }
-
- public void testNPEinFieldSignatureImpl_pr155972 () {
- runTest("NPE in FieldSignatureImpl");
- }
-
- public void testNPEinInitializerSignatureImpl_pr155972 () {
- runTest("NPE in InitializerSignatureImpl");
- }
-
- public void testLineNumberTableCorrectWithGenericsForEachAndContinue_pr155763() {
- runTest("ensure LineNumberTable correct with generics, for each and continue");
- }
-
- public void testDeclareSoftDoesntAllowUndeclaredExInAnonInnerClass_pr151772() {
- runTest("ensure declare soft doesn't allow undeclared exception in anonymous inner class");
- }
-
- public void testDeclareSoftDoesntAllowUndeclaredExInAnonInnerClass_pr151772_2() {
- runTest("ensure declare soft doesn't allow undeclared exception in anonymous inner class - 2");
- }
-
- public void testDeclareSoftAndInnerClasses_pr125981() {
- runTest("declare soft and inner classes");
- }
-
- public void testGetSourceSignature_pr148908() {
- runTest("ensure getSourceSignature correct with static field");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
- IProgramElement ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.FIELD,"MY_COMPARATOR");
- String expected = "static final Comparator MY_COMPARATOR;\n";
- assertEquals("expected source signature to be " + expected +
- " but found " + ipe.getSourceSignature(),
- expected, ipe.getSourceSignature());
-
- ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.FIELD,"aList");
- expected = "public List<String> aList;\n";
- assertEquals("expected source signature to be " + expected +
- " but found " + ipe.getSourceSignature(),
- expected, ipe.getSourceSignature());
-
- ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.FIELD,"bList");
- expected = "public List<String> bList;\n";
- assertEquals("expected source signature to be " + expected +
- " but found " + ipe.getSourceSignature(),
- expected, ipe.getSourceSignature());
- }
-
-// public void testNPEWithCustomAgent_pr158205() {
-// runTest("NPE with custom agent");
-// }
-
- public void testWeaveConcreteSubaspectWithAdvice_pr132080() {
- runTest("Weave concrete sub-aspect with advice");
- }
-
- public void testWeaveConcreteSubaspectWithITD_pr132080() {
- runTest("Weave concrete sub-aspect with ITD");
- }
-
- public void testWeaveConcreteSubaspectWithAroundClosure_pr132080() {
- runTest("Weave concrete sub-aspect with around closure");
- }
-
- public void testWeaveConcreteSubaspectWithCflow_pr132080() {
- runTest("Weave concrete sub-aspect with cflow");
- }
-
- public void testNPEWithLTWPointcutLibraryAndMissingAspectDependency_pr158957 () {
- runTest("NPE with LTW, pointcut library and missing aspect dependency");
- }
-
- public void testNoInvalidAbsoluteTypeNameWarning_pr156904_1() {runTest("ensure no invalidAbsoluteTypeName when do match - 1");}
- public void testNoInvalidAbsoluteTypeNameWarning_pr156904_2() {runTest("ensure no invalidAbsoluteTypeName when do match - 2");}
- public void testNoInvalidAbsoluteTypeNameWarning_pr156904_3() {runTest("ensure no invalidAbsoluteTypeName when do match - 3");}
- public void testNoInvalidAbsoluteTypeNameWarning_pr156904_4() {runTest("ensure no invalidAbsoluteTypeName when do match - 4");}
-
- public void testNoNPEWithThrownExceptionWarningAndAtAspectj_pr161217() {runTest("NPE with thrown exception warning and at aspectj");}
-
- public void testJavadocCommentsAreSetIfHaveNormalComments_pr164340() {
- runTest("javadoc comments are set if have normal comments");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
-
- IProgramElement ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.METHOD,"foo()");
- assertNotNull("expected formal comment to be non null but" +
- " found that it was null",ipe.getFormalComment());
-
- ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.METHOD,"bar()");
- assertNotNull("expected formal comment to be non null but" +
- " found that it was null",ipe.getFormalComment());
-
- ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.METHOD,"goo()");
- assertNull("expected formal comment to be null but" +
- " found that it was " + ipe.getFormalComment(),ipe.getFormalComment());
-
- }
-
- public void testBinaryWeavingIntoJava6Library_pr164384() {runTest("binary weaving into java 6 library");}
- public void testCompilanceJava6ThrowsUsageError_pr164384() {runTest("compliance java 6 throws usage error");}
- public void testSourceLevelJava6ThrowsUsageError_pr164384() {runTest("source level java 6 throws usage error");}
- public void testTargetLevelJava6ThrowsUsageError_pr164384() {runTest("target level java 6 throws usage error");}
-
- public void testStaticImport() {
+ // public void testGenericsProblem_pr151978() { runTest("generics problem");}
+ // public void testArgnamesAndJavac_pr148381() { runTest("argNames and javac");}
+ // public void testCFlowXMLAspectLTW_pr149096() { runTest("cflow xml concrete aspect"); }
+ // public void testAmbiguousBinding_pr121805() { runTest("ambiguous binding");}
+ // public void testNegatedAnnotationMatchingProblem_pr153464() { runTest("negated annotation matching problem");}
+ // public void testAnnotationStyleBcException_pr162135() { runTest("bcexception in annotation style around advice");}
+ // public void testAnnotationStyleBcException_pr162135_2() { runTest("bcexception in annotation style around advice - 2");}
+ // public void testAnnotationStyleBcException_pr162135_3() { runTest("bcexception in annotation style around advice - 3");}
+ // public void testAnnotationStyleBcException_pr162135_4() { runTest("bcexception in annotation style around advice - 4");}
+ // public void testAnnotationStyleBcException_pr162135_5() { runTest("bcexception in annotation style around advice - 5");}
+ public void testIncompatibleClassChangeWithITD_pr164633() {
+ runTest("incompatibleclasschange");
+ }
+
+ public void testComplexPointcut_pr162657() {
+ runTest("complex pointcut");
+ }
+
+ public void testGenericsInPointcuts_pr161502() {
+ runTest("generics in pointcuts");
+ }
+
+ public void testGenericsInPointcuts_pr161502_2() {
+ runTest("generics in pointcuts - 2");
+ }
+
+ public void testNoNPEDueToMissingType_pr149908() {
+ runTest("ensure no npe due to missing type");
+ }
+
+ public void testNoNPEDueToMember_pr149908() {
+ runTest("ensure no npe due to missing member");
+ }
+
+ public void testPTWgetWithinTypeName_pr123423_1() {
+ runTest("basic usage of getWithinTypeName");
+ }
+
+ public void testPTWgetWithinTypeName_pr123423_2() {
+ runTest("basic usage of getWithinTypeName - multiple types");
+ }
+
+ public void testPTWgetWithinTypeName_pr123423_3() {
+ runTest("basic usage of getWithinTypeName - non matching types");
+ }
+
+ public void testPTWgetWithinTypeName_pr123423_4() {
+ runTest("basic usage of getWithinTypeName - types in packages");
+ }
+
+ public void testPTWgetWithinTypeName_pr123423_5() {
+ runTest("basic usage of getWithinTypeName - annotation style");
+ }
+
+ public void testTurningOffBcelCaching_pr160674() {
+ runTest("turning off bcel caching");
+ }
+
+ public void testNoIllegalStateExceptionWithGenericInnerAspect_pr156058() {
+ runTest("no IllegalStateException with generic inner aspect");
+ }
+
+ public void testNoIllegalStateExceptionWithGenericInnerAspect_pr156058_2() {
+ runTest("no IllegalStateException with generic inner aspect - 2");
+ }
+
+ public void testDeclareMethodAnnotations_pr159143() {
+ runTest("declare method annotations");
+ }
+
+ public void testVisibilityProblem_pr149071() {
+ runTest("visibility problem");
+ }
+
+ public void testMissingLineNumbersInStacktraceAfter_pr145442() {
+ runTest("missing line numbers in stacktrace after");
+ }
+
+ public void testMissingLineNumbersInStacktraceAround_pr145442() {
+ runTest("missing line numbers in stacktrace around");
+ }
+
+ public void testGenericArrays_pr158624() {
+ runTest("generics and arrays");
+ }
+
+ public void testMissingLineNumbersInStacktraceBefore_pr145442() {
+ runTest("missing line numbers in stacktrace before");
+ }
+
+ public void testMissingLineNumbersInStacktraceBefore_pr145442_Binary() {
+ runTest("missing line numbers in stacktrace before - binary");
+ }
+
+ public void testAnnotationStylePointcutNPE_pr158412() {
+ runTest("annotation style pointcut npe");
+ }
+
+ public void testAnnotationStylePointcutNPE_pr158412_2() {
+ runTest("annotation style pointcut npe - 2");
+ }
+
+ public void testAnnotationsCallConstructors_pr158126() {
+ runTest("annotations, call and constructors problem");
+ }
+
+ public void testIllegalStateExceptionGenerics_pr153845() {
+ runTest("IllegalStateException at GenericSignatureParser.java");
+ }
+
+ public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_1() {
+ runTest("no illegal state exception from AsmDelegate - 1");
+ }
+
+ public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_2() {
+ runTest("no illegal state exception from AsmDelegate - 2");
+ }
+
+ public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_3() {
+ runTest("no illegal state exception from AsmDelegate - 3");
+ }
+
+ public void testAnnotMethod_pr156962() {
+ runTest("Test Annot Method");
+ }
+
+ public void testAnnotMethodHasMember_pr156962() {
+ runTest("Test Annot Method Has Member");
+ }
+
+ public void testMixingGenerics_pr152848() {
+ runTest("mixing generics");
+ }
+
+ public void testIncorrectStaticinitializationWeaving_pr149560_1() {
+ runTest("incorrect staticinitialization weaving - codestyle");
+ }
+
+ public void testIncorrectStaticinitializationWeaving_pr149560_2() {
+ runTest("incorrect staticinitialization weaving - annstyle");
+ }
+
+ public void testIncorrectDeprecatedAnnotationProcessing_pr154332() {
+ runTest("incorrect deprecated annotation processing");
+ }
+
+ public void testPipeliningProblemWithAnnotationsDecp_pr153380_1() {
+ runTest("pipelining decps");
+ }
+
+ public void testUnwantedPointcutWarning_pr148219() {
+ runTest("unwanted warning for pointcut");
+ }
+
+ public void testDecpAndCflowadderMungerClash_pr152631() {
+ runTest("decp and cflowadder munger clash");
+ }
+
+ public void testGenericInheritanceDecp_pr150095() {
+ runTest("generics, inheritance and decp");
+ }
+
+ public void testIllegalStateException_pr148737() {
+ runTest("illegalstateexception for non generic type");
+ }
+
+ public void testAtajInheritance_pr149305_1() {
+ runTest("ataj inheritance - 1");
+ }
+
+ public void testAtajInheritance_pr149305_2() {
+ runTest("ataj inheritance - 2");
+ }
+
+ public void testAtajInheritance_pr149305_3() {
+ runTest("ataj inheritance - 3");
+ }
+
+ // public void testVerificationFailureForAspectOf_pr148693() {
+ // runTest("verification problem"); // build the code
+ // Utils.verifyClass(ajc,"mypackage.MyAspect"); // verify it <<< BRAND NEW VERIFY UTILITY FOR EVERYONE TO TRY ;)
+ // }
+ public void testIncorrectAnnotationValue_pr148537() {
+ runTest("incorrect annotation value");
+ }
+
+ public void testVerifyErrNoTypeCflowField_pr145693_1() {
+ runTest("verifyErrNoTypeCflowField");
+ }
+
+ public void testVerifyErrInpathNoTypeCflowField_pr145693_2() {
+ runTest("verifyErrInpathNoTypeCflowField");
+ }
+
+ public void testCpathNoTypeCflowField_pr145693_3() {
+ runTest("cpathNoTypeCflowField");
+ }
+
+ // public void testAdviceNotWovenAspectPath_pr147841() { runTest("advice not woven on aspectpath");}
+ public void testGenericSignatures_pr148409() {
+ runTest("generic signature problem");
+ }
+
+ public void testCantFindType_pr149322_01() {
+ runTest("can't find type on interface call 1");
+ }
+
+ public void testCantFindType_pr149322_02() {
+ runTest("can't find type on interface call 2");
+ }
+
+ public void testCantFindType_pr149322_03() {
+ runTest("can't find type on interface call 3");
+ }
+
+ public void testParsingBytecodeLess_pr152871() {
+ Utility.testingParseCounter = 0;
+ runTest("parsing bytecode less");
+ assertTrue("Should have called parse 2 times, not " + Utility.testingParseCounter + " times",
+ Utility.testingParseCounter == 2);
+ // 5 means: // 3 of these are gone with change to UnwovenClassFileWTPMB to take a classname in ctor
+ // (1)=registerAspect
+ // (2,3)=checkingIfShouldWeave,AcceptingResult for class
+ // (4,5)=checkingIfShouldWeave,AcceptingResult for aspect
+ }
+
+ public void testMatchVolatileField_pr150671() {
+ runTest("match volatile field");
+ }
+
+ public void testDuplicateJVMTIAgents_pr151938() {
+ runTest("Duplicate JVMTI agents");
+ }
+
+ public void testLTWWorldWithAnnotationMatching_pr153572() {
+ runTest("LTWWorld with annotation matching");
+ }
+
+ public void testReweavableAspectNotRegistered_pr129525() {
+ runTest("reweavableAspectNotRegistered error");
+ }
+
+ public void testNPEinConstructorSignatureImpl_pr155972() {
+ runTest("NPE in ConstructorSignatureImpl");
+ }
+
+ public void testNPEinFieldSignatureImpl_pr155972() {
+ runTest("NPE in FieldSignatureImpl");
+ }
+
+ public void testNPEinInitializerSignatureImpl_pr155972() {
+ runTest("NPE in InitializerSignatureImpl");
+ }
+
+ public void testLineNumberTableCorrectWithGenericsForEachAndContinue_pr155763() {
+ runTest("ensure LineNumberTable correct with generics, for each and continue");
+ }
+
+ public void testDeclareSoftDoesntAllowUndeclaredExInAnonInnerClass_pr151772() {
+ runTest("ensure declare soft doesn't allow undeclared exception in anonymous inner class");
+ }
+
+ public void testDeclareSoftDoesntAllowUndeclaredExInAnonInnerClass_pr151772_2() {
+ runTest("ensure declare soft doesn't allow undeclared exception in anonymous inner class - 2");
+ }
+
+ public void testDeclareSoftAndInnerClasses_pr125981() {
+ runTest("declare soft and inner classes");
+ }
+
+ public void testGetSourceSignature_pr148908() {
+ runTest("ensure getSourceSignature correct with static field");
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
+ IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "MY_COMPARATOR");
+ String expected = "static final Comparator MY_COMPARATOR;\n";
+ assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe
+ .getSourceSignature());
+
+ ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "aList");
+ expected = "public List<String> aList;\n";
+ assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe
+ .getSourceSignature());
+
+ ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "bList");
+ expected = "public List<String> bList;\n";
+ assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe
+ .getSourceSignature());
+ }
+
+ // public void testNPEWithCustomAgent_pr158205() {
+ // runTest("NPE with custom agent");
+ // }
+
+ public void testWeaveConcreteSubaspectWithAdvice_pr132080() {
+ runTest("Weave concrete sub-aspect with advice");
+ }
+
+ public void testWeaveConcreteSubaspectWithITD_pr132080() {
+ runTest("Weave concrete sub-aspect with ITD");
+ }
+
+ public void testWeaveConcreteSubaspectWithAroundClosure_pr132080() {
+ runTest("Weave concrete sub-aspect with around closure");
+ }
+
+ public void testWeaveConcreteSubaspectWithCflow_pr132080() {
+ runTest("Weave concrete sub-aspect with cflow");
+ }
+
+ public void testNPEWithLTWPointcutLibraryAndMissingAspectDependency_pr158957() {
+ runTest("NPE with LTW, pointcut library and missing aspect dependency");
+ }
+
+ public void testNoInvalidAbsoluteTypeNameWarning_pr156904_1() {
+ runTest("ensure no invalidAbsoluteTypeName when do match - 1");
+ }
+
+ public void testNoInvalidAbsoluteTypeNameWarning_pr156904_2() {
+ runTest("ensure no invalidAbsoluteTypeName when do match - 2");
+ }
+
+ public void testNoInvalidAbsoluteTypeNameWarning_pr156904_3() {
+ runTest("ensure no invalidAbsoluteTypeName when do match - 3");
+ }
+
+ public void testNoInvalidAbsoluteTypeNameWarning_pr156904_4() {
+ runTest("ensure no invalidAbsoluteTypeName when do match - 4");
+ }
+
+ public void testNoNPEWithThrownExceptionWarningAndAtAspectj_pr161217() {
+ runTest("NPE with thrown exception warning and at aspectj");
+ }
+
+ public void testJavadocCommentsAreSetIfHaveNormalComments_pr164340() {
+ runTest("javadoc comments are set if have normal comments");
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
+
+ IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, "foo()");
+ assertNotNull("expected formal comment to be non null but" + " found that it was null", ipe.getFormalComment());
+
+ ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, "bar()");
+ assertNotNull("expected formal comment to be non null but" + " found that it was null", ipe.getFormalComment());
+
+ ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, "goo()");
+ assertNull("expected formal comment to be null but" + " found that it was " + ipe.getFormalComment(), ipe
+ .getFormalComment());
+
+ }
+
+ public void testBinaryWeavingIntoJava6Library_pr164384() {
+ runTest("binary weaving into java 6 library");
+ }
+
+ public void testCompilanceJava6ThrowsUsageError_pr164384() {
+ runTest("compliance java 6 throws usage error");
+ }
+
+ public void testSourceLevelJava6ThrowsUsageError_pr164384() {
+ runTest("source level java 6 throws usage error");
+ }
+
+ public void testTargetLevelJava6ThrowsUsageError_pr164384() {
+ runTest("target level java 6 throws usage error");
+ }
+
+ public void testStaticImport() {
runTest("ensure static import reference have static modifier set");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
-
- IProgramElement ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.IMPORT_REFERENCE,"ABC.StaticImport.Alphabet.A");
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
+
+ IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.IMPORT_REFERENCE,
+ "ABC.StaticImport.Alphabet.A");
String expected = "import static ABC.StaticImport.Alphabet.A;";
- assertEquals("expected source signature to be " + expected +
- " but found " + ipe.getSourceSignature(),
- expected, ipe.getSourceSignature());
- }
- public void testAspected_Annotation(){
- runTest("ensure Annotations are added to import list");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
-
- IProgramElement ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.IMPORT_REFERENCE,"annotation.A");
- String expected = "import annotation.A;";
- assertEquals("expected source signature to be " + expected +
- " but found " + ipe.getSourceSignature(),
- expected, ipe.getSourceSignature());
-
- }
-
- public void testGetSourceSignature_GenericMethods(){
- runTest("ensure getSourceSignature correct with generic method");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
-
- IProgramElement ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.METHOD,"returnT(T)");
- String expected = "public <T> T returnT(T a)";
- assertEquals("expected source signature to be " + expected +
- " but found " + ipe.getSourceSignature(),
- expected, ipe.getSourceSignature());
-
- ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.METHOD,"returnQ(Q)");
- expected = "public <Q extends List> Q returnQ(Q a)";
- assertEquals("expected source signature to be " + expected +
- " but found " + ipe.getSourceSignature(),
- expected, ipe.getSourceSignature());
-
- ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.METHOD,"doubleGeneric(Q,T)");
- expected = "public <T, Q> void doubleGeneric(Q a, T b)";
- assertEquals("expected source signature to be " + expected +
- " but found " + ipe.getSourceSignature(),
- expected, ipe.getSourceSignature());
-
+ assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe
+ .getSourceSignature());
+ }
+
+ public void testAspected_Annotation() {
+ runTest("ensure Annotations are added to import list");
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
+
+ IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.IMPORT_REFERENCE, "annotation.A");
+ String expected = "import annotation.A;";
+ assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe
+ .getSourceSignature());
+
+ }
+
+ public void testGetSourceSignature_GenericMethods() {
+ runTest("ensure getSourceSignature correct with generic method");
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
+
+ IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, "returnT(T)");
+ String expected = "public <T> T returnT(T a)";
+ assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe
+ .getSourceSignature());
+
+ ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, "returnQ(Q)");
+ expected = "public <Q extends List> Q returnQ(Q a)";
+ assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe
+ .getSourceSignature());
+
+ ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, "doubleGeneric(Q,T)");
+ expected = "public <T, Q> void doubleGeneric(Q a, T b)";
+ assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe
+ .getSourceSignature());
+
// Generic Method Constructor
- ipe = top.findElementForLabel(top.getRoot(),
- IProgramElement.Kind.CONSTRUCTOR,"C(T)");
- expected = "public <T> C(T b)";
- assertEquals("expected source signature to be " + expected +
- " but found " + ipe.getSourceSignature(),
- expected, ipe.getSourceSignature());
- }
-
-
- /////////////////////////////////////////
- public static Test suite() {
- return XMLBasedAjcTestCase.loadSuite(Ajc153Tests.class);
- }
-
- protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc153/ajc153.xml");
- }
-
-
+ ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.CONSTRUCTOR, "C(T)");
+ expected = "public <T> C(T b)";
+ assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe
+ .getSourceSignature());
+ }
+
+ // ///////////////////////////////////////
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(Ajc153Tests.class);
+ }
+
+ protected File getSpecFile() {
+ return new File("../tests/src/org/aspectj/systemtest/ajc153/ajc153.xml");
+ }
+
}
\ No newline at end of file
import junit.framework.Test;
import org.aspectj.asm.AsmManager;
-import org.aspectj.asm.IElementHandleProvider;
import org.aspectj.asm.IHierarchy;
import org.aspectj.asm.IProgramElement;
-import org.aspectj.asm.internal.JDTLikeHandleProvider;
import org.aspectj.testing.XMLBasedAjcTestCase;
public class JDTLikeHandleProviderTests extends XMLBasedAjcTestCase {
- IElementHandleProvider handleProvider;
+ // IElementHandleProvider handleProvider;
protected void setUp() throws Exception {
super.setUp();
- handleProvider = AsmManager.getDefault().getHandleProvider();
- AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider());
+ // handleProvider = AsmManager.getDefault().getHandleProvider();
+ // AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider());
}
protected void tearDown() throws Exception {
super.tearDown();
- AsmManager.getDefault().setHandleProvider(handleProvider);
+ // AsmManager.getDefault().setHandleProvider(handleProvider);
}
public void testMoreThanOneNamedPointcut() {
public void testAspectHandle() {
runTest("aspect handle");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
IProgramElement pe = top.findElementForType("pkg", "A1");
String expected = "<pkg*A1.aj}A1";
String found = pe.getHandleIdentifier();
public void testGetIPEWithAspectHandle() {
runTest("get IProgramElement with aspect handle");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
String handle = "<pkg*A1.aj}A1";
IProgramElement ipe = top.getElement(handle);
assertNotNull("should have found ipe with handle " + handle, ipe);
// signature and the same pointcut
public void testTwoPiecesOfAdviceWithSameSignatureAndPointcut() {
runTest("two pieces of advice with the same signature and pointcut");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
IProgramElement parent = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ASPECT, "A5");
List children = parent.getChildren();
String handle1 = null;
// on the end
public void testIPEsWithSameNameHaveUniqueHandles_methodCall() {
runTest("ipes with same name have unique handles - method-call");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
String handle1 = "<*TwoMethodCalls.aj[Main~main~\\[QString;?method-call("
+ "void java.io.PrintStream.println(java.lang.String))";
assertNotNull("expected to find node with handle " + handle1 + ", but did not", top.getElement(handle1));
// shouldn't have the "2"
public void testIPEsWithDiffNamesDontHaveCounter_methodCall() {
runTest("ipes with different names do not have counter - method-call");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
String handle1 = "<*TwoDiffMethodCalls.aj[Main~main~\\[QString;?method-call("
+ "void java.io.PrintStream.println(java.lang.String))";
assertNotNull("expected to find node with handle " + handle1 + ", but did not", top.getElement(handle1));
public void testIPEsWithSameNameHaveUniqueHandles_handler() {
runTest("ipes with same name have unique handles - handler");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
String handle1 = "<*Handler.aj[C~method?exception-handler(void C." + "<catch>(java.io.FileNotFoundException))";
assertNotNull("expected to find node with handle " + handle1 + ", but did not", top.getElement(handle1));
public void testIPEsWithSameNameHaveUniqueHandles_get() {
runTest("ipes with same name have unique handles - get");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
String handle1 = "<*Get.aj[C1~method1?field-get(int C1.x)";
assertNotNull("expected to find node with handle " + handle1 + ", but did not", top.getElement(handle1));
public void testIPEsWithSameNameHaveUniqueHandles_set() {
runTest("ipes with same name have unique handles - set");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
String handle1 = "<*Set.aj[C1~method?field-set(int C1.x)";
assertNotNull("expected to find node with handle " + handle1 + ", but did not", top.getElement(handle1));
public void testTwoPiecesOfBeforeAdviceInInjarAspectHaveUniqueHandles_pr159896() {
runTest("advice with same name in injar aspect should have unique handles");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
String handle1 = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE, "before(): p..").getHandleIdentifier();
String handle2 = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE, "before(): exec..")
.getHandleIdentifier();
assertFalse("expected the two advice nodes to have unique handles but" + " did not", handle1.equals(handle2));
try {
- AsmManager.getDefault().dumptree(AsmManager.getDefault().getHierarchy().getRoot(), 0);
+ AsmManager.lastActiveStructureModel.dumptree(AsmManager.lastActiveStructureModel.getHierarchy().getRoot(), 0);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
public void testTwoDeclareWarningsInInjarAspectHaveUniqueHandles_pr159896() {
runTest("declare warnings in injar aspect should have unique handles");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
String handle1 = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_WARNING, "declare warning: \"blah\"")
.getHandleIdentifier();
String handle2 = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_WARNING, "declare warning: \"blah2\"")
// their handle
public void testOnlyIncrementSameDeclareTypeFromInjar_pr159896() {
runTest("dont increment counter for different declares");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
String warning = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_WARNING,
"declare warning: \"warning\"").getHandleIdentifier();
assertTrue("shouldn't have incremented counter for declare warning handle " + "because only one declare warning statement",
public void testTypeSameAsJDT() {
// JDT: =TJP Example/src<tjp{Demo.java[Demo
runTest("type same as jdt");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
IProgramElement pe = top.findElementForType("tjp", "Demo");
String expected = "<tjp{Demo.java[Demo";
String found = pe.getHandleIdentifier();
// JDT: =TJP Example/src<tjp{Demo.java[Demo|1
// and =TJP Example/src<tjp{Demo.java[Demo|2
runTest("initialization same as jdt");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
IProgramElement parent = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.CLASS, "Demo");
List children = parent.getChildren();
String handle1 = null;
public void testEnumSameAsJDT() {
// JDT: =Java5 Handles/src<pkg{E.java[E
runTest("enum same as jdt");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
IProgramElement pe = top.findElementForType("pkg", "E");
String expected = "<pkg{E.java[E";
String found = pe.getHandleIdentifier();
public void testAnnotationSameAsJDT() {
// JDT: =Java5 Handles/src<pkg{MyAnnotation.java[MyAnnotation
runTest("annotation same as jdt");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
IProgramElement pe = top.findElementForType("pkg", "MyAnnotation");
String expected = "<pkg{MyAnnotation.java[MyAnnotation";
String found = pe.getHandleIdentifier();
// ----------- helper methods ---------------
private void compareHandles(IProgramElement.Kind kind, String ipeName, String expectedHandle) {
- IHierarchy top = AsmManager.getDefault().getHierarchy();
+ IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
IProgramElement pe = top.findElementForLabel(top.getRoot(), kind, ipeName);
String found = pe.getHandleIdentifier();
System.err.println("expected: " + expectedHandle);
import org.aspectj.testing.XMLBasedAjcTestCase;
public class Ajc161Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
-
- // AspectJ1.6.1
- public void testSignatureProcessing_pr237447() { runTest("signature processing"); }
- public void testGenericAtAround_pr237419() { runTest("generics ataround"); }
- public void testGenericMarkerMatch_pr203367() { runTest("generic marker match"); }
-// public void testSuperItds_pr134425() { runTest("super itds"); }
- public void testSuperItds_pr198196_1() { runTest("super itds - 2"); }
- public void testSuperItds_pr198196_2() { runTest("super itds - 3"); }
- public void testSuperItds_pr198196_3() { runTest("super itds - 4"); }
- public void testDeow_pr237381_1() { runTest("ataspectj deow - 1"); }
- public void testDeow_pr237381_2() { runTest("ataspectj deow - 2"); }
- public void testRunningBrokenCode_pr102733_2() { runTest("running broken code - 2"); }
- public void testRunningBrokenCode_pr102733() { runTest("running broken code"); }
- public void testErrorOnNonabstractGenericAtAspectJAspect_pr168982() { runTest("error on non-abstract generic ataspectj aspect");}
- public void testIgnoringTypeLevelSuppression_pr234933() { runTest("ignoring type level suppress");}
- public void testDuplicateMethodSignature_pr223226_2() { runTest("duplicate method signature - 2"); }
- public void testDuplicateMethodSignature_pr223226() { runTest("duplicate method signature"); }
- public void testProtectedMethodsAroundAdvice_pr197719_2() { runTest("protected methods and around advice - again - 2");}
- public void testProtectedMethodsAroundAdvice_pr197719() { runTest("protected methods and around advice - again");}
- public void testProtectedMethodsAroundAdvice_pr230075() { runTest("protected methods and around advice");}
- public void testFinalStringsAnnotationPointcut_pr174385() { runTest("static strings in annotation pointcuts");}
- public void testComplexBoundsGenericAspect_pr199130_1() { runTest("complex bounds on generic aspect - 1");}
- public void testComplexBoundsGenericAspect_pr199130_2() { runTest("complex bounds on generic aspect - 2");}
- public void testComplexBoundsGenericAspect_pr199130_3() { runTest("complex bounds on generic aspect - 3");}
- public void testPrivilegedGenericAspect_pr235505() { runTest("privileged generic aspect");}
- public void testPrivilegedGenericAspect_pr235505_2() { runTest("privileged generic aspect - 2");}
- public void testParsingAroundNoReturn_pr64222() { runTest("parsing around advice no return");}
- public void testParsingBeforeArrayRef_pr159268() { runTest("before array name");}
- public void testGenericAspectAroundAdvice_pr226201() { runTest("generic aspect around advice");}
- public void testCrazyGenericsInnerTypes_pr235829() { runTest("crazy generics and inner types");}
- public void testAnnotationExposureGenerics_pr235597() { runTest("annotation exposure and generics");}
- public void testIncorrectRelationship_pr235204() {
- runTest("incorrect call relationship");
- IRelationshipMap irm = AsmManager.getDefault().getRelationshipMap();
- Set entries = irm.getEntries();
- boolean gotSomethingValid = false;
- String expected = "<recursivepackage{RecursiveCatcher.java}RecursiveCatcher~recursiveCall~I?method-call(void recursivepackage.RecursiveCatcher.recursiveCall(int))";
- for (Iterator iterator = entries.iterator(); iterator.hasNext();) {
- String str = (String) iterator.next();
- if (str.indexOf(expected)!=-1) gotSomethingValid = true;
- }
- if (!gotSomethingValid) {
- fail("Did not find a relationship with the expected data in '"+expected+"'");
- }
- }
-
-// public void testLVTableAround_pr173978() throws Exception {
-// runTest("lv table for around");
-// JavaClass jc = Utils.getClassFrom(ajc.getSandboxDirectory().getAbsolutePath(),"Test");
-// Method[] ms = jc.getMethods();
-// Method m = null;
-// for (int i = 0; i < ms.length; i++) {
-// if (ms[i].getName().equals("sayHello")) {
-// m = ms[i];
-// }
-// }
-// if (m.getLocalVariableTable()==null) fail("Local variable table should not be null");
-// print(m.getLocalVariableTable());
-// }
-
- private void print(LocalVariableTable localVariableTable) {
- LocalVariable[] lvs = localVariableTable.getLocalVariableTable();
- for (int i = 0; i < lvs.length; i++) {
+
+ // AspectJ1.6.1
+ public void testSignatureProcessing_pr237447() {
+ runTest("signature processing");
+ }
+
+ public void testGenericAtAround_pr237419() {
+ runTest("generics ataround");
+ }
+
+ public void testGenericMarkerMatch_pr203367() {
+ runTest("generic marker match");
+ }
+
+ // public void testSuperItds_pr134425() { runTest("super itds"); }
+ public void testSuperItds_pr198196_1() {
+ runTest("super itds - 2");
+ }
+
+ public void testSuperItds_pr198196_2() {
+ runTest("super itds - 3");
+ }
+
+ public void testSuperItds_pr198196_3() {
+ runTest("super itds - 4");
+ }
+
+ public void testDeow_pr237381_1() {
+ runTest("ataspectj deow - 1");
+ }
+
+ public void testDeow_pr237381_2() {
+ runTest("ataspectj deow - 2");
+ }
+
+ public void testRunningBrokenCode_pr102733_2() {
+ runTest("running broken code - 2");
+ }
+
+ public void testRunningBrokenCode_pr102733() {
+ runTest("running broken code");
+ }
+
+ public void testErrorOnNonabstractGenericAtAspectJAspect_pr168982() {
+ runTest("error on non-abstract generic ataspectj aspect");
+ }
+
+ public void testIgnoringTypeLevelSuppression_pr234933() {
+ runTest("ignoring type level suppress");
+ }
+
+ public void testDuplicateMethodSignature_pr223226_2() {
+ runTest("duplicate method signature - 2");
+ }
+
+ public void testDuplicateMethodSignature_pr223226() {
+ runTest("duplicate method signature");
+ }
+
+ public void testProtectedMethodsAroundAdvice_pr197719_2() {
+ runTest("protected methods and around advice - again - 2");
+ }
+
+ public void testProtectedMethodsAroundAdvice_pr197719() {
+ runTest("protected methods and around advice - again");
+ }
+
+ public void testProtectedMethodsAroundAdvice_pr230075() {
+ runTest("protected methods and around advice");
+ }
+
+ public void testFinalStringsAnnotationPointcut_pr174385() {
+ runTest("static strings in annotation pointcuts");
+ }
+
+ public void testComplexBoundsGenericAspect_pr199130_1() {
+ runTest("complex bounds on generic aspect - 1");
+ }
+
+ public void testComplexBoundsGenericAspect_pr199130_2() {
+ runTest("complex bounds on generic aspect - 2");
+ }
+
+ public void testComplexBoundsGenericAspect_pr199130_3() {
+ runTest("complex bounds on generic aspect - 3");
+ }
+
+ public void testPrivilegedGenericAspect_pr235505() {
+ runTest("privileged generic aspect");
+ }
+
+ public void testPrivilegedGenericAspect_pr235505_2() {
+ runTest("privileged generic aspect - 2");
+ }
+
+ public void testParsingAroundNoReturn_pr64222() {
+ runTest("parsing around advice no return");
+ }
+
+ public void testParsingBeforeArrayRef_pr159268() {
+ runTest("before array name");
+ }
+
+ public void testGenericAspectAroundAdvice_pr226201() {
+ runTest("generic aspect around advice");
+ }
+
+ public void testCrazyGenericsInnerTypes_pr235829() {
+ runTest("crazy generics and inner types");
+ }
+
+ public void testAnnotationExposureGenerics_pr235597() {
+ runTest("annotation exposure and generics");
+ }
+
+ public void testIncorrectRelationship_pr235204() {
+ runTest("incorrect call relationship");
+ IRelationshipMap irm = AsmManager.lastActiveStructureModel.getRelationshipMap();
+ Set entries = irm.getEntries();
+ boolean gotSomethingValid = false;
+ String expected = "<recursivepackage{RecursiveCatcher.java}RecursiveCatcher~recursiveCall~I?method-call(void recursivepackage.RecursiveCatcher.recursiveCall(int))";
+ for (Iterator iterator = entries.iterator(); iterator.hasNext();) {
+ String str = (String) iterator.next();
+ if (str.indexOf(expected) != -1)
+ gotSomethingValid = true;
+ }
+ if (!gotSomethingValid) {
+ fail("Did not find a relationship with the expected data in '" + expected + "'");
+ }
+ }
+
+ // public void testLVTableAround_pr173978() throws Exception {
+ // runTest("lv table for around");
+ // JavaClass jc = Utils.getClassFrom(ajc.getSandboxDirectory().getAbsolutePath(),"Test");
+ // Method[] ms = jc.getMethods();
+ // Method m = null;
+ // for (int i = 0; i < ms.length; i++) {
+ // if (ms[i].getName().equals("sayHello")) {
+ // m = ms[i];
+ // }
+ // }
+ // if (m.getLocalVariableTable()==null) fail("Local variable table should not be null");
+ // print(m.getLocalVariableTable());
+ // }
+
+ private void print(LocalVariableTable localVariableTable) {
+ LocalVariable[] lvs = localVariableTable.getLocalVariableTable();
+ for (int i = 0; i < lvs.length; i++) {
LocalVariable localVariable = lvs[i];
System.out.println(localVariable);
}
}
- public void testITDPrecedence_pr233838_1() { runTest("itd precedence - 1"); }
- public void testITDPrecedence_pr233838_2() { runTest("itd precedence - 2"); }
- public void testGetFieldGenerics_pr227401() { runTest("getfield problem with generics");}
- public void testGenericAbstractAspects_pr231478() { runTest("generic abstract aspects"); }
- public void testFieldJoinpointsAndAnnotationValues_pr227993() { runTest("field jp anno value"); }
- public void testGenericsBoundsDecp_pr231187() { runTest("generics bounds decp"); }
- public void testGenericsBoundsDecp_pr231187_2() { runTest("generics bounds decp - 2"); }
- public void testLtwInheritedCflow_pr230134() { runTest("ltw inherited cflow"); }
- public void testAroundAdviceOnFieldSet_pr229910() { runTest("around advice on field set"); }
- public void testPipelineCompilationGenericReturnType_pr226567() { runTest("pipeline compilation and generic return type"); }
-
- public static Test suite() {
- return XMLBasedAjcTestCase.loadSuite(Ajc161Tests.class);
- }
-
- protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/ajc161/ajc161.xml");
- }
-
+
+ public void testITDPrecedence_pr233838_1() {
+ runTest("itd precedence - 1");
+ }
+
+ public void testITDPrecedence_pr233838_2() {
+ runTest("itd precedence - 2");
+ }
+
+ public void testGetFieldGenerics_pr227401() {
+ runTest("getfield problem with generics");
+ }
+
+ public void testGenericAbstractAspects_pr231478() {
+ runTest("generic abstract aspects");
+ }
+
+ public void testFieldJoinpointsAndAnnotationValues_pr227993() {
+ runTest("field jp anno value");
+ }
+
+ public void testGenericsBoundsDecp_pr231187() {
+ runTest("generics bounds decp");
+ }
+
+ public void testGenericsBoundsDecp_pr231187_2() {
+ runTest("generics bounds decp - 2");
+ }
+
+ public void testLtwInheritedCflow_pr230134() {
+ runTest("ltw inherited cflow");
+ }
+
+ public void testAroundAdviceOnFieldSet_pr229910() {
+ runTest("around advice on field set");
+ }
+
+ public void testPipelineCompilationGenericReturnType_pr226567() {
+ runTest("pipeline compilation and generic return type");
+ }
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(Ajc161Tests.class);
+ }
+
+ protected File getSpecFile() {
+ return new File("../tests/src/org/aspectj/systemtest/ajc161/ajc161.xml");
+ }
+
}
\ No newline at end of file
import junit.framework.Test;
-import org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder;
import org.aspectj.asm.AsmManager;
import org.aspectj.testing.XMLBasedAjcTestCase;
import org.aspectj.testing.util.StructureModelUtil;
public class IncrementalModelTests extends org.aspectj.testing.XMLBasedAjcTestCase {
- public static Test suite() {
- return XMLBasedAjcTestCase.loadSuite(IncrementalModelTests.class);
- }
-
- protected File getSpecFile() {
- return new File("../tests/src/org/aspectj/systemtest/incremental/model/incremental-model.xml");
- }
-
- // This first test doesnt do a lot currently, but is ready too...
- public void test001() throws Exception {
- runTest("Testing incremental structure model: Intertype declarations (and a declare parents)");
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/CloneablePoint.20.java","src/introduction/CloneablePoint.java");
- nextIncrement(true);
- copyFile("changes/Point.30.java","src/introduction/Point.java");
- copyFileAndDoIncrementalBuild("changes/HashablePoint.30.java","src/introduction/HashablePoint.java");
- StructureModelUtil.checkModel("declare parents=2");
- }
-
- public void test002() throws Exception {
- runTest("Testing incremental structure model: Intertype field declarations");
-
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/secondary/BetaA.20.java","src/secondary/BetaA.java");
- StructureModelUtil.checkModel("inter-type field=2,RelationshipMapSize=3");
-
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/secondary/BetaA.30.java","src/secondary/BetaA.java");
-// TODO Andy - fix this test, what should the real results be in the model?
- // when we go slow it seems to be relmapsize=0
- // StructureModelUtil.checkModel("inter-type field=1,RelationshipMapSize=2");
- }
-
- public void test003() throws Exception{
- runTest("Testing incremental structure model: Weaving handlers");
-
- // <!-- BetaA has a new piece of handler advice added -->
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/primary/BetaA.20.java","src/primary/BetaA.java");
- if (AsmHierarchyBuilder.shouldAddUsesPointcut) {
- StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=3");
- } else {
- StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=2");
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(IncrementalModelTests.class);
+ }
+
+ protected File getSpecFile() {
+ return new File("../tests/src/org/aspectj/systemtest/incremental/model/incremental-model.xml");
}
- // <!-- secondary.GammaA added, also advises the same handler -->
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/secondary/GammaA.30.java","src/secondary/GammaA.java");
- if (AsmHierarchyBuilder.shouldAddUsesPointcut) {
- StructureModelUtil.checkModel("code=1,advice=2,RelationshipMapSize=5");
- } else {
- StructureModelUtil.checkModel("code=1,advice=2,RelationshipMapSize=3");
+ // This first test doesnt do a lot currently, but is ready too...
+ public void test001() throws Exception {
+ runTest("Testing incremental structure model: Intertype declarations (and a declare parents)");
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/CloneablePoint.20.java", "src/introduction/CloneablePoint.java");
+ nextIncrement(true);
+ copyFile("changes/Point.30.java", "src/introduction/Point.java");
+ copyFileAndDoIncrementalBuild("changes/HashablePoint.30.java", "src/introduction/HashablePoint.java");
+ StructureModelUtil.checkModel("declare parents=2");
+ }
+
+ public void test002() throws Exception {
+ runTest("Testing incremental structure model: Intertype field declarations");
+
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/secondary/BetaA.20.java", "src/secondary/BetaA.java");
+ StructureModelUtil.checkModel("inter-type field=2,RelationshipMapSize=3");
+
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/secondary/BetaA.30.java", "src/secondary/BetaA.java");
+ // TODO Andy - fix this test, what should the real results be in the model?
+ // when we go slow it seems to be relmapsize=0
+ // StructureModelUtil.checkModel("inter-type field=1,RelationshipMapSize=2");
+ }
+
+ public void test003() throws Exception {
+ runTest("Testing incremental structure model: Weaving handlers");
+
+ // <!-- BetaA has a new piece of handler advice added -->
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/primary/BetaA.20.java", "src/primary/BetaA.java");
+ // if (AsmHierarchyBuilder.shouldAddUsesPointcut) {
+ // StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=3");
+ // } else {
+ StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=2");
+ // }
+
+ // <!-- secondary.GammaA added, also advises the same handler -->
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/secondary/GammaA.30.java", "src/secondary/GammaA.java");
+ // if (AsmHierarchyBuilder.shouldAddUsesPointcut) {
+ // StructureModelUtil.checkModel("code=1,advice=2,RelationshipMapSize=5");
+ // } else {
+ StructureModelUtil.checkModel("code=1,advice=2,RelationshipMapSize=3");
+ // }
+
+ // <!-- primary.BetaA deleted -->
+ nextIncrement(true);
+ deleteFileAndDoIncrementalBuild("src/primary/BetaA.java");
+ // if (AsmHierarchyBuilder.shouldAddUsesPointcut) {
+ // StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=3");
+ // } else {
+ StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=2");
+ // }
+
}
- // <!-- primary.BetaA deleted -->
- nextIncrement(true);
- deleteFileAndDoIncrementalBuild("src/primary/BetaA.java");
- if (AsmHierarchyBuilder.shouldAddUsesPointcut) {
- StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=3");
- } else {
- StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=2");
+ public void test004() throws Exception {
+ runTest("Testing incremental structure model: Weaving");
+
+ // <!-- BetaA has a new piece of advice added -->
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/primary/BetaA.20.java", "src/primary/BetaA.java");
+ // if (AsmHierarchyBuilder.shouldAddUsesPointcut) {
+ // StructureModelUtil.checkModel("code=2,advice=2,java source file=3,RelationshipMapSize=6");
+ // } else {
+ StructureModelUtil.checkModel("code=2,advice=2,java source file=3,RelationshipMapSize=4");
+ // }
+
+ // <!-- BetaA has a piece of advice removed -->
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/primary/BetaA.30.java", "src/primary/BetaA.java");
+ // if (AsmHierarchyBuilder.shouldAddUsesPointcut) {
+ // StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=3");
+ // } else {
+ StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=2");
+ // }
+
+ // <!-- BetaA other piece of advice removed (now empty) -->
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/primary/BetaA.40.java", "src/primary/BetaA.java");
+ StructureModelUtil.checkModel("code=0,RelationshipMapSize=0,advice=0");
}
- }
-
-
- public void test004() throws Exception {
- runTest("Testing incremental structure model: Weaving");
-
- // <!-- BetaA has a new piece of advice added -->
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/primary/BetaA.20.java","src/primary/BetaA.java");
- if (AsmHierarchyBuilder.shouldAddUsesPointcut) {
- StructureModelUtil.checkModel("code=2,advice=2,java source file=3,RelationshipMapSize=6");
- } else {
- StructureModelUtil.checkModel("code=2,advice=2,java source file=3,RelationshipMapSize=4");
+ public void test005() throws Exception {
+ runTest("Testing incremental structure model: Updating files");
+
+ // <!-- Beta changed, method added -->
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/primary/Beta.20.java", "src/primary/Beta.java");
+ StructureModelUtil.checkModel("java source file=5,method=4,class=3,FileMapSize=4");
+
+ // <!-- Delta changed, class added -->
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/secondary/Delta.30.java", "src/secondary/Delta.java");
+ StructureModelUtil.checkModel("java source file=5,method=4,class=4,advice=1");
+
+ // <!-- Gamma changed, advice added -->
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/secondary/Gamma.40.java", "src/secondary/Gamma.java");
+ StructureModelUtil.checkModel("advice=2");
+
+ // <!-- Gamma changed, pointcut added -->
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/secondary/Gamma.50.java", "src/secondary/Gamma.java");
+ StructureModelUtil.checkModel("advice=2,pointcut=1");
+
+ // <!-- Gamma changed, both advice removed -->
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/secondary/Gamma.60.java", "src/secondary/Gamma.java");
+ StructureModelUtil.checkModel("advice=0,pointcut=1");
+
}
-
-
- // <!-- BetaA has a piece of advice removed -->
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/primary/BetaA.30.java","src/primary/BetaA.java");
- if (AsmHierarchyBuilder.shouldAddUsesPointcut) {
- StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=3");
- } else {
- StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=2");
+
+ public void test006() throws Exception {
+ runTest("Testing incremental structure model: Adding and removing files");
+
+ // <!-- Adds primary.Beta class -->
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/primary/Beta.20.java", "src/primary/Beta.java");
+ StructureModelUtil.checkModel("java source file=3,FileMapSize=2");
+
+ // <!-- Adds secondary.Gamma aspect -->
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/secondary/Gamma.30.java", "src/secondary/Gamma.java");
+ StructureModelUtil.checkModel("java source file=4");
+
+ // <!-- Adds secondary.Delta class -->
+ nextIncrement(true);
+ copyFileAndDoIncrementalBuild("changes/secondary/Delta.40.java", "src/secondary/Delta.java");
+ StructureModelUtil.checkModel("java source file=5,package=2,FileMapSize=4");
+
+ // <!-- Deletes Gamma aspect -->
+ nextIncrement(true);
+ deleteFileAndDoIncrementalBuild("src/secondary/Gamma.java");
+ StructureModelUtil.checkModel("java source file=4,package=2");
+
+ // <!-- Deletes Beta and Delta classes -->
+ nextIncrement(true);
+ deleteFile("src/primary/Beta.java");
+ deleteFileAndDoIncrementalBuild("src/secondary/Delta.java");
+ StructureModelUtil.checkModel("java source file=2,FileMapSize=1");
}
-
- // <!-- BetaA other piece of advice removed (now empty) -->
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/primary/BetaA.40.java","src/primary/BetaA.java");
- StructureModelUtil.checkModel("code=0,RelationshipMapSize=0,advice=0");
- }
-
- public void test005() throws Exception {
- runTest("Testing incremental structure model: Updating files");
-
- // <!-- Beta changed, method added -->
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/primary/Beta.20.java","src/primary/Beta.java");
- StructureModelUtil.checkModel("java source file=5,method=4,class=3,FileMapSize=4");
-
- // <!-- Delta changed, class added -->
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/secondary/Delta.30.java","src/secondary/Delta.java");
- StructureModelUtil.checkModel("java source file=5,method=4,class=4,advice=1");
-
- // <!-- Gamma changed, advice added -->
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/secondary/Gamma.40.java","src/secondary/Gamma.java");
- StructureModelUtil.checkModel("advice=2");
-
- // <!-- Gamma changed, pointcut added -->
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/secondary/Gamma.50.java","src/secondary/Gamma.java");
- StructureModelUtil.checkModel("advice=2,pointcut=1");
-
- // <!-- Gamma changed, both advice removed -->
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/secondary/Gamma.60.java","src/secondary/Gamma.java");
- StructureModelUtil.checkModel("advice=0,pointcut=1");
-
- }
-
- public void test006() throws Exception {
- runTest("Testing incremental structure model: Adding and removing files");
-
- // <!-- Adds primary.Beta class -->
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/primary/Beta.20.java","src/primary/Beta.java");
- StructureModelUtil.checkModel("java source file=3,FileMapSize=2");
-
- // <!-- Adds secondary.Gamma aspect -->
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/secondary/Gamma.30.java","src/secondary/Gamma.java");
- StructureModelUtil.checkModel("java source file=4");
-
- // <!-- Adds secondary.Delta class -->
- nextIncrement(true);
- copyFileAndDoIncrementalBuild("changes/secondary/Delta.40.java","src/secondary/Delta.java");
- StructureModelUtil.checkModel("java source file=5,package=2,FileMapSize=4");
-
- // <!-- Deletes Gamma aspect -->
- nextIncrement(true);
- deleteFileAndDoIncrementalBuild("src/secondary/Gamma.java");
- StructureModelUtil.checkModel("java source file=4,package=2");
-
- // <!-- Deletes Beta and Delta classes -->
- nextIncrement(true);
- deleteFile("src/primary/Beta.java");
- deleteFileAndDoIncrementalBuild("src/secondary/Delta.java");
- StructureModelUtil.checkModel("java source file=2,FileMapSize=1");
- }
-
- protected void setUp() throws Exception {
+
+ protected void setUp() throws Exception {
super.setUp();
AsmManager.attemptIncrementalModelRepairs = true;
}
-
+
protected void tearDown() throws Exception {
// To see the model after a test, uncomment these lines...
-// AsmManager.ModelInfo mi = AsmManager.ModelInfo.summarizeModel();
-// System.err.println(mi.toString());
+ // AsmManager.ModelInfo mi = AsmManager.ModelInfo.summarizeModel();
+ // System.err.println(mi.toString());
super.tearDown();
-
+
AsmManager.attemptIncrementalModelRepairs = false;
}
}
-
public void configureNewProjectDependency(String fromProjectName, String projectItDependsOn) {
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + fromProjectName);
((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).addDependancy(projectItDependsOn);
- }
-
+ }
+
public void addSourceFolderForSourceFile(String projectName, File f, String sourceFolder) {
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
- ((MultiProjTestOutputLocationManager)((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).getOutputLocationManager()).setSourceFolderFor(f,sourceFolder);
+ ((MultiProjTestOutputLocationManager) ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration())
+ .getOutputLocationManager()).setSourceFolderFor(f, sourceFolder);
}
public void setNextChangeResponse(String projName, int flags) {
return true;
}
+ // public AsmManager getStructureModelFor(String projectName) {
+ // AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
+ // returnc compiler.getStructureModelFor(projectName)
+ // }
+
/** Drives a full build **/
public boolean doFullBuild(String projectName) {
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
if (getCompiledFiles(projectName).size() == 0 && getWovenClasses(projectName).size() == 0)
sb.append("No files were compiled or woven\n");
for (Iterator iter = getCompiledFiles(projectName).iterator(); iter.hasNext();) {
- Object element = (Object) iter.next();
+ Object element = iter.next();
sb.append("compiled: " + element + "\n");
}
for (Iterator iter = getWovenClasses(projectName).iterator(); iter.hasNext();) {
- Object element = (Object) iter.next();
+ Object element = iter.next();
sb.append("woven: " + element + "\n");
}
return sb.toString();
return ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getCompiledFiles();
}
+ public AsmManager getModelFor(String projectName) {
+ AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
+ return compiler.getModel();
+ }
+
public List getWovenClasses(String projectName) {
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
return ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getWovenClasses();
import org.aspectj.ajdt.internal.core.builder.AjState;
import org.aspectj.ajdt.internal.core.builder.IncrementalStateManager;
import org.aspectj.asm.AsmManager;
-import org.aspectj.asm.IElementHandleProvider;
import org.aspectj.asm.IHierarchy;
import org.aspectj.asm.IProgramElement;
import org.aspectj.asm.IRelationship;
import org.aspectj.asm.IRelationshipMap;
-import org.aspectj.asm.internal.JDTLikeHandleProvider;
import org.aspectj.asm.internal.Relationship;
import org.aspectj.bridge.IMessage;
import org.aspectj.tools.ajc.Ajc;
// see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=false;
initialiseProject("P4");
build("P4");
- Ajc.dumpAJDEStructureModel("after full build where advice is applying");
+ Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after full build where advice is applying");
// should be 4 relationship entries
// In inc1 the first advised line is 'commented out'
alter("P4", "inc1");
build("P4");
checkWasntFullBuild();
- Ajc.dumpAJDEStructureModel("after inc build where first advised line is gone");
+ Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after inc build where first advised line is gone");
// should now be 2 relationship entries
// This will be the line 6 entry in C.java
- IProgramElement codeElement = findCode(checkForNode("pack", "C", true));
+ IProgramElement codeElement = findCode(checkForNode(getModelFor("P4"), "pack", "C", true));
// This will be the line 7 entry in A.java
- IProgramElement advice = findAdvice(checkForNode("pack", "A", true));
+ IProgramElement advice = findAdvice(checkForNode(getModelFor("P4"), "pack", "A", true));
- IRelationshipMap asmRelMap = AsmManager.getDefault().getRelationshipMap();
+ IRelationshipMap asmRelMap = getModelFor("P4").getRelationshipMap();
assertEquals("There should be two relationships in the relationship map", 2, asmRelMap.getEntries().size());
for (Iterator iter = asmRelMap.getEntries().iterator(); iter.hasNext();) {
String sourceOfRelationship = (String) iter.next();
- IProgramElement ipe = AsmManager.getDefault().getHierarchy().findElementForHandle(sourceOfRelationship);
+ IProgramElement ipe = getModelFor("P4").getHierarchy().findElementForHandle(sourceOfRelationship);
assertNotNull("expected to find IProgramElement with handle " + sourceOfRelationship + " but didn't", ipe);
if (ipe.getKind().equals(IProgramElement.Kind.ADVICE)) {
assertEquals("expected source of relationship to be " + advice.toString() + " but found " + ipe.toString(),
List targets = rel.getTargets();
for (Iterator iterator2 = targets.iterator(); iterator2.hasNext();) {
String t = (String) iterator2.next();
- IProgramElement link = AsmManager.getDefault().getHierarchy().findElementForHandle(t);
+ IProgramElement link = getModelFor("P4").getHierarchy().findElementForHandle(t);
if (ipe.getKind().equals(IProgramElement.Kind.ADVICE)) {
assertEquals("expected target of relationship to be " + codeElement.toString() + " but found "
+ link.toString(), codeElement, link);
build("Annos");
checkWasFullBuild();
checkCompileWeaveCount("Annos", 4, 4);
- assertEquals("Should be 3 relationships ", 3, AsmManager.getDefault().getRelationshipMap().getEntries().size());
+ AsmManager model = getModelFor("Annos");
+ assertEquals("Should be 3 relationships ", 3, model.getRelationshipMap().getEntries().size());
alter("Annos", "inc1"); // Comment out the annotation on Parent
build("Annos");
checkWasntFullBuild();
- assertEquals("Should be no relationships ", 0, AsmManager.getDefault().getRelationshipMap().getEntries().size());
+ assertEquals("Should be no relationships ", 0, model.getRelationshipMap().getEntries().size());
checkCompileWeaveCount("Annos", 3, 3);
alter("Annos", "inc2"); // Add the annotation back onto Parent
build("Annos");
checkWasntFullBuild();
- assertEquals("Should be 3 relationships ", 3, AsmManager.getDefault().getRelationshipMap().getEntries().size());
+ assertEquals("Should be 3 relationships ", 3, model.getRelationshipMap().getEntries().size());
checkCompileWeaveCount("Annos", 3, 3);
}
build(p);
// alter(p, "inc2");
// build(p);
- dumptree(AsmManager.getDefault().getHierarchy().getRoot(), 0);
+ AsmManager model = getModelFor(p);
+ dumptree(model.getHierarchy().getRoot(), 0);
- IProgramElement root = AsmManager.getDefault().getHierarchy().getRoot();
+ IProgramElement root = model.getHierarchy().getRoot();
IProgramElement ipe = findElementAtLine(root, 4);
assertEquals("=BrokenHandles<p{GetInfo.java}GetInfo`declare warning", ipe.getHandleIdentifier());
ipe = findElementAtLine(root, 5);
String p = "Simpler";
initialiseProject(p);
build(p);
- dumptree(AsmManager.getDefault().getHierarchy().getRoot(), 0);
+ dumptree(getModelFor(p).getHierarchy().getRoot(), 0);
// incomplete
}
String p = "BeanExample";
initialiseProject(p);
build(p);
- dumptree(AsmManager.getDefault().getHierarchy().getRoot(), 0);
+ dumptree(getModelFor(p).getHierarchy().getRoot(), 0);
PrintWriter pw = new PrintWriter(System.out);
- AsmManager.getDefault().dumprels(pw);
+ getModelFor(p).dumprels(pw);
pw.flush();
// incomplete
}
initialiseProject(p);
addSourceFolderForSourceFile(p, getProjectRelativePath(p, "src/Handles.aj"), "src");
build(p);
- IProgramElement root = AsmManager.getDefault().getHierarchy().getRoot();
+ IProgramElement root = getModelFor(p).getHierarchy().getRoot();
IProgramElement typeDecl = findElementAtLine(root, 4);
assertEquals("=AdviceHandles/src<spacewar*Handles.aj}Handles", typeDecl.getHandleIdentifier());
addSourceFolderForSourceFile("MultiSource", getProjectRelativePath("MultiSource", "src2/CodeTwo.java"), "src2");
addSourceFolderForSourceFile("MultiSource", getProjectRelativePath("MultiSource", "src3/pkg/CodeThree.java"), "src3");
build("MultiSource");
- IProgramElement srcOne = AsmManager.getDefault().getHierarchy().findElementForHandle("=MultiSource/src1");
- IProgramElement CodeOneClass = AsmManager.getDefault().getHierarchy().findElementForHandle(
+ IProgramElement srcOne = getModelFor("MultiSource").getHierarchy().findElementForHandle("=MultiSource/src1");
+ IProgramElement CodeOneClass = getModelFor("MultiSource").getHierarchy().findElementForHandle(
"=MultiSource/src1{CodeOne.java[CodeOne");
- IProgramElement srcTwoPackage = AsmManager.getDefault().getHierarchy().findElementForHandle("=MultiSource/src2<pkg");
- IProgramElement srcThreePackage = AsmManager.getDefault().getHierarchy().findElementForHandle("=MultiSource/src3<pkg");
+ IProgramElement srcTwoPackage = getModelFor("MultiSource").getHierarchy().findElementForHandle("=MultiSource/src2<pkg");
+ IProgramElement srcThreePackage = getModelFor("MultiSource").getHierarchy().findElementForHandle("=MultiSource/src3<pkg");
assertNotNull(srcOne);
assertNotNull(CodeOneClass);
assertNotNull(srcTwoPackage);
configureAspectPath(bug2, getProjectRelativePath(bug, "bin"));
build(bug);
build(bug2);
- dumptree(AsmManager.getDefault().getHierarchy().getRoot(), 0);
+ dumptree(getModelFor(bug2).getHierarchy().getRoot(), 0);
PrintWriter pw = new PrintWriter(System.out);
- AsmManager.getDefault().dumprels(pw);
+ getModelFor(bug2).dumprels(pw);
pw.flush();
- IProgramElement root = AsmManager.getDefault().getHierarchy().getRoot();
+ IProgramElement root = getModelFor(bug2).getHierarchy().getRoot();
assertEquals("=AspectPathTwo/binaries<pkg(Asp.class}Asp&before", findElementAtLine(root, 5).getHandleIdentifier());
assertEquals("=AspectPathTwo/binaries<(Asp2.class}Asp2&before", findElementAtLine(root, 16).getHandleIdentifier());
}
alter(p1, "inc1");
build(p1); // Modify the aspect Asp2 to include staticinitialization() advice
checkWasFullBuild();
- Set s = AsmManager.getDefault().getModelChangesOnLastBuild();
+ Set s = getModelFor(p1).getModelChangesOnLastBuild();
assertTrue("Should be empty as was full build:" + s, s.isEmpty());
// prod the build of the second project with some extra info to tell it more precisely about the change:
checkCompileWeaveCount("pr240360", 5, 4);
assertTrue("There should be an error:\n" + getErrorMessages("pr240360"), !getErrorMessages("pr240360").isEmpty());
- Set s = AsmManager.getDefault().getRelationshipMap().getEntries();
+ Set s = getModelFor("pr240360").getRelationshipMap().getEntries();
int relmapLength = s.size();
// Delete the erroneous type
build("pr240360");
checkWasntFullBuild();
checkCompileWeaveCount("pr240360", 0, 0);
- assertEquals(relmapLength, AsmManager.getDefault().getRelationshipMap().getEntries().size());
+ assertEquals(relmapLength, getModelFor("pr240360").getRelationshipMap().getEntries().size());
// Readd the erroneous type
alter("pr240360", "inc1");
build("pr240360");
checkWasntFullBuild();
checkCompileWeaveCount("pr240360", 1, 0);
- assertEquals(relmapLength, AsmManager.getDefault().getRelationshipMap().getEntries().size());
+ assertEquals(relmapLength, getModelFor("pr240360").getRelationshipMap().getEntries().size());
// Change the advice
alter("pr240360", "inc2");
build("pr240360");
checkWasFullBuild();
checkCompileWeaveCount("pr240360", 6, 4);
- assertEquals(relmapLength, AsmManager.getDefault().getRelationshipMap().getEntries().size());
+ assertEquals(relmapLength, getModelFor("pr240360").getRelationshipMap().getEntries().size());
}
initialiseProject("P2");
build("P1");
- checkForNode("pkg", "C", true);
+ checkForNode(getModelFor("P1"), "pkg", "C", true);
build("P2");
- checkForNode("pkg", "C", false);
+ checkForNode(getModelFor("P2"), "pkg", "C", false);
build("P1");
- checkForNode("pkg", "C", true);
+ checkForNode(getModelFor("P1"), "pkg", "C", true);
build("P2");
- checkForNode("pkg", "C", false);
+ checkForNode(getModelFor("P2"), "pkg", "C", false);
}
// Setup up two simple projects and build them in turn - check the
initialiseProject("P2");
build("P1");
- checkForNode("pkg", "C", true);
+ checkForNode(getModelFor("P1"), "pkg", "C", true);
build("P2");
- checkForNode("pkg", "C", false);
+ checkForNode(getModelFor("P2"), "pkg", "C", false);
build("P1");
- checkForNode("pkg", "C", true);
+ checkForNode(getModelFor("P1"), "pkg", "C", true);
build("P2");
- checkForNode("pkg", "C", false);
+ checkForNode(getModelFor("P2"), "pkg", "C", false);
}
/**
.get(0)).getSourceLocation().getLine());
alter("PR134541", "inc1");
build("PR134541");
- if (AsmManager.getDefault().getHandleProvider().dependsOnLocation())
- checkWasFullBuild(); // the line number has changed... but nothing
- // structural about the code
- else
- checkWasntFullBuild(); // the line number has changed... but nothing
+ // if (getModelFor("PR134541").getHandleProvider().dependsOnLocation())
+ // checkWasFullBuild(); // the line number has changed... but nothing
+ // // structural about the code
+ // else
+ checkWasntFullBuild(); // the line number has changed... but nothing
// structural about the code
assertEquals("[Xlint:adviceDidNotMatch] should now be associated with line 7", 7,
((IMessage) getWarningMessages("PR134541").get(0)).getSourceLocation().getLine());
}
public void testJDTLikeHandleProviderWithLstFile_pr141730() {
- IElementHandleProvider handleProvider = AsmManager.getDefault().getHandleProvider();
- AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider());
- try {
- // The JDTLike-handles should start with the name
- // of the buildconfig file
- initialiseProject("JDTLikeHandleProvider");
- build("JDTLikeHandleProvider");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
- IProgramElement pe = top.findElementForType("pkg", "A");
- String expectedHandle = "=JDTLikeHandleProvider<pkg*A.aj}A";
- assertEquals("expected handle to be " + expectedHandle + ", but found " + pe.getHandleIdentifier(), expectedHandle, pe
- .getHandleIdentifier());
- } finally {
- AsmManager.getDefault().setHandleProvider(handleProvider);
- }
+ // IElementHandleProvider handleProvider = AsmManager.getDefault().getHandleProvider();
+ // AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider());
+ // try {
+ // The JDTLike-handles should start with the name
+ // of the buildconfig file
+ initialiseProject("JDTLikeHandleProvider");
+ build("JDTLikeHandleProvider");
+ IHierarchy top = getModelFor("JDTLikeHandleProvider").getHierarchy();
+ IProgramElement pe = top.findElementForType("pkg", "A");
+ String expectedHandle = "=JDTLikeHandleProvider<pkg*A.aj}A";
+ assertEquals("expected handle to be " + expectedHandle + ", but found " + pe.getHandleIdentifier(), expectedHandle, pe
+ .getHandleIdentifier());
+ // } finally {
+ // AsmManager.getDefault().setHandleProvider(handleProvider);
+ // }
}
public void testMovingAdviceDoesntChangeHandles_pr141730() {
- IElementHandleProvider handleProvider = AsmManager.getDefault().getHandleProvider();
- AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider());
- try {
- initialiseProject("JDTLikeHandleProvider");
- build("JDTLikeHandleProvider");
- checkWasFullBuild();
- IHierarchy top = AsmManager.getDefault().getHierarchy();
- IProgramElement pe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE,
- "before(): <anonymous pointcut>");
- // add a line which shouldn't change the handle
- alter("JDTLikeHandleProvider", "inc1");
- build("JDTLikeHandleProvider");
- checkWasntFullBuild();
- IHierarchy top2 = AsmManager.getDefault().getHierarchy();
- IProgramElement pe2 = top.findElementForLabel(top2.getRoot(), IProgramElement.Kind.ADVICE,
- "before(): <anonymous pointcut>");
- assertEquals("expected advice to be on line " + pe.getSourceLocation().getLine() + 1 + " but was on "
- + pe2.getSourceLocation().getLine(), pe.getSourceLocation().getLine() + 1, pe2.getSourceLocation().getLine());
- assertEquals("expected advice to have handle " + pe.getHandleIdentifier() + " but found handle "
- + pe2.getHandleIdentifier(), pe.getHandleIdentifier(), pe2.getHandleIdentifier());
- } finally {
- AsmManager.getDefault().setHandleProvider(handleProvider);
- }
+ // IElementHandleProvider handleProvider = AsmManager.getDefault().getHandleProvider();
+ // AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider());
+ // try {
+ initialiseProject("JDTLikeHandleProvider");
+ build("JDTLikeHandleProvider");
+ checkWasFullBuild();
+ IHierarchy top = getModelFor("JDTLikeHandleProvider").getHierarchy();
+ IProgramElement pe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE, "before(): <anonymous pointcut>");
+ // add a line which shouldn't change the handle
+ alter("JDTLikeHandleProvider", "inc1");
+ build("JDTLikeHandleProvider");
+ checkWasntFullBuild();
+ IHierarchy top2 = getModelFor("JDTLikeHandleProvider").getHierarchy();
+ IProgramElement pe2 = top
+ .findElementForLabel(top2.getRoot(), IProgramElement.Kind.ADVICE, "before(): <anonymous pointcut>");
+ assertEquals("expected advice to be on line " + pe.getSourceLocation().getLine() + 1 + " but was on "
+ + pe2.getSourceLocation().getLine(), pe.getSourceLocation().getLine() + 1, pe2.getSourceLocation().getLine());
+ assertEquals("expected advice to have handle " + pe.getHandleIdentifier() + " but found handle "
+ + pe2.getHandleIdentifier(), pe.getHandleIdentifier(), pe2.getHandleIdentifier());
+ // } finally {
+ // AsmManager.getDefault().setHandleProvider(handleProvider);
+ // }
}
public void testSwappingAdviceAndHandles_pr141730() {
- IElementHandleProvider handleProvider = AsmManager.getDefault().getHandleProvider();
- AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider());
- try {
- initialiseProject("JDTLikeHandleProvider");
- build("JDTLikeHandleProvider");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
-
- IProgramElement call = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE, "after(): callPCD..");
- IProgramElement exec = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE, "after(): execPCD..");
- // swap the two after advice statements over. This forces
- // a full build which means 'after(): callPCD..' will now
- // be the second after advice in the file and have the same
- // handle as 'after(): execPCD..' originally did.
- alter("JDTLikeHandleProvider", "inc2");
- build("JDTLikeHandleProvider");
- checkWasFullBuild();
-
- IHierarchy top2 = AsmManager.getDefault().getHierarchy();
- IProgramElement newCall = top2.findElementForLabel(top2.getRoot(), IProgramElement.Kind.ADVICE, "after(): callPCD..");
- IProgramElement newExec = top2.findElementForLabel(top2.getRoot(), IProgramElement.Kind.ADVICE, "after(): execPCD..");
-
- assertEquals("after swapping places, expected 'after(): callPCD..' " + "to be on line "
- + newExec.getSourceLocation().getLine() + " but was on line " + call.getSourceLocation().getLine(), newExec
- .getSourceLocation().getLine(), call.getSourceLocation().getLine());
- assertEquals("after swapping places, expected 'after(): callPCD..' " + "to have handle " + exec.getHandleIdentifier()
- + " (because was full build) but had " + newCall.getHandleIdentifier(), exec.getHandleIdentifier(), newCall
- .getHandleIdentifier());
- } finally {
- AsmManager.getDefault().setHandleProvider(handleProvider);
- }
- }
+ // IElementHandleProvider handleProvider = AsmManager.getDefault().getHandleProvider();
+ // AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider());
+ // try {
+ initialiseProject("JDTLikeHandleProvider");
+ build("JDTLikeHandleProvider");
+ IHierarchy top = getModelFor("JDTLikeHandleProvider").getHierarchy();
+
+ IProgramElement call = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE, "after(): callPCD..");
+ IProgramElement exec = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE, "after(): execPCD..");
+ // swap the two after advice statements over. This forces
+ // a full build which means 'after(): callPCD..' will now
+ // be the second after advice in the file and have the same
+ // handle as 'after(): execPCD..' originally did.
+ alter("JDTLikeHandleProvider", "inc2");
+ build("JDTLikeHandleProvider");
+ checkWasFullBuild();
- public void testInitializerCountForJDTLikeHandleProvider_pr141730() {
- IElementHandleProvider handleProvider = AsmManager.getDefault().getHandleProvider();
- AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider());
- try {
- initialiseProject("JDTLikeHandleProvider");
- build("JDTLikeHandleProvider");
- String expected = "=JDTLikeHandleProvider<pkg*A.aj[C|1";
+ IHierarchy top2 = getModelFor("JDTLikeHandleProvider").getHierarchy();
+ IProgramElement newCall = top2.findElementForLabel(top2.getRoot(), IProgramElement.Kind.ADVICE, "after(): callPCD..");
+ IProgramElement newExec = top2.findElementForLabel(top2.getRoot(), IProgramElement.Kind.ADVICE, "after(): execPCD..");
- IHierarchy top = AsmManager.getDefault().getHierarchy();
- IProgramElement init = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.INITIALIZER, "...");
- assertEquals("expected initializers handle to be " + expected + "," + " but found " + init.getHandleIdentifier(true),
- expected, init.getHandleIdentifier(true));
+ assertEquals("after swapping places, expected 'after(): callPCD..' " + "to be on line "
+ + newExec.getSourceLocation().getLine() + " but was on line " + call.getSourceLocation().getLine(), newExec
+ .getSourceLocation().getLine(), call.getSourceLocation().getLine());
+ assertEquals("after swapping places, expected 'after(): callPCD..' " + "to have handle " + exec.getHandleIdentifier()
+ + " (because was full build) but had " + newCall.getHandleIdentifier(), exec.getHandleIdentifier(), newCall
+ .getHandleIdentifier());
+ // } finally {
+ // AsmManager.getDefault().setHandleProvider(handleProvider);
+ // }
+ }
- alter("JDTLikeHandleProvider", "inc2");
- build("JDTLikeHandleProvider");
- checkWasFullBuild();
+ public void testInitializerCountForJDTLikeHandleProvider_pr141730() {
+ // IElementHandleProvider handleProvider = AsmManager.getDefault().getHandleProvider();
+ // AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider());
+ // try {
+ initialiseProject("JDTLikeHandleProvider");
+ build("JDTLikeHandleProvider");
+ String expected = "=JDTLikeHandleProvider<pkg*A.aj[C|1";
+
+ IHierarchy top = getModelFor("JDTLikeHandleProvider").getHierarchy();
+ IProgramElement init = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.INITIALIZER, "...");
+ assertEquals("expected initializers handle to be " + expected + "," + " but found " + init.getHandleIdentifier(true),
+ expected, init.getHandleIdentifier(true));
+
+ alter("JDTLikeHandleProvider", "inc2");
+ build("JDTLikeHandleProvider");
+ checkWasFullBuild();
- IHierarchy top2 = AsmManager.getDefault().getHierarchy();
- IProgramElement init2 = top2.findElementForLabel(top2.getRoot(), IProgramElement.Kind.INITIALIZER, "...");
- assertEquals("expected initializers handle to still be " + expected + "," + " but found "
- + init2.getHandleIdentifier(true), expected, init2.getHandleIdentifier(true));
+ IHierarchy top2 = getModelFor("JDTLikeHandleProvider").getHierarchy();
+ IProgramElement init2 = top2.findElementForLabel(top2.getRoot(), IProgramElement.Kind.INITIALIZER, "...");
+ assertEquals(
+ "expected initializers handle to still be " + expected + "," + " but found " + init2.getHandleIdentifier(true),
+ expected, init2.getHandleIdentifier(true));
- } finally {
- AsmManager.getDefault().setHandleProvider(handleProvider);
- }
+ // } finally {
+ // AsmManager.getDefault().setHandleProvider(handleProvider);
+ // }
}
// 134471 related tests perform incremental compilation and verify features
configureNonStandardCompileOptions("PR134471", "-showWeaveInfo -emacssym");
configureShowWeaveInfoMessages("PR134471", true);
build("PR134471");
-
+ AsmManager model = getModelFor("PR134471");
// Step2. Quick check that the advice points to something...
- IProgramElement nodeForTypeA = checkForNode("pkg", "A", true);
+ IProgramElement nodeForTypeA = checkForNode(model, "pkg", "A", true);
IProgramElement nodeForAdvice = findAdvice(nodeForTypeA);
- List relatedElements = getRelatedElements(nodeForAdvice, 1);
+ List relatedElements = getRelatedElements(model, nodeForAdvice, 1);
// Step3. Check the advice applying at the first 'code' join point
// in pkg.C is from aspect pkg.A, line 7
- IProgramElement programElement = getFirstRelatedElement(findCode(checkForNode("pkg", "C", true)));
+ IProgramElement programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true)));
int line = programElement.getSourceLocation().getLine();
assertTrue("advice should be at line 7 - but is at line " + line, line == 7);
// in it
alter("PR134471", "inc1");
build("PR134471");
+ model = getModelFor("PR134471");
// Step5. Quick check that the advice points to something...
- nodeForTypeA = checkForNode("pkg", "A", true);
+ nodeForTypeA = checkForNode(model, "pkg", "A", true);
nodeForAdvice = findAdvice(nodeForTypeA);
- relatedElements = getRelatedElements(nodeForAdvice, 1);
+ relatedElements = getRelatedElements(model, nodeForAdvice, 1);
// Step6. Check the advice applying at the first 'code' join point
// in pkg.C is from aspect pkg.A, line 7
- programElement = getFirstRelatedElement(findCode(checkForNode("pkg", "C", true)));
+ programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true)));
line = programElement.getSourceLocation().getLine();
assertTrue("advice should be at line 7 - but is at line " + line, line == 7);
} finally {
configureNonStandardCompileOptions("PR134471_2", "-showWeaveInfo -emacssym");
configureShowWeaveInfoMessages("PR134471_2", true);
build("PR134471_2");
-
+ AsmManager model = getModelFor("PR134471_2");
// Step2. confirm advice is from correct location
- IProgramElement programElement = getFirstRelatedElement(findCode(checkForNode("pkg", "C", true)));
+ IProgramElement programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true)));
int line = programElement.getSourceLocation().getLine();
assertTrue("advice should be at line 7 - but is at line " + line, line == 7);
// down a few lines... (change in source location)
alter("PR134471_2", "inc1");
build("PR134471_2");
- if (AsmManager.getDefault().getHandleProvider().dependsOnLocation())
- checkWasFullBuild(); // the line number has changed... but nothing
- // structural about the code
- else
- checkWasntFullBuild(); // the line number has changed... but nothing
+ model = getModelFor("PR134471_2");
+ checkWasntFullBuild(); // the line number has changed... but nothing
// structural about the code
// checkWasFullBuild(); // this is true whilst we consider
// to until the handles are independent of location
// Step4. Check we have correctly realised the advice moved to line 11
- programElement = getFirstRelatedElement(findCode(checkForNode("pkg", "C", true)));
+ programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true)));
line = programElement.getSourceLocation().getLine();
assertTrue("advice should be at line 11 - but is at line " + line, line == 11);
}
configureNonStandardCompileOptions("PR134471", "-showWeaveInfo -emacssym");
configureShowWeaveInfoMessages("PR134471", true);
build("PR134471");
-
+ AsmManager model = getModelFor("PR134471");
// Step2. confirm advice is from correct location
- IProgramElement programElement = getFirstRelatedElement(findCode(checkForNode("pkg", "C", true)));
+ IProgramElement programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true)));
int line = programElement.getSourceLocation().getLine();
assertTrue("advice should be at line 7 - but is at line " + line, line == 7);
// Step3. No change to the aspect at all
alter("PR134471", "inc1");
build("PR134471");
-
+ model = getModelFor("PR134471");
// Step4. Quick check that the advice points to something...
- IProgramElement nodeForTypeA = checkForNode("pkg", "A", true);
+ IProgramElement nodeForTypeA = checkForNode(model, "pkg", "A", true);
IProgramElement nodeForAdvice = findAdvice(nodeForTypeA);
- List relatedElements = getRelatedElements(nodeForAdvice, 1);
+ List relatedElements = getRelatedElements(model, nodeForAdvice, 1);
// Step5. No change to the file C but it should still be advised
// afterwards
alter("PR134471", "inc2");
build("PR134471");
checkWasntFullBuild();
+ model = getModelFor("PR134471");
// Step6. confirm advice is from correct location
- programElement = getFirstRelatedElement(findCode(checkForNode("pkg", "C", true)));
+ programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true)));
line = programElement.getSourceLocation().getLine();
assertTrue("advice should be at line 7 - but is at line " + line, line == 7);
} finally {
build("PR134471_3");
checkWasFullBuild();
+ AsmManager model = getModelFor("PR134471_3");
// Step2. confirm declare warning is from correct location, decw matches
// line 7 in pkg.C
- IProgramElement programElement = getFirstRelatedElement(findCode(checkForNode("pkg", "C", true), 7));
+ IProgramElement programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 7));
int line = programElement.getSourceLocation().getLine();
assertTrue("declare warning should be at line 10 - but is at line " + line, line == 10);
// Step3. confirm advice is from correct location, advice matches line 6
// in pkg.C
- programElement = getFirstRelatedElement(findCode(checkForNode("pkg", "C", true), 6));
+ programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 6));
line = programElement.getSourceLocation().getLine();
assertTrue("advice should be at line 7 - but is at line " + line, line == 7);
// Step4. Move declare warning in the aspect
alter("PR134471_3", "inc1");
build("PR134471_3");
- if (AsmManager.getDefault().getHandleProvider().dependsOnLocation())
- checkWasFullBuild(); // the line number has changed... but nothing
- // structural about the code
- else
- checkWasntFullBuild(); // the line number has changed... but nothing
+ model = getModelFor("PR134471_3");
+ checkWasntFullBuild(); // the line number has changed... but nothing
// structural about the code
// checkWasFullBuild();
// Step5. confirm declare warning is from correct location, decw (now at
// line 12) in pkg.A matches line 7 in pkg.C
- programElement = getFirstRelatedElement(findCode(checkForNode("pkg", "C", true), 7));
+ programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 7));
line = programElement.getSourceLocation().getLine();
assertTrue("declare warning should be at line 12 - but is at line " + line, line == 12);
alter("PR134471_3", "inc2");
build("PR134471_3");
checkWasntFullBuild();
-
+ model = getModelFor("PR134471_3");
// Step7. confirm declare warning is from correct location, decw (now at
// line 12) in pkg.A matches line 7 in pkg.C
- programElement = getFirstRelatedElement(findCode(checkForNode("pkg", "C", true), 7));
+ programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 7));
line = programElement.getSourceLocation().getLine();
assertTrue("declare warning should be at line 12 - but is at line " + line, line == 12);
}
configureShowWeaveInfoMessages("PR134471_3", true);
build("PR134471_3");
checkWasFullBuild();
-
+ AsmManager model = getModelFor("PR134471_3");
// Step2. confirm declare warning is from correct location, decw matches
// line 7 in pkg.C
- IProgramElement programElement = getFirstRelatedElement(findCode(checkForNode("pkg", "C", true), 7));
+ IProgramElement programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 7));
int line = programElement.getSourceLocation().getLine();
assertTrue("declare warning should be at line 10 - but is at line " + line, line == 10);
// Step3. confirm advice is from correct location, advice matches line 6
// in pkg.C
- programElement = getFirstRelatedElement(findCode(checkForNode("pkg", "C", true), 6));
+ programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 6));
line = programElement.getSourceLocation().getLine();
assertTrue("advice should be at line 7 - but is at line " + line, line == 7);
// Step4. Move declare warning in the aspect
alter("PR134471_3", "inc1");
build("PR134471_3");
- if (AsmManager.getDefault().getHandleProvider().dependsOnLocation())
- checkWasFullBuild(); // the line number has changed... but nothing
- // structural about the code
- else
- checkWasntFullBuild(); // the line number has changed... but nothing
+ model = getModelFor("PR134471_3");
+ checkWasntFullBuild(); // the line number has changed... but nothing
// structural about the code
// checkWasFullBuild();
// Step5. confirm declare warning is from correct location, decw (now at
// line 12) in pkg.A matches line 7 in pkg.C
- programElement = getFirstRelatedElement(findCode(checkForNode("pkg", "C", true), 7));
+ programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 7));
line = programElement.getSourceLocation().getLine();
assertTrue("declare warning should be at line 12 - but is at line " + line, line == 12);
alter("PR134471_3", "inc2");
build("PR134471_3");
checkWasntFullBuild();
-
+ model = getModelFor("PR134471_3");
// Step7. confirm declare warning is from correct location, decw (now at
// line 12) in pkg.A matches line 7 in pkg.C
- programElement = getFirstRelatedElement(findCode(checkForNode("pkg", "C", true), 7));
+ programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 7));
line = programElement.getSourceLocation().getLine();
assertTrue("declare warning should be at line 12 - but is at line " + line, line == 12);
// Step9. confirm declare warning is from correct location, decw (now at
// line 12) in pkg.A matches line 7 in pkg.C
- programElement = getFirstRelatedElement(findCode(checkForNode("pkg", "C", true), 7));
+ programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 7));
line = programElement.getSourceLocation().getLine();
assertTrue("declare warning should be at line 12 - but is at line " + line, line == 12);
}
assertTrue("There should be no warnings:\n" + warnings, warnings.isEmpty());
alter("PR152589", "inc1");
build("PR152589");
- if (AsmManager.getDefault().getHandleProvider().dependsOnLocation())
- checkWasFullBuild(); // the line number has changed... but nothing
- // structural about the code
- else
- checkWasntFullBuild(); // the line number has changed... but nothing
+ checkWasntFullBuild(); // the line number has changed... but nothing
// structural about the code
// checkWasFullBuild();
}
public void testPR158573() {
- IElementHandleProvider handleProvider = AsmManager.getDefault().getHandleProvider();
- AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider());
+ // IElementHandleProvider handleProvider = AsmManager.getDefault().getHandleProvider();
+ // AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider());
initialiseProject("PR158573");
build("PR158573");
List warnings = getWarningMessages("PR158573");
checkWasntFullBuild();
warnings = getWarningMessages("PR158573");
assertTrue("There should be no warnings after changing the value of a " + "variable:\n" + warnings, warnings.isEmpty());
- AsmManager.getDefault().setHandleProvider(handleProvider);
+ // AsmManager.getDefault().setHandleProvider(handleProvider);
}
/**
* @param programElement Program element whose related elements are to be found
* @param expected the number of expected related elements
*/
- private List/* IProgramElement */getRelatedElements(IProgramElement programElement, int expected) {
- List relatedElements = getRelatedElements(programElement);
+ private List/* IProgramElement */getRelatedElements(AsmManager model, IProgramElement programElement, int expected) {
+ List relatedElements = getRelatedElements(model, programElement);
StringBuffer debugString = new StringBuffer();
if (relatedElements != null) {
for (Iterator iter = relatedElements.iterator(); iter.hasNext();) {
String element = (String) iter.next();
- debugString.append(AsmManager.getDefault().getHierarchy().findElementForHandle(element).toLabelString()).append(
- "\n");
+ debugString.append(model.getHierarchy().findElementForHandle(element).toLabelString()).append("\n");
}
}
assertTrue("Should be " + expected + " element" + (expected > 1 ? "s" : "") + " related to this one '" + programElement
return relatedElements;
}
- private IProgramElement getFirstRelatedElement(IProgramElement programElement) {
- List rels = getRelatedElements(programElement, 1);
- return AsmManager.getDefault().getHierarchy().findElementForHandle((String) rels.get(0));
+ private IProgramElement getFirstRelatedElement(AsmManager model, IProgramElement programElement) {
+ List rels = getRelatedElements(model, programElement, 1);
+ return model.getHierarchy().findElementForHandle((String) rels.get(0));
}
- private List/* IProgramElement */getRelatedElements(IProgramElement advice) {
+ private List/* IProgramElement */getRelatedElements(AsmManager model, IProgramElement advice) {
List output = null;
- IRelationshipMap map = AsmManager.getDefault().getRelationshipMap();
+ IRelationshipMap map = model.getRelationshipMap();
List/* IRelationship */rels = map.get(advice);
if (rels == null)
fail("Did not find any related elements!");
// --------------------------------------------------------------------------
// -------------------------
- private IProgramElement checkForNode(String packageName, String typeName, boolean shouldBeFound) {
- IProgramElement ipe = AsmManager.getDefault().getHierarchy().findElementForType(packageName, typeName);
+ private IProgramElement checkForNode(AsmManager model, String packageName, String typeName, boolean shouldBeFound) {
+ IProgramElement ipe = model.getHierarchy().findElementForType(packageName, typeName);
if (shouldBeFound) {
if (ipe == null)
- printModel();
+ printModel(model);
assertTrue("Should have been able to find '" + packageName + "." + typeName + "' in the asm", ipe != null);
} else {
if (ipe != null)
- printModel();
+ printModel(model);
assertTrue("Should have NOT been able to find '" + packageName + "." + typeName + "' in the asm", ipe == null);
}
return ipe;
}
- private void printModel() {
+ private void printModel(AsmManager model) {
try {
- AsmManager.dumptree(AsmManager.getDefault().getHierarchy().getRoot(), 0);
+ AsmManager.dumptree(model.getHierarchy().getRoot(), 0);
} catch (IOException e) {
e.printStackTrace();
}
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IElementHandleProvider;
import org.aspectj.asm.IModelFilter;
-import org.aspectj.asm.internal.JDTLikeHandleProvider;
import org.aspectj.testing.XMLBasedAjcTestCase;
import org.aspectj.util.FileUtil;
/**
- * This class provides an extension to the XMLBasedAjcTestCase to manage
- * testing the model. It assumes the testdata is in ../tests/model/<testid>
- * and that the expected model against which to do the comparison is in
- * the file ../tests/model/expected/<testid>.txt. One test ensures that both
- * the model and the relationship map are as expected for the given testdata.
+ * This class provides an extension to the XMLBasedAjcTestCase to manage testing the model. It assumes the testdata is in
+ * ../tests/model/<testid> and that the expected model against which to do the comparison is in the file
+ * ../tests/model/expected/<testid>.txt. One test ensures that both the model and the relationship map are as expected for the given
+ * testdata.
*
- * To write a testcase, create a testdata directory containing the data
- * for the test run and a file containing the expected model (this can be
- * generated by setting the regenerate flag to true). Add the required
- * configuration to model.xml. Finally, create a testcase in either ModelTests
- * or Model5Tests (depending on whether the testcase has a requirement
- * on Java5) and call runModelTest(<title of test>,<testid>).
+ * To write a testcase, create a testdata directory containing the data for the test run and a file containing the expected model
+ * (this can be generated by setting the regenerate flag to true). Add the required configuration to model.xml. Finally, create a
+ * testcase in either ModelTests or Model5Tests (depending on whether the testcase has a requirement on Java5) and call
+ * runModelTest(<title of test>,<testid>).
*/
public abstract class ModelTestCase extends XMLBasedAjcTestCase {
protected static boolean regenerate = false;
protected static boolean debugTest = false;
- private final String expectedOutDir = "../tests/model/expected" + File.separator;
+ private final String expectedOutDir = "../tests/model/expected" + File.separator;
private String testid;
-
+
private String modelFilename;
-
+
private IElementHandleProvider handleProvider;
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
super.setUp();
// using the JDTLikeHandleProvider because this produces consistent handles
// over different compiles
- handleProvider = AsmManager.getDefault().getHandleProvider();
- AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider());
// We are about to create a sandbox for the model output file, don't let the
// following compile wipe it.
ajc.setShouldEmptySandbox(false);
// report all information - model, relationships delta processing
modelFilename = ajc.getSandboxDirectory().getAbsolutePath() + File.separator + "model.txt";
- AsmManager.setReporting(modelFilename,
- true,true,true,false,new TestFilter(ajc.getSandboxDirectory().getCanonicalPath()));
+ AsmManager.setReporting(modelFilename, true, true, true, false,
+ new TestFilter(ajc.getSandboxDirectory().getCanonicalPath()));
}
-
+
static class TestFilter implements IModelFilter {
- String sandboxDirectory ;
+ String sandboxDirectory;
+
public TestFilter(String sandboxDirectory) {
this.sandboxDirectory = sandboxDirectory;
}
int forwardSlash = sub.indexOf("/");
// replace all "/" with "\" - to ensure platform independence
if (forwardSlash != -1) {
- sub = sub.replace('/','\\');
+ sub = sub.replace('/', '\\');
}
// don't report the column number since this is sometimes
// different on windows and linux
int column = sub.lastIndexOf(':');
if (column != -1) {
- return "TEST_SANDBOX" + sub.substring(0,column);
+ return "TEST_SANDBOX" + sub.substring(0, column);
}
- return "TEST_SANDBOX"+sub;
+ return "TEST_SANDBOX" + sub;
}
return loc;
}
return false;
}
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see junit.framework.TestCase#tearDown()
*/
protected void tearDown() throws Exception {
super.tearDown();
- AsmManager.getDefault().setHandleProvider(handleProvider);
AsmManager.setDontReport();
ajc.setShouldEmptySandbox(true);
}
-
+
/**
- * Firstly sets the testid which is both the name of the expected output
- * file and the name of the testdata directory. It then
- * invokes XMLBasedAjcTestCase.runTest(String) with the given
- * title and finally verifies that the model file created from this test
- * run is the same as the expected output (includes model information, the
- * relationship map and various properties about the model) contained
- * in ../tests/model/expected/<testid>.txt
+ * Firstly sets the testid which is both the name of the expected output file and the name of the testdata directory. It then
+ * invokes XMLBasedAjcTestCase.runTest(String) with the given title and finally verifies that the model file created from this
+ * test run is the same as the expected output (includes model information, the relationship map and various properties about
+ * the model) contained in ../tests/model/expected/<testid>.txt
*/
- protected void runModelTest(String title,String testid) {
+ protected void runModelTest(String title, String testid) {
this.testid = testid;
runTest(title);
verifyModel();
}
-
+
private void verifyModel() {
File expectedOutput = new File(expectedOutDir + testid + ".txt");
if (regenerate) {
compareModel(expectedOutput);
}
}
-
+
private void compareModel(File expectedF) {
- if (debugTest) System.out.println("comparing with model in file " + expectedF.getAbsolutePath());
+ if (debugTest)
+ System.out.println("comparing with model in file " + expectedF.getAbsolutePath());
List fileContents = new ArrayList();
try {
String sandboxDir = ajc.getSandboxDirectory().getAbsolutePath();
String modelOutput = modelFilename;
// Load the file with the expected output
BufferedReader expect = new BufferedReader(new FileReader(expectedF));
-// String tempDir = expect.readLine();
+ // String tempDir = expect.readLine();
String expectedLine = null;
- while((expectedLine=expect.readLine())!=null) {
- fileContents.add(expectedLine);
+ while ((expectedLine = expect.readLine()) != null) {
+ fileContents.add(expectedLine);
}
List expectedFileContents = new ArrayList();
expectedFileContents.addAll(fileContents);
-
+
// Load the file with the output from this test run
BufferedReader found = new BufferedReader(new FileReader(new File(modelOutput)));
String foundLine = null;
List foundFileContents = new ArrayList();
- while((foundLine=found.readLine())!=null) {
-// int i = foundLine.indexOf(sandboxDir);
-// if (i == -1) {
-// int j = foundLine.indexOf("(targets=");
-// if (j == -1) {
- foundFileContents.add(foundLine);
-// } else {
-// foundFileContents.add(foundLine.substring(j));
-// }
-// } else {
-// String newLine = foundLine.substring(0,i) + tempDir
-// + foundLine.substring(i + sandboxDir.length());
-// foundFileContents.add(newLine);
-// }
+ while ((foundLine = found.readLine()) != null) {
+ // int i = foundLine.indexOf(sandboxDir);
+ // if (i == -1) {
+ // int j = foundLine.indexOf("(targets=");
+ // if (j == -1) {
+ foundFileContents.add(foundLine);
+ // } else {
+ // foundFileContents.add(foundLine.substring(j));
+ // }
+ // } else {
+ // String newLine = foundLine.substring(0,i) + tempDir
+ // + foundLine.substring(i + sandboxDir.length());
+ // foundFileContents.add(newLine);
+ // }
}
-
+
// iterate over what we found
for (Iterator iter = foundFileContents.iterator(); iter.hasNext();) {
String line = (String) iter.next();
- if (debugTest) System.err.println("looking at model entry: " + line);
+ if (debugTest)
+ System.err.println("looking at model entry: " + line);
if (!fileContents.contains(line)) {
-// if (!((String)fileContents.get(lineNumber)).equals(line)) {
-
- if(debugTest) {
+ // if (!((String)fileContents.get(lineNumber)).equals(line)) {
+
+ if (debugTest) {
System.err.println("couldn't find: " + line);
- for (Iterator iterator = fileContents.iterator(); iterator
- .hasNext();) {
+ for (Iterator iterator = fileContents.iterator(); iterator.hasNext();) {
String element = (String) iterator.next();
System.err.println("compared with: " + element);
}
}
-
-// StringBuffer errorData = new StringBuffer();
-// errorData.append("Problem with comparison at line number: "+)
+
+ // StringBuffer errorData = new StringBuffer();
+ // errorData.append("Problem with comparison at line number: "+)
fail("couldn't find model entry '" + line + "' in expected output");
} else {
fileContents.remove(line);
}
}
-
+
if (debugTest && !fileContents.isEmpty()) {
- for (Iterator iter = fileContents.iterator(); iter
- .hasNext();) {
+ for (Iterator iter = fileContents.iterator(); iter.hasNext();) {
String element = (String) iter.next();
System.err.println("remaining: " + element);
}
}
- assertTrue("should have found all expected model output: " + fileContents,fileContents.isEmpty());
+ assertTrue("should have found all expected model output: " + fileContents, fileContents.isEmpty());
} catch (Exception e) {
- fail("Unexpected exception comparing model files:"+e);
+ fail("Unexpected exception comparing model files:" + e);
}
}
-
+
private void saveModel(File f) {
- if (debugTest) System.out.println("Saving model into "+f.getAbsolutePath());
- File modelFile = new File(modelFilename);
+ if (debugTest)
+ System.out.println("Saving model into " + f.getAbsolutePath());
+ File modelFile = new File(modelFilename);
try {
FileUtil.copyFile(modelFile, f);
} catch (IOException ioe) {
ioe.printStackTrace();
- fail("Couldn't copy file to "+f.toString());
+ fail("Couldn't copy file to " + f.toString());
}
}
import junit.framework.Test;
-import org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder;
import org.aspectj.testing.XMLBasedAjcTestCase;
import org.aspectj.weaver.World;
}
}
- public void testPCDInClassAppearsInModel_pr148027() {
- boolean b = AsmHierarchyBuilder.shouldAddUsesPointcut;
- AsmHierarchyBuilder.shouldAddUsesPointcut = true;
- World.createInjarHierarchy = false;
- try {
- runModelTest("ensure pcd declare in class appears in model", "pr148027");
- } finally {
- World.createInjarHierarchy = true;
- AsmHierarchyBuilder.shouldAddUsesPointcut = b;
- }
- }
+ //
+ // public void testPCDInClassAppearsInModel_pr148027() {
+ // boolean b = AsmHierarchyBuilder.shouldAddUsesPointcut;
+ // AsmHierarchyBuilder.shouldAddUsesPointcut = true;
+ // World.createInjarHierarchy = false;
+ // try {
+ // runModelTest("ensure pcd declare in class appears in model", "pr148027");
+ // } finally {
+ // World.createInjarHierarchy = true;
+ // AsmHierarchyBuilder.shouldAddUsesPointcut = b;
+ // }
+ // }
// public void testInpathAdvisedCode_prX() { runModelTest("inpath advised elements","prX"); }